luci-app-aria2: fix http/https protocol when opening aria2 webUI

In the openWebUI function, the url is assumed as http protocol,
this will cause problem when we login luci-admin with https.

The variable localhostPath has already contained http/https
protocol, so we can use it directly and add the path of aria2
webUI.

Signed-off-by: Zheng Qian <sotux82@gmail.com>
This commit is contained in:
Zheng Qian 2018-12-10 17:45:55 +08:00
parent 1b26c91a08
commit 4f11edadff

View file

@ -67,7 +67,7 @@ function openWebUI(path) {
var pathName = window.document.location.pathname; var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName); var pos = curWwwPath.indexOf(pathName);
var localhostPath = curWwwPath.substring(0, pos); var localhostPath = curWwwPath.substring(0, pos);
var url = "http:" + localhostPath.substring(window.location.protocol.length) + "/" + path; var url = localhostPath + "/" + path;
window.open(url) window.open(url)
}; };
//]]> //]]>