mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 17:02:17 -05:00
Use regex to parse key server urls from manifest
This commit is contained in:
parent
c6b50d04f6
commit
eb81028123
@ -1,6 +1,5 @@
|
||||
{
|
||||
"name": "whiteout-mail",
|
||||
"version": "0.0.1",
|
||||
"description": "Mail App with integrated OpenPGP encryption.",
|
||||
"author": "Whiteout Networks",
|
||||
"homepage": "https://whiteout.io",
|
||||
|
@ -164,21 +164,18 @@ if (typeof chrome !== 'undefined' && chrome.runtime && chrome.runtime.getManifes
|
||||
}
|
||||
|
||||
function setConfigParams(manifest) {
|
||||
var cfg = exports.config,
|
||||
cloudUrl, keychainUrl;
|
||||
var cfg = exports.config;
|
||||
|
||||
function getUrl(beginsWith) {
|
||||
return _.find(manifest.permissions, function(permission) {
|
||||
return typeof permission === 'string' && permission.indexOf(beginsWith) === 0;
|
||||
}).replace(/\/$/, ''); // remove last '/' from url due to required syntax in manifest
|
||||
}
|
||||
|
||||
// get key server base url
|
||||
cloudUrl = _.find(manifest.permissions, function(permission) {
|
||||
return typeof permission === 'string' && permission.indexOf('https://keys') === 0;
|
||||
});
|
||||
// remove last '/' from url due to required syntax in manifest
|
||||
cfg.cloudUrl = cloudUrl.substring(0, cloudUrl.length - 1);
|
||||
cfg.cloudUrl = getUrl('https://keys');
|
||||
// get keychain server base url
|
||||
keychainUrl = _.find(manifest.permissions, function(permission) {
|
||||
return typeof permission === 'string' && permission.indexOf('https://keychain') === 0;
|
||||
});
|
||||
// remove last '/' from url due to required syntax in manifest
|
||||
cfg.privkeyServerUrl = keychainUrl.substring(0, keychainUrl.length - 1);
|
||||
cfg.privkeyServerUrl = getUrl('https://keychain');
|
||||
// get client ID for OAuth requests
|
||||
cfg.gmail.clientId = manifest.oauth2.client_id;
|
||||
// get the app version
|
||||
|
Loading…
Reference in New Issue
Block a user