diff --git a/src/adapt/cnipa/index.js b/src/adapt/cnipa/index.js index ac98160..4f46f5b 100644 --- a/src/adapt/cnipa/index.js +++ b/src/adapt/cnipa/index.js @@ -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', } diff --git a/src/adapt/common/index.js b/src/adapt/common/index.js new file mode 100644 index 0000000..4f46f5b --- /dev/null +++ b/src/adapt/common/index.js @@ -0,0 +1,6 @@ +module.exports = { + cp0: 'qk`z}qodw}|`c~zw', + cp2: 'wPPR`QO`OQONUP', + globalText1: "'r2mKa'.length", + globalText2: '&Ţfunction', +} diff --git a/src/adapt/index.js b/src/adapt/index.js index 0ae90dc..d3761f1 100644 --- a/src/adapt/index.js +++ b/src/adapt/index.js @@ -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 }; diff --git a/src/adapt/readme.md b/src/adapt/readme.md index e150d17..04f59eb 100644 --- a/src/adapt/readme.md +++ b/src/adapt/readme.md @@ -18,7 +18,7 @@ module.exports = { cp0: 'gl}y|sMnyn}', cp2: 'g+*`-+`+0`.1`', globalText1: "'r2mKa'.length", - globalText2: '&Ţfunction', + globalText2: 'function ā(ā){', } ``` diff --git a/src/adapt/riversecurity/index.js b/src/adapt/riversecurity/index.js new file mode 100644 index 0000000..b860501 --- /dev/null +++ b/src/adapt/riversecurity/index.js @@ -0,0 +1,6 @@ +module.exports = { + cp0: 'gl}y|sMnyn}', + cp2: 'g+*`-+`+0`.1`', + globalText1: "'r2mKa'.length", + globalText2: 'function ā(ā){', +}