demo 20-4-2026

This commit is contained in:
taDuc
2026-04-19 23:43:31 +07:00
parent 34e709cea4
commit 7804ef842b
6 changed files with 105 additions and 17 deletions

View File

@@ -33,7 +33,7 @@ router.get("/:z/:x/:y", (req, res) => {
const y = Number(req.params.y);
if (!Number.isInteger(z) || !Number.isInteger(x) || !Number.isInteger(y)) {
return res.status(400).send("Invalid tile coordinates");
return res.status(400).json({ error: "Invalid tile coordinates" });
}
const tmsY = (1 << z) - 1 - y;
@@ -47,7 +47,7 @@ router.get("/:z/:x/:y", (req, res) => {
`).get(z, x, tmsY);
if (!tile) {
return res.status(404).send("Tile not found");
return res.status(404).json({ error: "Tile not found" });
}
res.setHeader("Content-Type", contentType);

View File

@@ -289,9 +289,9 @@ router.post("/:sectionId/submit", (req, res) => {
throw createHttpError("Section is not editable", 409);
}
const commitId = normalizeId(req.body?.commit_id) || state.head_commit_id;
const commitId = state.head_commit_id;
if (!commitId) {
throw createHttpError("Section has no commit to submit", 400);
throw createHttpError("Section has no head commit to submit", 400);
}
const commit = getCommitForSection(section.id, commitId);

View File

@@ -47,7 +47,7 @@ router.get("/:z/:x/:y", (req, res) => {
const y = Number(req.params.y);
if (!Number.isInteger(z) || !Number.isInteger(x) || !Number.isInteger(y)) {
return res.status(400).send("Invalid tile coordinates");
return res.status(400).json({ error: "Invalid tile coordinates" });
}
// convert XYZ → TMS
@@ -64,7 +64,7 @@ router.get("/:z/:x/:y", (req, res) => {
const tile = stmt.get(z, x, tmsY);
if (!tile) {
return res.status(404).send("Tile not found");
return res.status(404).json({ error: "Tile not found" });
}
res.setHeader("Content-Type", contentType);