Made registerProtocolHandler('mailto') optional by activating at Settings -> General

This commit is contained in:
the-djmaze 2024-07-07 18:16:39 +02:00
parent 325197175b
commit a3d9d98184
40 changed files with 88 additions and 49 deletions

View file

@ -147,7 +147,6 @@ export class AppUser extends AbstractApp {
}
logout() {
localStorage.removeItem('register_protocol_offered');
Remote.request('Logout', () => rl.logoutReload(Settings.app('customLogoutLink')));
}
@ -222,17 +221,6 @@ export class AppUser extends AbstractApp {
SMimeUserStore.loadCertificates();
setTimeout(() => mailToHelper(SettingsGet('mailToEmail')), 500);
if (!localStorage.getItem('register_protocol_offered')) {
console.log('register mailto protocol');
navigator.registerProtocolHandler?.(
'mailto',
location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s',
(SettingsGet('title') || 'SnappyMail')
);
localStorage.setItem('register_protocol_offered', '1');
}
} else {
this.logout();
}