luci-app-syncthing: add button to open WebUI
This commit is contained in:
parent
6b6b284f32
commit
5ec7dcc5fa
@ -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 = '<font color=green><%:RUNNING%></font>';
|
||||
var links = '<font color=green><%:RUNNING%></font><input class="cbi-button mar-10" type="button" value="<%:Open Web Interface%>" onclick="openClient();" />';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<font color=red><%:NOT RUNNING%></font>';
|
||||
@ -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)
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
|
||||
@ -4,8 +4,5 @@ msgstr "储存同步"
|
||||
msgid "SyncThing Synchronization Tool"
|
||||
msgstr "syncthing同步工具"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
msgid "Open Web Interface"
|
||||
msgstr "打开管理页面"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user