From 5ec7dcc5fa814f595b5c90e6417d206f4b7e038d Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Thu, 20 Feb 2020 21:07:50 +0800 Subject: [PATCH] luci-app-syncthing: add button to open WebUI --- .../luasrc/view/syncthing/syncthing_status.htm | 11 ++++++++++- .../luci-app-syncthing/po/zh-cn/syncthing.po | 7 ++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/package/zxlhhyccc/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm b/package/zxlhhyccc/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm index fa56b79cc5..88d615aa40 100644 --- a/package/zxlhhyccc/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm +++ b/package/zxlhhyccc/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm @@ -4,7 +4,7 @@ XHR.poll(1, '<%=url([[admin]], [[nas]], [[syncthing]], [[status]])%>', null, var tb = document.getElementById('syncthing_status'); if (data && tb) { if (data.running) { - var links = '<%:RUNNING%>'; + var links = '<%:RUNNING%>'; tb.innerHTML = links; } else { tb.innerHTML = '<%:NOT RUNNING%>'; @@ -12,6 +12,15 @@ XHR.poll(1, '<%=url([[admin]], [[nas]], [[syncthing]], [[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.syncthing.config.port").value + var url = "http:" + localhostPath.substring(window.location.protocol.length) + ":" + clientPort; + window.open(url) //]]> diff --git a/package/zxlhhyccc/luci-app-syncthing/po/zh-cn/syncthing.po b/package/zxlhhyccc/luci-app-syncthing/po/zh-cn/syncthing.po index 2949c4075b..2ca4381771 100644 --- a/package/zxlhhyccc/luci-app-syncthing/po/zh-cn/syncthing.po +++ b/package/zxlhhyccc/luci-app-syncthing/po/zh-cn/syncthing.po @@ -4,8 +4,5 @@ msgstr "储存同步" msgid "SyncThing Synchronization Tool" msgstr "syncthing同步工具" - - - - - +msgid "Open Web Interface" +msgstr "打开管理页面"