mirror of https://github.com/zer0bin-dev/zer0bin
feat: ✨ Customizable confetti chance
This commit is contained in:
parent
e6a4341976
commit
5948dcfda5
17
README.md
17
README.md
|
@ -95,6 +95,8 @@ cargo build --release
|
|||
<details>
|
||||
<summary><h3>Configuration</h3></summary>
|
||||
|
||||
<h3>Backend</h3>
|
||||
|
||||
| Key | Values | Description |
|
||||
| ------------------------------------------ | ------------------------ | ------------------------------------------------------------------------------ |
|
||||
| server.backend_host | 127.0.0.1 or 0.0.0.0 | The host to run the backend on |
|
||||
|
@ -108,15 +110,22 @@ cargo build --release
|
|||
| logging.on_post_paste | true or false | Log on new paste is made |
|
||||
| logging.on_get_paste | true or false | Log on paste get |
|
||||
|
||||
</details>
|
||||
|
||||
<h3>Frontend</h3>
|
||||
|
||||
| Key | Values | Description |
|
||||
| --------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| api_url | API URL | The URL of the API. Should be your instance's domain + /api |
|
||||
| confetti_chance | Positive number from 6 to 2^64 - 1 | The 6 out of \<number\> chance of confetti showing on saving a paste. The default of 40 means there's a 6/40 chance of confetti |
|
||||
|
||||
</details>
|
||||
|
||||
# Benchmarks
|
||||
|
||||
###### Measured with Lighthouse and Firefox Network Performance Analysis
|
||||
|
||||
<details>
|
||||
<summary><h3>Results</h3></summary>
|
||||
|
||||
|
||||
### Homepage
|
||||
|
||||
![image](https://user-images.githubusercontent.com/44733677/159571157-64cebfa7-c10b-4597-b493-df9186c07680.png)
|
||||
|
@ -130,7 +139,7 @@ cargo build --release
|
|||
![image](https://user-images.githubusercontent.com/44733677/159571491-8afe7dcd-9e64-46fe-b23a-4a2fe2763adf.png)
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
# Contributing
|
||||
|
||||
See [CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{
|
||||
"api_url": "https://example.tld/api"
|
||||
"api_url": "https://example.tld/api",
|
||||
"confetti_chance": 40
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import Scrollbar from "smooth-scrollbar"
|
|||
|
||||
import config from "../config.json"
|
||||
const apiUrl = config.api_url
|
||||
const confettiChance = config.confetti_chance
|
||||
let rawContent = ""
|
||||
|
||||
const jsConfetti = new JSConfetti()
|
||||
|
@ -163,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() * confettiChance)
|
||||
|
||||
if (rand < 5) {
|
||||
jsConfetti.addConfetti({
|
||||
|
|
Loading…
Reference in New Issue