mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: use #lib instead of $lib
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
import { getRefreshToken, getToken, setTokens } from '$lib/utils/auth';
|
import { getRefreshToken, getToken, setTokens } from '#lib/utils/auth';
|
||||||
import { parseTotpEnabled } from '$lib/utils/totp';
|
import { parseTotpEnabled } from '#lib/utils/totp';
|
||||||
import { tick } from 'svelte';
|
import { tick } from 'svelte';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import type { ModalItem, ModalMode } from '$lib/types/modal';
|
import type { ModalItem, ModalMode } from '#lib/types/modal';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
show?: boolean;
|
show?: boolean;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Modal from '$lib/components/Modal.svelte';
|
import Modal from '#lib/components/Modal.svelte';
|
||||||
import { cancelModal, confirmModal, modal } from '$lib/stores/modal';
|
import { cancelModal, confirmModal, modal } from '#lib/stores/modal';
|
||||||
|
|
||||||
let state = $derived($modal);
|
let state = $derived($modal);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import { clearTokens, hasRole } from '$lib/utils/auth';
|
import { clearTokens, hasRole } from '#lib/utils/auth';
|
||||||
import logo from '$lib/assets/favicon.svg';
|
import logo from '#lib/assets/favicon.svg';
|
||||||
import type { PageData } from '../../routes/$types';
|
import type { PageData } from '../../routes/$types';
|
||||||
import { slide } from 'svelte/transition';
|
import { slide } from 'svelte/transition';
|
||||||
import { Menu, X } from '@lucide/svelte';
|
import { Menu, X } from '@lucide/svelte';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tooltip, dateToRelativeString, formatNumber, formatBytes } from '$lib/utils/misc';
|
import { tooltip, dateToRelativeString, formatNumber, formatBytes } from '#lib/utils/misc';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import {
|
import {
|
||||||
Eye,
|
Eye,
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
HatGlasses,
|
HatGlasses,
|
||||||
ThumbsUp
|
ThumbsUp
|
||||||
} from '@lucide/svelte';
|
} from '@lucide/svelte';
|
||||||
import { syntaxes } from '$lib/consts';
|
import { syntaxes } from '#lib/consts';
|
||||||
import type { Paste } from '$lib/types/paste';
|
import type { Paste } from '#lib/types/paste';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
paste: Paste;
|
paste: Paste;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { CommentReaction, CommentTreeNode } from '$lib/types/comment';
|
import type { CommentReaction, CommentTreeNode } from '#lib/types/comment';
|
||||||
import { dateToRelativeString, tooltip } from '$lib/utils/misc';
|
import { dateToRelativeString, tooltip } from '#lib/utils/misc';
|
||||||
import { parseCommentMarkdown } from '$lib/utils/markdown';
|
import { parseCommentMarkdown } from '#lib/utils/markdown';
|
||||||
import { escapeHtml } from '$lib/utils/html';
|
import { escapeHtml } from '#lib/utils/html';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import PasteCommentItem from '$lib/components/PasteCommentItem.svelte';
|
import PasteCommentItem from '#lib/components/PasteCommentItem.svelte';
|
||||||
import { ThumbsUp, ThumbsDown, Trash2, Shredder, Reply, Quote } from '@lucide/svelte';
|
import { ThumbsUp, ThumbsDown, Trash2, Shredder, Reply, Quote } from '@lucide/svelte';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import RichTextEditor from './RichTextEditor.svelte';
|
import RichTextEditor from './RichTextEditor.svelte';
|
||||||
import { hasRole, roles } from '$lib/utils/auth';
|
import { hasRole, roles } from '#lib/utils/auth';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
node: CommentTreeNode;
|
node: CommentTreeNode;
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { getToken } from '$lib/utils/auth';
|
import { getToken } from '#lib/utils/auth';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import type {
|
import type {
|
||||||
CommentReaction,
|
CommentReaction,
|
||||||
CommentReactionResult,
|
CommentReactionResult,
|
||||||
PasteComment,
|
PasteComment,
|
||||||
CommentTreeNode
|
CommentTreeNode
|
||||||
} from '$lib/types/comment';
|
} from '#lib/types/comment';
|
||||||
import PasteCommentItem from '$lib/components/PasteCommentItem.svelte';
|
import PasteCommentItem from '#lib/components/PasteCommentItem.svelte';
|
||||||
import { SvelteMap } from 'svelte/reactivity';
|
import { SvelteMap } from 'svelte/reactivity';
|
||||||
import RichTextEditor from './RichTextEditor.svelte';
|
import RichTextEditor from './RichTextEditor.svelte';
|
||||||
import { openModal } from '$lib/stores/modal';
|
import { openModal } from '#lib/stores/modal';
|
||||||
import { RefreshCw } from '@lucide/svelte';
|
import { RefreshCw } from '@lucide/svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Bold, Italic, CodeXml, Quote, Send, Eye, Pencil } from '@lucide/svelte';
|
import { Bold, Italic, CodeXml, Quote, Send, Eye, Pencil } from '@lucide/svelte';
|
||||||
import { parseCommentMarkdown } from '$lib/utils/markdown';
|
import { parseCommentMarkdown } from '#lib/utils/markdown';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
class?: string;
|
class?: string;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
// place files you want to import through the `$lib` alias in this folder.
|
// place files you want to import through the `#lib` alias in this folder.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
|
|
||||||
const methodsWithoutBody = new Set(['GET', 'HEAD']);
|
const methodsWithoutBody = new Set(['GET', 'HEAD']);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import type { ModalOpenOptions, ModalState } from '$lib/types/modal';
|
import type { ModalOpenOptions, ModalState } from '#lib/types/modal';
|
||||||
|
|
||||||
const initialState: ModalState = {
|
const initialState: ModalState = {
|
||||||
show: false,
|
show: false,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import type { AuthUser } from '$lib/types/user';
|
import type { AuthUser } from '#lib/types/user';
|
||||||
|
|
||||||
let initial: AuthUser | null = null;
|
let initial: AuthUser | null = null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import type { Cookies } from '@sveltejs/kit';
|
import type { Cookies } from '@sveltejs/kit';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import type { JWTUser } from '$lib/types/user';
|
import type { JWTUser } from '#lib/types/user';
|
||||||
|
|
||||||
export const roles = {
|
export const roles = {
|
||||||
User: 1,
|
User: 1,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import createDOMPurify from 'dompurify';
|
import createDOMPurify from 'dompurify';
|
||||||
import type { WindowLike } from 'dompurify';
|
import type { WindowLike } from 'dompurify';
|
||||||
import { trustedDomains } from '$lib/consts';
|
import { trustedDomains } from '#lib/consts';
|
||||||
import { escapeHtml } from './html';
|
import { escapeHtml } from './html';
|
||||||
|
|
||||||
export const externalMediaWarningStorageKey = 'sharpbin:ignore-external-media-warning';
|
export const externalMediaWarningStorageKey = 'sharpbin:ignore-external-media-warning';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { syntaxes } from '$lib/consts';
|
import { syntaxes } from '#lib/consts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bytes Bytes to format.
|
* @param bytes Bytes to format.
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import './layout.css';
|
import './layout.css';
|
||||||
import favicon from '$lib/assets/favicon.svg';
|
import favicon from '#lib/assets/favicon.svg';
|
||||||
import Navbar from '$lib/components/Navbar.svelte';
|
import Navbar from '#lib/components/Navbar.svelte';
|
||||||
import Footer from '$lib/components/Footer.svelte';
|
import Footer from '#lib/components/Footer.svelte';
|
||||||
import ModalHost from '$lib/components/ModalHost.svelte';
|
import ModalHost from '#lib/components/ModalHost.svelte';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import { startTokenRefreshInterval, getToken, refreshTokenIfNeeded } from '$lib/utils/auth';
|
import { startTokenRefreshInterval, getToken, refreshTokenIfNeeded } from '#lib/utils/auth';
|
||||||
import { parseTotpEnabled } from '$lib/utils/totp';
|
import { parseTotpEnabled } from '#lib/utils/totp';
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import type { LayoutData } from './$types';
|
import type { LayoutData } from './$types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { syntaxes, expiresOptions } from '$lib/consts';
|
import { syntaxes, expiresOptions } from '#lib/consts';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import { getToken } from '$lib/utils/auth';
|
import { getToken } from '#lib/utils/auth';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { fly, fade } from 'svelte/transition';
|
import { fly, fade } from 'svelte/transition';
|
||||||
import { encryptAES, estimateEncryptedSize } from '$lib/utils/encryption';
|
import { encryptAES, estimateEncryptedSize } from '#lib/utils/encryption';
|
||||||
import {
|
import {
|
||||||
formatBytes,
|
formatBytes,
|
||||||
formatNumber,
|
formatNumber,
|
||||||
isBinaryData,
|
isBinaryData,
|
||||||
tooltip,
|
tooltip,
|
||||||
syntaxFromExtension
|
syntaxFromExtension
|
||||||
} from '$lib/utils/misc';
|
} from '#lib/utils/misc';
|
||||||
import { parseMarkdown } from '$lib/utils/markdown';
|
import { parseMarkdown } from '#lib/utils/markdown';
|
||||||
import Dropdown from '$lib/components/Dropdown.svelte';
|
import Dropdown from '#lib/components/Dropdown.svelte';
|
||||||
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
||||||
import { FileUp, X, Eye, EyeClosed, Dices } from '@lucide/svelte';
|
import { FileUp, X, Eye, EyeClosed, Dices } from '@lucide/svelte';
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import { syntaxes } from '$lib/consts';
|
import { syntaxes } from '#lib/consts';
|
||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import {
|
import {
|
||||||
getCachedOgImage,
|
getCachedOgImage,
|
||||||
getCacheControlHeader,
|
getCacheControlHeader,
|
||||||
getCacheTtlSeconds,
|
getCacheTtlSeconds,
|
||||||
scheduleOgImageCachePurge,
|
scheduleOgImageCachePurge,
|
||||||
storeCachedOgImage
|
storeCachedOgImage
|
||||||
} from '$lib/server/og/cache';
|
} from '#lib/server/og/cache';
|
||||||
import OgPasteEmbed from '$lib/server/og/PasteEmbed.svelte';
|
import OgPasteEmbed from '#lib/server/og/PasteEmbed.svelte';
|
||||||
import type { PasteEmbedProps } from '$lib/server/og/pasteEmbed';
|
import type { PasteEmbedProps } from '#lib/server/og/pasteEmbed';
|
||||||
import type { Paste } from '$lib/types/paste';
|
import type { Paste } from '#lib/types/paste';
|
||||||
import {
|
import {
|
||||||
dateToRelativeString,
|
dateToRelativeString,
|
||||||
extractDateFromUUIDv7,
|
extractDateFromUUIDv7,
|
||||||
formatBytes,
|
formatBytes,
|
||||||
formatNumber
|
formatNumber
|
||||||
} from '$lib/utils/misc';
|
} from '#lib/utils/misc';
|
||||||
import { Resvg } from '@resvg/resvg-js';
|
import { Resvg } from '@resvg/resvg-js';
|
||||||
import { readFile } from 'node:fs/promises';
|
import { readFile } from 'node:fs/promises';
|
||||||
import { createRequire } from 'node:module';
|
import { createRequire } from 'node:module';
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import type { Paste } from '$lib/types/paste';
|
import type { Paste } from '#lib/types/paste';
|
||||||
import type { PasteComment } from '$lib/types/comment';
|
import type { PasteComment } from '#lib/types/comment';
|
||||||
import { getServerToken } from '$lib/utils/auth';
|
import { getServerToken } from '#lib/utils/auth';
|
||||||
import { apiUrl, viewInternalApiKey } from '$lib/server/api';
|
import { apiUrl, viewInternalApiKey } from '#lib/server/api';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params, fetch, url, cookies, parent, request }) => {
|
export const load: PageServerLoad = async ({ params, fetch, url, cookies, parent, request }) => {
|
||||||
|
|||||||
@@ -36,24 +36,24 @@
|
|||||||
dateToRelativeString,
|
dateToRelativeString,
|
||||||
tooltip,
|
tooltip,
|
||||||
isBinaryData
|
isBinaryData
|
||||||
} from '$lib/utils/misc';
|
} from '#lib/utils/misc';
|
||||||
import {
|
import {
|
||||||
getIgnoreExternalMediaWarning,
|
getIgnoreExternalMediaWarning,
|
||||||
parseMarkdown,
|
parseMarkdown,
|
||||||
setIgnoreExternalMediaWarning
|
setIgnoreExternalMediaWarning
|
||||||
} from '$lib/utils/markdown';
|
} from '#lib/utils/markdown';
|
||||||
import { syntaxes, expiresOptions } from '$lib/consts';
|
import { syntaxes, expiresOptions } from '#lib/consts';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { decryptAES, encryptAES } from '$lib/utils/encryption';
|
import { decryptAES, encryptAES } from '#lib/utils/encryption';
|
||||||
import { escapeHtml } from '$lib/utils/html';
|
import { escapeHtml } from '#lib/utils/html';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { getToken, hasRole } from '$lib/utils/auth';
|
import { getToken, hasRole } from '#lib/utils/auth';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import Dropdown from '$lib/components/Dropdown.svelte';
|
import Dropdown from '#lib/components/Dropdown.svelte';
|
||||||
import PasteComments from '$lib/components/PasteComments.svelte';
|
import PasteComments from '#lib/components/PasteComments.svelte';
|
||||||
import { openModal } from '$lib/stores/modal';
|
import { openModal } from '#lib/stores/modal';
|
||||||
import type { Paste, PasteReaction } from '$lib/types/paste';
|
import type { Paste, PasteReaction } from '#lib/types/paste';
|
||||||
import HighlightWorker from '$lib/workers/highlight.worker?worker';
|
import HighlightWorker from '#lib/workers/highlight.worker?worker';
|
||||||
interface Props {
|
interface Props {
|
||||||
data: PageData;
|
data: PageData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { proxyBackendRequest } from '$lib/server/proxy';
|
import { proxyBackendRequest } from '#lib/server/proxy';
|
||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from './$types';
|
||||||
|
|
||||||
const handle: RequestHandler = ({ params, request, url }) => {
|
const handle: RequestHandler = ({ params, request, url }) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import { json } from '@sveltejs/kit';
|
import { json } from '@sveltejs/kit';
|
||||||
|
|
||||||
export const GET = async () => {
|
export const GET = async () => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth';
|
import { setTokens, startTokenRefreshInterval } from '#lib/utils/auth';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { proxyBackendRequest } from '$lib/server/proxy';
|
import { proxyBackendRequest } from '#lib/server/proxy';
|
||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from './$types';
|
||||||
|
|
||||||
export const GET: RequestHandler = ({ request, url }) => {
|
export const GET: RequestHandler = ({ request, url }) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { proxyBackendRequest } from '$lib/server/proxy';
|
import { proxyBackendRequest } from '#lib/server/proxy';
|
||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from './$types';
|
||||||
|
|
||||||
export const GET: RequestHandler = ({ params, request, url }) => {
|
export const GET: RequestHandler = ({ params, request, url }) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ params, request }) => {
|
export const GET: RequestHandler = async ({ params, request }) => {
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import type { Paste } from '$lib/types/paste';
|
import type { Paste } from '#lib/types/paste';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ fetch, request }) => {
|
export const load: PageServerLoad = async ({ fetch, request }) => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import Paste from '$lib/components/Paste.svelte';
|
import Paste from '#lib/components/Paste.svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: PageData;
|
data: PageData;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth';
|
import { setTokens, startTokenRefreshInterval } from '#lib/utils/auth';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import { Check, X, Eye, EyeClosed } from '@lucide/svelte';
|
import { Check, X, Eye, EyeClosed } from '@lucide/svelte';
|
||||||
import { slide, fade } from 'svelte/transition';
|
import { slide, fade } from 'svelte/transition';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import { getServerToken, clearServerTokens, roles, getUserFromToken } from '$lib/utils/auth';
|
import { getServerToken, clearServerTokens, roles, getUserFromToken } from '#lib/utils/auth';
|
||||||
import type { Report } from '$lib/types/report';
|
import type { Report } from '#lib/types/report';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ fetch, cookies, params, url, request }) => {
|
export const load: PageServerLoad = async ({ fetch, cookies, params, url, request }) => {
|
||||||
const token = getServerToken(cookies);
|
const token = getServerToken(cookies);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
|
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
|
||||||
import { tooltip } from '$lib/utils/misc';
|
import { tooltip } from '#lib/utils/misc';
|
||||||
import { getToken } from '$lib/utils/auth';
|
import { getToken } from '#lib/utils/auth';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: PageData;
|
data: PageData;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import {
|
import {
|
||||||
getServerToken,
|
getServerToken,
|
||||||
getUserFromToken,
|
getUserFromToken,
|
||||||
clearServerTokens,
|
clearServerTokens,
|
||||||
hasRole,
|
hasRole,
|
||||||
roles
|
roles
|
||||||
} from '$lib/utils/auth';
|
} from '#lib/utils/auth';
|
||||||
import type { ReportListResponse } from '$lib/types/report';
|
import type { ReportListResponse } from '#lib/types/report';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
|
|
||||||
function normalizeTarget(value: string | null): 'all' | 'pastes' | 'users' {
|
function normalizeTarget(value: string | null): 'all' | 'pastes' | 'users' {
|
||||||
if (value === 'pastes' || value === 'users') return value;
|
if (value === 'pastes' || value === 'users') return value;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
|
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
|
||||||
import { tooltip } from '$lib/utils/misc';
|
import { tooltip } from '#lib/utils/misc';
|
||||||
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import { Check, X } from '@lucide/svelte';
|
import { Check, X } from '@lucide/svelte';
|
||||||
import { slide, fade } from 'svelte/transition';
|
import { slide, fade } from 'svelte/transition';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import { error, isHttpError } from '@sveltejs/kit';
|
import { error, isHttpError } from '@sveltejs/kit';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ fetch }) => {
|
export const load: PageServerLoad = async ({ fetch }) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { formatBytes, formatNumber, tooltip } from '$lib/utils/misc';
|
import { formatBytes, formatNumber, tooltip } from '#lib/utils/misc';
|
||||||
import { FileText, Users, Database, TrendingUp } from '@lucide/svelte';
|
import { FileText, Users, Database, TrendingUp } from '@lucide/svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import { getServerToken } from '$lib/utils/auth';
|
import { getServerToken } from '#lib/utils/auth';
|
||||||
import type { User } from '$lib/types/user';
|
import type { User } from '#lib/types/user';
|
||||||
import type { Paste } from '$lib/types/paste';
|
import type { Paste } from '#lib/types/paste';
|
||||||
import type { Pagination } from '$lib/types/pagination';
|
import type { Pagination } from '#lib/types/pagination';
|
||||||
import type { Report, ReportListResponse } from '$lib/types/report';
|
import type { Report, ReportListResponse } from '#lib/types/report';
|
||||||
|
|
||||||
function decodeJwtRoles(token?: string | null): number {
|
function decodeJwtRoles(token?: string | null): number {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { goto, afterNavigate } from '$app/navigation';
|
import { goto, afterNavigate } from '$app/navigation';
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import type { Pagination } from '$lib/types/pagination';
|
import type { Pagination } from '#lib/types/pagination';
|
||||||
import {
|
import {
|
||||||
User,
|
User,
|
||||||
CalendarDays,
|
CalendarDays,
|
||||||
@@ -30,13 +30,13 @@
|
|||||||
tooltip,
|
tooltip,
|
||||||
dateToRelativeString,
|
dateToRelativeString,
|
||||||
extractError
|
extractError
|
||||||
} from '$lib/utils/misc';
|
} from '#lib/utils/misc';
|
||||||
import { clearTokens, getToken, hasRole, roles } from '$lib/utils/auth';
|
import { clearTokens, getToken, hasRole, roles } from '#lib/utils/auth';
|
||||||
import { openModal } from '$lib/stores/modal';
|
import { openModal } from '#lib/stores/modal';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '#lib/stores/user';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import Paste from '$lib/components/Paste.svelte';
|
import Paste from '#lib/components/Paste.svelte';
|
||||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
|
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { RequestEvent } from '@sveltejs/kit';
|
import type { RequestEvent } from '@sveltejs/kit';
|
||||||
import { error, redirect } from '@sveltejs/kit';
|
import { error, redirect } from '@sveltejs/kit';
|
||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import { getServerToken } from '$lib/utils/auth';
|
import { getServerToken } from '#lib/utils/auth';
|
||||||
|
|
||||||
export const load = async ({ params, fetch, cookies }: RequestEvent) => {
|
export const load = async ({ params, fetch, cookies }: RequestEvent) => {
|
||||||
const token = getServerToken(cookies);
|
const token = getServerToken(cookies);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { apiUrl } from '$lib/server/api';
|
import { apiUrl } from '#lib/server/api';
|
||||||
import { extractError } from '$lib/utils/misc';
|
import { extractError } from '#lib/utils/misc';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
export const load = async ({ url, request }) => {
|
export const load = async ({ url, request }) => {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"moduleResolution": "bundler"
|
"moduleResolution": "bundler"
|
||||||
}
|
}
|
||||||
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
||||||
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
// except #lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
||||||
//
|
//
|
||||||
// To make changes to top-level options such as include and exclude, we recommend extending
|
// To make changes to top-level options such as include and exclude, we recommend extending
|
||||||
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
|
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
|
||||||
|
|||||||
Reference in New Issue
Block a user