From 141789b034abdc718787f345c469f94760165b19 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sat, 27 Aug 2022 20:59:36 +0000 Subject: [PATCH] handle locale & preview in network detection regex --- frontend/src/app/services/state.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/services/state.service.ts b/frontend/src/app/services/state.service.ts index 14d220fa1..b0e018941 100644 --- a/frontend/src/app/services/state.service.ts +++ b/frontend/src/app/services/state.service.ts @@ -153,7 +153,12 @@ export class StateService { if (this.env.BASE_MODULE !== 'mempool' && this.env.BASE_MODULE !== 'liquid') { return; } - const networkMatches = url.match(/^\/(bisq|testnet|liquidtestnet|liquid|signet)/); + // horrible network regex breakdown: + // /^\/ starts with a forward slash... + // (?:[a-z]{2}(?:-[A-Z]{2})?\/)? optional locale prefix (non-capturing) + // (?:preview\/)? optional "preview" prefix (non-capturing) + // (bisq|testnet|liquidtestnet|liquid|signet)/ network string (captured as networkMatches[1]) + const networkMatches = url.match(/^\/(?:[a-z]{2}(?:-[A-Z]{2})?\/)?(?:preview\/)?(bisq|testnet|liquidtestnet|liquid|signet)/); switch (networkMatches && networkMatches[1]) { case 'liquid': if (this.network !== 'liquid') {