Fix XML error format to match legacy PHP responses

This commit is contained in:
Jarvis Prime
2026-03-23 16:53:04 +00:00
parent ef5e27aece
commit d3b4ede8a6
2 changed files with 8 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ function xmlResponse(content) {
} }
function xmlError(message) { function xmlError(message) {
return xmlResponse(`<error>${escXml(message)}</error>`); return xmlResponse(`<errorcode>1</errorcode><errormessage>${escXml(message)}</errormessage>`);
} }
function escXml(s) { function escXml(s) {
@@ -53,7 +53,7 @@ async function handleActivate(request, env) {
const email = parseField(body, 'email') ?? ''; const email = parseField(body, 'email') ?? '';
if (!serial_number || !product || !reg_key) { if (!serial_number || !product || !reg_key) {
return xmlError('Missing required fields'); return xmlError('Invalid XML.');
} }
// Validate product exists // Validate product exists

View File

@@ -1,8 +1,13 @@
name = "cowl-licensing" name = "cowl-licensing"
main = "src/index.js" main = "src/index.js"
compatibility_date = "2024-01-01" compatibility_date = "2024-01-01"
workers_dev = true
routes = [
{ pattern = "licensing.componentowl.com/*", zone_name = "componentowl.com" }
]
[[d1_databases]] [[d1_databases]]
binding = "DB" binding = "DB"
database_name = "cowl-licensing" database_name = "cowl-licensing"
database_id = "TO_BE_FILLED" database_id = "e350cc3b-e83f-49ef-949f-6a7ebbb4a189"