feat: add support for CSP (#72)
This commit adds support for running with CSP. CSP can be enabled on a per page basis. If this is done, fresh will set a default CSP that is very restrictive. Users can modify the CSP with the `useCSP` hook. Fresh will add its own script resources to the CSP automatically.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/** @jsx h */
|
||||
import { h, HandlerContext, Suspense, useData } from "../deps.ts";
|
||||
import { h, HandlerContext, PageConfig, Suspense, useData } from "../deps.ts";
|
||||
import { getDatabase, Todo } from "../utils/database.ts";
|
||||
|
||||
export default function TodoListPage() {
|
||||
@@ -48,3 +48,5 @@ export const handler = {
|
||||
return Response.redirect(ctx.req.url, 303);
|
||||
},
|
||||
};
|
||||
|
||||
export const config: PageConfig = { csp: true };
|
||||
|
||||
Reference in New Issue
Block a user