mirror of
https://github.com/ibelick/ui-skills.git
synced 2026-09-14 18:43:13 +08:00
perf: bypass Worker for static routes
This commit is contained in:
@@ -13,6 +13,10 @@
|
||||
/analytics/*
|
||||
Cache-Control: public, max-age=3600
|
||||
|
||||
/mcp.json
|
||||
Cache-Control: public, max-age=300, s-maxage=3600, stale-while-revalidate=86400
|
||||
Content-Type: application/json; charset=utf-8
|
||||
|
||||
/_astro/*
|
||||
Cache-Control: public, max-age=31536000, immutable
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "UI Skills MCP",
|
||||
"version": "0.2.4",
|
||||
"protocol": "mcp",
|
||||
"endpoint": "https://www.ui-skills.com/mcp",
|
||||
"registry": "https://www.ui-skills.com/skills/registry.json",
|
||||
"tools": ["list_skills", "get_skill"]
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { APIRoute } from "astro";
|
||||
import { getGithubStars } from "../../lib/github-stars.ts";
|
||||
|
||||
export const prerender = true;
|
||||
|
||||
export const GET: APIRoute = async () => {
|
||||
const stars = await getGithubStars();
|
||||
return Response.json(stars, {
|
||||
|
||||
@@ -123,6 +123,21 @@ try {
|
||||
throw new Error("First-party One Dollar Stats script is missing");
|
||||
}
|
||||
|
||||
const mcpMetadata = await fetchLocal("/mcp.json");
|
||||
if (mcpMetadata.status !== 200) {
|
||||
throw new Error(`Static MCP metadata returned ${mcpMetadata.status}`);
|
||||
}
|
||||
const mcpMetadataType = mcpMetadata.headers.get("content-type") ?? "";
|
||||
if (!mcpMetadataType.startsWith("application/json")) {
|
||||
throw new Error(`Static MCP metadata returned unexpected type: ${mcpMetadataType}`);
|
||||
}
|
||||
if (mcpMetadata.headers.get("cache-control") === null) {
|
||||
throw new Error("Static MCP metadata is missing cache headers");
|
||||
}
|
||||
if (!(await mcpMetadata.text()).includes('"UI Skills MCP"')) {
|
||||
throw new Error("Static MCP metadata is invalid");
|
||||
}
|
||||
|
||||
const analyticsProxy = await fetchLocal("/analytics/events", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
||||
+2
-1
@@ -6,9 +6,10 @@
|
||||
"directory": "./dist",
|
||||
"binding": "ASSETS",
|
||||
"not_found_handling": "404-page",
|
||||
"html_handling": "drop-trailing-slash",
|
||||
"run_worker_first": [
|
||||
"/api/*",
|
||||
"/mcp",
|
||||
"/mcp/rpc",
|
||||
"/oauth/*",
|
||||
"/_server-islands/*",
|
||||
"/_image",
|
||||
|
||||
Reference in New Issue
Block a user