Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codebam/pastebin-worker
Pastebin Worker API with ChaChaPoly encryption, LZ4 compression, MIME types and highlighting support
https://github.com/codebam/pastebin-worker
api chacha20-poly1305 encryption rust syntax-highlighting worker
Last synced: about 11 hours ago
JSON representation
Pastebin Worker API with ChaChaPoly encryption, LZ4 compression, MIME types and highlighting support
- Host: GitHub
- URL: https://github.com/codebam/pastebin-worker
- Owner: codebam
- License: apache-2.0
- Created: 2023-07-12T21:35:26.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-03T21:29:50.000Z (11 months ago)
- Last Synced: 2024-05-01T13:47:02.902Z (7 months ago)
- Topics: api, chacha20-poly1305, encryption, rust, syntax-highlighting, worker
- Language: HTML
- Homepage: https://pastebin.seanbehan.ca
- Size: 251 KB
- Stars: 3
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-pastebin-worker
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/codebam/pastebin-worker)
Set up your own KV in the wrangler.toml and put uploader.html at /
Supports MIME types by putting .file-ext at the end of filenames when
downloading.Supports syntax highlighting by using https://pastebin.seanbehan.ca/highlight/yourfile.js
Files are limited to 15MB due to KV limitations.
Example usage:
```sh
curl -Ls -o /dev/null -w %{url_effective} -F upload=@- https://pastebin.seanbehan.ca
```See the redirect URL to get where your paste is stored.
```javascript
export const pastebin_url = "https://pastebin.seanbehan.ca";
export const pastebin = {
upload: async (filename) =>
fetch(pastebin_url, {
method: "POST",
body: new URLSearchParams({ upload: await read_file(filename) }),
redirect: "manual",
}).then(get_redirect_location),
delete: async (filename) =>
fetch(pastebin_url + `/${filename}`, { method: "DELETE" }).then(
(response) => response.text()
),
upload_encrypt: async (filename) =>
fetch(pastebin_url + "/encrypt", {
method: "POST",
body: new URLSearchParams({ upload: await read_file(filename) }),
redirect: "manual",
}).then(get_redirect_location),
list: async () =>
fetch(pastebin_url + "/list").then((response) => response.text()),
upload_string: async (str) =>
fetch(pastebin_url, {
method: "POST",
body: new URLSearchParams({ upload: str }),
redirect: "manual",
}).then(get_redirect_location),
};
```Or just use the provided uploader.html