diff --git a/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt b/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt
index c77a92b21..77d8eee64 100644
--- a/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt
+++ b/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt
@@ -47,6 +47,7 @@ data class HttpTTS(
id = doc.readLong("$.id") ?: System.currentTimeMillis(),
name = doc.readString("$.name")!!,
url = doc.readString("$.url")!!,
+ contentType = doc.readString("$.contentType"),
concurrentRate = doc.readString("$.concurrentRate"),
loginUrl = doc.readString("$.loginUrl"),
loginUi = if (loginUi is List<*>) GSON.toJson(loginUi) else loginUi?.toString(),
diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt
index 5c0d4971e..f0e11dc90 100644
--- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt
+++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt
@@ -134,7 +134,8 @@ class HttpReadAloudService : BaseReadAloudService(),
response = analyzeUrl.evalJS(checkJs, response) as Response
}
}
- httpTts.contentType?.let { contentTypeRegex ->
+ val contentTypeRegex = httpTts.contentType
+ if (!contentTypeRegex.isNullOrBlank()) {
response.headers["Content-Type"]?.let { contentType ->
if (!contentType.matches(contentTypeRegex.toRegex())) {
throw NoStackTraceException(response.body!!.string())
diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditDialog.kt
index f3b95bef9..d519db410 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditDialog.kt
@@ -72,6 +72,7 @@ class HttpTtsEditDialog() : BaseDialogFragment(R.layout.dialog_http_tts_edit),
fun initView(httpTTS: HttpTTS) {
binding.tvName.setText(httpTTS.name)
binding.tvUrl.setText(httpTTS.url)
+ binding.tvContentType.setText(httpTTS.contentType)
binding.tvLoginUrl.setText(httpTTS.loginUrl)
binding.tvLoginUi.setText(httpTTS.loginUi)
binding.tvLoginCheckJs.setText(httpTTS.loginCheckJs)
@@ -117,6 +118,7 @@ class HttpTtsEditDialog() : BaseDialogFragment(R.layout.dialog_http_tts_edit),
id = viewModel.id ?: System.currentTimeMillis(),
name = binding.tvName.text.toString(),
url = binding.tvUrl.text.toString(),
+ contentType = binding.tvContentType.text?.toString(),
loginUrl = binding.tvLoginUrl.text?.toString(),
loginUi = binding.tvLoginUi.text?.toString(),
loginCheckJs = binding.tvLoginCheckJs.text?.toString(),
diff --git a/app/src/main/res/layout/dialog_http_tts_edit.xml b/app/src/main/res/layout/dialog_http_tts_edit.xml
index 0b0b0430a..2d2f42264 100644
--- a/app/src/main/res/layout/dialog_http_tts_edit.xml
+++ b/app/src/main/res/layout/dialog_http_tts_edit.xml
@@ -51,6 +51,20 @@
+
+
+
+
+
+