The backend for Paste. https://paste.fascinated.cc
This repository has been archived on 2024-06-10. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2024-06-05 12:03:10 +01:00
.gitea/workflows Update s4u/setup-maven-action action to v1.13.0 2024-05-17 19:01:14 +00:00
src fix ignore content type being missing on /api/upload 2024-06-05 11:58:47 +01:00
.gitignore add logs 2024-04-23 00:46:39 +01:00
Dockerfile Update maven Docker tag to v3.9.7 2024-05-28 21:01:17 +00:00
LICENSE add license 2024-04-24 21:28:01 +01:00
pom.xml add html compression 2024-06-02 10:20:10 +01:00
README.md add readme 2024-06-05 12:03:10 +01:00
renovate.json Add renovate.json 2024-04-23 15:00:40 +00:00

Paste

A simple pastebin service. Running at paste.fascinated.cc.

Javascript Utility

/**
 * Uploads a paste to paste.fascinated.cc
 *
 * @param content the content of the paste
 * @returns the paste key and the URL
 */
async function uploadPaste(content: string) {
  const response = await fetch("https://paste.fascinated.cc/api/upload", {
    method: "POST",
    body: content,
  });
  const json = await response.json();

  if (!response.ok) {
    throw new Error(json.message);
  }

  return {
    ...json,
    url: `https://paste.fascinated.cc/${json.key}`,
  };
}

console.log(await uploadPaste("Hello, World!"));