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:
commit
4da6f9a2b2
6 changed files with 15 additions and 1 deletions
|
@ -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
4
locales/index.d.ts
vendored
|
@ -5385,6 +5385,10 @@ export interface Locale extends ILocale {
|
|||
* センシティブなメディアです。表示しますか?
|
||||
*/
|
||||
"sensitiveMediaRevealConfirm": string;
|
||||
/**
|
||||
* 外部URLを開く際に警告を表示する
|
||||
*/
|
||||
"warnExternalUrl": string;
|
||||
/**
|
||||
* 作成したリスト
|
||||
*/
|
||||
|
|
|
@ -1342,6 +1342,7 @@ inquiry: "お問い合わせ"
|
|||
tryAgain: "もう一度お試しください。"
|
||||
confirmWhenRevealingSensitiveMedia: "センシティブなメディアを表示するとき確認する"
|
||||
sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?"
|
||||
warnExternalUrl: "外部URLを開く際に警告を表示する"
|
||||
createdLists: "作成したリスト"
|
||||
createdAntennas: "作成したアンテナ"
|
||||
severAllFollowRelations: "以下の関係をすべて断ち切る"
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -169,6 +169,10 @@ export const defaultStore = markRaw(new Storage('base', {
|
|||
where: 'account',
|
||||
default: [] as string[],
|
||||
},
|
||||
warnExternalUrl: {
|
||||
where: 'account',
|
||||
default: true,
|
||||
},
|
||||
|
||||
menu: {
|
||||
where: 'deviceAccount',
|
||||
|
|
Loading…
Reference in a new issue