diff --git a/Protest/Front/backup.js b/Protest/Front/backup.js index 542bce34..27ea845b 100644 --- a/Protest/Front/backup.js +++ b/Protest/Front/backup.js @@ -101,7 +101,7 @@ class Backup extends List { this.ListBackup(); } catch (ex) { - this.ConfirmBox(ex, true, "mono/error.svg") + setTimeout(()=>this.ConfirmBox(ex, true, "mono/error.svg"), 250); } }; diff --git a/Protest/Front/certificates.js b/Protest/Front/certificates.js index f2fe1888..6f26f5c5 100644 --- a/Protest/Front/certificates.js +++ b/Protest/Front/certificates.js @@ -136,7 +136,24 @@ class Certificates extends List { setTimeout(()=>nameInput.focus(), 200); - okButton.addEventListener("click", async ()=> { + okButton.onclick = async ()=> { + let requiredFieldMissing = false; + let requiredFields = [nameInput, domainInput]; + + for (let i=0; i - - - - - \ No newline at end of file diff --git a/Protest/Front/reverseproxy.js b/Protest/Front/reverseproxy.js index 26279a13..52fe3970 100644 --- a/Protest/Front/reverseproxy.js +++ b/Protest/Front/reverseproxy.js @@ -20,8 +20,14 @@ class ReverseProxy extends List { this.deleteButton = this.AddToolbarButton("Delete", "mono/delete.svg?light"); this.AddToolbarSeparator(); this.startButton = this.AddToolbarButton("Start", "mono/play.svg?light"); + this.pauseButton = this.AddToolbarButton("Pause", "mono/pause.svg?light"); this.stopButton = this.AddToolbarButton("Stop", "mono/stop.svg?light"); + this.deleteButton.disabled = true; + this.startButton.disabled = true; + this.pauseButton.disabled = true; + this.stopButton.disabled = true; + this.list.style.right = "unset"; this.list.style.width = "min(40%, 480px)"; @@ -112,7 +118,7 @@ class ReverseProxy extends List { innerBox.style.padding = "16px 32px"; innerBox.style.display = "grid"; innerBox.style.gridTemplateColumns = "auto 175px 275px auto"; - innerBox.style.gridTemplateRows = "repeat(7, 38px)"; + innerBox.style.gridTemplateRows = "repeat(8, 38px)"; innerBox.style.alignItems = "center"; let counter = 0; @@ -138,7 +144,7 @@ class ReverseProxy extends List { return input; }; - const nameInput = AddParameter("Name", "input", "text"); + const nameInput = AddParameter("Name", "input", "text"); const protocolInput = AddParameter("Protocol", "select", null); for (const protocol of ["TCP", "UDP", "HTTP", "HTTPS"]) { @@ -170,6 +176,13 @@ class ReverseProxy extends List { const destinationAddressInput = AddParameter("Destination address", "input", "text", {placeholder: "127.0.0.1"}); const destinationPortInput = AddParameter("Destination port", "input", "number", {"min":1, "max":65535, value:80}); + counter++; + const autostartBox = document.createElement("div"); + autostartBox.style.gridArea = `${counter} / 2 / ${counter} / 4`; + innerBox.append(autostartBox); + + const autostartToggle = this.CreateToggle("Autostart", false, autostartBox); + setTimeout(()=>nameInput.focus(), 200); protocolInput.onchange = ()=> { @@ -177,6 +190,53 @@ class ReverseProxy extends List { }; protocolInput.onchange(); + + okButton.onclick = async ()=> { + let requiredFieldMissing = false; + let requiredFields = [nameInput, listenAddressInput, listenPostInput, destinationAddressInput, destinationPortInput]; + + for (let i=0; ithis.ConfirmBox(ex, true, "mono/error.svg"), 250); + } + + dialog.Close(); + }; } Delete() { diff --git a/Protest/Front/settings.js b/Protest/Front/settings.js index 5cc66c75..55a75f9a 100644 --- a/Protest/Front/settings.js +++ b/Protest/Front/settings.js @@ -163,7 +163,7 @@ class Settings extends Tabs { this.tabsPanel.appendChild(this.zonesList); this.zonesNewButton.onclick = ()=>{ - this.PreviewZone(null); + this.ZoneDialog(null); }; this.zonesRemoveButton.onclick = ()=> { @@ -382,9 +382,7 @@ class Settings extends Tabs { } catch (ex) { dialog.Close(); - setTimeout(()=>{ - this.ConfirmBox(ex, true, "mono/error.svg"); - },250); + setTimeout(()=>this.ConfirmBox(ex, true, "mono/error.svg"), 250); } }; @@ -554,7 +552,7 @@ class Settings extends Tabs { }; element.ondblclick = ()=>{ - this.PreviewZone(json[i]); + this.ZoneDialog(json[i]); }; } } @@ -706,7 +704,7 @@ class Settings extends Tabs { } } - PreviewZone(object=null) { + ZoneDialog(object=null) { const dialog = this.DialogBox("240px"); if (dialog === null) return; @@ -758,7 +756,7 @@ class Settings extends Tabs { trustedToggle.checkbox.checked = object.isTrusted; } - okButton.addEventListener("click", async ()=>{ + okButton.onclick = async()=> { let isNew = object === null; let index = this.zones.indexOf(object); @@ -766,6 +764,23 @@ class Settings extends Tabs { if (index === -1) isNew = true; } + let requiredFieldMissing = false; + let requiredFields = [nameInput, networkInput]; + + for (let i=0; i{ nameInput.focus() }, 200); } @@ -861,7 +877,7 @@ class Settings extends Tabs { sslToggle.checkbox.checked = object.ssl; } - okButton.addEventListener("click", async ()=> { + okButton.onclick = async ()=>{ let isNew = object === null; let index = this.smtpProfiles.indexOf(object); @@ -869,6 +885,23 @@ class Settings extends Tabs { if (index === -1) isNew = true; } + let requiredFieldMissing = false; + let requiredFields = [serverInput, portInput, senderInput, usernameInput, passwordInput]; + + for (let i=0; i{ serverInput.focus() }, 200); } @@ -1115,6 +1149,27 @@ class Settings extends Tabs { if (index === -1) isNew = true; } + let isV3 = versionInput.value == 3; + + let requiredFieldMissing = false; + let requiredFields = isV3 + ? [nameInput, priorityInput, usernameInput, authPasswordInput, privacyPasswordInput] + : [nameInput, priorityInput, communityInput]; + + for (let i=0; i option { font-size: var(--global-font-size); font-family: var(--global-font-family); +} + +@keyframes required { + 0% { background-position: calc(100% + 40px); } + 100% { background-position: calc(100%); } } \ No newline at end of file diff --git a/Protest/Front/watchdog.js b/Protest/Front/watchdog.js index 048ea1ef..739dd9f5 100644 --- a/Protest/Front/watchdog.js +++ b/Protest/Front/watchdog.js @@ -492,38 +492,38 @@ class Watchdog extends Window { okButton.onclick = async ()=> { if (!isNew && this.selected === null) return; - let requiredFilledMissing = false; + let requiredFieldMissing = false; if (targetInput.value.length === 0) { - if (!requiredFilledMissing) targetInput.focus(); + if (!requiredFieldMissing) targetInput.focus(); targetInput.required = true; - requiredFilledMissing = true; + requiredFieldMissing = true; } if (typeInput.value === "TCP" && portInput.value.length === 0) { - if (!requiredFilledMissing) portInput.focus(); + if (!requiredFieldMissing) portInput.focus(); portInput.required = true; - requiredFilledMissing = true; + requiredFieldMissing = true; } if (typeInput.value === "DNS" && portInput.value.length === 0) { - if (!requiredFilledMissing) portInput.focus(); + if (!requiredFieldMissing) portInput.focus(); portInput.required = true; - requiredFilledMissing = true; + requiredFieldMissing = true; } if (typeInput.value === "DNS" && queryInput.value.length === 0) { - if (!requiredFilledMissing) queryInput.focus(); + if (!requiredFieldMissing) queryInput.focus(); queryInput.required = true; - requiredFilledMissing = true; + requiredFieldMissing = true; } if (typeInput.value === "HTTP keyword" && keywordInput.value.length === 0) { - if (!requiredFilledMissing) keywordInput.focus(); + if (!requiredFieldMissing) keywordInput.focus(); keywordInput.required = true; - requiredFilledMissing = true; + requiredFieldMissing = true; } - if (requiredFilledMissing) return; + if (requiredFieldMissing) return; if (nameInput.value.length === 0) { nameInput.value = targetInput.value;