From c00d2f3763e7949fa2ab931325cadc94e5351f5b Mon Sep 17 00:00:00 2001 From: softsimon Date: Fri, 21 Jun 2024 19:32:25 +0900 Subject: [PATCH] Hack networkMatches --- frontend/src/app/services/state.service.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/services/state.service.ts b/frontend/src/app/services/state.service.ts index d339e688a..0d502747c 100644 --- a/frontend/src/app/services/state.service.ts +++ b/frontend/src/app/services/state.service.ts @@ -206,8 +206,6 @@ export class StateService { this.env.MINING_DASHBOARD = false; } - this.network = this.env.ROOT_NETWORK; - if (this.isBrowser) { this.setNetworkBasedonUrl(window.location.pathname); this.setLightningBasedonUrl(window.location.pathname); @@ -331,7 +329,12 @@ export class StateService { // (?:preview\/)? optional "preview" prefix (non-capturing) // (testnet|signet)/ network string (captured as networkMatches[1]) // ($|\/) network string must end or end with a slash - const networkMatches = url.match(/^\/(?:[a-z]{2}(?:-[A-Z]{2})?\/)?(?:preview\/)?(testnet4?|signet)($|\/)/); + let networkMatches: object = url.match(/^\/(?:[a-z]{2}(?:-[A-Z]{2})?\/)?(?:preview\/)?(testnet4?|signet)($|\/)/); + + if (!networkMatches && this.env.ROOT_NETWORK) { + networkMatches = { 1: this.env.ROOT_NETWORK }; + } + switch (networkMatches && networkMatches[1]) { case 'signet': if (this.network !== 'signet') { @@ -363,8 +366,8 @@ export class StateService { this.networkChanged$.next(this.env.BASE_MODULE); } } else if (this.network !== '') { - this.network = this.env.ROOT_NETWORK; - this.networkChanged$.next(this.env.ROOT_NETWORK); + this.network = ''; + this.networkChanged$.next(''); } } }