🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for syncthing
LUCI_DEPENDS:=+luci-compat +syncthing
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,21 @@
module("luci.controller.syncthing", package.seeall)
function index()
if not nixio.fs.access("/etc/config/syncthing") then
return
end
local page = entry({"admin", "nas", "syncthing"}, cbi("syncthing"), _("Syncthing"))
page.order = 10
page.dependent = true
page.acl_depends = { "luci-app-syncthing" }
entry({"admin","nas","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
@@ -0,0 +1,52 @@
-- Copyright 2008 Yanira <forum-2008@email.de>
-- Licensed to the public under the Apache License 2.0.
require("nixio.fs")
m = Map("syncthing", translate("Syncthing Synchronization Tool"))
m:section(SimpleSection).template = "syncthing/syncthing_status"
s = m:section(TypedSection, "syncthing")
s.addremove = false
s.anonymous = true
o = s:option(Flag, "enabled", translate("Enabled"))
o.default = 0
o.rmempty = false
gui_address = s:option(Value, "gui_address", translate("GUI access address"))
gui_address.description = translate("Use 0.0.0.0:8384 to monitor all access.")
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("Configuration file directory"))
home.description = translate("Only the configuration saved in /etc/syncthing will be automatically backed up!")
home.default = "/etc/syncthing"
home.placeholder = "/etc/syncthing"
home.rmempty = false
user = s:option(ListValue, "user", translate("User"))
user.description = translate("The default is syncthing, but it may cause permission denied. Syncthing officially does not recommend running as 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("Thread limit"))
macprocs.description = translate("0 to match the number of CPUs (default), >0 to explicitly specify concurrency.")
macprocs.default = "0"
macprocs.placeholder = "0"
macprocs.datatype="range(0,32)"
macprocs.rmempty = false
nice = s:option(Value, "nice", "Nice")
nice.description = translate("Explicitly specify nice. 0 is the highest and 19 is the lowest. (negative values are not allowed to be set temporarily)")
nice.default = "19"
nice.placeholder = "19"
nice.datatype="range(0,19)"
nice.rmempty = false
return m
@@ -0,0 +1,27 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(1, '<%=url([[admin]], [[nas]], [[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 <%:RUNNING%></font></b></em><input class="btn cbi-button mar-10" type="button" value="<%:Open Syncthing page%>" onclick="openwebui();" />';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color="red">Syncthing <%:NOT RUNNING%></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><%:Collecting data...%></em>
</p>
</fieldset>
+1
View File
@@ -0,0 +1 @@
zh_Hans
@@ -0,0 +1,35 @@
msgid "Syncthing"
msgstr "Syncthing"
msgid "Syncthing Synchronization Tool"
msgstr "Syncthing 存储同步工具"
msgid "Open Syncthing page"
msgstr "打开储存同步页面"
msgid "GUI access address"
msgstr "GUI访问地址"
msgid "Use 0.0.0.0:8384 to monitor all access."
msgstr "使用0.0.0.0:8384监听所有访问。"
msgid "Configuration file directory"
msgstr "配置文件存储目录"
msgid "Only the configuration saved in /etc/syncthing will be automatically backed up!"
msgstr "只有保存在 /etc/syncthing 的配置会被自动备份!"
msgid "User"
msgstr "用户"
msgid "The default is syncthing, but it may cause permission denied. Syncthing officially does not recommend running as root."
msgstr "默认为syncthing,但可能引起权限不足问题。Syncthing官方不建议以root身份运行。"
msgid "Thread limit"
msgstr "线程限制"
msgid "0 to match the number of CPUs (default), >0 to explicitly specify concurrency."
msgstr "使用0来匹配CPU核心数,或输入大于0的数来显式指定并发数。"
msgid "Explicitly specify nice. 0 is the highest and 19 is the lowest. (negative values are not allowed to be set temporarily)"
msgstr "显式指定进程Nice值。其中0最高,19最低。(暂不允许设置负值)"
@@ -0,0 +1,21 @@
#!/bin/sh
[ ! -f "/usr/share/ucitrack/luci-app-syncthing.json" ] && {
cat > /usr/share/ucitrack/luci-app-syncthing.json << EEOF
{
"config": "syncthing",
"init": "syncthing"
}
EEOF
}
touch /etc/config/syncthing
sed -i "s/127.0.0.1:8384/0.0.0.0:8384/" /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 restart'
commit ucitrack
EOF
# remove LuCI cache
rm -f /tmp/luci*
exit 0
@@ -0,0 +1,11 @@
{
"luci-app-syncthing": {
"description": "Grant UCI access for luci-app-syncthing",
"read": {
"uci": [ "syncthing" ]
},
"write": {
"uci": [ "syncthing" ]
}
}
}