A simple CDN made using Cloudflare Workers, Cloudflare R2, and Hono.
- A Cloudflare account
- R2 Plan (starts of free)
- KV namespace
The easiest method is to click the Deploy with Workers button above and go through the installation steps provided by Cloudflare.
There will not be a manual installation guide as of now, but one may be added in the future. However, if you need any help or have any questions, feel free to create an issue, and I will try my best to help you out.
For the KV namespace, the key should be the user's access token, and the value should have some sort of user identification, such as the user's name.
Route | Description |
---|---|
GET / |
Redirects to my website by default. However, you can change it inside wrangler.toml. |
GET /:key |
Displays the specified media that has been uploaded publicly. |
POST /upload |
Uploads media to the CDN. The Access-Token header is required! |
DELETE /:key |
Deletes media with the given key, from the CDN. The Access-Token header is required! |
{
"Version": "14.0.1",
"Name": "cdn",
"DestinationType": "ImageUploader, TextUploader, FileUploader",
"RequestMethod": "POST",
"RequestURL": "https://your.domain/upload",
"Headers": {
"Access-Token": "Recommended to be 64+ characters"
},
"Body": "MultipartFormData",
"FileFormName": "image",
"URL": "{json:url}",
"DeletionURL": "{json:url}",
"ErrorMessage": "{json:error}"
}
If you wish to use the example above:
- Set
RequestURL
to be the domain you are using, andAccess-Token
to the one you created in your KV namespace. - Go to ShareX, Destinations, Custom uploader settings and then click Import. You can import from your clipboard, file, or URL.
- Follow the prompts that it gives you and you should be done.