mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
chore: npm run format
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="top-0 left-0 z-100 h-15 w-full bg-neutral-900">
|
<div class="top-0 left-0 z-100 h-15 w-full bg-neutral-900">
|
||||||
<div class="mx-auto md:flex h-15 hidden w-[95%] max-w-7xl items-center py-2">
|
<div class="mx-auto hidden h-15 w-[95%] max-w-7xl items-center py-2 md:flex">
|
||||||
<div>
|
<div>
|
||||||
<a href={resolve('/')} class="text-xl font-bold text-white hover:text-neutral-300">Sharpbin</a
|
<a href={resolve('/')} class="text-xl font-bold text-white hover:text-neutral-300">Sharpbin</a
|
||||||
>
|
>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
<img src={logo} alt="Sharpbin Logo" class="h-8 w-8 group-hover:opacity-80" />
|
<img src={logo} alt="Sharpbin Logo" class="h-8 w-8 group-hover:opacity-80" />
|
||||||
</a>
|
</a>
|
||||||
<button
|
<button
|
||||||
class="ml-auto p-2 flex items-center justify-center h-10 w-10 bg-neutral-800 rounded border border-neutral-700 hover:bg-neutral-700 focus:outline-none"
|
class="ml-auto flex h-10 w-10 items-center justify-center rounded border border-neutral-700 bg-neutral-800 p-2 hover:bg-neutral-700 focus:outline-none"
|
||||||
on:click={() => (menuOpen = !menuOpen)}
|
on:click={() => (menuOpen = !menuOpen)}
|
||||||
aria-label="Toggle Menu"
|
aria-label="Toggle Menu"
|
||||||
aria-expanded={menuOpen}
|
aria-expanded={menuOpen}
|
||||||
@@ -88,48 +88,52 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if menuOpen}
|
{#if menuOpen}
|
||||||
<div
|
<div
|
||||||
class="mx-auto mb-2 w-full px-2 py-3 md:hidden bg-neutral-900 border-b border-neutral-800 rounded-b"
|
class="mx-auto mb-2 w-full rounded-b border-b border-neutral-800 bg-neutral-900 px-2 py-3 md:hidden"
|
||||||
in:slide={{ duration: 180 }}
|
in:slide={{ duration: 180 }}
|
||||||
out:slide={{ duration: 180 }}
|
out:slide={{ duration: 180 }}
|
||||||
style="z-index:1000;position:relative;"
|
style="z-index:1000;position:relative;"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href={resolve('/recent')}
|
href={resolve('/recent')}
|
||||||
class="block w-full rounded px-3 py-2 text-neutral-100 bg-neutral-800 hover:bg-neutral-700 transition-colors text-center"
|
class="block w-full rounded bg-neutral-800 px-3 py-2 text-center text-neutral-100 transition-colors hover:bg-neutral-700"
|
||||||
on:click={() => (menuOpen = false)}
|
on:click={() => (menuOpen = false)}>Recent Pastes</a
|
||||||
>Recent Pastes</a>
|
>
|
||||||
{#if $user}
|
{#if $user}
|
||||||
{#if $user.roles.includes(1) || $user.roles.includes(255)}
|
{#if $user.roles.includes(1) || $user.roles.includes(255)}
|
||||||
<a
|
<a
|
||||||
href={resolve('/reports')}
|
href={resolve('/reports')}
|
||||||
class="mt-1 block w-full rounded px-3 py-2 text-neutral-100 bg-neutral-800 hover:bg-neutral-700 transition-colors text-center"
|
class="mt-1 block w-full rounded bg-neutral-800 px-3 py-2 text-center text-neutral-100 transition-colors hover:bg-neutral-700"
|
||||||
on:click={() => (menuOpen = false)}
|
on:click={() => (menuOpen = false)}>Reports</a
|
||||||
>Reports</a>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
<a
|
<a
|
||||||
href={resolve(`/user/${$user.username}`)}
|
href={resolve(`/user/${$user.username}`)}
|
||||||
class="mt-1 block w-full rounded px-3 py-2 text-neutral-100 bg-neutral-800 hover:bg-neutral-700 transition-colors text-center"
|
class="mt-1 block w-full rounded bg-neutral-800 px-3 py-2 text-center text-neutral-100 transition-colors hover:bg-neutral-700"
|
||||||
on:click={() => (menuOpen = false)}
|
on:click={() => (menuOpen = false)}>Profile</a
|
||||||
>Profile</a>
|
>
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
logout();
|
logout();
|
||||||
menuOpen = false;
|
menuOpen = false;
|
||||||
}}
|
}}
|
||||||
class="mt-1 w-full rounded bg-neutral-800 px-3 py-2 text-neutral-100 hover:bg-neutral-700 transition-colors text-center"
|
class="mt-1 w-full rounded bg-neutral-800 px-3 py-2 text-center text-neutral-100 transition-colors hover:bg-neutral-700"
|
||||||
>Logout</button>
|
>Logout</button
|
||||||
|
>
|
||||||
{:else}
|
{:else}
|
||||||
<a
|
<a
|
||||||
href={resolve(`/login${returnParam}`)}
|
href={resolve(`/login${returnParam}`)}
|
||||||
class="mt-1 block w-full rounded px-3 py-2 text-neutral-100 bg-neutral-800 hover:bg-neutral-700 transition-colors"
|
class="mt-1 block w-full rounded bg-neutral-800 px-3 py-2 text-neutral-100 transition-colors hover:bg-neutral-700"
|
||||||
on:click={() => (menuOpen = false)}
|
on:click={() => (menuOpen = false)}>Login</a
|
||||||
>Login</a>
|
>
|
||||||
<!-- eslint-disable svelte/no-navigation-without-resolve -->
|
<!-- eslint-disable svelte/no-navigation-without-resolve -->
|
||||||
<a
|
<a
|
||||||
href={data.options?.registration_enabled ? resolve(`/register${returnParam}`) : '#'}
|
href={data.options?.registration_enabled ? resolve(`/register${returnParam}`) : '#'}
|
||||||
class="mt-1 block w-full rounded px-3 py-2 text-neutral-100 hover:bg-neutral-700 transition-colors {data.options?.registration_enabled ? '' : 'cursor-not-allowed bg-neutral-900 text-neutral-500'}"
|
class="mt-1 block w-full rounded px-3 py-2 text-neutral-100 transition-colors hover:bg-neutral-700 {data
|
||||||
on:click={() => (menuOpen = false)}
|
.options?.registration_enabled
|
||||||
>Register</a>
|
? ''
|
||||||
|
: 'cursor-not-allowed bg-neutral-900 text-neutral-500'}"
|
||||||
|
on:click={() => (menuOpen = false)}>Register</a
|
||||||
|
>
|
||||||
<!-- eslint-enable svelte/no-navigation-without-resolve -->
|
<!-- eslint-enable svelte/no-navigation-without-resolve -->
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -163,8 +163,7 @@ export const roles = {
|
|||||||
403: 'Banned'
|
403: 'Banned'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const trustedDomains =
|
export const trustedDomains = [
|
||||||
[
|
|
||||||
'img.youtube.com',
|
'img.youtube.com',
|
||||||
'i.ytimg.com',
|
'i.ytimg.com',
|
||||||
|
|
||||||
@@ -195,4 +194,4 @@ export const trustedDomains =
|
|||||||
'cloudflare-ipfs.com',
|
'cloudflare-ipfs.com',
|
||||||
|
|
||||||
'upload.wikimedia.org'
|
'upload.wikimedia.org'
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ const tagMap: Record<string, string> = {
|
|||||||
IFRAME: 'iframe'
|
IFRAME: 'iframe'
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function parseMarkdown(md: string, preventExternal: boolean = true, allowTrustedDomains: boolean = true): Promise<string> {
|
export async function parseMarkdown(
|
||||||
|
md: string,
|
||||||
|
preventExternal: boolean = true,
|
||||||
|
allowTrustedDomains: boolean = true
|
||||||
|
): Promise<string> {
|
||||||
const html = await marked.parse(md);
|
const html = await marked.parse(md);
|
||||||
let dom: WindowLike & { document: Document };
|
let dom: WindowLike & { document: Document };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user