mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
[edit] Host the .torrent (xs=) for edited external URLs too — close the gap
The edit-modal external-URL webseed was ws=-only because the Edit modal had no storage credentials wired in. Reuse mediaUploader.resolveActiveConnection() (the same resolver the Edit modal's file-replace uploads use) to get the active provider + credentials when storage is unlocked, and pass them to deriveTorrentForExternalUrl so it hosts the tiny .torrent and emits ws=+xs= — full P2P bootstrap, matching the upload modal. Storage locked / no connection → ws=-only (unchanged, best-effort). Edit-modal submit-state + upload-field + external-url-torrent suites green. Lint + build green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
11c7884366
commit
757fca1059
1 file changed
+19
-3
@@ -1080,8 +1080,9 @@ export class EditModal {
|
||||
// with no magnet, so an edited external URL keeps the P2P benefit (magnet
|
||||
// ws=url). Best-effort + size-capped; on CORS / too-large / any error it stays
|
||||
// URL-only. Runs before the magnet normalization below so the derived magnet's
|
||||
// ws/xs are extracted the same way a pasted magnet's are. (Hosting the tiny
|
||||
// .torrent (xs=) on the edit path needs credential plumbing — a follow-up.)
|
||||
// ws/xs are extracted the same way a pasted magnet's are. When storage is
|
||||
// unlocked we also host the tiny .torrent (xs=) so the webseed can bootstrap
|
||||
// P2P — same as the upload modal.
|
||||
if (
|
||||
urlWasEdited &&
|
||||
finalUrl &&
|
||||
@@ -1089,9 +1090,24 @@ export class EditModal {
|
||||
typeof this.mediaUploader?.deriveTorrentForExternalUrl === "function"
|
||||
) {
|
||||
try {
|
||||
let connection = null;
|
||||
try {
|
||||
connection =
|
||||
typeof this.mediaUploader.resolveActiveConnection === "function"
|
||||
? await this.mediaUploader.resolveActiveConnection()
|
||||
: null;
|
||||
} catch (connectionError) {
|
||||
connection = null;
|
||||
}
|
||||
const canHostTorrent = Boolean(
|
||||
connection?.unlocked && connection?.credentials && connection?.provider,
|
||||
);
|
||||
const derived = await this.mediaUploader.deriveTorrentForExternalUrl(
|
||||
finalUrl,
|
||||
{},
|
||||
{
|
||||
provider: canHostTorrent ? connection.provider : undefined,
|
||||
credentials: canHostTorrent ? connection.credentials : undefined,
|
||||
},
|
||||
);
|
||||
if (derived?.magnet) {
|
||||
finalMagnet = derived.magnet;
|
||||
|
||||
Reference in new issue
Block a user