Skip to content

Commit

Permalink
fix: 在cloudflare cdn环境下获取ip不正确
Browse files Browse the repository at this point in the history
  • Loading branch information
MengNianxiaoyao authored Aug 3, 2024
1 parent ad99ea5 commit 1415ec6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/self-hosted/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,8 @@ async function createCollections () {

function getIp (request) {
try {
const { TWIKOO_IP_HEADERS } = process.env
const headers = TWIKOO_IP_HEADERS ? JSON.parse(TWIKOO_IP_HEADERS) : []
const TWIKOO_IP_HEADERS = process.env.TWIKOO_IP_HEADERS
let headers = TWIKOO_IP_HEADERS ? JSON.parse(TWIKOO_IP_HEADERS) : []

Check failure on line 959 in src/server/self-hosted/index.js

View workflow job for this annotation

GitHub Actions / build (18.x)

'headers' is never reassigned. Use 'const' instead
return getUserIP(request, headers)
} catch (e) {
logger.error('获取 IP 错误信息:', e)
Expand Down

0 comments on commit 1415ec6

Please sign in to comment.