mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-15 20:58:01 +00:00
Compare commits
77 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71817baad0 | |||
| f6735c9c26 | |||
| 708a1a8eb8 | |||
|
|
70ab357799 | ||
|
|
c7e69158d2 | ||
|
|
022009b140 | ||
|
|
6849632abe | ||
|
|
c929beaf6c | ||
|
|
dfb09b3ccd | ||
|
|
9809a758b4 | ||
|
|
c9739b2d0e | ||
|
|
25e274a4f8 | ||
|
|
fc1c8d8512 | ||
|
|
e27879aa94 | ||
|
|
d219e48541 | ||
|
|
107f5765b0 | ||
|
|
adafffd86b | ||
|
|
9d807d1d63 | ||
|
|
481ba6bce3 | ||
|
|
df82c7cd22 | ||
|
|
bd5af9c721 | ||
|
|
7cb063d511 | ||
|
|
904e61bee6 | ||
|
|
24477694f8 | ||
|
|
87ef48b826 | ||
|
|
da8afc12cf | ||
|
|
84613dcf8a | ||
|
|
dd8aa175d1 | ||
|
|
e3caa24ca4 | ||
|
|
ae352f27e1 | ||
|
|
552a1d4b44 | ||
|
|
b0ed85689b | ||
|
|
a18e093d4a | ||
|
|
79a7c6d991 | ||
|
|
1a2c3e2843 | ||
|
|
741fdc973c | ||
|
|
1400636201 | ||
|
|
6e737b50ee | ||
|
|
c409e3b6ed | ||
|
|
e738d1e46d | ||
|
|
380c55a653 | ||
|
|
9241b3a26a | ||
|
|
3093b6f386 | ||
|
|
42366f4a32 | ||
|
|
6d6fd9a88c | ||
|
|
dc1e0aaf90 | ||
|
|
a5cb1f729d | ||
|
|
e997cd9907 | ||
|
|
c5c7ccc89e | ||
|
|
61d0b5953f | ||
|
|
a5bf5c7dfd | ||
|
|
fd40a29180 | ||
|
|
486b04b70b | ||
|
|
6ad756b215 | ||
|
|
ed1daab1f6 | ||
|
|
f2f4e2ce58 | ||
|
|
845bc8a921 | ||
|
|
f2efc4e682 | ||
|
|
f4d3d67132 | ||
|
|
e14e6d73c6 | ||
|
|
4ec550dc46 | ||
|
|
dd6d4bf1c6 | ||
|
|
a6e433bdc5 | ||
|
|
59898c7883 | ||
|
|
1b7e33c222 | ||
|
|
221ca63d3d | ||
|
|
b7f7ac8d31 | ||
|
|
65f5df8a60 | ||
|
|
8a50337854 | ||
|
|
7b97ac0139 | ||
|
|
1cb3e4b29f | ||
|
|
c89ebbdd22 | ||
|
|
ce738f6b40 | ||
|
|
41b72563ff | ||
|
|
345f3588bd | ||
|
|
022f740c3f | ||
|
|
ce778afff6 |
51 changed files with 5540 additions and 4033 deletions
|
|
@ -1,6 +1,6 @@
|
|||
VUE_APP_NETEASE_API_URL=/api
|
||||
VUE_APP_ELECTRON_API_URL=/api
|
||||
VUE_APP_ELECTRON_API_URL_DEV=http://127.0.0.1:35216
|
||||
VUE_APP_ELECTRON_API_URL_DEV=http://127.0.0.1:10754
|
||||
VUE_APP_LASTFM_API_KEY=09c55292403d961aa517ff7f5e8a3d9c
|
||||
VUE_APP_LASTFM_API_SHARED_SECRET=307c9fda32b3904e53654baff215cb67
|
||||
DEV_SERVER_PORT=20201
|
||||
|
|
|
|||
4
.envrc
Normal file
4
.envrc
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="
|
||||
|
||||
export NIXPKGS_ALLOW_INSECURE=1
|
||||
use devenv
|
||||
7
.github/workflows/build.yaml
vendored
7
.github/workflows/build.yaml
vendored
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-18.04]
|
||||
os: [macos-latest, windows-latest, ubuntu-22.04]
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
|
|
@ -36,7 +36,7 @@ jobs:
|
|||
run: |
|
||||
sudo apt-get update &&
|
||||
sudo apt-get install --no-install-recommends -y rpm &&
|
||||
sudo apt-get install --no-install-recommends -y bsdtar &&
|
||||
sudo apt-get install --no-install-recommends -y libarchive-tools &&
|
||||
sudo apt-get install --no-install-recommends -y libopenjp2-tools
|
||||
|
||||
- name: Install Snapcraft (on Ubuntu)
|
||||
|
|
@ -81,8 +81,9 @@ jobs:
|
|||
- name: Build/release Electron app
|
||||
uses: samuelmeuli/action-electron-builder@v1.6.0
|
||||
env:
|
||||
VUE_APP_NETEASE_API_URL: /api
|
||||
VUE_APP_ELECTRON_API_URL: /api
|
||||
VUE_APP_ELECTRON_API_URL_DEV: http://127.0.0.1:35216
|
||||
VUE_APP_ELECTRON_API_URL_DEV: http://127.0.0.1:10754
|
||||
VUE_APP_LASTFM_API_KEY: 09c55292403d961aa517ff7f5e8a3d9c
|
||||
VUE_APP_LASTFM_API_SHARED_SECRET: 307c9fda32b3904e53654baff215cb67
|
||||
with:
|
||||
|
|
|
|||
48
.github/workflows/sync.yml
vendored
Normal file
48
.github/workflows/sync.yml
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
name: Upstream Sync
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
actions: write
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 * * * *' # every hour
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync_latest_from_upstream:
|
||||
name: Sync latest commits from upstream repo
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.repository.fork }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Clean issue notice
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
labels: '🚨 Sync Fail'
|
||||
|
||||
- name: Sync upstream changes
|
||||
id: sync
|
||||
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
|
||||
with:
|
||||
upstream_sync_repo: qier222/YesPlayMusic
|
||||
upstream_sync_branch: master
|
||||
target_sync_branch: master
|
||||
target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
|
||||
test_mode: false
|
||||
|
||||
- name: Sync check
|
||||
if: failure()
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
title: '🚨 同步失败 | Sync Fail'
|
||||
labels: '🚨 Sync Fail'
|
||||
body: |
|
||||
Due to a change in the workflow file of the upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork.
|
||||
|
||||
由于上游仓库的 workflow 文件变更,导致 GitHub 自动暂停了本次自动更新,你需要手动 Sync Fork 一次。
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -32,3 +32,12 @@ NeteaseCloudMusicApi-master.zip
|
|||
# Local Netlify folder
|
||||
.netlify
|
||||
vercel.json
|
||||
# Devenv
|
||||
.devenv*
|
||||
devenv.local.nix
|
||||
|
||||
# direnv
|
||||
.direnv
|
||||
|
||||
# pre-commit
|
||||
.pre-commit-config.yaml
|
||||
|
|
|
|||
11
Dockerfile
11
Dockerfile
|
|
@ -1,17 +1,20 @@
|
|||
FROM node:16.13.1-alpine as build
|
||||
ENV VUE_APP_NETEASE_API_URL=/api
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache python3 make g++ git
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
|
||||
apk add --no-cache python3 make g++ git
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn install
|
||||
COPY . .
|
||||
RUN yarn build
|
||||
RUN yarn config set electron_mirror https://npmmirror.com/mirrors/electron/ && \
|
||||
yarn build
|
||||
|
||||
FROM nginx:1.20.2-alpine as app
|
||||
|
||||
COPY --from=build /app/package.json /usr/local/lib/
|
||||
|
||||
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main libuv \
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
|
||||
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main libuv \
|
||||
&& apk add --no-cache --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main nodejs npm \
|
||||
&& npm i -g $(awk -F \" '{if($2=="NeteaseCloudMusicApi") print $2"@"$4}' /usr/local/lib/package.json) \
|
||||
&& rm -f /usr/local/lib/package.json
|
||||
|
|
@ -19,4 +22,4 @@ RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/m
|
|||
COPY --from=build /app/docker/nginx.conf.example /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
CMD nginx ; exec npx NeteaseCloudMusicApi
|
||||
CMD nginx ; exec npx NeteaseCloudMusicApi
|
||||
21
README.md
21
README.md
|
|
@ -8,7 +8,7 @@
|
|||
<p align="center">
|
||||
高颜值的第三方网易云播放器
|
||||
<br />
|
||||
<a href="https://music.qier222.com" target="blank"><strong>🌎 访问DEMO</strong></a> |
|
||||
<a href="https://music.ineko.cc" target="blank"><strong>🌎 访问DEMO</strong></a> |
|
||||
<a href="#%EF%B8%8F-安装" target="blank"><strong>📦️ 下载安装包</strong></a> |
|
||||
<a href="https://t.me/yesplaymusic" target="blank"><strong>💬 加入交流群</strong></a>
|
||||
<br />
|
||||
|
|
@ -16,7 +16,12 @@
|
|||
</p>
|
||||
</p>
|
||||
|
||||
[![Library][library-screenshot]](https://music.qier222.com)
|
||||
[![Library][library-screenshot]](https://music.ineko.cc)
|
||||
|
||||
|
||||
## 全新版本
|
||||
全新2.0 Alpha测试版已发布,欢迎前往 [Releases](https://github.com/qier222/YesPlayMusic/releases) 页面下载。
|
||||
当前版本将会进入维护模式,除重大bug修复外,不会再更新新功能。
|
||||
|
||||
## ✨ 特性
|
||||
|
||||
|
|
@ -120,6 +125,16 @@ yarn run build
|
|||
|
||||
7. 将 `/dist` 目录下的文件上传到你的 Web 服务器
|
||||
|
||||
## ⚙️ 宝塔面板 docker应用商店 部署
|
||||
|
||||
1. 安装宝塔面板,前往[宝塔面板官网](https://www.bt.cn/new/download.html) ,选择正式版的脚本下载安装。
|
||||
|
||||
2. 安装后登录宝塔面板,在左侧导航栏中点击 Docker,首次进入会提示安装Docker服务,点击立即安装,按提示完成安装
|
||||
|
||||
3. 安装完成后在应用商店中找到YesPlayMusic,点击安装,配置域名、端口等基本信息即可完成安装。
|
||||
|
||||
4. 安装后在浏览器输入上一步骤设置的域名即可访问。
|
||||
|
||||
## ⚙️ Docker 部署
|
||||
|
||||
1. 构建 Docker Image
|
||||
|
|
@ -157,7 +172,7 @@ bash <(curl -s -L https://raw.githubusercontent.com/qier222/YesPlayMusic/main/in
|
|||
4. 由于 replit 个人版限制内存为 1G(教育版为 3G),构建过程中可能会失败,请再次运行上述命令或运行以下命令:
|
||||
|
||||
```sh
|
||||
cd /home/runner/${REPL_SLUG}/music && yarn installl && yarn run build
|
||||
cd /home/runner/${REPL_SLUG}/music && yarn install && yarn run build
|
||||
```
|
||||
|
||||
## 👷♂️ 打包客户端
|
||||
|
|
|
|||
132
devenv.lock
Normal file
132
devenv.lock
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
{
|
||||
"nodes": {
|
||||
"devenv": {
|
||||
"locked": {
|
||||
"dir": "src/modules",
|
||||
"lastModified": 1730412360,
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "45847cb1f14a6d8cfa86ea943703c54a8798ae7e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "src/modules",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1730272153,
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1730327045,
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "080166c15633801df010977d9d7474b4a6c549d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nodejs16": {
|
||||
"locked": {
|
||||
"lastModified": 1700230496,
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a71323f68d4377d12c04a5410e214495ec598d4c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a71323f68d4377d12c04a5410e214495ec598d4c",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730302582,
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nodejs16": "nodejs16",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
53
devenv.nix
Normal file
53
devenv.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{ pkgs, lib, config, inputs, ... }:
|
||||
|
||||
let
|
||||
nodejs16 = import inputs.nodejs16 { system = pkgs.stdenv.system; };
|
||||
in
|
||||
{
|
||||
# https://devenv.sh/basics/
|
||||
env.GREET = "devenv";
|
||||
|
||||
# https://devenv.sh/packages/
|
||||
packages = [ pkgs.git ] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [
|
||||
frameworks.AppKit
|
||||
]);
|
||||
|
||||
# https://devenv.sh/languages/
|
||||
languages.javascript.enable = true;
|
||||
languages.javascript.package = nodejs16.pkgs.nodejs_16;
|
||||
languages.javascript.corepack.enable = true;
|
||||
# languages.rust.enable = true;
|
||||
|
||||
# https://devenv.sh/processes/
|
||||
# processes.cargo-watch.exec = "cargo-watch";
|
||||
|
||||
# https://devenv.sh/services/
|
||||
# services.postgres.enable = true;
|
||||
|
||||
# https://devenv.sh/scripts/
|
||||
scripts.hello.exec = ''
|
||||
echo hello from $GREET
|
||||
'';
|
||||
|
||||
enterShell = ''
|
||||
hello
|
||||
git --version
|
||||
'';
|
||||
|
||||
# https://devenv.sh/tasks/
|
||||
# tasks = {
|
||||
# "myproj:setup".exec = "mytool build";
|
||||
# "devenv:enterShell".after = [ "myproj:setup" ];
|
||||
# };
|
||||
|
||||
# https://devenv.sh/tests/
|
||||
enterTest = ''
|
||||
echo "Running tests"
|
||||
git --version | grep --color=auto "${pkgs.git.version}"
|
||||
'';
|
||||
|
||||
# https://devenv.sh/pre-commit-hooks/
|
||||
# pre-commit.hooks.shellcheck.enable = true;
|
||||
|
||||
# See full reference at https://devenv.sh/reference/options/
|
||||
}
|
||||
19
devenv.yaml
Normal file
19
devenv.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
|
||||
inputs:
|
||||
nixpkgs:
|
||||
url: github:nixos/nixpkgs/nixpkgs-unstable
|
||||
nodejs16:
|
||||
url: github:nixos/nixpkgs/a71323f68d4377d12c04a5410e214495ec598d4c
|
||||
|
||||
# https://github.com/cachix/devenv/issues/792#issuecomment-2043166453
|
||||
impure: true
|
||||
# If you're using non-OSS software, you can set allowUnfree to true.
|
||||
# allowUnfree: true
|
||||
|
||||
# If you're willing to use a package that's vulnerable
|
||||
# permittedInsecurePackages:
|
||||
# - "openssl-1.1.1w"
|
||||
|
||||
# If you have more than one devenv you can merge them
|
||||
#imports:
|
||||
# - ./backend
|
||||
|
|
@ -7,6 +7,33 @@ services:
|
|||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./docker/nginx.conf.example:/etc/nginx/conf.d/default.conf:ro
|
||||
ports:
|
||||
- 80:80
|
||||
restart: always
|
||||
depends_on:
|
||||
- UnblockNeteaseMusic
|
||||
environment:
|
||||
- NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||
networks:
|
||||
my_network:
|
||||
|
||||
UnblockNeteaseMusic:
|
||||
image: pan93412/unblock-netease-music-enhanced
|
||||
command: -o kugou kuwo migu bilibili pyncmd -p 80:443 -f 45.127.129.53 -e -
|
||||
# environment:
|
||||
# JSON_LOG: true
|
||||
# LOG_LEVEL: debug
|
||||
networks:
|
||||
my_network:
|
||||
aliases:
|
||||
- music.163.com
|
||||
- interface.music.163.com
|
||||
- interface3.music.163.com
|
||||
- interface.music.163.com.163jiasu.com
|
||||
- interface3.music.163.com.163jiasu.com
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
my_network:
|
||||
driver: bridge
|
||||
|
|
|
|||
11
package.json
11
package.json
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "yesplaymusic",
|
||||
"version": "0.4.6",
|
||||
"version": "0.4.9",
|
||||
"private": true,
|
||||
"description": "A third party music player for Netease Music",
|
||||
"author": "qier222<qier222@outlook.com>",
|
||||
|
|
@ -22,9 +22,12 @@
|
|||
"netease_api:run": "npx NeteaseCloudMusicApi"
|
||||
},
|
||||
"main": "background.js",
|
||||
"engines": {
|
||||
"node": "14 || 16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@unblockneteasemusic/rust-napi": "^0.4.0",
|
||||
"NeteaseCloudMusicApi": "^4.8.7",
|
||||
"NeteaseCloudMusicApi": "^4.23.3",
|
||||
"axios": "^0.26.1",
|
||||
"change-case": "^4.1.2",
|
||||
"cli-color": "^2.0.0",
|
||||
|
|
@ -44,6 +47,8 @@
|
|||
"electron-log": "^4.3.0",
|
||||
"electron-store": "^8.0.1",
|
||||
"electron-updater": "^5.0.1",
|
||||
"esbuild": "^0.20.1",
|
||||
"esbuild-loader": "^4.0.3",
|
||||
"express": "^4.17.1",
|
||||
"express-fileupload": "^1.2.0",
|
||||
"express-http-proxy": "^1.6.2",
|
||||
|
|
@ -59,7 +64,6 @@
|
|||
"nprogress": "^0.2.0",
|
||||
"pac-proxy-agent": "^4.1.0",
|
||||
"plyr": "^3.6.2",
|
||||
"prettier": "2.5.1",
|
||||
"qrcode": "^1.4.4",
|
||||
"register-service-worker": "^1.7.1",
|
||||
"svg-sprite-loader": "^6.0.11",
|
||||
|
|
@ -87,6 +91,7 @@
|
|||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-vue": "^7.9.0",
|
||||
"husky": "^4.3.0",
|
||||
"prettier": "2.5.1",
|
||||
"sass": "^1.26.11",
|
||||
"sass-loader": "^10.0.2",
|
||||
"vue-cli-plugin-electron-builder": "~2.1.1",
|
||||
|
|
|
|||
BIN
public/img/icons/menu-dark@88.png
Normal file
BIN
public/img/icons/menu-dark@88.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
|
@ -1,2 +1,2 @@
|
|||
User-agent: *
|
||||
Disallow:
|
||||
Disallow: /
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import request from '@/utils/request';
|
||||
import { mapTrackPlayableStatus } from '@/utils/common';
|
||||
import { isAccountLoggedIn } from '@/utils/auth';
|
||||
import { getTrackDetail } from '@/api/track';
|
||||
|
||||
/**
|
||||
* 获取歌手单曲
|
||||
|
|
@ -14,7 +16,13 @@ export function getArtist(id) {
|
|||
id,
|
||||
timestamp: new Date().getTime(),
|
||||
},
|
||||
}).then(data => {
|
||||
}).then(async data => {
|
||||
if (!isAccountLoggedIn()) {
|
||||
const trackIDs = data.hotSongs.map(t => t.id);
|
||||
const tracks = await getTrackDetail(trackIDs.join(','));
|
||||
data.hotSongs = tracks.songs;
|
||||
return data;
|
||||
}
|
||||
data.hotSongs = mapTrackPlayableStatus(data.hotSongs);
|
||||
return data;
|
||||
});
|
||||
|
|
|
|||
3
src/assets/icons/fullscreen-exit.svg
Normal file
3
src/assets/icons/fullscreen-exit.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="14" height="14" viewBox="0 0 14 14" data-darkreader-inline-fill="" xmlns="http://www.w3.org/2000/svg">
|
||||
<path id="path" d="M1 11L3 11L3 13C3 13.55 3.45 14 4 14C4.55 14 5 13.55 5 13L5 10C5 9.45 4.55 9 4 9L1 9C0.45 9 0 9.45 0 10C0 10.55 0.45 11 1 11ZM11 3L11 1C11 0.45 10.55 0 10 0C9.45 0 9 0.45 9 1L9 4C9 4.54 9.45 5 10 5L13 5C13.55 5 14 4.54 14 4C14 3.45 13.55 3 13 3L11 3Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 396 B |
3
src/assets/icons/fullscreen.svg
Normal file
3
src/assets/icons/fullscreen.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="14" height="14" viewBox="0 0 14 14" data-darkreader-inline-fill="" xmlns="http://www.w3.org/2000/svg">
|
||||
<path id="path" d="M1 9C0.45 9 0 9.45 0 10L0 13C0 13.55 0.45 14 1 14L4 14C4.55 14 5 13.55 5 13C5 12.45 4.55 12 4 12L2 12L2 10C2 9.45 1.55 9 1 9ZM9 1C9 1.54 9.45 2 10 2L12 2L12 4C12 4.54 12.45 5 13 5C13.55 5 14 4.54 14 4L14 1C14 0.45 13.55 0 13 0L10 0C9.45 0 9 0.45 9 1Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 396 B |
|
|
@ -31,7 +31,8 @@ import { EventEmitter } from 'events';
|
|||
import express from 'express';
|
||||
import expressProxy from 'express-http-proxy';
|
||||
import Store from 'electron-store';
|
||||
import { createMpris } from '@/electron/mpris';
|
||||
import { createMpris, createDbus } from '@/electron/mpris';
|
||||
import { spawn } from 'child_process';
|
||||
const clc = require('cli-color');
|
||||
const log = text => {
|
||||
console.log(`${clc.blueBright('[background.js]')} ${text}`);
|
||||
|
|
@ -66,7 +67,7 @@ const closeOnLinux = (e, win, store) => {
|
|||
win.hide(); //调用 最小化实例方法
|
||||
} else if (result.response === 1) {
|
||||
win = null;
|
||||
app.exit(); // exit()直接关闭客户端,不会执行quit();
|
||||
app.exit(); //exit()直接关闭客户端,不会执行quit();
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
|
|
@ -153,7 +154,7 @@ class Background {
|
|||
|
||||
const expressApp = express();
|
||||
expressApp.use('/', express.static(__dirname + '/'));
|
||||
expressApp.use('/api', expressProxy('http://127.0.0.1:35216'));
|
||||
expressApp.use('/api', expressProxy('http://127.0.0.1:10754'));
|
||||
expressApp.use('/player', (req, res) => {
|
||||
this.window.webContents
|
||||
.executeJavaScript('window.yesplaymusic.player')
|
||||
|
|
@ -166,7 +167,7 @@ class Background {
|
|||
});
|
||||
});
|
||||
});
|
||||
this.expressApp = expressApp.listen(41342, '127.0.0.1');
|
||||
this.expressApp = expressApp.listen(27232, '127.0.0.1');
|
||||
}
|
||||
|
||||
createWindow() {
|
||||
|
|
@ -257,8 +258,8 @@ class Background {
|
|||
createProtocol('app');
|
||||
this.window.loadURL(
|
||||
showLibraryDefault
|
||||
? 'http://localhost:41342/#/library'
|
||||
: 'http://localhost:41342'
|
||||
? 'http://localhost:27232/#/library'
|
||||
: 'http://localhost:27232'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -420,6 +421,21 @@ class Background {
|
|||
registerGlobalShortcut(this.window, this.store);
|
||||
}
|
||||
|
||||
// try to start osdlyrics process on start
|
||||
if (this.store.get('settings.enableOsdlyricsSupport')) {
|
||||
await createDbus(this.window);
|
||||
log('try to start osdlyrics process');
|
||||
const osdlyricsProcess = spawn('osdlyrics');
|
||||
|
||||
osdlyricsProcess.on('error', err => {
|
||||
log(`failed to start osdlyrics: ${err.message}`);
|
||||
});
|
||||
|
||||
osdlyricsProcess.on('exit', (code, signal) => {
|
||||
log(`osdlyrics process exited with code ${code}, signal ${signal}`);
|
||||
});
|
||||
}
|
||||
|
||||
// create mpris
|
||||
if (isCreateMpris) {
|
||||
createMpris(this.window);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ img {
|
|||
cursor: default;
|
||||
transition: 0.2s;
|
||||
.svg-icon {
|
||||
height: 44%;
|
||||
width: 50%;
|
||||
margin: {
|
||||
left: 4px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default {
|
|||
props: {
|
||||
items: { type: Array, required: true },
|
||||
type: { type: String, required: true },
|
||||
subText: { type: String, default: 'null' },
|
||||
subText: { type: String, default: 'none' },
|
||||
subTextFontSize: { type: String, default: '16px' },
|
||||
showPlayCount: { type: Boolean, default: false },
|
||||
columnNumber: { type: Number, default: 5 },
|
||||
|
|
@ -75,9 +75,9 @@ export default {
|
|||
return new Date(item.publishTime).getFullYear();
|
||||
if (this.subText === 'artist') {
|
||||
if (item.artist !== undefined)
|
||||
return `<a href="/#/artist/${item.artist.id}">${item.artist.name}</a>`;
|
||||
return `<a href="/artist/${item.artist.id}">${item.artist.name}</a>`;
|
||||
if (item.artists !== undefined)
|
||||
return `<a href="/#/artist/${item.artists[0].id}">${item.artists[0].name}</a>`;
|
||||
return `<a href="/artist/${item.artists[0].id}">${item.artists[0].name}</a>`;
|
||||
}
|
||||
if (this.subText === 'albumType+releaseYear') {
|
||||
let albumType = item.type;
|
||||
|
|
@ -96,7 +96,7 @@ export default {
|
|||
return this.type === 'playlist' && item.privacy === 10;
|
||||
},
|
||||
isExplicit(item) {
|
||||
return this.type === 'album' && item.mark === 1056768;
|
||||
return this.type === 'album' && (item.mark & 1048576) === 1048576;
|
||||
},
|
||||
getTitleLink(item) {
|
||||
return `/${this.type}/${item.id}`;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export default {
|
|||
artistName = mv.creator[0].userName;
|
||||
artistID = mv.creator[0].userId;
|
||||
}
|
||||
return `<a href="/#/artist/${artistID}">${artistName}</a>`;
|
||||
return `<a href="/artist/${artistID}">${artistName}</a>`;
|
||||
} else if (this.subtitle === 'publishTime') {
|
||||
return mv.publishTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ nav {
|
|||
|
||||
@media (max-width: 1336px) {
|
||||
nav {
|
||||
padding: 0 5vw;
|
||||
padding: 0 max(5vw, 90px);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ import '@/assets/css/slider.css';
|
|||
import ButtonIcon from '@/components/ButtonIcon.vue';
|
||||
import VueSlider from 'vue-slider-component';
|
||||
import { goToListSource, hasListSource } from '@/utils/playList';
|
||||
import { formatTrackTime } from '@/utils/common';
|
||||
|
||||
export default {
|
||||
name: 'Player',
|
||||
|
|
@ -239,10 +240,7 @@ export default {
|
|||
: this.$router.push({ name: 'next' });
|
||||
},
|
||||
formatTrackTime(value) {
|
||||
if (!value) return '';
|
||||
let min = ~~((value / 60) % 60);
|
||||
let sec = (~~(value % 60)).toString().padStart(2, '0');
|
||||
return `${min}:${sec}`;
|
||||
return formatTrackTime(value);
|
||||
},
|
||||
hasList() {
|
||||
return hasListSource();
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
v-for="(track, index) in tracks"
|
||||
:key="itemKey === 'id' ? track.id : `${track.id}${index}`"
|
||||
:track-prop="track"
|
||||
:track-no="index + 1"
|
||||
:highlight-playing-track="highlightPlayingTrack"
|
||||
@dblclick.native="playThisList(track.id || track.songId)"
|
||||
@click.right.native="openMenu($event, track, index)"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
style="height: 14px; width: 14px"
|
||||
></svg-icon>
|
||||
</button>
|
||||
<span v-show="(!focus || !playable) && !isPlaying">{{ track.no }}</span>
|
||||
<span v-show="(!focus || !playable) && !isPlaying">{{ trackNo }}</span>
|
||||
<button v-show="isPlaying">
|
||||
<svg-icon
|
||||
icon-class="volume"
|
||||
|
|
@ -42,13 +42,15 @@
|
|||
:exclude="$parent.albumObject.artist.name"
|
||||
prefix="-"
|
||||
/></span>
|
||||
<span v-if="isAlbum && track.mark === 1318912" class="explicit-symbol"
|
||||
<span
|
||||
v-if="isAlbum && (track.mark & 1048576) === 1048576"
|
||||
class="explicit-symbol"
|
||||
><ExplicitSymbol
|
||||
/></span>
|
||||
</div>
|
||||
<div v-if="!isAlbum" class="artist">
|
||||
<span
|
||||
v-if="track.mark === 1318912"
|
||||
v-if="(track.mark & 1048576) === 1048576"
|
||||
class="explicit-symbol before-artist"
|
||||
><ExplicitSymbol :size="15"
|
||||
/></span>
|
||||
|
|
@ -96,6 +98,7 @@ export default {
|
|||
|
||||
props: {
|
||||
trackProp: Object,
|
||||
trackNo: Number,
|
||||
highlightPlayingTrack: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ export function initIpcMain(win, store, trayEventEmitter) {
|
|||
details: track.name + ' - ' + track.ar.map(ar => ar.name).join(','),
|
||||
state: track.al.name,
|
||||
endTimestamp: Date.now() + track.dt,
|
||||
largeImageKey: 'logo',
|
||||
largeImageKey: track.al.picUrl,
|
||||
largeImageText: 'Listening ' + track.name,
|
||||
smallImageKey: 'play',
|
||||
smallImageText: 'Playing',
|
||||
|
|
@ -252,7 +252,7 @@ export function initIpcMain(win, store, trayEventEmitter) {
|
|||
client.updatePresence({
|
||||
details: track.name + ' - ' + track.ar.map(ar => ar.name).join(','),
|
||||
state: track.al.name,
|
||||
largeImageKey: 'logo',
|
||||
largeImageKey: track.al.picUrl,
|
||||
largeImageText: 'YesPlayMusic',
|
||||
smallImageKey: 'pause',
|
||||
smallImageText: 'Pause',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import dbus from 'dbus-next';
|
||||
import { ipcMain, app } from 'electron';
|
||||
|
||||
export function createMpris(window) {
|
||||
|
|
@ -28,6 +29,8 @@ export function createMpris(window) {
|
|||
});
|
||||
|
||||
ipcMain.on('metadata', (e, metadata) => {
|
||||
// 更新 Mpris 状态前将位置设为0, 否则 OSDLyrics 获取到的进度是上首音乐切换时的进度
|
||||
player.getPosition = () => 0;
|
||||
player.metadata = {
|
||||
'mpris:trackid': player.objectPath('track/' + metadata.trackId),
|
||||
'mpris:artUrl': metadata.artwork[0].src,
|
||||
|
|
@ -35,11 +38,17 @@ export function createMpris(window) {
|
|||
'xesam:title': metadata.title,
|
||||
'xesam:album': metadata.album,
|
||||
'xesam:artist': metadata.artist.split(','),
|
||||
'xesam:url': metadata.url,
|
||||
};
|
||||
});
|
||||
|
||||
ipcMain.on('playerCurrentTrackTime', (e, position) => {
|
||||
player.getPosition = () => position * 1000 * 1000;
|
||||
player.seeked(position * 1000 * 1000);
|
||||
});
|
||||
|
||||
ipcMain.on('seeked', (e, position) => {
|
||||
player.seeked(position * 1000 * 1000);
|
||||
});
|
||||
|
||||
ipcMain.on('switchRepeatMode', (e, mode) => {
|
||||
|
|
@ -60,3 +69,26 @@ export function createMpris(window) {
|
|||
player.shuffle = shuffle;
|
||||
});
|
||||
}
|
||||
|
||||
export async function createDbus(window) {
|
||||
const bus = dbus.sessionBus();
|
||||
const Variant = dbus.Variant;
|
||||
|
||||
const osdService = await bus.getProxyObject(
|
||||
'org.osdlyrics.Daemon',
|
||||
'/org/osdlyrics/Lyrics'
|
||||
);
|
||||
|
||||
const osdInterface = osdService.getInterface('org.osdlyrics.Lyrics');
|
||||
|
||||
ipcMain.on('sendLyrics', async (e, { track, lyrics }) => {
|
||||
const metadata = {
|
||||
title: new Variant('s', track.name),
|
||||
artist: new Variant('s', track.ar.map(ar => ar.name).join(', ')),
|
||||
};
|
||||
|
||||
await osdInterface.SetLyricContent(metadata, Buffer.from(lyrics));
|
||||
|
||||
window.webContents.send('saveLyricFinished');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import clc from 'cli-color';
|
||||
import checkAuthToken from '../utils/checkAuthToken';
|
||||
import server from 'NeteaseCloudMusicApi/server';
|
||||
|
||||
export async function startNeteaseMusicApi() {
|
||||
|
|
@ -7,7 +8,7 @@ export async function startNeteaseMusicApi() {
|
|||
|
||||
// Load the NCM API.
|
||||
await server.serveNcmApi({
|
||||
port: 35216,
|
||||
port: 10754,
|
||||
moduleDefs: require('../ncmModDef'),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* global __static */
|
||||
import path from 'path';
|
||||
import { app, nativeImage, Tray, Menu } from 'electron';
|
||||
import { app, nativeImage, Tray, Menu, nativeTheme } from 'electron';
|
||||
import { isLinux } from '@/utils/platform';
|
||||
|
||||
function createMenuTemplate(win) {
|
||||
|
|
@ -197,8 +197,11 @@ class YPMTrayWindowsImpl {
|
|||
}
|
||||
|
||||
export function createTray(win, eventEmitter) {
|
||||
// 感觉图标颜色应该不属于界面主题范畴,只需要跟随系统主题
|
||||
let iconTheme = nativeTheme.shouldUseDarkColors ? 'light' : 'dark';
|
||||
|
||||
let icon = nativeImage
|
||||
.createFromPath(path.join(__static, 'img/icons/menu@88.png'))
|
||||
.createFromPath(path.join(__static, `img/icons/menu-${iconTheme}@88.png`))
|
||||
.resize({
|
||||
height: 20,
|
||||
width: 20,
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ export default {
|
|||
pause: 'Pause',
|
||||
mute: 'Mute',
|
||||
nextUp: 'Next Up',
|
||||
translationLyric: 'lyric (trans)',
|
||||
PronunciationLyric: 'lyric (pronounce)',
|
||||
},
|
||||
modal: {
|
||||
close: 'Close',
|
||||
|
|
@ -130,6 +132,17 @@ export default {
|
|||
settings: 'Settings',
|
||||
logout: 'LOGOUT',
|
||||
language: 'Languages',
|
||||
lyric: 'Lyric',
|
||||
others: 'Others',
|
||||
customization: 'Customization',
|
||||
MusicGenrePreference: {
|
||||
text: 'Music Language Preference',
|
||||
none: 'No preferences',
|
||||
mandarin: 'Mandarin',
|
||||
western: 'Europe & America',
|
||||
korean: 'Korean',
|
||||
japanese: 'Japanese',
|
||||
},
|
||||
musicQuality: {
|
||||
text: 'Music Quality',
|
||||
low: 'Low',
|
||||
|
|
@ -180,6 +193,13 @@ export default {
|
|||
exit: 'Exit',
|
||||
minimizeToTray: 'Minimize to tray',
|
||||
},
|
||||
enableOsdlyricsSupport: {
|
||||
title: 'desktop lyrics support',
|
||||
desc1:
|
||||
'Only takes effect under Linux. After enabled, it downloads the lyrics file to the local, and tries to launch OSDLyrics at startup.',
|
||||
desc2:
|
||||
'Please ensure that you have installed OSDLyrics before turning on this.',
|
||||
},
|
||||
unm: {
|
||||
enable: 'Enable',
|
||||
audioSource: {
|
||||
|
|
@ -224,6 +244,8 @@ export default {
|
|||
minePlaylists: 'My Playlists',
|
||||
likedPlaylists: 'Liked Playlists',
|
||||
cardiacMode: 'Cardiac Mode',
|
||||
copyLyric: 'Copy Lyric',
|
||||
copyLyricWithTranslation: 'Copy Lyric With Translation',
|
||||
},
|
||||
toast: {
|
||||
savedToPlaylist: 'Saved to playlist',
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ export default {
|
|||
pause: 'Durdur',
|
||||
mute: 'Sesi kapat',
|
||||
nextUp: 'Sıradaki',
|
||||
translationLyric: 'şarkı sözleri (çeviri)',
|
||||
PronunciationLyric: 'şarkı sözleri (çeviri)',
|
||||
},
|
||||
modal: {
|
||||
close: 'Kapat',
|
||||
|
|
@ -125,6 +127,17 @@ export default {
|
|||
settings: 'Ayarlar',
|
||||
logout: 'ÇIKIŞ YAP',
|
||||
language: 'Diller',
|
||||
lyric: 'Şarkı Sözleri',
|
||||
others: 'Diğerleri',
|
||||
customization: 'Özelleştirme',
|
||||
MusicGenrePreference: {
|
||||
text: 'Müzik Dili Tercihi',
|
||||
none: 'Tercih yok',
|
||||
mandarin: 'Çince dili',
|
||||
western: 'Avrupa ve Amerika',
|
||||
korean: 'Korece',
|
||||
japanese: 'Japonca',
|
||||
},
|
||||
musicQuality: {
|
||||
text: 'Müzik Kalitesi',
|
||||
low: 'Düşük',
|
||||
|
|
@ -217,6 +230,8 @@ export default {
|
|||
minePlaylists: 'My Playlists',
|
||||
likedPlaylists: 'Liked Playlists',
|
||||
cardiacMode: 'Cardiac Mode',
|
||||
copyLyric: 'Copy Lyric',
|
||||
copyLyricWithTranslation: 'Copy Lyric With Translation',
|
||||
},
|
||||
toast: {
|
||||
savedToMyLikedSongs: 'Beğendiğim Müziklere Kaydet',
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ export default {
|
|||
pause: '暂停',
|
||||
mute: '静音',
|
||||
nextUp: '播放列表',
|
||||
translationLyric: '歌词(译)',
|
||||
PronunciationLyric: '歌词(音)',
|
||||
},
|
||||
modal: {
|
||||
close: '关闭',
|
||||
|
|
@ -131,6 +133,17 @@ export default {
|
|||
settings: '设置',
|
||||
logout: '登出',
|
||||
language: '语言',
|
||||
lyric: '歌词',
|
||||
others: '其他',
|
||||
customization: '自定义',
|
||||
MusicGenrePreference: {
|
||||
text: '音乐语种偏好',
|
||||
none: '无偏好',
|
||||
mandarin: '华语',
|
||||
western: '欧美',
|
||||
korean: '韩语',
|
||||
japanese: '日语',
|
||||
},
|
||||
musicQuality: {
|
||||
text: '音质选择',
|
||||
low: '普通',
|
||||
|
|
@ -181,6 +194,12 @@ export default {
|
|||
exit: '退出',
|
||||
minimizeToTray: '最小化到托盘',
|
||||
},
|
||||
enableOsdlyricsSupport: {
|
||||
title: '桌面歌词支持',
|
||||
desc1:
|
||||
'仅 Linux 下生效。启用后会将歌词文件下载到本地,并在开启播放器时尝试拉起 OSDLyrics。',
|
||||
desc2: '请在开启之前确保您已经正确安装了 OSDLyrics。',
|
||||
},
|
||||
unm: {
|
||||
enable: '启用',
|
||||
audioSource: {
|
||||
|
|
@ -224,6 +243,8 @@ export default {
|
|||
minePlaylists: '创建的歌单',
|
||||
likedPlaylists: '收藏的歌单',
|
||||
cardiacMode: '心动模式',
|
||||
copyLyric: '复制歌词',
|
||||
copyLyricWithTranslation: '复制歌词(含翻译)',
|
||||
},
|
||||
toast: {
|
||||
savedToPlaylist: '已添加到歌单',
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ export default {
|
|||
pause: '暫停',
|
||||
mute: '靜音',
|
||||
nextUp: '播放清單',
|
||||
translationLyric: '歌詞(譯)',
|
||||
PronunciationLyric: '歌詞(音)',
|
||||
},
|
||||
modal: {
|
||||
close: '關閉',
|
||||
|
|
@ -127,6 +129,17 @@ export default {
|
|||
settings: '設定',
|
||||
logout: '登出',
|
||||
language: '語言',
|
||||
lyric: '歌詞',
|
||||
others: '其他',
|
||||
customization: '自訂',
|
||||
MusicGenrePreference: {
|
||||
text: '音樂語種偏好',
|
||||
none: '無偏好',
|
||||
mandarin: '華語',
|
||||
western: '歐美',
|
||||
korean: '韓語',
|
||||
japanese: '日語',
|
||||
},
|
||||
musicQuality: {
|
||||
text: '音質選擇',
|
||||
low: '普通',
|
||||
|
|
@ -178,6 +191,12 @@ export default {
|
|||
exit: '退出',
|
||||
minimizeToTray: '最小化到工作列角落',
|
||||
},
|
||||
enableOsdlyricsSupport: {
|
||||
title: '桌面歌詞支援',
|
||||
desc1:
|
||||
'只在 Linux 環境下生效。啟用後會將歌詞檔案下載至本機位置,並在開啟播放器時嘗試連帶啟動 OSDLyrics。',
|
||||
desc2: '請在開啟之前確保您已經正確安裝了 OSDLyrics。',
|
||||
},
|
||||
unm: {
|
||||
enable: '啟用',
|
||||
audioSource: {
|
||||
|
|
@ -221,6 +240,8 @@ export default {
|
|||
minePlaylists: '我建立的歌單',
|
||||
likedPlaylists: '收藏的歌單',
|
||||
cardiacMode: '心動模式',
|
||||
copyLyric: '複製歌詞',
|
||||
copyLyricWithTranslation: '複製歌詞(含翻譯)',
|
||||
},
|
||||
toast: {
|
||||
savedToPlaylist: '已新增至歌單',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import i18n from '@/locale';
|
|||
import '@/assets/icons';
|
||||
import '@/utils/filters';
|
||||
import './registerServiceWorker';
|
||||
import { dailyTask } from '@/utils/common';
|
||||
import '@/assets/css/global.scss';
|
||||
import NProgress from 'nprogress';
|
||||
import '@/assets/css/nprogress.css';
|
||||
|
|
@ -38,7 +37,6 @@ Vue.use(
|
|||
Vue.config.productionTip = false;
|
||||
|
||||
NProgress.configure({ showSpinner: false, trickleSpeed: 100 });
|
||||
dailyTask();
|
||||
|
||||
new Vue({
|
||||
i18n,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ let localStorage = {
|
|||
nyancatStyle: false,
|
||||
showLyricsTranslation: true,
|
||||
lyricsBackground: true,
|
||||
enableOsdlyricsSupport: false,
|
||||
closeAppOption: 'ask',
|
||||
enableDiscordRichPresence: false,
|
||||
enableGlobalShortcut: true,
|
||||
|
|
@ -35,6 +36,8 @@ let localStorage = {
|
|||
server: '',
|
||||
port: null,
|
||||
},
|
||||
enableRealIP: false,
|
||||
realIP: null,
|
||||
shortcuts: shortcuts,
|
||||
},
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { getArtist } from '@/api/artist';
|
|||
import { trackScrobble, trackUpdateNowPlaying } from '@/api/lastfm';
|
||||
import { fmTrash, personalFM } from '@/api/others';
|
||||
import { getPlaylistDetail, intelligencePlaylist } from '@/api/playlist';
|
||||
import { getMP3, getTrackDetail, scrobble } from '@/api/track';
|
||||
import { getLyric, getMP3, getTrackDetail } from '@/api/track';
|
||||
import store from '@/store';
|
||||
import { isAccountLoggedIn } from '@/utils/auth';
|
||||
import { cacheTrackSource, getTrackSource } from '@/utils/db';
|
||||
|
|
@ -14,6 +14,8 @@ import { decode as base642Buffer } from '@/utils/base64';
|
|||
|
||||
const PLAY_PAUSE_FADE_DURATION = 200;
|
||||
|
||||
const INDEX_IN_PLAY_NEXT = -1;
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @enum {string}
|
||||
|
|
@ -128,6 +130,8 @@ export default class {
|
|||
if (shuffle) {
|
||||
this._shuffleTheList();
|
||||
}
|
||||
// 同步当前歌曲在列表中的下标
|
||||
this.current = this.list.indexOf(this.currentTrackID);
|
||||
}
|
||||
get reversed() {
|
||||
return this._reversed;
|
||||
|
|
@ -199,6 +203,9 @@ export default class {
|
|||
set progress(value) {
|
||||
if (this._howler) {
|
||||
this._howler.seek(value);
|
||||
if (isCreateMpris) {
|
||||
ipcRenderer?.send('seeked', this._howler.seek());
|
||||
}
|
||||
}
|
||||
}
|
||||
get isCurrentTrackLiked() {
|
||||
|
|
@ -255,8 +262,8 @@ export default class {
|
|||
const next = this._reversed ? this.current - 1 : this.current + 1;
|
||||
|
||||
if (this._playNextList.length > 0) {
|
||||
let trackID = this._playNextList.shift();
|
||||
return [trackID, this.current];
|
||||
let trackID = this._playNextList[0];
|
||||
return [trackID, INDEX_IN_PLAY_NEXT];
|
||||
}
|
||||
|
||||
// 循环模式开启,则重新播放当前模式下的相对的下一首
|
||||
|
|
@ -302,11 +309,6 @@ export default class {
|
|||
);
|
||||
const trackDuration = ~~(track.dt / 1000);
|
||||
time = completed ? trackDuration : ~~time;
|
||||
scrobble({
|
||||
id: track.id,
|
||||
sourceid: this.playlistSource.id,
|
||||
time,
|
||||
});
|
||||
if (
|
||||
store.state.lastfm.key !== undefined &&
|
||||
(time >= trackDuration / 2 || time >= 240)
|
||||
|
|
@ -338,6 +340,10 @@ export default class {
|
|||
// code 3: MEDIA_ERR_DECODE
|
||||
if (errCode === 3) {
|
||||
this._playNextTrack(this._isPersonalFM);
|
||||
} else if (errCode === 4) {
|
||||
// code 4: MEDIA_ERR_SRC_NOT_SUPPORTED
|
||||
store.dispatch('showToast', `无法播放: 不支持的音频格式`);
|
||||
this._playNextTrack(this._isPersonalFM);
|
||||
} else {
|
||||
const t = this.progress;
|
||||
this._replaceCurrentTrackAudio(this.currentTrack, false, false).then(
|
||||
|
|
@ -611,13 +617,35 @@ export default class {
|
|||
],
|
||||
length: this.currentTrackDuration,
|
||||
trackId: this.current,
|
||||
url: '/trackid/' + track.id,
|
||||
};
|
||||
|
||||
navigator.mediaSession.metadata = new window.MediaMetadata(metadata);
|
||||
if (isCreateMpris) {
|
||||
ipcRenderer?.send('metadata', metadata);
|
||||
this._updateMprisState(track, metadata);
|
||||
}
|
||||
}
|
||||
// OSDLyrics 会检测 Mpris 状态并寻找对应歌词文件,所以要在更新 Mpris 状态之前保证歌词下载完成
|
||||
async _updateMprisState(track, metadata) {
|
||||
if (!store.state.settings.enableOsdlyricsSupport) {
|
||||
return ipcRenderer?.send('metadata', metadata);
|
||||
}
|
||||
|
||||
let lyricContent = await getLyric(track.id);
|
||||
|
||||
if (!lyricContent.lrc || !lyricContent.lrc.lyric) {
|
||||
return ipcRenderer?.send('metadata', metadata);
|
||||
}
|
||||
|
||||
ipcRenderer.send('sendLyrics', {
|
||||
track,
|
||||
lyrics: lyricContent.lrc.lyric,
|
||||
});
|
||||
|
||||
ipcRenderer.on('saveLyricFinished', () => {
|
||||
ipcRenderer?.send('metadata', metadata);
|
||||
});
|
||||
}
|
||||
_updateMediaSessionPositionState() {
|
||||
if ('mediaSession' in navigator === false) {
|
||||
return;
|
||||
|
|
@ -699,7 +727,12 @@ export default class {
|
|||
this._setPlaying(false);
|
||||
return false;
|
||||
}
|
||||
this.current = index;
|
||||
let next = index;
|
||||
if (index === INDEX_IN_PLAY_NEXT) {
|
||||
this._playNextList.shift();
|
||||
next = this.current;
|
||||
}
|
||||
this.current = next;
|
||||
this._replaceCurrentTrack(trackID);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -787,6 +820,9 @@ export default class {
|
|||
this._howler?.once('play', () => {
|
||||
this._howler?.fade(0, this.volume, PLAY_PAUSE_FADE_DURATION);
|
||||
|
||||
// 播放时确保开启player.
|
||||
// 避免因"忘记设置"导致在播放时播放器不显示的Bug
|
||||
this._enabled = true;
|
||||
this._setPlaying(true);
|
||||
if (this._currentTrack.name) {
|
||||
setTitle(this._currentTrack);
|
||||
|
|
@ -810,11 +846,14 @@ export default class {
|
|||
this.play();
|
||||
}
|
||||
}
|
||||
seek(time = null) {
|
||||
seek(time = null, sendMpris = true) {
|
||||
if (isCreateMpris && sendMpris && time) {
|
||||
ipcRenderer?.send('seeked', time);
|
||||
}
|
||||
if (time !== null) {
|
||||
this._howler?.seek(time);
|
||||
if (this._playing)
|
||||
this._playDiscordPresence(this._currentTrack, this.seek());
|
||||
this._playDiscordPresence(this._currentTrack, this.seek(null, false));
|
||||
}
|
||||
return this._howler === null ? 0 : this._howler.seek();
|
||||
}
|
||||
|
|
@ -840,7 +879,6 @@ export default class {
|
|||
autoPlayTrackID = 'first'
|
||||
) {
|
||||
this._isPersonalFM = false;
|
||||
if (!this._enabled) this._enabled = true;
|
||||
this.list = trackIDs;
|
||||
this.current = 0;
|
||||
this._playlistSource = {
|
||||
|
|
@ -851,7 +889,7 @@ export default class {
|
|||
if (autoPlayTrackID === 'first') {
|
||||
this._replaceCurrentTrack(this.list[0]);
|
||||
} else {
|
||||
this.current = trackIDs.indexOf(autoPlayTrackID);
|
||||
this.current = this.list.indexOf(autoPlayTrackID);
|
||||
this._replaceCurrentTrack(autoPlayTrackID);
|
||||
}
|
||||
}
|
||||
|
|
@ -902,7 +940,6 @@ export default class {
|
|||
}
|
||||
playPersonalFM() {
|
||||
this._isPersonalFM = true;
|
||||
if (!this._enabled) this._enabled = true;
|
||||
if (this.currentTrackID !== this._personalFMTrack.id) {
|
||||
this._replaceCurrentTrack(this._personalFMTrack.id, true);
|
||||
} else {
|
||||
|
|
|
|||
8
src/utils/checkAuthToken.js
Normal file
8
src/utils/checkAuthToken.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import os from 'os';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
// extract from NeteasyCloudMusicAPI/generateConfig.js and avoid bugs in there (generateConfig require main.js but the main.js has bugs)
|
||||
if (!fs.existsSync(path.resolve(os.tmpdir(), 'anonymous_token'))) {
|
||||
fs.writeFileSync(path.resolve(os.tmpdir(), 'anonymous_token'), '', 'utf-8');
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ export function bytesToSize(bytes) {
|
|||
|
||||
export function formatTrackTime(value) {
|
||||
if (!value) return '';
|
||||
let min = ~~((value / 60) % 60);
|
||||
let min = ~~(value / 60);
|
||||
let sec = (~~(value % 60)).toString().padStart(2, '0');
|
||||
return `${min}:${sec}`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ export function lyricParser(lrc) {
|
|||
return {
|
||||
lyric: parseLyric(lrc?.lrc?.lyric || ''),
|
||||
tlyric: parseLyric(lrc?.tlyric?.lyric || ''),
|
||||
romalyric: parseLyric(lrc?.romalrc?.lyric || ''),
|
||||
lyricuser: lrc.lyricUser,
|
||||
transuser: lrc.transUser,
|
||||
};
|
||||
|
|
@ -83,3 +84,30 @@ function trimContent(content) {
|
|||
let t = content.trim();
|
||||
return t.length < 1 ? content : t;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} lyric
|
||||
*/
|
||||
export async function copyLyric(lyric) {
|
||||
const textToCopy = lyric;
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(textToCopy);
|
||||
} catch (err) {
|
||||
alert('复制失败,请手动复制!');
|
||||
}
|
||||
} else {
|
||||
const tempInput = document.createElement('textarea');
|
||||
tempInput.value = textToCopy;
|
||||
tempInput.style.position = 'absolute';
|
||||
tempInput.style.left = '-9999px';
|
||||
document.body.appendChild(tempInput);
|
||||
tempInput.select();
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
} catch (err) {
|
||||
alert('复制失败,请手动复制!');
|
||||
}
|
||||
document.body.removeChild(tempInput);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@ const service = axios.create({
|
|||
service.interceptors.request.use(function (config) {
|
||||
if (!config.params) config.params = {};
|
||||
if (baseURL.length) {
|
||||
if (baseURL[0] !== '/' && !process.env.IS_ELECTRON) {
|
||||
if (
|
||||
baseURL[0] !== '/' &&
|
||||
!process.env.IS_ELECTRON &&
|
||||
getCookie('MUSIC_U') !== null
|
||||
) {
|
||||
config.params.cookie = `MUSIC_U=${getCookie('MUSIC_U')};`;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -34,8 +38,15 @@ service.interceptors.request.use(function (config) {
|
|||
config.params.realIP = '211.161.244.70';
|
||||
}
|
||||
|
||||
// Force real_ip
|
||||
const enableRealIP = JSON.parse(
|
||||
localStorage.getItem('settings')
|
||||
).enableRealIP;
|
||||
const realIP = JSON.parse(localStorage.getItem('settings')).realIP;
|
||||
if (process.env.VUE_APP_REAL_IP) {
|
||||
config.params.realIP = process.env.VUE_APP_REAL_IP;
|
||||
} else if (enableRealIP) {
|
||||
config.params.realIP = realIP;
|
||||
}
|
||||
|
||||
const proxy = JSON.parse(localStorage.getItem('settings')).proxyConfig;
|
||||
|
|
@ -53,8 +64,16 @@ service.interceptors.response.use(
|
|||
},
|
||||
async error => {
|
||||
/** @type {import('axios').AxiosResponse | null} */
|
||||
const response = error.response;
|
||||
const data = response.data;
|
||||
let response;
|
||||
let data;
|
||||
if (error === 'TypeError: baseURL is undefined') {
|
||||
response = error;
|
||||
data = error;
|
||||
console.error("You must set up the baseURL in the service's config");
|
||||
} else if (error.response) {
|
||||
response = error.response;
|
||||
data = response.data;
|
||||
}
|
||||
|
||||
if (
|
||||
response &&
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@
|
|||
<span v-else>Compilation by Various Artists</span>
|
||||
</div>
|
||||
<div class="date-and-count">
|
||||
<span v-if="album.mark === 1056768" class="explicit-symbol"
|
||||
<span
|
||||
v-if="(album.mark & 1048576) === 1048576"
|
||||
class="explicit-symbol"
|
||||
><ExplicitSymbol
|
||||
/></span>
|
||||
<span :title="album.publishTime | formatDate">{{
|
||||
|
|
@ -96,9 +98,7 @@
|
|||
{{ $t('album.released') }}
|
||||
{{ album.publishTime | formatDate('MMMM D, YYYY') }}
|
||||
</div>
|
||||
<div v-if="album.company !== null" class="copyright">
|
||||
© {{ album.company }}
|
||||
</div>
|
||||
<div v-if="album.company" class="copyright"> © {{ album.company }} </div>
|
||||
</div>
|
||||
<div v-if="filteredMoreAlbums.length !== 0" class="more-by">
|
||||
<div class="section-title">
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ import {
|
|||
followAArtist,
|
||||
similarArtists,
|
||||
} from '@/api/artist';
|
||||
import { getTrackDetail } from '@/api/track';
|
||||
import locale from '@/locale';
|
||||
import { isAccountLoggedIn } from '@/utils/auth';
|
||||
import NProgress from 'nprogress';
|
||||
|
|
@ -241,7 +242,9 @@ export default {
|
|||
computed: {
|
||||
...mapState(['player']),
|
||||
albums() {
|
||||
return this.albumsData.filter(a => a.type === '专辑');
|
||||
return this.albumsData.filter(
|
||||
a => a.type === '专辑' || a.type === '精选集'
|
||||
);
|
||||
},
|
||||
eps() {
|
||||
return this.albumsData.filter(a =>
|
||||
|
|
@ -276,7 +279,7 @@ export default {
|
|||
this.$parent.$refs.main.scrollTo({ top: 0 });
|
||||
getArtist(id).then(data => {
|
||||
this.artist = data.artist;
|
||||
this.popularTracks = data.hotSongs;
|
||||
this.setPopularTracks(data.hotSongs);
|
||||
if (next !== undefined) next();
|
||||
NProgress.done();
|
||||
this.show = true;
|
||||
|
|
@ -289,8 +292,16 @@ export default {
|
|||
this.mvs = data.mvs;
|
||||
this.hasMoreMV = data.hasMore;
|
||||
});
|
||||
similarArtists(id).then(data => {
|
||||
this.similarArtists = data.artists;
|
||||
if (isAccountLoggedIn()) {
|
||||
similarArtists(id).then(data => {
|
||||
this.similarArtists = data.artists;
|
||||
});
|
||||
}
|
||||
},
|
||||
setPopularTracks(hotSongs) {
|
||||
const trackIDs = hotSongs.map(t => t.id);
|
||||
getTrackDetail(trackIDs.join(',')).then(data => {
|
||||
this.popularTracks = data.songs;
|
||||
});
|
||||
},
|
||||
goToAlbum(id) {
|
||||
|
|
|
|||
|
|
@ -120,10 +120,13 @@ export default {
|
|||
setTimeout(() => {
|
||||
if (!this.show) NProgress.start();
|
||||
}, 1000);
|
||||
this.activeCategory =
|
||||
this.$route.query.category === undefined
|
||||
? '全部'
|
||||
: this.$route.query.category;
|
||||
const queryCategory = this.$route.query.category;
|
||||
if (queryCategory === undefined) {
|
||||
this.playlists = [];
|
||||
this.activeCategory = '全部';
|
||||
} else {
|
||||
this.activeCategory = queryCategory;
|
||||
}
|
||||
this.getPlaylist();
|
||||
},
|
||||
goToCategory(Category) {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@
|
|||
|
||||
<script>
|
||||
import { mapActions, mapMutations, mapState } from 'vuex';
|
||||
import { randomNum, dailyTask } from '@/utils/common';
|
||||
import { randomNum } from '@/utils/common';
|
||||
import { isAccountLoggedIn } from '@/utils/auth';
|
||||
import { uploadSong } from '@/api/user';
|
||||
import { getLyric } from '@/api/track';
|
||||
|
|
@ -310,7 +310,6 @@ export default {
|
|||
activated() {
|
||||
this.$parent.$refs.scrollbar.restorePosition();
|
||||
this.loadData();
|
||||
dailyTask();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['showToast']),
|
||||
|
|
|
|||
|
|
@ -7,16 +7,19 @@
|
|||
<div class="title">{{ $t('login.loginText') }}</div>
|
||||
<div class="section-2">
|
||||
<div v-show="mode === 'phone'" class="input-box">
|
||||
<div class="container" :class="{ active: inputFocus === 'phone' }">
|
||||
<div
|
||||
class="container"
|
||||
:class="{ active: ['phone', 'countryCode'].includes(inputFocus) }"
|
||||
>
|
||||
<svg-icon icon-class="mobile" />
|
||||
<div class="inputs">
|
||||
<input
|
||||
id="countryCode"
|
||||
v-model="countryCode"
|
||||
:placeholder="
|
||||
inputFocus === 'phone' ? '' : $t('login.countryCode')
|
||||
inputFocus === 'countryCode' ? '' : $t('login.countryCode')
|
||||
"
|
||||
@focus="inputFocus = 'phone'"
|
||||
@focus="inputFocus = 'countryCode'"
|
||||
@blur="inputFocus = ''"
|
||||
@keyup.enter="login"
|
||||
/>
|
||||
|
|
@ -87,14 +90,14 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="other-login">
|
||||
<a v-show="mode !== 'email'" @click="changeMode('email')">{{
|
||||
<!-- <a v-show="mode !== 'email'" @click="changeMode('email')">{{
|
||||
$t('login.loginWithEmail')
|
||||
}}</a>
|
||||
<span v-show="mode === 'qrCode'">|</span>
|
||||
<a v-show="mode !== 'phone'" @click="changeMode('phone')">{{
|
||||
$t('login.loginWithPhone')
|
||||
}}</a>
|
||||
<span v-show="mode !== 'qrCode'">|</span>
|
||||
<span v-show="mode !== 'qrCode'">|</span> -->
|
||||
<a v-show="mode !== 'qrCode'" @click="changeMode('qrCode')">
|
||||
二维码登录
|
||||
</a>
|
||||
|
|
@ -261,6 +264,8 @@ export default {
|
|||
});
|
||||
},
|
||||
checkQrCodeLogin() {
|
||||
// 清除二维码检测
|
||||
clearInterval(this.qrCodeCheckInterval);
|
||||
this.qrCodeCheckInterval = setInterval(() => {
|
||||
if (this.qrCodeKey === '') return;
|
||||
loginQrCodeCheck(this.qrCodeKey).then(result => {
|
||||
|
|
@ -275,7 +280,7 @@ export default {
|
|||
clearInterval(this.qrCodeCheckInterval);
|
||||
this.qrCodeInformation = '登录成功,请稍等...';
|
||||
result.code = 200;
|
||||
result.cookie = result.cookie.replace('HTTPOnly', '');
|
||||
result.cookie = result.cookie.replaceAll(' HTTPOnly', '');
|
||||
this.handleLoginResponse(result);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -201,6 +201,28 @@
|
|||
>
|
||||
<svg-icon icon-class="shuffle" />
|
||||
</button-icon>
|
||||
<button-icon
|
||||
v-show="
|
||||
isShowLyricTypeSwitch &&
|
||||
$store.state.settings.showLyricsTranslation &&
|
||||
lyricType === 'translation'
|
||||
"
|
||||
:title="$t('player.translationLyric')"
|
||||
@click.native="switchLyricType"
|
||||
>
|
||||
<span class="lyric-switch-icon">译</span>
|
||||
</button-icon>
|
||||
<button-icon
|
||||
v-show="
|
||||
isShowLyricTypeSwitch &&
|
||||
$store.state.settings.showLyricsTranslation &&
|
||||
lyricType === 'romaPronunciation'
|
||||
"
|
||||
:title="$t('player.PronunciationLyric')"
|
||||
@click.native="switchLyricType"
|
||||
>
|
||||
<span class="lyric-switch-icon">音</span>
|
||||
</button-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -215,7 +237,7 @@
|
|||
>
|
||||
<div id="line-1" class="line"></div>
|
||||
<div
|
||||
v-for="(line, index) in lyricWithTranslation"
|
||||
v-for="(line, index) in lyricToShow"
|
||||
:id="`line${index}`"
|
||||
:key="index"
|
||||
class="line"
|
||||
|
|
@ -226,7 +248,11 @@
|
|||
@dblclick="clickLyricLine(line.time, true)"
|
||||
>
|
||||
<div class="content">
|
||||
<span v-if="line.contents[0]">{{ line.contents[0] }}</span>
|
||||
<span
|
||||
v-if="line.contents[0]"
|
||||
@click.right="openLyricMenu($event, line, 0)"
|
||||
>{{ line.contents[0] }}</span
|
||||
>
|
||||
<br />
|
||||
<span
|
||||
v-if="
|
||||
|
|
@ -234,10 +260,26 @@
|
|||
$store.state.settings.showLyricsTranslation
|
||||
"
|
||||
class="translation"
|
||||
@click.right="openLyricMenu($event, line, 1)"
|
||||
>{{ line.contents[1] }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<ContextMenu v-if="!noLyric" ref="lyricMenu">
|
||||
<div class="item" @click="copyLyric(false)">{{
|
||||
$t('contextMenu.copyLyric')
|
||||
}}</div>
|
||||
<div
|
||||
v-if="
|
||||
rightClickLyric &&
|
||||
rightClickLyric.contents[1] &&
|
||||
$store.state.settings.showLyricsTranslation
|
||||
"
|
||||
class="item"
|
||||
@click="copyLyric(true)"
|
||||
>{{ $t('contextMenu.copyLyricWithTranslation') }}</div
|
||||
>
|
||||
</ContextMenu>
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
|
|
@ -246,6 +288,12 @@
|
|||
<svg-icon icon-class="arrow-down" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="close-button" style="left: 24px" @click="fullscreen">
|
||||
<button>
|
||||
<svg-icon v-if="isFullscreen" icon-class="fullscreen-exit" />
|
||||
<svg-icon v-else icon-class="fullscreen" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
|
@ -256,9 +304,10 @@
|
|||
|
||||
import { mapState, mapMutations, mapActions } from 'vuex';
|
||||
import VueSlider from 'vue-slider-component';
|
||||
import ContextMenu from '@/components/ContextMenu.vue';
|
||||
import { formatTrackTime } from '@/utils/common';
|
||||
import { getLyric } from '@/api/track';
|
||||
import { lyricParser } from '@/utils/lyrics';
|
||||
import { lyricParser, copyLyric } from '@/utils/lyrics';
|
||||
import ButtonIcon from '@/components/ButtonIcon.vue';
|
||||
import * as Vibrant from 'node-vibrant/dist/vibrant.worker.min.js';
|
||||
import Color from 'color';
|
||||
|
|
@ -271,16 +320,21 @@ export default {
|
|||
components: {
|
||||
VueSlider,
|
||||
ButtonIcon,
|
||||
ContextMenu,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lyricsInterval: null,
|
||||
lyric: [],
|
||||
tlyric: [],
|
||||
romalyric: [],
|
||||
lyricType: 'translation', // or 'romaPronunciation'
|
||||
highlightLyricIndex: -1,
|
||||
minimize: true,
|
||||
background: '',
|
||||
date: this.formatTime(new Date()),
|
||||
isFullscreen: !!document.fullscreenElement,
|
||||
rightClickLyric: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -302,6 +356,14 @@ export default {
|
|||
bgImageUrl() {
|
||||
return this.player.currentTrack?.al?.picUrl + '?param=512y512';
|
||||
},
|
||||
isShowLyricTypeSwitch() {
|
||||
return this.romalyric.length > 0 && this.tlyric.length > 0;
|
||||
},
|
||||
lyricToShow() {
|
||||
return this.lyricType === 'translation'
|
||||
? this.lyricWithTranslation
|
||||
: this.lyricWithRomaPronunciation;
|
||||
},
|
||||
lyricWithTranslation() {
|
||||
let ret = [];
|
||||
// 空内容的去除
|
||||
|
|
@ -333,6 +395,37 @@ export default {
|
|||
}
|
||||
return ret;
|
||||
},
|
||||
lyricWithRomaPronunciation() {
|
||||
let ret = [];
|
||||
// 空内容的去除
|
||||
const lyricFiltered = this.lyric.filter(({ content }) =>
|
||||
Boolean(content)
|
||||
);
|
||||
// content统一转换数组形式
|
||||
if (lyricFiltered.length) {
|
||||
lyricFiltered.forEach(l => {
|
||||
const { rawTime, time, content } = l;
|
||||
const lyricItem = { time, content, contents: [content] };
|
||||
const sameTimeRomaLyric = this.romalyric.find(
|
||||
({ rawTime: tLyricRawTime }) => tLyricRawTime === rawTime
|
||||
);
|
||||
if (sameTimeRomaLyric) {
|
||||
const { content: romaLyricContent } = sameTimeRomaLyric;
|
||||
if (content) {
|
||||
lyricItem.contents.push(romaLyricContent);
|
||||
}
|
||||
}
|
||||
ret.push(lyricItem);
|
||||
});
|
||||
} else {
|
||||
ret = lyricFiltered.map(({ time, content }) => ({
|
||||
time,
|
||||
content,
|
||||
contents: [content],
|
||||
}));
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
lyricFontSize() {
|
||||
return {
|
||||
fontSize: `${this.$store.state.settings.lyricFontSize || 28}px`,
|
||||
|
|
@ -372,6 +465,15 @@ export default {
|
|||
this.getLyric();
|
||||
this.getCoverColor();
|
||||
this.initDate();
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'F11') {
|
||||
e.preventDefault();
|
||||
this.fullscreen();
|
||||
}
|
||||
});
|
||||
document.addEventListener('fullscreenchange', () => {
|
||||
this.isFullscreen = !!document.fullscreenElement;
|
||||
});
|
||||
},
|
||||
beforeDestroy: function () {
|
||||
if (this.timer) {
|
||||
|
|
@ -403,6 +505,13 @@ export default {
|
|||
second.padStart(2, '0')
|
||||
);
|
||||
},
|
||||
fullscreen() {
|
||||
if (document.fullscreenElement) {
|
||||
document.exitFullscreen();
|
||||
} else {
|
||||
document.documentElement.requestFullscreen();
|
||||
}
|
||||
},
|
||||
addToPlaylist() {
|
||||
if (!isAccountLoggedIn()) {
|
||||
this.showToast(locale.t('toast.needToLogin'));
|
||||
|
|
@ -439,9 +548,10 @@ export default {
|
|||
if (!data?.lrc?.lyric) {
|
||||
this.lyric = [];
|
||||
this.tlyric = [];
|
||||
this.romalyric = [];
|
||||
return false;
|
||||
} else {
|
||||
let { lyric, tlyric } = lyricParser(data);
|
||||
let { lyric, tlyric, romalyric } = lyricParser(data);
|
||||
lyric = lyric.filter(
|
||||
l => !/^作(词|曲)\s*(:|:)\s*无$/.exec(l.content)
|
||||
);
|
||||
|
|
@ -461,15 +571,27 @@ export default {
|
|||
if (lyric.length === 1 && includeAM) {
|
||||
this.lyric = [];
|
||||
this.tlyric = [];
|
||||
this.romalyric = [];
|
||||
return false;
|
||||
} else {
|
||||
this.lyric = lyric;
|
||||
this.tlyric = tlyric;
|
||||
this.romalyric = romalyric;
|
||||
if (tlyric.length * romalyric.length > 0) {
|
||||
this.lyricType = 'translation';
|
||||
} else {
|
||||
this.lyricType =
|
||||
lyric.length > 0 ? 'translation' : 'romaPronunciation';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
switchLyricType() {
|
||||
this.lyricType =
|
||||
this.lyricType === 'translation' ? 'romaPronunciation' : 'translation';
|
||||
},
|
||||
formatTrackTime(value) {
|
||||
return formatTrackTime(value);
|
||||
},
|
||||
|
|
@ -488,9 +610,24 @@ export default {
|
|||
this.player.play();
|
||||
}
|
||||
},
|
||||
openLyricMenu(e, lyric, idx) {
|
||||
this.rightClickLyric = { ...lyric, idx };
|
||||
this.$refs.lyricMenu.openMenu(e);
|
||||
e.preventDefault();
|
||||
},
|
||||
copyLyric(withTranslation) {
|
||||
if (this.rightClickLyric) {
|
||||
const idx = this.rightClickLyric.idx;
|
||||
if (!withTranslation) {
|
||||
copyLyric(this.rightClickLyric.contents[idx]);
|
||||
} else {
|
||||
copyLyric(this.rightClickLyric.contents.join(' '));
|
||||
}
|
||||
}
|
||||
},
|
||||
setLyricsInterval() {
|
||||
this.lyricsInterval = setInterval(() => {
|
||||
const progress = this.player.seek() ?? 0;
|
||||
const progress = this.player.seek(null, false) ?? 0;
|
||||
let oldHighlightLyricIndex = this.highlightLyricIndex;
|
||||
this.highlightLyricIndex = this.lyric.findIndex((l, index) => {
|
||||
const nextLyric = this.lyric[index + 1];
|
||||
|
|
@ -758,6 +895,12 @@ export default {
|
|||
width: 22px;
|
||||
}
|
||||
}
|
||||
.lyric-switch-icon {
|
||||
color: var(--color-text);
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
opacity: 0.88;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -821,6 +964,7 @@ export default {
|
|||
transform-origin: center left;
|
||||
transform: scale(0.95);
|
||||
transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||
user-select: none;
|
||||
|
||||
span {
|
||||
opacity: 0.28;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@ export default {
|
|||
this.player.current + 1,
|
||||
this.player.current + 100
|
||||
);
|
||||
return this.tracks.filter(t => trackIDs.includes(t.id));
|
||||
return trackIDs
|
||||
.map(tid => this.tracks.find(t => t.id === tid))
|
||||
.filter(t => t);
|
||||
},
|
||||
playNextList() {
|
||||
return this.player.playNextList;
|
||||
|
|
|
|||
|
|
@ -58,20 +58,32 @@
|
|||
</div>
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title"> 音乐语种偏好 </div>
|
||||
<div class="title">
|
||||
{{ $t('settings.MusicGenrePreference.text') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<select v-model="musicLanguage">
|
||||
<option value="all">无偏好</option>
|
||||
<option value="zh">华语</option>
|
||||
<option value="ea">欧美</option>
|
||||
<option value="jp">日语</option>
|
||||
<option value="kr">韩语</option>
|
||||
<option value="all">{{
|
||||
$t('settings.MusicGenrePreference.none')
|
||||
}}</option>
|
||||
<option value="zh">{{
|
||||
$t('settings.MusicGenrePreference.mandarin')
|
||||
}}</option>
|
||||
<option value="ea">{{
|
||||
$t('settings.MusicGenrePreference.western')
|
||||
}}</option>
|
||||
<option value="jp">{{
|
||||
$t('settings.MusicGenrePreference.japanese')
|
||||
}}</option>
|
||||
<option value="kr">{{
|
||||
$t('settings.MusicGenrePreference.korean')
|
||||
}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>音质</h3>
|
||||
<!-- <h3>音质</h3> -->
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title"> {{ $t('settings.musicQuality.text') }} </div>
|
||||
|
|
@ -166,7 +178,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<h3>歌词</h3>
|
||||
<h3>{{ $t('settings.lyric') }}</h3>
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title">{{ $t('settings.showLyricsTranslation') }}</div>
|
||||
|
|
@ -239,6 +251,33 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isElectron && isLinux" class="item">
|
||||
<div class="left">
|
||||
<div class="title">
|
||||
{{ $t('settings.unm.enable') }}
|
||||
<a target="_blank" href="https://github.com/osdlyrics/osdlyrics"
|
||||
>OSDLyrics</a
|
||||
>
|
||||
{{ $t('settings.enableOsdlyricsSupport.title') }}
|
||||
</div>
|
||||
<div class="description">
|
||||
{{ $t('settings.enableOsdlyricsSupport.desc1') }}
|
||||
<br />
|
||||
{{ $t('settings.enableOsdlyricsSupport.desc2') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="toggle">
|
||||
<input
|
||||
id="enable-osdlyrics-support"
|
||||
v-model="enableOsdlyricsSupport"
|
||||
type="checkbox"
|
||||
name="enable-osdlyrics-support"
|
||||
/>
|
||||
<label for="enable-osdlyrics-support"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section v-if="isElectron" class="unm-configuration">
|
||||
<h3>UnblockNeteaseMusic</h3>
|
||||
|
|
@ -408,7 +447,7 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<h3>第三方</h3>
|
||||
<h3>{{ $t('settings.customization') }}</h3>
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title">
|
||||
|
|
@ -445,7 +484,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<h3>其他</h3>
|
||||
<h3>{{ $t('settings.others') }}</h3>
|
||||
<div v-if="isElectron && !isMac" class="item">
|
||||
<div class="left">
|
||||
<div class="title"> {{ $t('settings.closeAppOption.text') }} </div>
|
||||
|
|
@ -602,6 +641,33 @@
|
|||
<button @click="sendProxyConfig">更新代理</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isElectron">
|
||||
<h3>Real IP</h3>
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title"> Real IP </div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="toggle">
|
||||
<input
|
||||
id="enable-real-ip"
|
||||
v-model="enableRealIP"
|
||||
type="checkbox"
|
||||
name="enable-real-ip"
|
||||
/>
|
||||
<label for="enable-real-ip"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="real-ip" :class="{ disabled: !enableRealIP }">
|
||||
<input
|
||||
v-model="realIP"
|
||||
class="text-input"
|
||||
placeholder="IP地址"
|
||||
:disabled="!enableRealIP"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isElectron">
|
||||
<h3>快捷键</h3>
|
||||
|
|
@ -963,6 +1029,17 @@ export default {
|
|||
});
|
||||
},
|
||||
},
|
||||
enableOsdlyricsSupport: {
|
||||
get() {
|
||||
return this.settings.enableOsdlyricsSupport;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('updateSettings', {
|
||||
key: 'enableOsdlyricsSupport',
|
||||
value,
|
||||
});
|
||||
},
|
||||
},
|
||||
closeAppOption: {
|
||||
get() {
|
||||
return this.settings.closeAppOption;
|
||||
|
|
@ -1074,6 +1151,28 @@ export default {
|
|||
});
|
||||
},
|
||||
},
|
||||
enableRealIP: {
|
||||
get() {
|
||||
return this.settings.enableRealIP || false;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('updateSettings', {
|
||||
key: 'enableRealIP',
|
||||
value: value,
|
||||
});
|
||||
},
|
||||
},
|
||||
realIP: {
|
||||
get() {
|
||||
return this.settings.realIP || '';
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('updateSettings', {
|
||||
key: 'realIP',
|
||||
value: value,
|
||||
});
|
||||
},
|
||||
},
|
||||
proxyPort: {
|
||||
get() {
|
||||
return this.settings.proxyConfig?.port || '';
|
||||
|
|
@ -1465,6 +1564,7 @@ h3 {
|
|||
|
||||
select {
|
||||
min-width: 192px;
|
||||
max-width: 600px;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
padding: 8px 12px 8px 12px;
|
||||
|
|
@ -1515,11 +1615,13 @@ input[type='number'] {
|
|||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
#proxy-form {
|
||||
#proxy-form,
|
||||
#real-ip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
#proxy-form.disabled {
|
||||
#proxy-form.disabled,
|
||||
#real-ip.disabled {
|
||||
opacity: 0.47;
|
||||
button:hover {
|
||||
transform: unset;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,16 @@ module.exports = {
|
|||
.loader('node-loader')
|
||||
.end();
|
||||
|
||||
config.module
|
||||
.rule('webpack4_es_fallback')
|
||||
.test(/\.js$/)
|
||||
.include.add(/node_modules/)
|
||||
.end()
|
||||
.use('esbuild-loader')
|
||||
.loader('esbuild-loader')
|
||||
.options({ target: 'es2015', format: "cjs" })
|
||||
.end();
|
||||
|
||||
// LimitChunkCountPlugin 可以通过合并块来对块进行后期处理。用以解决 chunk 包太多的问题
|
||||
config.plugin('chunkPlugin').use(webpack.optimize.LimitChunkCountPlugin, [
|
||||
{
|
||||
|
|
@ -169,6 +179,16 @@ module.exports = {
|
|||
'jsbi',
|
||||
path.join(__dirname, 'node_modules/jsbi/dist/jsbi-cjs.js')
|
||||
);
|
||||
|
||||
config.module
|
||||
.rule('webpack4_es_fallback')
|
||||
.test(/\.js$/)
|
||||
.include.add(/node_modules/)
|
||||
.end()
|
||||
.use('esbuild-loader')
|
||||
.loader('esbuild-loader')
|
||||
.options({ target: 'es2015', format: "cjs" })
|
||||
.end();
|
||||
},
|
||||
// 渲染线程的配置文件
|
||||
chainWebpackRendererProcess: config => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue