@csdwd/ai-teams-server 0.1.1 → 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 +5 -0
- 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" });
|
package/package.json
CHANGED