修改扩展语法检查方式

This commit is contained in:
kuangthree 2024-02-03 17:55:59 +08:00
parent d9022bb482
commit f72fe09b22
2 changed files with 8 additions and 1 deletions

View File

@ -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); object = await (gnc.is.generatorFunc(object) ? gnc.of(object) : object)(lib, game, ui, get, ai, _status);
noEval = true; noEval = true;
} }
if(object.closeSyntaxCheck){
noEval = true;
}
const name = object.name, extensionName = `extension_${name}`, extensionMenu = lib.extensionMenu[extensionName] = { const name = object.name, extensionName = `extension_${name}`, extensionMenu = lib.extensionMenu[extensionName] = {
enable: { enable: {
name: '开启', name: '开启',

View File

@ -708,7 +708,11 @@ export class LibInit extends Uninstantable {
} }
else if (typeof func == 'object') { else if (typeof func == 'object') {
for (var i in func) { 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]); func[i] = lib.init.eval(func[i]);
} }
} }