feat: Add back frontend config

This commit is contained in:
ThatOneCalculator 2022-03-22 15:40:01 -07:00
parent 294b50150f
commit 50ecb91151
5 changed files with 10 additions and 4 deletions

View File

@ -0,0 +1,4 @@
{
"api_url": "https://yourdomain.tld/api",
"confetti_chance": "10"
}

View File

@ -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')

View File

@ -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({