@csdwd/ai-teams-server 0.1.0 → 0.1.2
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 +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1897,10 +1897,15 @@ async function createAiTeamsServer(options) {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
return { employeeId, workspace, activeSessionId, sessions };
|
|
1899
1899
|
}
|
|
1900
|
+
const staticExts = /* @__PURE__ */ new Set([".html", ".js", ".css", ".ico", ".png", ".jpg", ".svg", ".woff", ".woff2", ".ttf", ".map"]);
|
|
1900
1901
|
app.addHook("preHandler", async (request, reply) => {
|
|
1901
1902
|
if (request.url.startsWith("/ws/") || request.url.startsWith("/docs")) {
|
|
1902
1903
|
return;
|
|
1903
1904
|
}
|
|
1905
|
+
const ext = path.extname(request.url.split("?")[0]);
|
|
1906
|
+
if (request.url === "/" || staticExts.has(ext)) {
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1904
1909
|
if (!isAuthorized(options.authToken, request.url, request.headers)) {
|
|
1905
1910
|
app.log.warn({ url: request.url, ip: request.ip }, "Unauthorized request");
|
|
1906
1911
|
await reply.code(401).send({ error: "unauthorized" });
|
|
@@ -2306,7 +2311,7 @@ async function startServer(options = readOptionsFromEnv()) {
|
|
|
2306
2311
|
await server.app.listen({ port: options.port ?? DEFAULT_PORT, host: options.host ?? "0.0.0.0" });
|
|
2307
2312
|
return server;
|
|
2308
2313
|
}
|
|
2309
|
-
var isCli = process.argv[1] === fileURLToPath(import.meta.url);
|
|
2314
|
+
var isCli = process.argv[1] && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
2310
2315
|
if (isCli) {
|
|
2311
2316
|
let getArgValue = function(name) {
|
|
2312
2317
|
const idx = args.indexOf(name);
|
package/package.json
CHANGED