Skip to content

Conversation

@nikitalokhmachev-ai
Copy link
Collaborator

@nikitalokhmachev-ai nikitalokhmachev-ai commented May 23, 2025

User description

This PR tackles #31.

It implements the following features:

  • The ability to view a list of all archives the user is seeding
  • Select one or more archives from that list
  • "Unseed" (stop sharing) any selected archive

PR Type

Enhancement


Description

  • Implemented My Shared Archives tab functionality

  • Added seeding/unseeding archive capabilities

  • Created UI for viewing shared archives

  • Added WebTorrent integration for P2P sharing


Changes walkthrough 📝

Relevant files
Enhancement
10 files
argo-archive-list.ts
UI styling improvements for list items                                     
+11/-4   
argo-shared-archive-list.ts
New component for displaying shared archives                         
+447/-0 
bg.ts
Added handler for shared archives                                               
+6/-1     
global-webtorrent.ts
Created WebTorrent client singleton                                           
+1/-0     
localstorage.ts
Added shared archives storage functions                                   
+15/-0   
sidepanel.ts
Implemented shared archives tab and seeding functionality
+147/-19
types.ts
Added SharedArchive interface                                                       
+15/-0   
webtorrent-browser.d.ts
Comprehensive WebTorrent type definitions                               
+158/-11
webtorrent-global.d.ts
Extended WebTorrent global interface                                         
+47/-2   
sidepanel.html
Minor UI style adjustments                                                             
+3/-0     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @pr-agent-monadical
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis ✅

    31 - Fully compliant

    Compliant requirements:

    • See a list of all archives they are seeding
    • Select one or more archives from that list
    • "Unseed" (stop sharing) any selected archive

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling

    The reseedAll method attempts to reseed archives but has minimal error handling. If a file is missing or corrupted, it only logs a warning without updating the shared archives list to remove invalid entries.

    private async reseedAll() {
      const shared: SharedArchive[] = await getSharedArchives();
      if (!shared.length) return;
    
      const opfsRoot = await navigator.storage.getDirectory();
      console.log(`♻️ reseedAll: found ${shared.length} archives`);
    
      for (const record of shared) {
        try {
          // Skip if already seeding
          if (client.get(record.magnetURI)) continue;
    
          // Get file handle and file from OPFS
          const handle = await opfsRoot.getFileHandle(record.filename, {
            create: false,
          });
          const file = await handle.getFile();
    
          client.seed(
            file,
            WS_TRACKERS.length
              ? { announce: WS_TRACKERS, name: record.filename }
              : undefined,
            (torrent) => {
              console.log(`♻️ Re-seeding ${record.filename}:`, torrent.infoHash);
              console.log("Magnet:", torrent.magnetURI);
            },
          );
        } catch (err) {
          console.warn(`⚠️ Could not reseed ${record.filename}:`, err);
        }
      }
    }
    UI Feedback

    When a user clicks the "Unseed" button, there's no visual feedback or confirmation dialog before removing the archive from seeding. This could lead to accidental unseeding.

    <md-icon-button
      @click=${() => this._unseed(archive.id)}
      aria-label="Unshare"
    >
      <md-icon>share_off</md-icon>
    </md-icon-button>

    @nikitalokhmachev-ai nikitalokhmachev-ai merged commit 86c4e52 into main May 26, 2025
    0 of 3 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants