Skip to content

Commit

Permalink
feat: allow dl_session via cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
missuo committed Apr 23, 2024
1 parent 56c066a commit b44e9b6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* @Author: Vincent Yang
* @Date: 2023-07-01 21:45:34
* @LastEditors: Vincent Yang
* @LastEditTime: 2024-04-23 00:42:28
* @LastEditors: Vincent Young
* @LastEditTime: 2024-04-23 14:49:35
* @FilePath: /DeepLX/main.go
* @Telegram: https://t.me/missuo
* @GitHub: https://github.com/missuo
Expand Down Expand Up @@ -126,6 +126,12 @@ func main() {
translateText := req.TransText

dlSession := cfg.DlSession

cookie := c.GetHeader("Cookie")
if cookie != "" {
dlSession = strings.Replace(cookie, "dl_session=", "", -1)
}

if dlSession == "" {
c.JSON(http.StatusUnauthorized, gin.H{
"code": http.StatusUnauthorized,
Expand Down

0 comments on commit b44e9b6

Please sign in to comment.