rankrunners-cms 0.0.30 → 0.0.31
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/package.json +1 -1
- package/src/tanstack/captcha.ts +13 -6
package/package.json
CHANGED
package/src/tanstack/captcha.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { verifyToken as verifyTokenClient } from "../api/client/captcha";
|
|
2
2
|
|
|
3
3
|
export const getIpAddress = (request: Request): string => {
|
|
4
|
+
const cfConnectingIp = request.headers.get("cf-connecting-ip")?.trim();
|
|
5
|
+
if (cfConnectingIp && cfConnectingIp.length > 0) {
|
|
6
|
+
return cfConnectingIp;
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
const forwardedFor = request.headers.get("x-forwarded-for");
|
|
5
10
|
|
|
6
11
|
if (forwardedFor) {
|
|
@@ -18,11 +23,6 @@ export const getIpAddress = (request: Request): string => {
|
|
|
18
23
|
return realIp;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
const cfConnectingIp = request.headers.get("cf-connecting-ip")?.trim();
|
|
22
|
-
if (cfConnectingIp && cfConnectingIp.length > 0) {
|
|
23
|
-
return cfConnectingIp;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
26
|
return "";
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -69,6 +69,13 @@ export const verifyToken = async (request: Request, token: string) => {
|
|
|
69
69
|
return false;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
console.log(
|
|
72
|
+
console.log(
|
|
73
|
+
"Verifying captcha token",
|
|
74
|
+
token,
|
|
75
|
+
" with IP:",
|
|
76
|
+
ip,
|
|
77
|
+
"and hostname:",
|
|
78
|
+
hostname,
|
|
79
|
+
);
|
|
73
80
|
return verifyTokenClient({ token, ip, hostname });
|
|
74
81
|
};
|