pull/1395/head
gedoor 3 years ago
parent 3be6838d3d
commit 05481ac32c
  1. 2
      app/src/main/assets/defaultData/httpTTS.json
  2. 9
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  3. 4
      app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt
  4. 4
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt
  5. 10
      app/src/main/java/io/legado/app/model/webBook/WebBook.kt
  6. 2
      app/src/main/java/io/legado/app/ui/book/read/TextActionMenu.kt
  7. 2
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt

@ -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",

@ -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)
}
/**
* 时间格式化
*/

@ -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()

@ -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()

@ -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<SearchBook> {
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,

@ -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 {

@ -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()
)

Loading…
Cancel
Save