This commit is contained in:
Robin Appelman 2026-08-13 01:50:53 +02:00
commit db71d66600
5 changed files with 48 additions and 46 deletions

View file

@ -1,4 +1,5 @@
# Bin
# Bin
A minimal pastebin which also accepts binary files like Images, PDFs and ships
multiple clients.
@ -14,10 +15,10 @@ You can paste
- Normal Text
- Paste Images from clipboard:
![clipboard-paste](.github/files/image_clipboard.gif)
![clipboard-paste](.github/files/image_clipboard.gif)
- Files by drag and drop:
![drag_n_drop](.github/files/drag_n_drop.gif)
![drag_n_drop](.github/files/drag_n_drop.gif)
### CLI
@ -25,7 +26,8 @@ You can paste
#### Installation
Get the client from [this repository](contrib/cli/client) or from my deployed paste:
Get the client from [this repository](contrib/cli/client) or from my deployed
paste:
```bash
curl -o pst https://bin.noracodes.dev/r/client && chmod +x pst
@ -51,10 +53,9 @@ PASTELINK="$URL$RESPONSE"
echo "$PASTELINK.$EXTENSION"
```
You have the option to remove the `/client` description / help in the
landing page. To show the `/client` description, run the `bin` binary
with either `BIN_CLIENT_DESC` env variable or a `-c` flag. More on
arguments later
You have the option to remove the `/client` description / help in the landing
page. To show the `/client` description, run the `bin` binary with either
`BIN_CLIENT_DESC` env variable or a `-c` flag. More on arguments later
#### Usage
@ -75,23 +76,27 @@ $ cat someimage.png | pst
```vim
nnoremap <leader>p :!pst %<CR>
```
#### Usage
Use `<leader> + p` paste.
## Server Deployment
The [main fork](https://github.com/wantguns/bin) ships Docker and binary releases.
The [main fork](https://github.com/wantguns/bin) ships Docker and binary
releases.
### Manual
- Build on your own:
```bash
# A statically linked build
$ cargo build --release
```
- Execute the binary as is, no extra shenanigans needed:
```bash
$ ./bin
```
@ -131,9 +136,10 @@ This pastebin utilizes a custom configuration provider from Rocket. Apart from
the essential arguments, you can also use environment variables, which have the
highest preference in order.
Everything from the [official Rocket
doc](https://rocket.rs/v0.5-rc/guide/configuration/#overview) is supported,
just that you have to prefix the env variable with "BIN_":
Everything from the
[official Rocket doc](https://rocket.rs/v0.5-rc/guide/configuration/#overview)
is supported, just that you have to prefix the env variable with "BIN\_":
```txt
BIN_PORT=6163
BIN_ADDRESS=0.0.0.0
@ -145,24 +151,21 @@ BIN_IDENT=false
## API
`GET /r/<id>[.<ext>]`
Get raw pastes
`GET /r/<id>[.<ext>]` Get raw pastes
`GET /p/<id>`
Get pastes with a pretty UI
Get pastes with a pretty UI
`GET /p/<id>.<ext> `
`GET /p/<id>.<ext> `
Get syntax highlighted pastes in the pretty UI.
E.g. https://bin.nora.codes/p/foobaz.cpp should return a C++ syntax
highlighted paste
Get syntax highlighted pastes in the pretty UI. E.g.
https://bin.nora.codes/p/foobaz.cpp should return a C++ syntax highlighted paste
`POST /`
Post binary data, get object ID
`POST /` Post binary data, get object ID
## Design Decisions
This pastebin:
This pastebin:
- does not use a database. It lacks non-essential features like
password-protection / automatic deletion as a result of which, it can do
@ -170,13 +173,13 @@ This pastebin:
deploying it easier.
- uses server sided highlighting, which ensures that everything stays light and
snappy at the client side.
- uses very minimal frontend because a pastebin does not need it. It focuses
(or atleast tries to) on getting things done in minimum amount of clicks.
- uses very minimal frontend because a pastebin does not need it. It focuses (or
atleast tries to) on getting things done in minimum amount of clicks.
## Hacking
- If you want to ensure your pushed refs will pass CI, add the prepush script
to your Git hooks:
- If you want to ensure your pushed refs will pass CI, add the prepush script to
your Git hooks:
```bash
$ cp -a tools/prepush .git/hooks/pre-push