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

feat: 添加注册登录&同步聊天数据 #589

Closed
wants to merge 180 commits into from

Conversation

Kerwin1202
Copy link

冲突太多 重新改了下 关联 原 pr #417 左下角支持了退出

开启登录

当 AUTH_SECRET_KEY 不为空则开启登录,否则为空也可以多设备同步聊天。不同设备刷新页面会同步

其他设置看 注释好了

image

image

image

@gitguardian
Copy link

gitguardian bot commented Mar 14, 2023

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
- SMTP credentials 0cccd04 docker-compose/docker-compose.yml View secret
- SMTP credentials 7bd68a3 docker-compose/docker-compose.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@rzarvirov
Copy link

works great, thank you!

@Chanzhaoyu
Copy link
Owner

感谢你的贡献,但是登录注册这种应该由自己的后端去开发,因为涉及数据库,很多人其实用不到。可以的话你可以在自己项目扩展分支,我可以链接过去,再次感谢,抱歉。

@LuckyWang6
Copy link
Contributor

image
大佬,docker到这一步,怎么解决呀
image
image
这是我的docker compose文件

@Kerwin1202
Copy link
Author

感谢你的贡献,但是登录注册这种应该由自己的后端去开发,因为涉及数据库,很多人其实用不到。可以的话你可以在自己项目扩展分支,我可以链接过去,再次感谢,抱歉。

嗯嗯,没事,也是给有需要的人

@Kerwin1202
Copy link
Author

Kerwin1202 commented Mar 15, 2023

@luckywangxi 看报错是 docker-compose/nginx 目录下的 conf 文件减少了, 确实我也不知道为啥,我之前合并主分支跑也是这样,少了这个文件你自己新建一下贴上 配置 https://github.com/Chanzhaoyu/chatgpt-web/blob/main/docker-compose/nginx/nginx.conf

image

@LuckyWang6
Copy link
Contributor

@luckywangxi 看报错是 docker-compose/nginx 目录下的 conf 文件减少了, 确实我也不知道为啥,我之前合并主分支跑也是这样,少了这个文件你自己新建一下贴上 配置 https://github.com/Chanzhaoyu/chatgpt-web/blob/main/docker-compose/nginx/nginx.conf

image

image
image
image
大佬,这样怎么办呀

@02000823
Copy link

我想请问一下有没有打包好可以部署的docker镜像和docker-compose的yaml文件?

@Kerwin1202
Copy link
Author

@luckywangxi 这看不出 右键 f12 看下

@LuckyWang6
Copy link
Contributor

LuckyWang6 commented Mar 16, 2023

@luckywangxi 这看不出 右键 f12 看下
这是F12的
image
image
这是网页的docker日志
image
这是数据库的日志
image
麻烦大佬帮忙看看

@Kerwin1202
Copy link
Author

@luckywangxi 看上去是数据库密码不对 , 这两个对比看看 或者你之前是不是改过密码之类的

image

@Kerwin1202
Copy link
Author

我想请问一下有没有打包好可以部署的docker镜像和docker-compose的yaml文件?

参考如下

version: '3'

services:
  app:
    image: kerwin1202/chatgpt-web # 总是使用latest,更新时重新pull该tag镜像即可
    ports:
      - 13002:3002
    depends_on:
      - database
    environment:
      # 二选一
      OPENAI_API_KEY: xxx
      # 访问jwt加密参数,可选 不为空则允许登录 同时需要设置 MONGODB_URL
      AUTH_SECRET_KEY: xxx
      # 超时,单位毫秒,可选
      TIMEOUT_MS: 60000
      # mongodb 的连接字符串
      MONGODB_URL: 'mongodb://chatgpt:xxxx@database:27017'
      # 网站是否开启注册
      REGISTER_ENABLED: true
      # 开启注册之后 网站注册允许的邮箱后缀 如果空 则允许任意后缀
      REGISTER_MAILS: '@qq.com,@sina.com,@163.com'
      # 开启注册之后 密码加密的盐
      PASSWORD_MD5_SALT: xxx
      # 开启注册之后 超级管理邮箱
      ROOT_USER: xxx
      # 开启注册之后 网站域名 不含 / 注册的时候发送验证邮箱使用
      SITE_DOMAIN: http://127.0.0.1:13002
      # 开启注册之后 发送验证邮箱配置
      SMTP_HOST: smtp.exmail.qq.com
      SMTP_PORT: 465
      SMTP_TSL: true
      SMTP_USERNAME: xxx
      SMTP_PASSWORD: xxx
    links:
      - database

  database:
    image: mongo
    ports:
      - '27017:27017'
    expose:
      - '27017'
    volumes:
      - mongodb:/data/db
    environment:
      MONGO_INITDB_ROOT_USERNAME: chatgpt
      MONGO_INITDB_ROOT_PASSWORD: xxxx
      MONGO_INITDB_DATABASE: chatgpt
      
volumes:
  mongodb: {}

@islercn
Copy link

islercn commented Mar 16, 2023

如果后台有开启/关闭注册的开关就比较方便了

@LuckyWang6
Copy link
Contributor

不知道有没有开启/关闭注册的开关,不然和开放使用没什么区别

docker compose文件里面可以选择开关

@LuckyWang6
Copy link
Contributor

@luckywangxi 看上去是数据库密码不对 , 这两个对比看看 或者你之前是不是改过密码之类的

image

感谢大佬,已经实现了,希望可以有一个忘记密码和重置密码的功能

@islercn
Copy link

islercn commented Mar 16, 2023

@luckywangxi 看上去是数据库密码不对 , 这两个对比看看 或者你之前是不是改过密码之类的
image

感谢大佬,已经实现了,希望可以有一个忘记密码和重置密码的功能

邀请码系统同样重要

@Kerwin1202
Copy link
Author

请问需要自己安装数据库吗

docker 自带数据库

@Kerwin1202
Copy link
Author

@1589138103 我没说你的是因为密码啊,你的平台不对. 但是我win10 64 也可以跑 试试这个

docker pull kerwin1202/chatgpt-web:amd64

@Kerwin1202
Copy link
Author

@1589138103 如果是root_user是没有验证码的,这些配置是其他用户才需要,注册之后直接可以登录。 这个 site_domain 不影响发邮件,至于自己掉了需要日志看看

@vectorsss
Copy link

您好,请问一下MONGODB_URL怎么设置的?
我尝试了以下几种方法都无法正常连接:
MONGODB_URL=mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.8.0

mongodb://chatgpt:xxxx@database:27017

mongodb://chatgpt:xxxx@database:27017/chatgpt

@JinhuW
Copy link

JinhuW commented Mar 17, 2023

@Kerwin1202
SITE_DOMAIN: http://127.0.0.1:1002
这个docker compose 没有开放1002 的后段端口 应该没有办法进行验证吧


这里应该是3002

@Kerwin1202
Copy link
Author

@1589138103 如果是root_user是没有验证码的,这些配置是其他用户才需要,注册之后直接可以登录。 这个 site_domain 不影响发邮件,至于自己掉了需要日志看看

是普通用户需要验证码

需要具体 docker 日志

@Kerwin1202
Copy link
Author

您好,请问一下MONGODB_URL怎么设置的? 我尝试了以下几种方法都无法正常连接: MONGODB_URL=mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.8.0

mongodb://chatgpt:xxxx@database:27017

mongodb://chatgpt:xxxx@database:27017/chatgpt

确实默认别改任何操作 就可以了, 改个账户名字或者密码即可

image

@Kerwin1202
Copy link
Author

@Kerwin1202 SITE_DOMAIN: http://127.0.0.1:1002 这个docker compose 没有开放1002 的后段端口 应该没有办法进行验证吧

这里应该是3002

正常是 3002 但是具体看你docker配置的端口 就是网页访问的

@Kerwin1202
Copy link
Author

还有我想请问一下邮件这部分是需要腾讯企业邮箱还是说普通QQ邮箱开IMAP、POP3/SMTP服务就可以?

只要支持 smtp 都可以

@Kerwin1202
Copy link
Author

大佬,我现在没有报错了,邮箱密码啥的也都是正确的,就是也可以显示发送成功,但是就是收不到验证码,我想请问一下这是怎么回事,有没有什么检验办法

这个就不好说了 https://www.smtper.net/ (我没试过) 可以这种试试看,记得测完改密码,类似的第三方邮件 foxmail 等也可以试试加不能加

popcell and others added 28 commits June 3, 2023 22:10
fix: 多层代理导致ip获取错误,限流失效
feat: 实现用户登录权限相关接口的限流(登录、注册、发送邮件等等)
fix: Failed to resolve component NButton
fix: remove unused fetchChatAPI
@Chanzhaoyu Chanzhaoyu closed this Oct 12, 2023
@itnico
Copy link

itnico commented May 5, 2024

不知道如何添加反爬虫,能不能具体点,群晖docker部署的。

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

Successfully merging this pull request may close these issues.

None yet