MoeKoe Music Extension

MoeKoe Music browser extension version, built based on MoeKoeMusic Web and completed API route compatibility within the browser extension.

🌎 GitHub repository

Features

Quick Start

Environment Requirements

Install Dependencies

git submodule update --init --recursive
npm install
npm run install:app

npm run install:app will install dependencies for both MoeKoeMusic and MoeKoeMusic/api. After installation, it is recommended to check the submodule workspace to avoid submitting unexpected changes from the upstream lockfile.

Build Extension

npm run build

The build output will be to:

dist/extension

Install to Browser

  1. Open chrome://extensions or edge://extensions.
  2. Enable “Developer mode”.
  3. Click “Load unpacked extension”.
  4. Select the dist/extension directory under this project.

Do not load the source code directory extension, otherwise the browser will prompt that the manifest or background script failed to load.

API Running Method

Compared to the MoeKoe Music Web version, the plugin version will not require users to fill in the API address. The MoeKoeMusic front-end still initiates requests according to its own HTTP routes, and Axios requests will be adapted to the extension’s internal message channel during the build.

The request process is as follows:

MoeKoeMusic Web
  -> extension/app/api-adapter.js
  -> extension/api/service-worker.cjs
  -> extension/api/generated/modules.cjs
  -> MoeKoeMusic/api/module/*.js
  -> KuGou related interfaces

extension/api/generated/modules.cjs is a generated file, generated by scripts/generate-extension-api-entry.mjs scanning MoeKoeMusic/api/module. After adding or updating an API module, you can re-run either of the following commands:

npm run generate:api
npm run build

Project Structure

.
├── MoeKoeMusic/                         # Upstream MoeKoeMusic sub-module
│   └── api/                             # Upstream API sub-module
├── extension/
│   ├── app/
│   │   ├── api-adapter.js               # Web-side Axios adapter
│   │   └── locale-init.js               # External language initialization script
│   ├── api/
│   │   ├── generated/modules.cjs        # API route mapping generated file
│   │   ├── axios-fetch.cjs              # Browser fetch version Axios compatibility layer
│   │   ├── service-worker.cjs           # Extension background logic
│   │   └── url.cjs                      # url module compatibility layer
│   ├── manifest.json                    # Extension manifest
│   └── vite.extension.config.mjs        # Extension build configuration
├── scripts/
│   ├── build-extension.mjs              # Extension build script
│   └── generate-extension-api-entry.mjs # API mapping generation script
└── dist/extension                       # Build output extension directory

Technology Stack

Technology Purpose
Manifest V3 Browser extension running environment
Vue 3 MoeKoeMusic Web page
Vite Web page building
esbuild Service Worker packaging
Chrome Extensions API Window opening, message communication, storage
KuGouMusicApi Upstream API module source

Disclaimer

This project is only for learning and technical research. The music data, lyrics, covers, and other contents in the project are owned by the original copyright holders. Please do not use this project for commercial purposes or violate relevant service terms. Any risks arising from the use of this project are borne by the users themselves.

License

This project follows the open-source agreement of the upstream MoeKoeMusic, see MoeKoeMusic/LICENSE .

Copyright Notice

Author: MoeJue

Link: https://ja.moejue.cn/en/posts/339/

License: クリエイティブ・コモンズ表示-非営利-継承4.0国際ライセンス

この作品は、クリエイティブ・コモンズ表示-非営利-継承4.0国際ライセンスに基づいてライセンスされています。

Start searching

Enter keywords to search articles

↑↓
↵
ESC
⌘K Shortcut