mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 17:02:28 +00:00
Fix nostr-tools bootstrapping, UploadModal zombie callbacks, and service error handling
- Add fallback mock to `js/nostrToolsBootstrap.js` for test environments. - Add guards to `js/ui/components/UploadModal.js` to prevent stale state updates. - Ensure service calls are awaited in `js/ui/tagPreferenceMenuController.js`. - Fix `tests/ui/uploadModal-reset.test.mjs` setup and environment. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
91b45abf9a
commit
3aafcf93d5
4 files changed
+72
-15
No files matched your search
@@ -518,7 +518,7 @@ export class UploadModal {
|
||||
// 1. Compute Identifier (Info Hash / Fingerprint) before generating keys
|
||||
const identifier = await this.resolveUploadIdentifier(file);
|
||||
|
||||
if (this.videoUploadId !== currentUploadId) return;
|
||||
if (this.videoUploadId !== currentUploadId) return; // Zombie guard
|
||||
|
||||
// 2. Prepare Upload (Get Creds & Bucket)
|
||||
const pubkey = this.getCurrentPubkey();
|
||||
@@ -529,7 +529,7 @@ export class UploadModal {
|
||||
|
||||
const { settings, bucketEntry } = await service.prepareUpload(npub, { credentials: this.activeCredentials });
|
||||
|
||||
if (this.videoUploadId !== currentUploadId) return;
|
||||
if (this.videoUploadId !== currentUploadId) return; // Zombie guard
|
||||
|
||||
// 3. Determine Keys
|
||||
const videoKey = buildR2Key(npub, file, identifier);
|
||||
@@ -588,7 +588,7 @@ export class UploadModal {
|
||||
|
||||
const [uploadResult, torrentResult] = await Promise.all([uploadPromise, torrentPromise]);
|
||||
|
||||
if (this.videoUploadId !== currentUploadId) return;
|
||||
if (this.videoUploadId !== currentUploadId) return; // Zombie guard
|
||||
|
||||
// Video Complete
|
||||
this.videoUploadState.status = 'complete';
|
||||
@@ -634,7 +634,7 @@ export class UploadModal {
|
||||
createBucketIfMissing: true,
|
||||
});
|
||||
|
||||
if (this.videoUploadId !== currentUploadId) return;
|
||||
if (this.videoUploadId !== currentUploadId) return; // Zombie guard
|
||||
|
||||
this.torrentState.status = 'complete';
|
||||
this.torrentState.infoHash = torrentResult.infoHash;
|
||||
@@ -661,7 +661,7 @@ export class UploadModal {
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
if (this.videoUploadId !== currentUploadId) return;
|
||||
if (this.videoUploadId !== currentUploadId) return; // Zombie guard
|
||||
|
||||
userLogger.error("Video upload sequence failed:", err);
|
||||
this.videoUploadState.status = 'error';
|
||||
|
||||
Reference in new issue
Block a user