fix: remove hardcoded aes key and fix string unescaping

This commit is contained in:
2026-04-21 01:20:43 +02:00
parent a1909559b3
commit f1b0a7cf41

View File

@@ -12,6 +12,7 @@ import (
"io" "io"
"net/http" "net/http"
"os" "os"
"strconv"
"strings" "strings"
"time" "time"
) )
@@ -141,8 +142,9 @@ func (c *allAnimeClient) Search(ctx context.Context, query string, mode string)
id, _ := item["_id"].(string) id, _ := item["_id"].(string)
malID, _ := item["malId"].(string) malID, _ := item["malId"].(string)
name, _ := item["name"].(string) name, _ := item["name"].(string)
name = strings.ReplaceAll(name, `\\"`, `"`) if unquoted, err := strconv.Unquote("\"" + name + "\""); err == nil {
name = strings.ReplaceAll(name, `\"`, `"`) name = unquoted
}
name = strings.TrimSpace(name) name = strings.TrimSpace(name)
if id == "" { if id == "" {
@@ -403,7 +405,7 @@ func decryptTobeparsed(encoded string) ([]byte, error) {
keyStr := os.Getenv(allAnimeAESKey) keyStr := os.Getenv(allAnimeAESKey)
if keyStr == "" { if keyStr == "" {
keyStr = "SimtVuagFbGR2K7P" return nil, fmt.Errorf("ALLANIME_AES_KEY environment variable not set")
} }
if len(keyStr) < 16 { if len(keyStr) < 16 {
return nil, fmt.Errorf("ALLANIME_AES_KEY must be at least 16 characters") return nil, fmt.Errorf("ALLANIME_AES_KEY must be at least 16 characters")