Kiosk: System Name storage, validation, sync, and sent on license validation
Adds local System Name persistence (trimmed, 1-40) in system_kv, an
injectable sync module with conflict/invalid revert and a pending-sync
flag, a background SystemNameSync worker (retries on boot and on a timer),
and api_client support for PUT /licenses/{key}/system-name plus the
additive systemName field/systemNameStatus on license validation. The
license service sends the stored name and applies the status. Covers
validation, pending retry, and conflict revert with a faked HTTP layer.
This commit is contained in:
@@ -87,4 +87,21 @@ std::string formatLicenseKey(const std::string& sanitized) {
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string trim(const std::string& input) {
|
||||
size_t start = 0;
|
||||
size_t end = input.size();
|
||||
while (start < end && std::isspace(static_cast<unsigned char>(input[start]))) {
|
||||
++start;
|
||||
}
|
||||
while (end > start && std::isspace(static_cast<unsigned char>(input[end - 1]))) {
|
||||
--end;
|
||||
}
|
||||
return input.substr(start, end - start);
|
||||
}
|
||||
|
||||
bool isValidSystemName(const std::string& name) {
|
||||
const std::string trimmed = trim(name);
|
||||
return !trimmed.empty() && trimmed.size() <= SYSTEM_NAME_MAX_LENGTH;
|
||||
}
|
||||
|
||||
} // namespace radiantwave::validation
|
||||
|
||||
Reference in New Issue
Block a user