diff --git a/package.json b/package.json new file mode 100644 index 0000000..c77de1f --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "qzmusic-web-master", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "http://171.80.3.149:4321/miao-moe/QZMusic-Web.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "type": "commonjs" +} diff --git a/qzmusic-web/analyze-plugin.cjs b/qzmusic-web/analyze-plugin.cjs new file mode 100644 index 0000000..761d0f0 --- /dev/null +++ b/qzmusic-web/analyze-plugin.cjs @@ -0,0 +1,25 @@ +const fs = require('fs'); +const content = fs.readFileSync('C:\\Users\\Administrator\\AppData\\Local\\Temp\\zq_kw_v3-fix1.js', 'utf-8'); + +// Find musicSearch module (ID 5019) +let idx = content.indexOf('/***/ 5019:'); +if (idx < 0) idx = content.indexOf('"5019"'); +console.log('Module 5019 at:', idx); +if (idx >= 0) console.log(content.substring(idx, idx + 2000)); + +// Look for the search function's returned fields +console.log('\n=== Looking for field names in search results ==='); +const fieldPatterns = ['hash:', 'Hash:', 'songmid:', 'songMid:', 'SongID:', 'songId:', 'MusicID:', 'FileHash:', 'album_name:', 'singer:', 'singername:', 'songname:', 'songName:']; +for (const p of fieldPatterns) { + const fi = content.indexOf(p); + if (fi > 0 && fi < content.indexOf('module.exports')) { + console.log(` ${p} at ${fi}: ${content.substring(Math.max(0,fi-80), fi+80)}`); + } +} + +// Look for how search results are formatted +console.log('\n=== Search function body ==='); +const searchFnStart = content.indexOf('function search_song'); +if (searchFnStart >= 0) { + console.log(content.substring(searchFnStart, searchFnStart + 3000)); +} diff --git a/qzmusic-web/deploy-plugins.cjs b/qzmusic-web/deploy-plugins.cjs new file mode 100644 index 0000000..b6bae99 --- /dev/null +++ b/qzmusic-web/deploy-plugins.cjs @@ -0,0 +1,50 @@ +const { Client } = require('ssh2'); +const conn = new Client(); + +const HOST = '171.80.3.149'; +const PORT = 631; +const USER = 'root'; +const PASS = 'aicyRTPZ3868'; + +const cmds = [ + 'mkdir -p /opt/QZMusic-Web/dist/plugins', + // download all plugins using curl from Alist server + 'curl -sL -o /opt/QZMusic-Web/dist/plugins/zq_kw_v3-fix1.js "http://171.80.3.149:5244/sd/c6VNt7hG/%E9%9F%B3%E6%BA%90/QZ-Music_v2/%E5%AE%98%E6%96%B9/v3/zq_kw_v3-fix1.js?pwd=music"', + 'curl -sL -o /opt/QZMusic-Web/dist/plugins/zq_wy_v3.js "http://171.80.3.149:5244/sd/c6VNt7hG/%E9%9F%B3%E6%BA%90/QZ-Music_v2/%E5%AE%98%E6%96%B9/v3/zq_wy_v3.js?pwd=music"', + 'curl -sL -o /opt/QZMusic-Web/dist/plugins/zq_tx_v3-fix1.js "http://171.80.3.149:5244/sd/c6VNt7hG/%E9%9F%B3%E6%BA%90/QZ-Music_v2/%E5%AE%98%E6%96%B9/v3/zq_tx_v3-fix1.js?pwd=music"', + 'curl -sL -o /opt/QZMusic-Web/dist/plugins/zq_kg.js "http://171.80.3.149:5244/sd/c6VNt7hG/%E9%9F%B3%E6%BA%90/QZ-Music_v2/%E5%AE%98%E6%96%B9/v3/zq_kg.js?pwd=music"', + 'curl -sL -o /opt/QZMusic-Web/dist/plugins/zq_mg_v3.js "http://171.80.3.149:5244/sd/c6VNt7hG/%E9%9F%B3%E6%BA%90/QZ-Music_v2/%E5%AE%98%E6%96%B9/v3/zq_mg_v3.js?pwd=music"', + 'ls -la /opt/QZMusic-Web/dist/plugins/', +]; + +conn.on('ready', () => { + console.log('SSH connected'); + runNext(0); +}); + +function runNext(idx) { + if (idx >= cmds.length) { + console.log('All done'); + conn.end(); + return; + } + const cmd = cmds[idx]; + console.log(`[${idx+1}/${cmds.length}] ${cmd}`); + conn.exec(cmd, (err, stream) => { + if (err) { console.error('Error:', err.message); conn.end(); return; } + let out = '', errOut = ''; + stream.on('data', d => { out += d.toString(); }); + stream.stderr.on('data', d => { errOut += d.toString(); }); + stream.on('close', code => { + if (out.trim()) console.log(out.trim()); + if (errOut.trim()) console.error(errOut.trim()); + if (code !== 0) { console.error('Failed (exit ' + code + '), continuing'); } + runNext(idx + 1); + }); + }); +} + +conn.connect({ + host: HOST, port: PORT, username: USER, password: PASS, + readyTimeout: 30000, keepaliveInterval: 10000, +}); diff --git a/qzmusic-web/explore-webdav.cjs b/qzmusic-web/explore-webdav.cjs new file mode 100644 index 0000000..ec7d2dd --- /dev/null +++ b/qzmusic-web/explore-webdav.cjs @@ -0,0 +1,27 @@ +const base = 'http://171.80.3.149:5244'; +const shareCode = 'c6VNt7hG'; +const pwd = 'music'; +const plugins = ['zq_kw_v3-fix1.js','zq_wy_v3.js','zq_tx_v3-fix1.js','zq_kg.js','zq_mg_v3.js']; + +async function downloadPlugin(name) { + const path = '/@s/' + shareCode + '/音源/QZ-Music_v2/官方/v3/' + name; + const resp = await fetch(base + '/api/fs/get', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ path, password: pwd }) + }); + const data = await resp.json(); + if (data.code !== 200 || !data.data?.raw_url) { + console.log(name + ': no raw_url'); + return null; + } + return { name, raw_url: data.data.raw_url, size: data.data.size }; +} + +async function main() { + for (const p of plugins) { + const info = await downloadPlugin(p); + if (info) console.log(info.name + ' -> ' + info.raw_url + ' (' + info.size + ' bytes)'); + } +} +main(); diff --git a/qzmusic-web/src/plugins/init.ts b/qzmusic-web/src/plugins/init.ts index 9b3e477..704c135 100644 --- a/qzmusic-web/src/plugins/init.ts +++ b/qzmusic-web/src/plugins/init.ts @@ -80,9 +80,9 @@ export const initPlugins = async (): Promise => { failedBuiltins = res.failed; } - // 4) 确保默认激活插件:优先 wy / 首个内置,再是用户的,最后落到 demo + // 4) 确保默认激活插件:优先 kw(酷我)/ 首个内置,再是用户的,最后落到 demo const active = pluginManager.getActivePluginId(); - const priority = ['wy', 'tx', 'kw', 'kg', 'mg', 'demo']; + const priority = ['kw', 'wy', 'tx', 'kg', 'mg', 'demo']; if (!active) { for (const id of priority) { if (pluginManager.has(id)) { diff --git a/qzmusic-web/src/plugins/nodePolyfills.ts b/qzmusic-web/src/plugins/nodePolyfills.ts index baa777b..5753236 100644 --- a/qzmusic-web/src/plugins/nodePolyfills.ts +++ b/qzmusic-web/src/plugins/nodePolyfills.ts @@ -738,6 +738,10 @@ export function createNodePolyfills(): Record { inflateSync: (d: any) => d, deflateSync: (d: any) => d, gzipSync: (d: any) => d, + deflateRaw: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); }, + inflateRaw: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); }, + deflateRawSync: (d: any) => d, + inflateRawSync: (d: any) => d, gunzip: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); }, inflate: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); }, createGunzip: () => { const p: any = Object.create(streamMod !== undefined ? streamMod.Transform.prototype : {}); p.write = () => true; p.end = function() { this.emit && this.emit('end'); return this; }; return p; }, diff --git a/qzmusic-web/src/plugins/pluginManager.ts b/qzmusic-web/src/plugins/pluginManager.ts index b7126bf..e066f96 100644 --- a/qzmusic-web/src/plugins/pluginManager.ts +++ b/qzmusic-web/src/plugins/pluginManager.ts @@ -472,9 +472,9 @@ export class PluginManager { version: 'v20.0.0', platform: 'browser', arch: 'x64', + browser: true, argv: [], title: 'node', - browser: true, cwd: () => '/', chdir: () => { /* noop */ }, on: function () { return this; }, @@ -484,7 +484,7 @@ export class PluginManager { addListener: function () { return this; }, removeListener: function () { return this; }, removeAllListeners: function () { return this; }, - versions: { node: '20.0.0', v8: '11.3.244.8-node.16' }, + versions: { node: '20.0.0', v8: '11.3.244.8-node.16', app: '3.0.0' }, exit: function () { /* noop */ }, nextTick: (fn: () => void) => setTimeout(fn, 0), };