-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): use package updates + extensive setup with Mantine
as requested in #34 good opportunity to test the lib with another great UI framework and CSS-in-JS lib
- Loading branch information
Showing
12 changed files
with
502 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,33 @@ | ||
import { | ||
chain, | ||
csp, | ||
nextSafe, | ||
strictDynamic, | ||
strictInlineStyles, | ||
reporting, | ||
} from "@next-safe/middleware"; | ||
|
||
const isDev = process.env.NODE_ENV === "development"; | ||
const reportOnly = !!process.env.CSP_REPORT_ONLY; | ||
|
||
const nextSafeMiddleware = nextSafe((req) => { | ||
return { | ||
isDev, | ||
contentSecurityPolicy: { | ||
reportOnly, | ||
"frame-src": [`'self'`, req.nextUrl.origin], | ||
const securityMiddleware = [ | ||
nextSafe({ disableCsp: true }), | ||
csp({ | ||
directives: { | ||
"frame-src": ["self"], | ||
"img-src": ["self", "data:", "https://images.unsplash.com"], | ||
"font-src": ["self", "https://fonts.gstatic.com"], | ||
"connect-src": ["self", "sentry.io"], | ||
}, | ||
// customize as you need: https://trezy.gitbook.io/next-safe/usage/configuration | ||
}; | ||
}); | ||
|
||
const reportingMiddleware = reporting((req) => { | ||
const nextApiReportEndpoint = `/api/reporting`; | ||
return { | ||
}), | ||
strictDynamic(), | ||
strictInlineStyles(), | ||
reporting({ | ||
csp: { | ||
reportUri: process.env.CSP_REPORT_URI || nextApiReportEndpoint, | ||
reportUri: "/api/reporting" | ||
}, | ||
reportTo: { | ||
max_age: 1800, | ||
endpoints: [ | ||
{ | ||
url: process.env.REPORT_TO_ENDPOINT_DEFAULT || nextApiReportEndpoint, | ||
}, | ||
], | ||
endpoints: [{ url: "/api/reporting" }], | ||
}, | ||
}; | ||
}); | ||
|
||
const securityMiddleware = [ | ||
nextSafeMiddleware, | ||
strictDynamic(), | ||
strictInlineStyles({ | ||
extendStyleSrc: false, | ||
}), | ||
reportingMiddleware, | ||
]; | ||
|
||
export default chain(...securityMiddleware); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
import { reporting } from "@next-safe/middleware/dist/api"; | ||
import { | ||
reporting, | ||
sentryCspReporterForEndpoint, | ||
} from "@next-safe/middleware/dist/api"; | ||
|
||
export default reporting(data => console.log(JSON.stringify(data))); | ||
const sentryCspEndpoint = process.env.SENTRY_CSP_ENDPOINT; | ||
|
||
const consoleLogReporter = (data) => | ||
console.log(JSON.stringify(data, undefined, 2)); | ||
|
||
export default reporting( | ||
consoleLogReporter, | ||
...(sentryCspEndpoint | ||
? [sentryCspReporterForEndpoint(sentryCspEndpoint)] | ||
: []) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import MantinePage from "./index"; | ||
|
||
export const getStaticProps = () => { | ||
return { props: {} }; | ||
}; | ||
|
||
export default MantinePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import MantinePage from "./index"; | ||
|
||
export const getServerSideProps = () => { | ||
return { props: {} }; | ||
}; | ||
|
||
export default MantinePage; |
Oops, something went wrong.