@dnax/core 0.4.8 → 0.5.0
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/app/hono.ts +9 -4
- package/lib/orama/@types.ts +6 -1
- package/lib/orama/index.ts +7 -0
- package/package.json +1 -1
package/app/hono.ts
CHANGED
|
@@ -41,8 +41,11 @@ function HonoInstance(): typeof app {
|
|
|
41
41
|
let session = sessionStorage();
|
|
42
42
|
var token = jwt.getToken("Bearer", c.req.header()["authorization"]) || "";
|
|
43
43
|
var { decode, valid, error } = jwt.verify(token);
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (valid && decode?.studio) {
|
|
45
|
+
// FIX STUDIO INFO
|
|
46
|
+
c.set("_STUDIO_SECRET_KEY_", secretKeyStudio);
|
|
47
|
+
c.set("isStudio", isStudio(secretKeyStudio));
|
|
48
|
+
}
|
|
46
49
|
let _v = {
|
|
47
50
|
token: token || null,
|
|
48
51
|
ip:
|
|
@@ -390,9 +393,10 @@ function HonoInstance(): typeof app {
|
|
|
390
393
|
}
|
|
391
394
|
});
|
|
392
395
|
|
|
393
|
-
app.post("/api/studio", (c, next) => {
|
|
396
|
+
app.post("/api/studio", async (c, next) => {
|
|
394
397
|
let cookie = getCookie(c);
|
|
395
|
-
let
|
|
398
|
+
let body = await c?.req?.json();
|
|
399
|
+
let secretKeyStudio = body?.secret || cookie["_STUDIO_SECRET_KEY_"];
|
|
396
400
|
let canPerform = isStudio(secretKeyStudio);
|
|
397
401
|
let cf = {
|
|
398
402
|
collections: Cfg.collections?.map((c) =>
|
|
@@ -405,6 +409,7 @@ function HonoInstance(): typeof app {
|
|
|
405
409
|
return c.json({
|
|
406
410
|
auth: true,
|
|
407
411
|
data: cf,
|
|
412
|
+
token: jwt.sign({ studio: true }),
|
|
408
413
|
});
|
|
409
414
|
} else {
|
|
410
415
|
c.status(403);
|
package/lib/orama/@types.ts
CHANGED
package/lib/orama/index.ts
CHANGED