diff --git a/app/src/main/assets/defaultData/httpTTS.json b/app/src/main/assets/defaultData/httpTTS.json index f0d143baf..1dd21ac25 100644 --- a/app/src/main/assets/defaultData/httpTTS.json +++ b/app/src/main/assets/defaultData/httpTTS.json @@ -13,7 +13,7 @@ "id": -29, "name": "3.阿里云语音", "url": "https://nls-gateway.cn-shanghai.aliyuncs.com/stream/v1/tts,{\"method\": \"POST\",\"body\", {\"appkey\":\"31f932fb\",\"text\":\"{{speakText}}\",\"format\":\"mp3\"}}", - "loginUrl": "var query = 'AccessKeyId=' + source.loginInfoMap().get('AccessKeyId') + '&Action=CreateToken&Version=2019-02-28&Format=JSON&RegionId=cn-shanghai&SignatureMethod=HMAC-SHA1&SignatureVersion=1.0&SignatureNonce=' + java.UUID", + "loginUrl": "var query = 'AccessKeyId=' + source.loginInfoMap().get('AccessKeyId') + '&Action=CreateToken&Format=JSON&RegionId=cn-shanghai&SignatureMethod=HMAC-SHA1&SignatureNonce=' + java.UUID + '&SignatureVersion=1.0&Timestamp=' + java.timeFormatUTC(new Date().getTime(), 'YYYY-MM-DDThh:mm:ssZ', 0) + '&Version=2019-02-28'; ", "loginUi": [ { "name": "AccessKeyId", diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index 62b859e92..f154cfa12 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -13,6 +13,7 @@ import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.async import kotlinx.coroutines.runBlocking +import org.apache.commons.lang3.time.DateFormatUtils import org.jsoup.Connection import org.jsoup.Jsoup import splitties.init.appCtx @@ -224,6 +225,14 @@ interface JsExtensions { return MD5Utils.md5Encode16(str) } + /** + * 格式化时间 + */ + fun timeFormatUTC(time: Long, format: String, sh: Int): String? { + val utc = SimpleTimeZone(sh, "UTC") + return DateFormatUtils.format(Date(time), format, utc, null) + } + /** * 时间格式化 */ diff --git a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt index 42671fe54..7353dd33d 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt @@ -63,7 +63,7 @@ object BookChapterList { while (nextUrl.isNotEmpty() && !nextUrlList.contains(nextUrl)) { nextUrlList.add(nextUrl) AnalyzeUrl( - ruleUrl = nextUrl, + mUrl = nextUrl, source = bookSource, ruleData = book, headerMapF = bookSource.getHeaderMap() @@ -85,7 +85,7 @@ object BookChapterList { async(IO) { val urlStr = chapterData.second[it] val analyzeUrl = AnalyzeUrl( - ruleUrl = urlStr, + mUrl = urlStr, source = bookSource, ruleData = book, headerMapF = bookSource.getHeaderMap() diff --git a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt index d570aa27d..de4698d6c 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt @@ -68,7 +68,7 @@ object BookContent { nextUrlList.add(nextUrl) scope.ensureActive() val res = AnalyzeUrl( - ruleUrl = nextUrl, + mUrl = nextUrl, source = bookSource, ruleData = book, headerMapF = bookSource.getHeaderMap() @@ -91,7 +91,7 @@ object BookContent { async(IO) { val urlStr = contentData.second[it] val analyzeUrl = AnalyzeUrl( - ruleUrl = urlStr, + mUrl = urlStr, source = bookSource, ruleData = book, headerMapF = bookSource.getHeaderMap() diff --git a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt index a662fb210..167f32a4a 100644 --- a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt @@ -66,7 +66,7 @@ object WebBook { val variableBook = SearchBook() bookSource.searchUrl?.let { searchUrl -> val analyzeUrl = AnalyzeUrl( - ruleUrl = searchUrl, + mUrl = searchUrl, key = key, page = page, baseUrl = bookSource.bookSourceUrl, @@ -117,7 +117,7 @@ object WebBook { ): ArrayList { val variableBook = SearchBook() val analyzeUrl = AnalyzeUrl( - ruleUrl = url, + mUrl = url, page = page, baseUrl = bookSource.bookSourceUrl, source = bookSource, @@ -176,7 +176,7 @@ object WebBook { ) } else { val analyzeUrl = AnalyzeUrl( - ruleUrl = book.bookUrl, + mUrl = book.bookUrl, baseUrl = bookSource.bookSourceUrl, source = bookSource, ruleData = book, @@ -233,7 +233,7 @@ object WebBook { ) } else { val analyzeUrl = AnalyzeUrl( - ruleUrl = book.tocUrl, + mUrl = book.tocUrl, baseUrl = book.bookUrl, source = bookSource, ruleData = book, @@ -297,7 +297,7 @@ object WebBook { ) } else { val analyzeUrl = AnalyzeUrl( - ruleUrl = bookChapter.getAbsoluteURL(), + mUrl = bookChapter.getAbsoluteURL(), baseUrl = book.tocUrl, source = bookSource, ruleData = book, diff --git a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt index 882c1ec5a..976f34a2a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt @@ -57,7 +57,7 @@ class TextActionMenu(private val context: Context, private val callBack: CallBac } menuItems = myMenu.visibleItems + otherMenu.visibleItems visibleMenuItems.addAll(menuItems.subList(0, 5)) - moreMenuItems.addAll(menuItems.subList(5, menuItems.lastIndex)) + moreMenuItems.addAll(menuItems.subList(5, menuItems.size)) binding.recyclerView.adapter = adapter binding.recyclerViewMore.adapter = adapter setOnDismissListener { diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt index 23024a514..1cfbe34fc 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt @@ -82,7 +82,7 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application), private fun loadUrl(url: String, baseUrl: String) { val analyzeUrl = AnalyzeUrl( - ruleUrl = url, + mUrl = url, baseUrl = baseUrl, headerMapF = rssSource?.getHeaderMap() )