From: Niki Roo Date: Thu, 14 May 2020 15:37:05 +0000 (+0200) Subject: fix STOP server X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=82c6796bb4d08e5a6c267787bed648c3c5cacf21;p=nikiroo-utils.git fix STOP server --- diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index c02abb3..3536544 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -643,11 +643,25 @@ public class Main { break; case STOP_SERVER: // Can be given via "--remote XX XX XX" - if (key == null) - key = Instance.getInstance().getConfig().getString(Config.SERVER_KEY); - if (port == null) + if (key == null) { + key = Instance.getInstance().getConfig() + .getString(Config.SERVER_KEY); + + // If a subkey in RW mode exists, use it + for (String subkey : Instance.getInstance().getConfig() + .getList(Config.SERVER_ALLOWED_SUBKEYS, + new ArrayList())) { + if ((subkey + "|").contains("|rw|")) { + key = key + "|" + subkey; + break; + } + } + } + + if (port == null) { port = Instance.getInstance().getConfig().getInteger(Config.SERVER_PORT); - + } + if (host == null) { String mode = Instance.getInstance().getConfig() .getString(Config.SERVER_MODE, "fanfix");