Skip to content

Commit 6f3546f

Browse files
Merge pull request #31 from zer0bin-dev/idk
2 parents 49a34ac + 1b96536 commit 6f3546f

20 files changed

+3857
-2165
lines changed

.github/ISSUE_TEMPLATE/03_public_instance.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ What country is the server in:
1616

1717
What server hardware/provider is the server on:
1818

19-
Are you using CloudFlare:
19+
Are you using CloudFlare or any Google serives (domain, DNS, etc):
2020

2121
What version of zer0bin is it running:
2222

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**/target/
2+
**/.yarn
23
**/node_modules/
34
**/dist/
45
**/.parcel-cache/

.prettierrc.json

-7
This file was deleted.

CODE_OF_CONDUCT.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
24-
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
26-
overall community
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the
26+
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
31-
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
35-
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
37-
professional setting
30+
- The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
3838

3939
## Enforcement Responsibilities
4040

@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
63+
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

CONTRIBUTING.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Contributing Guidelines
2-
- Follow the repository structure
3-
- Commit messages must be descriptive and concise
4-
- Your code must be formatted with the respective formatter
5-
- The frontend must use `prettier` using our config
6-
- The backend must use `rustfmt`
7-
- The frontend must work with `npm`
8-
- Additional frontend packages must not be considered bloated
2+
3+
- Follow the repository structure
4+
- Commit messages must be descriptive and concise
5+
- Your code must be formatted with the formatters we use
6+
- The frontend must use our `prettier` config
7+
- The backend must use `rustfmt`
8+
- The frontend must be installed and compiled with `yarn` and `parcel`
9+
- Additional frontend packages must not be considered bloated
10+
- All commits must follow [Conventional Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits)

README.md

+31-26
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
<br>
1111
<p align="center">
1212
<a href="https://github.com/zer0bin-dev/zer0bin/stargazers">
13-
<img alt="Stargazers" src="https://custom-icon-badges.herokuapp.com/github/stars/zer0bin-dev/zer0bin?style=for-the-badge&logo=star&color=f6c177&logoColor=31748f&labelColor=12101F"></a>
14-
<!-- <a href="https://github.com/zer0bin-dev/zer0bin/releases/latest">
15-
<img alt="Releases" src="https://img.shields.io/github/release/zer0bin-dev/zer0bin?style=for-the-badge&logo=github&color=31748f&logoColor=ebbcba&labelColor=12101F"/></a> -->
13+
<img alt="Stargazers" src="https://custom-icon-badges.herokuapp.com/github/stars/zer0bin-dev/zer0bin?style=for-the-badge&logo=star&color=f6c177&logoColor=31748f&labelColor=191724"></a>
14+
<a href="https://github.com/zer0bin-dev/zer0bin/releases/latest">
15+
<img alt="Releases" src="https://img.shields.io/github/release/zer0bin-dev/zer0bin?style=for-the-badge&logo=github&color=31748f&logoColor=908caa&labelColor=191724"/></a>
1616
<a href="https://github.com/zer0bin-dev/zer0bin/issues">
17-
<img alt="Issues" src="https://custom-icon-badges.herokuapp.com/github/issues/zer0bin-dev/zer0bin?style=for-the-badge&logo=issue-opened&color=9ccfd8&logoColor=eb6f92&labelColor=12101F"></a>
17+
<img alt="Issues" src="https://custom-icon-badges.herokuapp.com/github/issues/zer0bin-dev/zer0bin?style=for-the-badge&logo=issue-opened&color=9ccfd8&logoColor=eb6f92&labelColor=191724"></a>
1818
<a href="https://github.com/zer0bin-dev/zer0bin/blob/main/LICENSE">
19-
<img alt="License" src="https://custom-icon-badges.herokuapp.com/github/license/zer0bin-dev/zer0bin?style=for-the-badge&logo=law&color=c4a7e7&logoColor=ebbcba&labelColor=12101F"></a>
19+
<img alt="License" src="https://custom-icon-badges.herokuapp.com/github/license/zer0bin-dev/zer0bin?style=for-the-badge&logo=law&color=c4a7e7&logoColor=ebbcba&labelColor=191724"></a>
2020
</p>
2121
<br>
2222
</div>
@@ -27,44 +27,45 @@ Submit your public instance [here](https://github.com/Domterion/zer0bin/issues/n
2727

2828
| Website | Expiration | Max paste size | Version | Country |
2929
| ---------------------------------------------- | ---------- | -------------- | ------- | ------- |
30-
| zer0b.in (not up yet) | 7 days | 40,000 chars | vx.x.x | ? |
31-
| [stepbro.voring.me](https://stepbro.voring.me) | 365 days | 69,000 chars | v0.6.1 | 🇺🇸 US |
30+
| zer0b.in | 7 days | 40,000 chars | v1.0.0 | 🇺🇸 USA |
31+
| [stepbro.voring.me](https://stepbro.voring.me) | 365 days | 69,000 chars | v0.7.1 | 🇺🇸 USA |
3232

3333
# Technologies used
3434

3535
### Frontend:
3636

37-
<a href="https://www.typescriptlang.org/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/TypeScript.svg" height=40/></a> <a href="https://sass-lang.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Sass.svg" height=40/></a> <a href="https://pugjs.org/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Pug-Dark.svg" height=40/></a> <a href="https://rosepinetheme.com/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953176309444542464/RosePine.svg" height=40/></a> <a href="https://highlightjs.org/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953177926688464936/HLJS.svg" height=40/></a> <a href="https://github.com/ant-design/ant-design-icons"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953181625259266059/AntIcons-Dark.svg" height=40/></a> <a href="https://github.com/idiotWu/smooth-scrollbar"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953564432628322364/SmoothScrollJS.svg" height=40/></a> <a href="https://github.com/loonywizard/js-confetti"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953564432896782416/JSConfetti.svg" height=40/></a> <a href="https://definitelytyped.org/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953567495321710602/DefinitelyTyped.svg" height=40/></a> <a href="https://parceljs.org/"><img src="https://user-images.githubusercontent.com/44733677/158683062-17ac3b62-cacd-4add-babb-1f74f36020d8.svg" height=40/></a> <a href="https://yarnpkg.org"><img src="https://cdn.discordapp.com/attachments/810799100940255260/954823377493852170/Yarn.svg" height=40/></a> <a href="https://transfonter.org"><img src="https://user-images.githubusercontent.com/44733677/159066877-234f68ba-e95c-439d-b5fe-74def49dc762.svg" height=40></a>
37+
<a href="https://www.typescriptlang.org/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/TypeScript.svg" height=40/></a> <a href="https://sass-lang.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Sass.svg" height=40/></a> <a href="https://pugjs.org/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Pug-Dark.svg" height=40/></a> <a href="https://rosepinetheme.com/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953176309444542464/RosePine.svg" height=40/></a> <a href="https://highlightjs.org/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953177926688464936/HLJS.svg" height=40/></a> <a href="https://github.com/ant-design/ant-design-icons"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953181625259266059/AntIcons-Dark.svg" height=40/></a> <a href="https://github.com/idiotWu/smooth-scrollbar"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953564432628322364/SmoothScrollJS.svg" height=40/></a><br><a href="https://atomiks.github.io/tippyjs/"><img src="https://cdn.discordapp.com/attachments/872332549777666078/955624715521769522/Tippy.svg" height=40/></a> <a href="https://github.com/loonywizard/js-confetti"><img src="https://cdn.discordapp.com/attachments/810799100940255260/955609316042362930/JSConfetti.svg" height=40/></a> <a href="https://definitelytyped.org/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953567495321710602/DefinitelyTyped.svg" height=40/></a> <a href="https://parceljs.org/"><img src="https://user-images.githubusercontent.com/44733677/158683062-17ac3b62-cacd-4add-babb-1f74f36020d8.svg" height=40/></a> <a href="https://prettier.io/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953339670538887318/Prettier.svg" height=40/></a> <a href="https://yarnpkg.org"><img src="https://cdn.discordapp.com/attachments/810799100940255260/954823377493852170/Yarn.svg" height=40/></a> <a href="https://transfonter.org"><img src="https://user-images.githubusercontent.com/44733677/159066877-234f68ba-e95c-439d-b5fe-74def49dc762.svg" height=40></a>
3838

3939
### Backend:
4040

4141
<a href="https://www.rust-lang.org/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Rust.svg" height=40/></a> <a href="https://actix.rs/"><img src="https://user-images.githubusercontent.com/44733677/158648238-0586f185-4e0c-43bc-b6a9-effd18b3b1ac.svg" height=40/></a> <a href="https://github.com/serde-rs/serde"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953176309964627978/Serde-Dark.svg" height=40/></a> <a href="https://github.com/launchbadge/sqlx"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953176310354673704/SQLX-Dark.svg" height=40/></a> <a href="https://github.com/chronotope/chrono"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953178919169835018/NPM-svg.png" height=40/></a> <a href="https://www.postgresql.org/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/PostgreSQL-Dark.svg" height=40/></a> <a href="https://github.com/nikolay-govorov/nanoid"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953176309629067354/NanoID-Dark.svg" height=40/></a>
4242

4343
### Misc:
4444

45-
<a href="https://nginx.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Nginx.svg" height=40/></a> <a href="https://github.com/google/ngx_brotli"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953552981691883520/Brotli.svg" height=40/></a> <a href="https://docker.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Docker.svg" height=40/></a> <a href="https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Markdown-Dark.svg" height=40/></a> <a href="https://prettier.io/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953339670538887318/Prettier.svg" height=40/></a> <a href="https://git-scm.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Git.svg" height=40/></a>
45+
<a href="https://nginx.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Nginx.svg" height=40/></a> <!-- <a href="https://docker.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Docker.svg" height=40/></a> --> <a href="https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Markdown-Dark.svg" height=40/></a> <a href="https://git-scm.com/"><img src="https://github.com/tandpfun/skill-icons/raw/main/icons/Git.svg" height=40/></a> <a href="https://www.conventionalcommits.org/"><img src="https://cdn.discordapp.com/attachments/810799100940255260/954930714007191582/ConventionalCommits.svg" height=40/></a>
4646

4747
###### (Sorta) made with [Skill Icons](https://skillicons.dev/)
4848

4949
# API
5050

51-
- **GET** `/api/p/:id` - Get a paste by ID
52-
- **POST** `/api/p/n` - Post a new paste
53-
- **GET** `/api/s` - Get stats about the instance
51+
- **GET** `/api/p/:id` - Get a paste by ID
52+
- **POST** `/api/p/n` - Post a new paste
53+
- **GET** `/api/s` - Get stats about the instance
5454

5555
# Self-host instructions
5656

5757
### Requirements
5858

59-
- 🦀 [Rust](https://www.rust-lang.org/) ≥ 1.58.0
60-
- 🐈 [Yarn](https://yarnpkg.com/) ≥ 1.0.0
61-
- 🐘 [PostgreSQL](https://www.postgresql.org/) ≥ 9.6
62-
- 🦝 [Nginx](https://www.nginx.com/) ≥ 1.18.0
63-
- 🌾 [Brotli plugin](https://github.com/google/ngx_brotli) recommended
64-
- 🐧 [Linux](https://kernel.org/) or 😈 [FreeBSD](https://freebsd.org/)
65-
- 🌄 Domain with [SSL](https://letsencrypt.org/)
59+
- 🦀 [Rust](https://www.rust-lang.org/) ≥ 1.58.0
60+
- 🐈 [Yarn](https://yarnpkg.com/) ≥ 1.0.0
61+
- 🐘 [PostgreSQL](https://www.postgresql.org/) ≥ 9.6
62+
- 🦝 [Nginx](https://www.nginx.com/) ≥ 1.18.0
63+
- 🌾 [Brotli plugin](https://github.com/google/ngx_brotli) recommended
64+
- 🐧 [Linux](https://kernel.org/) or 😈 [FreeBSD](https://freebsd.org/)
65+
- 🌄 Domain with [SSL](https://letsencrypt.org/)
6666

67-
### Steps
67+
<details>
68+
<summary><h3>Steps</h3></summary>
6869

6970
Please run each command one at a time!
7071

@@ -88,9 +89,10 @@ cargo build --release
8889
./target/release/zer0bin-bin # Preferably in a tmux session or as a service
8990
```
9091

91-
### Configuration
92+
</details>
9293

9394
<details>
95+
<summary><h3>Configuration</h3></summary>
9496

9597
| Key | Values | Description |
9698
| ------------------------------------------ | ------------------------ | ------------------------------------------------------------------------------ |
@@ -112,16 +114,19 @@ cargo build --release
112114
###### Measured with Lighthouse and Firefox Network Performance Analysis
113115

114116
<details>
115-
117+
<summary><h3>Results</h3></summary>
118+
116119
### Homepage
117120

118-
![image](https://user-images.githubusercontent.com/44733677/158523056-2d1b4a38-76f8-413f-b4df-5fd3d920dc66.png)
119-
![image](https://user-images.githubusercontent.com/44733677/158523711-19f34696-b88f-4a6c-9a66-a77cf2f3e74e.png)
121+
![image](https://user-images.githubusercontent.com/44733677/159143364-a6e06aee-256e-4998-83f2-541c77e85184.png)
122+
![image](https://user-images.githubusercontent.com/44733677/159143316-c8e95ed6-ec32-44b3-abcc-18bd204a004d.png)
123+
![image](https://user-images.githubusercontent.com/44733677/159143321-aa8a5f6f-53d2-40d1-bff9-71d72347e7ea.png)
120124

121125
### 20 line paste
122126

123-
![image](https://user-images.githubusercontent.com/44733677/158522958-a226612f-3848-43be-876e-8822a4cc9907.png)
124-
![image](https://user-images.githubusercontent.com/44733677/158523846-d79a94a5-64a5-475a-b481-e72141b47cf6.png)
127+
![image](https://user-images.githubusercontent.com/44733677/159143373-6e8787d8-61ef-44dc-9d66-52cd74e2a495.png)
128+
![image](https://user-images.githubusercontent.com/44733677/159143298-f8c7420d-ff76-4db7-a98e-03ff3615315e.png)
129+
![image](https://user-images.githubusercontent.com/44733677/159143303-efb71e15-623a-42cc-abf6-7e602843d801.png)
125130

126131
</details>
127132

backend/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
name = "backend"
3-
version = "0.1.0"
3+
version = "0.7.1"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
serde = "1.0"
9+
serde = { version = "1.0", features = ["derive"] }
1010
serde_json = "1.0"
1111

1212
actix-rt = "2.6.0"
@@ -31,4 +31,4 @@ debug-assertions = false
3131

3232
[[bin]]
3333
name = "zer0bin-bin"
34-
path = "src/main.rs"
34+
path = "src/main.rs"

backend/src/models.rs

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub struct GetPasteResponse {
3838
#[derive(Serialize)]
3939
pub struct GetStatsResponse {
4040
pub count: i64,
41+
pub version: String,
4142
}
4243

4344
#[derive(Serialize)]

backend/src/routes.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use crate::{
1919

2020
#[get("/s")]
2121
pub async fn get_stats(state: web::Data<AppState>) -> impl Responder {
22+
let version = env!("CARGO_PKG_VERSION").to_string();
2223
// TODO: Maybe there's a less hacky way to do this..?
2324
let count: Result<i64, sqlx::Error> = sqlx::query(r#"SELECT COUNT(*) FROM pastes"#)
2425
.try_map(|row: PgRow| row.try_get::<i64, _>("count"))
@@ -41,6 +42,7 @@ pub async fn get_stats(state: web::Data<AppState>) -> impl Responder {
4142
success: true,
4243
data: GetStatsResponse {
4344
count: count.unwrap(),
45+
version
4446
},
4547
})
4648
}

example.nginx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ server {
1717

1818
root /location/of/zer0bin/frontend/dist;
1919

20-
rewrite ^/~/(.*)$ /index.html;
20+
rewrite ^/(?!.*api)(?!.*\.).*$ /index.html;
2121

2222
location / {
2323
index index.html;

frontend/.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

frontend/index.pug

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ ul.noselect#messages
3737
.line-numbers.noselect
3838
pre#code-view-pre
3939
code#code-view
40-
textarea#text-area(spellcheck='false' autofocus='' name='value' aria-label='Paste input area')
40+
textarea#text-area(spellcheck='false' autofocus='' name='value' aria-label='Paste input area' disabled='')

frontend/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zer0bin",
33
"source": "index.pug",
4-
"version": "0.6.1",
4+
"version": "0.7.1",
55
"browserslist": "> 0.5%, last 2 versions, not dead",
66
"license": "MIT",
77
"scripts": {
@@ -26,6 +26,7 @@
2626
"@ant-design/icons-svg": "^4.2.1",
2727
"highlight.js": "^11.4.0",
2828
"js-confetti": "^0.10.2",
29-
"smooth-scrollbar": "^8.7.4"
29+
"smooth-scrollbar": "^8.7.4",
30+
"tippy.js": "^6.3.7"
3031
}
3132
}

0 commit comments

Comments
 (0)