SvelteKit Updated, Uppy broken

This commit is contained in:
Mawoka
2025-09-21 10:48:07 +02:00
parent a87f59f5c0
commit fa533257b3
20 changed files with 1017 additions and 810 deletions
+4 -3
View File
@@ -8,8 +8,8 @@ SPDX-License-Identifier: MPL-2.0
import '../app.css';
import Navbar from '$lib/navbar.svelte';
import { navbarVisible, pathname } from '$lib/stores';
import * as Sentry from '@sentry/browser';
import { BrowserTracing } from '@sentry/tracing';
// import * as Sentry from '@sentry/browser';
// import { BrowserTracing } from '@sentry/tracing';
import { initLocalizationContext } from '$lib/i18n';
import { browser } from '$app/environment';
import CommandPalette from '$lib/components/commandpalette.svelte';
@@ -54,7 +54,7 @@ SPDX-License-Identifier: MPL-2.0
start_language = localStorage.getItem('language') ?? 'en';
}
initLocalizationContext(start_language);
/*
if (import.meta.env.VITE_SENTRY !== undefined && import.meta.env.PROD) {
Sentry.init({
dsn: String(import.meta.env.VITE_SENTRY),
@@ -66,6 +66,7 @@ SPDX-License-Identifier: MPL-2.0
tracesSampleRate: 0.5
});
}
*/
</script>
<svelte:head>
+1 -1
View File
@@ -7,7 +7,7 @@ import { redirect } from '@sveltejs/kit';
export const load = async ({ parent }) => {
const { email } = await parent();
if (email) {
throw redirect(302, '/dashboard');
redirect(302, '/dashboard');
}
return {
email
@@ -8,7 +8,7 @@ import { error } from '@sveltejs/kit';
export const load = (async ({ fetch, params }) => {
const res = await fetch(`/api/v1/box-controller/web/controller?id=${params.controller_id}`);
if (res.status !== 200) {
throw error(res.status, await res.text());
error(res.status, await res.text());
}
const json: {
id: string;
@@ -9,7 +9,7 @@ export const load = (({ url }) => {
const code = url.searchParams.get('code');
const id = url.searchParams.get('id');
if (!id || !code) {
throw error(404, JSON.stringify({ detail: 'id and/or code are/is missing' }));
error(404, JSON.stringify({ detail: 'id and/or code are/is missing' }));
}
return {
id,
@@ -11,7 +11,7 @@ export async function load({ parent, url }) {
const { email } = await parent();
if (email) {
throw redirect(302, returnTo);
redirect(302, returnTo);
}
return {
verified: verified !== null
@@ -7,7 +7,7 @@ import { redirect } from '@sveltejs/kit';
export async function load({ parent }) {
const { email } = await parent();
if (email) {
throw redirect(302, '/dashboard');
redirect(302, '/dashboard');
}
return {};
}
@@ -7,7 +7,7 @@ import { redirect } from '@sveltejs/kit';
export async function load({ parent }) {
const { email } = await parent();
if (email) {
throw redirect(302, '/dashboard');
redirect(302, '/dashboard');
}
return {};
}
@@ -7,7 +7,7 @@ import { redirect } from '@sveltejs/kit';
export async function load({ parent }) {
const { email } = await parent();
if (!email) {
throw redirect(302, '/account/login?returnTo=/account/settings');
redirect(302, '/account/login?returnTo=/account/settings');
}
return {
email
+1 -1
View File
@@ -7,7 +7,7 @@ import { redirect } from '@sveltejs/kit';
export async function load({ parent, url }) {
const { email } = await parent();
if (!email) {
throw redirect(302, '/account/login');
redirect(302, '/account/login');
}
const token = url.searchParams.get('token');
const pin = url.searchParams.get('pin');
+1 -1
View File
@@ -7,7 +7,7 @@ import { redirect } from '@sveltejs/kit';
export async function load({ parent }) {
const { email } = await parent();
if (!email) {
throw redirect(302, '/account/login?returnTo=/create');
redirect(302, '/account/login?returnTo=/create');
}
return {};
}
@@ -7,7 +7,7 @@ import { redirect } from '@sveltejs/kit';
export const load = async ({ parent }) => {
const { email } = await parent();
if (!email) {
throw redirect(302, '/account/login?returnTo=/dashboard');
redirect(302, '/account/login?returnTo=/dashboard');
}
return {
email
+2 -2
View File
@@ -9,7 +9,7 @@ export async function load({ url, parent }) {
const quiz_id = url.searchParams.get('quiz_id');
const { email } = await parent();
if (!email) {
throw redirect(302, `/account/login?returnTo=/edit?quiz_id=${quiz_id}`);
redirect(302, `/account/login?returnTo=/edit?quiz_id=${quiz_id}`);
}
if (email) {
@@ -17,7 +17,7 @@ export async function load({ url, parent }) {
}
if (quiz_id === null) {
throw error(404);
error(404);
}
return {
quiz_id
+1 -1
View File
@@ -7,7 +7,7 @@ import { signedIn } from '$lib/stores';
export async function load({ parent }) {
const { email } = await parent();
if (!email) {
throw redirect(302, '/account/login?returnTo=/import');
redirect(302, '/account/login?returnTo=/import');
} else {
if (email) {
signedIn.set(true);
+2 -2
View File
@@ -9,11 +9,11 @@ import type { Data } from '$lib/quiztivity/types';
export const load = (async ({ url, fetch }) => {
const id = url.searchParams.get('id');
if (!id) {
throw error(400, 'id missing');
error(400, 'id missing');
}
const resp = await fetch(`/api/v1/quiztivity/${id}`);
if (!resp.ok) {
throw error(404, 'quiztivity not found');
error(404, 'quiztivity not found');
}
const data: Data = await resp.json();
return {
+2 -2
View File
@@ -10,7 +10,7 @@ export const load = (async ({ url, fetch }) => {
const id = url.searchParams.get('id');
const share = url.searchParams.get('share') === 'true';
if (!id) {
throw error(400, 'id missing');
error(400, 'id missing');
}
let resp: Response;
if (share) {
@@ -19,7 +19,7 @@ export const load = (async ({ url, fetch }) => {
resp = await fetch(`/api/v1/quiztivity/${id}`);
}
if (!resp.ok) {
throw error(resp.status);
error(resp.status);
}
const data: Data = await resp.json();
return {
@@ -8,5 +8,5 @@ import type { PageServerLoad } from './$types';
export const load = (({ params }) => {
const quiz_id = params.share_id;
throw redirect(301, `/quiztivity/play?id=${quiz_id}&share=true`);
redirect(301, `/quiztivity/play?id=${quiz_id}&share=true`);
}) satisfies PageServerLoad;
@@ -9,7 +9,7 @@ export const load = async ({ params, parent }) => {
const res = await fetch(`${process.env.API_URL}/api/v1/quiz/get/public/${quiz_id}`);
const { email } = await parent();
if (res.status === 404 || res.status === 400) {
throw error(404);
error(404);
} else if (res.status === 200) {
const quiz = await res.json();
return {
@@ -17,6 +17,6 @@ export const load = async ({ params, parent }) => {
logged_in: Boolean(email)
};
} else {
throw error(500);
error(500);
}
};