DMZJ: revert to old API URL (#16118)
This commit is contained in:
parent
b0cc31af11
commit
992a989ee3
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'DMZJ'
|
||||
pkgNameSuffix = 'zh.dmzj'
|
||||
extClass = '.Dmzj'
|
||||
extVersionCode = 37
|
||||
extVersionCode = 38
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -11,7 +11,7 @@ import okhttp3.Response
|
|||
object ApiV3 {
|
||||
|
||||
private const val v3apiUrl = "https://v3api.idmzj.com"
|
||||
private const val apiUrl = "https://api.idmzj.com"
|
||||
private const val apiUrl = "https://api.dmzj.com"
|
||||
|
||||
fun popularMangaUrl(page: Int) = "$v3apiUrl/classify/0/0/${page - 1}.json"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import kotlin.reflect.typeOf
|
|||
|
||||
object ApiV4 {
|
||||
|
||||
private const val v4apiUrl = "https://nnv4api.idmzj.com"
|
||||
private const val v4apiUrl = "https://nnv4api.dmzj.com"
|
||||
|
||||
fun mangaInfoUrl(id: String) = "$v4apiUrl/comic/detail/$id?uid=2665531"
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ class Dmzj : ConfigurableSource, HttpSource() {
|
|||
override val lang = "zh"
|
||||
override val supportsLatest = true
|
||||
override val name = "动漫之家"
|
||||
override val baseUrl = "https://m.idmzj.com"
|
||||
override val baseUrl = "https://m.dmzj.com"
|
||||
|
||||
private val preferences: SharedPreferences by lazy {
|
||||
private val preferences: SharedPreferences =
|
||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||
}
|
||||
.migrate()
|
||||
|
||||
override val client: OkHttpClient = network.client.newBuilder()
|
||||
.addInterceptor(ImageUrlInterceptor)
|
||||
|
@ -47,7 +47,7 @@ class Dmzj : ConfigurableSource, HttpSource() {
|
|||
.build()
|
||||
|
||||
private fun fetchIdBySlug(slug: String): String {
|
||||
val request = GET("https://manhua.idmzj.com/$slug/", headers)
|
||||
val request = GET("https://manhua.dmzj.com/$slug/", headers)
|
||||
val html = client.newCall(request).execute().body.string()
|
||||
val start = "g_comic_id = \""
|
||||
val startIndex = html.indexOf(start) + start.length
|
||||
|
@ -142,7 +142,6 @@ class Dmzj : ConfigurableSource, HttpSource() {
|
|||
if (id !in preferences.hiddenList) {
|
||||
fetchMangaInfoV4(id)?.run { return toSManga() }
|
||||
}
|
||||
throw Exception("目前无法获取特殊漫画类型 (2) 的详情 (ID: $id)")
|
||||
val response = client.newCall(GET(ApiV3.mangaInfoUrlV1(id), headers)).execute()
|
||||
return ApiV3.parseMangaDetailsV1(response)
|
||||
}
|
||||
|
@ -171,7 +170,6 @@ class Dmzj : ConfigurableSource, HttpSource() {
|
|||
return@fromCallable result.parseChapterList()
|
||||
}
|
||||
}
|
||||
throw Exception("目前无法获取特殊漫画的章节目录 (ID: $id)")
|
||||
val response = client.newCall(GET(ApiV3.mangaInfoUrlV1(id), headers)).execute()
|
||||
ApiV3.parseChapterListV1(response)
|
||||
}
|
||||
|
|
|
@ -85,6 +85,19 @@ private fun SharedPreferences.addToSet(key: String, id: String, oldSet: Set<Stri
|
|||
edit().putStringSet(key, newSet).apply()
|
||||
}
|
||||
|
||||
fun SharedPreferences.migrate(): SharedPreferences {
|
||||
val currentVersion = 1
|
||||
val versionPref = "version"
|
||||
val oldVersion = getInt(versionPref, 0)
|
||||
if (oldVersion >= currentVersion) return this
|
||||
val editor = edit()
|
||||
if (oldVersion < 1) {
|
||||
editor.remove(LICENSED_LIST_PREF).remove(HIDDEN_LIST_PREF)
|
||||
}
|
||||
editor.putInt(versionPref, currentVersion).apply()
|
||||
return this
|
||||
}
|
||||
|
||||
private const val IMAGE_QUALITY_PREF = "imageSourcePreference"
|
||||
const val AUTO_RES = "PREFER_ORIG_RES"
|
||||
const val ORIGINAL_RES = "ORIG_RES_ONLY"
|
||||
|
|
Loading…
Reference in New Issue