diff options
author | Christopher Gurnee <chris@gurneeconsulting.net> | 2020-04-24 02:24:09 +0300 |
---|---|---|
committer | Christopher Gurnee <chris@gurneeconsulting.net> | 2020-06-02 23:55:03 +0300 |
commit | 7f64384bfb391bd800382f9c1bfaac09cad19233 (patch) | |
tree | 880c2bd29173e6463e552c5a932eae01e6fee6fe | |
parent | cec240d2b92a25ae1b37e32cb68b7978d43896a3 (diff) |
Avoid initializing Mailvelope if we don't need to
-rw-r--r-- | program/js/app.js | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/program/js/app.js b/program/js/app.js index ddc9d756a..0c0cee012 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -347,6 +347,8 @@ function rcube_webmail() dt.setData('roundcube-name', n.text().trim()); } }); + + this.check_mailvelope(this.env.action); } else if (this.env.action == 'compose') { this.env.address_group_stack = []; @@ -395,6 +397,8 @@ function rcube_webmail() // init message compose form this.init_messageform(); + + this.check_mailvelope(this.env.action); } else if (this.env.action == 'bounce') { this.init_messageform_inputs(); @@ -431,11 +435,12 @@ function rcube_webmail() ); }); } - // show printing dialog - else if (this.env.action == 'print' && this.env.uid - && !this.env.is_pgp_content && !this.env.pgp_mime_part - ) { - this.print_dialog(); + // show printing dialog unless decryption must be done first + else if (this.env.action == 'print' && this.env.uid) { + this.check_mailvelope(this.env.action); + if (!this.env.is_pgp_content && !this.env.pgp_mime_part) { + this.print_dialog(); + } } // get unread count for each mailbox @@ -485,8 +490,6 @@ function rcube_webmail() this.http_post(postact, postdata); } - this.check_mailvelope(this.env.action); - // detect browser capabilities if (!this.is_framed() && !this.env.extwin) this.browser_capabilities_check(); @@ -567,7 +570,9 @@ function rcube_webmail() // initialize HTML editor this.editor_init(this.env.editor_config, 'rcmfd_signature'); - this.check_mailvelope(this.env.action); + if (this.env.action == 'edit-identity') { + this.check_mailvelope(this.env.action); + } } else if (this.env.action == 'folders') { this.enable_command('subscribe', 'unsubscribe', 'create-folder', 'rename-folder', true); @@ -3706,9 +3711,6 @@ function rcube_webmail() // Load Mailvelope functionality (and initialize keyring if needed) this.mailvelope_load = function(action) { - if (this.env.browser_capabilities) - this.env.browser_capabilities['pgpmime'] = 1; - var keyring = this.env.user_id, fn = function(kr) { ref.mailvelope_keyring = kr; @@ -9908,7 +9910,7 @@ function rcube_webmail() if (!this.env.browser_capabilities) this.env.browser_capabilities = {}; - $.each(['pdf', 'flash', 'tiff', 'webp'], function() { + $.each(['pdf', 'flash', 'tiff', 'webp', 'pgpmime'], function() { if (ref.env.browser_capabilities[this] === undefined) ref.env.browser_capabilities[this] = ref[this + '_support_check'](); }); @@ -10017,6 +10019,19 @@ function rcube_webmail() return 0; }; + // check for mailvelope API + this.pgpmime_support_check = function(action) + { + if (typeof window.mailvelope !== 'undefined') + return 1; + + $(window).on('mailvelope', function() { + ref.env.browser_capabilities['pgpmime'] = 1; + }); + + return 0; + }; + this.assets_path = function(path) { if (this.env.assets_path && !path.startsWith(this.env.assets_path)) { |