add linkease

This commit is contained in:
YGAS 2021-12-24 17:33:13 +08:00
parent 5d959916c2
commit 5e149fd8f7
7 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1,17 @@
# Copyright (C) 2016 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for linkease
LUCI_DEPENDS:=+linkease
LUCI_PKGARCH:=all
PKG_VERSION:=2.1.1
PKG_RELEASE:=2
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,25 @@
module("luci.controller.linkease", package.seeall)
function index()
if not nixio.fs.access("/etc/config/linkease") then
return
end
entry({"admin", "services", "linkease"}, cbi("linkease"), _("LinkEase"), 20).dependent = true
entry({"admin", "services", "linkease_status"}, call("linkease_status"))
end
function linkease_status()
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local port = tonumber(uci:get_first("linkease", "linkease", "port"))
local status = {
running = (sys.call("pidof linkease >/dev/null") == 0),
port = (port or 8897)
}
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end

View File

@ -0,0 +1,20 @@
--wulishui <wulishui@gmail.com> ,20200911
--jjm2473 <jjm2473@gmail.com> ,20210127
local m, s
m = Map("linkease", translate("LinkEase"), translate("LinkEase is an efficient data transfer tool."))
m:section(SimpleSection).template = "linkease_status"
s=m:section(TypedSection, "linkease", translate("Global settings"))
s.addremove=false
s.anonymous=true
s:option(Flag, "enabled", translate("Enable")).rmempty=false
s:option(Value, "port", translate("Port")).rmempty=false
return m

View File

@ -0,0 +1 @@
<%+linkease_status%>

View File

@ -0,0 +1,27 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=url("admin/services/linkease_status")%>', null,
function(x, st)
{
var tb = document.getElementById('linkease_status');
if (st && tb)
{
if (st.running)
{
tb.innerHTML = '<br/><em style=\"color:green\"><%:The LinkEase service is running.%></em>'
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open LinkEase%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + st.port + "/')\"/>";
}
else
{
tb.innerHTML = '<br/><em style=\"color:red\"><%:The LinkEase service is not running.%></em>';
}
}
}
);
//]]></script>
<fieldset class="cbi-section">
<legend><%:LinkEase Status%></legend>
<p id="linkease_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,27 @@
msgid "LinkEase"
msgstr "易有云文件管理器"
msgid "Running state"
msgstr "运行状态"
msgid "Click to open LinkEase"
msgstr "点击打开易有云"
msgid "LinkEase is an efficient data transfer tool."
msgstr "易有云是一个微型家庭数据服务中心,主要用于文件的集中存放、读取、备份及日常管理。释放用户终端设备空间,实现个人、家庭文件长久留存;支持家庭相册、视频文件随时随地多终端查看、播放,满足家庭文件的日常管理。"
msgid "Port"
msgstr "端口"
msgid "The LinkEase service is running."
msgstr "易有云服务已启动"
msgid "The LinkEase service is not running."
msgstr "易有云服务未启动"
msgid "LinkEase Status"
msgstr "易有云服务状态"
msgid "Collecting data..."
msgstr "收集数据..."

View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -f /tmp/luci-indexcache
exit 0