From f6e3fa068cdd4ffe81c0607ae7c771b014613550 Mon Sep 17 00:00:00 2001 From: Pacalini <141402887+Pacalini@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:26:39 +0800 Subject: [PATCH 1/2] ehentai: fix cookies validation --- ehentai.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ehentai.js b/ehentai.js index 60748e6..994987c 100644 --- a/ehentai.js +++ b/ehentai.js @@ -81,6 +81,12 @@ class Ehentai extends ComicSource { * @returns {Promise} */ validate: async (values) => { + if (values.length !== 4) { + return false + } + if (values[0].length === 0 || values[1].length === 0) { + return false + } let cookies = [] for (let i = 0; i < values.length; i++) { cookies.push(new Cookie({ @@ -95,12 +101,6 @@ class Ehentai extends ComicSource { })) } 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( "https://forums.e-hentai.org/", { @@ -1122,4 +1122,4 @@ class Ehentai extends ComicSource { "Language": "語言", }, } -} \ No newline at end of file +} From 64497500a86bfe8de2feb176de1562c4a5efd0f2 Mon Sep 17 00:00:00 2001 From: Pacalini <141402887+Pacalini@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:55:15 +0800 Subject: [PATCH 2/2] ehentai: clear cookies before each login attempt --- ehentai.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ehentai.js b/ehentai.js index 994987c..8b8f0a0 100644 --- a/ehentai.js +++ b/ehentai.js @@ -100,6 +100,7 @@ class Ehentai extends ComicSource { domain: ".exhentai.org" })) } + Network.deleteCookies('https://e-hentai.org') Network.setCookies('https://e-hentai.org', cookies) let res = await Network.get( "https://forums.e-hentai.org/",