From c9d5460b069d24fdd38e4728881ca3813deb4b32 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 21 Mar 2020 23:59:19 +0800 Subject: [PATCH] luci-app-qbittorrent: fix read port --- .../luasrc/view/qbittorrent/qbittorrent_status.htm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbittorrent_status.htm b/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbittorrent_status.htm index 0d4666e627..b604cd2271 100644 --- a/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbittorrent_status.htm +++ b/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbittorrent_status.htm @@ -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 = 'qBittorrent <%:RUNNING%>'; + var links = 'qBittorrent <%:RUNNING%>'; tb.innerHTML = links; } else { tb.innerHTML = 'qBittorrent <%:NOT RUNNING%>'; @@ -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',''); }; //]]>