Merge remote-tracking branch 'origin/master'

pull/1688/head
kunfei 3 years ago
commit 7ed6089ab9
  1. 25
      .github/workflows/stale.yml
  2. 2
      app/src/main/assets/web/bookshelf/css/detail.508547d2.css
  3. 4
      app/src/main/assets/web/bookshelf/index.html
  4. 0
      app/src/main/assets/web/bookshelf/js/about.3de69a08.js
  5. 2
      app/src/main/assets/web/bookshelf/js/app.cf266357.js
  6. 1
      app/src/main/assets/web/bookshelf/js/detail.4e45d3b6.js
  7. 1
      app/src/main/assets/web/bookshelf/js/detail.fdc516bb.js
  8. 19
      app/src/main/java/io/legado/app/api/controller/BookController.kt
  9. 28
      app/src/main/java/io/legado/app/help/RuleComplete.kt

@ -0,0 +1,25 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: closeStaleIssue
on:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: '由于长期没有状态更新,该问题将于5天后自动关闭。如有需要可重新打开。'
days-before-stale: 30
days-before-close: 5

@ -1,3 +1,3 @@
<!DOCTYPE html><html lang="en" style="padding: 0;height:100%"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="../favicon.ico" type="image/x-icon"><link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"><title>Legado Bookshelf</title><link href="css/about.af6c5045.css" rel="prefetch"><link href="css/detail.f410d97f.css" rel="prefetch"><link href="js/about.ee7b2200.js" rel="prefetch"><link href="js/detail.4e45d3b6.js" rel="prefetch"><link href="css/app.e4c919b7.css" rel="preload" as="style"><link href="css/chunk-vendors.5f0f4fba.css" rel="preload" as="style"><link href="js/app.ff27f6a9.js" rel="preload" as="script"><link href="js/chunk-vendors.d2b07f8f.js" rel="preload" as="script"><link href="css/chunk-vendors.5f0f4fba.css" rel="stylesheet"><link href="css/app.e4c919b7.css" rel="stylesheet"></head><style>body::-webkit-scrollbar {
<!DOCTYPE html><html lang="en" style="padding: 0;height:100%"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="../favicon.ico" type="image/x-icon"><link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"><title>Legado Bookshelf</title><link href="css/about.af6c5045.css" rel="prefetch"><link href="css/detail.508547d2.css" rel="prefetch"><link href="js/about.3de69a08.js" rel="prefetch"><link href="js/detail.fdc516bb.js" rel="prefetch"><link href="css/app.e4c919b7.css" rel="preload" as="style"><link href="css/chunk-vendors.5f0f4fba.css" rel="preload" as="style"><link href="js/app.cf266357.js" rel="preload" as="script"><link href="js/chunk-vendors.d2b07f8f.js" rel="preload" as="script"><link href="css/chunk-vendors.5f0f4fba.css" rel="stylesheet"><link href="css/app.e4c919b7.css" rel="stylesheet"></head><style>body::-webkit-scrollbar {
display: none;
}</style><body style="margin: 0;height:100%"><noscript><strong>We're sorry but yd-web-tool doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.d2b07f8f.js"></script><script src="js/app.ff27f6a9.js"></script></body></html>
}</style><body style="margin: 0;height:100%"><noscript><strong>We're sorry but yd-web-tool doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.d2b07f8f.js"></script><script src="js/app.cf266357.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -8,6 +8,7 @@ import io.legado.app.api.ReturnData
import io.legado.app.constant.PreferKey
import io.legado.app.data.appDb
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookSource
import io.legado.app.help.BookHelp
import io.legado.app.help.CacheManager
import io.legado.app.help.ContentProcessor
@ -29,6 +30,10 @@ import java.io.FileOutputStream
object BookController {
private lateinit var book: Book
private var bookSource: BookSource? = null
private var bookUrl: String = ""
/**
* 书架所有书籍
*/
@ -72,19 +77,25 @@ object BookController {
val returnData = ReturnData()
val bookUrl = parameters["url"]?.firstOrNull()
?: return returnData.setErrorMsg("bookUrl为空")
val book = appDb.bookDao.getBook(bookUrl)
?: return returnData.setErrorMsg("bookUrl不对:${bookUrl}")
val src = parameters["path"]?.firstOrNull()
?: return returnData.setErrorMsg("图片链接为空")
val width = parameters["width"]?.firstOrNull()?.toInt() ?: 640
if (this.bookUrl != bookUrl) {
this.book = appDb.bookDao.getBook(bookUrl)
?: return returnData.setErrorMsg("bookUrl不对")
}
val vFile = BookHelp.getImage(book, src)
if (!vFile.exists()) {
val bookSource = appDb.bookSourceDao.getBookSource(book.origin)
if (this.bookUrl != bookUrl) {
this.bookSource = appDb.bookSourceDao.getBookSource(book.origin)
}
runBlocking {
BookHelp.saveImage(bookSource, book, src)
}
}
this.bookUrl = bookUrl
return returnData.setData(
BitmapUtils.decodeBitmap(vFile.absolutePath, 640, 640)
BitmapUtils.decodeBitmap(vFile.absolutePath, width, width)
)
}

@ -34,15 +34,29 @@ object RuleComplete {
if (rules.isNullOrEmpty()||rules.contains(notComplete) || preRule?.contains(notComplete) ?: false){
return rules
}
// 分离正则
val regexSplit=rules.split("##".toRegex(),2)
val cleanedRule=regexSplit[0]
val regexRule=if (regexSplit.size>1) "##"+regexSplit[1] else ""
/** 尾部##分割的正则或由,分割的参数 */
val tailStr: String
/** 分割字符 */
val splitStr:String
/** 用于获取文字时添加的规则 */
val textRule: String
/** 用于获取链接时添加的规则 */
val linkRule: String
/** 用于获取图片时添加的规则 */
val imgRule: String
/** 用于获取图片alt属性时添加的规则 */
val imgText: String
// 分离尾部规则
val regexSplit=rules.split("##|,".toRegex(),2)
val cleanedRule=regexSplit[0]
if (regexSplit.size>1){
splitStr="##|,".toRegex().find(rules)?.value ?: ""
tailStr = splitStr + regexSplit[1]
}else{
tailStr = ""
}
if (cleanedRule.contains(isXpath)){
textRule = "//text()\${seq}"
linkRule = "//@href\${seq}"
@ -55,9 +69,9 @@ object RuleComplete {
imgText = "img\${at}@alt\${seq}"
}
return when (type) {
1 -> needComplete.replace(cleanedRule, textRule).replace(fixImgInfo, imgText) + regexRule
2 -> needComplete.replace(cleanedRule, linkRule) + regexRule
3 -> needComplete.replace(cleanedRule, imgRule) + regexRule
1 -> needComplete.replace(cleanedRule, textRule).replace(fixImgInfo, imgText) + tailStr
2 -> needComplete.replace(cleanedRule, linkRule) + tailStr
3 -> needComplete.replace(cleanedRule, imgRule) + tailStr
else -> rules
}
}

Loading…
Cancel
Save