refactor(ncmapi): use upstream version (#1278)

* refactor(ncmapi): use upstream version

FIXME: After #1457 released,
switch to the NPM version.

* fix(docker): install NeteaseCloudMusicApi early

* fix: remove useless submodule entry

* fix(ncmapi): update to 4.5.2
master
pan93412 3 years ago committed by GitHub
parent c8b9c0dae8
commit 5a5fb1f191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

3
.gitmodules vendored

@ -1,3 +0,0 @@
[submodule "netease_api"]
path = netease_api
url = https://github.com/Binaryify/NeteaseCloudMusicApi

@ -1,5 +1,3 @@
build
coverage
dist
netease_api

@ -1,22 +1,13 @@
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++
RUN apk add --no-cache python3 make g++ git
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build
FROM nginx:1.20.2-alpine as app
RUN 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 yarn
COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/netease_api /usr/src/netease_api
WORKDIR /usr/src/netease_api
RUN yarn install
RUN echo $'server { \n\
gzip on;\n\
listen 80; \n\
@ -24,23 +15,29 @@ RUN echo $'server { \n\
server_name localhost; \n\
\n\
location / { \n\
root /usr/share/nginx/html; \n\
index index.html; \n\
try_files $uri $uri/ /index.html; \n\
root /usr/share/nginx/html; \n\
index index.html; \n\
try_files $uri $uri/ /index.html; \n\
} \n\
\n\
location @rewrites { \n\
rewrite ^(.*)$ /index.html last; \n\
rewrite ^(.*)$ /index.html last; \n\
} \n\
\n\
location /api/ { \n\
proxy_set_header Host $host; \n\
proxy_set_header X-Real-IP $remote_addr; \n\
proxy_set_header X-Forwarded-For $remote_addr; \n\
proxy_set_header X-Forwarded-Host $remote_addr; \n\
proxy_set_header X-NginX-Proxy true; \n\
proxy_pass http://localhost:3000/; \n\
proxy_set_header Host $host; \n\
proxy_set_header X-Real-IP $remote_addr; \n\
proxy_set_header X-Forwarded-For $remote_addr; \n\
proxy_set_header X-Forwarded-Host $remote_addr; \n\
proxy_set_header X-NginX-Proxy true; \n\
proxy_pass http://localhost:3000/; \n\
} \n\
}' > /etc/nginx/conf.d/default.conf
}' > /etc/nginx/conf.d/default.conf
RUN 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 NeteaseCloudMusicApi
COPY --from=build /app/dist /usr/share/nginx/html
CMD nginx ; exec node app.js
CMD nginx ; exec npx NeteaseCloudMusicApi

@ -159,7 +159,7 @@ YesPlayMusic 地址为 `http://localhost`
## :computer: 配置开发环境
本项目由 [NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 提供 API,已经包含在本项目的`netease_api`目录
本项目由 [NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 提供 API。
运行本项目
@ -180,9 +180,6 @@ yarn electron:serve
本地运行 NeteaseCloudMusicApi或者将 API [部署至 Vercel](#%EF%B8%8F-部署至-vercel)
```shell
# 安装依赖
yarn netease_api:install
# 运行 API (默认 3000 端口)
yarn netease_api:run
```

@ -1 +0,0 @@
Subproject commit 69a71cb71093b9013201df4bda51452b72a79564

@ -19,16 +19,12 @@
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"prettier": "npx prettier --write ./src",
"netease_api:run": "cd ./netease_api && npm run start",
"netease_api:init": "git submodule init && git submodule update",
"netease_api:pull": "cd ./netease_api && git pull",
"netease_api:install": "yarn",
"netease_api:setup": "yarn netease_api:init && yarn netease_api:pull && yarn netease_api:install"
"netease_api:run": "npx NeteaseCloudMusicApi"
},
"main": "background.js",
"dependencies": {
"@unblockneteasemusic/server": "v0.27.0-rc.4",
"NeteaseCloudMusicApi": "file:./netease_api/",
"NeteaseCloudMusicApi": "^4.5.2",
"axios": "^0.21.0",
"change-case": "^4.1.2",
"cli-color": "^2.0.0",

@ -164,7 +164,6 @@ module.exports = {
},
// 主入口文件
// mainProcessFile: 'src/main.js',
// mainProcessWatch: ['../netease_api/routes.js'],
// mainProcessArgs: []
},
},

@ -2136,8 +2136,10 @@
resolved "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz"
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==
"NeteaseCloudMusicApi@file:./netease_api":
version "4.3.0"
NeteaseCloudMusicApi@^4.5.2:
version "4.5.2"
resolved "https://registry.yarnpkg.com/NeteaseCloudMusicApi/-/NeteaseCloudMusicApi-4.5.2.tgz#979ebab4350550fea865e469997be6893e6ec4bb"
integrity sha512-o945M2KQBHTqSvLoGvrJYTKHQTB4YJHUyhsupO+xJI3AebJhdx22fFh5rFcZPn/N3K6wDGxdRd4uNwyzYtuVbA==
dependencies:
axios "^0.24.0"
express "^4.17.1"

Loading…
Cancel
Save