diff --git a/.VERSION.un~ b/.VERSION.un~ new file mode 100644 index 00000000..95d07264 Binary files /dev/null and b/.VERSION.un~ differ diff --git a/VERSION b/VERSION index e69de29b..b0c2058e 100644 --- a/VERSION +++ b/VERSION @@ -0,0 +1 @@ +v0.5.2 diff --git a/VERSION~ b/VERSION~ new file mode 100644 index 00000000..e69de29b diff --git a/common/email.go.bak b/common/email.go.bak new file mode 100644 index 00000000..74f4cccd --- /dev/null +++ b/common/email.go.bak @@ -0,0 +1,67 @@ +package common + +import ( + "crypto/tls" + "encoding/base64" + "fmt" + "net/smtp" + "strings" +) + +func SendEmail(subject string, receiver string, content string) error { + if SMTPFrom == "" { // for compatibility + SMTPFrom = SMTPAccount + } + encodedSubject := fmt.Sprintf("=?UTF-8?B?%s?=", base64.StdEncoding.EncodeToString([]byte(subject))) + mail := []byte(fmt.Sprintf("To: %s\r\n"+ + "From: %s<%s>\r\n"+ + "Subject: %s\r\n"+ + "Content-Type: text/html; charset=UTF-8\r\n\r\n%s\r\n", + receiver, SystemName, SMTPFrom, encodedSubject, content)) + auth := smtp.PlainAuth("", SMTPAccount, SMTPToken, SMTPServer) + addr := fmt.Sprintf("%s:%d", SMTPServer, SMTPPort) + to := strings.Split(receiver, ";") + var err error + if SMTPPort == 465 { + tlsConfig := &tls.Config{ + InsecureSkipVerify: true, + ServerName: SMTPServer, + } + conn, err := tls.Dial("tcp", fmt.Sprintf("%s:%d", SMTPServer, SMTPPort), tlsConfig) + if err != nil { + return err + } + client, err := smtp.NewClient(conn, SMTPServer) + if err != nil { + return err + } + defer client.Close() + if err = client.Auth(auth); err != nil { + return err + } + if err = client.Mail(SMTPFrom); err != nil { + return err + } + receiverEmails := strings.Split(receiver, ";") + for _, receiver := range receiverEmails { + if err = client.Rcpt(receiver); err != nil { + return err + } + } + w, err := client.Data() + if err != nil { + return err + } + _, err = w.Write(mail) + if err != nil { + return err + } + err = w.Close() + if err != nil { + return err + } + } else { + err = smtp.SendMail(addr, auth, SMTPAccount, to, mail) + } + return err +} diff --git a/one-api b/one-api new file mode 100755 index 00000000..697ddfc3 Binary files /dev/null and b/one-api differ diff --git a/web/src/components/LoginForm.js b/web/src/components/LoginForm.js index 110dad46..c5492145 100644 --- a/web/src/components/LoginForm.js +++ b/web/src/components/LoginForm.js @@ -29,7 +29,7 @@ const LoginForm = () => { } }, []); - const [showWeChatLoginModal, setShowWeChatLoginModal] = useState(false); + const [showWeChatLoginModal, setShowWeChatLoginModal] = useState(true); const onGitHubOAuthClicked = () => { window.open(