upd&merge: Merge Cherrypick/MisskeyIO's external url popup, delete old popup warning and modify script to handle undefined domains

This commit is contained in:
Marie 2024-10-04 02:31:22 +02:00
parent ac1e5a0fb5
commit d5b372f7a9
No known key found for this signature in database
GPG key ID: 7ADF6C9CD9A28555
16 changed files with 298 additions and 29 deletions

View file

@ -9,6 +9,7 @@ import { aiScriptReadline, createAiScriptEnv } from '@/scripts/aiscript/api.js';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { Plugin, noteActions, notePostInterruptors, noteViewInterruptors, postFormActions, userActions, pageViewInterruptors } from '@/store.js';
import { warningExternalWebsite } from '@/scripts/warning-external-website.js';
const parser = new Parser();
const pluginContexts = new Map<string, Interpreter>();
@ -92,16 +93,8 @@ function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<s
registerPageViewInterruptor({ pluginId: opts.plugin.id, handler });
}),
'Plugin:open_url': values.FN_NATIVE(([url]) => {
(async () => {
utils.assertString(url);
const { canceled } = await os.confirm({
type: 'question',
text: i18n.tsx.confirmRemoteUrl({ x: url.value }),
plain: true,
});
if (canceled) return;
window.open(url.value, '_blank', 'noopener');
})();
utils.assertString(url);
warningExternalWebsite(url.value);
}),
'Plugin:config': values.OBJ(config),
};