feat: upgrade to svelte 1.0

This commit is contained in:
Damillora 2022-12-17 17:37:41 +07:00
parent 5cd7b4ac30
commit 20e6905fb2
49 changed files with 669 additions and 452 deletions

View File

@ -9,27 +9,26 @@
"format": "prettier --write ."
},
"devDependencies": {
"@sveltejs/kit": "^1.0.0-next.392",
"@sveltejs/kit": "1.0.0-next.588",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^3.4.1",
"prettier": "~2.2.1",
"prettier-plugin-svelte": "^2.7.0",
"svelte": "^3.49.0",
"prettier-plugin-svelte": "^2.9.0",
"svelte": "^3.55.0",
"svelte-preprocess": "^4.10.7",
"tslib": "^2.4.0",
"typescript": "^4.7.4",
"vite": "^3.0.2"
"tslib": "^2.4.1",
"typescript": "^4.9.4",
"vite": "^4.0.1"
},
"type": "module",
"dependencies": {
"@damillora/plachta": "^1.8.2",
"@damillora/shian": "^3.3.1",
"@sveltejs/adapter-node": "^1.0.0-next.83",
"dayjs": "^1.11.4",
"@damillora/plachta": "^2.0.2",
"@sveltejs/adapter-node": "^1.0.0",
"dayjs": "^1.11.7",
"howler": "^2.2.3",
"sass": "^1.54.0"
"sass": "^1.57.0"
}
}

File diff suppressed because it is too large Load Diff

20
src/routes/+error.svelte Normal file
View File

@ -0,0 +1,20 @@
<script>
import { page } from '$app/stores';
import Container from '@damillora/plachta/components/Container/Container.svelte';
</script>
<svelte:head>
<title>{$page.status}</title>
</svelte:head>
<Container>
<h1>{$page.status}</h1>
<p>{$page.error.message}</p>
{#if $page.error.stack}
<pre>{$page.error.stack}</pre>
{/if}
</Container>
<style>
</style>

View File

@ -34,7 +34,7 @@
<slot />
<Footer>
<p>Copyright (c) 2021 Damillora</p>
<p>Copyright (c) 2023 Damillora</p>
</Footer>
</Base>

View File

@ -6,12 +6,12 @@ export async function GET({ params }) {
var path = params.link;
if (linksCache[path]) {
if (linksCache[path] != 'none') {
return {
return new Response(undefined, {
status: 302,
headers: {
"Location": linksCache[path]
},
}
}
})
}
}
var fetchres = await fetch(shortenerBase + "/" + path, { redirect: "manual" });
@ -20,12 +20,12 @@ export async function GET({ params }) {
if (unshortenedUrl == shortenerBase + "/") {
linksCache[path] = "none";
} else {
return {
return new Response(undefined, {
status: 302,
headers: {
"Location": unshortenedUrl
},
}
}
})
}
}

View File

@ -1,33 +0,0 @@
<script context="module">
export function load({ error, status }) {
return {
props: {
status: status,
error: error
}
};
}
</script>
<script>
import Container from '@damillora/plachta/components/Container/Container.svelte';
export let status;
export let error;
</script>
<svelte:head>
<title>{status}</title>
</svelte:head>
<Container>
<h1>{status}</h1>
<p>{error.message}</p>
{#if error.stack}
<pre>{error.stack}</pre>
{/if}
</Container>
<style>
</style>

View File

@ -1,3 +1,5 @@
import { json as json$1 } from '@sveltejs/kit';
// Public webhook URL for forms.
@ -5,12 +7,11 @@ let webhookUrl = "https://n8n.nanao.moe/webhook/fd943cbe-fd27-47f8-98ec-01c14b51
export async function POST({ body }) {
if (!body.message) {
return {
status: 400,
body: {
error: "No message!"
}
}
return json$1({
error: "No message!"
}, {
status: 400
})
}
const data = await fetch(webhookUrl, {
method: "POST",
@ -22,9 +23,7 @@ export async function POST({ body }) {
}),
})
return {
body: {
success: true,
}
}
return json$1({
success: true,
})
}