From 5e149fd8f77bc4c1ff0b4a8ff4ca9860be10f5ee Mon Sep 17 00:00:00 2001 From: YGAS Date: Fri, 24 Dec 2021 17:33:13 +0800 Subject: [PATCH] add linkease --- applications/luci-app-linkease/Makefile | 17 ++++++++++++ .../luasrc/controller/linkease.lua | 25 +++++++++++++++++ .../luasrc/model/cbi/linkease.lua | 20 ++++++++++++++ .../view/admin_status/index/linkease.htm | 1 + .../luasrc/view/linkease_status.htm | 27 +++++++++++++++++++ .../luci-app-linkease/po/zh-cn/linkease.po | 27 +++++++++++++++++++ .../root/etc/uci-defaults/50_luci-linkease | 4 +++ 7 files changed, 121 insertions(+) create mode 100755 applications/luci-app-linkease/Makefile create mode 100755 applications/luci-app-linkease/luasrc/controller/linkease.lua create mode 100755 applications/luci-app-linkease/luasrc/model/cbi/linkease.lua create mode 100755 applications/luci-app-linkease/luasrc/view/admin_status/index/linkease.htm create mode 100755 applications/luci-app-linkease/luasrc/view/linkease_status.htm create mode 100755 applications/luci-app-linkease/po/zh-cn/linkease.po create mode 100755 applications/luci-app-linkease/root/etc/uci-defaults/50_luci-linkease diff --git a/applications/luci-app-linkease/Makefile b/applications/luci-app-linkease/Makefile new file mode 100755 index 0000000..d689040 --- /dev/null +++ b/applications/luci-app-linkease/Makefile @@ -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 + diff --git a/applications/luci-app-linkease/luasrc/controller/linkease.lua b/applications/luci-app-linkease/luasrc/controller/linkease.lua new file mode 100755 index 0000000..8eec0ab --- /dev/null +++ b/applications/luci-app-linkease/luasrc/controller/linkease.lua @@ -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 diff --git a/applications/luci-app-linkease/luasrc/model/cbi/linkease.lua b/applications/luci-app-linkease/luasrc/model/cbi/linkease.lua new file mode 100755 index 0000000..2479603 --- /dev/null +++ b/applications/luci-app-linkease/luasrc/model/cbi/linkease.lua @@ -0,0 +1,20 @@ +--wulishui ,20200911 +--jjm2473 ,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 + + diff --git a/applications/luci-app-linkease/luasrc/view/admin_status/index/linkease.htm b/applications/luci-app-linkease/luasrc/view/admin_status/index/linkease.htm new file mode 100755 index 0000000..7ae5dd5 --- /dev/null +++ b/applications/luci-app-linkease/luasrc/view/admin_status/index/linkease.htm @@ -0,0 +1 @@ +<%+linkease_status%> diff --git a/applications/luci-app-linkease/luasrc/view/linkease_status.htm b/applications/luci-app-linkease/luasrc/view/linkease_status.htm new file mode 100755 index 0000000..c170b80 --- /dev/null +++ b/applications/luci-app-linkease/luasrc/view/linkease_status.htm @@ -0,0 +1,27 @@ + + +
+ <%:LinkEase Status%> +

+ <%:Collecting data...%> +

+
diff --git a/applications/luci-app-linkease/po/zh-cn/linkease.po b/applications/luci-app-linkease/po/zh-cn/linkease.po new file mode 100755 index 0000000..3a4462e --- /dev/null +++ b/applications/luci-app-linkease/po/zh-cn/linkease.po @@ -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 "收集数据..." + diff --git a/applications/luci-app-linkease/root/etc/uci-defaults/50_luci-linkease b/applications/luci-app-linkease/root/etc/uci-defaults/50_luci-linkease new file mode 100755 index 0000000..d7bfee2 --- /dev/null +++ b/applications/luci-app-linkease/root/etc/uci-defaults/50_luci-linkease @@ -0,0 +1,4 @@ +#!/bin/sh + +rm -f /tmp/luci-indexcache +exit 0