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",
|
"name": "whiteout-mail",
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "Mail App with integrated OpenPGP encryption.",
|
"description": "Mail App with integrated OpenPGP encryption.",
|
||||||
"author": "Whiteout Networks",
|
"author": "Whiteout Networks",
|
||||||
"homepage": "https://whiteout.io",
|
"homepage": "https://whiteout.io",
|
||||||
|
@ -164,21 +164,18 @@ if (typeof chrome !== 'undefined' && chrome.runtime && chrome.runtime.getManifes
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setConfigParams(manifest) {
|
function setConfigParams(manifest) {
|
||||||
var cfg = exports.config,
|
var cfg = exports.config;
|
||||||
cloudUrl, keychainUrl;
|
|
||||||
|
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
|
// get key server base url
|
||||||
cloudUrl = _.find(manifest.permissions, function(permission) {
|
cfg.cloudUrl = getUrl('https://keys');
|
||||||
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);
|
|
||||||
// get keychain server base url
|
// get keychain server base url
|
||||||
keychainUrl = _.find(manifest.permissions, function(permission) {
|
cfg.privkeyServerUrl = getUrl('https://keychain');
|
||||||
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);
|
|
||||||
// get client ID for OAuth requests
|
// get client ID for OAuth requests
|
||||||
cfg.gmail.clientId = manifest.oauth2.client_id;
|
cfg.gmail.clientId = manifest.oauth2.client_id;
|
||||||
// get the app version
|
// get the app version
|
||||||
|
Loading…
Reference in New Issue
Block a user