release: WRNexusJS 0.4.0
This commit is contained in:
@@ -2,6 +2,7 @@ import type { DevToolbarCollector } from "./collector.ts";
|
||||
import { DEV_TOOLBAR_CSS, DEV_TOOLBAR_RUNTIME } from "../client/index.ts";
|
||||
import { openInEditor } from "./editor.ts";
|
||||
import { serializeDevToolbarJson } from "./serialize.ts";
|
||||
import type { DevToolbarPanel, DevToolbarPlatformSnapshot } from "../types.ts";
|
||||
|
||||
export interface DevToolbarRouteOptions {
|
||||
mode: string;
|
||||
@@ -9,6 +10,8 @@ export interface DevToolbarRouteOptions {
|
||||
collector: DevToolbarCollector;
|
||||
editor?: string;
|
||||
allowOpenEditor?: boolean;
|
||||
platform?: DevToolbarPlatformSnapshot;
|
||||
panels?: DevToolbarPanel[];
|
||||
}
|
||||
|
||||
const json = (value: unknown, status = 200) =>
|
||||
@@ -36,6 +39,8 @@ export async function handleDevToolbarRoute(
|
||||
return json({
|
||||
issues: options.collector.getIssues(url.searchParams.get("pathname") ?? undefined),
|
||||
});
|
||||
if (url.pathname === "/__wrnexus/dev-toolbar/platform" && request.method === "GET")
|
||||
return json({ platform: options.platform ?? null, panels: options.panels ?? [] });
|
||||
if (url.pathname === "/__wrnexus/dev-toolbar/open-editor" && request.method === "POST") {
|
||||
if (options.allowOpenEditor === false)
|
||||
return json({ error: "Open in editor is disabled." }, 403);
|
||||
|
||||
Reference in New Issue
Block a user