Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自建服务器时添加某星账号时报错 #32

Open
zeroneiko opened this issue Dec 4, 2023 · 4 comments
Open

自建服务器时添加某星账号时报错 #32

zeroneiko opened this issue Dec 4, 2023 · 4 comments

Comments

@zeroneiko
Copy link

zeroneiko commented Dec 4, 2023

添加账号时报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错误
求大佬们解惑

@kuizuo
Copy link
Owner

kuizuo commented Dec 5, 2023

本地测试有无问题?

超星对某些服务器(例如阿里云)是有 ip 检测的,这些服务器是无法访问超星服务器的,你可以通过 curl https://passport2.chaoxing.com/ 来测试,返回空则正常,如下图结果则服务器 ip 被拉黑了。

image

@zeroneiko
Copy link
Author

本地测试有无问题?

超星对某些服务器(例如阿里云)是有 ip 检测的,这些服务器是无法访问超星服务器的,你可以通过 curl https://passport2.chaoxing.com/ 来测试,返回空则正常,如下图结果则服务器 ip 被拉黑了。

image

大佬您好,部署的服务器是在学校寝室的实体机,校园网的IP是能够正常登录使用超星
curl https://passport2.chaoxing.com/命令测试也是正常的返回空值
屏幕截图 2023-12-05 204335
应该不存在ip被拉黑的情况,感谢大佬的回复!

@Hetols
Copy link

Hetols commented Dec 15, 2023

本地测试有无问题?
超星对某些服务器(例如阿里云)是有 ip 检测的,这些服务器是无法访问超星服务器的,你可以通过 curl https://passport2.chaoxing.com/ 来测试,返回空则正常,如下图结果则服务器 ip 被拉黑了。
image

大佬您好,部署的服务器是在学校寝室的实体机,校园网的IP是能够正常登录使用超星 curl https://passport2.chaoxing.com/ 命令测试也是正常的返回空值 屏幕截图 2023-12-05 204335 应该不存在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

@soundofautumn
Copy link

自建服务器临时解决方案:
注释掉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')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants