mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
Fix some code
This commit is contained in:
parent
9dcfe3b51f
commit
4c18c9c288
|
@ -308,8 +308,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the WebUI if the ClientSettings demand it.
|
* Starts the WebUI if the ClientSettings demand it.
|
||||||
* Because this method checks if the WebUI is needed,
|
* This method checks if the WebUI is needed,
|
||||||
* it can be safely called before checking yourself
|
|
||||||
*/
|
*/
|
||||||
private fun startWebUi() {
|
private fun startWebUi() {
|
||||||
val state = this.state
|
val state = this.state
|
||||||
|
@ -332,6 +331,9 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shutdowns the MangaDexClient
|
||||||
|
*/
|
||||||
fun shutdown() {
|
fun shutdown() {
|
||||||
LOGGER.info { "Mangadex@Home Client stopping" }
|
LOGGER.info { "Mangadex@Home Client stopping" }
|
||||||
|
|
||||||
|
@ -426,7 +428,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
|
||||||
// If we aren't restarting the server
|
// If we aren't restarting the server
|
||||||
// We can update the settings now
|
// We can update the settings now
|
||||||
this.state = state.copy(clientSettings = newSettings)
|
this.state = state.copy(clientSettings = newSettings)
|
||||||
serverHandler.setClientSettings(newSettings)
|
serverHandler.settings = newSettings
|
||||||
LOGGER.info { "Reloaded ClientSettings: $newSettings" }
|
LOGGER.info { "Reloaded ClientSettings: $newSettings" }
|
||||||
|
|
||||||
// Start the WebUI if we had to stop it
|
// Start the WebUI if we had to stop it
|
||||||
|
|
|
@ -43,7 +43,7 @@ object ServerHandlerJackson : ConfigurableJackson(
|
||||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
)
|
)
|
||||||
|
|
||||||
class ServerHandler(private var settings: ClientSettings) {
|
class ServerHandler(var settings: ClientSettings) {
|
||||||
private val client = ApacheClient(client = HttpClients.custom()
|
private val client = ApacheClient(client = HttpClients.custom()
|
||||||
.setDefaultRequestConfig(
|
.setDefaultRequestConfig(
|
||||||
RequestConfig.custom()
|
RequestConfig.custom()
|
||||||
|
@ -121,10 +121,6 @@ class ServerHandler(private var settings: ClientSettings) {
|
||||||
SERVER_ADDRESS_DEV
|
SERVER_ADDRESS_DEV
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setClientSettings(clientSettings: ClientSettings) {
|
|
||||||
this.settings = clientSettings
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val LOGGER = LoggerFactory.getLogger(ServerHandler::class.java)
|
private val LOGGER = LoggerFactory.getLogger(ServerHandler::class.java)
|
||||||
private val STRING_ANY_MAP_LENS = Body.auto<Map<String, Any>>().toLens()
|
private val STRING_ANY_MAP_LENS = Body.auto<Map<String, Any>>().toLens()
|
||||||
|
|
Loading…
Reference in a new issue