This is a pastebin that can be deployed on Cloudflare workers. Try it on shz.al.
Philosophy: effortless deployment, friendly CLI usage, rich functionality.
Features:
- Share your paste with as short as 4 characters
- Customize the paste URL as you want
- Make changes to uploaded paste
- Delete your paste after uploading
- Let your paste deleted from the server after a period of time
- Syntax highlighting powered by Prism
- Redirect to custom URL
- Specify the mimetype when fetching your paste
- Optional longer paste URL for better privacy
You can post, update, delete your paste directly on the website (such as shz.al).
It also provide a convenient HTTP API to use. See API reference for details. You can easily call API via command line (using curl
or anything else).
pb is bash script to make it easier to use on command line.
- If deployed on Cloudflare Worker free-tier plan, the service allows at most 100,000 reads and 1000 writes, 1000 deletes per day.
- Because Cloudflare put a limit of CPU time per request, uploading large file will drain out the limit and result in an error. According to test, the file size is bounded to roughly 1.1 MB for free-tier plan.
You are free to deploy the pastebin on your own domain if you host your domain on Cloudflare.
Requirements:
- *nix environment with bash and basic cli programs. If you are using Windows, try cygwin, WSL or something.
- GNU make.
node
andyarn
.wrangler
, the official cli program to manage Cloudflare workers.
Create two KV namespaces on Cloudflare workers dashboard (one for production, one for test). Remember their IDs. If you do not need testing, simply create one.
Clone the repository and enter the directory. Login to your Cloudflare account with wrangler login
. Modify entries in wrangler.toml
according to your own account information (account_id
, zone_id
, kv_namespaces.id
, kv_namespaces.preview_id
are what you need to modify). Refer to Cloudflare doc on how to find out these parameters.
Modify the contents in config.json
(which controls the generation of static pages): BASE_URL
is the URL of your site (no trailing slash); FAVICON
is the URL to the favicon you want to use on your site.
Deploy and enjoy!
$ yarn install
$ mkdir dist && make deploy