mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: implement paste decryption
refactor: switch back to highlight.js
This commit is contained in:
@@ -14,12 +14,16 @@
|
||||
$: returnParam = currentPath !== '/' ? `?return=${encodeURIComponent($page.url.pathname + $page.url.search)}` : '';
|
||||
</script>
|
||||
|
||||
<div class="fixed top-0 left-0 h-15 w-full bg-neutral-900">
|
||||
<div class="fixed top-0 left-0 h-15 w-full bg-neutral-900 z-100">
|
||||
<div class="mx-auto flex h-15 max-w-5xl items-center px-4 py-2">
|
||||
<a href={resolve('/')} class="text-xl font-bold text-white hover:text-neutral-300">Sharpbin</a>
|
||||
{#if $user}
|
||||
<div class="ml-auto flex items-center space-x-4">
|
||||
<span class="text-neutral-400">{$user.username}</span>
|
||||
<a
|
||||
href={resolve(`/dashboard`)}
|
||||
class="rounded bg-neutral-700 px-3 py-1 text-white hover:bg-neutral-800"
|
||||
>Profile</a
|
||||
>
|
||||
<button
|
||||
on:click={logout}
|
||||
class="rounded bg-neutral-700 px-3 py-1 text-white hover:bg-neutral-800 cursor-pointer">Logout</button
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { createHighlighter } from 'shiki';
|
||||
|
||||
import type { Highlighter } from 'shiki';
|
||||
let highlighterPromise: Promise<Highlighter> | null = null;
|
||||
|
||||
async function loadHighlighter() {
|
||||
const res = await fetch('http://localhost:5050/api/paste/create/options');
|
||||
if (!res.ok) throw new Error('Failed to fetch paste options');
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
return createHighlighter({
|
||||
themes: ['github-dark', 'github-light'],
|
||||
langs: data.syntaxes
|
||||
});
|
||||
}
|
||||
|
||||
export function getShiki() {
|
||||
if (!highlighterPromise) {
|
||||
highlighterPromise = loadHighlighter();
|
||||
}
|
||||
return highlighterPromise;
|
||||
}
|
||||
Reference in New Issue
Block a user