luci-app-verysync: fix button

Revert "luci-app-verysync: fix button"

This reverts commit c0e574c69b438a82576cf8de989758812f52ce5a.
This commit is contained in:
CN_SZTL 2020-02-11 19:59:09 +08:00
parent 5e81dc9f02
commit 00bcec4624
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 9 additions and 20 deletions

View File

@ -1,17 +1,10 @@
-- Copyright 2008 Yanira <forum-2008@email.de>
-- Copyright 2020 KFERMercer <KFER.Mercer@gmail.com>
-- Copyright 2020 [CTCGFW]Project-OpenWrt
-- Licensed to the public under the GPL v3.0.
-- Licensed to the public under the Apache License 2.0.
local uci = require "luci.model.uci".cursor()
local running=(luci.sys.call("pgrep verysync >/dev/null") == 0)
local button = ""
local trport = uci:get("verysync", "config", "port")
if running then
button = "<br/><br/><input type=\"button\" value=\" " .. translate("Open Verysync page") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
end
m = Map("verysync", translate("Verysync"), translate("Simple and easy-to-use multi-platform file synchronization software, astonishing transmission speed is different from the greatest advantage of other products. Micro-force synchronization of intelligent P2P technology to accelerate synchronization, will split the file into several KB-only data synchronization, and the file will be AES encryption processing.") .. button)
m = Map("verysync")
m.title = translate("Verysync")
m.description = translate("Simple and easy-to-use multi-platform file synchronization software, astonishing transmission speed is different from the greatest advantage of other products. Micro-force synchronization of intelligent P2P technology to accelerate synchronization, will split the file into several KB-only data synchronization, and the file will be AES encryption processing.")
m:section(SimpleSection).template = "verysync/verysync_status"

View File

@ -5,7 +5,8 @@ XHR.poll(3, '<%=url([[admin]], [[nas]], [[verysync]], [[status]])%>', null,
if (data && tb) {
if (data.running) {
tb.innerHTML = '<em><b><font color=green>Verysync <%:RUNNING%></font></b></em>';
var links = '<em><b><font color="green">Verysync <%:RUNNING%></font></b></em><input class="cbi-button mar-10" type="button" value="<%:Open Verysync page%>" onclick="openwebui();" />';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>Verysync <%:NOT RUNNING%></font></b></em>';
}
@ -13,14 +14,9 @@ XHR.poll(3, '<%=url([[admin]], [[nas]], [[verysync]], [[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.verysync.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 verysync.config.port"):gsub("^%s*(.-)%s*$", "%1")%>";
window.open('http://'+url,'target','');
};
//]]>
</script>