diff --git a/.env b/.env index ad23f2b..278d8c0 100644 --- a/.env +++ b/.env @@ -2,10 +2,14 @@ CORS_ALLOW_ORIGIN = "*" ### UnblockNeteaseMusic 设置项 +## 启用全局解灰, 无论是否调用参数都会使用解灰(推荐开启) +ENABLE_GENERAL_UNBLOCK = true ## 歌曲启用无损音质 ENABLE_FLAC = true ## 启用无损音质时,是否选择音质最高的 SELECT_MAX_BR = true +## 音源设置 +UNBLOCK_SOURCE = ['pyncmd','kuwo', 'qq', 'migu', 'kugou'] ## 严格按照配置音源设置顺序进行匹配 FOLLOW_SOURCE_ORDER = true ## Cookie设置项; 推荐在Vercel等平台进行环境变量的设置或者设置github secret diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7620d35..128045c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,8 +24,8 @@ importers: specifier: ^4.21.2 version: 4.21.2 express-fileupload: - specifier: ^1.5.1 - version: 1.5.1 + specifier: ^1.5.2 + version: 1.5.2 md5: specifier: ^2.3.0 version: 2.3.0 @@ -307,8 +307,8 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} - agent-base@7.1.3: - resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==} + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} engines: {node: '>= 14'} aggregate-error@3.1.0: @@ -982,8 +982,8 @@ packages: resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} engines: {node: '>=6'} - express-fileupload@1.5.1: - resolution: {integrity: sha512-LsYG1ALXEB7vlmjuSw8ABeOctMp8a31aUC5ZF55zuz7O2jLFnmJYrCv10py357ky48aEoBQ/9bVXgFynjvaPmA==} + express-fileupload@1.5.2: + resolution: {integrity: sha512-wxUJn2vTHvj/kZCVmc5/bJO15C7aSMyHeuXYY3geKpeKibaAoQGcEv5+sM6nHS2T7VF+QHS4hTWPiY2mKofEdg==} engines: {node: '>=12.0.0'} express@4.21.2: @@ -1133,8 +1133,8 @@ packages: resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} engines: {node: '>= 0.4'} - get-uri@6.0.4: - resolution: {integrity: sha512-E1b1lFFLvLgak2whF2xDBcOy6NLVGZBqqjJjsIhvopKfWWEi64pLVTWWehV8KlLerZkfNTA95sTe2OdJKm1OzQ==} + get-uri@6.0.5: + resolution: {integrity: sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==} engines: {node: '>= 14'} github-from-package@0.0.0: @@ -2125,8 +2125,8 @@ packages: resolution: {integrity: sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==} engines: {node: '>= 14'} - socks@2.8.5: - resolution: {integrity: sha512-iF+tNDQla22geJdTyJB1wM/qrX9DMRwWrciEPwWLPRWAUEM8sQiyxgckLxWT1f7+9VabJS0jTGGr4QgBuvi6Ww==} + socks@2.8.6: + resolution: {integrity: sha512-pe4Y2yzru68lXCb38aAqRf5gvN8YdjP1lok5o0J7BOHljkyCGKVz7H3vpVIXKD27rj2giOJ7DwVyk/GWrPHDWA==} engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} sonic-boom@1.4.1: @@ -2730,7 +2730,7 @@ snapshots: transitivePeerDependencies: - supports-color - agent-base@7.1.3: {} + agent-base@7.1.4: {} aggregate-error@3.1.0: dependencies: @@ -3537,7 +3537,7 @@ snapshots: expand-template@2.0.3: {} - express-fileupload@1.5.1: + express-fileupload@1.5.2: dependencies: busboy: 1.6.0 @@ -3733,7 +3733,7 @@ snapshots: es-errors: 1.3.0 get-intrinsic: 1.3.0 - get-uri@6.0.4: + get-uri@6.0.5: dependencies: basic-ftp: 5.0.5 data-uri-to-buffer: 6.0.2 @@ -3836,7 +3836,7 @@ snapshots: http-proxy-agent@7.0.2: dependencies: - agent-base: 7.1.3 + agent-base: 7.1.4 debug: 4.4.1(supports-color@9.4.0) transitivePeerDependencies: - supports-color @@ -3850,7 +3850,7 @@ snapshots: https-proxy-agent@7.0.6: dependencies: - agent-base: 7.1.3 + agent-base: 7.1.4 debug: 4.4.1(supports-color@9.4.0) transitivePeerDependencies: - supports-color @@ -4363,9 +4363,9 @@ snapshots: pac-proxy-agent@7.2.0: dependencies: '@tootallnate/quickjs-emscripten': 0.23.0 - agent-base: 7.1.3 + agent-base: 7.1.4 debug: 4.4.1(supports-color@9.4.0) - get-uri: 6.0.4 + get-uri: 6.0.5 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.6 pac-resolver: 7.0.1 @@ -4862,13 +4862,13 @@ snapshots: socks-proxy-agent@8.0.5: dependencies: - agent-base: 7.1.3 + agent-base: 7.1.4 debug: 4.4.1(supports-color@9.4.0) - socks: 2.8.5 + socks: 2.8.6 transitivePeerDependencies: - supports-color - socks@2.8.5: + socks@2.8.6: dependencies: ip-address: 9.0.5 smart-buffer: 4.2.0 diff --git a/server.js b/server.js index fb75e04..24c9662 100644 --- a/server.js +++ b/server.js @@ -239,19 +239,22 @@ async function consturctServer(moduleDefs) { return request(...obj) }) console.log('[OK]', decode(req.originalUrl)) -/* - if (req.baseUrl === '/song/url/v1' || req.baseUrl === '/song/url') { + + if ( + (req.baseUrl === '/song/url/v1' || req.baseUrl === '/song/url') && + process.env.ENABLE_GENERAL_UNBLOCK === 'true' + ) { const song = moduleResponse['body']['data'][0] if (song.freeTrialInfo !== null || !song.url || [1, 4].includes(song.fee)) { const match = require('@unblockneteasemusic/server') - const source = ['pyncmd', 'kuwo'] + const source = ['pyncmd','kuwo', 'qq', 'migu', 'kugou'] const { url } = await match(req.query.id, source) song.url = url - song.freeTrialInfo = 'unblock' - console.log("解灰成功!")// 对于Splayer来说,去除开通会员提示 + song.freeTrialInfo = 'null' + console.log("解灰成功!") } } -*/ + const cookies = moduleResponse.cookie if (!query.noCookie) {