@nicmeriano/spool-server 0.0.2 → 0.0.4
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/bin.js +8 -6
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -115,11 +115,13 @@ function createEventsRoutes(ctx) {
|
|
|
115
115
|
app.post("/app-url", async (c) => {
|
|
116
116
|
const body = await c.req.json();
|
|
117
117
|
console.error(`[spool] Received app URL: ${body.url}`);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
if (!ctx.noOpen) {
|
|
119
|
+
const host = c.req.header("host") || "localhost:3142";
|
|
120
|
+
const shellUrl = `http://${host}`;
|
|
121
|
+
console.error(`[spool] Opening ${shellUrl}`);
|
|
122
|
+
const cmd = platform() === "darwin" ? "open" : platform() === "win32" ? "start" : "xdg-open";
|
|
123
|
+
execFile(cmd, [shellUrl]);
|
|
124
|
+
}
|
|
123
125
|
let state = ctx.getState();
|
|
124
126
|
state = { ...state, appUrl: body.url };
|
|
125
127
|
ctx.setState(state);
|
|
@@ -2050,7 +2052,7 @@ async function startServer(options = {}) {
|
|
|
2050
2052
|
}
|
|
2051
2053
|
}
|
|
2052
2054
|
}));
|
|
2053
|
-
app.route("/api", createEventsRoutes(routeCtx));
|
|
2055
|
+
app.route("/api", createEventsRoutes({ ...routeCtx, noOpen: options.noOpen ?? false }));
|
|
2054
2056
|
app.route("/api/annotations", createAnnotationsRoutes(routeCtx));
|
|
2055
2057
|
app.route("/api/changes", createChangesRoutes(routeCtx));
|
|
2056
2058
|
app.route("/api/tasks", createTasksRoutes(routeCtx));
|