mirror of
https://github.com/gedoor/legado.git
synced 2024-07-04 23:36:56 +08:00
Compare commits
6 Commits
b214cf5c1a
...
97f268fe71
Author | SHA1 | Date | |
---|---|---|---|
|
97f268fe71 | ||
|
5eaf2f034f | ||
|
b6b6718177 | ||
|
2aed021e08 | ||
|
06d486c96c | ||
|
a35b7737aa |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
|||
{"arm64-v8a":"bbf2c50d1ebf0763d451b08e290a3244","armeabi-v7a":"ecb872f7b1b5342f4d7c36262bec0600","x86":"4da4832b89e2412d808c5b1ecdc24e3d","x86_64":"62080f051db02ed0e939affb39ce67fb","version":"123.0.6312.80"}
|
||||
{"x86":"a9d092828a1a33ed43b3030e16353e9a","armeabi-v7a":"522f2f5304bf9250a43edc56bfff0fb4","x86_64":"bc89c549d18bcd26fef8e82fbad4a7cd","arm64-v8a":"ad9209119e3e74e532d07256b6e4e0ba","version":"124.0.6367.171"}
|
|
@ -13,6 +13,7 @@
|
|||
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
|
||||
|
||||
**2024/02/27**
|
||||
* 更新cronet: 124.0.6367.171
|
||||
* 更新cronet: 123.0.6312.80
|
||||
* 更新cronet: 123.0.6312.40
|
||||
|
||||
|
|
|
@ -284,14 +284,6 @@ data class Book(
|
|||
}
|
||||
}
|
||||
|
||||
fun getBookSource(): BookSource? {
|
||||
return appDb.bookSourceDao.getBookSource(origin)
|
||||
}
|
||||
|
||||
fun isLocalModified(): Boolean {
|
||||
return isLocal && LocalBook.getLastModified(this).getOrDefault(0L) > latestChapterTime
|
||||
}
|
||||
|
||||
fun toSearchBook() = SearchBook(
|
||||
name = name,
|
||||
author = author,
|
||||
|
|
|
@ -5,17 +5,26 @@ package io.legado.app.help.book
|
|||
import android.net.Uri
|
||||
import com.script.SimpleBindings
|
||||
import com.script.rhino.RhinoScriptEngine
|
||||
import io.legado.app.constant.*
|
||||
import io.legado.app.constant.AppLog
|
||||
import io.legado.app.constant.BookSourceType
|
||||
import io.legado.app.constant.BookType
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.data.entities.BaseBook
|
||||
import io.legado.app.data.entities.Book
|
||||
import io.legado.app.data.entities.BookSource
|
||||
import io.legado.app.exception.NoStackTraceException
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.utils.*
|
||||
import io.legado.app.model.localBook.LocalBook
|
||||
import io.legado.app.utils.FileDoc
|
||||
import io.legado.app.utils.exists
|
||||
import io.legado.app.utils.find
|
||||
import io.legado.app.utils.inputStream
|
||||
import io.legado.app.utils.isUri
|
||||
import io.legado.app.utils.toastOnUi
|
||||
import splitties.init.appCtx
|
||||
import java.io.File
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.collections.set
|
||||
|
||||
|
||||
val Book.isAudio: Boolean
|
||||
|
@ -223,6 +232,14 @@ fun Book.sync(oldBook: Book) {
|
|||
canUpdate = curBook.canUpdate
|
||||
}
|
||||
|
||||
fun Book.getBookSource(): BookSource? {
|
||||
return appDb.bookSourceDao.getBookSource(origin)
|
||||
}
|
||||
|
||||
fun Book.isLocalModified(): Boolean {
|
||||
return isLocal && LocalBook.getLastModified(this).getOrDefault(0L) > latestChapterTime
|
||||
}
|
||||
|
||||
fun Book.isSameNameAuthor(other: Any?): Boolean {
|
||||
if (other is BaseBook) {
|
||||
return name == other.name && author == other.author
|
||||
|
|
|
@ -71,6 +71,8 @@ open class WebDav(
|
|||
<resourcetype />
|
||||
</prop>
|
||||
</propfind>"""
|
||||
|
||||
private const val DEFAULT_CONTENT_TYPE = "application/octet-stream"
|
||||
}
|
||||
|
||||
|
||||
|
@ -304,18 +306,12 @@ open class WebDav(
|
|||
* 上传文件
|
||||
*/
|
||||
@Throws(WebDavException::class)
|
||||
suspend fun upload(
|
||||
localPath: String,
|
||||
contentType: String = "application/octet-stream"
|
||||
) {
|
||||
suspend fun upload(localPath: String, contentType: String = DEFAULT_CONTENT_TYPE) {
|
||||
upload(File(localPath), contentType)
|
||||
}
|
||||
|
||||
@Throws(WebDavException::class)
|
||||
suspend fun upload(
|
||||
file: File,
|
||||
contentType: String = "application/octet-stream"
|
||||
) {
|
||||
suspend fun upload(file: File, contentType: String = DEFAULT_CONTENT_TYPE) {
|
||||
kotlin.runCatching {
|
||||
withContext(IO) {
|
||||
if (!file.exists()) throw WebDavException("文件不存在")
|
||||
|
@ -336,7 +332,7 @@ open class WebDav(
|
|||
}
|
||||
|
||||
@Throws(WebDavException::class)
|
||||
suspend fun upload(byteArray: ByteArray, contentType: String) {
|
||||
suspend fun upload(byteArray: ByteArray, contentType: String = DEFAULT_CONTENT_TYPE) {
|
||||
// 务必注意RequestBody不要嵌套,不然上传时内容可能会被追加多余的文件信息
|
||||
kotlin.runCatching {
|
||||
withContext(IO) {
|
||||
|
@ -356,7 +352,7 @@ open class WebDav(
|
|||
}
|
||||
|
||||
@Throws(WebDavException::class)
|
||||
suspend fun upload(uri: Uri, contentType: String) {
|
||||
suspend fun upload(uri: Uri, contentType: String = DEFAULT_CONTENT_TYPE) {
|
||||
// 务必注意RequestBody不要嵌套,不然上传时内容可能会被追加多余的文件信息
|
||||
kotlin.runCatching {
|
||||
withContext(IO) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.legado.app.data.entities.Book
|
|||
import io.legado.app.data.entities.BookChapter
|
||||
import io.legado.app.data.entities.BookSource
|
||||
import io.legado.app.help.book.ContentProcessor
|
||||
import io.legado.app.help.book.getBookSource
|
||||
import io.legado.app.help.coroutine.Coroutine
|
||||
import io.legado.app.service.AudioPlayService
|
||||
import io.legado.app.utils.postEvent
|
||||
|
|
|
@ -14,10 +14,7 @@ import io.legado.app.model.analyzeRule.CustomUrl
|
|||
import io.legado.app.model.localBook.LocalBook
|
||||
import io.legado.app.utils.NetworkUtils
|
||||
import io.legado.app.utils.isContentScheme
|
||||
import io.legado.app.utils.readBytes
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import splitties.init.appCtx
|
||||
import java.io.File
|
||||
|
||||
class RemoteBookWebDav(
|
||||
val rootBookUrl: String,
|
||||
|
@ -71,20 +68,17 @@ class RemoteBookWebDav(
|
|||
override suspend fun upload(book: Book) {
|
||||
if (!NetworkUtils.isAvailable()) throw NoStackTraceException("网络不可用")
|
||||
val localBookUri = Uri.parse(book.bookUrl)
|
||||
val putUrl = "$rootBookUrl${File.separator}${book.originName}"
|
||||
val putUrl = "$rootBookUrl${book.originName}"
|
||||
val webDav = WebDav(putUrl, authorization)
|
||||
if (localBookUri.isContentScheme()) {
|
||||
webDav.upload(
|
||||
byteArray = localBookUri.readBytes(appCtx),
|
||||
contentType = "application/octet-stream"
|
||||
)
|
||||
webDav.upload(localBookUri)
|
||||
} else {
|
||||
webDav.upload(localBookUri.path!!)
|
||||
}
|
||||
book.origin = BookType.webDavTag + CustomUrl(putUrl)
|
||||
.putAttribute("serverID", serverID)
|
||||
.toString()
|
||||
book.save()
|
||||
book.update()
|
||||
}
|
||||
|
||||
override suspend fun delete(remoteBookUrl: String) {
|
||||
|
|
|
@ -96,12 +96,11 @@ class WebService : BaseService() {
|
|||
if (addressList.any()) {
|
||||
notificationList.addAll(addressList.map { address -> getString(R.string.http_ip, address.hostAddress, getPort()) })
|
||||
hostAddress = notificationList.first()
|
||||
startForegroundNotification()
|
||||
} else {
|
||||
hostAddress = getString(R.string.network_connection_unavailable)
|
||||
notificationList.add(hostAddress)
|
||||
startForegroundNotification()
|
||||
}
|
||||
startForegroundNotification()
|
||||
postEvent(EventBus.WEB_SERVICE, hostAddress)
|
||||
}
|
||||
}
|
||||
|
@ -184,6 +183,7 @@ class WebService : BaseService() {
|
|||
*/
|
||||
override fun startForegroundNotification() {
|
||||
val builder = NotificationCompat.Builder(this, AppConst.channelIdWeb)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
.setSmallIcon(R.drawable.ic_web_service_noti)
|
||||
.setOngoing(true)
|
||||
.setContentTitle(getString(R.string.web_service))
|
||||
|
@ -196,7 +196,6 @@ class WebService : BaseService() {
|
|||
getString(R.string.cancel),
|
||||
servicePendingIntent<WebService>(IntentAction.stop)
|
||||
)
|
||||
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
val notification = builder.build()
|
||||
startForeground(NotificationId.WebService, notification)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.legado.app.data.appDb
|
|||
import io.legado.app.data.entities.Book
|
||||
import io.legado.app.data.entities.BookChapter
|
||||
import io.legado.app.data.entities.BookSource
|
||||
import io.legado.app.help.book.getBookSource
|
||||
import io.legado.app.help.book.removeType
|
||||
import io.legado.app.model.AudioPlay
|
||||
import io.legado.app.model.AudioPlay.durChapter
|
||||
|
|
|
@ -20,7 +20,7 @@ import kotlinx.coroutines.channels.awaitClose
|
|||
import kotlinx.coroutines.flow.callbackFlow
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import java.util.*
|
||||
import java.util.Collections
|
||||
|
||||
class RemoteBookViewModel(application: Application) : BaseViewModel(application) {
|
||||
var sortKey = RemoteBookSort.Default
|
||||
|
@ -78,6 +78,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
|
|||
}
|
||||
return@sortedWith compare
|
||||
}
|
||||
|
||||
else -> list.sortedWith { o1, o2 ->
|
||||
val compare = -compareValues(o1.isDir, o2.isDir)
|
||||
if (compare == 0) {
|
||||
|
@ -132,10 +133,8 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
|
|||
val downloadBookUri = bookWebDav.downloadRemoteBook(remoteBook)
|
||||
LocalBook.importFiles(downloadBookUri).forEach { book ->
|
||||
book.origin = BookType.webDavTag + CustomUrl(remoteBook.path)
|
||||
.putAttribute(
|
||||
"serverID",
|
||||
bookWebDav.serverID
|
||||
).toString()
|
||||
.putAttribute("serverID", bookWebDav.serverID)
|
||||
.toString()
|
||||
book.save()
|
||||
}
|
||||
remoteBook.isOnBookShelf = true
|
||||
|
@ -152,7 +151,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
|
|||
}
|
||||
|
||||
fun updateCallBackFlow(filterKey: String?) {
|
||||
dataCallback?.screen(filterKey)
|
||||
dataCallback?.screen(filterKey)
|
||||
}
|
||||
|
||||
interface DataCallback {
|
||||
|
|
|
@ -1304,7 +1304,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||
when (dialogId) {
|
||||
TEXT_COLOR -> {
|
||||
setCurTextColor(color)
|
||||
postEvent(EventBus.UP_CONFIG, arrayListOf(2, 9, 11))
|
||||
postEvent(EventBus.UP_CONFIG, arrayListOf(2, 6, 9, 11))
|
||||
}
|
||||
|
||||
BG_COLOR -> {
|
||||
|
@ -1500,9 +1500,9 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||
5 -> if (isInitFinish) ReadBook.loadContent(resetPageOffset = false)
|
||||
6 -> readView.upContent(resetPageOffset = false)
|
||||
8 -> ChapterProvider.upStyle()
|
||||
9 -> binding.readView.invalidateTextPage()
|
||||
9 -> readView.invalidateTextPage()
|
||||
10 -> ChapterProvider.upLayout()
|
||||
11 -> binding.readView.submitRenderTask()
|
||||
11 -> readView.submitRenderTask()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1543,10 +1543,10 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||
viewModel.searchResultList = it
|
||||
}
|
||||
observeEvent<Boolean>(EventBus.UPDATE_READ_ACTION_BAR) {
|
||||
binding.readMenu.reset()
|
||||
readMenu.reset()
|
||||
}
|
||||
observeEvent<Boolean>(EventBus.UP_SEEK_BAR) {
|
||||
binding.readMenu.upSeekBar()
|
||||
readMenu.upSeekBar()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import io.legado.app.help.AppWebDav
|
|||
import io.legado.app.help.book.BookHelp
|
||||
import io.legado.app.help.book.ContentProcessor
|
||||
import io.legado.app.help.book.isLocal
|
||||
import io.legado.app.help.book.isLocalModified
|
||||
import io.legado.app.help.book.removeType
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.help.coroutine.Coroutine
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.legado.app.data.entities.Book
|
|||
import io.legado.app.data.entities.BookChapter
|
||||
import io.legado.app.help.book.BookContent
|
||||
import io.legado.app.help.book.BookHelp
|
||||
import io.legado.app.help.book.getBookSource
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.help.config.ReadBookConfig
|
||||
import io.legado.app.help.coroutine.Coroutine
|
||||
|
|
|
@ -194,10 +194,10 @@ object NetworkUtils {
|
|||
enumeration = NetworkInterface.getNetworkInterfaces()
|
||||
} catch (e: SocketException) {
|
||||
e.printOnDebug()
|
||||
return mutableListOf()
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
var fallbackAddress: MutableList<InetAddress> = mutableListOf()
|
||||
val addressList = mutableListOf<InetAddress>()
|
||||
|
||||
while (enumeration.hasMoreElements()) {
|
||||
val nif = enumeration.nextElement()
|
||||
|
@ -205,13 +205,11 @@ object NetworkUtils {
|
|||
while (addresses.hasMoreElements()) {
|
||||
val address = addresses.nextElement()
|
||||
if (!address.isLoopbackAddress && isIPv4Address(address.hostAddress)) {
|
||||
if (nif.name?.startsWith("wlan") == true) {
|
||||
fallbackAddress.add(address)
|
||||
}
|
||||
addressList.add(address)
|
||||
}
|
||||
}
|
||||
}
|
||||
return fallbackAddress
|
||||
return addressList
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ android.defaults.buildfeatures.shaders=false
|
|||
# and none from the library's dependencies, thereby reducing the size of the R class for that library.
|
||||
android.nonTransitiveRClass=true
|
||||
# https://chromiumdash.appspot.com/releases?platform=Android
|
||||
CronetVersion=123.0.6312.80
|
||||
CronetMainVersion=123.0.0.0
|
||||
CronetVersion=124.0.6367.171
|
||||
CronetMainVersion=124.0.0.0
|
||||
android.injected.testOnly=false
|
||||
android.nonFinalResIds=true
|
Loading…
Reference in New Issue
Block a user