Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user