diff --git a/src/zh/dmzj/build.gradle b/src/zh/dmzj/build.gradle index 11b9ba490..9d8bbdbe6 100644 --- a/src/zh/dmzj/build.gradle +++ b/src/zh/dmzj/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'DMZJ' pkgNameSuffix = 'zh.dmzj' extClass = '.Dmzj' - extVersionCode = 37 + extVersionCode = 38 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV3.kt b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV3.kt index 9d728c799..397373879 100644 --- a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV3.kt +++ b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV3.kt @@ -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" diff --git a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV4.kt b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV4.kt index c10974f5d..20cbf73be 100644 --- a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV4.kt +++ b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/ApiV4.kt @@ -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" diff --git a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt index 50853e7e1..7069a7d93 100644 --- a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt +++ b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt @@ -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().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) } diff --git a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Preferences.kt b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Preferences.kt index 860265202..bcb21f844 100644 --- a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Preferences.kt +++ b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Preferences.kt @@ -85,6 +85,19 @@ private fun SharedPreferences.addToSet(key: String, id: String, oldSet: Set= 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"