make trustedDomains persist across reloads

we can't just write to `prefer.s.*`, we need to `.commit`

also, there's no need to use the reactive view (`prefer.r.*`) in
non-reactive contexts
This commit is contained in:
dakkar 2025-07-23 10:46:01 +01:00
parent ed68230811
commit df0f682518
2 changed files with 3 additions and 3 deletions

View file

@ -64,7 +64,7 @@ function done(canceled: boolean, result?: Result): void { // eslint-disable-line
async function ok() {
const result = true;
if (!prefer.s.trustedDomains.includes(domain.value) && trustThisDomain.value) {
prefer.r.trustedDomains.value = prefer.s.trustedDomains.concat(domain.value);
prefer.commit('trustedDomains', prefer.s.trustedDomains.concat(domain.value));
}
done(false, result);
}

View file

@ -36,8 +36,8 @@ export async function warningExternalWebsite(url: string) {
}
});
const isTrustedByUser = prefer.r.trustedDomains.value.includes(hostname);
const isDisabledByUser = !prefer.r.warnExternalUrl.value;
const isTrustedByUser = prefer.s.trustedDomains.includes(hostname);
const isDisabledByUser = !prefer.s.warnExternalUrl;
if (!isTrustedByInstance && !isTrustedByUser && !isDisabledByUser) {
const confirm = await new Promise<{ canceled: boolean }>(resolve => {