diff --git a/electron/main/index.js b/electron/main/index.js index 6d91410..eef60df 100644 --- a/electron/main/index.js +++ b/electron/main/index.js @@ -155,15 +155,6 @@ class MainProcess { else { this.mainWindow.loadURL(`http://127.0.0.1:${import.meta.env.MAIN_VITE_MAIN_PORT ?? 7899}`); } - - // 监听关闭 - this.mainWindow.on("close", (event) => { - if (!app.isQuiting) { - event.preventDefault(); - this.mainWindow.hide(); - } - return false; - }); } // 主应用程序事件 @@ -241,6 +232,19 @@ class MainProcess { this.mainWindow.on("moved", () => { this.store.set("windowSize", this.mainWindow.getBounds()); }); + + // 窗口关闭 + this.mainWindow.on("close", (event) => { + if (platform.isLinux) { + app.quit(); + } else { + if (!app.isQuiting) { + event.preventDefault(); + this.mainWindow.hide(); + } + return false; + } + }); } } diff --git a/package.json b/package.json index 25f8e8d..b8acccc 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@electron-toolkit/preload": "^2.0.0", "@electron-toolkit/utils": "^2.0.0", "@material/material-color-utilities": "^0.2.7", - "NeteaseCloudMusicApi": "^4.13.6", + "NeteaseCloudMusicApi": "git+git@github.com:imsyy/NeteaseCloudMusicApi.git", "axios": "^1.4.0", "colorthief": "^2.4.0", "electron-dl": "^3.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3524758..c30a905 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ dependencies: specifier: ^0.2.7 version: 0.2.7 NeteaseCloudMusicApi: - specifier: ^4.13.6 - version: 4.13.6 + specifier: git+git@github.com:imsyy/NeteaseCloudMusicApi.git + version: git@github.com+imsyy/NeteaseCloudMusicApi/fa5c733895bfe6cbf55380c2d7072f367bf6a09b axios: specifier: ^1.4.0 version: 1.4.0 @@ -238,7 +238,7 @@ packages: resolution: {integrity: sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.22.11 + '@babel/types': 7.23.6 dev: true /@babel/helper-builder-binary-assignment-operator-visitor@7.22.15: @@ -401,7 +401,7 @@ packages: resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.22.11 + '@babel/types': 7.23.6 dev: true /@babel/helper-plugin-utils@7.22.5: @@ -444,7 +444,7 @@ packages: resolution: {integrity: sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.22.11 + '@babel/types': 7.23.6 dev: true /@babel/helper-split-export-declaration@7.22.6: @@ -486,7 +486,7 @@ packages: resolution: {integrity: sha512-pms/UwkOpnQe/PDAEdV/d7dVCoBbB+R4FvYoHGZz+4VPcg7RtYy2KP7S2lbuWM6FCSgob5wshfGESbC/hzNXZw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/helper-function-name': 7.22.5 + '@babel/helper-function-name': 7.23.0 '@babel/template': 7.22.15 '@babel/types': 7.23.6 dev: true @@ -1387,7 +1387,7 @@ packages: dependencies: '@babel/core': 7.22.11 '@babel/helper-plugin-utils': 7.22.5 - '@babel/types': 7.22.11 + '@babel/types': 7.23.6 esutils: 2.0.3 dev: true @@ -1942,7 +1942,7 @@ packages: optional: true dependencies: '@babel/core': 7.22.11 - '@babel/helper-module-imports': 7.22.5 + '@babel/helper-module-imports': 7.22.15 '@rollup/pluginutils': 3.1.0(rollup@2.79.1) rollup: 2.79.1 dev: true @@ -2240,27 +2240,6 @@ packages: requiresBuild: true dev: true - /NeteaseCloudMusicApi@4.13.6: - resolution: {integrity: sha512-dK6vReOVYBhOuUSocex1M3FNfRnJJvGmTfCavqXkSFguS+PyyeP7D6JDmF0NVqMskwE7r1uT2yqrozDnBA/Syw==} - engines: {node: '>=12'} - hasBin: true - dependencies: - axios: 1.4.0 - express: 4.18.2 - express-fileupload: 1.4.0 - md5: 2.3.0 - music-metadata: 7.13.4 - pac-proxy-agent: 7.0.1 - qrcode: 1.5.3 - safe-decode-uri-component: 1.2.1 - tunnel: 0.0.6 - xml2js: 0.6.2 - yargs: 17.7.2 - transitivePeerDependencies: - - debug - - supports-color - dev: false - /accepts@1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} @@ -2421,7 +2400,7 @@ packages: dependencies: array-buffer-byte-length: 1.0.0 call-bind: 1.0.5 - define-properties: 1.2.0 + define-properties: 1.2.1 es-abstract: 1.22.3 get-intrinsic: 1.2.2 is-array-buffer: 3.0.2 @@ -3012,6 +2991,10 @@ packages: resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} dev: false + /crypto-js@4.2.0: + resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==} + dev: false + /crypto-random-string@2.0.0: resolution: {integrity: sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==} engines: {node: '>=8'} @@ -3165,7 +3148,7 @@ packages: resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.2.1 + get-intrinsic: 1.2.2 gopd: 1.0.1 has-property-descriptors: 1.0.0 dev: true @@ -4106,7 +4089,7 @@ packages: engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.5 - define-properties: 1.2.0 + define-properties: 1.2.1 es-abstract: 1.22.3 functions-have-names: 1.2.3 dev: true @@ -5267,6 +5250,11 @@ packages: engines: {node: '>=v0.6.5'} dev: false + /node-forge@1.3.1: + resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==} + engines: {node: '>= 6.13.0'} + dev: false + /node-id3@0.2.6: resolution: {integrity: sha512-w8GuKXLlPpDjTxLowCt/uYMhRQzED3cg2GdSG1i6RSGKeDzPvxlXeLQuQInKljahPZ0aDnmyX7FX8BbJOM7REg==} dependencies: @@ -5812,8 +5800,8 @@ packages: resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 + call-bind: 1.0.5 + define-properties: 1.2.1 set-function-name: 2.0.1 dev: true @@ -5933,7 +5921,7 @@ packages: peerDependencies: rollup: ^2.0.0 dependencies: - '@babel/code-frame': 7.22.10 + '@babel/code-frame': 7.23.5 jest-worker: 26.6.2 rollup: 2.79.1 serialize-javascript: 4.0.0 @@ -6272,10 +6260,10 @@ packages: /string.prototype.matchall@4.0.10: resolution: {integrity: sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 + call-bind: 1.0.5 + define-properties: 1.2.1 es-abstract: 1.22.3 - get-intrinsic: 1.2.1 + get-intrinsic: 1.2.2 has-symbols: 1.0.3 internal-slot: 1.0.6 regexp.prototype.flags: 1.5.1 @@ -6288,7 +6276,7 @@ packages: engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.5 - define-properties: 1.2.0 + define-properties: 1.2.1 es-abstract: 1.22.3 dev: true @@ -6296,7 +6284,7 @@ packages: resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} dependencies: call-bind: 1.0.5 - define-properties: 1.2.0 + define-properties: 1.2.1 es-abstract: 1.22.3 dev: true @@ -6304,7 +6292,7 @@ packages: resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} dependencies: call-bind: 1.0.5 - define-properties: 1.2.0 + define-properties: 1.2.1 es-abstract: 1.22.3 dev: true @@ -7317,3 +7305,30 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} dev: true + + git@github.com+imsyy/NeteaseCloudMusicApi/fa5c733895bfe6cbf55380c2d7072f367bf6a09b: + resolution: {commit: fa5c733895bfe6cbf55380c2d7072f367bf6a09b, repo: git@github.com:imsyy/NeteaseCloudMusicApi.git, type: git} + name: NeteaseCloudMusicApi + version: 4.13.8 + engines: {node: '>=12'} + hasBin: true + prepare: true + requiresBuild: true + dependencies: + axios: 1.4.0 + crypto-js: 4.2.0 + express: 4.18.2 + express-fileupload: 1.4.0 + md5: 2.3.0 + music-metadata: 7.13.4 + node-forge: 1.3.1 + pac-proxy-agent: 7.0.1 + qrcode: 1.5.3 + safe-decode-uri-component: 1.2.1 + tunnel: 0.0.6 + xml2js: 0.6.2 + yargs: 17.7.2 + transitivePeerDependencies: + - debug + - supports-color + dev: false diff --git a/src/api/artist.js b/src/api/artist.js index 5c57eef..6203ef6 100644 --- a/src/api/artist.js +++ b/src/api/artist.js @@ -34,7 +34,6 @@ export const getArtistDetail = (id) => { return axios({ method: "GET", url: "/artist/detail", - noCookie: true, params: { id, }, diff --git a/src/assets/icon.json b/src/assets/icon.json index 775503a..96ae3da 100644 --- a/src/assets/icon.json +++ b/src/assets/icon.json @@ -85,5 +85,6 @@ "github": "M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33c.85 0 1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2Z", "phone": "M16 1H8C6.34 1 5 2.34 5 4v16c0 1.66 1.34 3 3 3h8c1.66 0 3-1.34 3-3V4c0-1.66-1.34-3-3-3zm1 17H7V4h10v14zm-3 3h-4v-1h4v1z", "password": "M2 17h20v2H2v-2zm1.15-4.05L4 11.47l.85 1.48l1.3-.75l-.85-1.48H7v-1.5H5.3l.85-1.47L4.85 7L4 8.47L3.15 7l-1.3.75l.85 1.47H1v1.5h1.7l-.85 1.48l1.3.75zm6.7-.75l1.3.75l.85-1.48l.85 1.48l1.3-.75l-.85-1.48H15v-1.5h-1.7l.85-1.47l-1.3-.75L12 8.47L11.15 7l-1.3.75l.85 1.47H9v1.5h1.7l-.85 1.48zM23 9.22h-1.7l.85-1.47l-1.3-.75L20 8.47L19.15 7l-1.3.75l.85 1.47H17v1.5h1.7l-.85 1.48l1.3.75l.85-1.48l.85 1.48l1.3-.75l-.85-1.48H23v-1.5z", - "star": "m12 17.27l4.15 2.51c.76.46 1.69-.22 1.49-1.08l-1.1-4.72l3.67-3.18c.67-.58.31-1.68-.57-1.75l-4.83-.41l-1.89-4.46c-.34-.81-1.5-.81-1.84 0L9.19 8.63l-4.83.41c-.88.07-1.24 1.17-.57 1.75l3.67 3.18l-1.1 4.72c-.2.86.73 1.54 1.49 1.08l4.15-2.5z" + "star": "m12 17.27l4.15 2.51c.76.46 1.69-.22 1.49-1.08l-1.1-4.72l3.67-3.18c.67-.58.31-1.68-.57-1.75l-4.83-.41l-1.89-4.46c-.34-.81-1.5-.81-1.84 0L9.19 8.63l-4.83.41c-.88.07-1.24 1.17-.57 1.75l3.67 3.18l-1.1 4.72c-.2.86.73 1.54 1.49 1.08l4.15-2.5z", + "record": "M17 18.25v3.25H7v-3.25c0-1.38 2.24-2.5 5-2.5s5 1.12 5 2.5M12 5.5a6.5 6.5 0 0 1 6.5 6.5c0 1.25-.35 2.42-.96 3.41L16 14.04c.32-.61.5-1.31.5-2.04c0-2.5-2-4.5-4.5-4.5s-4.5 2-4.5 4.5c0 .73.18 1.43.5 2.04l-1.54 1.37c-.61-.99-.96-2.16-.96-3.41A6.5 6.5 0 0 1 12 5.5m0-4A10.5 10.5 0 0 1 22.5 12c0 2.28-.73 4.39-1.96 6.11l-1.5-1.35c.92-1.36 1.46-3 1.46-4.76A8.5 8.5 0 0 0 12 3.5A8.5 8.5 0 0 0 3.5 12c0 1.76.54 3.4 1.46 4.76l-1.5 1.35A10.473 10.473 0 0 1 1.5 12A10.5 10.5 0 0 1 12 1.5m0 8a2.5 2.5 0 0 1 2.5 2.5a2.5 2.5 0 0 1-2.5 2.5A2.5 2.5 0 0 1 9.5 12A2.5 2.5 0 0 1 12 9.5Z" } diff --git a/src/components/Global/Menu.vue b/src/components/Global/Menu.vue index af966de..a719cef 100644 --- a/src/components/Global/Menu.vue +++ b/src/components/Global/Menu.vue @@ -12,6 +12,7 @@ :collapsed-icon-size="22" :options="menuOptions" @contextmenu="openSideDropdown($event)" + @update:value="checkMenuItem" /> @@ -36,10 +37,17 @@ const router = useRouter(); const data = siteData(); const music = musicData(); const status = siteStatus(); -const { asideMenuCollapsed, showSider } = storeToRefs(status); +const { asideMenuCollapsed, showSider, showFullPlayer } = storeToRefs(status); const { userData, userLikeData, userLoginStatus } = storeToRefs(data); -const { playList, playListOld, playIndex, playSongData, playHeartbeatMode, playMode } = - storeToRefs(music); +const { + playList, + playListOld, + playIndex, + playSongData, + playHeartbeatMode, + playMode, + privateFmSong, +} = storeToRefs(music); // 子组件 const coverDropdownRef = ref(null); @@ -121,6 +129,25 @@ const menuOptions = computed(() => [ key: "discover", icon: renderIcon("discover-fill"), }, + { + label: "私人漫游", + key: "fm", + icon: renderIcon("radio"), + }, + { + label: () => + h( + RouterLink, + { + to: { + name: "record", + }, + }, + () => ["播客电台"], + ), + key: "record", + icon: renderIcon("record"), + }, { label: () => h( @@ -314,10 +341,24 @@ const changeUserPlaylists = (data) => { }; // 选中菜单项 -const checkMenuItem = (key) => { - console.log(key); +const checkMenuItem = async (key) => { // 例外路由 const otherRouter = ["search", "videos-player", "playlist", "like-songs"]; + // 私人漫游 + if (key === "fm") { + if (!privateFmSong.value || !Object.keys(privateFmSong.value)?.length) { + return $message.error("开启私人漫游出错,请重试"); + } + if (playMode.value === "fm") { + fadePlayOrPause(); + } else { + // 更改播放模式 + playMode.value = "fm"; + await initPlayer(true); + } + showFullPlayer.value = true; + $message.info("已开启私人漫游", { icon: renderIcon("radio") }); + } // 特殊处理 if (!key) { menuActiveKey.value = "home"; diff --git a/src/router/routes.js b/src/router/routes.js index bc7d93e..477e2f5 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -286,6 +286,23 @@ const routes = [ }, ], }, + // 播客 + { + path: "/record", + name: "record", + meta: { + title: "播客", + }, + component: () => import("@/views/Record/index.vue"), + redirect: "/record/hot", + children: [ + { + path: "hot", + name: "record-hot", + component: () => import("@/views/Record/hot.vue"), + }, + ], + }, // 全局设置 { path: "/setting", diff --git a/src/views/Record/hot.vue b/src/views/Record/hot.vue new file mode 100644 index 0000000..2559d78 --- /dev/null +++ b/src/views/Record/hot.vue @@ -0,0 +1,4 @@ + + diff --git a/src/views/Record/index.vue b/src/views/Record/index.vue new file mode 100644 index 0000000..7d9f4bc --- /dev/null +++ b/src/views/Record/index.vue @@ -0,0 +1,4 @@ + + diff --git a/src/views/Setting/index.vue b/src/views/Setting/index.vue index 3fbfed7..e320681 100644 --- a/src/views/Setting/index.vue +++ b/src/views/Setting/index.vue @@ -402,7 +402,7 @@ - 开启后可能会造成卡顿等性能问题 + 可能会造成卡顿等性能问题,请确保显卡为 GTX 2060 及以上