chore: 🏗️ Migrate to SvelteKit 1.0.0
This commit is contained in:
parent
308fffbefe
commit
689f232cbb
2
proxy.js
2
proxy.js
@ -14,7 +14,7 @@ app.use(
|
||||
app.use(
|
||||
"/",
|
||||
createProxyMiddleware({
|
||||
target: "http://localhost:3000",
|
||||
target: "http://localhost:5173",
|
||||
changeOrigin: true,
|
||||
})
|
||||
);
|
||||
|
@ -6,9 +6,8 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "svelte-kit build",
|
||||
"package": "svelte-kit package",
|
||||
"preview": "svelte-kit preview",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --check --plugin-search-dir=. . && eslint .",
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/env';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
import Callout from './Callout.svelte';
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/env';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/env';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
import Footer from '$lib/components/Footer.svelte';
|
||||
import NavBar from '$lib/components/navbar/NavBar.svelte';
|
||||
|
@ -3,8 +3,8 @@ import type { PageServerLoad } from './$types';
|
||||
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export const get: PageServerLoad = async ({ request, clientAddress, params, setHeaders }) => {
|
||||
const ip = (request.headers.get('x-forwarded-for') || clientAddress) as string;
|
||||
export const load: PageServerLoad = async ({ request, params, setHeaders, getClientAddress }) => {
|
||||
const ip = (request.headers.get('x-forwarded-for') || getClientAddress()) as string;
|
||||
const url = `${import.meta.env.VITE_SERVER_INTERNAL}/api/note/${params.id}`;
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
@ -20,7 +20,7 @@ export const get: PageServerLoad = async ({ request, clientAddress, params, setH
|
||||
const maxage = Math.floor((note.expire_time.valueOf() - note.insert_time.valueOf()) / 1000);
|
||||
|
||||
setHeaders({
|
||||
maxage: maxage,
|
||||
maxage: `${maxage}`,
|
||||
'Cache-Control': `max-age=${maxage}, public`
|
||||
});
|
||||
return { note };
|
||||
|
@ -4,7 +4,7 @@
|
||||
import MarkdownRenderer from '$lib/components/MarkdownRenderer.svelte';
|
||||
import LogoMarkdown from 'svelte-icons/io/IoLogoMarkdown.svelte';
|
||||
import IconEncrypted from 'svelte-icons/md/MdLockOutline.svelte';
|
||||
import { browser } from '$app/env';
|
||||
import { browser } from '$app/environment';
|
||||
import RawRenderer from '$lib/components/RawRenderer.svelte';
|
||||
import LogoDocument from 'svelte-icons/md/MdUndo.svelte';
|
||||
import Dismissable from '$lib/components/Dismissable.svelte';
|
||||
|
@ -1,14 +0,0 @@
|
||||
import type { EncryptedNote } from '$lib/model/EncryptedNote';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ data, setHeaders }) => {
|
||||
const note: EncryptedNote = data.note;
|
||||
const maxage = Math.floor((note.expire_time.valueOf() - note.insert_time.valueOf()) / 1000);
|
||||
|
||||
setHeaders({
|
||||
maxage: maxage,
|
||||
'Cache-Control': `max-age=${maxage}, public`
|
||||
});
|
||||
|
||||
return { note };
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user