fix: add editdisplay limit
This commit is contained in:
@@ -16,6 +16,7 @@ let luaFactory:LuaFactory
|
|||||||
let luaEngine:LuaEngine
|
let luaEngine:LuaEngine
|
||||||
let lastCode = ''
|
let lastCode = ''
|
||||||
let LuaSafeIds = new Set<string>()
|
let LuaSafeIds = new Set<string>()
|
||||||
|
let LuaEditDisplayIds = new Set<string>()
|
||||||
let LuaLowLevelIds = new Set<string>()
|
let LuaLowLevelIds = new Set<string>()
|
||||||
|
|
||||||
export async function runLua(code:string, arg:{
|
export async function runLua(code:string, arg:{
|
||||||
@@ -45,13 +46,13 @@ export async function runLua(code:string, arg:{
|
|||||||
}
|
}
|
||||||
luaEngine = await luaFactory.createEngine()
|
luaEngine = await luaFactory.createEngine()
|
||||||
luaEngine.global.set('setChatVar', (id:string,key:string, value:string) => {
|
luaEngine.global.set('setChatVar', (id:string,key:string, value:string) => {
|
||||||
if(!LuaSafeIds.has(id)){
|
if(!LuaSafeIds.has(id) && !LuaEditDisplayIds.has(id)){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setVar(key, value)
|
setVar(key, value)
|
||||||
})
|
})
|
||||||
luaEngine.global.set('getChatVar', (id:string,key:string) => {
|
luaEngine.global.set('getChatVar', (id:string,key:string) => {
|
||||||
if(!LuaSafeIds.has(id)){
|
if(!LuaSafeIds.has(id) && !LuaEditDisplayIds.has(id)){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return getVar(key)
|
return getVar(key)
|
||||||
@@ -291,9 +292,14 @@ export async function runLua(code:string, arg:{
|
|||||||
lastCode = code
|
lastCode = code
|
||||||
}
|
}
|
||||||
let accessKey = v4()
|
let accessKey = v4()
|
||||||
LuaSafeIds.add(accessKey)
|
if(mode === 'editDisplay'){
|
||||||
if(lowLevelAccess){
|
LuaEditDisplayIds.add(accessKey)
|
||||||
LuaLowLevelIds.add(v4())
|
}
|
||||||
|
else{
|
||||||
|
LuaSafeIds.add(accessKey)
|
||||||
|
if(lowLevelAccess){
|
||||||
|
LuaLowLevelIds.add(v4())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let res:any
|
let res:any
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user