ehentai: fix cookies validation

This commit is contained in:
Pacalini
2024-10-27 22:26:39 +08:00
committed by GitHub
parent 6cd3759dbe
commit f6e3fa068c

View File

@@ -81,6 +81,12 @@ class Ehentai extends ComicSource {
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
validate: async (values) => { validate: async (values) => {
if (values.length !== 4) {
return false
}
if (values[0].length === 0 || values[1].length === 0) {
return false
}
let cookies = [] let cookies = []
for (let i = 0; i < values.length; i++) { for (let i = 0; i < values.length; i++) {
cookies.push(new Cookie({ cookies.push(new Cookie({
@@ -95,12 +101,6 @@ class Ehentai extends ComicSource {
})) }))
} }
Network.setCookies('https://e-hentai.org', cookies) Network.setCookies('https://e-hentai.org', cookies)
if (cookies.length !== 4) {
return false
}
if (cookies[0].length === 0 || cookies[1].length === 0) {
return false
}
let res = await Network.get( let res = await Network.get(
"https://forums.e-hentai.org/", "https://forums.e-hentai.org/",
{ {