$ show acgotaku/115
This is a Chrome extension (Manifest V3) that integrates with the 115.com cloud storage service. It allows users to export download links from their 115 cloud files directly to an aria2 RPC download manager, or to generate text-based download commands for aria2, IDM, or plain links. The extension injects a UI overlay into the 115 web interface (both old and new UI versions) to select files and trigger downloads. It supports recursive folder traversal, SHA1 checksum verification, configurable RPC endpoints, and optional encrypted API calls for premium users. The architecture consists of a background service worker (background.js) that handles messaging, cookie retrieval, and HTTP requests; content scripts (start.js, 115.js, 115_new.js) that run in the context of 115.com pages to intercept file data and communicate with the extension; and a set of library modules (core.js, store.js, ui.js, downloader.js, secret.js) that manage configuration, UI rendering, and download logic. The extension uses a custom RSA-based encryption scheme (secret.js) to interact with 115's pro API for premium download links.
The LLM identified 3 files worth highlighting for reuse:
Implements a custom RSA encryption/decryption scheme (with PKCS#1 padding) and a symmetric XOR cipher to encode payloads for the 115.com pro API. It uses big-integer for big number arithmetic and blueimp-md5 for key derivation. The class provides encode/decode methods that wrap the full encryption pipeline: MD5 key generation, symmetric XOR with key-dependent permutation, and asymmetric RSA encryption. This module is self-contained (only depends on two npm packages) and could be extracted for any project needing a similar custom encryption protocol, though the hardcoded keys are specific to 115.
Runs in the main world of the 115.com page (injected via <script> tag). It intercepts the global fetch function to cache file listing responses from the 115 API, enabling quick lookup of file metadata (SHA1, pickcode) without additional network requests. It also listens for contextmenu events to track the hovered file index, and responds to postMessage queries from the extension's content script to return selected/hovered file info. This pattern of monkey-patching fetch and using postMessage for cross-world communication is reusable for any extension that needs to access page-level data without relying on content script injection limitations.
A minimal, clean implementation of the event emitter pattern with on, trigger, and off methods. It is fully self-contained with no dependencies and can be dropped into any JavaScript project to decouple components. While simple, it demonstrates good craftsmanship with clear JSDoc annotations and proper handling of listener arrays.