From b44e9b614dfeda36138509994dca4d29f64ae2c3 Mon Sep 17 00:00:00 2001 From: Vincent Young Date: Tue, 23 Apr 2024 14:50:12 -0400 Subject: [PATCH] feat: allow `dl_session` via cookie --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 15c8791..55bfd3b 100644 --- a/main.go +++ b/main.go @@ -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 @@ -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,