Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

Commit

Permalink
feat: 自定义标题
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerwin committed Mar 19, 2023
1 parent 785e307 commit e84e7a4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 28 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# build front-end
FROM node:lts-alpine AS frontend

ARG SITE_TITLE="ChatGpt Web"

RUN npm install pnpm -g

WORKDIR /app
Expand All @@ -13,7 +15,8 @@ RUN pnpm install

COPY . /app

RUN pnpm run build
RUN sed -i "s/\${TITLE}/${SITE_TITLE}/g" /app/public/index.html && \
pnpm run build

# build backend
FROM node:lts-alpine as backend
Expand Down
9 changes: 8 additions & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
</div>
</br>

## Introduction
> **This project is forked from [Chanzhaoyu/chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web). In addition to regularly merging this branch, some unique features have been added such as registration and login, setting API key on the front-end page.**
</br>
## Screenshots
> Disclaimer: This project is only released on GitHub, under the MIT License, free and for open-source learning purposes. There will be no account selling, paid services, discussion groups, or forums. Beware of fraud.
![cover](./docs/c1.png)
Expand Down Expand Up @@ -84,7 +89,7 @@ For all parameter variables, check [here](#docker-parameter-example) or see:

[] Formatting and beautifying code-like message types

[] Access rights control
[] Login or Register

[] Data import and export

Expand Down Expand Up @@ -227,6 +232,8 @@ services:
SOCKS_PROXY_PORT: xxxx
# HTTPS Proxy,optional, support http, https, socks5
HTTPS_PROXY: http://xxx:7890
# Title for site
SITE_TITLE: ChatGpt Web
# access salt,optional Allow login if not empty.
AUTH_SECRET_KEY: xxx
# mongodb's connection string
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
</div>
</br>

## 说明
> **此项目 Fork 自 [Chanzhaoyu/chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web), 除了定时合并该分支, 新增了部分特色功能, 注册&登录, 前端页面设置apikey 等**
</br>
## 截图
> 声明:此项目只发布于 Github,基于 MIT 协议,免费且作为开源学习使用。并且不会有任何形式的卖号、付费服务、讨论群、讨论组等行为。谨防受骗。
![cover](./docs/c1.png)
Expand Down Expand Up @@ -80,7 +85,7 @@

[] 对代码等消息类型的格式化美化处理

[] 访问权限控制
[] 支持用户登录注册

[] 数据导入、导出

Expand Down Expand Up @@ -235,6 +240,8 @@ services:
HTTPS_PROXY: http://xxx:7890
# 访问jwt加密参数,可选 不为空则允许登录 同时需要设置 MONGODB_URL
AUTH_SECRET_KEY: xxx
# 网站名称
SITE_TITLE: ChatGpt Web
# mongodb 的连接字符串
MONGODB_URL: 'mongodb://chatgpt:xxxx@database:27017'
# 网站是否开启注册
Expand Down
2 changes: 2 additions & 0 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
SOCKS_PROXY_PORT: xxx
# HTTPS_PROXY 代理,可选
HTTPS_PROXY: http://xxxx:7890
# 网站名称
SITE_TITLE: ChatGpt Web
# mongodb 的连接字符串
MONGODB_URL: 'mongodb://chatgpt:xxxx@database:27017'
# 网站是否开启注册
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="apple-touch-icon" href="/favicon.ico">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
<title>ChatGPT Web</title>
<title>${SITE_TITLE}</title>
</head>

<body class="dark:bg-black">
Expand Down
3 changes: 3 additions & 0 deletions service/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ SOCKS_PROXY_PORT=
# HTTPS PROXY
HTTPS_PROXY=

# Title for site
SITE_TITLE="ChatGpt Web"

# Databse connection string
# MONGODB_URL=mongodb://chatgpt:xxxx@yourip:port
MONGODB_URL=mongodb://chatgpt:xxxx@database:27017
Expand Down
27 changes: 3 additions & 24 deletions service/src/utils/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function sendMail(toMail: string, verifyUrl: string) {
const mailOptions = {
from: process.env.SMTP_USERNAME, // sender address
to: toMail, // list of receivers
subject: 'ChatGPT Web 账号验证', // Subject line
subject: `${process.env.SITE_TITLE} 账号验证`, // Subject line
html: `
<div class="page flex-col">
<div class="box_3 flex-col" style="
Expand Down Expand Up @@ -57,7 +57,7 @@ export function sendMail(toMail: string, verifyUrl: string) {
color: #000000;
line-height: 37px;
text-align: center;
"><target="_blank" style="text-decoration: none; color: #0088cc;">ChatGPT Web</a> 账号验证</span>
"><target="_blank" style="text-decoration: none; color: #0088cc;">${process.env.SITE_TITLE}</a> 账号验证</span>
<div class="box_2 flex-row" style="
margin: 0 20px;
Expand All @@ -83,7 +83,7 @@ export function sendMail(toMail: string, verifyUrl: string) {
<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">
<h1 style="color: #0088cc;">
感谢您使用
<target="_blank" style="text-decoration: none; color: #0088cc;">ChatGPT Web</a>,
<target="_blank" style="text-decoration: none; color: #0088cc;">${process.env.SITE_TITLE}</a>,
您的邮箱验证链接为(12小时内有效):
</span>
</div><hr style="
Expand Down Expand Up @@ -145,33 +145,12 @@ export function sendMail(toMail: string, verifyUrl: string) {
color: #00000045;
line-height: 17px;
">此邮件由服务器自动发出,直接回复无效。</span>
<a class="text_7" style="
height: 17px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #DB214B;
line-height: 17px;
margin-top: 6px;
text-decoration: none;
" href="https://github.com/Chanzhaoyu/chatgpt-web">项目作者</a>
<a class="text_8" style="
height: 17px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #DB214B;
line-height: 17px;
margin-top: 6px;
text-decoration: none;
" href="https://github.com/Kerwin1202/chatgpt-web">邮箱注册功能作者</a>
</div>
</div>
</div>
`, // html body
}


// send mail with defined transport object
transporter.sendMail(mailOptions, (error, info) => {
if (error)
Expand Down

1 comment on commit e84e7a4

@LuckyWang6
Copy link
Contributor

@LuckyWang6 LuckyWang6 commented on e84e7a4 Mar 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR [frontend 8/8] RUN sed -i "s/${TITLE}/ChatGpt Web/g" /app/public/index.html && pnpm run build 0.9s
[frontend 8/8] RUN sed -i "s/${TITLE}/ChatGpt Web/g" /app/public/index.html && pnpm run build:
#18 0.887 sed: /app/public/index.html: No such file or directory
executor failed running [/bin/sh -c sed -i "s/${TITLE}/${SITE_TITLE}/g" /app/public/index.html && pnpm run build]: exit code: #1

大佬,本地部署docker镜像出现以上报错

Please sign in to comment.