Skip to content

AquaSkyballad/FlareDrive-worker

Repository files navigation

FlareDrive

Cloudflare R2 storage manager powered by a Cloudflare Worker — file management over WebDAV with a React frontend, thumbnail generation, and chunked upload support.

Free 10 GB R2 storage with 100,000 invocation requests per day. More about pricing

Features

  • Upload large files (chunked upload via web UI)
  • WebDAV endpoint — mount as a remote drive
  • Create, rename, move, copy, and delete files & folders
  • Search files
  • Image / video / PDF thumbnails
  • Drag-and-drop upload
  • Built-in text editor (TextPad)

Prerequisites

  • A Cloudflare account with billing set up
  • R2 activated and at least one bucket created
  • Node.js 18+ and npm 9+
  • Wrangler CLI installed and authenticated (wrangler login)

Quick Start

git clone <your-fork>
cd FlareDrive_woker
npm install

1. Create KV Namespace (for login rate-limiting)

wrangler kv:namespace create "KV_NAMESPACE"
wrangler kv:namespace create "KV_NAMESPACE" --preview

Copy the returned IDs into wrangler.toml:

[[kv_namespaces]]
binding = "KV_NAMESPACE"
id = "<production-id>"
preview_id = "<preview-id>"

2. Create an R2 Bucket

wrangler r2 bucket create <your-bucket-name>

Update wrangler.toml:

[[r2_buckets]]
binding = "BUCKET"
bucket_name = "<your-bucket-name>"

3. Set WebDAV Credentials

wrangler secret put WEBDAV_USERNAME
wrangler secret put WEBDAV_PASSWORD

Optionally enable public read in wrangler.toml:

[vars]
WEBDAV_PUBLIC_READ = "1"

4. Deploy

npm run deploy

Done. Your Worker URL will be printed (e.g. https://flare-drive.<your-account>.workers.dev).

Local development

npm run dev

The dev server runs at http://localhost:8787.

Building the frontend

The React SPA is built separately and hosted (e.g. on Cloudflare Pages):

npm run build:frontend

The Worker proxies static assets from src/static.ts — update the upstream URL there to point to your own static host.

WebDAV Endpoint

Point your WebDAV client (e.g. Cx File Explorer, BD File Manager) at:

https://<your-domain.com>/webdav

Standard WebDAV cannot upload files ≥128 MB due to Cloudflare Worker body limits — use the web UI for large uploads (chunked upload).

Environment Variables & Bindings

Variable / Binding Type Description Required
WEBDAV_USERNAME Secret WebDAV auth username Yes
WEBDAV_PASSWORD Secret WebDAV auth password Yes
WEBDAV_PUBLIC_READ Var "1" to allow public reads (GET/HEAD/PROPFIND) No
KV_NAMESPACE KV binding Login attempt tracking & IP ban Yes
BUCKET R2 binding Default storage bucket Yes

Multi-bucket support

The router selects a bucket binding by the subdomain prefix of the request hostname. Add additional [[r2_buckets]] entries to wrangler.toml to support multiple buckets.

Acknowledgments

WebDAV logic is based on r2-webdav by abersheeran.

About

基于FlareDrive项目的worker版本

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages