File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
src/main/java/com/cyh128/hikari_novel/util Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ android {
1414 applicationId = " com.cyh128.hikari_novel"
1515 minSdk = 24
1616 targetSdk = 34 // 暂时不要升到35,不然之前的edgeToEdge效果会消失
17- versionCode = 250917
18- versionName = " 3.9.6 "
17+ versionCode = 251002
18+ versionName = " 3.9.7 "
1919
2020 testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
2121 }
Original file line number Diff line number Diff line change @@ -506,12 +506,20 @@ object Wenku8Parser {
506506 val regex = " <!--image-->(.*?)<!--image-->" .toRegex()
507507 val images = mutableListOf<String >()
508508 regex.findAll(content).forEach { matchResult ->
509- val url = matchResult.groupValues[1 ].trim()
509+ var url = matchResult.groupValues[1 ].trim()
510+ url = replaceDomain(url)
510511 images.add(url)
511512 }
512513 return images
513514 }
514515
516+ private fun replaceDomain (url : String , newDomain : String = "pic.777743.xyz"): String {
517+ val regex = Regex (""" https?://([^/]+)""" )
518+ return url.replace(regex) { matchResult ->
519+ matchResult.value.replace(matchResult.groupValues[1 ], newDomain)
520+ }
521+ }
522+
515523 // 判断当前页面是否为首页界面,以判断网络连接是否正常
516524 fun isIndexPage (html : String ): Boolean {
517525 val document = Jsoup .parse(html)
You can’t perform that action at this time.
0 commit comments