diff --git a/server/src/com/unciv/app/server/UncivServer.kt b/server/src/com/unciv/app/server/UncivServer.kt index c14c3ec3f6..055b360d1f 100644 --- a/server/src/com/unciv/app/server/UncivServer.kt +++ b/server/src/com/unciv/app/server/UncivServer.kt @@ -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 }