@floomhq/floom 1.0.43 → 1.0.44

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.
Files changed (2) hide show
  1. package/dist/login.js +35 -0
  2. package/package.json +1 -1
package/dist/login.js CHANGED
@@ -107,6 +107,31 @@ function waitForCallback(port) {
107
107
  res.end();
108
108
  return;
109
109
  }
110
+ if (req.method === "GET" && req.url?.startsWith("/cli-callback?")) {
111
+ try {
112
+ const data = parseCallbackQuery(req.url);
113
+ if (!data.access_token || !data.refresh_token) {
114
+ res.writeHead(400, {
115
+ "content-type": "text/html; charset=utf-8",
116
+ });
117
+ res.end(localCallbackPage("Missing tokens from OAuth response."));
118
+ return;
119
+ }
120
+ res.writeHead(200, {
121
+ "content-type": "text/html; charset=utf-8",
122
+ "referrer-policy": "no-referrer",
123
+ });
124
+ res.end(localCallbackPage("Signed in. You can close this tab."));
125
+ settled = true;
126
+ cleanup();
127
+ resolve(data);
128
+ }
129
+ catch {
130
+ res.writeHead(400, { "content-type": "text/html; charset=utf-8" });
131
+ res.end(localCallbackPage("Invalid OAuth response."));
132
+ }
133
+ return;
134
+ }
110
135
  if (req.method === "POST" && req.url === "/cli-callback") {
111
136
  let body = "";
112
137
  req.on("data", (chunk) => { body += chunk.toString("utf8"); });
@@ -170,6 +195,16 @@ function waitForCallback(port) {
170
195
  });
171
196
  });
172
197
  }
198
+ function parseCallbackQuery(url) {
199
+ const parsed = new URL(url, "http://127.0.0.1");
200
+ const result = {};
201
+ for (const key of ["access_token", "refresh_token", "expires_in", "token_type"]) {
202
+ const value = parsed.searchParams.get(key);
203
+ if (value)
204
+ result[key] = value;
205
+ }
206
+ return result;
207
+ }
173
208
  function parseCallbackBody(body, contentType) {
174
209
  const type = Array.isArray(contentType) ? contentType.join(";") : contentType ?? "";
175
210
  if (type.includes("application/x-www-form-urlencoded")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floomhq/floom",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "Sync AI skills across agents and machines.",
5
5
  "license": "MIT",
6
6
  "type": "module",