⬆️ Upgraded SvelteKit

This commit is contained in:
Mawoka
2022-08-18 15:35:01 +02:00
parent 12ec2ebf94
commit 9b79358db3
31 changed files with 198 additions and 324 deletions
@@ -4,14 +4,18 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
/** @type {import('@sveltejs/kit').Load} */ export function load({ error, status }) {
return {
props: {
status,
message: error.message
}
};
}
throw new Error(
'@migration task: Replace error load function (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3293209)'
);
// /** @type {import('@sveltejs/kit').Load} */ export function load({ error, status }) {
// return {
// props: {
// status,
// message: error.message
// }
// };
// }
</script>
<script lang="ts">
@@ -4,14 +4,18 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (session.authenticated) {
// signedIn.set(true);
// }
// return {};
// }
</script>
<script>
@@ -4,18 +4,22 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ session }) {
if (session.authenticated) {
signedIn.set(true);
return {
status: 302,
redirect: '/dashboard'
};
}
return {};
}
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (session.authenticated) {
// signedIn.set(true);
// return {
// status: 302,
// redirect: '/dashboard'
// };
// }
// return {};
// }
</script>
<script lang="ts">
@@ -4,14 +4,18 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (session.authenticated) {
// signedIn.set(true);
// }
// return {};
// }
</script>
<script lang="ts">
@@ -3,29 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
export async function load({ session, url }) {
const verified = url.searchParams.get('verified');
const returnTo =
url.searchParams.get('returnTo') !== null
? url.searchParams.get('returnTo')
: '/dashboard';
if (session.authenticated) {
return {
status: 302,
redirect: returnTo
};
}
return {
status: 200,
props: {
verified: verified !== null
}
};
}
</script>
<script lang="ts">
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
import * as Sentry from '@sentry/browser';
import { navbarVisible } from '$lib/stores';
import { browser } from '$app/env';
@@ -3,18 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
export async function load({ url }) {
const error = url.searchParams.get('error');
return {
props: {
error
}
};
}
</script>
<script lang="ts">
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
export let error: string;
</script>
@@ -3,20 +3,12 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
export async function load({ url }) {
const token = url.searchParams.get('token');
return {
props: {
token
}
};
}
</script>
<script lang="ts">
import { getLocalization } from '../../lib/i18n';
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
import { getLocalization } from '../../../lib/i18n';
const { t } = getLocalization();
export let token: string;
@@ -3,18 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
export async function load({ session }) {
if (session.authenticated) {
return {
status: 302,
redirect: '/dashboard'
};
}
return {};
}
</script>
<script lang="ts">
import { createForm } from 'felte';
import { getLocalization } from '$lib/i18n';
@@ -3,18 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
export async function load({ session }) {
if (session.authenticated) {
return {
status: 302,
redirect: '/dashboard'
};
}
return {};
}
</script>
<script lang="ts">
import { getLocalization } from '$lib/i18n';
import { navbarVisible } from '$lib/stores';
@@ -3,22 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
export async function load({ session }) {
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login?returnTo=/account/settings'
};
}
return {
props: {
email: session.email
}
};
}
</script>
<script lang="ts">
import { getLocalization } from '$lib/i18n';
import { DateTime } from 'luxon';
@@ -3,31 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
export async function load({ session, url }) {
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login'
};
}
const token = url.searchParams.get('token');
const pin = url.searchParams.get('pin');
let auto_connect = url.searchParams.get('connect') !== null;
if (token === null || pin === null) {
auto_connect = false;
}
return {
props: {
game_pin: pin === null ? '' : pin,
game_token: token === null ? '' : token,
auto_connect: auto_connect
}
};
}
</script>
<script lang="ts">
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
import type { QuizData } from '$lib/quiz_types';
import { socket } from '$lib/socket';
@@ -4,20 +4,24 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ session }) {
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login?returnTo=/create'
};
}
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (!session.authenticated) {
// return {
// status: 302,
// redirect: '/account/login?returnTo=/create'
// };
// }
// if (session.authenticated) {
// signedIn.set(true);
// }
// return {};
// }
</script>
<script lang="ts">
@@ -3,22 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
export async function load({ session }) {
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login?returnTo=/dashboard'
};
}
return {
props: {
email: session.email
}
};
}
</script>
<script lang="ts">
import type { Question } from '$lib/quiz_types';
import { DateTime } from 'luxon';
@@ -4,14 +4,18 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (session.authenticated) {
// signedIn.set(true);
// }
// return {};
// }
</script>
<script lang="ts">
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<svelte:head>
<title>ClassQuiz/docs - Index</title>
<meta
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<svelte:head>
<title>ClassQuiz/docs - Attribution</title>
<meta name="description" content="People who helped make with ClassQuiz." />
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<script lang="ts">
import { onMount } from 'svelte';
import '$lib/hljs.css';
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<svelte:head>
<title>ClassQuiz/docs - Import from Kahoot</title>
<meta
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<svelte:head>
<title>ClassQuiz/docs - PoW</title>
<meta
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<script lang="ts">
import { onMount } from 'svelte';
import '$lib/hljs.css';
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<svelte:head>
<title>ClassQuiz/docs - Roadmap</title>
<meta
@@ -3,10 +3,6 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
export const prerender = true;
</script>
<script lang="ts">
import { onMount } from 'svelte';
import '$lib/hljs.css';
@@ -7,10 +7,6 @@
hljs.highlightAll();
});
</script>-->
<script context="module">
export const prerender = true;
</script>
<!--
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -4,39 +4,47 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ url, session }) {
const quiz_id = url.searchParams.get('quiz_id');
if (!session.authenticated) {
return {
status: 302,
redirect: `/account/login?returnTo=/edit?quiz_id=${quiz_id}`
};
}
// import { signedIn } from '$lib/stores';
if (session.authenticated) {
signedIn.set(true);
}
// export async function load({ url, session }) {
// const quiz_id = url.searchParams.get('quiz_id');
// if (!session.authenticated) {
// return {
// status: 302,
// redirect: `/account/login?returnTo=/edit?quiz_id=${quiz_id}`
// };
// }
if (quiz_id === null) {
return {
status: 404
};
}
return {
props: {
quiz_id
}
};
}
// if (session.authenticated) {
// signedIn.set(true);
// }
// if (quiz_id === null) {
// return {
// status: 404
// };
// }
// return {
// props: {
// quiz_id
// }
// };
// }
</script>
<script lang="ts">
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
import Editor from '$lib/editor.svelte';
import { getLocalization } from '$lib/i18n';
import { navbarVisible } from '$lib/stores';
import { QuizQuestionType } from '../lib/quiz_types';
import { QuizQuestionType } from '../../lib/quiz_types';
navbarVisible.set(false);
@@ -4,14 +4,18 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (session.authenticated) {
// signedIn.set(true);
// }
// return {};
// }
</script>
<script lang="ts">
@@ -4,24 +4,28 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
import { signedIn } from '$lib/stores';
export async function load({ session }) {
if (!session.authenticated) {
return {
status: 302,
redirect: '/account/login?returnTo=/import'
};
} else {
if (session.authenticated) {
signedIn.set(true);
}
}
return {
props: {
email: session.email
}
};
}
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (!session.authenticated) {
// return {
// status: 302,
// redirect: '/account/login?returnTo=/import'
// };
// } else {
// if (session.authenticated) {
// signedIn.set(true);
// }
// }
// return {
// props: {
// email: session.email
// }
// };
// }
</script>
<script lang="ts">
@@ -7,10 +7,10 @@
import type { RequestHandler } from '@sveltejs/kit';
export const GET: RequestHandler = async () => {
return {
return new Response(undefined, {
status: 301,
headers: {
Location: '/dashboard'
}
};
});
};
@@ -4,22 +4,30 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ url, session }) {
if (session.authenticated) {
signedIn.set(true);
}
const token = url.searchParams.get('pin');
return {
props: {
game_pin: token === null ? '' : token
}
};
}
// import { signedIn } from '$lib/stores';
// export async function load({ url, session }) {
// if (session.authenticated) {
// signedIn.set(true);
// }
// const token = url.searchParams.get('pin');
// return {
// props: {
// game_pin: token === null ? '' : token
// }
// };
// }
</script>
<script lang="ts">
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
import { socket } from '$lib/socket';
import JoinGame from '$lib/play/join.svelte';
import type { Answer, QuizData } from '$lib/quiz_types';
@@ -4,14 +4,18 @@
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module" lang="ts">
import { signedIn } from '$lib/stores';
throw new Error(
'@migration task: Check code was safely removed (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292722)'
);
export async function load({ session }) {
if (session.authenticated) {
signedIn.set(true);
}
return {};
}
// import { signedIn } from '$lib/stores';
// export async function load({ session }) {
// if (session.authenticated) {
// signedIn.set(true);
// }
// return {};
// }
</script>
<script lang="ts">
@@ -3,22 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
/** @type {import('@sveltejs/kit').Load} */ export function load({ error, status }) {
return {
props: {
status,
message: error.message
}
};
}
</script>
<script lang="ts">
import { navbarVisible } from '$lib/stores';
import { page } from '$app/stores';
navbarVisible.set(true);
export let status: number;
export let message: string;
let status = $page.status;
</script>
<svelte:head>
@@ -3,33 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
import type { Load } from '@sveltejs/kit';
export const load: Load = async ({ params, fetch, session }) => {
const { quiz_id } = params;
const res = await fetch(`/api/v1/quiz/get/public/${quiz_id}`);
if (res.status === 404 || res.status === 400) {
return {
status: 404
};
} else if (res.status === 200) {
const quiz = await res.json();
return {
props: {
quiz: quiz,
logged_in: session.authenticated
}
};
} else {
return {
status: 500
};
}
};
</script>
<script lang="ts">
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
import { getLocalization } from '$lib/i18n';
import CollapsSection from '$lib/collapsible.svelte';
import { createTippy } from 'svelte-tippy';