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.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-12 18:53:22 +00:00
1 parent 01d4335fda
commit 7dc2977cf2
5 files changed
+224 -350

No files matched your search

+6 -2
View File
@@ -10,8 +10,12 @@ function sanitizeBaseDomain(domain) {
return "";
}
let value = String(domain).trim().toLowerCase();
value = value.replace(/^https?:\/\//, "");
value = value.replace(/\/.*$/, "");
// Ensure it starts with https:// if it doesn't already
if (!/^https?:\/\//.test(value)) {
value = `https://${value}`;
}
// Remove trailing slashes
value = value.replace(/\/+$/, "");
return value;
}