luci-app-qbittorrent: fix read port
This commit is contained in:
parent
dfc751a074
commit
c9d5460b06
@ -4,7 +4,7 @@ XHR.poll(3, '<%=url([[admin]], [[nas]], [[qBittorrent]], [[status]])%>', null,
|
||||
var tb = document.getElementById('qBittorrent_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>qBittorrent <%:RUNNING%></font></b></em><input class="cbi-button mar-10" type="button" value="<%:Open Web Interface%>" onclick="openClient();" />';
|
||||
var links = '<em><b><font color=green>qBittorrent <%:RUNNING%></font></b></em><input class="cbi-button mar-10" type="button" value="<%:Open Web Interface%>" onclick="openwebui();" />';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>qBittorrent <%:NOT RUNNING%></font></b></em>';
|
||||
@ -13,14 +13,9 @@ XHR.poll(3, '<%=url([[admin]], [[nas]], [[qBittorrent]], [[status]])%>', null,
|
||||
}
|
||||
);
|
||||
|
||||
function openClient() {
|
||||
var curWwwPath = window.document.location.href;
|
||||
var pathName = window.document.location.pathname;
|
||||
var pos = curWwwPath.indexOf(pathName);
|
||||
var localhostPath = curWwwPath.substring(0, pos);
|
||||
var clientPort = window.document.getElementById("cbid.qbittorrent.config.port").value
|
||||
var url = "http:" + localhostPath.substring(window.location.protocol.length) + ":" + clientPort;
|
||||
window.open(url)
|
||||
function openwebui(){
|
||||
var url = window.location.host+":<%=luci.sys.exec("uci -q get qbittorrent.@qbittorrent[0].port"):gsub("^%s*(.-)%s*$", "%1")%>";
|
||||
window.open('http://'+url,'target','');
|
||||
};
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user