From 82c6796bb4d08e5a6c267787bed648c3c5cacf21 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 14 May 2020 17:37:05 +0200 Subject: [PATCH] fix STOP server --- src/be/nikiroo/fanfix/Main.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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"); -- 2.27.0