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,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import './layout.css';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
import Navbar from '$lib/components/Navbar.svelte';
|
||||
import Footer from '$lib/components/Footer.svelte';
|
||||
import ModalHost from '$lib/components/ModalHost.svelte';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { startTokenRefreshInterval, getToken, refreshTokenIfNeeded } from '$lib/utils/auth';
|
||||
import { parseTotpEnabled } from '$lib/utils/totp';
|
||||
import favicon from '#lib/assets/favicon.svg';
|
||||
import Navbar from '#lib/components/Navbar.svelte';
|
||||
import Footer from '#lib/components/Footer.svelte';
|
||||
import ModalHost from '#lib/components/ModalHost.svelte';
|
||||
import { user } from '#lib/stores/user';
|
||||
import { startTokenRefreshInterval, getToken, refreshTokenIfNeeded } from '#lib/utils/auth';
|
||||
import { parseTotpEnabled } from '#lib/utils/totp';
|
||||
import { page } from '$app/state';
|
||||
import type { LayoutData } from './$types';
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { syntaxes, expiresOptions } from '$lib/consts';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { getToken } from '$lib/utils/auth';
|
||||
import { syntaxes, expiresOptions } from '#lib/consts';
|
||||
import { user } from '#lib/stores/user';
|
||||
import { getToken } from '#lib/utils/auth';
|
||||
import { onMount } from 'svelte';
|
||||
import { fly, fade } from 'svelte/transition';
|
||||
import { encryptAES, estimateEncryptedSize } from '$lib/utils/encryption';
|
||||
import { encryptAES, estimateEncryptedSize } from '#lib/utils/encryption';
|
||||
import {
|
||||
formatBytes,
|
||||
formatNumber,
|
||||
isBinaryData,
|
||||
tooltip,
|
||||
syntaxFromExtension
|
||||
} from '$lib/utils/misc';
|
||||
import { parseMarkdown } from '$lib/utils/markdown';
|
||||
import Dropdown from '$lib/components/Dropdown.svelte';
|
||||
} from '#lib/utils/misc';
|
||||
import { parseMarkdown } from '#lib/utils/markdown';
|
||||
import Dropdown from '#lib/components/Dropdown.svelte';
|
||||
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
||||
import { FileUp, X, Eye, EyeClosed, Dices } from '@lucide/svelte';
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { syntaxes } from '$lib/consts';
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { syntaxes } from '#lib/consts';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import {
|
||||
getCachedOgImage,
|
||||
getCacheControlHeader,
|
||||
getCacheTtlSeconds,
|
||||
scheduleOgImageCachePurge,
|
||||
storeCachedOgImage
|
||||
} from '$lib/server/og/cache';
|
||||
import OgPasteEmbed from '$lib/server/og/PasteEmbed.svelte';
|
||||
import type { PasteEmbedProps } from '$lib/server/og/pasteEmbed';
|
||||
import type { Paste } from '$lib/types/paste';
|
||||
} from '#lib/server/og/cache';
|
||||
import OgPasteEmbed from '#lib/server/og/PasteEmbed.svelte';
|
||||
import type { PasteEmbedProps } from '#lib/server/og/pasteEmbed';
|
||||
import type { Paste } from '#lib/types/paste';
|
||||
import {
|
||||
dateToRelativeString,
|
||||
extractDateFromUUIDv7,
|
||||
formatBytes,
|
||||
formatNumber
|
||||
} from '$lib/utils/misc';
|
||||
} from '#lib/utils/misc';
|
||||
import { Resvg } from '@resvg/resvg-js';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { createRequire } from 'node:module';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import type { Paste } from '$lib/types/paste';
|
||||
import type { PasteComment } from '$lib/types/comment';
|
||||
import { getServerToken } from '$lib/utils/auth';
|
||||
import { apiUrl, viewInternalApiKey } from '$lib/server/api';
|
||||
import type { Paste } from '#lib/types/paste';
|
||||
import type { PasteComment } from '#lib/types/comment';
|
||||
import { getServerToken } from '#lib/utils/auth';
|
||||
import { apiUrl, viewInternalApiKey } from '#lib/server/api';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, fetch, url, cookies, parent, request }) => {
|
||||
|
||||
@@ -36,24 +36,24 @@
|
||||
dateToRelativeString,
|
||||
tooltip,
|
||||
isBinaryData
|
||||
} from '$lib/utils/misc';
|
||||
} from '#lib/utils/misc';
|
||||
import {
|
||||
getIgnoreExternalMediaWarning,
|
||||
parseMarkdown,
|
||||
setIgnoreExternalMediaWarning
|
||||
} from '$lib/utils/markdown';
|
||||
import { syntaxes, expiresOptions } from '$lib/consts';
|
||||
} from '#lib/utils/markdown';
|
||||
import { syntaxes, expiresOptions } from '#lib/consts';
|
||||
import { resolve } from '$app/paths';
|
||||
import { decryptAES, encryptAES } from '$lib/utils/encryption';
|
||||
import { escapeHtml } from '$lib/utils/html';
|
||||
import { decryptAES, encryptAES } from '#lib/utils/encryption';
|
||||
import { escapeHtml } from '#lib/utils/html';
|
||||
import { fade } from 'svelte/transition';
|
||||
import { getToken, hasRole } from '$lib/utils/auth';
|
||||
import { user } from '$lib/stores/user';
|
||||
import Dropdown from '$lib/components/Dropdown.svelte';
|
||||
import PasteComments from '$lib/components/PasteComments.svelte';
|
||||
import { openModal } from '$lib/stores/modal';
|
||||
import type { Paste, PasteReaction } from '$lib/types/paste';
|
||||
import HighlightWorker from '$lib/workers/highlight.worker?worker';
|
||||
import { getToken, hasRole } from '#lib/utils/auth';
|
||||
import { user } from '#lib/stores/user';
|
||||
import Dropdown from '#lib/components/Dropdown.svelte';
|
||||
import PasteComments from '#lib/components/PasteComments.svelte';
|
||||
import { openModal } from '#lib/stores/modal';
|
||||
import type { Paste, PasteReaction } from '#lib/types/paste';
|
||||
import HighlightWorker from '#lib/workers/highlight.worker?worker';
|
||||
interface Props {
|
||||
data: PageData;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { proxyBackendRequest } from '$lib/server/proxy';
|
||||
import { proxyBackendRequest } from '#lib/server/proxy';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
const handle: RequestHandler = ({ params, request, url }) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
import { onMount } from 'svelte';
|
||||
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';
|
||||
|
||||
export const GET = async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import { setTokens, startTokenRefreshInterval } from '#lib/utils/auth';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
import { onMount } from 'svelte';
|
||||
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';
|
||||
|
||||
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';
|
||||
|
||||
export const GET: RequestHandler = ({ params, request, url }) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 }) => {
|
||||
const { id } = params;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import type { Paste } from '$lib/types/paste';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import type { Paste } from '#lib/types/paste';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export const load: PageServerLoad = async ({ fetch, request }) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { onMount } from 'svelte';
|
||||
import Paste from '$lib/components/Paste.svelte';
|
||||
import Paste from '#lib/components/Paste.svelte';
|
||||
|
||||
interface Props {
|
||||
data: PageData;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { setTokens, startTokenRefreshInterval } from '$lib/utils/auth';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import { setTokens, startTokenRefreshInterval } from '#lib/utils/auth';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
import { Check, X, Eye, EyeClosed } from '@lucide/svelte';
|
||||
import { slide, fade } from 'svelte/transition';
|
||||
import { resolve } from '$app/paths';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { getServerToken, clearServerTokens, roles, getUserFromToken } from '$lib/utils/auth';
|
||||
import type { Report } from '$lib/types/report';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import { getServerToken, clearServerTokens, roles, getUserFromToken } from '#lib/utils/auth';
|
||||
import type { Report } from '#lib/types/report';
|
||||
|
||||
export const load: PageServerLoad = async ({ fetch, cookies, params, url, request }) => {
|
||||
const token = getServerToken(cookies);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { resolve } from '$app/paths';
|
||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
|
||||
import { tooltip } from '$lib/utils/misc';
|
||||
import { getToken } from '$lib/utils/auth';
|
||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
|
||||
import { tooltip } from '#lib/utils/misc';
|
||||
import { getToken } from '#lib/utils/auth';
|
||||
|
||||
interface Props {
|
||||
data: PageData;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import {
|
||||
getServerToken,
|
||||
getUserFromToken,
|
||||
clearServerTokens,
|
||||
hasRole,
|
||||
roles
|
||||
} from '$lib/utils/auth';
|
||||
import type { ReportListResponse } from '$lib/types/report';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
} from '#lib/utils/auth';
|
||||
import type { ReportListResponse } from '#lib/types/report';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
|
||||
function normalizeTarget(value: string | null): 'all' | 'pastes' | 'users' {
|
||||
if (value === 'pastes' || value === 'users') return value;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import type { PageData } from './$types';
|
||||
import { resolve } from '$app/paths';
|
||||
import { goto } from '$app/navigation';
|
||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
|
||||
import { tooltip } from '$lib/utils/misc';
|
||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
|
||||
import { tooltip } from '#lib/utils/misc';
|
||||
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
import { Check, X } from '@lucide/svelte';
|
||||
import { slide, fade } from 'svelte/transition';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import { error, isHttpError } from '@sveltejs/kit';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
|
||||
export const load: PageServerLoad = async ({ fetch }) => {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
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';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { getServerToken } from '$lib/utils/auth';
|
||||
import type { User } from '$lib/types/user';
|
||||
import type { Paste } from '$lib/types/paste';
|
||||
import type { Pagination } from '$lib/types/pagination';
|
||||
import type { Report, ReportListResponse } from '$lib/types/report';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import { getServerToken } from '#lib/utils/auth';
|
||||
import type { User } from '#lib/types/user';
|
||||
import type { Paste } from '#lib/types/paste';
|
||||
import type { Pagination } from '#lib/types/pagination';
|
||||
import type { Report, ReportListResponse } from '#lib/types/report';
|
||||
|
||||
function decodeJwtRoles(token?: string | null): number {
|
||||
try {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { goto, afterNavigate } from '$app/navigation';
|
||||
import { page } from '$app/state';
|
||||
import type { PageData } from './$types';
|
||||
import type { Pagination } from '$lib/types/pagination';
|
||||
import type { Pagination } from '#lib/types/pagination';
|
||||
import {
|
||||
User,
|
||||
CalendarDays,
|
||||
@@ -30,13 +30,13 @@
|
||||
tooltip,
|
||||
dateToRelativeString,
|
||||
extractError
|
||||
} from '$lib/utils/misc';
|
||||
import { clearTokens, getToken, hasRole, roles } from '$lib/utils/auth';
|
||||
import { openModal } from '$lib/stores/modal';
|
||||
import { user } from '$lib/stores/user';
|
||||
} from '#lib/utils/misc';
|
||||
import { clearTokens, getToken, hasRole, roles } from '#lib/utils/auth';
|
||||
import { openModal } from '#lib/stores/modal';
|
||||
import { user } from '#lib/stores/user';
|
||||
import { onMount } from 'svelte';
|
||||
import Paste from '$lib/components/Paste.svelte';
|
||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '$lib/types/report';
|
||||
import Paste from '#lib/components/Paste.svelte';
|
||||
import { reportStatusLabels, reportTargetLabels, reportTypeLabels } from '#lib/types/report';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { RequestEvent } from '@sveltejs/kit';
|
||||
import { error, redirect } from '@sveltejs/kit';
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { getServerToken } from '$lib/utils/auth';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import { getServerToken } from '#lib/utils/auth';
|
||||
|
||||
export const load = async ({ params, fetch, cookies }: RequestEvent) => {
|
||||
const token = getServerToken(cookies);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { apiUrl } from '$lib/server/api';
|
||||
import { extractError } from '$lib/utils/misc';
|
||||
import { apiUrl } from '#lib/server/api';
|
||||
import { extractError } from '#lib/utils/misc';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export const load = async ({ url, request }) => {
|
||||
|
||||
Reference in New Issue
Block a user