mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Made registerProtocolHandler('mailto') optional by activating at Settings -> General
This commit is contained in:
parent
325197175b
commit
a3d9d98184
40 changed files with 88 additions and 49 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.mailto = ko.observable(!!navigator.registerProtocolHandler);
|
||||
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.hourCycle = LanguageStore.hourCycle;
|
||||
|
|
@ -181,4 +183,14 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
|||
selectLanguage() {
|
||||
showScreenPopup(LanguagesPopupView, [this.language, this.languages(), LanguageStore.userLanguage()]);
|
||||
}
|
||||
|
||||
registerMailto() {
|
||||
navigator.registerProtocolHandler(
|
||||
'mailto',
|
||||
location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s',
|
||||
(SettingsGet('title') || 'SnappyMail')
|
||||
);
|
||||
alert(i18n('GLOBAL/DONE'));
|
||||
this.mailto(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue