hooks env update
This commit is contained in:
parent
0e30d0a539
commit
4465d1d567
|
@ -1,8 +1,13 @@
|
|||
import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
|
||||
import * as Sentry from '@sentry/sveltekit';
|
||||
import {
|
||||
PUBLIC_SENTRY_KEY,
|
||||
PUBLIC_SENTRY_PROJECT_ID,
|
||||
PUBLIC_SENTRY_ORG_ID
|
||||
} from '$env/static/public';
|
||||
|
||||
Sentry.init({
|
||||
dsn: 'https://962a7ed3891a335e112746e5c6c6bf42@o4505828687478784.ingest.us.sentry.io/4506871754326016',
|
||||
dsn: `https://${PUBLIC_SENTRY_KEY}@${PUBLIC_SENTRY_ORG_ID}.ingest.us.sentry.io/${PUBLIC_SENTRY_PROJECT_ID}`,
|
||||
tracesSampleRate: 1.0,
|
||||
|
||||
// This sets the sample rate to be 10%. You may want this to be 100% while
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { Handle } from '@sveltejs/kit';
|
||||
import { sequence } from "@sveltejs/kit/hooks";
|
||||
import { sequence } from '@sveltejs/kit/hooks';
|
||||
|
||||
import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
|
||||
import { handleErrorWithSentry, sentryHandle } from '@sentry/sveltekit';
|
||||
import * as Sentry from '@sentry/sveltekit';
|
||||
import {
|
||||
PUBLIC_SENTRY_KEY,
|
||||
|
@ -15,8 +15,8 @@ import * as amp from '@sveltejs/amp';
|
|||
import dropcss from 'dropcss';
|
||||
|
||||
Sentry.init({
|
||||
dsn: 'https://962a7ed3891a335e112746e5c6c6bf42@o4505828687478784.ingest.us.sentry.io/4506871754326016',
|
||||
tracesSampleRate: 1.0,
|
||||
dsn: `https://${PUBLIC_SENTRY_KEY}@${PUBLIC_SENTRY_ORG_ID}.ingest.us.sentry.io/${PUBLIC_SENTRY_PROJECT_ID}`,
|
||||
tracesSampleRate: 1.0
|
||||
});
|
||||
|
||||
export const cspHandle: Handle = async ({ event, resolve }) => {
|
||||
|
@ -35,14 +35,14 @@ export const cspHandle: Handle = async ({ event, resolve }) => {
|
|||
'Content-Security-Policy': csp,
|
||||
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload',
|
||||
'Expect-CT': `max-age=86400, report-uri="https://${PUBLIC_SENTRY_ORG_ID}.ingest.us.sentry.io/api/${PUBLIC_SENTRY_PROJECT_ID}/security/?sentry_key=${PUBLIC_SENTRY_KEY}"`,
|
||||
'Report-To': `{group: "csp-endpoint", "max_age": 10886400, "endpoints": [{"url": "https://${PUBLIC_SENTRY_ORG_ID}.ingest.us.sentry.io/api/${PUBLIC_SENTRY_PROJECT_ID}/security/?sentry_key=${PUBLIC_SENTRY_KEY}/security/?sentry_key=${PUBLIC_SENTRY_KEY}"}]}`,
|
||||
'Report-To': `{group: "csp-endpoint", "max_age": 10886400, "endpoints": [{"url": "https://${PUBLIC_SENTRY_ORG_ID}.ingest.us.sentry.io/api/${PUBLIC_SENTRY_PROJECT_ID}/security/?sentry_key=${PUBLIC_SENTRY_KEY}"}]}`
|
||||
};
|
||||
|
||||
Object.entries(headers).forEach(([key, value]) => {
|
||||
response.headers.set(key, value);
|
||||
});
|
||||
return response;
|
||||
}
|
||||
};
|
||||
|
||||
export const ampHandle: Handle = async ({ event, resolve }) => {
|
||||
let buffer = '';
|
||||
|
@ -55,15 +55,18 @@ export const ampHandle: Handle = async ({ event, resolve }) => {
|
|||
const markup = amp
|
||||
.transform(buffer)
|
||||
.replace('⚡', 'amp') // dropcss can't handle this character
|
||||
.replace(/<style amp-custom([^>]*?)>([^]+?)<\/style>/, (match, attributes, contents) => {
|
||||
.replace(
|
||||
/<style amp-custom([^>]*?)>([^]+?)<\/style>/,
|
||||
(match, attributes, contents) => {
|
||||
css = contents;
|
||||
return `<style amp-custom${attributes}></style>`;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
css = dropcss({ css, html: markup }).css;
|
||||
return markup.replace('</style>', `${css}</style>`);
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue