Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-02-01 03:46:29 +00:00
parent 2473f3f708
commit 4292c62ad1
8 changed files with 150 additions and 87 deletions

View File

@@ -383,7 +383,11 @@ app.post("/api/licenses/verify", async (req, res) => {
return res.status(404).json({ valid: false, error: "Licentie niet gevonden." });
}
const result = await touchLicenseHostname(license, hostname);
const rawVersion = req.body?.currentVersion ?? req.body?.pluginVersion ?? null;
const pluginVersion =
rawVersion && String(rawVersion).trim().length > 0 ? String(rawVersion).trim().slice(0, 64) : null;
const result = await touchLicenseHostname(license, hostname, { pluginVersion });
if (!result.ok) {
const status = result.conflict ? 403 : 400;
return res.status(status).json({ valid: false, error: result.error, boundHostname: license.primary_hostname });