@dnax/core 0.10.1 → 0.10.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/app/hono.ts +10 -7
- package/package.json +1 -1
package/app/hono.ts
CHANGED
|
@@ -75,9 +75,10 @@ function HonoInstance(): typeof app {
|
|
|
75
75
|
if (typeof Cfg?.server?.logger == "boolean" && Cfg?.server?.logger) {
|
|
76
76
|
app.use(async (c, next) => {
|
|
77
77
|
let ip =
|
|
78
|
-
c.req.
|
|
79
|
-
c.req.
|
|
80
|
-
c.req.
|
|
78
|
+
c.req.header("cf-connecting-ip") ||
|
|
79
|
+
c.req.header("x-forwarded-for") ||
|
|
80
|
+
c.req.header("x-client-ip") ||
|
|
81
|
+
c.req.header("x-forwarded-for");
|
|
81
82
|
const origin =
|
|
82
83
|
c.req?.header("Origin") || c.req.raw?.headers?.get("Origin") || "";
|
|
83
84
|
const info = getConnInfo(c);
|
|
@@ -145,6 +146,11 @@ function HonoInstance(): typeof app {
|
|
|
145
146
|
//eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoibm9tIiwiaWF0IjoxNzE3Nzc0MDQzLCJleHAiOjE3MTc3NzQxMDN9.Ud4-0y8pa4SMIcSn8PU1A-sjC-hT4ZVe_u3AdChyIJU
|
|
146
147
|
// Middlewares Injection
|
|
147
148
|
app.use(async (c, next) => {
|
|
149
|
+
let IP_ =
|
|
150
|
+
c.req.header("cf-connecting-ip") ||
|
|
151
|
+
c.req.header("x-forwarded-for") ||
|
|
152
|
+
c.req.header("x-client-ip") ||
|
|
153
|
+
c.req.header("x-forwarded-for");
|
|
148
154
|
return asyncLocalStorage.run(new Map(), async () => {
|
|
149
155
|
let cookie = getCookie(c);
|
|
150
156
|
let secretKeyStudio = cookie["_STUDIO_SECRET_KEY_"] || null;
|
|
@@ -165,10 +171,7 @@ function HonoInstance(): typeof app {
|
|
|
165
171
|
|
|
166
172
|
let _v = {
|
|
167
173
|
token: token || null,
|
|
168
|
-
ip:
|
|
169
|
-
c.req.raw.headers?.get("CF-Connecting-IP") ||
|
|
170
|
-
c.req.raw.headers?.get("x-forwarded-for") ||
|
|
171
|
-
c.req.raw.headers?.get("x-real-ip"),
|
|
174
|
+
ip: IP_,
|
|
172
175
|
isAuth: valid ? true : false,
|
|
173
176
|
reqAt: moment().format().toString(),
|
|
174
177
|
setAt: sessionData?._v?.setAt || null,
|