发布咸鱼喵喵截图辅助工具公开版
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// 与启动器、服务端一致:读取实际游戏及存档目录,不解析页面 URL。
|
||||
const { CdpClient } = require('./cdp');
|
||||
const { OPS } = require('./ops');
|
||||
async function probe(port) {
|
||||
if (!Number.isInteger(port) || port < 1024 || port > 65535) throw new Error('端口无效');
|
||||
const c = new CdpClient(port);
|
||||
try { const r = await c.evalJson(OPS.selfPath()); if (!r.ok || !r.gameDir) throw new Error(r.error || '无法识别游戏'); return r; }
|
||||
finally { c.close(); }
|
||||
}
|
||||
if (require.main === module) probe(Number(process.argv[2])).then(r => console.log(r.gameDir)).catch(e => { console.error(e.message); process.exitCode = 1; });
|
||||
module.exports = { probe };
|
||||
Reference in New Issue
Block a user