From 50bc2d64e22a8a006bc88f5791e81d61268e0613 Mon Sep 17 00:00:00 2001 From: EGOIST Date: Sun, 15 May 2022 00:54:48 +0800 Subject: [PATCH] update readme for r2 --- r2/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/r2/README.md b/r2/README.md index c00c3f6e..209cc7a4 100644 --- a/r2/README.md +++ b/r2/README.md @@ -3,13 +3,12 @@ A cloudflare worker based REST API for your R2 bucket. Usage: - Change the `bucket_name` and `preview_bucket_name` in `wrangler.toml` if you want. -- Set `API_TOKEN` in the worker secrets using Wrangler CLI. +- Set `ENCRYPT_SECRET` (>= 32 chars) in the worker secrets using Wrangler CLI. Endpoints: - GET `/:key`: Public access -- POST `/`: Require `authorization: Bearer TOKEN` header, where `TOKEN` should match `API_TOKEN` from your worker secrets. The request content type should be `multipart/form-data` with following fields: - - `prefix`: optional prefix for the key, see blow +- POST `/`: Require `authorization: Bearer TOKEN` header, where `TOKEN` is an encrypted JWT using `@proselog/jwt` and `ENCRYPT_SECRET`. The request content type should be `multipart/form-data` with following fields: - `file`: `File` file to upload -The object key is generated from `prefix` + `uuid()` + `file.extension` +The object key is generated from `$userId/` + `uuid()` + `file.extension`