forked from mirrors/pronouns.cc
chore: upgrade sveltekit to 2.0.0, upgrade svelte to 4.0.0
This commit is contained in:
parent
34002e77d9
commit
d559d1a036
65 changed files with 1441 additions and 375 deletions
|
@ -12,11 +12,13 @@
|
||||||
"format": "prettier --plugin-search-dir . --write ."
|
"format": "prettier --plugin-search-dir . --write ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-auto": "^2.0.0",
|
"@sveltejs/adapter-auto": "^3.0.0",
|
||||||
"@sveltejs/adapter-node": "^1.2.3",
|
"@sveltejs/adapter-node": "^2.0.0",
|
||||||
"@sveltejs/kit": "^1.15.0",
|
"@sveltejs/kit": "^2.0.0",
|
||||||
"@types/luxon": "^3.2.2",
|
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||||
"@types/markdown-it": "^12.2.3",
|
"@sveltestrap/sveltestrap": "^6.0.5",
|
||||||
|
"@types/luxon": "^3.3.7",
|
||||||
|
"@types/markdown-it": "^13.0.7",
|
||||||
"@types/node": "^18.15.11",
|
"@types/node": "^18.15.11",
|
||||||
"@types/sanitize-html": "^2.9.0",
|
"@types/sanitize-html": "^2.9.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||||
|
@ -25,14 +27,13 @@
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-svelte3": "^4.0.0",
|
"eslint-plugin-svelte3": "^4.0.0",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.7",
|
||||||
"prettier-plugin-svelte": "^2.10.0",
|
"prettier-plugin-svelte": "^2.10.1",
|
||||||
"svelte": "^3.58.0",
|
"svelte": "^4.0.0",
|
||||||
"svelte-check": "^3.1.4",
|
"svelte-check": "^3.4.3",
|
||||||
"svelte-hcaptcha": "^0.1.1",
|
"svelte-hcaptcha": "^0.1.1",
|
||||||
"sveltestrap": "^5.10.0",
|
|
||||||
"tslib": "^2.5.0",
|
"tslib": "^2.5.0",
|
||||||
"typescript": "^4.9.5",
|
"typescript": "^5.0.0",
|
||||||
"vite": "^4.2.1",
|
"vite": "^5.0.0",
|
||||||
"vite-plugin-markdown": "^2.1.0"
|
"vite-plugin-markdown": "^2.1.0"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -41,8 +42,8 @@
|
||||||
"@popperjs/core": "^2.11.7",
|
"@popperjs/core": "^2.11.7",
|
||||||
"@sentry/node": "^7.46.0",
|
"@sentry/node": "^7.46.0",
|
||||||
"base64-arraybuffer": "^1.0.2",
|
"base64-arraybuffer": "^1.0.2",
|
||||||
"bootstrap": "5.3.0-alpha1",
|
"bootstrap": "^5.3.2",
|
||||||
"bootstrap-icons": "^1.10.4",
|
"bootstrap-icons": "^1.11.2",
|
||||||
"jose": "^4.13.1",
|
"jose": "^4.13.1",
|
||||||
"luxon": "^3.3.0",
|
"luxon": "^3.3.0",
|
||||||
"markdown-it": "^13.0.1",
|
"markdown-it": "^13.0.1",
|
||||||
|
|
6
frontend/src/app.d.ts
vendored
6
frontend/src/app.d.ts
vendored
|
@ -1,15 +1,15 @@
|
||||||
// See https://kit.svelte.dev/docs/types#app
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
|
|
||||||
import type { ErrorCode } from "$lib/api/entities";
|
import type { APIError, ErrorCode } from "$lib/api/entities";
|
||||||
|
|
||||||
// for information about these interfaces
|
// for information about these interfaces
|
||||||
declare global {
|
declare global {
|
||||||
namespace App {
|
namespace App {
|
||||||
interface Error {
|
type Error = {
|
||||||
code: ErrorCode;
|
code: ErrorCode;
|
||||||
message?: string | undefined;
|
message?: string | undefined;
|
||||||
details?: string | undefined;
|
details?: string | undefined;
|
||||||
}
|
} | APIError
|
||||||
// interface Locals {}
|
// interface Locals {}
|
||||||
// interface PageData {}
|
// interface PageData {}
|
||||||
// interface Platform {}
|
// interface Platform {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { NavLink } from "sveltestrap";
|
import { NavLink } from "@sveltestrap/sveltestrap";
|
||||||
import { page } from "$app/stores";
|
import { page } from "$app/stores";
|
||||||
|
|
||||||
export let href: string;
|
export let href: string;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { APIError } from "$lib/api/entities";
|
import type { APIError } from "$lib/api/entities";
|
||||||
import { Alert } from "sveltestrap";
|
import { Alert } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let error: APIError;
|
export let error: APIError;
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button, Icon, Tooltip } from "sveltestrap";
|
import { Button, Icon, Tooltip } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let icon: string;
|
export let icon: string;
|
||||||
export let color: "primary" | "secondary" | "success" | "danger";
|
export let color: "primary" | "secondary" | "success" | "danger";
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
type User,
|
type User,
|
||||||
type CustomPreferences,
|
type CustomPreferences,
|
||||||
} from "$lib/api/entities";
|
} from "$lib/api/entities";
|
||||||
import { Icon, Tooltip } from "sveltestrap";
|
import { Icon, Tooltip } from "@sveltestrap/sveltestrap";
|
||||||
import FallbackImage from "./FallbackImage.svelte";
|
import FallbackImage from "./FallbackImage.svelte";
|
||||||
|
|
||||||
export let user: User;
|
export let user: User;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Icon, Tooltip } from "sveltestrap";
|
import { Icon, Tooltip } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
import type { CustomPreference, CustomPreferences } from "$lib/api/entities";
|
import type { CustomPreference, CustomPreferences } from "$lib/api/entities";
|
||||||
import defaultPreferences from "$lib/api/default_preferences";
|
import defaultPreferences from "$lib/api/default_preferences";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Toast } from "sveltestrap";
|
import { Toast } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let header: string | undefined = undefined;
|
export let header: string | undefined = undefined;
|
||||||
export let body: string;
|
export let body: string;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Field, CustomPreferences } from "$lib/api/entities";
|
import type { Field, CustomPreferences } from "$lib/api/entities";
|
||||||
import IconButton from "$lib/components/IconButton.svelte";
|
import IconButton from "$lib/components/IconButton.svelte";
|
||||||
import { Button, Input, InputGroup } from "sveltestrap";
|
import { Button, Input, InputGroup } from "@sveltestrap/sveltestrap";
|
||||||
import FieldEntry from "./FieldEntry.svelte";
|
import FieldEntry from "./FieldEntry.svelte";
|
||||||
|
|
||||||
export let field: Field;
|
export let field: Field;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
DropdownToggle,
|
DropdownToggle,
|
||||||
Icon,
|
Icon,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let value: string;
|
export let value: string;
|
||||||
export let status: string;
|
export let status: string;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
InputGroupText,
|
InputGroupText,
|
||||||
Popover,
|
Popover,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let pronoun: Pronoun;
|
export let pronoun: Pronoun;
|
||||||
export let preferences: CustomPreferences;
|
export let preferences: CustomPreferences;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
DropdownToggle,
|
DropdownToggle,
|
||||||
Icon,
|
Icon,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let value: string;
|
export let value: string;
|
||||||
export let status: string;
|
export let status: string;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { flagURL, type PrideFlag } from "$lib/api/entities";
|
import { flagURL, type PrideFlag } from "$lib/api/entities";
|
||||||
import { Button, Tooltip } from "sveltestrap";
|
import { Button, Tooltip } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let flag: PrideFlag;
|
export let flag: PrideFlag;
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Icon, Modal } from "sveltestrap";
|
import { Icon, Modal } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
let isOpen = false;
|
let isOpen = false;
|
||||||
const toggle = () => (isOpen = !isOpen);
|
const toggle = () => (isOpen = !isOpen);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
import { settingsStore } from "$lib/store";
|
import { settingsStore } from "$lib/store";
|
||||||
import { toastStore } from "$lib/toast";
|
import { toastStore } from "$lib/toast";
|
||||||
import Toast from "$lib/components/Toast.svelte";
|
import Toast from "$lib/components/Toast.svelte";
|
||||||
import { Alert, Icon } from "sveltestrap";
|
import { Alert, Icon } from "@sveltestrap/sveltestrap";
|
||||||
import { apiFetchClient } from "$lib/api/fetch";
|
import { apiFetchClient } from "$lib/api/fetch";
|
||||||
import type { Settings } from "$lib/api/entities";
|
import type { Settings } from "$lib/api/entities";
|
||||||
import { renderUnsafeMarkdown } from "$lib/utils";
|
import { renderUnsafeMarkdown } from "$lib/utils";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PUBLIC_BASE_URL } from "$env/static/public";
|
import { PUBLIC_BASE_URL } from "$env/static/public";
|
||||||
import { Button } from "sveltestrap";
|
import { Button } from "@sveltestrap/sveltestrap";
|
||||||
import { userStore } from "$lib/store";
|
import { userStore } from "$lib/store";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ export const load = async ({ params }) => {
|
||||||
return resp;
|
return resp;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ((e as APIError).code === ErrorCode.UserNotFound) {
|
if ((e as APIError).code === ErrorCode.UserNotFound) {
|
||||||
throw error(404, e as APIError);
|
error(404, e as APIError);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
ModalBody,
|
ModalBody,
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import { DateTime, Duration, FixedOffsetZone, Zone } from "luxon";
|
import { DateTime, Duration, FixedOffsetZone, Zone } from "luxon";
|
||||||
import FieldCard from "$lib/components/FieldCard.svelte";
|
import FieldCard from "$lib/components/FieldCard.svelte";
|
||||||
import PronounLink from "$lib/components/PronounLink.svelte";
|
import PronounLink from "$lib/components/PronounLink.svelte";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { flagURL, type PrideFlag } from "$lib/api/entities";
|
import { flagURL, type PrideFlag } from "$lib/api/entities";
|
||||||
import { Tooltip } from "sveltestrap";
|
import { Tooltip } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let flag: PrideFlag;
|
export let flag: PrideFlag;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Icon } from "sveltestrap";
|
import { Icon } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let link: string;
|
export let link: string;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { fastFetchClient } from "$lib/api/fetch";
|
import { fastFetchClient } from "$lib/api/fetch";
|
||||||
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
||||||
import { addToast } from "$lib/toast";
|
import { addToast } from "$lib/toast";
|
||||||
import { Button, FormGroup, Icon, Modal, ModalBody, ModalFooter } from "sveltestrap";
|
import { Button, FormGroup, Icon, Modal, ModalBody, ModalFooter } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let subject: string;
|
export let subject: string;
|
||||||
export let reportUrl: string;
|
export let reportUrl: string;
|
||||||
|
|
|
@ -14,9 +14,9 @@ export const load = async ({ params }) => {
|
||||||
(e as APIError).code === ErrorCode.UserNotFound ||
|
(e as APIError).code === ErrorCode.UserNotFound ||
|
||||||
(e as APIError).code === ErrorCode.MemberNotFound
|
(e as APIError).code === ErrorCode.MemberNotFound
|
||||||
) {
|
) {
|
||||||
throw error(404, e as APIError);
|
error(404, e as APIError);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error(500, e as APIError);
|
error(500, e as APIError);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
import PronounLink from "$lib/components/PronounLink.svelte";
|
import PronounLink from "$lib/components/PronounLink.svelte";
|
||||||
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
||||||
import { Alert, Button, Icon, InputGroup } from "sveltestrap";
|
import { Alert, Button, Icon, InputGroup } from "@sveltestrap/sveltestrap";
|
||||||
import {
|
import {
|
||||||
memberAvatars,
|
memberAvatars,
|
||||||
pronounDisplay,
|
pronounDisplay,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import type { LayoutData } from "./$types";
|
import type { LayoutData } from "./$types";
|
||||||
import { addToast, delToast } from "$lib/toast";
|
import { addToast, delToast } from "$lib/toast";
|
||||||
import { apiFetchClient, fastFetchClient } from "$lib/api/fetch";
|
import { apiFetchClient, fastFetchClient } from "$lib/api/fetch";
|
||||||
import { Button, ButtonGroup, Modal, ModalBody, ModalFooter, Nav, NavItem } from "sveltestrap";
|
import { Button, ButtonGroup, Modal, ModalBody, ModalFooter, Nav, NavItem } from "@sveltestrap/sveltestrap";
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
||||||
import IconButton from "$lib/components/IconButton.svelte";
|
import IconButton from "$lib/components/IconButton.svelte";
|
||||||
|
|
|
@ -32,7 +32,7 @@ export const load = (async ({ params }) => {
|
||||||
member.user.name !== params.username ||
|
member.user.name !== params.username ||
|
||||||
member.name !== params.memberName
|
member.name !== params.memberName
|
||||||
) {
|
) {
|
||||||
throw redirect(303, `/@${user.name}/${member.name}`);
|
redirect(303, `/@${user.name}/${member.name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -42,7 +42,7 @@ export const load = (async ({ params }) => {
|
||||||
flags,
|
flags,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ("code" in e) throw error(500, e as APIError);
|
if ("code" in e) error(500, e as APIError);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}) satisfies LayoutLoad;
|
}) satisfies LayoutLoad;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import prettyBytes from "pretty-bytes";
|
import prettyBytes from "pretty-bytes";
|
||||||
import { encode } from "base64-arraybuffer";
|
import { encode } from "base64-arraybuffer";
|
||||||
import { FormGroup, Icon, Input } from "sveltestrap";
|
import { FormGroup, Icon, Input } from "@sveltestrap/sveltestrap";
|
||||||
import { memberAvatars, type Member } from "$lib/api/entities";
|
import { memberAvatars, type Member } from "$lib/api/entities";
|
||||||
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
||||||
import EditableName from "$lib/components/edit/EditableName.svelte";
|
import EditableName from "$lib/components/edit/EditableName.svelte";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import { MAX_DESCRIPTION_LENGTH, type Member } from "$lib/api/entities";
|
import { MAX_DESCRIPTION_LENGTH, type Member } from "$lib/api/entities";
|
||||||
import { charCount, renderMarkdown } from "$lib/utils";
|
import { charCount, renderMarkdown } from "$lib/utils";
|
||||||
import MarkdownHelp from "$lib/components/edit/MarkdownHelp.svelte";
|
import MarkdownHelp from "$lib/components/edit/MarkdownHelp.svelte";
|
||||||
import { Card, CardBody, CardHeader } from "sveltestrap";
|
import { Card, CardBody, CardHeader } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
const member = getContext<Writable<Member>>("member");
|
const member = getContext<Writable<Member>>("member");
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import { Button, Icon } from "sveltestrap";
|
import { Button, Icon } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
import type { Member } from "$lib/api/entities";
|
import type { Member } from "$lib/api/entities";
|
||||||
import EditableField from "$lib/components/edit/EditableField.svelte";
|
import EditableField from "$lib/components/edit/EditableField.svelte";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import { Alert, ButtonGroup, Input } from "sveltestrap";
|
import { Alert, ButtonGroup, Input } from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
import type { Member, PrideFlag } from "$lib/api/entities";
|
import type { Member, PrideFlag } from "$lib/api/entities";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { Button, ButtonGroup, Icon } from "sveltestrap";
|
import { Button, ButtonGroup, Icon } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
import type { APIError, Member } from "$lib/api/entities";
|
import type { APIError, Member } from "$lib/api/entities";
|
||||||
import { PUBLIC_SHORT_BASE } from "$env/static/public";
|
import { PUBLIC_SHORT_BASE } from "$env/static/public";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import type { Member } from "$lib/api/entities";
|
import type { Member } from "$lib/api/entities";
|
||||||
import { Button, Icon, Popover } from "sveltestrap";
|
import { Button, Icon, Popover } from "@sveltestrap/sveltestrap";
|
||||||
import EditablePronouns from "$lib/components/edit/EditablePronouns.svelte";
|
import EditablePronouns from "$lib/components/edit/EditablePronouns.svelte";
|
||||||
import IconButton from "$lib/components/IconButton.svelte";
|
import IconButton from "$lib/components/IconButton.svelte";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Tooltip } from "sveltestrap";
|
import { Tooltip } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
let icon: HTMLElement;
|
let icon: HTMLElement;
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { setContext } from "svelte";
|
import { setContext } from "svelte";
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
import type { LayoutData } from "./$types";
|
import type { LayoutData } from "./$types";
|
||||||
import { Button, ButtonGroup, Icon, Nav, NavItem } from "sveltestrap";
|
import { Button, ButtonGroup, Icon, Nav, NavItem } from "@sveltestrap/sveltestrap";
|
||||||
import type { MeUser, APIError } from "$lib/api/entities";
|
import type { MeUser, APIError } from "$lib/api/entities";
|
||||||
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
||||||
import { addToast, delToast } from "$lib/toast";
|
import { addToast, delToast } from "$lib/toast";
|
||||||
|
|
|
@ -13,7 +13,7 @@ export const load = async ({ params }) => {
|
||||||
const flags = await apiFetchClient<PrideFlag[]>("/users/@me/flags");
|
const flags = await apiFetchClient<PrideFlag[]>("/users/@me/flags");
|
||||||
|
|
||||||
if (params.username !== user.name) {
|
if (params.username !== user.name) {
|
||||||
throw redirect(303, `/@${user.name}/edit`);
|
redirect(303, `/@${user.name}/edit`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -22,7 +22,7 @@ export const load = async ({ params }) => {
|
||||||
flags,
|
flags,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ("code" in e) throw error(500, e as APIError);
|
if ("code" in e) error(500, e as APIError);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import prettyBytes from "pretty-bytes";
|
import prettyBytes from "pretty-bytes";
|
||||||
import { encode } from "base64-arraybuffer";
|
import { encode } from "base64-arraybuffer";
|
||||||
import { FormGroup, Icon, Input } from "sveltestrap";
|
import { FormGroup, Icon, Input } from "@sveltestrap/sveltestrap";
|
||||||
import { userAvatars, type MeUser } from "$lib/api/entities";
|
import { userAvatars, type MeUser } from "$lib/api/entities";
|
||||||
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
||||||
import EditableName from "$lib/components/edit/EditableName.svelte";
|
import EditableName from "$lib/components/edit/EditableName.svelte";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import { MAX_DESCRIPTION_LENGTH, type MeUser } from "$lib/api/entities";
|
import { MAX_DESCRIPTION_LENGTH, type MeUser } from "$lib/api/entities";
|
||||||
import { charCount, renderMarkdown } from "$lib/utils";
|
import { charCount, renderMarkdown } from "$lib/utils";
|
||||||
import MarkdownHelp from "$lib/components/edit/MarkdownHelp.svelte";
|
import MarkdownHelp from "$lib/components/edit/MarkdownHelp.svelte";
|
||||||
import { Card, CardBody, CardHeader } from "sveltestrap";
|
import { Card, CardBody, CardHeader } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
const user = getContext<Writable<MeUser>>("user");
|
const user = getContext<Writable<MeUser>>("user");
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import { Button, Icon } from "sveltestrap";
|
import { Button, Icon } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
import type { MeUser } from "$lib/api/entities";
|
import type { MeUser } from "$lib/api/entities";
|
||||||
import EditableField from "$lib/components/edit/EditableField.svelte";
|
import EditableField from "$lib/components/edit/EditableField.svelte";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import { Alert, ButtonGroup, Input } from "sveltestrap";
|
import { Alert, ButtonGroup, Input } from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
import type { MeUser, PrideFlag } from "$lib/api/entities";
|
import type { MeUser, PrideFlag } from "$lib/api/entities";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import { PreferenceSize, type APIError, type MeUser } from "$lib/api/entities";
|
import { PreferenceSize, type APIError, type MeUser } from "$lib/api/entities";
|
||||||
import IconButton from "$lib/components/IconButton.svelte";
|
import IconButton from "$lib/components/IconButton.svelte";
|
||||||
import { Button, ButtonGroup, FormGroup, Icon, Input, InputGroup } from "sveltestrap";
|
import { Button, ButtonGroup, FormGroup, Icon, Input, InputGroup } from "@sveltestrap/sveltestrap";
|
||||||
import { PUBLIC_SHORT_BASE } from "$env/static/public";
|
import { PUBLIC_SHORT_BASE } from "$env/static/public";
|
||||||
import CustomPreference from "./CustomPreference.svelte";
|
import CustomPreference from "./CustomPreference.svelte";
|
||||||
import { DateTime, FixedOffsetZone } from "luxon";
|
import { DateTime, FixedOffsetZone } from "luxon";
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
Icon,
|
Icon,
|
||||||
InputGroup,
|
InputGroup,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import IconPicker from "./IconPicker.svelte";
|
import IconPicker from "./IconPicker.svelte";
|
||||||
|
|
||||||
export let preference: CustomPreference;
|
export let preference: CustomPreference;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
Icon,
|
Icon,
|
||||||
Input,
|
Input,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import icons from "../../../../icons";
|
import icons from "../../../../icons";
|
||||||
import IconButton from "$lib/components/IconButton.svelte";
|
import IconButton from "$lib/components/IconButton.svelte";
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import type { MeUser } from "$lib/api/entities";
|
import type { MeUser } from "$lib/api/entities";
|
||||||
import { Button, Icon, Popover } from "sveltestrap";
|
import { Button, Icon, Popover } from "@sveltestrap/sveltestrap";
|
||||||
import EditablePronouns from "$lib/components/edit/EditablePronouns.svelte";
|
import EditablePronouns from "$lib/components/edit/EditablePronouns.svelte";
|
||||||
import IconButton from "$lib/components/IconButton.svelte";
|
import IconButton from "$lib/components/IconButton.svelte";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
|
@ -8,10 +8,10 @@ export const load = async ({ params }) => {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
});
|
});
|
||||||
|
|
||||||
throw redirect(303, `/@${resp.name}`);
|
redirect(303, `/@${resp.name}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ((e as APIError).code === ErrorCode.UserNotFound) {
|
if ((e as APIError).code === ErrorCode.UserNotFound) {
|
||||||
throw error(404, e as APIError);
|
error(404, e as APIError);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let authType: string;
|
export let authType: string;
|
||||||
export let remoteName: string | undefined;
|
export let remoteName: string | undefined;
|
||||||
|
|
|
@ -16,14 +16,14 @@ export const load = async ({ params }) => {
|
||||||
} as APIError;
|
} as APIError;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw redirect(303, `/@${user.name}/${member.name}/edit`);
|
redirect(303, `/@${user.name}/${member.name}/edit`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
(e as APIError).code === ErrorCode.Forbidden ||
|
(e as APIError).code === ErrorCode.Forbidden ||
|
||||||
(e as APIError).code === ErrorCode.InvalidToken ||
|
(e as APIError).code === ErrorCode.InvalidToken ||
|
||||||
(e as APIError).code === ErrorCode.NotOwnMember
|
(e as APIError).code === ErrorCode.NotOwnMember
|
||||||
) {
|
) {
|
||||||
throw error(403, e as APIError);
|
error(403, e as APIError);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -8,13 +8,13 @@ export const load = async () => {
|
||||||
try {
|
try {
|
||||||
const resp = await apiFetchClient<MeUser>(`/users/@me`);
|
const resp = await apiFetchClient<MeUser>(`/users/@me`);
|
||||||
|
|
||||||
throw redirect(303, `/@${resp.name}/edit`);
|
redirect(303, `/@${resp.name}/edit`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
(e as APIError).code === ErrorCode.Forbidden ||
|
(e as APIError).code === ErrorCode.Forbidden ||
|
||||||
(e as APIError).code === ErrorCode.InvalidToken
|
(e as APIError).code === ErrorCode.InvalidToken
|
||||||
) {
|
) {
|
||||||
throw error(403, e as APIError);
|
error(403, e as APIError);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
NavbarToggler,
|
NavbarToggler,
|
||||||
NavItem,
|
NavItem,
|
||||||
NavLink,
|
NavLink,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
import Logo from "./Logo.svelte";
|
import Logo from "./Logo.svelte";
|
||||||
import { userStore, themeStore, CURRENT_CHANGELOG, settingsStore } from "$lib/store";
|
import { userStore, themeStore, CURRENT_CHANGELOG, settingsStore } from "$lib/store";
|
||||||
|
|
|
@ -10,7 +10,7 @@ export const load = (async ({ params }) => {
|
||||||
|
|
||||||
const arr = param.split("/");
|
const arr = param.split("/");
|
||||||
if (arr.length === 0 || params.pronouns === "") {
|
if (arr.length === 0 || params.pronouns === "") {
|
||||||
throw error(404, { code: ErrorCode.NotFound, message: "Pronouns not found" });
|
error(404, { code: ErrorCode.NotFound, message: "Pronouns not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arr.length === 5) {
|
if (arr.length === 5) {
|
||||||
|
@ -46,5 +46,5 @@ export const load = (async ({ params }) => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error(404, { code: ErrorCode.NotFound, message: "Pronouns not found" });
|
error(404, { code: ErrorCode.NotFound, message: "Pronouns not found" });
|
||||||
}) satisfies PageLoad;
|
}) satisfies PageLoad;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { fastFetchClient } from "$lib/api/fetch";
|
import { fastFetchClient } from "$lib/api/fetch";
|
||||||
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
||||||
import { addToast } from "$lib/toast";
|
import { addToast } from "$lib/toast";
|
||||||
import { Button, ButtonGroup, FormGroup, Modal, ModalBody, ModalFooter } from "sveltestrap";
|
import { Button, ButtonGroup, FormGroup, Modal, ModalBody, ModalFooter } from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
import ReportCard from "./ReportCard.svelte";
|
import ReportCard from "./ReportCard.svelte";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Report } from "$lib/api/entities";
|
import type { Report } from "$lib/api/entities";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { Card, CardBody, CardFooter, CardHeader } from "sveltestrap";
|
import { Card, CardBody, CardFooter, CardHeader } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let report: Report;
|
export let report: Report;
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import { userStore } from "$lib/store";
|
import { userStore } from "$lib/store";
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
import { addToast } from "$lib/toast";
|
import { addToast } from "$lib/toast";
|
||||||
|
|
|
@ -40,7 +40,7 @@ export const load = (async ({ parent }) => {
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ((e as APIError).code !== ErrorCode.InternalServerError) {
|
if ((e as APIError).code !== ErrorCode.InternalServerError) {
|
||||||
throw redirect(303, "/auth/login");
|
redirect(303, "/auth/login");
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
ModalHeader,
|
ModalHeader,
|
||||||
Table,
|
Table,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
import { DateTime, Duration } from "luxon";
|
import { DateTime, Duration } from "luxon";
|
||||||
import { Alert, Button } from "sveltestrap";
|
import { Alert, Button } from "@sveltestrap/sveltestrap";
|
||||||
import { PUBLIC_MEDIA_URL } from "$env/static/public";
|
import { PUBLIC_MEDIA_URL } from "$env/static/public";
|
||||||
import { fastFetchClient } from "$lib/api/fetch";
|
import { fastFetchClient } from "$lib/api/fetch";
|
||||||
import type { APIError } from "$lib/api/entities";
|
import type { APIError } from "$lib/api/entities";
|
||||||
|
|
|
@ -10,6 +10,6 @@ export const load = async () => {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ((e as APIError).code === ErrorCode.NotFound) return { exportData: null };
|
if ((e as APIError).code === ErrorCode.NotFound) return { exportData: null };
|
||||||
|
|
||||||
throw error(500, e as APIError);
|
error(500, e as APIError);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { MAX_FLAGS, type APIError, type PrideFlag } from "$lib/api/entities";
|
import { MAX_FLAGS, type APIError, type PrideFlag } from "$lib/api/entities";
|
||||||
import { Button, Icon, Input, Modal, ModalBody, ModalFooter, ModalHeader } from "sveltestrap";
|
import { Button, Icon, Input, Modal, ModalBody, ModalFooter, ModalHeader } from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
import Flag from "./Flag.svelte";
|
import Flag from "./Flag.svelte";
|
||||||
import prettyBytes from "pretty-bytes";
|
import prettyBytes from "pretty-bytes";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { flagURL, type APIError, type PrideFlag } from "$lib/api/entities";
|
import { flagURL, type APIError, type PrideFlag } from "$lib/api/entities";
|
||||||
import { apiFetchClient } from "$lib/api/fetch";
|
import { apiFetchClient } from "$lib/api/fetch";
|
||||||
import { addToast } from "$lib/toast";
|
import { addToast } from "$lib/toast";
|
||||||
import { Button, Input, Modal, ModalBody, ModalFooter, ModalHeader } from "sveltestrap";
|
import { Button, Input, Modal, ModalBody, ModalFooter, ModalHeader } from "@sveltestrap/sveltestrap";
|
||||||
|
|
||||||
export let flag: PrideFlag;
|
export let flag: PrideFlag;
|
||||||
export let deleteFlag: (id: string) => Promise<void>;
|
export let deleteFlag: (id: string) => Promise<void>;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { apiFetchClient } from "$lib/api/fetch";
|
import { apiFetchClient } from "$lib/api/fetch";
|
||||||
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { Button, Modal, Table } from "sveltestrap";
|
import { Button, Modal, Table } from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Member } from "$lib/api/entities";
|
import type { Member } from "$lib/api/entities";
|
||||||
import { Alert, ListGroup, ListGroupItem } from "sveltestrap";
|
import { Alert, ListGroup, ListGroupItem } from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
ModalBody,
|
ModalBody,
|
||||||
ModalFooter,
|
ModalFooter,
|
||||||
ModalHeader,
|
ModalHeader,
|
||||||
} from "sveltestrap";
|
} from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
interface Token {
|
interface Token {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
|
||||||
import { addToast } from "$lib/toast";
|
import { addToast } from "$lib/toast";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { Button, Card, CardBody, CardFooter, CardHeader } from "sveltestrap";
|
import { Button, Card, CardBody, CardFooter, CardHeader } from "@sveltestrap/sveltestrap";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import adapter from "@sveltejs/adapter-node";
|
import adapter from "@sveltejs/adapter-node";
|
||||||
import { vitePreprocess } from "@sveltejs/kit/vite";
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
||||||
import * as child_process from "node:child_process";
|
import * as child_process from "node:child_process";
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
|
1645
pnpm-lock.yaml
generated
1645
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue