zer0bin/README.md

138 lines
9.9 KiB
Markdown
Raw Normal View History

2022-02-28 21:10:02 +00:00
<div align="center">
2022-03-16 19:47:52 +00:00
<a href="https://zer0b.in">
2022-03-16 16:41:14 +00:00
<img src="https://raw.githubusercontent.com/zer0bin-dev/.github/main/zer0bin.svg" height="150px"/>
2022-03-05 00:58:33 +00:00
<br>
2022-03-16 16:41:14 +00:00
<img src="https://raw.githubusercontent.com/zer0bin-dev/.github/main/zer0bin-rainbow.svg" height="100"/>
2022-03-05 00:58:33 +00:00
<br>
2022-03-16 19:47:52 +00:00
</a>
2022-03-05 00:58:33 +00:00
Just a place to paste
2022-02-28 21:10:02 +00:00
<br>
2022-03-01 02:40:06 +00:00
<br>
2022-03-01 02:24:50 +00:00
<p align="center">
2022-03-16 16:42:26 +00:00
<a href="https://github.com/zer0bin-dev/zer0bin/stargazers">
<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>
<!-- <a href="https://github.com/zer0bin-dev/zer0bin/releases/latest">
<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> -->
<a href="https://github.com/zer0bin-dev/zer0bin/issues">
<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>
<a href="https://github.com/zer0bin-dev/zer0bin/blob/main/LICENSE">
<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>
2022-03-01 02:24:50 +00:00
</p>
2022-02-28 21:10:02 +00:00
<br>
</div>
# Public instances
2022-03-01 13:48:26 +00:00
2022-03-01 02:07:35 +00:00
Submit your public instance [here](https://github.com/Domterion/zer0bin/issues/new?assignees=&labels=&template=03_public_instance.md&title=%F0%9F%9A%80+)!
2022-03-01 02:00:07 +00:00
2022-03-14 03:01:43 +00:00
| Website | Expiration | Max paste size | Version | Country |
2022-03-15 18:34:19 +00:00
| ---------------------------------------------- | ---------- | -------------- | ------- | ------- |
2022-03-14 03:01:43 +00:00
| zer0b.in (not up yet) | 7 days | 40,000 chars | vx.x.x | ? |
2022-03-16 18:17:06 +00:00
| [stepbro.voring.me](https://stepbro.voring.me) | 365 days | 69,000 chars | v0.6.1 | 🇺🇸 US |
2022-03-01 02:00:07 +00:00
2022-03-05 01:54:47 +00:00
# Technologies used
2022-03-05 01:54:26 +00:00
2022-03-15 05:53:32 +00:00
### Frontend:
2022-03-15 18:34:19 +00:00
2022-03-16 20:18:23 +00:00
<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://npmjs.org"><img src="https://cdn.discordapp.com/attachments/810799100940255260/953176309259972638/NPM.svg" height=40/></a>
2022-03-15 05:53:32 +00:00
### Backend:
2022-03-15 18:34:19 +00:00
2022-03-16 17:12:10 +00:00
<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>
2022-03-05 01:54:26 +00:00
### Misc:
2022-03-15 18:34:19 +00:00
2022-03-16 08:06:54 +00:00
<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>
2022-03-15 07:09:05 +00:00
# API
2022-03-15 18:34:19 +00:00
- **GET** `/api/p/:id` - Get a paste by ID
- **POST** `/api/p/n` - Post a new paste
- **GET** `/api/s` - Get stats about the instance
2022-03-15 07:09:05 +00:00
2022-03-14 02:59:59 +00:00
# Self-host instructions
2022-03-01 13:48:26 +00:00
2022-03-01 00:17:29 +00:00
### Requirements
2022-03-15 18:34:19 +00:00
- 🦀 Rust ≥ 1.58.0
- 🚢 Cargo ≥ 1.58.0
- 🐢 NodeJS ≥ 16.0
- 🚀 NPM ≥ 8.0.0
- 🐘 PostgreSQL ≥ 9.6
- 🦝 Nginx ≥ 1.18.0
2022-03-16 08:56:39 +00:00
- 🥖 [Brotli](https://github.com/google/ngx_brotli) plugin reccomended
- 📍 Domain linked to your server
- 🌄 Must have [SSL certs](https://letsencrypt.org/)
2022-03-16 08:46:31 +00:00
- 🐧 \*nix OS (Linux, \*BSD, etc)
2022-03-01 00:17:29 +00:00
2022-03-01 02:18:11 +00:00
### Steps
2022-03-15 18:34:19 +00:00
2022-03-14 02:59:39 +00:00
<!--
2022-03-01 00:17:29 +00:00
1. `git clone https://github.com/Domterion/zer0bin && cd zer0bin`
2022-03-14 02:59:39 +00:00
2. Edit `example.nginx` as appropriate, then `mv example.nginx yourdomain.tld && for i in /etc/nginx/sites-available/ /etc/nginx/sites-enabled/; do cp ./yourdomain.tld $i; done && systemctl nginx restart`
3. `psql -f schema.sql -U postgres zer0bin`
4. `cd frontend`
5. `cp config.example.json config.json` and edit as appropriate
6. `npm i && npm run build`
7. `cd ../backend`
8. `cp config.example.json config.json` and edit as appropriate
9. `cargo build --release`
10. `./target/release/backend` (preferably in a tmux session or as a service)
-->
2022-03-15 07:16:25 +00:00
🐋 Docker is coming soon:tm:
Please run each command one at a time!
2022-03-14 02:59:39 +00:00
```bash
# export EDITOR=nano
git clone https://github.com/Domterion/zer0bin && cd zer0bin
$EDITOR example.nginx # Edit as appropriate
mv example.nginx yourdomain.tld
2022-03-14 06:07:05 +00:00
sudo cp ./yourdomain.tld /etc/nginx/sites-available
sudo cp ./yourdomain.tld /etc/nginx/sites-enabled
2022-03-14 20:13:49 +00:00
systemctl nginx restart # Or whichever process manager you use
2022-03-14 02:59:39 +00:00
cd frontend
cp config.example.json config.json
$EDITOR config.json # Edit as appropriate
npm i && npm run build
cd ../backend
2022-03-14 05:46:06 +00:00
psql -f schema.sql -U postgres zer0bin
2022-03-14 02:59:39 +00:00
cp config.example.json config.json
$EDITOR config.json # Edit as appropriate
cargo build --release
2022-03-14 17:01:12 +00:00
./target/release/zer0bin-bin # Preferably in a tmux session or as a service
2022-03-14 02:59:39 +00:00
```
2022-03-01 13:48:26 +00:00
2022-03-01 14:14:44 +00:00
### Configuration
| Key | Values | Description |
| ------------------------------------------ | ------------------------ | ------------------------------------------------------------------------------ |
| server.backend_host | 127.0.0.1 or 0.0.0.0 | The host to run the backend on |
| server.backend_port | Any open port | The port to run the backend on |
| pastes.character_limit | Number up to 2^64 - 1 | The amount of characters allowed in a single paste |
| pastes.days_til_expiration | Number up to 2^63 or -1 | The days till a paste is to expire. If set to -1 then pastes will never expire |
| pastes.id_length | Number up to 2^64 - 1 | The length of the ID for each paste |
| databases.postgres_uri | PostreSQL Connection URI | The URI to use when connecting to a PostgreSQL database |
| ratelimits.seconds_in_between_pastes | Number up to 2^64 - 1 | The seconds between paste uploads |
| ratelimits.allowed_pastes_before_ratelimit | Number up to 2^32 - 1 | Amount of requests that can be made before they are blocked and have to wait |
2022-03-16 23:40:44 +00:00
| logging.on_post_paste | true or false | Log on new paste is made |
| logging.on_get_paste | true or false | Log on paste get |
2022-03-14 04:40:09 +00:00
2022-03-14 04:44:16 +00:00
# Benchmarks
2022-03-16 08:56:39 +00:00
2022-03-16 05:39:24 +00:00
###### Measured with Lighthouse and Firefox Network Performance Analysis
2022-03-15 18:34:19 +00:00
2022-03-16 04:17:57 +00:00
### Homepage
2022-03-16 08:56:39 +00:00
2022-03-16 05:31:57 +00:00
![image](https://user-images.githubusercontent.com/44733677/158523056-2d1b4a38-76f8-413f-b4df-5fd3d920dc66.png)
2022-03-16 05:39:24 +00:00
![image](https://user-images.githubusercontent.com/44733677/158523711-19f34696-b88f-4a6c-9a66-a77cf2f3e74e.png)
2022-03-16 05:31:57 +00:00
### 20 line paste
2022-03-16 08:56:39 +00:00
2022-03-16 05:31:57 +00:00
![image](https://user-images.githubusercontent.com/44733677/158522958-a226612f-3848-43be-876e-8822a4cc9907.png)
2022-03-16 20:18:23 +00:00
![image](https://user-images.githubusercontent.com/44733677/158523846-d79a94a5-64a5-475a-b481-e72141b47cf6.png)
2022-03-17 13:28:16 +00:00
# Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md)