From 1ea9d28523c6e0b68f2da6b994e9ce665ef2baed Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 16 Dec 2017 22:08:23 -0500 Subject: [PATCH] local api/identity uri paths --- CNAME | 1 - gulpfile.js | 2 +- settings.Preview.json | 6 +++--- settings.Production.json | 6 +++--- src/app/config.js | 22 +++++----------------- src/app/settings.js | 2 +- 6 files changed, 13 insertions(+), 26 deletions(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index f81ee6650e..0000000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -vault.bitwarden.com \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index bf2c2e2f6e..6543b8645f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -465,7 +465,7 @@ gulp.task('deploy-preview', ['dist'], function () { return gulp.src(paths.dist + '**/*') .pipe(ghPages({ cacheDir: paths.dist + '.publish', - remoteUrl: 'git@github.com:kspearrin/bitwarden-web-preview.git' + remoteUrl: 'git@github.com:bitwarden/web-preview.git' })); }); diff --git a/settings.Preview.json b/settings.Preview.json index 27bbd4f845..96706e3ee5 100644 --- a/settings.Preview.json +++ b/settings.Preview.json @@ -1,12 +1,12 @@ { "appSettings": { - "apiUri": "https://preview-api.bitwarden.com", - "identityUri": "https://preview-identity.bitwarden.com", + "apiUri": "/api", + "identityUri": "/identity", "iconsUri": "https://icons.bitwarden.com", "stripeKey": "pk_test_KPoCfZXu7mznb9uSCPZ2JpTD", "braintreeKey": "sandbox_r72q8jq6_9pnxkwm75f87sdc2", "whitelistDomains": [ - "preview-api.bitwarden.com" + "preview-vault.bitwarden.com" ] } } diff --git a/settings.Production.json b/settings.Production.json index 2efa4e442c..52da2d3549 100644 --- a/settings.Production.json +++ b/settings.Production.json @@ -1,12 +1,12 @@ { "appSettings": { - "apiUri": "https://api.bitwarden.com", - "identityUri": "https://identity.bitwarden.com", + "apiUri": "/api", + "identityUri": "/identity", "iconsUri": "https://icons.bitwarden.com", "stripeKey": "pk_live_bpN0P37nMxrMQkcaHXtAybJk", "braintreeKey": "production_qfbsv8kc_njj2zjtyngtjmbjd", "whitelistDomains": [ - "api.bitwarden.com" + "vault.bitwarden.com" ] } } diff --git a/src/app/config.js b/src/app/config.js index 1dca068f86..f24b11c649 100644 --- a/src/app/config.js +++ b/src/app/config.js @@ -14,27 +14,15 @@ angular $qProvider.errorOnUnhandledRejections(false); $locationProvider.hashPrefix(''); - var jwtConfig = { - whiteListedDomains: appSettings.whitelistDomains - }; - - if (!appSettings.selfHosted) { - var userAgent = navigator.userAgent.toLowerCase(); - if (userAgent.indexOf('safari') > -1 && userAgent.indexOf('chrome') === -1) { - // Safari doesn't work with unconventional "Content-Language" header for CORS. - // See notes here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS - jwtConfig.urlParam = 'access_token'; - } - else { - // Using Content-Language header since it is unused and is a CORS-safelisted header. This avoids pre-flights. - jwtConfig.authHeader = 'Content-Language'; - } + if (appSettings.apiUri !== '/api' && appSettings.whitelistDomains && appSettings.whitelistDomains.length) { + jwtOptionsProvider.config({ + whiteListedDomains: appSettings.whitelistDomains + }); } - jwtOptionsProvider.config(jwtConfig); var refreshPromise; jwtInterceptorProvider.tokenGetter = /*@ngInject*/ function (options, tokenService, authService) { - if (options.url.indexOf(appSettings.apiUri) !== 0) { + if (options.url.indexOf(appSettings.apiUri + '/') === -1) { return; } diff --git a/src/app/settings.js b/src/app/settings.js index fecd30d15a..505e183734 100644 --- a/src/app/settings.js +++ b/src/app/settings.js @@ -1,2 +1,2 @@ angular.module("bit") -.constant("appSettings", {"apiUri":"https://api.bitwarden.com","identityUri":"https://identity.bitwarden.com","iconsUri":"https://icons.bitwarden.com","stripeKey":"pk_live_bpN0P37nMxrMQkcaHXtAybJk","braintreeKey":"production_qfbsv8kc_njj2zjtyngtjmbjd","whitelistDomains":["api.bitwarden.com"],"selfHosted":false,"version":"1.21.0","environment":"Production"}); +.constant("appSettings", {"apiUri":"/api","identityUri":"/identity","iconsUri":"https://icons.bitwarden.com","stripeKey":"pk_live_bpN0P37nMxrMQkcaHXtAybJk","braintreeKey":"production_qfbsv8kc_njj2zjtyngtjmbjd","whitelistDomains":["vault.bitwarden.com"],"selfHosted":false,"version":"1.21.0","environment":"Production"});