1
0
Fork
You've already forked jabeh
0
No description
  • Go 87.7%
  • Shell 12.1%
  • Makefile 0.2%
2026年07月09日 22:48:04 +02:00
.gitignore Revise example systemd unit 2026年06月12日 12:38:59 +02:00
go.mod Remove external dep 2026年06月11日 09:02:53 +02:00
go.sum Remove external dep 2026年06月11日 09:02:53 +02:00
ja Make it only for extraargs 2026年06月29日 22:04:45 +02:00
jabeh.service Revise example systemd unit 2026年06月12日 12:38:59 +02:00
main.go Handle "raw" POST 2026年07月09日 22:48:04 +02:00
Makefile Init 2026年06月10日 15:36:45 +02:00
README.md Rework to accept actual form keys, instead of raw data 2026年06月29日 21:42:17 +02:00

Jabeh / جعبه [a box]

Minimal pastebin box for personal use. Too understand how to run it, see jabeh.service -- note the setting of allowed authentication tokens using EnvironmentFile. If you then use Caddy as reverse proxy, a line like reverse_proxy /bin/ localhost:40002 should then be enough.

You can put a file in the box like this (using HTTP Basic Auth; jabeh ignores the username):

curl -u :toomanysecrets -T ./somefile https://example.com/bin/

If everything went ok the URL to the box is returned in the HTTP body. Ready to be curled somewhere else. NOTE: no authentication on downloads.

The file is stored by a random ID of 8 characters using the Crockford base32 alphabet (5 bits per character). This gives us 40 bits of entropy, so 2^{40} possible ids, or around 1 trillion (10^{12}). For personal use this should be well enough for avoiding collisions.

Jabeh accepts HTTP PUT. This can be done with curl -T (or --upload-file), which also automatically sends a filename (see curl man page). That filename can be overridden by the HTTP header filename (curl -H "filename: foo.txt").

Jabeh also accepts a HTTP POST, set the form key file: curl -F file=@somefile. The filename can be overridden by setting the form key filename (-F filename=foo.txt), or using the HTTP header mentioned above. When POSTing, the authentication token can also be set using the key token.

When using curl, both methods allows for the local filename to be -, which makes curl slurp the data from stdin.

When downloading (HTTP GET) from Jabeh, the filename is returned in a Content-Disposition header, and can be honoured using curl -J -O.

As an alternative to the HTTP Basic Auth, the token can also be passed in a Authorization: Bearer header.

See ja for a slightly elaborate shell script.