refactor: remove unused parameters and redundant errors

This commit is contained in:
2026-05-12 12:25:18 +02:00
parent ebce2edb7d
commit 6e4fdf6314
4 changed files with 10 additions and 14 deletions

View File

@@ -464,8 +464,8 @@ func decryptTobeparsed(encoded string) ([]byte, error) {
}
if version == 1 {
plainText, err := tryDecryptCTR(block, iv, cipherText)
if err == nil && json.Valid(plainText) {
plainText := tryDecryptCTR(block, iv, cipherText)
if json.Valid(plainText) {
return plainText, nil
}
}
@@ -484,13 +484,13 @@ func decryptTobeparsed(encoded string) ([]byte, error) {
return nil, fmt.Errorf("decryption failed")
}
func tryDecryptCTR(block cipher.Block, iv []byte, cipherText []byte) ([]byte, error) {
func tryDecryptCTR(block cipher.Block, iv []byte, cipherText []byte) []byte {
ctrIV := append([]byte{}, iv...)
ctrIV = append(ctrIV, 0x00, 0x00, 0x00, 0x02)
ctr := cipher.NewCTR(block, ctrIV)
plainText := make([]byte, len(cipherText))
ctr.XORKeyStream(plainText, cipherText)
return plainText, nil
return plainText
}
// Search queries AllAnime for shows matching the given search term.