Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion src/argo-shared-archive-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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 @@ -424,7 +425,12 @@ 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
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";

10 changes: 7 additions & 3 deletions src/sidepanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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 @@ -493,15 +494,18 @@ 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(`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}`);
});
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