Skip to content

feat: ReplayWeb.page URL link #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
30 changes: 23 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,34 @@ 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"
title="Copy magnet link"
>
<md-icon>p2p</md-icon>
</md-icon-button>
<md-icon-button
@click=${() => this._unseed(archive.id)}
aria-label="Unshare"
title="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

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";

31 changes: 24 additions & 7 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}`);
});

const existing = await getSharedArchives();
Expand Down Expand Up @@ -1108,14 +1114,21 @@ class ArgoViewer extends LitElement {
</div>

<div style="display:flex; align-items:center;">
<md-icon-button aria-label="Download" @click=${this.onDownload}
<md-icon-button
aria-label="Export selected"
title="Export selected"
@click=${this.onDownload}
><md-icon>download</md-icon></md-icon-button
>
<md-icon-button aria-label="Share" @click=${this.onShareSelected}
<md-icon-button
aria-label="Share selected"
title="Share selected"
@click=${this.onShareSelected}
><md-icon>share</md-icon></md-icon-button
>
<md-icon-button
aria-label="Delete"
aria-label="Delete selected"
title="Delete selected"
@click=${this.onDeleteSelected}
><md-icon>delete</md-icon></md-icon-button
>
Expand Down Expand Up @@ -1224,7 +1237,11 @@ class ArgoViewer extends LitElement {
`
}

<md-icon-button aria-label="Settings" @click=${this._toggleSettings}>
<md-icon-button
aria-label="Settings"
title="Settings"
@click=${this._toggleSettings}
>
<md-icon>settings</md-icon>
</md-icon-button>
</div>
Expand Down
Loading