- Expose PutObjectCommand and GetObjectCommand in s3-client.js
- Update testS3Connection in r2-s3.js to perform a full Read/Write/Delete cycle when a bucket is provided
- Add clear user-facing logs for each step of the storage test
- Added `db.close()` to exported functions in `js/storage/dmDb.js` to ensure IndexedDB connections are released.
- Patched `tests/test-helpers/setup-localstorage.mjs` to include a `structuredClone` polyfill required by `fake-indexeddb` in Node.js environments.
- Updated `tests/dm-normalization.test.mjs`, `tests/dm-db.test.mjs`, and `tests/nostr/dm-direct-message-flow.test.mjs` to conditionally initialize `fake-indexeddb` to prevent global conflicts.
- Verified fixes by running unit tests and the `scripts/agent/interop-test.mjs` E2E suite.
Added `testConnection` to `StorageService` and `testS3Connection` to `r2-s3.js`.
Updated `ProfileModalController` to use the new `storageService.testAccess` method for verifying credentials before saving.
The test logic supports both specific bucket checks (via `HeadBucket`) and general credential checks (via `ListBuckets`).
- 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.
Removed the `cf-create-bucket-if-missing` header from the multipart upload request in `js/storage/r2-s3.js`. This header triggers a 403 Forbidden error (and subsequent "Failed to fetch" due to CORS behavior) when using R2 API tokens with limited "Object Read & Write" permissions, as it requires bucket creation privileges. Bucket existence is now handled separately.
Switched the CDN provider for the AWS SDK (R2 client) to the bundled version from `esm.sh` (`?bundle`). This resolves a runtime error `[unenv] fs.readFile is not implemented yet!` which occurred because the previous build was attempting to import Node.js-specific credential providers that rely on the filesystem.
The bundled version from `esm.sh` correctly resolves the browser entry points and provides browser-compatible polyfills (or safe defaults) for dependencies, ensuring the SDK initializes correctly in the client environment.
This change updates the `AWS_SDK_SPECIFIER` constant in `js/storage/r2-s3.js`.
Switched the CDN provider for the AWS SDK (R2 client) from `jsdelivr` to `esm.sh` to resolve a runtime dependency error ("does not provide an export named 'blobHasher'"). This error was caused by a broken bundling of the transitive dependency `@smithy/hash-blob-browser` on `jsdelivr`.
This change updates the `AWS_SDK_SPECIFIER` constant in `js/storage/r2-s3.js`.
- 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.
- Exported `ensureBucketExists` from `js/storage/r2-s3.js` to resolve a module import error in `js/services/r2Service.js`.
- Verified the fix via code read.
- Confirmed syntax correctness of `r2-s3.js` modifications.
Replaces unreliable esm.sh imports with cdn.jsdelivr.net to prevent site crashes due to CORS and timeout errors.
Updates imports for `nostr-tools`, `buffer`, and `@aws-sdk/client-s3` in `js/nostrToolsBootstrap.js`, `js/bufferPolyfill.js`, and `js/storage/r2-s3.js`.
Adds jsdelivr as a prioritized remote source in `nostrToolsBootstrap` while retaining esm.sh as a fallback.