From 6f3f3290d721c5c602e5f22d9f837893db332a04 Mon Sep 17 00:00:00 2001 From: FinnHornhoover Date: Sun, 12 Nov 2023 15:38:33 +0300 Subject: [PATCH] added default ip, regex for version names --- assets/js/server-selector.js | 3 +-- index.html | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/assets/js/server-selector.js b/assets/js/server-selector.js index ad74ffb..057b2a9 100644 --- a/assets/js/server-selector.js +++ b/assets/js/server-selector.js @@ -196,8 +196,7 @@ function validateVersionSave(modalName) { if ( matchingVersions.length > allowedMatches || - nameInput.value.length < parseInt(nameInput.getAttribute("minlength")) || - nameInput.value.length > parseInt(nameInput.getAttribute("maxlength")) + !(new RegExp(nameInput.getAttribute("pattern"))).test(nameInput.value) ) { nameInput.classList.add("invalidinput"); valid = false; diff --git a/index.html b/index.html index 6a7bbbb..92556d3 100644 --- a/index.html +++ b/index.html @@ -266,6 +266,7 @@ type="text" id="addserver-ipinput" placeholder="127.0.0.1:23000" + value="127.0.0.1:23000" required="" pattern="^([-a-zA-Z0-9]+\.)+[-a-zA-Z0-9]+:[0-9]+$" oninput="validateServerSave('add')" @@ -588,8 +589,7 @@ id="addversion-nameinput" placeholder="custom-build-000" required="" - minlength="1" - maxlength="70" + pattern="^[-a-zA-Z0-9_]{1,70}$" oninput="validateVersionSave('add')" />