From 96cb1ee3fdaa58e2dc98fbdafdc868ff75fbe1d7 Mon Sep 17 00:00:00 2001 From: fox <83943819+fewkz@users.noreply.github.com> Date: Fri, 30 Sep 2022 17:59:09 -0400 Subject: [PATCH] Support explicitly specifying http or https protocol in plugin (#642) * Support explicitly specifying http or https protocol in plugin * Fix incorrect format string Port is not a number --- plugin/src/App/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/src/App/init.lua b/plugin/src/App/init.lua index 9f7e2ecf..93186077 100644 --- a/plugin/src/App/init.lua +++ b/plugin/src/App/init.lua @@ -202,7 +202,9 @@ function App:startSession() twoWaySync = Settings:get("twoWaySync"), } - local baseUrl = ("http://%s:%s"):format(host, port) + local baseUrl = if string.find(host, "^https?://") + then string.format("%s:%s", host, port) + else string.format("http://%s:%s", host, port) local apiContext = ApiContext.new(baseUrl) local serveSession = ServeSession.new({