Skip to content

Commit

Permalink
fix: os.popupの引数を変更&変更漏れ
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Dec 29, 2024
1 parent 0c5e946 commit d0d406c
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions packages/frontend/src/scripts/warning-external-website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { instance } from '@/instance.js';
import { defaultStore } from '@/store.js';
import * as os from '@/os.js';
import MkUrlWarningDialog from '@/components/MkUrlWarningDialog.vue';
import { i18n } from '@/i18n.js';

const extractDomain = /^(https?:\/\/|\/\/)?([^@/\s]+@)?(www\.)?([^:/\s]+)/i;
const isRegExp = /^\/(.+)\/(.*)$/;
Expand All @@ -22,21 +23,27 @@ export async function warningExternalWebsite(ev: MouseEvent, url: string) {
} else if (expression.includes(' ')) return expression.split(' ').every(keyword => url.includes(keyword));
else return domain.endsWith(expression);
});
const isTrustedByUser = defaultStore.reactiveState.trustedDomains.value.includes(domain);
const isTrustedByUser = defaultStore.reactiveState.trustedExternalWebsites.value.includes(domain);

if (!self && !isTrustedByInstance && !isTrustedByUser) {
ev.preventDefault();
ev.stopPropagation();

const confirm = await new Promise<{ canceled: boolean }>(resolve => {
os.popup(MkUrlWarningDialog, {
url,
}, {
done: result => {
resolve(result ? result : { canceled: true });
const {dispose} = os.popup(

Check failure on line 33 in packages/frontend/src/scripts/warning-external-website.ts

View workflow job for this annotation

GitHub Actions / lint (frontend)

A space is required after '{'

Check failure on line 33 in packages/frontend/src/scripts/warning-external-website.ts

View workflow job for this annotation

GitHub Actions / lint (frontend)

A space is required before '}'
MkUrlWarningDialog,
{
url,
},
}, 'closed');
});
{
done: result => {
resolve(result ? result : { canceled: true });
},
closed: () => {
dispose();
}
});
});

if (confirm.canceled) return false;

Expand Down

0 comments on commit d0d406c

Please sign in to comment.