Spaces:
Running
Running
Update server.mjs
Browse files- server.mjs +2 -2
server.mjs
CHANGED
|
@@ -130,13 +130,13 @@ const server = http.createServer(async (req, res) => {
|
|
| 130 |
}
|
| 131 |
}
|
| 132 |
|
| 133 |
-
const jobMatch = url.pathname.match(/^\
|
| 134 |
if (req.method === "GET" && jobMatch) {
|
| 135 |
const job = jobs.get(jobMatch[1]);
|
| 136 |
return job ? json(res, 200, job) : json(res, 404, { error: "job not found" });
|
| 137 |
}
|
| 138 |
|
| 139 |
-
const downloadMatch = url.pathname.match(/^\
|
| 140 |
if (req.method === "GET" && downloadMatch) {
|
| 141 |
const job = jobs.get(downloadMatch[1]);
|
| 142 |
if (!job || job.status !== "ready") return json(res, 404, { error: "optimized file not ready" });
|
|
|
|
| 130 |
}
|
| 131 |
}
|
| 132 |
|
| 133 |
+
const jobMatch = url.pathname.match(/^\/jobs\/([a-f0-9-]+)$/);
|
| 134 |
if (req.method === "GET" && jobMatch) {
|
| 135 |
const job = jobs.get(jobMatch[1]);
|
| 136 |
return job ? json(res, 200, job) : json(res, 404, { error: "job not found" });
|
| 137 |
}
|
| 138 |
|
| 139 |
+
const downloadMatch = url.pathname.match(/^\/download\/([a-f0-9-]+)$/);
|
| 140 |
if (req.method === "GET" && downloadMatch) {
|
| 141 |
const job = jobs.get(downloadMatch[1]);
|
| 142 |
if (!job || job.status !== "ready") return json(res, 404, { error: "optimized file not ready" });
|