diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index d4a33fc..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "netease_api"] - path = netease_api - url = https://github.com/Binaryify/NeteaseCloudMusicApi diff --git a/.prettierignore b/.prettierignore index 15709e8..13859d2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,3 @@ build coverage dist -netease_api - diff --git a/Dockerfile b/Dockerfile index 1bdc0fe..21db7b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 -CMD nginx ; exec node app.js +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 npx NeteaseCloudMusicApi diff --git a/README.md b/README.md index 07c697e..d62679b 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/netease_api b/netease_api deleted file mode 160000 index 69a71cb..0000000 --- a/netease_api +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 69a71cb71093b9013201df4bda51452b72a79564 diff --git a/package.json b/package.json index 1e108d5..5e751d3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/vue.config.js b/vue.config.js index 64a385c..d3c775a 100644 --- a/vue.config.js +++ b/vue.config.js @@ -164,7 +164,6 @@ module.exports = { }, // 主入口文件 // mainProcessFile: 'src/main.js', - // mainProcessWatch: ['../netease_api/routes.js'], // mainProcessArgs: [] }, }, diff --git a/yarn.lock b/yarn.lock index c9ce799..3c38899 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"