mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: login & registration; enhanced paste view; custom dropdown + search; navbar; global user access via store; auto token refresh; paste creation as user; /api/user/me, returns info on yourself including pastes;
fix: auth check refactor: remove user UID api endpoint
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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