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
This commit is contained in:
fox
2022-09-30 17:59:09 -04:00
committed by GitHub
parent 003abe86bb
commit 96cb1ee3fd

View File

@@ -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({