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 }) => {
client.capture({
distinctId:
request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
event: 'cal.com page visited',
distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
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'
});
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 }) => {
client.capture({
distinctId:
request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
event: 'github page visited',
distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
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 }) => {
client.capture({
distinctId:
request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
event: 'privacy page visited',
distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
event: 'privacy page visited'
});
throw redirect(
301,
307,
'https://app.enzuzo.com/policies/privacy/958fc978-5477-11ee-a03b-7b111830c594'
);
};
@@ -7,5 +7,5 @@ export const load = ({ request }) => {
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 }) => {
client.capture({
distinctId:
request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
event: 'privacy page visited',
distinctId: request.headers.get('x-forwarded-for') || new Date().getTime().toString(),
event: 'privacy page visited'
});
throw redirect(
301,
'https://app.enzuzo.com/policies/tos/958fc978-5477-11ee-a03b-7b111830c594'
);
throw redirect(307, 'https://app.enzuzo.com/policies/tos/958fc978-5477-11ee-a03b-7b111830c594');
};
+1 -1
View File
@@ -45,7 +45,7 @@
"nodemailer": "^6.9.5",
"openai-edge": "^1.2.2",
"pluralize": "^8.0.0",
"posthog-js": "^1.87.2",
"posthog-js": "^1.96.0",
"sirv": "^2.0.3",
"svelte-email": "^0.0.4",
"svelte-ui": "workspace:*",
@@ -64,7 +64,7 @@ export async function fetchCourse(courseId?: Course['id'], slug?: Course['slug']
if (!data || error) {
console.log(`data`, data);
console.log(`fetchCourse => error`, error);
// return this.redirect(301, '/courses');
// return this.redirect(307, '/courses');
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 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)) {
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;
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') {
response.skipAuth = true;
} else if (subdomain !== 'app' && !dev) {
throw redirect(301, 'https://app.classroomio.com');
throw redirect(307, 'https://app.classroomio.com');
}
return response;
@@ -26,6 +26,6 @@ export const load = async ({ params = { hash: '' } }) => {
};
} catch (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) {
console.error('Error decoding invite params.hash', error);
throw redirect(301, '/404');
throw redirect(307, '/404');
}
};