mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Merge pull request #1922 from PR0M3TH3AN/fix-webtorrent-race-and-profile-media-10857751696116358785
Fix WebTorrent race condition and legacy media warning
This commit is contained in:
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