Custom branding
This commit is contained in:
@@ -23,7 +23,7 @@ export class EnterpriseService {
|
||||
private stateService: StateService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
) {
|
||||
const subdomain = this.stateService.env.customize.enterprise || this.document.location.hostname.indexOf(this.exclusiveHostName) > -1
|
||||
const subdomain = this.stateService.env.customize?.enterprise || this.document.location.hostname.indexOf(this.exclusiveHostName) > -1
|
||||
&& this.document.location.hostname.split(this.exclusiveHostName)[0] || false;
|
||||
if (subdomain && subdomain.match(/^[A-z0-9-_]+$/)) {
|
||||
this.subdomain = subdomain;
|
||||
@@ -47,16 +47,23 @@ export class EnterpriseService {
|
||||
}
|
||||
|
||||
fetchSubdomainInfo(): void {
|
||||
this.apiService.getEnterpriseInfo$(this.subdomain).subscribe((info) => {
|
||||
if (this.stateService.env.customize?.branding) {
|
||||
const info = this.stateService.env.customize?.branding;
|
||||
this.insertMatomo(info.site_id);
|
||||
this.seoService.setEnterpriseTitle(info.title);
|
||||
this.info$.next(info);
|
||||
},
|
||||
(error) => {
|
||||
if (error.status === 404) {
|
||||
window.location.href = 'https://mempool.space' + window.location.pathname;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.apiService.getEnterpriseInfo$(this.subdomain).subscribe((info) => {
|
||||
this.insertMatomo(info.site_id);
|
||||
this.seoService.setEnterpriseTitle(info.title);
|
||||
this.info$.next(info);
|
||||
},
|
||||
(error) => {
|
||||
if (error.status === 404) {
|
||||
window.location.href = 'https://mempool.space' + window.location.pathname;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
insertMatomo(siteId?: number): void {
|
||||
|
||||
@@ -23,6 +23,13 @@ export interface ILoadingIndicators { [name: string]: number; }
|
||||
export interface Customization {
|
||||
theme: string;
|
||||
enterprise?: string;
|
||||
branding: {
|
||||
name: string;
|
||||
site_id?: number;
|
||||
title: string;
|
||||
img: string;
|
||||
rounded_corner: boolean;
|
||||
},
|
||||
dashboard: {
|
||||
widgets: {
|
||||
component: string;
|
||||
|
||||
Reference in New Issue
Block a user