use my paste server

This commit is contained in:
Lee 2024-04-23 17:52:37 +01:00
parent a0b8777a94
commit 30e55d43c7
2 changed files with 5 additions and 4 deletions

@ -1,4 +1,4 @@
const HASTE_URL: string = "https://haste.fascinated.cc"; const HASTE_URL: string = "https://paste.fascinated.cc";
/** /**
* Creates a new haste with the given content. * Creates a new haste with the given content.
@ -7,11 +7,11 @@ const HASTE_URL: string = "https://haste.fascinated.cc";
* @returns the URL of the created haste * @returns the URL of the created haste
*/ */
export async function createHaste(content: string): Promise<string> { export async function createHaste(content: string): Promise<string> {
const response = await fetch(`${HASTE_URL}/documents`, { const response = await fetch(`${HASTE_URL}/api/upload`, {
method: "POST", method: "POST",
body: content, body: content,
}); });
const { key } = await response.json(); const { id } = await response.json();
return `${HASTE_URL}/${key}`; return `${HASTE_URL}/${id}`;
} }

@ -77,6 +77,7 @@ export function CodeHighlighter({ code, language = "json", rounded = true }: Cod
<span className="text-xs text-muted-foreground">{capitalizeFirstLetter(language)}</span> <span className="text-xs text-muted-foreground">{capitalizeFirstLetter(language)}</span>
</div> </div>
{/* Code */}
<SyntaxHighlighter <SyntaxHighlighter
className={cn("max-h-[600px] !bg-secondary break-all rounded-md", rounded && "rounded-md")} className={cn("max-h-[600px] !bg-secondary break-all rounded-md", rounded && "rounded-md")}
language={language} language={language}