优化
This commit is contained in:
@@ -270,4 +270,18 @@ object BookController {
|
|||||||
return returnData.setData(data)
|
return returnData.setData(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取图片
|
||||||
|
*/
|
||||||
|
fun getImage(parameters: Map<String, List<String>>): ReturnData {
|
||||||
|
val returnData = ReturnData()
|
||||||
|
val coverPath = parameters["path"]?.firstOrNull()
|
||||||
|
val ftBitmap = ImageLoader.loadBitmap(appCtx, coverPath).submit()
|
||||||
|
return try {
|
||||||
|
returnData.setData(ftBitmap.get())
|
||||||
|
} catch (e: Exception) {
|
||||||
|
returnData.setData(BookCover.defaultDrawable.toBitmap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class HttpServer(port: Int) : NanoHTTPD(port) {
|
|||||||
"/getReadConfig" -> BookController.getWebReadConfig()
|
"/getReadConfig" -> BookController.getWebReadConfig()
|
||||||
"/getRssSource" -> RssSourceController.getSource(parameters)
|
"/getRssSource" -> RssSourceController.getSource(parameters)
|
||||||
"/getRssSources" -> RssSourceController.sources
|
"/getRssSources" -> RssSourceController.sources
|
||||||
|
"/getImage" -> BookController.getImage(parameters)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class AssetsWeb(rootPath: String) {
|
|||||||
suffix.equals(".js", ignoreCase = true) -> "text/javascript"
|
suffix.equals(".js", ignoreCase = true) -> "text/javascript"
|
||||||
suffix.equals(".css", ignoreCase = true) -> "text/css"
|
suffix.equals(".css", ignoreCase = true) -> "text/css"
|
||||||
suffix.equals(".ico", ignoreCase = true) -> "image/x-icon"
|
suffix.equals(".ico", ignoreCase = true) -> "image/x-icon"
|
||||||
|
suffix.equals(".jpg", ignoreCase = true) -> "image/jpg"
|
||||||
else -> "text/html"
|
else -> "text/html"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user