merge: Add option to disable external url warning (!672)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/672

Approved-by: Hazelnoot <acomputerdog@gmail.com>
Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
Marie 2024-10-10 16:29:40 +00:00
commit 4da6f9a2b2
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',