From 2e2c2cff3481b76e137afb4656942c1fafbdf0f6 Mon Sep 17 00:00:00 2001 From: Younes Aassila <47226184+younesaassila@users.noreply.github.com> Date: Fri, 26 May 2023 17:51:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20default=20servers=20editin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/options/options.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/options/options.ts b/src/options/options.ts index ac67dc99..70fba285 100644 --- a/src/options/options.ts +++ b/src/options/options.ts @@ -2,6 +2,7 @@ import $ from "../common/ts/$"; import readFile from "../common/ts/readFile"; import saveFile from "../common/ts/saveFile"; import store from "../store"; +import getDefaultState from "../store/getDefaultState"; import { State } from "../store/types"; import type { KeyOfType } from "../types"; @@ -51,6 +52,7 @@ const importButtonElement = $("#import-button") as HTMLButtonElement; const resetButtonElement = $("#reset-button") as HTMLButtonElement; //#endregion +const DEFAULT_SERVERS = getDefaultState().servers; const DEFAULT_LIST_OPTIONS: ListOptions = Object.freeze({ getAlreadyExistsAlertMessage: text => `'${text}' is already in the list`, getItemPlaceholder: text => `Leave empty to remove '${text}' from the list`, @@ -111,6 +113,8 @@ function main() { }); // Server list const isServerUrlValid = (url: string): AllowedResult => { + if (DEFAULT_SERVERS.includes(url)) + return [false, `'${url}' is a default server URL`]; let Url: URL | undefined; try { Url = new URL(url); @@ -119,8 +123,9 @@ function main() { if ( Url.protocol.endsWith(".ttvlolpro.perfprod.com:") || Url.hostname.endsWith(".ttvlolpro.perfprod.com") - ) + ) { return [false, `'${url}' is a proxy server for TTV LOL PRO v2`]; + } if (Url.protocol !== "https:") return [false, `'${url}' is not a valid HTTPS URL`]; return [true];