mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-18 17:33:31 +00:00
luci-app-verysync: add button (#2569)
* luci-app-verysync: add button * fix compatibility with LuCI2 * improve translation * improve translation * fix mistake
This commit is contained in:
parent
4ceb25fb46
commit
36837b9169
@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for Verysync
|
||||
LUCI_DEPENDS:=+verysync
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=4
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -1,18 +1,17 @@
|
||||
|
||||
module("luci.controller.verysync", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/verysync") then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
entry({"admin", "nas", "verysync"}, cbi("verysync"), _("Verysync"), 10).dependent = true
|
||||
entry({"admin","nas","verysync","status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep verysync >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep verysync >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
@ -1,20 +1,24 @@
|
||||
-- Copyright 2008 Yanira <forum-2008@email.de>
|
||||
-- Copyright 2020 KFERMercer <KFER.Mercer@gmail.com>
|
||||
-- Licensed to the public under the Apache License 2.0.
|
||||
|
||||
require("nixio.fs")
|
||||
|
||||
m = Map("verysync", translate("An Efficient Data Transfer Tool"),
|
||||
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 = 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"
|
||||
|
||||
s = m:section(TypedSection, "setting", translate("Settings"))
|
||||
s = m:section(TypedSection, "verysync")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
s:option(Flag, "enabled", translate("Enable"))
|
||||
|
||||
s:option(Value, "port", translate("port")).default = 8886
|
||||
s.rmempty = true
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "port", translate("Port"))
|
||||
o.datatype = "port"
|
||||
o.placeholder = "8886"
|
||||
o.default = "8886"
|
||||
o.rmempty = false
|
||||
|
||||
return m
|
||||
|
@ -1,17 +1,28 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(1, '<%=url([[admin]], [[nas]], [[verysync]], [[status]])%>', null,
|
||||
XHR.poll(3, '<%=url([[admin]], [[nas]], [[verysync]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('verysync_status');
|
||||
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<font color=green><%:RUNNING%></font>';
|
||||
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="openClient();" />';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<font color=red><%:NOT RUNNING%></font>';
|
||||
tb.innerHTML = '<em><b><font color=red>Verysync <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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)
|
||||
};
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
|
@ -1,13 +1,8 @@
|
||||
msgid "Verysync"
|
||||
msgstr "微力同步"
|
||||
|
||||
msgid "An Efficient Data Transfer Tool"
|
||||
msgstr "一款高效的数据传输工具"
|
||||
|
||||
msgid "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."
|
||||
msgstr "简单易用的多平台文件同步软件,惊人的传输速度是不同于其他产品的最大优势, 微力同步 的智能 P2P 技术加速同步,会将文件分割成若干份仅 KB 的数据同步,而文件都会进行 AES 加密处理。"
|
||||
|
||||
|
||||
|
||||
|
||||
msgid "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."
|
||||
msgstr "简单易用的多平台文件同步软件, 惊人的传输速度是不同于其他产品的最大优势. 微力同步的智能 P2P 加速同步技术会将文件分割成若干份仅 KB 的数据进行传输, 同时会使用 AES 加密处理."
|
||||
|
||||
msgid "Open Verysync page"
|
||||
msgstr "打开微力同步页面"
|
||||
|
@ -1,4 +1,2 @@
|
||||
|
||||
config setting 'config'
|
||||
option enabled '0'
|
||||
option port '8886'
|
||||
config verysync 'config'
|
||||
|
@ -1,43 +1,17 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=50
|
||||
STOP=10
|
||||
|
||||
run_verysync()
|
||||
{
|
||||
local enabled
|
||||
config_get_bool enabled $1 enabled
|
||||
if [ $enabled = 1 ]; then
|
||||
local port
|
||||
config_get port $1 port
|
||||
state=`pgrep verysync | wc -l`
|
||||
if [ $state = 0 ] ; then
|
||||
export HOME="/root"
|
||||
verysync -gui-address="0.0.0.0:$port" -logfile="/var/log/verysync.log" -no-browser >/dev/null &
|
||||
echo "启动中..."
|
||||
start=`pgrep verysync | wc -l`
|
||||
if [ $start = 0 ] ; then
|
||||
echo "启动失败"
|
||||
else
|
||||
echo "启动成功"
|
||||
fi
|
||||
else
|
||||
echo "已在运行"
|
||||
fi
|
||||
fi
|
||||
start() {
|
||||
local enabled="$(uci get verysync.config.enabled)"
|
||||
local port="$(uci get verysync.config.port)"
|
||||
stop
|
||||
[ "${enabled}" == "1" ] || exit 0
|
||||
export HOME="/root/"
|
||||
verysync -gui-address="0.0.0.0:${port}" -logfile="/var/log/verysync.log" -home="/etc/verysync/" -no-browser >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load verysync
|
||||
config_foreach run_verysync setting
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
kill -9 `pgrep verysync`
|
||||
stop=`pgrep verysync | wc -l`
|
||||
if [ $stop = 0 ] ; then
|
||||
echo "已停止运行"
|
||||
else
|
||||
echo "未停止运行"
|
||||
fi
|
||||
stop() {
|
||||
kill -9 `pgrep verysync` >/dev/null 2>&1
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
#!/bin/sh
|
||||
touch /etc/config/verysync
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@verysync[-1]
|
||||
add ucitrack verysync
|
||||
set ucitrack.@verysync[-1].exec='/etc/init.d/verysync restart'
|
||||
set ucitrack.@verysync[-1].init=verysync
|
||||
commit ucitrack
|
||||
EOF
|
||||
# remove LuCI cache
|
||||
rm -f /tmp/luci*
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user