upd: add option to disable external url warning

This commit is contained in:
Marie 2024-10-10 02:00:41 +02:00
parent 72a0f16b38
commit 7bd971c036
No known key found for this signature in database
GPG Key ID: 7ADF6C9CD9A28555
6 changed files with 15 additions and 1 deletions

View File

@ -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"

4
locales/index.d.ts vendored
View File

@ -5385,6 +5385,10 @@ export interface Locale extends ILocale {
*
*/
"sensitiveMediaRevealConfirm": string;
/**
* URLを開く際に警告を表示する
*/
"warnExternalUrl": string;
/**
*
*/

View File

@ -1342,6 +1342,7 @@ inquiry: "お問い合わせ"
tryAgain: "もう一度お試しください。"
confirmWhenRevealingSensitiveMedia: "センシティブなメディアを表示するとき確認する"
sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?"
warnExternalUrl: "外部URLを開く際に警告を表示する"
createdLists: "作成したリスト"
createdAntennas: "作成したアンテナ"
severAllFollowRelations: "以下の関係をすべて断ち切る"

View File

@ -236,6 +236,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="enableHorizontalSwipe">{{ i18n.ts.enableHorizontalSwipe }}</MkSwitch>
<MkSwitch v-model="alwaysConfirmFollow">{{ i18n.ts.alwaysConfirmFollow }}</MkSwitch>
<MkSwitch v-model="confirmWhenRevealingSensitiveMedia">{{ i18n.ts.confirmWhenRevealingSensitiveMedia }}</MkSwitch>
<MkSwitch v-model="warnExternalUrl">{{ i18n.ts.warnExternalUrl }}</MkSwitch>
</div>
<MkSelect v-model="serverDisconnectedBehavior">
<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
@ -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();
});

View File

@ -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,

View File

@ -169,6 +169,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'account',
default: [] as string[],
},
warnExternalUrl: {
where: 'account',
default: true,
},
menu: {
where: 'deviceAccount',