self host builds
This commit is contained in:
parent
d509637623
commit
c5d575b9b6
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit f5287e29a2a135c131d00c4a56a90b18bc4afaab
|
||||
Subproject commit 20622db73c5c2a56777944bb06f32a21bf2e763f
|
|
@ -10,6 +10,10 @@
|
|||
"build:watch": "webpack-serve --config webpack.config.js",
|
||||
"build:prod": "cross-env NODE_ENV=production webpack --config webpack.config.js",
|
||||
"build:prod:watch": "cross-env NODE_ENV=production webpack-serve --config webpack.config.js",
|
||||
"build:selfhost": "cross-env SELF_HOST=true webpack-serve --config webpack.config.js",
|
||||
"build:selfhost:watch": "cross-env SELF_HOST=true webpack-serve --config webpack.config.js",
|
||||
"build:selfhost:prod": "cross-env SELF_HOST=true NODE_ENV=production webpack --config webpack.config.js",
|
||||
"build:selfhost:prod:watch": "cross-env SELF_HOST=true NODE_ENV=production webpack-serve --config webpack.config.js",
|
||||
"dist": "npm run build:prod && gulp dist",
|
||||
"lint": "tslint src/**/*.ts || true",
|
||||
"lint:fix": "tslint src/**/*.ts --fix"
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
</h1>
|
||||
</div>
|
||||
<app-premium *ngIf="!premium" (onPremiumPurchased)="load()"></app-premium>
|
||||
<ng-container *ngIf="premium">
|
||||
<i class="fa fa-spinner fa-spin text-muted" *ngIf="!firstLoaded && loading"></i>
|
||||
<ng-container *ngIf="billing">
|
||||
<i class="fa fa-spinner fa-spin text-muted" *ngIf="premium && !firstLoaded && loading"></i>
|
||||
<ng-container *ngIf="premium && billing">
|
||||
<app-callout type="warning" title="{{'canceled' | i18n}}" *ngIf="subscription.cancelled">{{'subscriptionCanceled' | i18n}}</app-callout>
|
||||
<app-callout type="warning" title="{{'pendingCancellation' | i18n}}" *ngIf="subscriptionMarkedForCancel">
|
||||
<p>{{'subscriptionPendingCanceled' | i18n}}</p>
|
||||
|
@ -19,7 +18,12 @@
|
|||
<span>{{'reinstateSubscription' | i18n}}</span>
|
||||
</button>
|
||||
</app-callout>
|
||||
<div class="row">
|
||||
<dl *ngIf="selfHosted">
|
||||
<dt>{{'expiration' | i18n}}</dt>
|
||||
<dd *ngIf="billing.expiration">{{billing.expiration | date:'mediumDate'}}</dd>
|
||||
<dd *ngIf="!billing.expiration">{{'neverExpires' | i18n}}</dd>
|
||||
</dl>
|
||||
<div class="row" *ngIf="!selfHosted">
|
||||
<div class="col-4">
|
||||
<dl>
|
||||
<dt>{{'status' | i18n}}</dt>
|
||||
|
@ -28,8 +32,8 @@
|
|||
<span class="badge badge-warning" *ngIf="subscriptionMarkedForCancel">{{'pendingCancellation' | i18n}}</span>
|
||||
</dd>
|
||||
<dt>{{'nextCharge' | i18n}}</dt>
|
||||
<dd>{{nextInvoice ? ((nextInvoice.date | date: 'mediumDate') + ', ' + (nextInvoice.amount | currency:'$'))
|
||||
: '-'}}</dd>
|
||||
<dd>{{nextInvoice ? ((nextInvoice.date | date: 'mediumDate') + ', ' + (nextInvoice.amount | currency:'$')) :
|
||||
'-'}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
|
@ -48,9 +52,18 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<ng-container *ngIf="selfHosted">
|
||||
<button type="button" class="btn btn-outline-secondary" (click)="updateLicense()">
|
||||
{{'updateLicense' | i18n}}
|
||||
</button>
|
||||
<a href="https://vault.bitwarden.com/#/settings/billing" target="_blank" rel="noopener" class="btn btn-outline-secondary">
|
||||
{{'manageSubscription' | i18n}}
|
||||
</a>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!selfHosted">
|
||||
<ng-container *ngIf="!subscription.cancelled || subscriptionMarkedForCancel">
|
||||
<div class="d-flex">
|
||||
<button type="button" class="btn btn-outline-secondary" (click)="license()" *ngIf="!subscription.cancelled">
|
||||
<button type="button" class="btn btn-outline-secondary" (click)="downloadLicense()" *ngIf="!subscription.cancelled">
|
||||
{{'downloadLicense' | i18n}}
|
||||
</button>
|
||||
<button #cancelBtn type="button" class="btn btn-outline-danger btn-submit ml-auto" (click)="cancel()" [appApiAction]="cancelPromise"
|
||||
|
@ -60,7 +73,6 @@
|
|||
</button>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!selfHosted">
|
||||
<h2 class="spaced-header">{{'storage' | i18n}}</h2>
|
||||
<p>{{'subscriptionStorage' | i18n : billing.maxStorageGb : billing.storageName || '0 MB'}}</p>
|
||||
<div class="progress">
|
||||
|
@ -110,4 +122,3 @@
|
|||
<small class="text-muted">* {{'chargesStatement' | i18n : 'BITWARDEN'}}</small>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
|
|
@ -15,8 +15,6 @@ import { TokenService } from 'jslib/abstractions/token.service';
|
|||
|
||||
import { PaymentMethodType } from 'jslib/enums/paymentMethodType';
|
||||
|
||||
import { AdjustStorageComponent } from './adjust-storage.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-billing',
|
||||
templateUrl: 'user-billing.component.html',
|
||||
|
@ -30,13 +28,16 @@ export class UserBillingComponent implements OnInit {
|
|||
showAdjustPayment = false;
|
||||
billing: BillingResponse;
|
||||
paymentMethodType = PaymentMethodType;
|
||||
selfHosted = false;
|
||||
|
||||
cancelPromise: Promise<any>;
|
||||
reinstatePromise: Promise<any>;
|
||||
|
||||
constructor(private tokenService: TokenService, private apiService: ApiService,
|
||||
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
|
||||
private analytics: Angulartics2, private toasterService: ToasterService) { }
|
||||
private analytics: Angulartics2, private toasterService: ToasterService) {
|
||||
this.selfHosted = platformUtilsService.isSelfHost();
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
await this.load();
|
||||
|
@ -96,7 +97,7 @@ export class UserBillingComponent implements OnInit {
|
|||
} catch { }
|
||||
}
|
||||
|
||||
license() {
|
||||
downloadLicense() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
|
@ -105,6 +106,12 @@ export class UserBillingComponent implements OnInit {
|
|||
this.platformUtilsService.saveFile(window, licenseString, null, 'bitwarden_premium_license.json');
|
||||
}
|
||||
|
||||
updateLicense() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
adjustStorage(add: boolean) {
|
||||
this.adjustStorageAdd = add;
|
||||
this.showAdjustStorage = true;
|
||||
|
|
|
@ -180,6 +180,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
|
|||
return process.env.ENV === 'development';
|
||||
}
|
||||
|
||||
isSelfHost(): boolean {
|
||||
return process.env.SELF_HOST.toString() === 'true';
|
||||
}
|
||||
|
||||
copyToClipboard(text: string, options?: any): void {
|
||||
const doc = options ? options.doc : window.document;
|
||||
if ((window as any).clipboardData && (window as any).clipboardData.setData) {
|
||||
|
|
|
@ -13,6 +13,10 @@ if (process.env.NODE_ENV == null) {
|
|||
}
|
||||
const ENV = process.env.ENV = process.env.NODE_ENV;
|
||||
|
||||
if (process.env.NODE_ENV == null) {
|
||||
process.env.NODE_ENV = 'development';
|
||||
}
|
||||
|
||||
const isVendorModule = (module) => {
|
||||
if (!module.context) {
|
||||
return false;
|
||||
|
@ -104,6 +108,7 @@ const plugins = [
|
|||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
'ENV': JSON.stringify(ENV),
|
||||
'SELF_HOST': JSON.stringify(process.env.SELF_HOST === 'true' ? true : false),
|
||||
'APPLICATION_VERSION': JSON.stringify(pjson.version),
|
||||
'CACHE_TAG': JSON.stringify(Math.random().toString(36).substring(7)),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue