Merge pull request #4746 from mempool/nymkappa/subdomain-cache-buster
[enterprise] implement subdomain logo cache buster
This commit is contained in:
commit
d459e1fae3
@ -16,9 +16,9 @@
|
||||
</ng-container>
|
||||
|
||||
<a class="navbar-brand" [ngClass]="{'dual-logos': subdomain}" [routerLink]="['/' | relativeUrl]" (click)="brandClick($event)">
|
||||
<ng-template [ngIf]="subdomain">
|
||||
<ng-template [ngIf]="subdomain && enterpriseInfo">
|
||||
<div class="subdomain_container">
|
||||
<img [src]="'/api/v1/services/enterprise/images/' + subdomain + '/logo'" class="subdomain_logo">
|
||||
<img [src]="'/api/v1/services/enterprise/images/' + subdomain + '/logo?imageMd5=' + enterpriseInfo.imageMd5" class="subdomain_logo">
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-container *ngIf="{ val: connectionState$ | async } as connectionState">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component, OnInit, Input, ViewChild } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, Input, ViewChild } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Env, StateService } from '../../services/state.service';
|
||||
import { Observable, merge, of } from 'rxjs';
|
||||
import { Observable, merge, of, Subscription } from 'rxjs';
|
||||
import { LanguageService } from '../../services/language.service';
|
||||
import { EnterpriseService } from '../../services/enterprise.service';
|
||||
import { NavigationService } from '../../services/navigation.service';
|
||||
@ -14,7 +14,7 @@ import { ApiService } from '../../services/api.service';
|
||||
templateUrl: './master-page.component.html',
|
||||
styleUrls: ['./master-page.component.scss'],
|
||||
})
|
||||
export class MasterPageComponent implements OnInit {
|
||||
export class MasterPageComponent implements OnInit, OnDestroy {
|
||||
@Input() headerVisible = true;
|
||||
@Input() footerVisibleOverride: boolean | null = null;
|
||||
|
||||
@ -32,6 +32,9 @@ export class MasterPageComponent implements OnInit {
|
||||
user: any = undefined;
|
||||
servicesEnabled = false;
|
||||
menuOpen = false;
|
||||
|
||||
enterpriseInfo: any;
|
||||
enterpriseInfo$: Subscription;
|
||||
|
||||
@ViewChild(MenuComponent)
|
||||
public menuComponent!: MenuComponent;
|
||||
@ -64,6 +67,9 @@ export class MasterPageComponent implements OnInit {
|
||||
this.footerVisible = this.footerVisibleOverride;
|
||||
}
|
||||
});
|
||||
this.enterpriseInfo$ = this.enterpriseService.info$.subscribe(info => {
|
||||
this.enterpriseInfo = info;
|
||||
});
|
||||
|
||||
this.servicesEnabled = this.officialMempoolSpace && this.stateService.env.ACCELERATOR === true && this.stateService.network === '';
|
||||
this.refreshAuth();
|
||||
@ -72,6 +78,12 @@ export class MasterPageComponent implements OnInit {
|
||||
this.menuOpen = isServicesPage && !this.isSmallScreen();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.enterpriseInfo$) {
|
||||
this.enterpriseInfo$.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
collapse(): void {
|
||||
this.navCollapsed = !this.navCollapsed;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import { ApiService } from './api.service';
|
||||
import { SeoService } from './seo.service';
|
||||
import { StateService } from './state.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -11,9 +12,9 @@ import { ActivatedRoute } from '@angular/router';
|
||||
export class EnterpriseService {
|
||||
exclusiveHostName = '.mempool.space';
|
||||
subdomain: string | null = null;
|
||||
info: object = {};
|
||||
statsUrl: string;
|
||||
siteId: number;
|
||||
info$: BehaviorSubject<object> = new BehaviorSubject(null);
|
||||
|
||||
constructor(
|
||||
@Inject(DOCUMENT) private document: Document,
|
||||
@ -47,9 +48,9 @@ export class EnterpriseService {
|
||||
|
||||
fetchSubdomainInfo(): void {
|
||||
this.apiService.getEnterpriseInfo$(this.subdomain).subscribe((info) => {
|
||||
this.info = info;
|
||||
this.insertMatomo(info.site_id);
|
||||
this.seoService.setEnterpriseTitle(info.title);
|
||||
this.info$.next(info);
|
||||
},
|
||||
(error) => {
|
||||
if (error.status === 404) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user