Commit Graph
43 Commits
Author SHA1 Message Date
thePR0M3TH3AN 419a3f419c Add storage pointer tags to video posts 2026-01-26 22:07:32 -05:00
thePR0M3TH3AN ee31e4318a Compute upload identifiers before building R2 keys 2026-01-26 21:43:39 -05:00
thePR0M3TH3AN c02db755ac Refactor R2 key prefix for deterministic identifiers 2026-01-26 12:47:05 -05:00
thePR0M3TH3AN 82986650ce Store video file fingerprints alongside series IDs 2026-01-26 12:25:54 -05:00
thePR0M3TH3AN 50ec850706 Merge pull request #1730 from PR0M3TH3AN/codex/add-unit-tests-for-r2service
R2Service: add DI for storage helpers and unit tests for bucket selection
2026-01-26 07:47:06 -05:00
thePR0M3TH3AN 84468cbed5 Add R2 bucket config tests 2026-01-26 07:46:54 -05:00
thePR0M3TH3AN 16b8656521 Fix R2 bucket resolution and add coverage 2026-01-26 07:40:23 -05:00
thePR0M3TH3AN 5759b9437a Use configured bucket for R2 verification 2026-01-26 07:37:24 -05:00
thePR0M3TH3AN ad0f58e328 Use meta bucket in R2 bucket resolution 2026-01-26 07:35:34 -05:00
thePR0M3TH3AN a1d27996f7 Handle locked R2 storage metadata 2026-01-26 07:26:52 -05:00
thePR0M3TH3AN 4e71b1d320 Add R2 CORS failure context logging 2026-01-25 22:00:22 -05:00
thePR0M3TH3AN 69dc281c04 Add debug logs for upload settings presence 2026-01-25 21:57:09 -05:00
thePR0M3TH3AN 1e2f6b989a Migrate legacy R2 settings to storage service 2026-01-25 21:33:00 -05:00
thePR0M3TH3AN 4248999294 Guard r2 settings bucket lookup 2026-01-25 21:07:54 -05:00
thePR0M3TH3AN 46161ccea2 Improve R2 CORS error guidance 2026-01-25 21:05:24 -05:00
thePR0M3TH3AN eac1e9a75d Normalize storage connection public URLs 2026-01-25 20:54:15 -05:00
google-labs-jules[bot] 070c054043 Refactor upload flow for immediate uploads and fix logging crash
- Refactored `UploadModal.js` to trigger uploads immediately on file selection.
- Added progress bars and result fields (Video URL, Magnet, Torrent) to the UI.
- Fixed a crash in `r2Service.js` caused by `userLogger.debug` usage.
- Exposed `prepareUpload` and `uploadFile` methods in `r2Service` and `s3UploadService` for granular control.
- Updated `upload-modal.html` with new UI elements.
2026-01-25 20:53:16 +00:00
thePR0M3TH3AN 15dea2bbf6 Add generic S3 connection support helpers 2026-01-24 12:39:56 -05:00
thePR0M3TH3AN e6ecbaf9e6 Add generic S3 multipart helpers 2026-01-23 20:02:15 -05:00
google-labs-jules[bot] e51f21681b feat: make r2Service generic and integrate storageService 2026-01-16 02:58:36 +00:00
google-labs-jules[bot] cf9d1c08be Refactor UploadModal to use StorageService for secure R2 credentials 2026-01-16 02:35:00 +00:00
google-labs-jules[bot] 5772ed1992 docs: add developer documentation to R2 upload service
Added comprehensive JSDoc comments to `js/services/r2Service.js` to explain the critical "Hybrid" hosting strategy and complex orchestration logic.

Key additions:
- File header explaining the service's role.
- Detailed documentation for `handleCloudflareUploadSubmit`, explaining the sequence of uploads and the construction of Magnet URIs with `ws` (WebSeed) and `xs` (Exact Source) parameters.
- Documentation for `ensureBucketConfigForNpub` covering bucket sanitization and auto-configuration.
- Documentation for `verifyPublicAccess` explaining the "Upload-then-Fetch" validation strategy.
2026-01-15 20:31:59 +00:00
google-labs-jules[bot] 4e840c6159 feat: improve magnet link reliability with webseeds
- Update `UploadModal.js` to pre-calculate R2 keys and public URLs before upload.
- Update `torrentHash.js` to embed the calculated video URL as a webseed (`url-list`) in the `.torrent` file.
- Update `r2Service.js` to accept forced keys/URLs and append `&xs=` (pointing to the .torrent file) to the magnet link.
- Ensures magnet links work for peerless downloads via WebSeed (BEP19) and HTTP Seeding (BEP17).
2026-01-15 13:26:27 +00:00
thePR0M3TH3AN a3374f0569 Guard upload when info hash is unavailable 2026-01-14 21:38:27 -05:00
thePR0M3TH3AN 6262a3cb37 Add torrent metadata upload for R2 videos 2026-01-14 21:28:57 -05:00
google-labs-jules[bot] 657ee40eb5 fix(r2): inject infohash into nip-71 imeta tags for webtorrent bootstrapping 2026-01-15 02:04:14 +00:00
google-labs-jules[bot] 0a79108c05 fix(r2): validate baseDomain to reject S3 API endpoints
Updated `r2Service.js` to detect if the user inputs an S3 API endpoint (e.g. `*.r2.cloudflarestorage.com`) as the Public Bucket URL. If detected, it prevents saving and displays a clear error message instructing the user to use the correct public domain (e.g. `*.r2.dev`). This prevents CORS errors and confusion caused by using the wrong endpoint type.
2026-01-14 17:19:14 +00:00
google-labs-jules[bot] fe1b6d0ae2 fix(storage): fix R2 setup issues (CORS, polyfills, headers)
- Switched to `esm.sh` bundle for `@aws-sdk/client-s3` to fix browser compatibility and `fs.readFile` errors.
- Removed `cf-create-bucket-if-missing` header from `multipartUpload` to prevent 403 Forbidden/CORS failures with standard API tokens.
- Refactored `verifyPublicAccess` to attempt CORS setup even if bucket check fails, and added specific error messaging for CORS issues.
- Updated documentation to include `POST` and `HEAD` in the recommended R2 CORS policy.
2026-01-14 17:11:04 +00:00
google-labs-jules[bot] 8097f64ba8 fix(storage): handle R2 CORS errors & use bundled aws-sdk
1.  **Refactor R2 Verification**: Separated bucket existence checks from CORS configuration in `r2Service.js`. Previously, if `HeadBucket` failed (e.g., due to CORS restrictions), the CORS configuration step was skipped. Now, CORS setup is attempted independently, increasing the chance of successful auto-configuration.
2.  **Improve Error Messaging**: Enhanced error handling in `verifyPublicAccess` to detect "Failed to fetch" errors and explicitly suggest checking Cloudflare R2 CORS settings in the UI.
3.  **Fix AWS SDK Import**: Consolidated the AWS SDK import fix to use the `?bundle` version from `esm.sh` in `r2-s3.js`. This prevents `fs.readFile` runtime errors by ensuring a browser-compatible build is loaded.
2026-01-14 16:36:25 +00:00
google-labs-jules[bot] a0ef54434a Implement 2-step wizard for R2 credentials with public access verification
- Added `deleteObject` to `js/storage/r2-s3.js` for cleanup.
- Added `verifyPublicAccess` to `js/services/r2Service.js` to test bucket configuration.
- Refactored `components/upload-modal.html` to support wizard steps.
- Updated `js/ui/components/UploadModal.js` to manage wizard state and trigger verification.
2026-01-12 20:16:30 +00:00
google-labs-jules[bot] f45f027a56 Refine R2 upload UX with bucket auto-creation attempt and clearer guidance
- Updated `R2Service` to attempt bucket creation via S3 API (`ensureBucketExists`) before upload. This improves the UX for users with Admin keys or custom domains while gracefully failing (with a warning) for users with minimal permissions.
- Modified `UploadModal` helper text to explicitly instruct users about enabling "Public Access" in the Cloudflare dashboard for new buckets.
- Updated `js/r2.js` to ensure the "Public Bucket URL" is always sanitized to include the `https://` protocol, fixing potential webseed generation issues.
2026-01-12 19:40:07 +00:00
google-labs-jules[bot] 7dc2977cf2 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.
2026-01-12 18:53:22 +00:00
google-labs-jules[bot] 44aed00b5e Add thumbnail upload support to UploadModal and R2Service
- Added file input and browse button for thumbnails in `upload-modal.html`.
- Updated `UploadModal.js` to handle thumbnail file selection and UI toggling.
- Updated `r2Service.js` to upload thumbnail file (if present) to R2 and update metadata.
- Ensured thumbnail keys are derived from video keys for consistent naming.
2026-01-09 03:03:35 +00:00
google-labs-jules[bot] 3a86ad5b20 docs: Add detailed R2 setup guide and clarify API token requirement
- Add new "Setup Guide" section to `docs/storage-r2.md` detailing the dual-credential requirement (S3 Keys + Cloudflare API Token) for full automation.
- Remove unsupported "manual/S3-only" workflow documentation to prevent user confusion.
- Update `js/services/r2Service.js` error message to explicitly prompt users for an API Token when the public domain is missing, instead of suggesting manual configuration.
2026-01-09 02:44:25 +00:00
google-labs-jules[bot] 9028f77464 feat: add client-side R2 to WebTorrent generation flow
Integrates WebTorrent client-side seeding into the Cloudflare R2 upload path.
- Adds `uploadFile` to `r2Service` for generic file uploads.
- Updates `UploadModal` to offer an optional "Create torrent & seed" flow.
- Generates magnet links and .torrent files in the browser after R2 upload.
- Uploads the .torrent file to R2 and populates `xs` tag.
- Populates `ws` (Web Seed) with the R2 public URL.
- Adds UI progress indicators for hashing and torrent upload.
- Enforces a 2GB file size limit for browser seeding to prevent crashes.
- Adds a mandatory legal rights confirmation checkbox for R2 uploads.
2026-01-08 13:50:53 +00:00
thePR0M3TH3AN 700056b5fc Extract video note payload normalization 2025-10-26 18:21:32 -04:00
thePR0M3TH3AN 7ae07b1369 refactor: migrate console usage to shared loggers 2025-10-15 14:37:25 -04:00
thePR0M3TH3AN d705cf176b Revert "Refactor logging to centralized logger" 2025-10-15 11:14:10 -04:00
thePR0M3TH3AN 37ba57aa37 Refactor logging to centralized logger 2025-10-15 11:11:14 -04:00
thePR0M3TH3AN d33ca197d7 Prevent conflicting audience flags in upload forms 2025-10-09 22:03:58 -04:00
thePR0M3TH3AN 1122c702af Add NSFW and kid-friendly toggles to upload flows 2025-10-09 21:55:05 -04:00
thePR0M3TH3AN 9041f9c0b7 feat: pass nip71 metadata through publish pipeline 2025-10-04 18:49:43 -04:00
thePR0M3TH3AN 06c979569f Refactor Cloudflare R2 handling into dedicated service 2025-10-02 22:29:54 -04:00