Skip to content

Commit 76ef7b4

Browse files
authored
Merge pull request #42 from Monadical-SAS/nikita-torrent-sharing
feat: ReplayWeb.page URL link
2 parents cac7ef3 + 7257797 commit 76ef7b4

3 files changed

Lines changed: 49 additions & 14 deletions

File tree

src/argo-shared-archive-list.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Index as FlexIndex } from "flexsearch";
1515
import type { SharedArchive } from "./types";
1616
import { webtorrentClient as client } from "./global-webtorrent";
1717

18+
import { REPLAY_BASE_URL } from "./consts";
1819
@customElement("argo-shared-archive-list")
1920
export class ArgoSharedArchiveList extends LitElement {
2021
static styles: CSSResultGroup = [
@@ -423,19 +424,34 @@ export class ArgoSharedArchiveList extends LitElement {
423424
style="padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.5rem; justify-content: space-between;"
424425
>
425426
<md-filled-button
426-
@click=${() => this._copyLink(archive.magnetURI)}
427+
@click=${() =>
428+
this._copyLink(
429+
`${REPLAY_BASE_URL}/?source=${encodeURIComponent(
430+
archive.magnetURI,
431+
)}`,
432+
)}
427433
>
428434
<md-icon slot="icon" style="color:white"
429435
>content_copy</md-icon
430436
>
431437
Copy Link
432438
</md-filled-button>
433-
<md-icon-button
434-
@click=${() => this._unseed(archive.id)}
435-
aria-label="Unshare"
436-
>
437-
<md-icon>share_off</md-icon>
438-
</md-icon-button>
439+
<div style="display: flex; gap: 0.25rem;">
440+
<md-icon-button
441+
@click=${() => this._copyLink(archive.magnetURI)}
442+
aria-label="P2P"
443+
title="Copy magnet link"
444+
>
445+
<md-icon>p2p</md-icon>
446+
</md-icon-button>
447+
<md-icon-button
448+
@click=${() => this._unseed(archive.id)}
449+
aria-label="Unshare"
450+
title="Unshare"
451+
>
452+
<md-icon>share_off</md-icon>
453+
</md-icon-button>
454+
</div>
439455
</div>
440456
</details>
441457
</md-elevated-card>

src/consts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ export const BEHAVIOR_READY_START = "ready";
33
export const BEHAVIOR_PAUSED = "paused";
44
export const BEHAVIOR_RUNNING = "running";
55
export const BEHAVIOR_DONE = "done";
6+
export const REPLAY_BASE_URL =
7+
"https://replayweb-page-m-git-nikita-webtorrent-integration-monadical.vercel.app";

src/sidepanel.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { getSharedArchives, setSharedArchives } from "./localstorage";
1515
import { webtorrentClient as client } from "./global-webtorrent";
1616
import { state } from "lit/decorators.js";
1717
import { isUrlInSkipList } from "./utils";
18+
import { REPLAY_BASE_URL } from "./consts";
1819

1920
import {
2021
getLocalOption,
@@ -512,15 +513,20 @@ class ArgoViewer extends LitElement {
512513
const magnetURI = torrent.magnetURI;
513514
console.log("Seeding WACZ file via WebTorrent:", magnetURI);
514515

516+
const replayLink = `${REPLAY_BASE_URL}/?source=${encodeURIComponent(
517+
magnetURI,
518+
)}`;
515519
// Copy to clipboard
516520
navigator.clipboard
517-
.writeText(magnetURI)
521+
.writeText(replayLink)
518522
.then(() => {
519-
alert(`Magnet link copied to clipboard:\n${magnetURI}`);
523+
alert(
524+
`ReplayWeb.page copied to clipboard (just paste it in the address bar):\n${replayLink}`,
525+
);
520526
})
521527
.catch((err) => {
522528
console.error("Failed to copy magnet link:", err);
523-
alert(`Magnet Link Ready:\n${magnetURI}`);
529+
alert(`ReplayWeb.page Ready:\n${replayLink}`);
524530
});
525531

526532
const existing = await getSharedArchives();
@@ -1108,14 +1114,21 @@ class ArgoViewer extends LitElement {
11081114
</div>
11091115
11101116
<div style="display:flex; align-items:center;">
1111-
<md-icon-button aria-label="Download" @click=${this.onDownload}
1117+
<md-icon-button
1118+
aria-label="Export selected"
1119+
title="Export selected"
1120+
@click=${this.onDownload}
11121121
><md-icon>download</md-icon></md-icon-button
11131122
>
1114-
<md-icon-button aria-label="Share" @click=${this.onShareSelected}
1123+
<md-icon-button
1124+
aria-label="Share selected"
1125+
title="Share selected"
1126+
@click=${this.onShareSelected}
11151127
><md-icon>share</md-icon></md-icon-button
11161128
>
11171129
<md-icon-button
1118-
aria-label="Delete"
1130+
aria-label="Delete selected"
1131+
title="Delete selected"
11191132
@click=${this.onDeleteSelected}
11201133
><md-icon>delete</md-icon></md-icon-button
11211134
>
@@ -1224,7 +1237,11 @@ class ArgoViewer extends LitElement {
12241237
`
12251238
}
12261239
1227-
<md-icon-button aria-label="Settings" @click=${this._toggleSettings}>
1240+
<md-icon-button
1241+
aria-label="Settings"
1242+
title="Settings"
1243+
@click=${this._toggleSettings}
1244+
>
12281245
<md-icon>settings</md-icon>
12291246
</md-icon-button>
12301247
</div>

0 commit comments

Comments
 (0)