client: check input for aiscript
ci/woodpecker/push/lint-client Pipeline was successful Details
ci/woodpecker/push/lint-backend Pipeline was successful Details
ci/woodpecker/push/lint-foundkey-js Pipeline was successful Details
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/lint-sw Pipeline was successful Details
ci/woodpecker/push/test Pipeline was successful Details

af1c9251fc
5f3640c7fd

Co-authored-by: Johann150 <johann.galle@protonmail.com>
Changelog: Fixed
This commit is contained in:
syuilo 2023-02-10 20:04:45 +01:00 committed by Johann150
parent 27b912b9b0
commit 09fe55379e
Signed by: Johann150
GPG Key ID: 9EE6577A2A06F8F1
5 changed files with 12 additions and 4 deletions

View File

@ -59,6 +59,7 @@ async function run() {
os.inputText({
title: q,
}).then(({ canceled, result: a }) => {
if (canceled) return;
ok(a);
});
});

View File

@ -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);
});
});

View File

@ -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));

View File

@ -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);
});
});

View File

@ -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);
});
});