From 9b7301fb2e503c5085fdf18c9d0ff8b40eaba809 Mon Sep 17 00:00:00 2001 From: Marie Date: Sun, 15 Sep 2024 23:54:31 +0200 Subject: [PATCH 01/13] upd: Prompt for confirmation when Plugin:open_url is used --- locales/en-US.yml | 1 + locales/index.d.ts | 4 ++++ locales/ja-JP.yml | 1 + packages/frontend/src/plugin.ts | 14 +++++++++++--- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 58712657e8..d559b58a94 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -291,6 +291,7 @@ removeAreYouSure: "Are you sure that you want to remove \"{x}\"?" deleteAreYouSure: "Are you sure that you want to delete \"{x}\"?" resetAreYouSure: "Really reset?" areYouSure: "Are you sure?" +confirmRemoteUrl: "Are you sure that you want to go to \"{x}\"?" saved: "Saved" messaging: "Chat" upload: "Upload" diff --git a/locales/index.d.ts b/locales/index.d.ts index 55a95f8fd9..0e560b8ae9 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1180,6 +1180,10 @@ export interface Locale extends ILocale { * よろしいですか? */ "areYouSure": string; + /** + * 「{x}」を開きますか? + */ + "confirmRemoteUrl": ParameterizedString<"x">; /** * 保存しました */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index da208147a1..dc501f5802 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -291,6 +291,7 @@ removeAreYouSure: "「{x}」を削除しますか?" deleteAreYouSure: "「{x}」を削除しますか?" resetAreYouSure: "リセットしますか?" areYouSure: "よろしいですか?" +confirmRemoteUrl: "「{x}」を開きますか?" saved: "保存しました" messaging: "チャット" upload: "アップロード" diff --git a/packages/frontend/src/plugin.ts b/packages/frontend/src/plugin.ts index 81233a5a5e..0818eb43f1 100644 --- a/packages/frontend/src/plugin.ts +++ b/packages/frontend/src/plugin.ts @@ -6,7 +6,8 @@ import { ref } from 'vue'; import { Interpreter, Parser, utils, values } from '@syuilo/aiscript'; import { aiScriptReadline, createAiScriptEnv } from '@/scripts/aiscript/api.js'; -import { inputText } from '@/os.js'; +import * as os from '@/os.js'; +import { i18n } from '@/i18n.js'; import { Plugin, noteActions, notePostInterruptors, noteViewInterruptors, postFormActions, userActions, pageViewInterruptors } from '@/store.js'; const parser = new Parser(); @@ -91,8 +92,15 @@ function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record { - utils.assertString(url); - window.open(url.value, '_blank', 'noopener'); + (async () => { + utils.assertString(url); + const { canceled } = await os.confirm({ + type: 'question', + text: i18n.tsx.confirmRemoteUrl({x: url.value}), + }); + if (canceled) return; + window.open(url.value, '_blank', 'noopener'); + })(); }), 'Plugin:config': values.OBJ(config), }; From 67257ee5c685910d1f08be6a1164231fdae66910 Mon Sep 17 00:00:00 2001 From: Marie Date: Mon, 16 Sep 2024 00:08:15 +0200 Subject: [PATCH 02/13] upd: fix audio showing multiple warnings --- packages/frontend/src/components/MkMediaBanner.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/components/MkMediaBanner.vue b/packages/frontend/src/components/MkMediaBanner.vue index ed8d43273f..77a86ff2fb 100644 --- a/packages/frontend/src/components/MkMediaBanner.vue +++ b/packages/frontend/src/components/MkMediaBanner.vue @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only