fix: verified-against-live Core v2.3.3 shapes
- login: {type: LoginLocalUser, params} + data.jwt extraction
- inspect: server-scoped objects use {server, container|image|network|volume}
- search_logs: terms array + per-type params (deployment/container/stack/swarm_service)
Verified via 15-test read-only pass against 10.10.2.114:9120
This commit is contained in:
+13
-3
@@ -47,9 +47,13 @@ export class KomodoClient {
|
||||
const res = await fetch(`${this.baseUrl}/auth/login`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
// Komodo Core v2.3.3 login shape (verified live): {type, params}
|
||||
body: JSON.stringify({
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
type: "LoginLocalUser",
|
||||
params: {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
},
|
||||
}),
|
||||
signal: AbortSignal.timeout(30000),
|
||||
});
|
||||
@@ -57,7 +61,13 @@ export class KomodoClient {
|
||||
const text = await res.text().catch(() => "");
|
||||
throw new Error(`Komodo login failed (${res.status}): ${text}`);
|
||||
}
|
||||
this.token = await res.text();
|
||||
// Response shape: {type, data: {jwt}} — NOT raw text
|
||||
const body = (await res.json()) as { data?: { jwt?: string } };
|
||||
const jwt = body?.data?.jwt;
|
||||
if (!jwt) {
|
||||
throw new Error(`Komodo login succeeded but no data.jwt in response`);
|
||||
}
|
||||
this.token = jwt;
|
||||
}
|
||||
|
||||
async rpc(
|
||||
|
||||
Reference in New Issue
Block a user