feat: lizenz aendern - PATCH /api/v1/licenses/:key

- Aendert max_activations (z.B. -1 unbegrenzt), email, note, expires_at, status.
- Partielles Update, validiert; nur erlaubte Felder. Tests + README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
s4luorth
2026-06-07 15:53:31 +02:00
parent e691b675cd
commit b03f18a794
3 changed files with 57 additions and 0 deletions

View File

@@ -215,6 +215,19 @@ try {
const fuLocal = await admin('POST', '/api/v1/releases/from-url', { product: P, version: '1.2.0', zip_url: 'http://127.0.0.1/a.zip' });
ok('from-url private host → 400', fuLocal.status === 400, JSON.stringify(fuLocal.json));
// ── Modify a license (PATCH) ──
// key1 is max=1 (1 domain bound). Switch it to unlimited and prove it works.
const patch = await admin('PATCH', `/api/v1/licenses/${key1}`, { max_activations: -1 });
ok('patch to unlimited', patch.status === 200 && patch.json.max_activations === -1, JSON.stringify(patch.json));
const extra = await pub('/api/v1/activate', { key: key1, product: P, domain: 'extra.de' });
ok('after unlimited, extra domain activates', extra.json.status === 'valid', JSON.stringify(extra.json));
const patchBad = await admin('PATCH', `/api/v1/licenses/${key1}`, { max_activations: 0 });
ok('patch bad value → 400', patchBad.status === 400, JSON.stringify(patchBad.json));
const patchUnknown = await admin('PATCH', '/api/v1/licenses/ZZZZ-ZZZZ-ZZZZ-ZZZZ', { max_activations: 3 });
ok('patch unknown key → 404', patchUnknown.status === 404, JSON.stringify(patchUnknown.json));
} catch (e) {
console.error(e);
fail++;