From: Alexander Ebert Date: Thu, 3 Aug 2023 11:40:42 +0000 (+0200) Subject: Prevent parallel executions of the store code installation X-Git-Tag: 6.0.0_Beta_1~14^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b81286ed0fdef2ff9f0f95cdd077fb37ed406173;p=GitHub%2FWoltLab%2FWCF.git Prevent parallel executions of the store code installation See https://www.woltlab.com/community/thread/300905/ --- diff --git a/ts/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.ts b/ts/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.ts index 0580d742b4..f2fe2f15c1 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.ts @@ -35,6 +35,10 @@ type Response = function detectCode(): void { const value = codeInput.value.trim(); + if (value === "") { + innerError(codeInput, false); + return; + } let isValid = false; if (value.startsWith("WoltLab_StoreCode_Do_Not_Share_")) { @@ -136,20 +140,7 @@ export function setup(): void { void refreshPackageDatabase(); }); - codeInput.addEventListener("keydown", (event) => { - if (event.key === "Enter") { - event.preventDefault(); - - detectCode(); - } - }); - - codeInput.addEventListener("paste", (event) => { - event.preventDefault(); - - const value = event.clipboardData!.getData("text/plain"); - codeInput.value = value; - + codeInput.addEventListener("input", () => { detectCode(); }); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.js index e522eea04b..821c1edd77 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Package/QuickInstallation.js @@ -17,6 +17,10 @@ define(["require", "exports", "tslib", "../../../Ajax", "../../../Ajax/Status", let codeInput; function detectCode() { const value = codeInput.value.trim(); + if (value === "") { + (0, Util_1.innerError)(codeInput, false); + return; + } let isValid = false; if (value.startsWith("WoltLab_StoreCode_Do_Not_Share_")) { const decodedValue = window.atob(value.replace(/^WoltLab_StoreCode_Do_Not_Share_/, "")); @@ -107,16 +111,7 @@ define(["require", "exports", "tslib", "../../../Ajax", "../../../Ajax/Status", // pasting the StoreCode into the input. void refreshPackageDatabase(); }); - codeInput.addEventListener("keydown", (event) => { - if (event.key === "Enter") { - event.preventDefault(); - detectCode(); - } - }); - codeInput.addEventListener("paste", (event) => { - event.preventDefault(); - const value = event.clipboardData.getData("text/plain"); - codeInput.value = value; + codeInput.addEventListener("input", () => { detectCode(); }); }