mirror of
https://github.com/venera-app/venera-configs.git
synced 2025-09-27 08:27:24 +00:00
jm: update jm3 api (#117)
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
"name": "禁漫天堂",
|
"name": "禁漫天堂",
|
||||||
"fileName": "jm.js",
|
"fileName": "jm.js",
|
||||||
"key": "jm",
|
"key": "jm",
|
||||||
"version": "1.1.4",
|
"version": "1.2.0",
|
||||||
"description": "禁漫天堂漫畫源, 不能使用時請嘗試切換分流"
|
"description": "禁漫天堂漫畫源, 不能使用時請嘗試切換分流"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
117
jm.js
117
jm.js
@@ -7,25 +7,31 @@ class JM extends ComicSource {
|
|||||||
// unique id of the source
|
// unique id of the source
|
||||||
key = "jm"
|
key = "jm"
|
||||||
|
|
||||||
version = "1.1.4"
|
version = "1.2.0"
|
||||||
|
|
||||||
minAppVersion = "1.2.5"
|
minAppVersion = "1.2.5"
|
||||||
|
|
||||||
|
static jmVersion = "2.0.1"
|
||||||
|
|
||||||
|
static jmPkgName = "com.example.app"
|
||||||
|
|
||||||
// update url
|
// update url
|
||||||
url = "https://git.nyne.dev/nyne/venera-configs/raw/branch/main/jm.js"
|
url = "https://git.nyne.dev/nyne/venera-configs/raw/branch/main/jm.js"
|
||||||
|
|
||||||
static apiDomains = [
|
static apiDomains = [
|
||||||
"www.jmapiproxyxxx.vip",
|
"www.cdnaspa.vip",
|
||||||
"www.cdnblackmyth.club",
|
"www.cdnaspa.club",
|
||||||
"www.cdnmhws.cc",
|
"www.cdnplaystation6.vip",
|
||||||
"www.cdnmhwscc.org"
|
"www.cdnplaystation6.cc"
|
||||||
];
|
];
|
||||||
|
|
||||||
static imageUrl = "https://cdn-msp.jmapinodeudzn.net"
|
static imageUrl = "https://cdn-msp.jmapinodeudzn.net"
|
||||||
|
|
||||||
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 ua = "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 ua() {
|
||||||
|
return JM.ua;
|
||||||
|
}
|
||||||
|
|
||||||
get baseUrl() {
|
get baseUrl() {
|
||||||
let index = parseInt(this.loadSetting('apiDomain')) - 1
|
let index = parseInt(this.loadSetting('apiDomain')) - 1
|
||||||
@@ -48,12 +54,49 @@ class JM extends ComicSource {
|
|||||||
return /^\d+$/.test(str)
|
return /^\d+$/.test(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
get apiUa() {
|
get baseHeaders() {
|
||||||
return JM.apiUa;
|
return {
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br, zstd",
|
||||||
|
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Origin": "https://localhost",
|
||||||
|
"Referer": "https://localhost/",
|
||||||
|
"Sec-Fetch-Dest": "empty",
|
||||||
|
"Sec-Fetch-Mode": "cors",
|
||||||
|
"Sec-Fetch-Site": "cross-site",
|
||||||
|
"X-Requested-With": JM.jmPkgName,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get imgUa() {
|
getApiHeaders(time) {
|
||||||
return JM.imgUa;
|
const jmAuthKey = "18comicAPPContent"
|
||||||
|
let token = Convert.md5(Convert.encodeUtf8(`${time}${jmAuthKey}`))
|
||||||
|
|
||||||
|
return {
|
||||||
|
...this.baseHeaders,
|
||||||
|
"Authorization": "Bearer",
|
||||||
|
"Sec-Fetch-Storage-Access": "active",
|
||||||
|
"token": Convert.hexEncode(token),
|
||||||
|
"tokenparam": `${time},${JM.jmVersion}`,
|
||||||
|
"User-Agent": this.ua,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getImgHeaders() {
|
||||||
|
return {
|
||||||
|
"Accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br, zstd",
|
||||||
|
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Referer": "https://localhost/",
|
||||||
|
"Sec-Fetch-Dest": "image",
|
||||||
|
"Sec-Fetch-Mode": "no-cors",
|
||||||
|
"Sec-Fetch-Site": "cross-site",
|
||||||
|
"Sec-Fetch-Storage-Access": "active",
|
||||||
|
"User-Agent": this.ua,
|
||||||
|
"X-Requested-With": JM.jmPkgName,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getCoverUrl(id) {
|
getCoverUrl(id) {
|
||||||
@@ -78,32 +121,33 @@ class JM extends ComicSource {
|
|||||||
* @param showConfirmDialog {boolean}
|
* @param showConfirmDialog {boolean}
|
||||||
*/
|
*/
|
||||||
async refreshApiDomains(showConfirmDialog) {
|
async refreshApiDomains(showConfirmDialog) {
|
||||||
let today = new Date();
|
let url = "https://jmapp03-1308024008.cos.ap-jakarta.myqcloud.com/server-2024.txt"
|
||||||
let url = "https://jmappc01-1308024008.cos.ap-guangzhou.myqcloud.com/server-2024.txt"
|
|
||||||
let domainSecret = "diosfjckwpqpdfjkvnqQjsik"
|
let domainSecret = "diosfjckwpqpdfjkvnqQjsik"
|
||||||
let title = ""
|
let title = ""
|
||||||
let message = ""
|
let message = ""
|
||||||
|
let jm3_Server = []
|
||||||
let domains = []
|
let domains = []
|
||||||
let res = await fetch(
|
let res = await fetch(
|
||||||
`${url}?time=${today.getFullYear()}${today.getMonth() + 1}${today.getDate()}`,
|
url,
|
||||||
{headers: {"User-Agent": this.imgUa}}
|
{headers: this.baseHeaders}
|
||||||
)
|
)
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
let data = this.convertData(await res.text(), domainSecret)
|
let data = this.convertData(await res.text(), domainSecret)
|
||||||
let json = JSON.parse(data)
|
let json = JSON.parse(data)
|
||||||
if (json["Server"]) {
|
if (json["jm3_Server"]) {
|
||||||
title = "Update Success"
|
title = "Update Success"
|
||||||
message = "New domains:\n\n"
|
message = "\n"
|
||||||
domains = json["Server"]
|
jm3_Server = json["jm3_Server"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (domains.length === 0) {
|
if (jm3_Server.length === 0) {
|
||||||
title = "Update Failed"
|
title = "Update Failed"
|
||||||
message = `Using built-in domains:\n\n`
|
message = `Using built-in domains:\n\n`
|
||||||
domains = JM.apiDomains
|
domains = JM.apiDomains
|
||||||
}
|
}
|
||||||
for (let i = 0; i < domains.length; i++) {
|
for (let [domain, index] of jm3_Server) {
|
||||||
message = message + `Stream ${i + 1}: ${domains[i]}\n`
|
message = message + `${index}: ${domain}\n`
|
||||||
|
domains.push(domain)
|
||||||
}
|
}
|
||||||
if (showConfirmDialog) {
|
if (showConfirmDialog) {
|
||||||
UI.showDialog(
|
UI.showDialog(
|
||||||
@@ -135,7 +179,7 @@ class JM extends ComicSource {
|
|||||||
async refreshImgUrl(showMessage) {
|
async refreshImgUrl(showMessage) {
|
||||||
let index = this.loadSetting('imageStream')
|
let index = this.loadSetting('imageStream')
|
||||||
let res = await this.get(
|
let res = await this.get(
|
||||||
`${this.baseUrl}/setting?app_img_shunt=${index}`
|
`${this.baseUrl}/setting?app_img_shunt=${index}?express=`
|
||||||
)
|
)
|
||||||
let setting = JSON.parse(res)
|
let setting = JSON.parse(res)
|
||||||
if (setting["img_host"]) {
|
if (setting["img_host"]) {
|
||||||
@@ -174,19 +218,6 @@ class JM extends ComicSource {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeaders(time) {
|
|
||||||
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",
|
|
||||||
"User-Agent": this.apiUa,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param input {string}
|
* @param input {string}
|
||||||
@@ -213,7 +244,7 @@ class JM extends ComicSource {
|
|||||||
async get(url) {
|
async get(url) {
|
||||||
let time = Math.floor(Date.now() / 1000)
|
let time = Math.floor(Date.now() / 1000)
|
||||||
let kJmSecret = "185Hcomic3PAPP7R"
|
let kJmSecret = "185Hcomic3PAPP7R"
|
||||||
let res = await Network.get(url, this.getHeaders(time))
|
let res = await Network.get(url, this.getApiHeaders(time))
|
||||||
if(res.status !== 200) {
|
if(res.status !== 200) {
|
||||||
if(res.status === 401) {
|
if(res.status === 401) {
|
||||||
let json = JSON.parse(res.body)
|
let json = JSON.parse(res.body)
|
||||||
@@ -237,7 +268,7 @@ class JM extends ComicSource {
|
|||||||
let time = Math.floor(Date.now() / 1000)
|
let time = Math.floor(Date.now() / 1000)
|
||||||
let kJmSecret = "185Hcomic3PAPP7R"
|
let kJmSecret = "185Hcomic3PAPP7R"
|
||||||
let res = await Network.post(url, {
|
let res = await Network.post(url, {
|
||||||
...this.getHeaders(time),
|
...this.getApiHeaders(time),
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
}, body)
|
}, body)
|
||||||
if(res.status !== 200) {
|
if(res.status !== 200) {
|
||||||
@@ -634,7 +665,7 @@ class JM extends ComicSource {
|
|||||||
if (id.startsWith('jm')) {
|
if (id.startsWith('jm')) {
|
||||||
id = id.substring(2)
|
id = id.substring(2)
|
||||||
}
|
}
|
||||||
let res = await this.get(`${this.baseUrl}/album?comicName=&id=${id}`);
|
let res = await this.get(`${this.baseUrl}/album?id=${id}`);
|
||||||
let data = JSON.parse(res)
|
let data = JSON.parse(res)
|
||||||
let author = data.author ?? []
|
let author = data.author ?? []
|
||||||
let chapters = new Map()
|
let chapters = new Map()
|
||||||
@@ -735,10 +766,7 @@ class JM extends ComicSource {
|
|||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
headers: {
|
headers: this.getImgHeaders(),
|
||||||
"Accept-Encoding": "gzip",
|
|
||||||
"User-Agent": this.imgUa,
|
|
||||||
},
|
|
||||||
modifyImage: `
|
modifyImage: `
|
||||||
let modifyImage = (image) => {
|
let modifyImage = (image) => {
|
||||||
const num = ${num}
|
const num = ${num}
|
||||||
@@ -773,10 +801,7 @@ class JM extends ComicSource {
|
|||||||
*/
|
*/
|
||||||
onThumbnailLoad: (url) => {
|
onThumbnailLoad: (url) => {
|
||||||
return {
|
return {
|
||||||
headers: {
|
headers: this.getImgHeaders()
|
||||||
"Accept-Encoding": "gzip",
|
|
||||||
"User-Agent": this.imgUa,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user