Fix some code

This commit is contained in:
carbotaniuman 2020-08-05 10:07:16 -05:00
parent 9dcfe3b51f
commit 4c18c9c288
2 changed files with 6 additions and 8 deletions

View file

@ -308,8 +308,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
/**
* Starts the WebUI if the ClientSettings demand it.
* Because this method checks if the WebUI is needed,
* it can be safely called before checking yourself
* This method checks if the WebUI is needed,
*/
private fun startWebUi() {
val state = this.state
@ -332,6 +331,9 @@ class MangaDexClient(private val clientSettingsFile: String) {
}
}
/**
* Shutdowns the MangaDexClient
*/
fun shutdown() {
LOGGER.info { "Mangadex@Home Client stopping" }
@ -426,7 +428,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
// If we aren't restarting the server
// We can update the settings now
this.state = state.copy(clientSettings = newSettings)
serverHandler.setClientSettings(newSettings)
serverHandler.settings = newSettings
LOGGER.info { "Reloaded ClientSettings: $newSettings" }
// Start the WebUI if we had to stop it

View file

@ -43,7 +43,7 @@ object ServerHandlerJackson : ConfigurableJackson(
.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()
.setDefaultRequestConfig(
RequestConfig.custom()
@ -121,10 +121,6 @@ class ServerHandler(private var settings: ClientSettings) {
SERVER_ADDRESS_DEV
}
fun setClientSettings(clientSettings: ClientSettings) {
this.settings = clientSettings
}
companion object {
private val LOGGER = LoggerFactory.getLogger(ServerHandler::class.java)
private val STRING_ANY_MAP_LENS = Body.auto<Map<String, Any>>().toLens()