mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 16:04:23 +07:00
Update UncivServer.kt (#9742)
* Update UncivServer.kt Add display operator IP mode to help game match referees query operators * Update UncivServer.kt * Update UncivServer.kt
This commit is contained in:
parent
ad0af51020
commit
478fb35e57
@ -50,6 +50,13 @@ private class UncivServerRunner : CliktCommand() {
|
||||
help = "Enable Authentication"
|
||||
).flag("-no-auth", default = false)
|
||||
|
||||
private val IdentifyOperators by option(
|
||||
"-i", "-Identify",
|
||||
envvar = "UncivServerIdentify",
|
||||
help = "Display each operation archive request IP to assist management personnel"
|
||||
).flag("-no-Identify", default = false)
|
||||
|
||||
|
||||
override fun run() {
|
||||
serverRun(port, folder)
|
||||
}
|
||||
@ -125,7 +132,14 @@ private class UncivServerRunner : CliktCommand() {
|
||||
}
|
||||
put("/files/{fileName}") {
|
||||
val fileName = call.parameters["fileName"] ?: throw Exception("No fileName!")
|
||||
log.info("Receiving file: $fileName")
|
||||
|
||||
// If IdentifyOperators is enabled a Operator IP is displayed
|
||||
if (IdentifyOperators) {
|
||||
log.info("Receiving file: ${fileName} --Operation sourced from ${call.request.local.remoteHost}")
|
||||
}else{
|
||||
log.info("Receiving file: ${fileName}")
|
||||
}
|
||||
|
||||
val file = File(fileFolderName, fileName)
|
||||
|
||||
if (!validateGameAccess(file, call.request.headers["Authorization"])) {
|
||||
@ -142,10 +156,23 @@ private class UncivServerRunner : CliktCommand() {
|
||||
}
|
||||
get("/files/{fileName}") {
|
||||
val fileName = call.parameters["fileName"] ?: throw Exception("No fileName!")
|
||||
log.info("File requested: $fileName")
|
||||
|
||||
// If IdentifyOperators is enabled a Operator IP is displayed
|
||||
if (IdentifyOperators) {
|
||||
log.info("File requested: ${fileName} --Operation sourced from ${call.request.local.remoteHost}")
|
||||
}else{
|
||||
log.info("File requested: $fileName")
|
||||
}
|
||||
|
||||
val file = File(fileFolderName, fileName)
|
||||
if (!file.exists()) {
|
||||
log.info("File $fileName not found")
|
||||
|
||||
// If IdentifyOperators is enabled a Operator IP is displayed
|
||||
if (IdentifyOperators) {
|
||||
log.info("File ${fileName} not found --Operation sourced from ${call.request.local.remoteHost}")
|
||||
}else{
|
||||
log.info("File $fileName not found")
|
||||
}
|
||||
call.respond(HttpStatusCode.NotFound, "File does not exist")
|
||||
return@get
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user