From 2165ea262c25ebe86a5eaaa3875cc4155a41a3d1 Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Sun, 16 Jun 2024 20:38:28 +0800 Subject: [PATCH] fix: the netease music player issue. --- package-lock.json | 44 +++++++++++++++---------------- src/components/player/resolver.ts | 11 ++++---- tools/go.mod | 4 +-- tools/go.sum | 5 ++++ 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/package-lock.json b/package-lock.json index 799fb48..c843cfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2602,9 +2602,9 @@ ] }, "node_modules/@shikijs/core": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.6.4.tgz", - "integrity": "sha512-WTU9rzZae1p2v6LOxMf6LhtmZOkIHYYW160IuahUyJy7YXPPjyWZLR1ag+SgD22ZMxZtz1gfU6Tccc8t0Il/XA==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.6.5.tgz", + "integrity": "sha512-XcQYt6e4L61ruAxHiL3Xg1DL/XkWWjzDdeckB/DtN8jAxoAU+bcxsV6DetC8NafHpL4YpGhxy9iXF0ND/u6HmA==", "license": "MIT" }, "node_modules/@types/acorn": { @@ -2909,9 +2909,9 @@ "license": "MIT" }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", + "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -3358,9 +3358,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001633", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001633.tgz", - "integrity": "sha512-6sT0yf/z5jqf8tISAgpJDrmwOpLsrpnyCdD/lOZKvKkkJK4Dn0X5i7KF7THEZhOq+30bmhwBlNEaqPUiHiKtZg==", + "version": "1.0.30001634", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001634.tgz", + "integrity": "sha512-fbBYXQ9q3+yp1q1gBk86tOFs4pyn/yxFm5ZNP18OXJDfA3txImOY9PhfxVggZ4vRHDqoU8NrKU81eN0OtzOgRA==", "funding": [ { "type": "opencollective", @@ -4029,9 +4029,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.802", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.802.tgz", - "integrity": "sha512-TnTMUATbgNdPXVSHsxvNVSG0uEd6cSZsANjm8c9HbvflZVVn1yTRcmVXYT1Ma95/ssB/Dcd30AHweH2TE+dNpA==", + "version": "1.4.803", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.803.tgz", + "integrity": "sha512-61H9mLzGOCLLVsnLiRzCbc63uldP0AniRYPV3hbGVtONA1pI7qSGILdbofR7A8TMbOypDocEAjH/e+9k1QIe3g==", "license": "ISC" }, "node_modules/emmet": { @@ -4387,9 +4387,9 @@ } }, "node_modules/foreground-child": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.0.tgz", - "integrity": "sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", "dev": true, "license": "ISC", "dependencies": { @@ -8047,12 +8047,12 @@ } }, "node_modules/shiki": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.6.4.tgz", - "integrity": "sha512-X88chM7w8jnadoZtjPTi5ahCJx9pc9f8GfEkZAEYUTlcUZIEw2D/RY86HI/LkkE7Nj8TQWkiBfaFTJ3VJT6ESg==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.6.5.tgz", + "integrity": "sha512-iFzypldJG0zeyRHKAhaSGCf+YWXpMMyUyOrCVFBFKGGdF5vrB6jbd66/SQljxV20aSrVZEAQwUto/hhuNi/CIg==", "license": "MIT", "dependencies": { - "@shikijs/core": "1.6.4" + "@shikijs/core": "1.6.5" } }, "node_modules/signal-exit": { @@ -8722,9 +8722,9 @@ } }, "node_modules/vite": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.0.tgz", - "integrity": "sha512-hA6vAVK977NyW1Qw+fLvqSo7xDPej7von7C3DwwqPRmnnnK36XEBC/J3j1V5lP8fbt7y0TgTKJbpNGSwM+Bdeg==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.1.tgz", + "integrity": "sha512-XBmSKRLXLxiaPYamLv3/hnP/KXDai1NDexN0FpkTaZXTfycHvkRHoenpgl/fvuK/kPbB6xAgoyiryAhQNxYmAQ==", "license": "MIT", "dependencies": { "esbuild": "^0.21.3", diff --git a/src/components/player/resolver.ts b/src/components/player/resolver.ts index 99add89..9f42bc0 100644 --- a/src/components/player/resolver.ts +++ b/src/components/player/resolver.ts @@ -16,12 +16,10 @@ const emptySong = { name: '', artist: '', url: '', pic: '' }; const song = async (props: MusicPlayerProps): Promise => { const { netease, song } = props; - if (import.meta.env.DEV) { - // Fix the UNABLE_TO_GET_ISSUER_CERT_LOCALLY issue. - process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - } - if (netease) { + // Fix the UNABLE_TO_GET_ISSUER_CERT_LOCALLY issue for the mirror site. + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + // https://github.com/injahow/meting-api const data = await fetch(`https://api.injahow.cn/meting/?type=song&id=${netease}`) .then((response) => response.json()) @@ -30,7 +28,8 @@ const song = async (props: MusicPlayerProps): Promise => { return [emptySong]; }); - return data[0] as Song; + // Check the return result. + return { name: data[0].name, artist: data[0].artist, url: data[0].url, pic: data[0].pic }; } if (song) { diff --git a/tools/go.mod b/tools/go.mod index b7e240d..f1228a3 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -4,11 +4,11 @@ go 1.22 require ( github.com/disintegration/imaging v1.6.2 - github.com/spf13/cobra v1.8.0 + github.com/spf13/cobra v1.8.1 ) require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/image v0.16.0 // indirect + golang.org/x/image v0.17.0 // indirect ) diff --git a/tools/go.sum b/tools/go.sum index e5f0c55..5e5e9a0 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -1,4 +1,5 @@ github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -6,11 +7,15 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.16.0 h1:9kloLAKhUufZhA12l5fwnx2NZW39/we1UhBesW433jw= golang.org/x/image v0.16.0/go.mod h1:ugSZItdV4nOxyqp56HmXwH0Ry0nBCpjnZdpDaIHdoPs= +golang.org/x/image v0.17.0 h1:nTRVVdajgB8zCMZVsViyzhnMKPwYeroEERRC64JuLco= +golang.org/x/image v0.17.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=