Merge pull request #4 from pysunday/develop

fix: 适配更新
This commit is contained in:
pysunday 2024-03-20 12:13:25 +08:00 committed by GitHub
commit 67deededea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,6 @@
module.exports = {
cp0: 'gl}y|sMnyn}',
cp2: 'g+*`-+`+0`.1`',
cp0: 'qk`z}qodw}|`c~zw',
cp2: 'wPPR`QO`OQONUP',
globalText1: "'r2mKa'.length",
globalText2: '&Ţfunction',
}

View File

@ -0,0 +1,6 @@
module.exports = {
cp0: 'qk`z}qodw}|`c~zw',
cp2: 'wPPR`QO`OQONUP',
globalText1: "'r2mKa'.length",
globalText2: '&Ţfunction',
}

View File

@ -1,4 +1,5 @@
const fs = require('fs');
const logger = require('@utils/logger');
const unescape = require('@utils/unescape');
const adapts = fs.readdirSync(__dirname, { withFileTypes: true })
@ -26,10 +27,10 @@ function findFullString(text, start, end) {
}
module.exports = function(code, name) {
const config = adapts[name] ? adapts[name] : adapts.cnipa;
const idx = code.indexOf(config.cp2);
const config = adapts[name] ? adapts[name] : adapts.common;
return Object.entries(config).reduce((ans, [key, val]) => {
const idx = code.indexOf(val);
if (idx === -1) throw new Error(`${key}值数据未找到请查看文档src/adapt/readme.md`);
if (code.indexOf(val, idx + val.length) > -1) throw new Error(`${key}对应的值${val}在代码中非唯一,请检查!`);
const fullString = findFullString(code, idx, idx + val.length);
return { ...ans, [key]: fullString };

View File

@ -18,7 +18,7 @@ module.exports = {
cp0: 'gl}y|sMnyn}',
cp2: 'g+*`-+`+0`.1`',
globalText1: "'r2mKa'.length",
globalText2: '&Ţfunction',
globalText2: 'function ā(ā){',
}
```

View File

@ -0,0 +1,6 @@
module.exports = {
cp0: 'gl}y|sMnyn}',
cp2: 'g+*`-+`+0`.1`',
globalText1: "'r2mKa'.length",
globalText2: 'function ā(ā){',
}