mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-07-27 08:31:44 +08:00
update 2026-07-07 18:50:38
This commit is contained in:
parent
972bb0f2e8
commit
63fdfa1a7a
28
luci-app-baidudrive/Makefile
Normal file
28
luci-app-baidudrive/Makefile
Normal file
@ -0,0 +1,28 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=baidudrive
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_RELEASE:=1
|
||||
LUCI_DEPENDS:=+baidudrive +luci-compat
|
||||
LUCI_MINIFY_CSS:=0
|
||||
LUCI_MINIFY_JS:=0
|
||||
|
||||
define Package/luci-app-baidudrive/conffiles
|
||||
/etc/config/baidudrive
|
||||
endef
|
||||
|
||||
define Package/luci-app-baidudrive/postrm
|
||||
#!/bin/sh
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
29
luci-app-baidudrive/luasrc/controller/baidudrive.lua
Normal file
29
luci-app-baidudrive/luasrc/controller/baidudrive.lua
Normal file
@ -0,0 +1,29 @@
|
||||
local http = require "luci.http"
|
||||
|
||||
module("luci.controller.baidudrive", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/baidudrive") then
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "baidudrive"}, cbi("baidudrive"), _("BaiduDrive"), 100)
|
||||
page.dependent = true
|
||||
entry({"admin", "services", "baidudrive_status"}, call("baidudrive_status"))
|
||||
end
|
||||
|
||||
function baidudrive_status()
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local port = uci:get_first("baidudrive", "baidudrive", "port") or "10780"
|
||||
local app_running = (sys.call("pidof baidudrive >/dev/null") == 0)
|
||||
local sdk_running = (sys.call("pidof baiduNas >/dev/null") == 0)
|
||||
local status = {
|
||||
running = app_running and sdk_running,
|
||||
app_running = app_running,
|
||||
sdk_running = sdk_running,
|
||||
port = port
|
||||
}
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(status)
|
||||
end
|
||||
53
luci-app-baidudrive/luasrc/model/baidudrive.lua
Normal file
53
luci-app-baidudrive/luasrc/model/baidudrive.lua
Normal file
@ -0,0 +1,53 @@
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local baidudrive = {}
|
||||
|
||||
baidudrive.blocks = function()
|
||||
local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r")
|
||||
local vals = {}
|
||||
if f then
|
||||
local ret = f:read("*all")
|
||||
f:close()
|
||||
local obj = jsonc.parse(ret)
|
||||
for _, val in pairs(obj and obj["blockdevices"] or {}) do
|
||||
local fsize = val["fssize"]
|
||||
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
|
||||
vals[#vals + 1] = val["mountpoint"]
|
||||
end
|
||||
end
|
||||
end
|
||||
return vals
|
||||
end
|
||||
|
||||
baidudrive.home = function()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local home_dirs = {}
|
||||
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root")
|
||||
home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"] .. "/Configs")
|
||||
home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"] .. "/Public")
|
||||
home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"] .. "/Downloads")
|
||||
home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"] .. "/Caches")
|
||||
return home_dirs
|
||||
end
|
||||
|
||||
baidudrive.find_paths = function(blocks, home_dirs, path_name)
|
||||
local default_path = ""
|
||||
local paths = {}
|
||||
|
||||
default_path = home_dirs[path_name] .. "/BaiduDrive"
|
||||
if #blocks == 0 then
|
||||
table.insert(paths, default_path)
|
||||
else
|
||||
for _, val in pairs(blocks) do
|
||||
table.insert(paths, val .. "/" .. path_name .. "/BaiduDrive")
|
||||
end
|
||||
local without_conf_dir = "/root/" .. path_name .. "/BaiduDrive"
|
||||
if default_path == without_conf_dir then
|
||||
default_path = paths[1]
|
||||
end
|
||||
end
|
||||
|
||||
return paths, default_path
|
||||
end
|
||||
|
||||
return baidudrive
|
||||
32
luci-app-baidudrive/luasrc/model/cbi/baidudrive.lua
Normal file
32
luci-app-baidudrive/luasrc/model/cbi/baidudrive.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local m, s
|
||||
|
||||
m = Map("baidudrive", translate("BaiduDrive"), translate("BaiduDrive provides a Baidu Netdisk Web UI."))
|
||||
m:section(SimpleSection).template = "baidudrive/baidudrive_status"
|
||||
|
||||
s = m:section(TypedSection, "baidudrive", translate("Global settings"))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
s:option(Flag, "enabled", translate("Enable")).rmempty = false
|
||||
|
||||
local baidudrive_model = require "luci.model.baidudrive"
|
||||
local blocks = baidudrive_model.blocks()
|
||||
local home = baidudrive_model.home()
|
||||
|
||||
local data_dir = s:option(Value, "data_dir", translate("Data directory"))
|
||||
data_dir.rmempty = false
|
||||
data_dir.description = translate("Required. BaiduDrive stores its config, session and task data under this directory.")
|
||||
|
||||
local paths, default_path = baidudrive_model.find_paths(blocks, home, "Configs")
|
||||
for _, val in pairs(paths) do
|
||||
data_dir:value(val, val)
|
||||
end
|
||||
data_dir.default = default_path
|
||||
|
||||
local port = s:option(Value, "port", translate("Listen port"))
|
||||
port.default = "10780"
|
||||
port.rmempty = false
|
||||
port.datatype = "port"
|
||||
port.description = translate("Port for BaiduDrive HTTP server.")
|
||||
|
||||
return m
|
||||
@ -0,0 +1,23 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url("admin/services/baidudrive_status")%>', null, function(x, st) {
|
||||
var el = document.getElementById('baidudrive_status');
|
||||
if (st && el) {
|
||||
if (!st.running) {
|
||||
el.innerHTML = '<br/><em style=\"color:red\"><%:The BaiduDrive service is not running.%></em>'
|
||||
+ '<br/><small>baidudrive: ' + (st.app_running ? 'running' : 'stopped')
|
||||
+ ', baiduNas: ' + (st.sdk_running ? 'running' : 'stopped') + '</small>';
|
||||
}
|
||||
if (st.running) {
|
||||
el.innerHTML = '<br/><em style=\"color:green\"><%:The BaiduDrive service is running.%></em>'
|
||||
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open BaiduDrive%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + st.port + "/')\"/>";
|
||||
}
|
||||
}
|
||||
});
|
||||
//]]></script>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Status%></legend>
|
||||
<p id="baidudrive_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
56
luci-app-baidudrive/po/zh-cn/baidudrive.po
Normal file
56
luci-app-baidudrive/po/zh-cn/baidudrive.po
Normal file
@ -0,0 +1,56 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: luasrc/controller/baidudrive.lua:10 luasrc/model/cbi/baidudrive.lua:3
|
||||
msgid "BaiduDrive"
|
||||
msgstr "百度网盘"
|
||||
|
||||
#: luasrc/model/cbi/baidudrive.lua:3
|
||||
msgid "BaiduDrive provides a Baidu Netdisk Web UI."
|
||||
msgstr "百度网盘提供 WEBUI"
|
||||
|
||||
#: luasrc/view/baidudrive/baidudrive_status.htm:10
|
||||
msgid "Click to open BaiduDrive"
|
||||
msgstr "点击打开百度网盘 WEBUI"
|
||||
|
||||
#: luasrc/view/baidudrive/baidudrive_status.htm:19
|
||||
msgid "Collecting data..."
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/baidudrive.lua:16
|
||||
msgid "Data directory"
|
||||
msgstr "数据文件夹"
|
||||
|
||||
#: luasrc/model/cbi/baidudrive.lua:10
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
#: luasrc/model/cbi/baidudrive.lua:6
|
||||
msgid "Global settings"
|
||||
msgstr "全局设置"
|
||||
|
||||
#: luasrc/model/cbi/baidudrive.lua:26
|
||||
msgid "Listen port"
|
||||
msgstr "监听端口"
|
||||
|
||||
#: luasrc/model/cbi/baidudrive.lua:30
|
||||
msgid "Port for BaiduDrive HTTP server."
|
||||
msgstr "百度网盘 HTTP 服务的端口号"
|
||||
|
||||
#: luasrc/model/cbi/baidudrive.lua:18
|
||||
msgid ""
|
||||
"Required. BaiduDrive stores its config, session and task data under this "
|
||||
"directory."
|
||||
msgstr "必需。百度网盘在此文件夹下保存配置和会话,以及任务数据"
|
||||
|
||||
#: luasrc/view/baidudrive/baidudrive_status.htm:17
|
||||
msgid "Status"
|
||||
msgstr "状态"
|
||||
|
||||
#: luasrc/view/baidudrive/baidudrive_status.htm:6
|
||||
msgid "The BaiduDrive service is not running."
|
||||
msgstr "百度网盘未运行"
|
||||
|
||||
#: luasrc/view/baidudrive/baidudrive_status.htm:9
|
||||
msgid "The BaiduDrive service is running."
|
||||
msgstr "百度网盘运行中"
|
||||
@ -893,21 +893,21 @@ return view.extend({
|
||||
s.tab('advanced', _('Advanced Settings'));
|
||||
|
||||
// enable flag;
|
||||
o = s.taboption("general", form.Flag, "enabled", _("Enable"), _("Enable"));
|
||||
o = s.taboption("general", form.Flag, "enabled", _("Enable"));
|
||||
o.rmempty = false;
|
||||
o.default = o.enabled;
|
||||
o.editable = true;
|
||||
|
||||
// name;
|
||||
o = s.taboption("general", form.Value, "name", _("DNS Server Name"), _("DNS Server Name"));
|
||||
o = s.taboption("general", form.Value, "name", _("DNS Server Name"));
|
||||
|
||||
// IP address;
|
||||
o = s.taboption("general", form.Value, "ip", _("ip"), _("DNS Server ip"));
|
||||
o = s.taboption("general", form.Value, "ip", _("DNS Server ip"));
|
||||
o.datatype = "or(ipaddr, string)";
|
||||
o.rmempty = false;
|
||||
|
||||
// port;
|
||||
o = s.taboption("general", form.Value, "port", _("port"), _("DNS Server port"));
|
||||
o = s.taboption("general", form.Value, "port" _("DNS Server port"));
|
||||
o.placeholder = "default";
|
||||
o.datatype = "port";
|
||||
o.rempty = true;
|
||||
@ -917,7 +917,7 @@ return view.extend({
|
||||
o.depends("type", "quic");
|
||||
|
||||
// type;
|
||||
o = s.taboption("general", form.ListValue, "type", _("type"), _("DNS Server type"));
|
||||
o = s.taboption("general", form.ListValue, "type" _("DNS Server type"));
|
||||
o.placeholder = "udp";
|
||||
o.value("udp", _("udp"));
|
||||
o.value("tcp", _("tcp"));
|
||||
@ -929,7 +929,7 @@ return view.extend({
|
||||
o.rempty = false;
|
||||
|
||||
// server group
|
||||
o = s.taboption("general", form.Value, "server_group", _("Server Group"), _("DNS Server group"))
|
||||
o = s.taboption("general", form.Value, "server_group" _("DNS Server group"))
|
||||
o.rmempty = true;
|
||||
o.placeholder = "default";
|
||||
o.datatype = "hostname";
|
||||
|
||||
@ -21,13 +21,13 @@ define Download/geoip
|
||||
HASH:=b71d1999439dde2de2d2b6844a2befa50c50211ff739785c005ca7c230a17d6a
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=20260706034657
|
||||
GEOSITE_VER:=20260707064352
|
||||
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
|
||||
define Download/geosite
|
||||
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=79259090bb43e906a74fcb59b7e4b4afc83e8238a0d75f15f55f5f71e62671e9
|
||||
HASH:=51a40b9fbd782a22f78bdefb6940219fe485110325ae101caf333d35856a7ff1
|
||||
endef
|
||||
|
||||
GEOSITE_IRAN_VER:=202607060129
|
||||
|
||||
Loading…
Reference in New Issue
Block a user