mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-06 20:14:19 +08:00
1 parent
37eb246de8
commit
ec44f6fe2e
16 files changed
+130
-275
No files matched your search
+53
-36
@@ -1,47 +1,43 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2017-2024
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=filebrowser-q
|
PKG_NAME:=filebrowser-q
|
||||||
PKG_VERSION:=1.5.6-stable
|
PKG_VERSION:=1.5.6-stable
|
||||||
PKG_RELEASE=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
ifeq ($(ARCH),aarch64)
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_ARCH:=arm64
|
PKG_SOURCE_URL:=https://codeload.github.com/gtsteffaniak/filebrowser/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_HASH:=skip
|
PKG_HASH:=skip
|
||||||
else ifeq ($(ARCH),arm)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/filebrowser-$(PKG_VERSION)
|
||||||
PKG_ARCH:=armv7
|
|
||||||
PKG_HASH:=skip
|
PKG_LICENSE:=Apache-2.0
|
||||||
else ifeq ($(ARCH),x86_64)
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
PKG_ARCH:=amd64
|
PKG_MAINTAINER:=kiddin9
|
||||||
PKG_HASH:=skip
|
|
||||||
endif
|
PKG_BUILD_DEPENDS:=golang/host node/host
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
PKG_BUILD_FLAGS:=no-mips16
|
||||||
|
|
||||||
|
GO_PKG:=github.com/gtsteffaniak/filebrowser/backend
|
||||||
|
GO_PKG_BUILD_DIR:=$(PKG_BUILD_DIR)/backend
|
||||||
|
GO_PKG_LDFLAGS_X:= \
|
||||||
|
$(GO_PKG)/internal/version.Version=v$(PKG_VERSION) \
|
||||||
|
$(GO_PKG)/internal/version.CommitSHA=$(PKG_VERSION)
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||||
|
|
||||||
define Package/filebrowser-q
|
define Package/filebrowser-q
|
||||||
SECTION:=net
|
SECTION:=utils
|
||||||
CATEGORY:=Network
|
CATEGORY:=Utilities
|
||||||
DEPENDS:=@(arm||aarch64||x86_64)
|
SUBMENU:=Filesystem
|
||||||
TITLE:=FileBrowser Quantum
|
TITLE:=FileBrowser Quantum - Modern Web File Manager
|
||||||
|
URL:=https://github.com/gtsteffaniak/filebrowser
|
||||||
|
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/filebrowser-q/description
|
define Package/filebrowser-q/description
|
||||||
The best free self-hosted web-based file manager.
|
FileBrowser Quantum provides a modern, responsive web-based file management
|
||||||
endef
|
interface with multi-source, real-time search, and enhanced preview features.
|
||||||
|
|
||||||
PKG_SOURCE:=linux-$(PKG_ARCH)-filebrowser
|
|
||||||
PKG_SOURCE_URL:=https://github.com/gtsteffaniak/filebrowser/releases/download/v$(PKG_VERSION)
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
$(call Build/Prepare/Default)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/filebrowser-q/conffiles
|
define Package/filebrowser-q/conffiles
|
||||||
@@ -49,13 +45,34 @@ define Package/filebrowser-q/conffiles
|
|||||||
/etc/config/filebrowser-q
|
/etc/config/filebrowser-q
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
$(call Build/Prepare/Default)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
( \
|
||||||
|
pushd $(PKG_BUILD_DIR)/frontend && \
|
||||||
|
npm install && \
|
||||||
|
npm run build ; \
|
||||||
|
)
|
||||||
|
( \
|
||||||
|
cd $(PKG_BUILD_DIR)/backend && \
|
||||||
|
$(GO_PKG_VARS) \
|
||||||
|
go build \
|
||||||
|
-trimpath \
|
||||||
|
-ldflags="-w -s" \
|
||||||
|
-o $(PKG_BUILD_DIR)/filebrowser . ; \
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
define Package/filebrowser-q/install
|
define Package/filebrowser-q/install
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
$(INSTALL_BIN) $(CURDIR)/files/filebrowser.init $(1)/etc/init.d/filebrowser-q
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/filebrowser $(1)/usr/bin/filebrowser-q
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
$(INSTALL_CONF) $(CURDIR)/files/filebrowser.config $(1)/etc/config/filebrowser-q
|
$(INSTALL_CONF) $(CURDIR)/files/filebrowser.config $(1)/etc/config/filebrowser-q
|
||||||
$(INSTALL_DIR) $(1)/usr/bin/
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) $(DL_DIR)/linux-$(PKG_ARCH)-filebrowser $(1)/usr/bin/filebrowser-q
|
$(INSTALL_BIN) $(CURDIR)/files/filebrowser.init $(1)/etc/init.d/filebrowser-q
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,filebrowser-q))
|
$(eval $(call BuildPackage,filebrowser-q))
|
||||||
@@ -16,7 +16,7 @@ start() {
|
|||||||
[ "$enabled" -eq "1" ] || return 1
|
[ "$enabled" -eq "1" ] || return 1
|
||||||
|
|
||||||
local listen_port root_path root_name
|
local listen_port root_path root_name
|
||||||
config_get listen_port "config" "listen_port" "8989"
|
config_get listen_port "config" "listen_port" "8787"
|
||||||
config_get root_path "config" "root_path" "/"
|
config_get root_path "config" "root_path" "/"
|
||||||
|
|
||||||
# 路径为 / 时 name 设为 root,否则留空
|
# 路径为 / 时 name 设为 root,否则留空
|
||||||
@@ -43,9 +43,9 @@ userDefaults:
|
|||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
grep -q " name:" "$CONF_PATH" || sed -i "s,.*- path:.*,&\n name: \"\"," "$CONF_PATH"
|
grep -q " name:" "$CONF_PATH" || sed -i "s,.*- path:.*,&\n name: \"\"," "$CONF_PATH"
|
||||||
sed -e "s/.*port:.*/ port: $listen_port/" \
|
sed -e "s/ port:.*/ port: $listen_port/" \
|
||||||
-e "s,.*- path:.*, - path: \"$root_path\"," \
|
-e "s, - path:.*, - path: \"$root_path\"," \
|
||||||
-e "s/.*name:.*/ name: \"$root_name\"/" \
|
-e "s/ name: \".*\"/ name: \"$root_name\"/" \
|
||||||
-i "$CONF_PATH"
|
-i "$CONF_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ return view.extend({
|
|||||||
|
|
||||||
o = s.option(form.Value, 'listen_port', _('Listen port'));
|
o = s.option(form.Value, 'listen_port', _('Listen port'));
|
||||||
o.datatype = 'port';
|
o.datatype = 'port';
|
||||||
o.default = '8989';
|
o.default = '8787';
|
||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
|
|
||||||
o = s.option(form.Value, 'root_path', _('Root directory'));
|
o = s.option(form.Value, 'root_path', _('Root directory'));
|
||||||
|
|||||||
@@ -272,9 +272,17 @@ o = s:option(ListValue, "remote_dns_protocol", translate("Remote DNS Protocol"))
|
|||||||
o:value("tcp", "TCP")
|
o:value("tcp", "TCP")
|
||||||
o:value("doh", "DoH")
|
o:value("doh", "DoH")
|
||||||
o:value("udp", "UDP")
|
o:value("udp", "UDP")
|
||||||
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
if m.is_js_luci then
|
||||||
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
if current_node.type == "sing-box" then
|
||||||
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
o:value("tls", "TLS(DoT)")
|
||||||
|
o:value("quic", "QUIC(DoQ)")
|
||||||
|
o:value("http3", "HTTP3(DoH3)")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
||||||
|
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
||||||
|
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
||||||
|
end
|
||||||
o:depends("_show_dns_option", "1")
|
o:depends("_show_dns_option", "1")
|
||||||
|
|
||||||
---- DNS over TCP or UDP or TLS (DoT) or QUIC (DoQ)
|
---- DNS over TCP or UDP or TLS (DoT) or QUIC (DoQ)
|
||||||
@@ -382,9 +390,8 @@ for k, v in pairs(nodes_table) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--m:appendTemplate("/acl/options", {section = arg[1]})
|
--[[
|
||||||
|
-- Shunt
|
||||||
-- Shunt Start
|
|
||||||
if current_node.protocol == "_shunt" then
|
if current_node.protocol == "_shunt" then
|
||||||
local shunt_lua = loadfile("/usr/lib/lua/luci/model/cbi/passwall2/client/include/shunt_options.lua")
|
local shunt_lua = loadfile("/usr/lib/lua/luci/model/cbi/passwall2/client/include/shunt_options.lua")
|
||||||
setfenv(shunt_lua, getfenv(1))(m, s, {
|
setfenv(shunt_lua, getfenv(1))(m, s, {
|
||||||
@@ -396,5 +403,6 @@ if current_node.protocol == "_shunt" then
|
|||||||
end
|
end
|
||||||
|
|
||||||
m:appendTemplate("/acl/shunt", { shunt_list = api.jsonc.stringify(shunt_list), section = s.section })
|
m:appendTemplate("/acl/shunt", { shunt_list = api.jsonc.stringify(shunt_list), section = s.section })
|
||||||
|
]]--
|
||||||
|
|
||||||
return api.return_map(m)
|
return api.return_map(m)
|
||||||
@@ -201,9 +201,17 @@ o = s:taboption("DNS", ListValue, "remote_dns_protocol", translate("Remote DNS P
|
|||||||
o:value("tcp", "TCP")
|
o:value("tcp", "TCP")
|
||||||
o:value("doh", "DoH")
|
o:value("doh", "DoH")
|
||||||
o:value("udp", "UDP")
|
o:value("udp", "UDP")
|
||||||
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
if m.is_js_luci then
|
||||||
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
if current_node.type == "sing-box" then
|
||||||
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
o:value("tls", "TLS(DoT)")
|
||||||
|
o:value("quic", "QUIC(DoQ)")
|
||||||
|
o:value("http3", "HTTP3(DoH3)")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
||||||
|
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
||||||
|
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
||||||
|
end
|
||||||
|
|
||||||
---- DNS over TCP or UDP or TLS (DoT) or QUIC (DoQ)
|
---- DNS over TCP or UDP or TLS (DoT) or QUIC (DoQ)
|
||||||
o = s:taboption("DNS", Value, "remote_dns", translate("Remote DNS"))
|
o = s:taboption("DNS", Value, "remote_dns", translate("Remote DNS"))
|
||||||
@@ -259,11 +267,10 @@ o:value("UseIP")
|
|||||||
o:value("UseIPv4")
|
o:value("UseIPv4")
|
||||||
o:value("UseIPv6")
|
o:value("UseIPv6")
|
||||||
|
|
||||||
if current_node.type == "sing-box" then
|
o = s:taboption("DNS", Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
||||||
o = s:taboption("DNS", Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
o.datatype = "min(1)"
|
||||||
o.datatype = "min(1)"
|
o.default = "30"
|
||||||
o.default = "30"
|
o:depends("_is_singbox", "1")
|
||||||
end
|
|
||||||
|
|
||||||
o = s:taboption("DNS", TextValue, "dns_hosts", translate("Domain Override"))
|
o = s:taboption("DNS", TextValue, "dns_hosts", translate("Domain Override"))
|
||||||
o.rows = 5
|
o.rows = 5
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
<%
|
|
||||||
local map = self.map
|
|
||||||
local api = map.api
|
|
||||||
local config = map.config
|
|
||||||
local section = self.section
|
|
||||||
-%>
|
|
||||||
<script type="text/javascript">
|
|
||||||
//<![CDATA[
|
|
||||||
function setOption(option, val) {
|
|
||||||
const dom = document.getElementById('cbid.<%=config%>.<%=section%>.' + option);
|
|
||||||
if (dom) {
|
|
||||||
dom.value = val;
|
|
||||||
}
|
|
||||||
const combobox_dom = document.getElementById('cbi.combobox.cbid.<%=config%>.<%=section%>.' + option);
|
|
||||||
if (combobox_dom) {
|
|
||||||
combobox_dom.value = val;
|
|
||||||
//combobox_dom.selectedIndex = val;
|
|
||||||
//combobox_dom.dispatchEvent(new Event("change", { bubbles: true }));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
function dom_event() {
|
|
||||||
waitForElementId('cbi.combobox.cbid.<%=config%>.<%=section%>.tcp_no_redir_ports', function(el) {
|
|
||||||
const o_val = el.value;
|
|
||||||
el.addEventListener("change", () => {
|
|
||||||
const udp_no_redir_ports = getOption("<%=config%>", "<%=section%>", "udp_no_redir_ports");
|
|
||||||
if (el.value == "1:65535" && udp_no_redir_ports && udp_no_redir_ports.value == "1:65535") {
|
|
||||||
setOption("tcp_no_redir_ports", "");
|
|
||||||
setOption("udp_no_redir_ports", "");
|
|
||||||
setOption("mode", 0);
|
|
||||||
cbi_d_update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
waitForElementId('cbi.combobox.cbid.<%=config%>.<%=section%>.udp_no_redir_ports', function(el) {
|
|
||||||
const o_val = el.value;
|
|
||||||
el.addEventListener("change", () => {
|
|
||||||
const tcp_no_redir_ports = getOption("<%=config%>", "<%=section%>", "tcp_no_redir_ports");
|
|
||||||
if (el.value == "1:65535" && tcp_no_redir_ports && tcp_no_redir_ports.value == "1:65535") {
|
|
||||||
setOption("tcp_no_redir_ports", "");
|
|
||||||
setOption("udp_no_redir_ports", "");
|
|
||||||
setOption("mode", 0);
|
|
||||||
cbi_d_update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const ori_cbi_d_update = cbi_d_update;
|
|
||||||
cbi_d_update = function() {
|
|
||||||
ori_cbi_d_update();
|
|
||||||
dom_event();
|
|
||||||
};
|
|
||||||
dom_event();
|
|
||||||
});
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
@@ -1507,15 +1507,17 @@ table td, .table .td {
|
|||||||
|
|
||||||
//Node list option saving logic
|
//Node list option saving logic
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
function onChange(option, value) {
|
function onChange(option, value, refresh) {
|
||||||
ajax.abortAll();
|
ajax.abortAll();
|
||||||
XHR.get('<%=api.url("save_node_list_opt")%>', {
|
XHR.get('<%=api.url("save_node_list_opt")%>', {
|
||||||
option: option,
|
option: option,
|
||||||
value: value
|
value: value
|
||||||
}, function(x) {
|
}, function(x) {
|
||||||
if (x && x.status == 200) {
|
if (x && x.status == 200) {
|
||||||
document.getElementById("node_list").innerHTML = "";
|
if (refresh) {
|
||||||
loadNodeList();
|
document.getElementById("node_list").innerHTML = "";
|
||||||
|
loadNodeList();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alert("<%:Error%>");
|
alert("<%:Error%>");
|
||||||
}
|
}
|
||||||
@@ -1527,7 +1529,7 @@ table td, .table .td {
|
|||||||
el.addEventListener("change", () => {
|
el.addEventListener("change", () => {
|
||||||
el.blur();
|
el.blur();
|
||||||
show_node_info = el.checked ? "1" : "0";
|
show_node_info = el.checked ? "1" : "0";
|
||||||
onChange("show_node_info", show_node_info);
|
onChange("show_node_info", show_node_info, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1535,32 +1537,47 @@ table td, .table .td {
|
|||||||
el.addEventListener("change", () => {
|
el.addEventListener("change", () => {
|
||||||
el.blur();
|
el.blur();
|
||||||
auto_detection_time = el.value;
|
auto_detection_time = el.value;
|
||||||
onChange("auto_detection_time", auto_detection_time);
|
onChange("auto_detection_time", auto_detection_time, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
waitForElement('select[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
<% if api.is_js_luci() then -%>
|
||||||
el.addEventListener("change", () => {
|
waitForElement('div[id*="cbid.<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||||
if (el.value) {
|
el.addEventListener("cbi-dropdown-change", () => {
|
||||||
onChange("url_test_url", el.value);
|
if (el.value && (!el.new_val || el.new_val != el.value)) {
|
||||||
}
|
onChange("url_test_url", el.value, false);
|
||||||
|
el.new_val = el.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
<% else -%>
|
||||||
|
waitForElement('select[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||||
|
el.addEventListener("change", () => {
|
||||||
|
if (el.value && (!el.new_val || el.new_val != el.value)) {
|
||||||
|
onChange("url_test_url", el.value, false);
|
||||||
|
el.new_val = el.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
waitForElement('input[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
waitForElement('input[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||||
el.addEventListener("change", () => {
|
el.addEventListener("change", () => {
|
||||||
if (el.value) {
|
if (el.value && (!el.new_val || el.new_val != el.value)) {
|
||||||
onChange("url_test_url", el.value);
|
onChange("url_test_url", el.value, false);
|
||||||
}
|
el.new_val = el.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
<% end -%>
|
||||||
}
|
}
|
||||||
|
|
||||||
const ori_cbi_d_update = cbi_d_update;
|
<% if not api.is_js_luci() then -%>
|
||||||
cbi_d_update = function() {
|
const ori_cbi_d_update = cbi_d_update;
|
||||||
ori_cbi_d_update();
|
cbi_d_update = function() {
|
||||||
dom_event();
|
ori_cbi_d_update();
|
||||||
};
|
dom_event();
|
||||||
|
};
|
||||||
|
<% end -%>
|
||||||
dom_event();
|
dom_event();
|
||||||
|
|
||||||
const links = document.querySelectorAll('a');
|
const links = document.querySelectorAll('a');
|
||||||
|
|||||||
Submodule
+1
Submodule luci-app-syncthing added at b7a197a93c.
@@ -1,22 +0,0 @@
|
|||||||
# Copyright (C) 2020 Gyj1109
|
|
||||||
# 适配 OpenWrt 25.12 修改版
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=luci-app-syncthing
|
|
||||||
PKG_VERSION:=1.0
|
|
||||||
PKG_RELEASE:=3
|
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI support for Syncthing
|
|
||||||
LUCI_PKGARCH:=all
|
|
||||||
# 适配 25.12:确保安装了 syncthing 后,LuCI 界面能正确拉起
|
|
||||||
LUCI_DEPENDS:=+syncthing
|
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
|
||||||
|
|
||||||
# 明确定义配置文件的归属,这对 25.12 的 apk 管理器非常重要
|
|
||||||
define Package/$(PKG_NAME)/conffiles
|
|
||||||
/etc/config/syncthing
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# luci-app-syncthing
|
|
||||||
在Potat0000源码基础上进行了汉化优化,官方openwrt23.05.3编译后可使用
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
module("luci.controller.syncthing", package.seeall)
|
|
||||||
|
|
||||||
function index()
|
|
||||||
if not nixio.fs.access("/etc/config/syncthing") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
entry({"admin", "services", "syncthing"}, cbi("syncthing"), _("文件同步"), 10).dependent = true
|
|
||||||
entry({"admin", "services", "syncthing", "status"}, call("act_status")).leaf = true
|
|
||||||
end
|
|
||||||
|
|
||||||
function act_status()
|
|
||||||
local e = {}
|
|
||||||
e.running = luci.sys.call("pgrep syncthing >/dev/null") == 0
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json(e)
|
|
||||||
end
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
require("nixio.fs")
|
|
||||||
|
|
||||||
m = Map("syncthing", translate("Syncthing同步工具"))
|
|
||||||
|
|
||||||
m:section(SimpleSection).template = "syncthing/syncthing_status"
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "syncthing")
|
|
||||||
|
|
||||||
s.anonymous = true
|
|
||||||
|
|
||||||
o = s:option(Flag, "enabled", translate("启用"))
|
|
||||||
o.default = 0
|
|
||||||
o.rmempty = false
|
|
||||||
|
|
||||||
gui_address = s:option(Value, "gui_address", translate("GUI访问地址"))
|
|
||||||
gui_address.description = translate("使用0.0.0.0以监控所有访问。")
|
|
||||||
gui_address.default = "http://0.0.0.0:8384"
|
|
||||||
gui_address.placeholder = "http://0.0.0.0:8384"
|
|
||||||
gui_address.rmempty = false
|
|
||||||
|
|
||||||
home = s:option(Value, "home", translate("配置文件目录"))
|
|
||||||
home.description = translate("只有保存在/etc/syncthing中的配置会自动备份!")
|
|
||||||
home.default = "/etc/syncthing"
|
|
||||||
home.placeholder = "/etc/syncthing"
|
|
||||||
home.rmempty = false
|
|
||||||
|
|
||||||
user = s:option(ListValue, "user", translate("用户"))
|
|
||||||
user.description = translate("默认是syncthing,但这可能会导致权限被拒绝。Syncthing官方不建议以root身份运行。")
|
|
||||||
user:value("", translate("syncthing"))
|
|
||||||
for u in luci.util.execi("cat /etc/passwd | cut -d ':' -f1") do
|
|
||||||
user:value(u)
|
|
||||||
end
|
|
||||||
|
|
||||||
macprocs = s:option(Value, "macprocs", translate("线程限制"))
|
|
||||||
macprocs.description = translate("0表示匹配CPU数量(默认),>0表示显式指定并发数。")
|
|
||||||
macprocs.default = "0"
|
|
||||||
macprocs.placeholder = "0"
|
|
||||||
macprocs.datatype = "range(0,32)"
|
|
||||||
macprocs.rmempty = false
|
|
||||||
|
|
||||||
nice = s:option(Value, "nice", translate("优先级"))
|
|
||||||
nice.description = translate("显式指定优先级值。0是最高,19是最低。(暂时不允许设置负值)")
|
|
||||||
nice.default = "19"
|
|
||||||
nice.placeholder = "19"
|
|
||||||
nice.datatype = "range(0,19)"
|
|
||||||
nice.rmempty = false
|
|
||||||
|
|
||||||
return m
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
XHR.poll(1, '<%=url([[admin]], [[services]], [[syncthing]], [[status]])%>', null,
|
|
||||||
function (x, data) {
|
|
||||||
var tb = document.getElementById('syncthing_status');
|
|
||||||
if (data && tb) {
|
|
||||||
if (data.running) {
|
|
||||||
var links = '<em><b><font color="green">Syncthing <%:运行中%></font></b></em><input class="btn cbi-button mar-10" type="button" value="<%:打开Syncthing页面%>" onclick="openwebui();" />';
|
|
||||||
tb.innerHTML = links;
|
|
||||||
} else {
|
|
||||||
tb.innerHTML = '<em><b><font color="red">Syncthing <%:未运行%></font></b></em>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
function openwebui(){
|
|
||||||
var url = window.location.host+":<%=luci.sys.exec("uci -q get syncthing.syncthing.gui_address"):match(":[0-9]+"):gsub(":", "")%>";
|
|
||||||
window.open('http://'+url,'target','');
|
|
||||||
}
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<p id="syncthing_status">
|
|
||||||
<em><%:正在收集数据...%></em>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
touch /etc/config/syncthing
|
|
||||||
|
|
||||||
uci -q batch <<-EOF >/dev/null
|
|
||||||
delete ucitrack.@syncthing[-1]
|
|
||||||
add ucitrack syncthing
|
|
||||||
set ucitrack.@syncthing[-1].exec='/etc/init.d/syncthing stop && /etc/init.d/syncthing start'
|
|
||||||
commit ucitrack
|
|
||||||
EOF
|
|
||||||
# remove LuCI cache
|
|
||||||
rm -f /tmp/luci*
|
|
||||||
exit 0
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"luci-app-syncthing": {
|
|
||||||
"description": "Grant UCI access for luci-app-syncthing",
|
|
||||||
"read": {
|
|
||||||
"uci": [ "syncthing" ]
|
|
||||||
},
|
|
||||||
"write": {
|
|
||||||
"uci": [ "syncthing" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1767,6 +1767,9 @@ static int __init fast_classifier_init(void)
|
|||||||
printk(KERN_ALERT "fast-classifier: starting up\n");
|
printk(KERN_ALERT "fast-classifier: starting up\n");
|
||||||
DEBUG_INFO("SFE CM init\n");
|
DEBUG_INFO("SFE CM init\n");
|
||||||
|
|
||||||
|
/* Initialize state before registering callbacks that can use it. */
|
||||||
|
spin_lock_init(&sc->lock);
|
||||||
|
|
||||||
hash_init(fc_conn_ht);
|
hash_init(fc_conn_ht);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1882,8 +1885,6 @@ static int __init fast_classifier_init(void)
|
|||||||
|
|
||||||
printk(KERN_ALERT "fast-classifier: registered\n");
|
printk(KERN_ALERT "fast-classifier: registered\n");
|
||||||
|
|
||||||
spin_lock_init(&sc->lock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hook the receive path in the network stack.
|
* Hook the receive path in the network stack.
|
||||||
*/
|
*/
|
||||||
@@ -2005,4 +2006,3 @@ module_exit(fast_classifier_exit)
|
|||||||
|
|
||||||
MODULE_DESCRIPTION("Shortcut Forwarding Engine - Connection Manager");
|
MODULE_DESCRIPTION("Shortcut Forwarding Engine - Connection Manager");
|
||||||
MODULE_LICENSE("Dual BSD/GPL");
|
MODULE_LICENSE("Dual BSD/GPL");
|
||||||
|
|
||||||
Reference in new issue
Block a user