diff options
author | Zheng Qian <sotux82@gmail.com> | 2018-12-14 13:32:18 +0800 |
---|---|---|
committer | Zheng Qian <sotux82@gmail.com> | 2018-12-14 13:32:49 +0800 |
commit | 83703aaec0f03d9dc4962bcfa672f86d8a3b0cdc (patch) | |
tree | 540ad7440510d62d11794cb64e1c9d9c263df88d /applications/luci-app-aria2/luasrc/view/aria2 | |
parent | 76f81c262c2db625a3f36743db25c87377bf61b4 (diff) |
luci-app-aria2: fix showRPCURL when using https
if login luci-admin with https, RPC protocol should be https or wss.
Signed-off-by: Zheng Qian <sotux82@gmail.com>
Diffstat (limited to 'applications/luci-app-aria2/luasrc/view/aria2')
-rw-r--r-- | applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm b/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm index a06d2015f..318182c08 100644 --- a/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm +++ b/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm @@ -45,11 +45,14 @@ function showRPCURL() { var auth_method = document.getElementById("cbid.aria2.main.rpc_auth_method"); var auth_port = document.getElementById("cbid.aria2.main.rpc_listen_port"); var auth_port_value; + if (window.location.protocol == "https:") { + protocol += "s"; + } if (auth_port.value == "") { - auth_port_value = "6800" + auth_port_value = "6800"; } else { - auth_port_value = auth_port.value - }; + auth_port_value = auth_port.value; + } if (auth_method.value == "token") { var auth_token = document.getElementById("cbid.aria2.main.rpc_secret"); newTextNode.value = protocol + "://token:" + auth_token.value + "@" + document.domain + ":" + auth_port_value + "/jsonrpc"; @@ -68,7 +71,7 @@ function openWebUI(path) { var pos = curWwwPath.indexOf(pathName); var localhostPath = curWwwPath.substring(0, pos); var url = localhostPath + "/" + path; - window.open(url) + window.open(url); }; //]]> </script> |