115Master Documentation

repository·main·Indexed 21 days ago

https://github.com/cbingb666/115master

A userscript designed to enhance the 115 cloud storage web interface. Key features include an advanced video player (XPlayer) with ultra quality, online subtitles, and IINA integration; file list improvements such as video covers and path displays; and one-click magnet link integration for offline tasks. The repository also contains a monorepo with technical details on the XPlayer's HUD component, keyboard shortcut management via the useShortcuts hook, and AVPlayer core control through the useAvPlayerCore hook.

Tokens
16.2K
Snippets
52
Records
73
Agent score
71%

What's inside 115Master

  1. Overview of 115Master features

    main

    115Master provides several enhancements to the 115 web interface, categorized into Player, File List, and Magnet support:

    Player Enhancements

    • Ultra Quality: High-definition playback.
    • Video Thumbnails: Visual previews.
    • Online Subtitles: Support for web-based subtitles.
    • IINA Playback: Integration with IINA player.
    • Picture-in-Picture: Support for PiP mode.
    • Playlist: Manage multiple videos.
    • Custom Hotkeys: User-definable keyboard shortcuts.
    • Color Adjustment: Video color correction tools.

    File List Enhancements

    • Video Covers: Visual thumbnails in the list.
    • Path Display: Shows the full title/path of the file.
    • Navigation: 'Back to directory' button.
    • Scroll Memory: Remembers scroll position.
    • Offline Task Redirection: Redirects without refreshing for offline tasks.
    • File Download: Supports single file downloads.
    • Folder Interaction: Middle-click a folder to open in a new tab.

    Magnet Support

    • Supports one-click triggering of offline tasks from any website's Magnet links.
  2. Understand the 115 VOD cross-origin authorization flow

    main

    The official 115 VOD authorization relies on a multi-step redirect chain to obtain a cross-origin cookie. If you are implementing custom playback, you must replicate this sequence:

    1. Initial Request: Navigate to the VOD URL (e.g., https://115vod.com/?pickcode={pickcode}&share_id={share_id}).
    2. Passport Redirect: The request is redirected to the hnpassportapi.115.com authentication endpoint with a goto parameter pointing to the 115vod.com/bridge endpoint.
    3. Bridge Redirect: The passport service redirects to https://115vod.com/bridge?goto=...&auth_token=....
    4. Cookie Acquisition: This bridge request returns the necessary cookie.
    5. Final Redirect: The user is redirected back to the original VOD URL, now authorized with the acquired cookie.
    1. https://115vod.com/?pickcode=eu03yk1a3yp1dzzdt&share_id=0
    2. Redirect to: https://hnpassportapi.115.com/app/1.0/web/1.0/login/authToken?goto=...&time=...&digest=...
    3. Redirect to: https://115vod.com/bridge?goto=...&auth_token=xxx
    4. Result: Cookie is set
    5. Final Redirect: https://115vod.com/?pickcode=eu03yk1a3yp1dzzdt&share_id=0
  3. Install 115Master

    main

    115Master is a userscript designed to enhance the 115 resource backup experience. Follow these steps to install:

    1. Browser Requirements: Use Chrome 130+ or 115Browser 35+.
    2. Script Manager: Install Tampermonkey v5.3.3+ or ScriptCat.
    3. Developer Mode: Enable Browser Extension Developer Mode.
    4. Install Script: Download and install the 115Master user script.
    https://github.com/cbingb666/115master/releases/latest/download/115master.user.js
  4. Understand Stream objects and selection

    main

    When a media file is loaded, the player exposes a list of available streams. Each Stream object contains metadata and codec parameters used to identify the media type and capabilities.

    Stream Properties:

    • mediaType: 'Audio' or 'Video'.
    • codecparProxy: Contains codec parameters like width, height, and codecId.
    • id: Unique identifier for the stream.
    • duration: Total duration (int64).
    • metadata: Additional stream metadata.

    Stream Selection:

    • audioStreams: A computed array of all audio streams.
    • videoStreams: A computed array of all video streams.
    • currentVideoStream: The currently active video stream.
    • setAudioStream(id): Method to switch the active audio track by its stream ID.
    // Accessing streams via the hook
    const { streams, audioStreams, videoStreams, setAudioStream } = useAvPlayerCore(ctx);
    
    // Switch to a specific audio track
    if (audioStreams.value.length > 0) {
      await setAudioStream(audioStreams.value[0].id);
    }
  5. Understand KeyBinding formats

    main

    Keyboard shortcuts are represented using two primary formats:

    • KeyBindingStr: A single string representing the combination, e.g., 'Shift+A' or 'A'.
    • KeyBindingArr: An array of strings representing the keys, e.g., ['Shift', 'A'] or ['A'].

    KeyBindings is an array of KeyBindingStr, allowing a single action to be mapped to multiple string-based shortcuts.

  6. Understand the VideoCover data structure

    main

    The hook returns a VideoCover[] array in its state property. There are two main types used internally:

    1. VideoCoverRaw: The raw data containing the Blob object.
    2. VideoCover: The processed data ready for UI rendering, where the Blob is converted into a string URL via URL.createObjectURL.

    VideoCover Properties:

    • width: number - The width of the generated image.
    • height: number - The height of the generated image.
    • frameTime: number - The actual timestamp (in seconds) of the frame captured.
    • seekTime: number - The time (in seconds) at which the video was seeked to capture the frame.
    • img: string - The blob: URL used in <img> tags.
  7. Configure ESLint using @115master/eslint-config

    main

    To apply the standard linting rules for this project, use the baseConfig exported from @115master/eslint-config in your eslint.config.js file. This provides a pre-configured ESLint flat configuration designed for the monorepo's environment.

    import { baseConfig } from '@115master/eslint-config'
    
    export default baseConfig
  8. Manage FileListMod lifecycle

    main

    When using FileListMod, you must manage its lifecycle to prevent memory leaks and orphaned observers.

    • Initialization: Instantiating the class via new FileListMod() triggers the init() process, which starts the MutationObserver and sets up scroll history.
    • Cleanup: You must call the .destroy() method when the component or page is unmounted. This method disconnects the MutationObserver, destroys all active FileItemModLoader instances, and cleans up the FileListScrollHistory.
  9. Use @115master/eslint-config in your project

    main

    To apply the standard linting rules used across the 115master monorepo, import and export baseConfig from @115master/eslint-config in your eslint.config.js file. This allows your project to inherit the shared ESLint configuration.

    import { baseConfig } from '@115master/eslint-config'
    
    export default baseConfig
  10. Troubleshoot VOD domain cross-origin authorization failure in master player

    main

    If you experience failures when attempting to play VOD (Video on Demand) content in the master player, but the content plays successfully in the official 115 player, it is likely due to a missing cross-origin authorization token.

    Root Cause

    The official 115 player automatically handles the re-authorization of cross-origin tokens via a specific redirect chain that sets a required cookie. The master player currently lacks this automatic re-authorization logic.

    Reproduction Steps

    1. Log out of your account.
    2. Log back in.
    3. Attempt to play via the master player (will fail).
    4. Attempt to play via the 115 player (will succeed).

    Solution

    To fix this, the master player's playback page must be updated to intercept and execute the cross-origin authorization request flow used by the official player.