mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-02 13:10:55 +00:00
DevUpdateServer: Minor logging changes.
This commit is contained in:
parent
a7d7c9f818
commit
7f9bd32cc7
@ -39,7 +39,7 @@ class DevUpdateServer(val plugin: FoundationCorePlugin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.token.length < 8) {
|
if (config.token.length < 8) {
|
||||||
plugin.slF4JLogger.warn("DevUpdate Token was too short (must be 8 or more characters)")
|
plugin.slF4JLogger.warn("DevUpdateServer Token was too short (must be 8 or more characters)")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,18 +50,18 @@ class DevUpdateServer(val plugin: FoundationCorePlugin) {
|
|||||||
server.bind(InetSocketAddress("0.0.0.0", config.port), 0)
|
server.bind(InetSocketAddress("0.0.0.0", config.port), 0)
|
||||||
server.start()
|
server.start()
|
||||||
this.server = server
|
this.server = server
|
||||||
plugin.slF4JLogger.info("DevUpdate Server listening on port ${config.port}")
|
plugin.slF4JLogger.info("DevUpdateServer listening on port ${config.port}")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handle(exchange: HttpExchange) {
|
private fun handle(exchange: HttpExchange) {
|
||||||
val ip = exchange.remoteAddress.address.hostAddress
|
val ip = exchange.remoteAddress.address.hostAddress
|
||||||
if (!config.ipAllowList.contains("*") && !config.ipAllowList.contains(ip)) {
|
if (!config.ipAllowList.contains("*") && !config.ipAllowList.contains(ip)) {
|
||||||
plugin.slF4JLogger.warn("DevUpdate Server received request from IP $ip which is not allowed.")
|
plugin.slF4JLogger.warn("DevUpdateServer received request from IP $ip which is not allowed.")
|
||||||
exchange.close()
|
exchange.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.slF4JLogger.info("DevUpdate Server Request $ip ${exchange.requestMethod} ${exchange.requestURI.path}")
|
plugin.slF4JLogger.info("DevUpdateServer Request $ip ${exchange.requestMethod} ${exchange.requestURI.path}")
|
||||||
if (exchange.requestMethod != "POST") {
|
if (exchange.requestMethod != "POST") {
|
||||||
exchange.respond(405, "Method not allowed.")
|
exchange.respond(405, "Method not allowed.")
|
||||||
return
|
return
|
||||||
@ -98,11 +98,7 @@ class DevUpdateServer(val plugin: FoundationCorePlugin) {
|
|||||||
plugin.slF4JLogger.info("DevUpdate Started")
|
plugin.slF4JLogger.info("DevUpdate Started")
|
||||||
UpdateService.updatePlugins(plugin.server.consoleSender) {
|
UpdateService.updatePlugins(plugin.server.consoleSender) {
|
||||||
plugin.server.scheduler.runTask(plugin) { ->
|
plugin.server.scheduler.runTask(plugin) { ->
|
||||||
try {
|
|
||||||
plugin.server.shutdown()
|
plugin.server.shutdown()
|
||||||
} catch (e: Exception) {
|
|
||||||
plugin.slF4JLogger.error("DevUpdate Server failed to update server.", e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user