diff --git a/frontend/config.example.json b/frontend/config.example.json new file mode 100644 index 0000000..a43d4ce --- /dev/null +++ b/frontend/config.example.json @@ -0,0 +1,4 @@ +{ + "api_url": "https://yourdomain.tld/api", + "confetti_chance": "10" +} diff --git a/frontend/src/icons.ts b/frontend/icons.ts similarity index 100% rename from frontend/src/icons.ts rename to frontend/icons.ts diff --git a/frontend/index.pug b/frontend/index.pug index e5ef485..f8e0cf0 100755 --- a/frontend/index.pug +++ b/frontend/index.pug @@ -18,8 +18,8 @@ head meta(property='twitter:title' content='zer0bin') meta(property='twitter:description' content='🖊 Just a place to paste') meta(property='twitter:image' content='https://raw.githubusercontent.com/zer0bin-dev/.github/main/zer0bin.png') - script(defer='' type='module' src='src/index.ts') - script(defer='' type='module' src='src/icons.ts') + script(defer='' type='module' src='index.ts') + script(defer='' type='module' src='icons.ts') ul.noselect#messages .button-wrapper.noselect(style='position: fixed') diff --git a/frontend/src/index.ts b/frontend/index.ts similarity index 97% rename from frontend/src/index.ts rename to frontend/index.ts index 934fc8e..bf65b61 100755 --- a/frontend/src/index.ts +++ b/frontend/index.ts @@ -4,7 +4,9 @@ import hljs from "highlight.js" import JSConfetti from "js-confetti" import Scrollbar from "smooth-scrollbar" -const apiUrl = window.location.hostname + "/api" +import config from "./config.json" +const apiUrl = config.api_url +const confetti_chance = config.api_url let rawContent = "" const jsConfetti = new JSConfetti() @@ -162,7 +164,7 @@ async function savePaste() { rawContent = res["data"]["content"] viewPaste(rawContent, "0") - const rand = Math.floor(Math.random() * 40) + const rand = Math.floor(Math.random() * confetti_chance * 6) if (rand < 5) { jsConfetti.addConfetti({ diff --git a/frontend/src/tsconfig.json b/frontend/tsconfig.json similarity index 100% rename from frontend/src/tsconfig.json rename to frontend/tsconfig.json