From f72fe09b2277bef5f5eb85f9cbd90d8a97ab7590 Mon Sep 17 00:00:00 2001 From: kuangthree Date: Sat, 3 Feb 2024 17:55:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=A9=E5=B1=95=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E6=A3=80=E6=9F=A5=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/game/index.js | 3 +++ noname/library/init/index.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/noname/game/index.js b/noname/game/index.js index 00c61270c..7fefb3262 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -1782,6 +1782,9 @@ export class Game extends Uninstantable { object = await (gnc.is.generatorFunc(object) ? gnc.of(object) : object)(lib, game, ui, get, ai, _status); noEval = true; } + if(object.closeSyntaxCheck){ + noEval = true; + } const name = object.name, extensionName = `extension_${name}`, extensionMenu = lib.extensionMenu[extensionName] = { enable: { name: '开启', diff --git a/noname/library/init/index.js b/noname/library/init/index.js index 41f3f2612..735b2bb75 100644 --- a/noname/library/init/index.js +++ b/noname/library/init/index.js @@ -708,7 +708,11 @@ export class LibInit extends Uninstantable { } else if (typeof func == 'object') { for (var i in func) { - if (Object.prototype.hasOwnProperty.call(func, i)) { + if(typeof func[i] == 'function'){ + let checkObject = {}; + checkObject[i] = func[i]; + return eval(`(function(){return ${get.stringify(checkObject)};})()`)[i]; + }else{ func[i] = lib.init.eval(func[i]); } }