Auto add "http://" for pixctrl

This commit is contained in:
2020-06-08 17:17:15 +02:00
parent 2aa73f581f
commit 4d82414fdd

View File

@@ -4,7 +4,7 @@ import common
when defined(js): when defined(js):
import ajax, jsconsole, dom import ajax, jsconsole, dom
else: else:
import httpClient import httpClient, strformat
import argparse import argparse
var randopixServer* {.exportc.}: string ## URL for the randopix server var randopixServer* {.exportc.}: string ## URL for the randopix server
@@ -64,7 +64,10 @@ else:
help("Control utilitiy for randopix") help("Control utilitiy for randopix")
option("-s", "--server", help="Host running the randopix server", default="http://localhost:8080/") option("-s", "--server", help="Host running the randopix server", default="http://localhost:8080/")
run: run:
if opts.server.startsWith("http://"):
randopixServer = opts.server randopixServer = opts.server
else:
randopixServer = fmt"http://{opts.server}"
command($cRefresh): command($cRefresh):
## Force refresh command ## Force refresh command