chore: update posthug and change all 301 to 307

This commit is contained in:
Rotimi Best
2023-12-14 22:41:16 +03:00
parent 5f2037101b
commit 845b87b21f
12 changed files with 24 additions and 40 deletions
@@ -3,10 +3,9 @@ import { client } from '$lib/utils/posthog';
export const load = ({ request }) => { export const load = ({ request }) => {
client.capture({ client.capture({
distinctId: distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
request.headers.get('x-forwarded-for') || new Date().getTime().toString(), event: 'cal.com page visited'
event: 'cal.com page visited',
}); });
throw redirect(301, 'https://cal.com/classroomio/demo'); throw redirect(307, 'https://cal.com/classroomio/demo');
}; };
@@ -7,5 +7,5 @@ export const load = ({ request }) => {
event: 'discord page visited' event: 'discord page visited'
}); });
throw redirect(301, 'https://discord.gg/dRmxBpJw59'); throw redirect(307, 'https://discord.gg/dRmxBpJw59');
}; };
@@ -3,10 +3,9 @@ import { client } from '$lib/utils/posthog';
export const load = async ({ request }) => { export const load = async ({ request }) => {
client.capture({ client.capture({
distinctId: distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
request.headers.get('x-forwarded-for') || new Date().getTime().toString(), event: 'github page visited'
event: 'github page visited',
}); });
throw redirect(301, 'https://github.com/rotimi-best/classroomio'); throw redirect(307, 'https://github.com/rotimi-best/classroomio');
}; };
@@ -3,13 +3,12 @@ import { client } from '$lib/utils/posthog';
export const load = async ({ request }) => { export const load = async ({ request }) => {
client.capture({ client.capture({
distinctId: distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
request.headers.get('x-forwarded-for') || new Date().getTime().toString(), event: 'privacy page visited'
event: 'privacy page visited',
}); });
throw redirect( throw redirect(
301, 307,
'https://app.enzuzo.com/policies/privacy/958fc978-5477-11ee-a03b-7b111830c594' 'https://app.enzuzo.com/policies/privacy/958fc978-5477-11ee-a03b-7b111830c594'
); );
}; };
@@ -7,5 +7,5 @@ export const load = ({ request }) => {
event: 'signup' event: 'signup'
}); });
throw redirect(301, 'https://app.classroomio.com/signup'); throw redirect(307, 'https://app.classroomio.com/signup');
}; };
@@ -3,13 +3,9 @@ import { client } from '$lib/utils/posthog';
export const load = async ({ request }) => { export const load = async ({ request }) => {
client.capture({ client.capture({
distinctId: distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
request.headers.get('x-forwarded-for') || new Date().getTime().toString(), event: 'privacy page visited'
event: 'privacy page visited',
}); });
throw redirect( throw redirect(307, 'https://app.enzuzo.com/policies/tos/958fc978-5477-11ee-a03b-7b111830c594');
301,
'https://app.enzuzo.com/policies/tos/958fc978-5477-11ee-a03b-7b111830c594'
);
}; };
+1 -1
View File
@@ -45,7 +45,7 @@
"nodemailer": "^6.9.5", "nodemailer": "^6.9.5",
"openai-edge": "^1.2.2", "openai-edge": "^1.2.2",
"pluralize": "^8.0.0", "pluralize": "^8.0.0",
"posthog-js": "^1.87.2", "posthog-js": "^1.96.0",
"sirv": "^2.0.3", "sirv": "^2.0.3",
"svelte-email": "^0.0.4", "svelte-email": "^0.0.4",
"svelte-ui": "workspace:*", "svelte-ui": "workspace:*",
@@ -64,7 +64,7 @@ export async function fetchCourse(courseId?: Course['id'], slug?: Course['slug']
if (!data || error) { if (!data || error) {
console.log(`data`, data); console.log(`data`, data);
console.log(`fetchCourse => error`, error); console.log(`fetchCourse => error`, error);
// return this.redirect(301, '/courses'); // return this.redirect(307, '/courses');
return { data, error }; return { data, error };
} }
+2 -11
View File
@@ -31,15 +31,6 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
const matches = url.host.match(/([a-z 0-9 -]+).*classroomio[.]com/); const matches = url.host.match(/([a-z 0-9 -]+).*classroomio[.]com/);
const subdomain = matches?.[1] ?? ''; const subdomain = matches?.[1] ?? '';
if (subdomain === 'app' && url.search && url.search?.includes('forwardTo')) {
const params = new URLSearchParams(url.search);
const forwardToURL = params.get('forwardTo');
if (forwardToURL) {
throw redirect(307, forwardToURL);
}
}
if (!blockedSubdomain.includes(subdomain)) { if (!blockedSubdomain.includes(subdomain)) {
const answer = Array.isArray(matches) ? !!subdomain && subdomain !== 'www' : false; const answer = Array.isArray(matches) ? !!subdomain && subdomain !== 'www' : false;
@@ -48,12 +39,12 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null; response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
if (!response.org && !dev) { if (!response.org && !dev) {
throw redirect(301, 'https://app.classroomio.com/404?type=org'); throw redirect(307, 'https://app.classroomio.com/404?type=org');
} }
} else if (subdomain === 'play' || debugPlay === 'true') { } else if (subdomain === 'play' || debugPlay === 'true') {
response.skipAuth = true; response.skipAuth = true;
} else if (subdomain !== 'app' && !dev) { } else if (subdomain !== 'app' && !dev) {
throw redirect(301, 'https://app.classroomio.com'); throw redirect(307, 'https://app.classroomio.com');
} }
return response; return response;
@@ -26,6 +26,6 @@ export const load = async ({ params = { hash: '' } }) => {
}; };
} catch (error) { } catch (error) {
console.error('Error decoding course invite params.hash', error); console.error('Error decoding course invite params.hash', error);
throw redirect(301, '/404'); throw redirect(307, '/404');
} }
}; };
@@ -29,6 +29,6 @@ export const load = async ({ params = { hash: '' } }) => {
}; };
} catch (error) { } catch (error) {
console.error('Error decoding invite params.hash', error); console.error('Error decoding invite params.hash', error);
throw redirect(301, '/404'); throw redirect(307, '/404');
} }
}; };
+4 -4
View File
@@ -169,8 +169,8 @@ importers:
specifier: ^8.0.0 specifier: ^8.0.0
version: 8.0.0 version: 8.0.0
posthog-js: posthog-js:
specifier: ^1.87.2 specifier: ^1.96.0
version: 1.87.2 version: 1.96.0
sirv: sirv:
specifier: ^2.0.3 specifier: ^2.0.3
version: 2.0.3 version: 2.0.3
@@ -9242,8 +9242,8 @@ packages:
picocolors: 1.0.0 picocolors: 1.0.0
source-map-js: 1.0.2 source-map-js: 1.0.2
/posthog-js@1.87.2: /posthog-js@1.96.0:
resolution: {integrity: sha512-pdxEylfxwEDwwz7g5dunPucvAN51RAOWWQmkcqHsLNHlV5o5bTaTwcAXaWB1IUn3xKPuKYE2lqbdB3vC4H4rFQ==} resolution: {integrity: sha512-nutEP3UbwjPt1a78KwBbdNBMhAY30lLjYXbBOPZ/juB9NDklmSqLF+lWImPcf6+rlXEhIboSr5sdTAF/R+Dasg==}
dependencies: dependencies:
fflate: 0.4.8 fflate: 0.4.8
dev: false dev: false