Frontend config support for AU. New absolute server url settings.

refs #104
This commit is contained in:
softsimon
2020-11-23 02:30:46 +07:00
parent bd1440ce96
commit d2cd595da6
16 changed files with 68 additions and 66 deletions

View File

@@ -5,7 +5,6 @@ import { StateService } from 'src/app/services/state.service';
import { Observable } from 'rxjs';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ApiService } from 'src/app/services/api.service';
import { env } from '../../app.constants';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { map } from 'rxjs/operators';
@@ -21,7 +20,7 @@ export class AboutComponent implements OnInit {
donationStatus = 1;
sponsors$: Observable<any>;
donationObj: any;
sponsorsEnabled = env.SPONSORS_ENABLED;
sponsorsEnabled = this.stateService.env.SPONSORS_ENABLED;
sponsors = null;
constructor(

View File

@@ -7,7 +7,6 @@ import { Block, Transaction, Vout } from '../../interfaces/electrs.interface';
import { of, Subscription } from 'rxjs';
import { StateService } from '../../services/state.service';
import { SeoService } from 'src/app/services/seo.service';
import { env } from 'src/app/app.constants';
import { WebsocketService } from 'src/app/services/websocket.service';
@Component({
@@ -31,7 +30,7 @@ export class BlockComponent implements OnInit, OnDestroy {
paginationMaxSize: number;
coinbaseTx: Transaction;
page = 1;
itemsPerPage = env.ELCTRS_ITEMS_PER_PAGE;
itemsPerPage: number;
constructor(
private route: ActivatedRoute,
@@ -47,6 +46,7 @@ export class BlockComponent implements OnInit, OnDestroy {
this.websocketService.want(['blocks', 'mempool-blocks']);
this.paginationMaxSize = window.matchMedia('(max-width: 700px)').matches ? 3 : 5;
this.network = this.stateService.network;
this.itemsPerPage = this.stateService.env.ELECTRS_ITEMS_PER_PAGE;
this.subscription = this.route.paramMap
.pipe(

View File

@@ -3,7 +3,6 @@ import { Subscription } from 'rxjs';
import { Block } from 'src/app/interfaces/electrs.interface';
import { StateService } from 'src/app/services/state.service';
import { Router } from '@angular/router';
import { env } from 'src/app/app.constants';
@Component({
selector: 'app-blockchain-blocks',
@@ -78,7 +77,7 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
this.cd.markForCheck();
}, 50);
if (this.blocks.length === env.KEEP_BLOCKS_AMOUNT) {
if (this.blocks.length === this.stateService.env.KEEP_BLOCKS_AMOUNT) {
this.blocksFilled = true;
}
this.cd.markForCheck();

View File

@@ -1,6 +1,5 @@
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { StateService } from '../../services/state.service';
import { env } from 'src/app/app.constants';
import { Component, OnInit } from '@angular/core';
import { Env, StateService } from '../../services/state.service';
import { Observable, merge, of } from 'rxjs';
@Component({
@@ -9,7 +8,7 @@ import { Observable, merge, of } from 'rxjs';
styleUrls: ['./master-page.component.scss'],
})
export class MasterPageComponent implements OnInit {
env = env;
env: Env;
network$: Observable<string>;
connectionState$: Observable<number>;
navCollapsed = false;
@@ -20,6 +19,7 @@ export class MasterPageComponent implements OnInit {
) { }
ngOnInit() {
this.env = this.stateService.env;
this.connectionState$ = this.stateService.connectionState$;
this.network$ = merge(of(''), this.stateService.networkChanged$);
}

View File

@@ -5,7 +5,6 @@ import { switchMap, map, tap, filter } from 'rxjs/operators';
import { MempoolBlock } from 'src/app/interfaces/websocket.interface';
import { Observable, BehaviorSubject } from 'rxjs';
import { SeoService } from 'src/app/services/seo.service';
import { env } from 'src/app/app.constants';
import { WebsocketService } from 'src/app/services/websocket.service';
@Component({
@@ -70,7 +69,7 @@ export class MempoolBlockComponent implements OnInit, OnDestroy {
const blocksInBlock = Math.ceil(mempoolBlock.blockVSize / 1000000);
if (this.mempoolBlockIndex === 0) {
return 'Next block';
} else if (this.mempoolBlockIndex === env.KEEP_BLOCKS_AMOUNT - 1 && blocksInBlock > 1 ) {
} else if (this.mempoolBlockIndex === this.stateService.env.KEEP_BLOCKS_AMOUNT - 1 && blocksInBlock > 1 ) {
return `Stack of ${blocksInBlock} blocks`;
} else {
const s = ['th', 'st', 'nd', 'rd'];