Coder Social home page Coder Social logo

cdn's Introduction

CDN Worker

A simple CDN made using Cloudflare Workers, Cloudflare R2, and Hono.

Deploy to Cloudflare Workers

Prerequisites

  • A Cloudflare account
  • R2 Plan (starts of free)
  • KV namespace

Installation

The easiest method is to click the Deploy with Workers button above and going 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, free feel to create an issue and I will try my best to help you out.

As for the KV namespace, the key should be the user's access token and some sort of user identification for the value. For example: the name of the user.

HTTP Routes

Route Description
GET / Redirects to my website by default. However, you can change it inside wrangler.toml.
GET /:key Displays the speciified 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!

ShareX Config Example

{
  "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:

  1. Set RequestURL to be the domain you are using, and Access-Token to the one you created in your KV namespace.
  2. Go to ShareX, Destinations, Custom uploader settings and then click Import. You can import from clipboard, file, or URL.
  3. Follow the prompts that it gives you and you should be done.

cdn's People

Contributors

serenmodz21 avatar renovate[bot] avatar kast-g avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.