From 829ad4ff3febafaee0f1c646f1c74cfc7a7c9dc9 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 9 Jan 2022 23:33:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/api/controller/BookController.kt | 15 +++++++++++++++ app/src/main/java/io/legado/app/web/HttpServer.kt | 2 ++ 2 files changed, 17 insertions(+) diff --git a/app/src/main/java/io/legado/app/api/controller/BookController.kt b/app/src/main/java/io/legado/app/api/controller/BookController.kt index 0a15c5ac3..e0ba95bb5 100644 --- a/app/src/main/java/io/legado/app/api/controller/BookController.kt +++ b/app/src/main/java/io/legado/app/api/controller/BookController.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) + } + } diff --git a/app/src/main/java/io/legado/app/web/HttpServer.kt b/app/src/main/java/io/legado/app/web/HttpServer.kt index ccab3a9f5..2d4d2c575 100644 --- a/app/src/main/java/io/legado/app/web/HttpServer.kt +++ b/app/src/main/java/io/legado/app/web/HttpServer.kt @@ -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