dynamoi 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dynamoi.js +6 -21
- package/package.json +1 -1
package/dist/dynamoi.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var package_default = {
|
|
4
4
|
$schema: "https://www.schemastore.org/package",
|
|
5
5
|
name: "dynamoi",
|
|
6
|
-
version: "0.2.
|
|
6
|
+
version: "0.2.9",
|
|
7
7
|
type: "module",
|
|
8
8
|
license: "MIT",
|
|
9
9
|
description: "Music promotion and distribution, built for AI agents: the Dynamoi command line.",
|
|
@@ -312,7 +312,7 @@ function callbackPage(ok) {
|
|
|
312
312
|
"Go back to your terminal and run <code>dynamoi login</code> again.",
|
|
313
313
|
ALERT
|
|
314
314
|
];
|
|
315
|
-
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title} · Dynamoi</title><style>${STYLE}</style></head><body><main><div class="lockup">${BLOOM}<span class="word">dynamoi</span></div><div class="status">${icon}</div><h1>${title}</h1><p>${body}</p><footer><a href="https://dynamoi.com">dynamoi.com</a></footer></main></body></html>`;
|
|
315
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="text-scale" content="scale"><title>${title} · Dynamoi</title><style>${STYLE}</style></head><body><main><div class="lockup">${BLOOM}<span class="word">dynamoi</span></div><div class="status">${icon}</div><h1>${title}</h1><p>${body}</p><footer><a href="https://dynamoi.com">dynamoi.com</a></footer></main></body></html>`;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
// src/store.ts
|
|
@@ -433,6 +433,7 @@ async function clearCredentials() {
|
|
|
433
433
|
// src/oauth.ts
|
|
434
434
|
var BASE_URL = "https://dynamoi.com";
|
|
435
435
|
var MCP_URL = `${BASE_URL}/mcp`;
|
|
436
|
+
var CLIENT_ID = "https://dynamoi.com/api/oauth/clients/dynamoi-cli";
|
|
436
437
|
var b64url = (bytes) => bytes.toString("base64url");
|
|
437
438
|
async function jsonBody(response) {
|
|
438
439
|
try {
|
|
@@ -517,26 +518,10 @@ async function login(print, open = openBrowser) {
|
|
|
517
518
|
const { port, result } = await listenForRedirect(state);
|
|
518
519
|
const redirectUri = `http://127.0.0.1:${port}/callback`;
|
|
519
520
|
const scope = (meta.scopes_supported ?? []).join(" ");
|
|
520
|
-
const registration = await fetch(meta.registration_endpoint, {
|
|
521
|
-
body: JSON.stringify({
|
|
522
|
-
client_name: "Dynamoi CLI",
|
|
523
|
-
grant_types: ["authorization_code", "refresh_token"],
|
|
524
|
-
redirect_uris: [redirectUri],
|
|
525
|
-
response_types: ["code"],
|
|
526
|
-
scope,
|
|
527
|
-
token_endpoint_auth_method: "none"
|
|
528
|
-
}),
|
|
529
|
-
headers: { "content-type": "application/json" },
|
|
530
|
-
method: "POST"
|
|
531
|
-
});
|
|
532
|
-
const client = await jsonBody(registration);
|
|
533
|
-
if (!(registration.ok && client.client_id)) {
|
|
534
|
-
throw new Error(`Could not register the CLI (HTTP ${registration.status}).`);
|
|
535
|
-
}
|
|
536
521
|
const verifier = b64url(randomBytes(32));
|
|
537
522
|
const authorize = new URL(meta.authorization_endpoint);
|
|
538
523
|
authorize.search = new URLSearchParams({
|
|
539
|
-
client_id:
|
|
524
|
+
client_id: CLIENT_ID,
|
|
540
525
|
code_challenge: b64url(createHash("sha256").update(verifier).digest()),
|
|
541
526
|
code_challenge_method: "S256",
|
|
542
527
|
redirect_uri: redirectUri,
|
|
@@ -559,14 +544,14 @@ ${authorize}`);
|
|
|
559
544
|
throw new Error("Sign-in response came from an unexpected issuer.");
|
|
560
545
|
}
|
|
561
546
|
const token = await postForm(meta.token_endpoint, {
|
|
562
|
-
client_id:
|
|
547
|
+
client_id: CLIENT_ID,
|
|
563
548
|
code,
|
|
564
549
|
code_verifier: verifier,
|
|
565
550
|
grant_type: "authorization_code",
|
|
566
551
|
redirect_uri: redirectUri,
|
|
567
552
|
resource: MCP_URL
|
|
568
553
|
});
|
|
569
|
-
const credentials = toCredentials(token,
|
|
554
|
+
const credentials = toCredentials(token, CLIENT_ID);
|
|
570
555
|
await saveCredentials(credentials);
|
|
571
556
|
return credentials;
|
|
572
557
|
}
|
package/package.json
CHANGED