fix: 修复v3插件process.versions.app缺失/zlib deflateRaw/优先级kw优先

This commit is contained in:
miao-moe
2026-06-20 13:34:32 +08:00
parent da604cd842
commit 9bfe5eb618
7 changed files with 127 additions and 4 deletions

17
package.json Normal file
View File

@@ -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"
}

View File

@@ -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));
}

View File

@@ -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,
});

View File

@@ -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();

View File

@@ -80,9 +80,9 @@ export const initPlugins = async (): Promise<InitPluginsResult> => {
failedBuiltins = res.failed; failedBuiltins = res.failed;
} }
// 4) 确保默认激活插件:优先 wy / 首个内置,再是用户的,最后落到 demo // 4) 确保默认激活插件:优先 kw酷我/ 首个内置,再是用户的,最后落到 demo
const active = pluginManager.getActivePluginId(); const active = pluginManager.getActivePluginId();
const priority = ['wy', 'tx', 'kw', 'kg', 'mg', 'demo']; const priority = ['kw', 'wy', 'tx', 'kg', 'mg', 'demo'];
if (!active) { if (!active) {
for (const id of priority) { for (const id of priority) {
if (pluginManager.has(id)) { if (pluginManager.has(id)) {

View File

@@ -738,6 +738,10 @@ export function createNodePolyfills(): Record<string, any> {
inflateSync: (d: any) => d, inflateSync: (d: any) => d,
deflateSync: (d: any) => d, deflateSync: (d: any) => d,
gzipSync: (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); }, 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); }, 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; }, 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; },

View File

@@ -472,9 +472,9 @@ export class PluginManager {
version: 'v20.0.0', version: 'v20.0.0',
platform: 'browser', platform: 'browser',
arch: 'x64', arch: 'x64',
browser: true,
argv: [], argv: [],
title: 'node', title: 'node',
browser: true,
cwd: () => '/', cwd: () => '/',
chdir: () => { /* noop */ }, chdir: () => { /* noop */ },
on: function () { return this; }, on: function () { return this; },
@@ -484,7 +484,7 @@ export class PluginManager {
addListener: function () { return this; }, addListener: function () { return this; },
removeListener: function () { return this; }, removeListener: function () { return this; },
removeAllListeners: 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 */ }, exit: function () { /* noop */ },
nextTick: (fn: () => void) => setTimeout(fn, 0), nextTick: (fn: () => void) => setTimeout(fn, 0),
}; };