pull/1514/head
gedoor 3 years ago
parent 4a2671c914
commit 829ad4ff3f
  1. 15
      app/src/main/java/io/legado/app/api/controller/BookController.kt
  2. 2
      app/src/main/java/io/legado/app/web/HttpServer.kt

@ -8,6 +8,7 @@ import io.legado.app.constant.PreferKey
import io.legado.app.data.appDb
import io.legado.app.data.entities.Book
import io.legado.app.help.BookHelp
import io.legado.app.help.CacheManager
import io.legado.app.help.ContentProcessor
import io.legado.app.help.glide.ImageLoader
import io.legado.app.help.storage.AppWebDav
@ -232,4 +233,18 @@ object BookController {
return returnData.setData(true)
}
fun saveWebReadConfig(postData: String?): ReturnData {
val returnData = ReturnData()
postData?.let {
CacheManager.put("webReadConfig", postData)
}
return returnData.setData("")
}
fun getWebReadConfig(): ReturnData {
val returnData = ReturnData()
val data = CacheManager.get("webReadConfig") ?: "{}"
return returnData.setData(data)
}
}

@ -44,6 +44,7 @@ class HttpServer(port: Int) : NanoHTTPD(port) {
"/deleteBookSources" -> BookSourceController.deleteSources(postData)
"/saveBook" -> BookController.saveBook(postData)
"/addLocalBook" -> BookController.addLocalBook(session.parameters)
"/saveReadConfig" -> BookController.saveWebReadConfig(postData)
"/saveRssSource" -> RssSourceController.saveSource(postData)
"/saveRssSources" -> RssSourceController.saveSources(postData)
"/deleteRssSources" -> RssSourceController.deleteSources(postData)
@ -61,6 +62,7 @@ class HttpServer(port: Int) : NanoHTTPD(port) {
"/refreshToc" -> BookController.refreshToc(parameters)
"/getBookContent" -> BookController.getBookContent(parameters)
"/cover" -> BookController.getCover(parameters)
"/getReadConfig" -> BookController.getWebReadConfig()
"/getRssSource" -> RssSourceController.getSource(parameters)
"/getRssSources" -> RssSourceController.sources
else -> null

Loading…
Cancel
Save