[copy_manga] Update copyVersion && Allow user to edit apiUrl (#70)

* [copy_manga] Update copyVersion && Allow user to edit apiUrl

mangacopy.com is currently inaccessible in mainland China.

* Update index.json

* fix favorite
This commit is contained in:
角砂糖
2025-05-11 08:20:53 +08:00
committed by GitHub
parent 474c812144
commit ac38d8809e
2 changed files with 30 additions and 22 deletions

View File

@@ -4,7 +4,7 @@ class CopyManga extends ComicSource {
key = "copy_manga"
version = "1.1.4"
version = "1.1.5"
minAppVersion = "1.2.1"
@@ -12,9 +12,11 @@ class CopyManga extends ComicSource {
headers = {}
static copyVersion = "2.2.6"
static copyVersion = "2.2.9"
static apiUrl = "https://api.mangacopy.com"
get apiUrl() {
return `https://${this.loadSetting('base_url')}`
}
init() {
let token = this.loadData("token");
@@ -46,7 +48,7 @@ class CopyManga extends ComicSource {
let salt = randomInt(1000, 9999)
let base64 = Convert.encodeBase64(Convert.encodeUtf8(`${pwd}-${salt}`))
let res = await Network.post(
`${CopyManga.apiUrl}/api/v3/login?platform=3`,
`${this.apiUrl}/api/v3/login?platform=3`,
{
...this.headers,
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
@@ -77,7 +79,7 @@ class CopyManga extends ComicSource {
logout: () => {
this.deleteData('token')
},
registerWebsite: "https://www.mangacopy.com/web/login/loginByAccount"
registerWebsite: null
}
/// explore pages
@@ -87,7 +89,7 @@ class CopyManga extends ComicSource {
type: "singlePageWithMultiPart",
load: async () => {
let dataStr = await Network.get(
`${CopyManga.apiUrl}/api/v3/h5/homeIndex?platform=3`,
`${this.apiUrl}/api/v3/h5/homeIndex?platform=3`,
this.headers
)
@@ -223,7 +225,7 @@ class CopyManga extends ComicSource {
let category_url;
// 分类-排行
if (category === "排行" || param === "ranking") {
category_url = `${CopyManga.apiUrl}/api/v3/ranks?limit=21&offset=${(page - 1) * 21}&_update=true&type=1&audience_type=${options[0]}&date_type=${options[1]}`
category_url = `${this.apiUrl}/api/v3/ranks?limit=21&offset=${(page - 1) * 21}&_update=true&type=1&audience_type=${options[0]}&date_type=${options[1]}`
} else {
// 分类-主题
if (category !== undefined && category !== null) {
@@ -231,7 +233,7 @@ class CopyManga extends ComicSource {
param = CopyManga.category_param_dict[category] || "";
}
options = options.map(e => e.replace("*", "-"))
category_url = `${CopyManga.apiUrl}/api/v3/comics?limit=21&offset=${(page - 1) * 21}&ordering=${options[1]}&theme=${param}&top=${options[0]}&platform=3`
category_url = `${this.apiUrl}/api/v3/comics?limit=21&offset=${(page - 1) * 21}&ordering=${options[1]}&theme=${param}&top=${options[0]}&platform=3`
}
@@ -354,7 +356,7 @@ class CopyManga extends ComicSource {
if (author && author in this.author_path_word_dict) {
let path_word = encodeURIComponent(this.author_path_word_dict[author]);
res = await Network.get(
`${CopyManga.apiUrl}/api/v3/comics?limit=21&offset=${(page - 1) * 21}&ordering=-datetime_updated&author=${path_word}&platform=3`,
`${this.apiUrl}/api/v3/comics?limit=21&offset=${(page - 1) * 21}&ordering=-datetime_updated&author=${path_word}&platform=3`,
this.headers
)
}
@@ -365,7 +367,7 @@ class CopyManga extends ComicSource {
q_type = options[0];
}
keyword = encodeURIComponent(keyword)
let search_url = this.loadSetting('search_api') === "webAPI" ? "https://www.mangacopy.com/api/kb/web/searchbd/comics" : `${CopyManga.apiUrl}/api/v3/search/comic`
let search_url = this.loadSetting('search_api') === "webAPI" ? `${this.apiUrl}/api/kb/web/searchbd/comics` : `${this.apiUrl}/api/v3/search/comic`
res = await Network.get(
`${search_url}?limit=21&offset=${(page - 1) * 21}&q=${keyword}&q_type=${q_type}&platform=3`,
this.headers
@@ -426,7 +428,7 @@ class CopyManga extends ComicSource {
let is_collect = isAdding ? 1 : 0
let token = this.loadData("token");
let comicData = await Network.get(
`${CopyManga.apiUrl}/api/v3/comic2/${comicId}?platform=3`,
`${this.apiUrl}/api/v3/comic2/${comicId}?platform=3`,
this.headers
)
if (comicData.status !== 200) {
@@ -434,7 +436,7 @@ class CopyManga extends ComicSource {
}
let comic_id = JSON.parse(comicData.body).results.comic.uuid
let res = await Network.post(
`${CopyManga.apiUrl}/api/v3/member/collect/comic?platform=3`,
`${this.apiUrl}/api/v3/member/collect/comic?platform=3`,
{
...this.headers,
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
@@ -451,7 +453,7 @@ class CopyManga extends ComicSource {
},
loadComics: async (page, folder) => {
var res = await Network.get(
`${CopyManga.apiUrl}/api/v3/member/collect/comics?limit=21&offset=${(page - 1) * 21}&free_type=1&ordering=-datetime_updated&platform=3`,
`${this.apiUrl}/api/v3/member/collect/comics?limit=21&offset=${(page - 1) * 21}&free_type=1&ordering=-datetime_updated&platform=3`,
this.headers
)
@@ -501,7 +503,7 @@ class CopyManga extends ComicSource {
let getChapters = async (id, groups) => {
let fetchSingle = async (id, path) => {
let res = await Network.get(
`${CopyManga.apiUrl}/api/v3/comic/${id}/group/${path}/chapters?limit=500&offset=0&platform=3`,
`${this.apiUrl}/api/v3/comic/${id}/group/${path}/chapters?limit=500&offset=0&platform=3`,
this.headers
);
if (res.status !== 200) {
@@ -519,7 +521,7 @@ class CopyManga extends ComicSource {
let offset = 500;
while (offset < maxChapter) {
res = await Network.get(
`${CopyManga.apiUrl}/api/v3/comic/chongjingchengweimofashaonv/group/${path}/chapters?limit=500&offset=${offset}&platform=3`,
`${this.apiUrl}/api/v3/comic/chongjingchengweimofashaonv/group/${path}/chapters?limit=500&offset=${offset}&platform=3`,
this.headers
);
if (res.status !== 200) {
@@ -567,7 +569,7 @@ class CopyManga extends ComicSource {
}
let getFavoriteStatus = async (id) => {
let res = await Network.get(`${CopyManga.apiUrl}/api/v3/comic2/${id}/query?platform=3`, this.headers);
let res = await Network.get(`${this.apiUrl}/api/v3/comic2/${id}/query?platform=3`, this.headers);
if (res.status !== 200) {
throw `Invalid status code: ${res.status}`;
}
@@ -576,7 +578,7 @@ class CopyManga extends ComicSource {
let results = await Promise.all([
Network.get(
`${CopyManga.apiUrl}/api/v3/comic2/${id}?platform=3`,
`${this.apiUrl}/api/v3/comic2/${id}?platform=3`,
this.headers
),
getFavoriteStatus.bind(this)(id)
@@ -628,7 +630,7 @@ class CopyManga extends ComicSource {
while (attempt < maxAttempts) {
try {
res = await Network.get(
`${CopyManga.apiUrl}/api/v3/comic/${comicId}/chapter2/${epId}?platform=3`,
`${this.apiUrl}/api/v3/comic/${comicId}/chapter2/${epId}?platform=3`,
this.headers
);
@@ -688,7 +690,7 @@ class CopyManga extends ComicSource {
}
},
loadComments: async (comicId, subId, page, replyTo) => {
let url = `${CopyManga.apiUrl}/api/v3/comments?comic_id=${subId}&limit=20&offset=${(page - 1) * 20}`;
let url = `${this.apiUrl}/api/v3/comments?comic_id=${subId}&limit=20&offset=${(page - 1) * 20}`;
if (replyTo) {
url = url + `&reply_id=${replyTo}&_update=true`;
}
@@ -731,7 +733,7 @@ class CopyManga extends ComicSource {
replyTo = '';
}
let res = await Network.post(
`${CopyManga.apiUrl}/api/v3/member/comment`,
`${this.apiUrl}/api/v3/member/comment`,
{
...this.headers,
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
@@ -791,7 +793,13 @@ class CopyManga extends ComicSource {
}
],
default: 'baseAPI'
}
},
base_url: {
title: "API地址",
type: "input",
validator: '^(?!:\\/\\/)(?=.{1,253})([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}$',
default: 'www.copy20.com',
},
}
/**

View File

@@ -3,7 +3,7 @@
"name": "拷贝漫画",
"fileName": "copy_manga.js",
"key": "copy_manga",
"version": "1.1.4"
"version": "1.1.5"
},
{
"name": "Komiic",