From 36f133355bbd52c1cbf82e03364612e8158ed204 Mon Sep 17 00:00:00 2001 From: Pacalini <141402887+Pacalini@users.noreply.github.com> Date: Tue, 14 Jan 2025 15:48:25 +0800 Subject: [PATCH] jm: update version code, domain and UA (#36) ref: https://goo.gle/4fZkFiE --- index.json | 2 +- jm.js | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/index.json b/index.json index 6df5ade..b160661 100644 --- a/index.json +++ b/index.json @@ -45,6 +45,6 @@ "name": "禁漫天堂", "fileName": "jm.js", "key": "jm", - "version": "1.0.1" + "version": "1.0.2" } ] diff --git a/jm.js b/jm.js index 961a904..cf98146 100644 --- a/jm.js +++ b/jm.js @@ -7,7 +7,7 @@ class JM extends ComicSource { // unique id of the source key = "jm" - version = "1.0.1" + version = "1.0.2" minAppVersion = "1.0.2" @@ -18,7 +18,7 @@ class JM extends ComicSource { "https://www.jmapiproxyxxx.vip", "https://www.cdnblackmyth.club", "https://www.cdnmhws.cc", - "https://www.cdnxxx-proxy.co" + "https://www.cdnmhwscc.org" ]; static imageUrls = [ @@ -28,6 +28,10 @@ class JM extends ComicSource { "https://cdn-msp3.jmapiproxy3.cc", ]; + static apiUa = "Mozilla/5.0 (Linux; Android 10; K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/130.0.0.0 Mobile Safari/537.36" + + static imgUa = "okhttp/3.12.1" + get baseUrl() { let index = parseInt(this.loadSetting('apiDomain')) - 1 return JM.apiDomains[index] @@ -43,6 +47,14 @@ class JM extends ComicSource { return JM.imageUrls[index] } + get apiUa() { + return JM.apiUa; + } + + get imgUa() { + return JM.imgUa; + } + getCoverUrl(id) { return `${this.imageUrl}/media/albums/${id}_3x4.jpg` } @@ -84,14 +96,15 @@ class JM extends ComicSource { } getHeaders(time) { - const jmVersion = "1.7.5" + const jmVersion = "1.7.6" const jmAuthKey = "18comicAPPContent" let token = Convert.md5(Convert.encodeUtf8(`${time}${jmAuthKey}`)) return { "token": Convert.hexEncode(token), "tokenparam": `${time},${jmVersion}`, - "accept-encoding": "gzip", + "Accept-Encoding": "gzip", + "User-Agent": this.apiUa, } } @@ -503,6 +516,10 @@ class JM extends ComicSource { return {} } return { + headers: { + "Accept-Encoding": "gzip", + "User-Agent": this.imgUa, + }, modifyImage: ` let modifyImage = (image) => { const num = ${num} @@ -530,6 +547,19 @@ class JM extends ComicSource { `, } }, + /** + * [Optional] provide configs for a thumbnail loading + * @param url {string} + * @returns {{}} + */ + onThumbnailLoad: (url) => { + return { + headers: { + "Accept-Encoding": "gzip", + "User-Agent": this.imgUa, + } + } + }, /** * [Optional] load comments * @param comicId {string}