chaoxing-sign
chaoxing-sign copied to clipboard
自建服务器时添加某星账号时报错
添加账号时报Cookie has domain set to a public suffix错误,账号无法添加
无论是使用pnpm run preview
还是npm run start:pm2
都会出现此错误
[nuxt] [request error] [unhandled] [500] Cookie has domain set to a public suffix
at Request._beforeError (./server/node_modules/got/dist/source/core/index.js:310:21)
at Request._onResponseBase (./server/node_modules/got/dist/source/core/index.js:625:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Request._onResponse (./server/node_modules/got/dist/source/core/index.js:765:13)
at CookieJar.setCookie (./server/node_modules/tough-cookie/lib/cookie.js:1186:15)
at ./server/node_modules/universalify/index.js:13:12
at new Promise (<anonymous>)
at CookieJar.setCookie (./server/node_modules/universalify/index.js:7:14)
at ./server/node_modules/got/dist/source/core/index.js:612:82
at Array.map (<anonymous>)
at Request._onResponseBase (./server/node_modules/got/dist/source/core/index.js:612:39)
at Request._onResponse (./server/node_modules/got/dist/source/core/index.js:765:24)
at ClientRequest.<anonymous> (./server/node_modules/got/dist/source/core/index.js:783:23)
at Object.onceWrapper (node:events:632:26)
测试请求地址为ip+端口
和域名+端口
,依旧还是会报以上错误
该条请求报500 Internal Server Error错误
求大佬们解惑
本地测试有无问题?
超星对某些服务器(例如阿里云)是有 ip 检测的,这些服务器是无法访问超星服务器的,你可以通过 curl https://passport2.chaoxing.com/ 来测试,返回空则正常,如下图结果则服务器 ip 被拉黑了。
本地测试有无问题?
超星对某些服务器(例如阿里云)是有 ip 检测的,这些服务器是无法访问超星服务器的,你可以通过 curl https://passport2.chaoxing.com/ 来测试,返回空则正常,如下图结果则服务器 ip 被拉黑了。
大佬您好,部署的服务器是在学校寝室的实体机,校园网的IP是能够正常登录使用超星
curl https://passport2.chaoxing.com/命令测试也是正常的返回空值
应该不存在ip被拉黑的情况,感谢大佬的回复!
本地测试有无问题? 超星对某些服务器(例如阿里云)是有 ip 检测的,这些服务器是无法访问超星服务器的,你可以通过 curl https://passport2.chaoxing.com/ 来测试,返回空则正常,如下图结果则服务器 ip 被拉黑了。
大佬您好,部署的服务器是在学校寝室的实体机,校园网的IP是能够正常登录使用超星 curl https://passport2.chaoxing.com/ 命令测试也是正常的返回空值
应该不存在ip被拉黑的情况,感谢大佬的回复!
@ZeroNeiko 我复现了问题,在build过程中看到一些异常,你可以尝试在不进行Build的情况下运行,并等待作者修复该问题:
git clone https://github.com/kuizuo/chaoxing-sign.git
cd chaoxing-sign
pnpm install
npx prisma db push
pnpm run dev
自建服务器临时解决方案: 注释掉server/protocol/cx/index.ts的132-135行后,重新编译并部署。 怀疑是学校自建的超星平台导致重定向到学校域名导致的问题 不过会导致头像等功能不显示,其余功能自测可用
async parseUserInfo(data: CX.LoginResult) {
this.user = {
...this.user,
...data,
uid: String(data.uid),
} as unknown as CX.User
// const { body: html } = await this.http.get(http://i.chaoxing.com/base?t=${timestamp()}
, { responseType: 'text' })
// const $ = cheerio.load(html)
// this.user.avatar = ${$('.head-img').attr('src')! + this.user.uid}_80
// this.user.siteName = $('#siteName').attr('title')
}