forked from FoundKeyGang/FoundKey
client: check input for aiscript
af1c9251fc
5f3640c7fd
Co-authored-by: Johann150 <johann.galle@protonmail.com> Changelog: Fixed
This commit is contained in:
parent
27b912b9b0
commit
09fe55379e
5 changed files with 12 additions and 4 deletions
|
@ -59,6 +59,7 @@ async function run() {
|
|||
os.inputText({
|
||||
title: q,
|
||||
}).then(({ canceled, result: a }) => {
|
||||
if (canceled) return;
|
||||
ok(a);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,7 +18,8 @@ export function install(plugin) {
|
|||
return new Promise(ok => {
|
||||
inputText({
|
||||
title: q,
|
||||
}).then(({ result: a }) => {
|
||||
}).then(({ canceled, result: a }) => {
|
||||
if (canceled) return;
|
||||
ok(a);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,7 +24,11 @@ export function createAiScriptEnv(opts) {
|
|||
return confirm.canceled ? values.FALSE : values.TRUE;
|
||||
}),
|
||||
'Mk:api': values.FN_NATIVE(async ([ep, param, token]) => {
|
||||
if (token) utils.assertString(token);
|
||||
if (token) {
|
||||
utils.assertString(token);
|
||||
// In case there is a bug, it could be undefined.
|
||||
if (typeof token.value !== 'string') throw new Error('invalid token');
|
||||
}
|
||||
apiRequests++;
|
||||
if (apiRequests > 16) return values.NULL;
|
||||
const res = await os.api(ep.value, utils.valToJs(param), token ? token.value : (opts.token || null));
|
||||
|
|
|
@ -72,7 +72,8 @@ const run = async (): Promise<void> => {
|
|||
return new Promise(ok => {
|
||||
os.inputText({
|
||||
title: q,
|
||||
}).then(({ result: a }) => {
|
||||
}).then(({ canceled, result: a }) => {
|
||||
if (canceled) return;
|
||||
ok(a);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -60,7 +60,8 @@ const run = async (): Promise<void> => {
|
|||
return new Promise(ok => {
|
||||
os.inputText({
|
||||
title: q,
|
||||
}).then(({ result: a }) => {
|
||||
}).then(({ canceled, result: a }) => {
|
||||
if (canceled) return;
|
||||
ok(a);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue