mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-19 16:16:45 +00:00
fix(site): route plugin detail pages through worker shell
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { test } from "vitest";
|
||||
import { issueRedirectPath, pluginDetailShellRequest, sanitizeReturnTo, signPayload, staticAssetCacheControl, verifySignedPayload } from "../worker";
|
||||
|
||||
test("plugin detail shell routes are routed to the worker before static 404 handling", () => {
|
||||
const wrangler = JSON.parse(readFileSync(new URL("../wrangler.json", import.meta.url), "utf8"));
|
||||
const runWorkerFirst: string[] = wrangler.assets.run_worker_first;
|
||||
for (const prefix of ["/cn/plugins", "/en/plugins"]) {
|
||||
assert.ok(
|
||||
runWorkerFirst.includes(`${prefix}/*`),
|
||||
`${prefix}/* missing from run_worker_first; the asset layer would serve the static 404 before the worker shell fallback runs`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("signed OAuth payloads round-trip and reject tampering", async () => {
|
||||
const signed = await signPayload({ login: "dbx-user" }, "test-secret");
|
||||
assert.deepEqual(await verifySignedPayload<{ login: string }>(signed, "test-secret"), { login: "dbx-user" });
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
"not_found_handling": "404-page",
|
||||
"run_worker_first": [
|
||||
"/api/*",
|
||||
"/cn/plugins/*",
|
||||
"/en/plugins/*",
|
||||
"/tr",
|
||||
"/tr/*",
|
||||
"/issue",
|
||||
|
||||
Reference in New Issue
Block a user