diff --git a/.env.example b/.env.example index 9eeada5..7c0058a 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dacb51f..8a103f3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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) @@ -82,7 +82,7 @@ jobs: uses: samuelmeuli/action-electron-builder@v1.6.0 env: 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: diff --git a/Dockerfile b/Dockerfile index ac22342..19d3817 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,41 +8,15 @@ COPY . . RUN yarn build FROM nginx:1.20.2-alpine as app -RUN echo $'server { \n\ - gzip on;\n\ - listen 80; \n\ - listen [::]:80; \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\ - } \n\ - \n\ - location @rewrites { \n\ - rewrite ^(.*)$ /index.html last; \n\ - } \n\ - \n\ - location /api/ { \n\ - proxy_buffer_size 128k; \n\ - proxy_buffers 16 32k; \n\ - proxy_busy_buffers_size 128k; \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 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 jq \ +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@"$(jq -r '.dependencies.NeteaseCloudMusicApi' /usr/local/lib/package.json)" + && npm i -g $(awk -F \" '{if($2=="NeteaseCloudMusicApi") print $2"@"$4}' /usr/local/lib/package.json) \ + && rm -f /usr/local/lib/package.json +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 diff --git a/LICENSE b/LICENSE index d95eafc..7385fd2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2022 qier222 +Copyright (c) 2020-2023 qier222 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 34efc41..6764526 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,11 @@ [![Library][library-screenshot]](https://music.qier222.com) + +## 全新版本 +全新2.0 Alpha测试版已发布,欢迎前往 [Releases](https://github.com/qier222/YesPlayMusic/releases) 页面下载。 +当前版本将会进入维护模式,除重大bug修复外,不会再更新新功能。 + ## ✨ 特性 - ✅ 使用 Vue.js 全家桶开发 diff --git a/docker-compose.yml b/docker-compose.yml index efc2826..221b66d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,9 @@ services: context: . image: yesplaymusic container_name: YesPlayMusic + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro ports: - 80:80 restart: always diff --git a/docker/nginx.conf.example b/docker/nginx.conf.example new file mode 100644 index 0000000..cdab218 --- /dev/null +++ b/docker/nginx.conf.example @@ -0,0 +1,28 @@ +server { + gzip on; + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html; + } + + location @rewrites { + rewrite ^(.*)$ /index.html last; + } + + location /api/ { + proxy_buffers 16 32k; + proxy_buffer_size 128k; + proxy_busy_buffers_size 128k; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Host $remote_addr; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://localhost:3000/; + } +} diff --git a/package.json b/package.json index 37ce354..5324233 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yesplaymusic", - "version": "0.4.5", + "version": "0.4.7", "private": true, "description": "A third party music player for Netease Music", "author": "qier222", @@ -22,9 +22,12 @@ "netease_api:run": "npx NeteaseCloudMusicApi" }, "main": "background.js", + "engines": { + "node": "14 || 16" + }, "dependencies": { - "@unblockneteasemusic/rust-napi": "^0.3.0-pre.1", - "NeteaseCloudMusicApi": "^4.5.2", + "@unblockneteasemusic/rust-napi": "^0.4.0", + "NeteaseCloudMusicApi": "^4.8.7", "axios": "^0.26.1", "change-case": "^4.1.2", "cli-color": "^2.0.0", @@ -59,7 +62,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", @@ -83,6 +85,7 @@ "@vue/cli-service": "~4.5.0", "babel-eslint": "^10.1.0", "eslint": "^6.7.2", + "prettier": "2.5.1", "eslint-config-prettier": "^8.1.0", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-vue": "^7.9.0", diff --git a/src/background.js b/src/background.js index 9d0b42a..3404ef8 100644 --- a/src/background.js +++ b/src/background.js @@ -67,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 => { @@ -154,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') @@ -167,7 +167,7 @@ class Background { }); }); }); - this.expressApp = expressApp.listen(41342, '127.0.0.1'); + this.expressApp = expressApp.listen(27232, '127.0.0.1'); } createWindow() { @@ -258,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' ); } } diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index 34d1df7..dce629b 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -194,7 +194,7 @@ nav { @media (max-width: 1336px) { nav { - padding: 0 5vw; + padding: 0 max(5vw, 90px); } } diff --git a/src/components/Player.vue b/src/components/Player.vue index 0bb0194..0b98ab6 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -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(); diff --git a/src/components/TrackList.vue b/src/components/TrackList.vue index 6743f3f..ebb5046 100644 --- a/src/components/TrackList.vue +++ b/src/components/TrackList.vue @@ -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)" diff --git a/src/components/TrackListItem.vue b/src/components/TrackListItem.vue index 907e884..3eef677 100644 --- a/src/components/TrackListItem.vue +++ b/src/components/TrackListItem.vue @@ -21,7 +21,7 @@ style="height: 14px; width: 14px" > - {{ track.no }} + {{ trackNo }}