From 7dc2977cf2d256e04f01899791c45f1fbf010c46 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 18:53:22 +0000 Subject: [PATCH] Update Cloudflare R2 upload to use minimal permissions and add progress bar - Removed requirement for Cloudflare API Token, Zone ID, and Worker Token from Upload Modal and R2Service. - Simplified R2 configuration to require only Account ID, S3 Access Keys, and a user-provided Public Bucket URL. - Added a read-only field in Upload Modal displaying the derived target bucket name (npub-based) for user reference. - Implemented client-side torrent info hash calculation using `WebTorrent` (via `js/utils/torrentHash.js`) to generate magnet links before upload. - Added a visual upload progress bar to the Upload Modal. - Updated `js/r2.js` to ensure the Public Bucket URL always includes the `https://` protocol. --- components/upload-modal.html | 60 ++--- js/r2.js | 8 +- js/services/r2Service.js | 375 ++++++-------------------------- js/ui/components/UploadModal.js | 69 ++++-- js/utils/torrentHash.js | 62 ++++++ 5 files changed, 224 insertions(+), 350 deletions(-) create mode 100644 js/utils/torrentHash.js diff --git a/components/upload-modal.html b/components/upload-modal.html index e997060f..a3ee5dcc 100644 --- a/components/upload-modal.html +++ b/components/upload-modal.html @@ -89,7 +89,7 @@ - +