This commit is contained in:
Horis
2025-02-10 13:53:50 +08:00
parent 88a03b70ec
commit 0a53d7b28d
4 changed files with 24 additions and 17 deletions
@@ -103,16 +103,20 @@ interface BaseSource : JsExtensions {
*/
fun getHeaderMap(hasLoginHeader: Boolean = false) = HashMap<String, String>().apply {
header?.let {
val json = when {
it.startsWith("@js:", true) -> evalJS(it.substring(4)).toString()
it.startsWith("<js>", true) -> evalJS(
it.substring(4, it.lastIndexOf("<"))
).toString()
try {
val json = when {
it.startsWith("@js:", true) -> evalJS(it.substring(4)).toString()
it.startsWith("<js>", true) -> evalJS(
it.substring(4, it.lastIndexOf("<"))
).toString()
else -> it
}
GSON.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
putAll(map)
else -> it
}
GSON.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
putAll(map)
}
} catch (e: Exception) {
AppLog.put("getHeaderMap 出错\n$e", e)
}
}
if (!has(AppConst.UA_NAME, true)) {
@@ -1293,7 +1293,7 @@ class ReadBookActivity : BaseReadBookActivity(),
analyzeRule.setBaseUrl(chapter.url)
analyzeRule.chapter = chapter
analyzeRule.evalJS(payAction).toString()
}.onSuccess {
}.onSuccess(IO) {
if (it.isAbsUrl()) {
startActivity<WebViewActivity> {
putExtra("title", getString(R.string.chapter_pay))
@@ -23,6 +23,7 @@ import io.legado.app.help.config.AppConfig
import io.legado.app.help.config.LocalConfig
import io.legado.app.help.config.ReadBookConfig
import io.legado.app.help.config.ThemeConfig
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.Selector
import io.legado.app.lib.theme.accentColor
@@ -346,11 +347,13 @@ class ReadMenu @JvmOverloads constructor(
if (AppConfig.readUrlInBrowser) {
context.openUrl(tvChapterUrl.text.toString().substringBefore(",{"))
} else {
context.startActivity<WebViewActivity> {
val url = tvChapterUrl.text.toString()
putExtra("title", tvChapterName.text)
putExtra("url", url)
IntentData.put(url, ReadBook.bookSource?.getHeaderMap(true))
Coroutine.async {
context.startActivity<WebViewActivity> {
val url = tvChapterUrl.text.toString()
putExtra("title", tvChapterName.text)
putExtra("url", url)
IntentData.put(url, ReadBook.bookSource?.getHeaderMap(true))
}
}
}
}
@@ -159,7 +159,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
@@ -379,7 +379,7 @@
</LinearLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@+id/fl_action"