Merge pull request #737 from Celeter/master

优化
pull/743/head 3.20.121618
kunfei 4 years ago committed by GitHub
commit b7cd5bd176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .github/workflows/legado.yml
  2. 5
      app/src/main/java/io/legado/app/constant/AppConst.kt
  3. 8
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  4. 2
      app/src/main/java/io/legado/app/model/webBook/BookInfo.kt
  5. 4
      app/src/main/java/io/legado/app/model/webBook/BookList.kt

@ -28,7 +28,7 @@ jobs:
# 蓝奏云里的文件夹名(需手动在蓝奏云创建)
LANZOU_FOLDER: '阅读3测试版'
# 是否上传到artifact
UPLOAD_ARTIFACT: 'true'
UPLOAD_ARTIFACT: 'false'
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
@ -57,7 +57,7 @@ jobs:
echo "开始进行release构建"
chmod +x gradlew
./gradlew assembleAppRelease
- name: upload apk
- name: Upload App To Artifact
if: ${{ env.UPLOAD_ARTIFACT != 'false' }}
uses: actions/upload-artifact@v2
with:
@ -83,7 +83,7 @@ jobs:
f.write(res.content)
env:
FILEPATH: ${{ github.workspace }}/.github/lzy.py
- name: Upload App
- name: Upload App To Lanzou
if: ${{ env.LANZOU_PSD }}
run: python $GITHUB_WORKSPACE/.github/lzy.py
env:

@ -36,9 +36,8 @@ object AppConst {
val keyboardToolChars: List<String> by lazy {
arrayListOf(
"", "@", "&", "|", "%", "/", "\\", ":", "[", "]", "{", "}", "<", ">",
"$", "#", "!", ".", "+", "-", "*", "=", "href", "src", "textNodes", "xpath", "json",
"css", "id", "class", "tag"
"", "@css:", "<js></js>", "{{}}", "&&", "%%", "||", "//", "$.", "@", "class", "id", "href",
"textNodes", "ownText", "all", "html", "[", "]", "<", ">","#", "!", ".", "+", "-", "*", "="
)
}

@ -54,10 +54,10 @@ interface JsExtensions {
}
/**
* 实现文件下载,返回路径
* 实现16进制字符串转文件
*/
fun downloadFile(content: String, url: String): String {
val type = AnalyzeUrl(url).type ?: return "type为空,未下载"
val type = AnalyzeUrl(url).type ?: return ""
val zipPath = FileUtils.getPath(
FileUtils.createFolderIfNotExist(FileUtils.getCachePath()),
"${MD5Utils.md5Encode16(url)}.${type}"
@ -76,6 +76,7 @@ interface JsExtensions {
* js实现压缩文件解压
*/
fun unzipFile(zipPath: String): String {
if (zipPath.isEmpty()) return ""
val unzipPath = FileUtils.getPath(
FileUtils.createFolderIfNotExist(FileUtils.getCachePath()),
FileUtils.getNameExcludeExtension(zipPath)
@ -92,6 +93,7 @@ interface JsExtensions {
* js实现文件夹内所有文件读取
*/
fun getTxtInFolder(unzipPath: String): String {
if (unzipPath.isEmpty()) return ""
val unzipFolder = FileUtils.createFolderIfNotExist(unzipPath)
val contents = StringBuilder()
unzipFolder.listFiles().let {
@ -109,7 +111,7 @@ interface JsExtensions {
}
/**
* js实现重定向拦截,不能删
* js实现重定向拦截,网络访问get
*/
fun get(urlStr: String, headers: Map<String, String>): Connection.Response {
return Jsoup.connect(urlStr)

@ -70,7 +70,7 @@ object BookInfo {
analyzeRule.getString(infoRule.intro).let {
if (it.isNotEmpty()) book.intro = it.htmlFormat()
}
Debug.log(bookSource.bookSourceUrl, "${book.intro}", isHtml = true)
Debug.log(bookSource.bookSourceUrl, "${book.intro}")
Debug.log(bookSource.bookSourceUrl, "┌获取封面链接")
analyzeRule.getString(infoRule.coverUrl).let {

@ -163,7 +163,7 @@ object BookList {
if (!scope.isActive) throw CancellationException()
Debug.log(bookSource.bookSourceUrl, "┌获取简介")
searchBook.intro = analyzeRule.getString(intro).htmlFormat()
Debug.log(bookSource.bookSourceUrl, "${searchBook.intro}", true)
Debug.log(bookSource.bookSourceUrl, "${searchBook.intro}")
if (!scope.isActive) throw CancellationException()
Debug.log(bookSource.bookSourceUrl, "┌获取封面链接")
searchBook.coverUrl = analyzeRule.getString(coverUrl, true)
@ -223,7 +223,7 @@ object BookList {
if (!scope.isActive) throw CancellationException()
Debug.log(bookSource.bookSourceUrl, "┌获取简介", log)
searchBook.intro = analyzeRule.getString(ruleIntro).htmlFormat()
Debug.log(bookSource.bookSourceUrl, "${searchBook.intro}", log, true)
Debug.log(bookSource.bookSourceUrl, "${searchBook.intro}", log)
if (!scope.isActive) throw CancellationException()
Debug.log(bookSource.bookSourceUrl, "┌获取封面链接", log)
analyzeRule.getString(ruleCoverUrl).let {

Loading…
Cancel
Save