mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
fix store in warning-external-website.ts
This commit is contained in:
parent
de279a86b2
commit
67cecda7fb
1 changed files with 4 additions and 4 deletions
|
@ -4,13 +4,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { instance } from '@/instance.js';
|
import { instance } from '@/instance.js';
|
||||||
import { defaultStore } from '@/store.js';
|
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import MkUrlWarningDialog from '@/components/MkUrlWarningDialog.vue';
|
import MkUrlWarningDialog from '@/components/MkUrlWarningDialog.vue';
|
||||||
|
import { prefer } from '@/preferences';
|
||||||
|
|
||||||
const isRegExp = /^\/(.+)\/(.*)$/;
|
const isRegExp = /^\/(.+)\/(.*)$/;
|
||||||
|
|
||||||
function extractHostname(maybeUrl: string): URL | null {
|
function extractHostname(maybeUrl: string): string | null {
|
||||||
try {
|
try {
|
||||||
const url = new URL(maybeUrl);
|
const url = new URL(maybeUrl);
|
||||||
return url.host;
|
return url.host;
|
||||||
|
@ -36,8 +36,8 @@ export async function warningExternalWebsite(url: string) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const isTrustedByUser = defaultStore.reactiveState.trustedDomains.value.includes(hostname);
|
const isTrustedByUser = prefer.r.trustedDomains.value.includes(hostname);
|
||||||
const isDisabledByUser = !defaultStore.reactiveState.warnExternalUrl.value;
|
const isDisabledByUser = !prefer.r.warnExternalUrl.value;
|
||||||
|
|
||||||
if (!isTrustedByInstance && !isTrustedByUser && !isDisabledByUser) {
|
if (!isTrustedByInstance && !isTrustedByUser && !isDisabledByUser) {
|
||||||
const confirm = await new Promise<{ canceled: boolean }>(resolve => {
|
const confirm = await new Promise<{ canceled: boolean }>(resolve => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue