@podge/cli 0.2.0-beta.5 → 0.2.0-beta.7
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/index.js +7 -1
- package/dist/lib/auth-server.js +14 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18,7 +18,13 @@ const program = new commander_1.Command();
|
|
|
18
18
|
program
|
|
19
19
|
.name("podge")
|
|
20
20
|
.description("Podge CLI — manage workspaces, collections, and search")
|
|
21
|
-
.version(pkg.version);
|
|
21
|
+
.version(pkg.version, "-v, --version");
|
|
22
|
+
program
|
|
23
|
+
.command("version")
|
|
24
|
+
.description("Show the installed CLI version")
|
|
25
|
+
.action(() => {
|
|
26
|
+
console.log(pkg.version);
|
|
27
|
+
});
|
|
22
28
|
(0, auth_1.registerAuthCommands)(program);
|
|
23
29
|
(0, config_1.registerConfigCommands)(program);
|
|
24
30
|
(0, workspaces_1.registerWorkspaceCommands)(program);
|
package/dist/lib/auth-server.js
CHANGED
|
@@ -40,6 +40,20 @@ function startAuthServer(expectedState, timeoutMs = 120000) {
|
|
|
40
40
|
}, timeoutMs);
|
|
41
41
|
server.on("request", (req, res) => {
|
|
42
42
|
const parsed = url.parse(req.url ?? "", true);
|
|
43
|
+
// CORS headers for cross-origin requests from the web app
|
|
44
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
45
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
|
|
46
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
47
|
+
if (req.method === "OPTIONS") {
|
|
48
|
+
res.writeHead(204);
|
|
49
|
+
res.end();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (parsed.pathname === "/state") {
|
|
53
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
54
|
+
res.end(JSON.stringify({ state: expectedState }));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
43
57
|
if (parsed.pathname !== "/callback") {
|
|
44
58
|
res.writeHead(404);
|
|
45
59
|
res.end("Not found");
|