first commit

This commit is contained in:
Matt Kane
2026-04-01 10:44:22 +01:00
commit 43fcb9a131
1789 changed files with 395041 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
/**
* x402 Astro Middleware
*
* Injected by the x402 integration. Creates the enforcer and
* places it on Astro.locals.x402 for use in page frontmatter.
*
* The config is passed via the virtual module resolved by the integration.
*/
import { defineMiddleware } from "astro:middleware";
// The integration injects config via a virtual module.
// @ts-ignore -- virtual module, resolved at build time
import x402Config from "virtual:x402/config";
import { createEnforcer } from "./enforcer.js";
import type { X402Config } from "./types.js";
const config = x402Config as X402Config;
const enforcer = createEnforcer(config);
export const onRequest = defineMiddleware(async (context, next) => {
context.locals.x402 = enforcer;
return next();
});