1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-14 02:08:50 +02:00

more preprocessing for self host

This commit is contained in:
Kyle Spearrin 2017-08-15 10:05:39 -04:00
parent 635caa9ad0
commit 4d25077108
7 changed files with 66 additions and 11 deletions

View File

@ -6,9 +6,11 @@
'ui.bootstrap.showErrors',
'toastr',
'angulartics',
// @if !selfHosted
'angulartics.google.analytics',
'angular-stripe',
'credit-cards',
// @endif
'angular-promise-polyfill',
'bit.directives',

View File

@ -2,7 +2,11 @@ angular
.module('bit')
.config(function ($stateProvider, $urlRouterProvider, $httpProvider, jwtInterceptorProvider, jwtOptionsProvider,
$uibTooltipProvider, toastrConfig, $locationProvider, $qProvider, stripeProvider, appSettings) {
$uibTooltipProvider, toastrConfig, $locationProvider, $qProvider, appSettings
// @if !selfHosted
, stripeProvider
// @endif
) {
angular.extend(appSettings, window.bitwardenAppSettings);
$qProvider.errorOnUnhandledRejections(false);
@ -37,7 +41,9 @@ angular
return refreshPromise;
};
// @if !selfHosted
stripeProvider.setPublishableKey(appSettings.stripeKey);
// @endif
angular.extend(toastrConfig, {
closeButton: true,

View File

@ -1,8 +1,12 @@
angular
.module('bit.organization')
.controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, stripe,
$analytics, toastr, existingPaymentMethod) {
.controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService,
$analytics, toastr, existingPaymentMethod
// @if !selfHosted
, stripe
// @endif
) {
$analytics.eventTrack('organizationBillingChangePaymentController', { category: 'Modal' });
$scope.existingPaymentMethod = existingPaymentMethod;
$scope.paymentMethod = 'card';

View File

@ -1,8 +1,12 @@
angular
.module('bit.organization')
.controller('settingsBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, stripe,
$analytics, toastr, existingPaymentMethod, appSettings, $timeout) {
.controller('settingsBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService,
$analytics, toastr, existingPaymentMethod, appSettings, $timeout
// @if !selfHosted
, stripe
// @endif
) {
$analytics.eventTrack('settingsBillingChangePaymentController', { category: 'Modal' });
$scope.existingPaymentMethod = existingPaymentMethod;
$scope.paymentMethod = 'card';

View File

@ -2,7 +2,11 @@
.module('bit.settings')
.controller('settingsCreateOrganizationController', function ($scope, $state, apiService, cryptoService,
toastr, $analytics, authService, stripe, constants, appSettings, validationService) {
toastr, $analytics, authService, constants, appSettings, validationService
// @if !selfHosted
, stripe
// @endif
) {
$scope.plans = constants.plans;
$scope.storageGb = constants.storageGb;
$scope.paymentMethod = 'card';

View File

@ -1,8 +1,12 @@
angular
.module('bit.settings')
.controller('settingsPremiumController', function ($scope, $state, apiService, toastr, $analytics, authService, stripe,
constants, $timeout, appSettings, validationService) {
.controller('settingsPremiumController', function ($scope, $state, apiService, toastr, $analytics, authService,
constants, $timeout, appSettings, validationService
// @if !selfHosted
, stripe
// @endif
) {
authService.getUserProfile().then(function (profile) {
if (profile.premium) {
return $state.go('backend.user.settingsBilling');

View File

@ -2,6 +2,7 @@
<html ng-app="bit" ng-csp>
<head>
<meta charset="utf-8" />
<!-- @if !selfHosted -->
<meta http-equiv="Content-Security-Policy" content="
default-src
'self';
@ -48,20 +49,48 @@
https://*.duosecurity.com;
connect-src
*;">
<!-- @endif -->
<!-- @if selfHosted !>
<meta http-equiv="Content-Security-Policy" content="
default-src
'self';
style-src
'self'
'unsafe-inline'
https://fonts.googleapis.com;
img-src
'self'
data:
https://haveibeenpwned.com
https://chart.googleapis.com;
font-src
'self'
https://fonts.gstatic.com;
child-src
'self'
https://*.duosecurity.com;
frame-src
'self'
https://*.duosecurity.com;
connect-src
*;">
<!-- @endif -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<base href="/" />
<title page-title>bitwarden.com Password Manager</title>
<!-- @if !selfHosted !>
<!-- @if !selfHosted -->
<script src="https://js.stripe.com/v2/"></script>
<script src="https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js"></script>
<!-- @endif -->
<!-- @if true !>
<!-- @if !selfHosted !>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<!-- @endif -->
<!-- @if true !>
<meta name="x-stylesheet-test" content="" class="fa invisible" />
<script src="js/fallback-styles.min.js?v=<!-- @echo cacheTag !>"></script>
@ -79,13 +108,15 @@
'control-sidebar-open': main.usingControlSidebar && main.openControlSidebar}">
<div ui-view></div>
<!-- @if true !>
<!-- @if !selfHosted !>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"
integrity="sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.3/angular.min.js"
integrity="sha384-AH/e+s4V4kUifvnNED2x1XZqArO5qTFU4YKRzUXbz4IgPG1H0Xmz6fP1XUmO4vT/" crossorigin="anonymous"></script>
<!-- @endif -->
<!-- @if true !>
<script src="js/fallback-scripts.min.js?v=<!-- @echo cacheTag !>"></script>
<script src="js/settings.js?v=<!-- @echo cacheTag !>"></script>