mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 20:32:27 +00:00
Fix WebTorrent client race condition and silence legacy avatar warning
- Added a null check for `this.client` in `js/webtorrent.js` after `await this.init()` to prevent `TypeError` when cleanup occurs during initialization. - Updated `js/utils/profileMedia.js` to silently ignore the legacy `images/robot.png` path, preventing "Unsupported media URL" warnings. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
bb097283c2
commit
bf7988226d
2 files changed
+9
No files matched your search
@@ -46,6 +46,10 @@ export function sanitizeProfileMediaUrl(value) {
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
if (trimmed === "images/robot.png") {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (/^ipfs:\/\//i.test(trimmed)) {
|
||||
return normalizeIpfsGatewayUrl(trimmed);
|
||||
}
|
||||
|
||||
@@ -873,6 +873,11 @@ export class TorrentClient {
|
||||
emit("torrent-stream-start", { magnet: magnetURI });
|
||||
// 1) Make sure we have a WebTorrent client and a valid SW registration.
|
||||
const initResult = await this.init();
|
||||
|
||||
if (!this.client) {
|
||||
throw new Error("Client destroyed during initialization");
|
||||
}
|
||||
|
||||
const serviceWorkerReady =
|
||||
!!(initResult?.serviceWorkerReady && this.swRegistration);
|
||||
|
||||
|
||||
Reference in new issue
Block a user