celesWuff / ktpwarp-server

ktpWarp:课堂派自动签到
MIT License
31 stars 5 forks source link

针对固定ip前缀可能出现的问题 #3

Closed SetBoerk closed 7 months ago

SetBoerk commented 11 months ago

作者你好,我部署了你的ktpwarp项目,在实际应用中遇到了针对固定ip前缀教师点名的问题,我的解决方法是把FAKE_IP_PREFIX修改为一个数组,数组里用来放多个我的属地的ip前缀,在getAuthenticatedHeaders方法里面我修改为了随机在FAKE_IP_PREFIX数组里挑选一个做前缀, export function getAuthenticatedHeaders(credential: CredentialType): any { const headers = structuredClone(HEADERS); headers["token"] = credential.token; // 从 FAKE_IP_PREFIX_ARRAY 中随机选择一个前缀 const randomPrefixIndex = Math.floor(Math.random() * FAKE_IP_PREFIX_ARRAY.length); const selectedPrefix = FAKE_IP_PREFIX[randomPrefixIndex]; headers["X-Forwarded-For"] = selectedPrefix + fakeIpSuffix.next(); return headers; }

GR666 commented 10 months ago

课堂派是不是更新了,二维码扫不上了,楼主还能用吗

SetBoerk commented 10 months ago

课堂派是不是更新了,二维码扫不上了,楼主还能用吗

大码可以,小码不行

celesWuff commented 7 months ago

感谢您的提议,1.3 版本实现了该功能。