@@ -477,28 +477,28 @@ export class FileHost implements IFileHost {
477477 reject ( new Error ( 'WebTorrent seeding timeout' ) ) ;
478478 } , 30000 ) ; // 30 second timeout for seeding
479479
480- this . webTorrentClient ! . seed ( hash , ( torrent ) => {
480+ this . webTorrentClient ! . seed ( hash , async ( torrent ) => {
481481 clearTimeout ( seedTimeout ) ;
482482 const magnetURI = torrent . magnetURI ;
483483 this . magnetUris . set ( hash , magnetURI ) ;
484484 console . log ( `🧲 WebTorrent seeding started for ${ hash } ` ) ;
485485 console . log ( ` Magnet URI: ${ magnetURI } ` ) ;
486+
487+ // Update capabilities in Gun.js registry with new magnet URI
488+ if ( this . gunRegistry && this . capabilities ) {
489+ console . log ( `🔄 Updating Gun.js registry with new magnet URI...` ) ;
490+
491+ // Update the current capabilities with the new magnet URI
492+ if ( this . capabilities . webTorrent ) {
493+ this . capabilities . webTorrent . magnetUris = Array . from ( this . magnetUris . values ( ) ) ;
494+ }
495+
496+ await this . gunRegistry . register ( this . capabilities ) ;
497+ console . log ( `✅ Updated Gun.js registry with magnet URI for ${ hash } ` ) ;
498+ }
486499 resolve ( ) ;
487500 } ) ;
488501 } ) ;
489-
490- // Update capabilities in Gun.js registry with new magnet URI
491- if ( this . gunRegistry && this . capabilities ) {
492- console . log ( `🔄 Updating Gun.js registry with new magnet URI...` ) ;
493-
494- // Update the current capabilities with the new magnet URI
495- if ( this . capabilities . webTorrent ) {
496- this . capabilities . webTorrent . magnetUris = Array . from ( this . magnetUris . values ( ) ) ;
497- }
498-
499- await this . gunRegistry . register ( this . capabilities ) ;
500- console . log ( `✅ Updated Gun.js registry with magnet URI for ${ hash } ` ) ;
501- }
502502 } catch ( error ) {
503503 console . warn ( `⚠️ Failed to seed file via WebTorrent:` , error ) ;
504504 }
0 commit comments