diff --git a/locales/en-US.yml b/locales/en-US.yml index 8163ca525b..958a37c272 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1342,6 +1342,7 @@ inquiry: "Contact" tryAgain: "Please try again later" confirmWhenRevealingSensitiveMedia: "Confirm when revealing sensitive media" sensitiveMediaRevealConfirm: "This media might be sensitive. Are you sure you want to reveal it?" +warnExternalUrl: "Show warning when opening external URLs" createdLists: "Created lists" createdAntennas: "Created antennas" severAllFollowRelations: "Break following relationships" diff --git a/locales/index.d.ts b/locales/index.d.ts index fcd64071af..56f4150592 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5385,6 +5385,10 @@ export interface Locale extends ILocale { * センシティブなメディアです。表示しますか? */ "sensitiveMediaRevealConfirm": string; + /** + * 外部URLを開く際に警告を表示する + */ + "warnExternalUrl": string; /** * 作成したリスト */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 7e39515c5c..11d788c210 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1342,6 +1342,7 @@ inquiry: "お問い合わせ" tryAgain: "もう一度お試しください。" confirmWhenRevealingSensitiveMedia: "センシティブなメディアを表示するとき確認する" sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?" +warnExternalUrl: "外部URLを開く際に警告を表示する" createdLists: "作成したリスト" createdAntennas: "作成したアンテナ" severAllFollowRelations: "以下の関係をすべて断ち切る" diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 8cd1caf6bd..3caa635f7f 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -236,6 +236,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.enableHorizontalSwipe }} {{ i18n.ts.alwaysConfirmFollow }} {{ i18n.ts.confirmWhenRevealingSensitiveMedia }} + {{ i18n.ts.warnExternalUrl }} @@ -437,6 +438,7 @@ const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('u const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow')); const confirmWhenRevealingSensitiveMedia = computed(defaultStore.makeGetterSetter('confirmWhenRevealingSensitiveMedia')); const contextMenu = computed(defaultStore.makeGetterSetter('contextMenu')); +const warnExternalUrl = computed(defaultStore.makeGetterSetter('warnExternalUrl')); watch(lang, () => { miLocalStorage.setItem('lang', lang.value as string); @@ -498,6 +500,7 @@ watch([ alwaysConfirmFollow, confirmWhenRevealingSensitiveMedia, contextMenu, + warnExternalUrl, ], async () => { await reloadAsk(); }); diff --git a/packages/frontend/src/scripts/warning-external-website.ts b/packages/frontend/src/scripts/warning-external-website.ts index 5ef003cb01..67158c6438 100644 --- a/packages/frontend/src/scripts/warning-external-website.ts +++ b/packages/frontend/src/scripts/warning-external-website.ts @@ -29,8 +29,9 @@ export async function warningExternalWebsite(url: string) { }); const isTrustedByUser = defaultStore.reactiveState.trustedDomains.value.includes(domain); + const isDisabledByUser = !defaultStore.reactiveState.warnExternalUrl.value; - if (!isTrustedByInstance && !isTrustedByUser) { + if (!isTrustedByInstance && !isTrustedByUser && !isDisabledByUser) { const confirm = await new Promise<{ canceled: boolean }>(resolve => { const { dispose } = os.popup(MkUrlWarningDialog, { url, diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index ab5fbf0dd1..8665cdaf76 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -169,6 +169,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'account', default: [] as string[], }, + warnExternalUrl: { + where: 'account', + default: true, + }, menu: { where: 'deviceAccount',