From 6a4dbfd30b78ff7736dfd2577b5d443d45b1a186 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 9 Nov 2023 13:11:44 +0900 Subject: [PATCH] [feat] add state limit --- src/ts/plugins/embedscript.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ts/plugins/embedscript.ts b/src/ts/plugins/embedscript.ts index 32aa323d..66854b24 100644 --- a/src/ts/plugins/embedscript.ts +++ b/src/ts/plugins/embedscript.ts @@ -190,9 +190,15 @@ addWorkerFunction('setState', async (statename, data) => { if(typeof data !== 'string' && typeof data !== 'number' && typeof data !== 'boolean'){ return false } + if(typeof data === 'string' && data.length > 100000){ + return false + } if(!chat.scriptstate){ chat.scriptstate = {} } + if(Object.keys(chat.scriptstate).length > 50){ + return false + } chat.scriptstate[statename] = data char.chats[char.chatPage] = chat db.characters[selectedChar] = char