From d38dbe644ae56e76592c27fbc2645d26a5e50dc5 Mon Sep 17 00:00:00 2001 From: syrinka Date: Thu, 25 Aug 2022 19:30:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20=E4=B8=BA=20E=20=E7=AB=99?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20star=20cookie=20(#10607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en/install/README.md | 1 + docs/install/README.md | 1 + lib/config.js | 1 + lib/v2/ehentai/ehapi.js | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/docs/en/install/README.md b/docs/en/install/README.md index 5caa219c0..e8fb9e7c8 100644 --- a/docs/en/install/README.md +++ b/docs/en/install/README.md @@ -607,6 +607,7 @@ See docs of the specified route and `lib/config.js` for detailed information. - `EH_IPB_MEMBER_ID`: The value of `ipb_member_id` in the cookie header after logging in E-Hentai - `EH_IPB_PASS_HASH`: The value of `ipb_pass_hash` in the cookie header after logging in E-Hentai - `EH_SK`: The value of `sk` in the cookie header after logging in E-Hentai + - `EH_STAR`: The value of `star` in the cookie header if your account has stars. If this value is set, image limit allocation will links to the account rather than IP address - `EH_IGNEOUS`: The value of `igneous` in the cookie header after logging in ExHentai. If this value is set, RSS will be generated from ExHentai - `EH_IMG_PROXY`: Cover proxy address. If this is set, the link to the cover image will be replaced with this value at the beginning. When using ExHentai, the cover image requires cookies to access it, so you can use this with a cookie-added proxy server to access the cover image without cookies in some readers. diff --git a/docs/install/README.md b/docs/install/README.md index c23305b83..975be4a70 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -641,6 +641,7 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行 - `EH_IPB_PASS_HASH`: E-Hentai 账户登录后 cookie 的 `ipb_pass_hash` 值 - `EH_SK`: E-Hentai 账户登录后 cookie 中的`sk`值 - `EH_IGNEOUS`: ExHentai 账户登录后 cookie 中的`igneous`值。若设置此值,RSS 数据将全部从里站获取 + - `EH_STAR`: E-Hentai 账户获得捐赠等级后将出现该 cookie。若设置此值,图片访问量限制将与账号关联而非 IP 地址 - `EH_IMG_PROXY`: 封面代理访问地址。若设置此值,封面图链接将被替换为以此值开头。使用 ExHentai 时,封面图需要有 Cookie 才能访问,在一些阅读软件上没法显示封面,可以使用此值搭配一个加 Cookie 的代理服务器实现阅读软件无 Cookie 获取封面图。 - Gitee 全部路由:[申请地址](https://gitee.com/api/v5/swagger) diff --git a/lib/config.js b/lib/config.js index 6022cf3ca..7771b9d21 100644 --- a/lib/config.js +++ b/lib/config.js @@ -134,6 +134,7 @@ const calculateValue = () => { ipb_pass_hash: envs.EH_IPB_PASS_HASH, sk: envs.EH_SK, igneous: envs.EH_IGNEOUS, + star: envs.EH_STAR, img_proxy: envs.EH_IMG_PROXY, }, email: { diff --git a/lib/v2/ehentai/ehapi.js b/lib/v2/ehentai/ehapi.js index 86e99225e..b1b974e68 100644 --- a/lib/v2/ehentai/ehapi.js +++ b/lib/v2/ehentai/ehapi.js @@ -17,6 +17,10 @@ if (has_cookie) { } } +if (config.star) { + headers.cookie += `;star=${config.star}`; +} + function ehgot(url) { if (from_ex) { return got({ method: 'get', url: `https://exhentai.org/${url}`, headers });