Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/argo-shared-archive-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Index as FlexIndex } from "flexsearch";
import type { SharedArchive } from "./types";
import { webtorrentClient as client } from "./global-webtorrent";

import { REPLAY_BASE_URL } from "./consts";
@customElement("argo-shared-archive-list")
export class ArgoSharedArchiveList extends LitElement {
static styles: CSSResultGroup = [
Expand Down Expand Up @@ -423,19 +424,32 @@ export class ArgoSharedArchiveList extends LitElement {
style="padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.5rem; justify-content: space-between;"
>
<md-filled-button
@click=${() => this._copyLink(archive.magnetURI)}
@click=${() =>
this._copyLink(
`${REPLAY_BASE_URL}/?source=${encodeURIComponent(
archive.magnetURI,
)}`,
)}
>
<md-icon slot="icon" style="color:white"
>content_copy</md-icon
>
Copy Link
</md-filled-button>
<md-icon-button
@click=${() => this._unseed(archive.id)}
aria-label="Unshare"
>
<md-icon>share_off</md-icon>
</md-icon-button>
<div style="display: flex; gap: 0.25rem;">
<md-icon-button
@click=${() => this._copyLink(archive.magnetURI)}
aria-label="P2P"
>
<md-icon>p2p</md-icon>
</md-icon-button>
<md-icon-button
@click=${() => this._unseed(archive.id)}
aria-label="Unshare"
>
<md-icon>share_off</md-icon>
</md-icon-button>
</div>
</div>
</details>
</md-elevated-card>
Expand Down
2 changes: 2 additions & 0 deletions src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export const BEHAVIOR_READY_START = "ready";
export const BEHAVIOR_PAUSED = "paused";
export const BEHAVIOR_RUNNING = "running";
export const BEHAVIOR_DONE = "done";
export const REPLAY_BASE_URL =
"https://replayweb-page-m-git-nikita-webtorrent-integration-monadical.vercel.app";
Comment on lines +6 to +7
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The hardcoded URL appears to be a development or staging environment. For production code, consider using a configuration variable or environment variable to make the base URL configurable across different environments. [general, importance: 7]

Suggested change
export const REPLAY_BASE_URL =
"https://replayweb-page-m-git-nikita-webtorrent-integration-monadical.vercel.app";
export const REPLAY_BASE_URL =
process.env.REPLAY_BASE_URL || "https://replayweb.page";

12 changes: 9 additions & 3 deletions src/sidepanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getSharedArchives, setSharedArchives } from "./localstorage";
import { webtorrentClient as client } from "./global-webtorrent";
import { state } from "lit/decorators.js";
import { isUrlInSkipList } from "./utils";
import { REPLAY_BASE_URL } from "./consts";

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

const replayLink = `${REPLAY_BASE_URL}/?source=${encodeURIComponent(
magnetURI,
)}`;
// Copy to clipboard
navigator.clipboard
.writeText(magnetURI)
.writeText(replayLink)
.then(() => {
alert(`Magnet link copied to clipboard:\n${magnetURI}`);
alert(
`ReplayWeb.page copied to clipboard (just paste it in the address bar):\n${replayLink}`,
);
})
.catch((err) => {
console.error("Failed to copy magnet link:", err);
alert(`Magnet Link Ready:\n${magnetURI}`);
alert(`ReplayWeb.page Ready:\n${replayLink}`);
});
Comment on lines 500 to 530
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The alert message says "Magnet link copied" but you're actually copying a ReplayWeb.page URL. Update the message to accurately reflect what's being copied to avoid user confusion. [general, importance: 8]

Suggested change
// Copy to clipboard
navigator.clipboard
.writeText(magnetURI)
.writeText(replayLink)
.then(() => {
alert(`Magnet link copied to clipboard:\n${magnetURI}`);
alert(`Magnet link copied to clipboard:\n${replayLink}`);
})
.catch((err) => {
console.error("Failed to copy magnet link:", err);
alert(`Magnet Link Ready:\n${magnetURI}`);
alert(`Magnet Link Ready:\n${replayLink}`);
});
// Copy to clipboard
navigator.clipboard
.writeText(replayLink)
.then(() => {
alert(`ReplayWeb.page link copied to clipboard:\n${replayLink}`);
})
.catch((err) => {
console.error("Failed to copy ReplayWeb.page link:", err);
alert(`ReplayWeb.page Link Ready:\n${replayLink}`);
});


const existing = await getSharedArchives();
Expand Down
Loading