🔥 Sync 2026-11-17 02:49:06

This commit is contained in:
github-actions[bot] committed 2026-11-17 02:49:06 +08:00
1 parent 527da74d3e
commit 8fcc7fc0e9
73 files changed
+11702 -765

No files matched your search

+6 -6
View File
@@ -1,10 +1,10 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=changeguard
PKG_VERSION:=0.3.0-cg1
PKG_RELEASE:=1
PKG_VERSION:=0.3.1
PKG_RELEASE:=2
include ./release.mk
PKG_SOURCE:=changeguard-$(PKG_VERSION)-$(ARCH).tar.gz
PKG_SOURCE_URL?=https://fw.koolcenter.com/binary/changeguard/releases/
PKG_SOURCE_URL:=https://github.com/istoreos/istoreos-app-hub/releases/download/changeguard-runtime-v$(PKG_VERSION)/
PKG_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
STRIP:=true
@@ -51,8 +51,8 @@ IPKG_INSTROOT="$${IPKG_INSTROOT:-}" "$${IPKG_INSTROOT:-}/usr/libexec/changeguard
endef
define Package/changeguard/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/changeguard_bin $(1)/usr/sbin/changeguard_bin
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/changeguard_bin $(1)/usr/sbin/changeguard_bin
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,changeguard))
+3 -3
View File
@@ -1,3 +1,3 @@
# Local candidate; not publicly published.
CHANGEGUARD_HASH_x86_64:=11dba6b05e0bb7479253ee083292b2f5e078ee395ec770a2128ac85a5e166886
CHANGEGUARD_HASH_aarch64:=3f2ffbcf2b58a11953b76163cbb187225f2591c16f4e70e6a96a49c3d74896ff
# GitHub release: changeguard-runtime-v0.3.1
CHANGEGUARD_HASH_x86_64:=c56c53d3269f9b591d97da17d2a70e22bdbe3c243b3393739a82cb4ac496d489
CHANGEGUARD_HASH_aarch64:=cb50edf684063b0570e570768457d7a28118d8be3dd0c74ffac404a5c786633b
+6 -6
View File
@@ -1,10 +1,10 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=linkspace
PKG_VERSION:=0.3.0-cg1
PKG_RELEASE:=1
PKG_VERSION:=0.3.1
PKG_RELEASE:=2
include ./release.mk
PKG_SOURCE:=linkspace-$(PKG_VERSION)-$(ARCH).tar.gz
PKG_SOURCE_URL?=https://fw.koolcenter.com/binary/linkspace/releases/
PKG_SOURCE_URL:=https://github.com/istoreos/istoreos-app-hub/releases/download/linkspace-runtime-v$(PKG_VERSION)/
PKG_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
@@ -64,8 +64,8 @@ exit 0
endef
define Package/linkspace/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/share/linkspace
$(INSTALL_BIN) $(PKG_BUILD_DIR)/linkspace $(1)/usr/bin/linkspace
$(INSTALL_DATA) $(PKG_BUILD_DIR)/dependency.json $(1)/usr/share/linkspace/dependency.json
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/share/linkspace
$(INSTALL_BIN) $(PKG_BUILD_DIR)/linkspace $(1)/usr/bin/linkspace
$(INSTALL_DATA) $(PKG_BUILD_DIR)/dependency.json $(1)/usr/share/linkspace/dependency.json
endef
$(eval $(call BuildPackage,linkspace))
+3 -3
View File
@@ -1,3 +1,3 @@
# Local candidate; not publicly published.
LINKSPACE_HASH_x86_64:=b6f2de26c0e2d146440486377036bfb9385d009def4ace01d3a2f39be4c96ab3
LINKSPACE_HASH_aarch64:=3edbba641ac9145f6c8f2da15ebf14d6bfe4e6d0f389e5f1a894bdc8b18ddadb
# GitHub release: linkspace-runtime-v0.3.1
LINKSPACE_HASH_x86_64:=608fe97aff8ecf8d115ac562777a07a65ac4671920e0cb8541bcaca212cac8ec
LINKSPACE_HASH_aarch64:=6de36c52125c33a34497acb6742b98b4541628db76f879b4ba354b4752e8b0a4
+1 -1
View File
@@ -1,2 +1,2 @@
18b646c37aee3bb27acc61fefc73fa6c19a7fc05
2587ea8d53bf4dddec5c7a77a9ae5572bdc7d1d2
e192c5983e50169ed984d48b094798869a0a780b
+5 -4
View File
@@ -3,12 +3,13 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Language: sv\n"
"Content-Transfer-Encoding: 8bit\n"
"Last-Translator: Daniel Nylander <yeagersthlm@gmail.com>\n"
"Last-Translator: Kristoffer Grundström "
"<umeaboy@users.noreply.hosted.weblate.org>\n"
"Language-Team: Swedish <https://hosted.weblate.org/projects/openwrt/"
"luciapplicationsadguardhome/sv/>\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"PO-Revision-Date: 2026-09-16 17:45+0000\n"
"X-Generator: Weblate 2026.10.dev0\n"
"PO-Revision-Date: 2026-11-16 06:43+0000\n"
"X-Generator: Weblate 2026.12.dev0\n"
#: applications/luci-app-adguardhome/htdocs/luci-static/resources/view/adguardhome/config.js:244
msgid ""
@@ -58,7 +59,7 @@ msgstr ""
#: applications/luci-app-adguardhome/htdocs/luci-static/resources/view/adguardhome/config.js:129
msgid "General Settings"
msgstr "Allmänna inställningar"
msgstr "Generella inställningar"
#: applications/luci-app-adguardhome/htdocs/luci-static/resources/view/adguardhome/config.js:138
msgid ""
+9
View File
@@ -0,0 +1,9 @@
out/
.DS_Store
# The daemon and the panel are fetched from their releases, never committed.
dae/assets/
doona/assets/
# Review reports and other local notes stay on this machine.
docs/
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
-15
View File
@@ -1,15 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
LUCI_TITLE:=LuCI app for dae
LUCI_DEPENDS:=+dae +dae-geoip +dae-geosite
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
+278
View File
@@ -0,0 +1,278 @@
# luci-app-dae
dae 内核的 OpenWrt / ImmortalWrt 软件包与 LuCI 页面。面板(doona)的源码在
[szwjp/doona](https://github.com/szwjp/doona),但**它的包在这里构建**:本仓库的发布从
doona 的发布归档重新打包,三个包(引擎、面板、LuCI 页面)同一条发布、同一组版本。
仓库产出五个包:
| 包 | 内容 |
|---|---|
| `dae` | 守护进程,来自 [szwjp/dae](https://github.com/szwjp/dae) 的发布二进制(带 native HTTP 控制面),加上 OpenWrt 侧的 init/UCI/配置模板与手动 Geo 数据更新脚本。 |
| `luci-app-dae` | LuCI 入口页与服务后端(rpcd):状态、启停、API 密钥、打开面板、手动更新 Geo 数据。依赖 `dae` 与 `doona`。 |
| `luci-i18n-dae-zh-cn` / `luci-i18n-dae-zh-tw` | LuCI 页面的简体 / 繁体中文翻译。 |
| `doona` | 面板本体:把 szwjp/doona 发布的归档(摘要固定在 `doona/digests.txt`)装到 `/usr/share/doona`。字体归档不在本仓库打包。 |
面板由 dae 自己托管:dae 把 `/usr/share/doona` 挂在 `/ui/`,API 仍要 Token。
## 安装
### 系统要求
需要带 **apk v3** 的系统,例如 ImmortalWrt 25.12 及更新版本;仍用 opkg 的
OpenWrt 24.10 及更早版本装不上这些包。内核需要带 BTF(见「架构」一节)。
```sh
apk --version # 需要 apk-tools 3.x
```
### 下载并安装
apk v3 的 `apk add` 只认本地文件,不接受 URL,所以先把包下载下来再装。
`luci-app-dae` 依赖 `doona`,**三个文件要在同一条命令里**交给 apk。三个包全部由本仓库
的发布产出——面板由本仓库从 szwjp/doona 的发布归档重新打包(版本与摘要固定在
`doona/digests.txt`),所以不需要再去另一个仓库挑版本:
```sh
cd /tmp
# 引擎:按设备架构选一个
wget -O dae.apk \
https://github.com/szwjp/luci-app-dae/releases/latest/download/dae-2.1.1-r15-x86_64.apk
# 面板
wget -O doona.apk \
https://github.com/szwjp/luci-app-dae/releases/latest/download/doona-0.1.0-r18.apk
# LuCI 页面
wget -O luci-app-dae.apk \
https://github.com/szwjp/luci-app-dae/releases/latest/download/luci-app-dae-2026.11.14-r8.apk
apk add --allow-untrusted ./dae.apk ./doona.apk ./luci-app-dae.apk
```
从旧版本升级时,`doona` 包会被同样包名的本仓库构建替换;面板文件仍装在
`/usr/share/doona`,dae 的 `ui` 设置不用改。
守护进程按架构分发:
| 设备架构 | 包 |
|---|---|
| x86_64 | `dae-<ver>-x86_64.apk` |
| arm64 | `dae-<ver>-aarch64_generic.apk` |
| riscv64 | `dae-<ver>-riscv64_generic.apk` |
可选包:
```sh
# LuCI 中文翻译,界面语言随浏览器 Accept-Language 走
apk add --allow-untrusted ./luci-i18n-dae-zh-cn-<ver>.apk
```
面板不带字体归档(Noto Sans TC/SC),缺少时回退系统字体。需要自带字体时,仍可从
szwjp/doona 的发布里装 `doona-fonts-<ver>.apk`。
### 启用服务
服务**默认禁用**。先按设备改好配置再启用:`/etc/dae/config.dae` 是入口文件,
模块放在 `/etc/dae/config.d/`,LAN/WAN 接口在 `/etc/dae/config.d/global.dae` 里指定。
```sh
uci set dae.main.enabled=1
uci commit dae
/etc/init.d/dae start
```
也可以直接在 LuCI 页面上点「启动」,它会一并把 `enabled` 置为 1、设为开机自启并
启动服务。要关掉开机自启而不停服务,用 *系统 → 启动项* 里的开关(或
`/etc/init.d/dae disable`)。
API 监听地址与密钥放在 UCI 里,不写进配置文件。首次成功启动时服务会自动生成一个
密钥并写回:
```sh
uci get dae.main.api_secret
```
注意:**密钥只在服务真正启动时生成**。`enabled=0` 时启动会被拒绝,也就不会生成。
| UCI 选项 | 默认值 | 含义 |
|---|---|---|
| `enabled` | `0` | 是否启用服务 |
| `config_file` | `/etc/dae/config.dae` | 运行的配置文件 |
| `api_listen` | `0.0.0.0:9527` | native API 监听地址 |
| `api_secret` | 首次启动自动生成 | API 的 Bearer 令牌 |
| `api_write` | `1` | 允许面板写配置。默认打开,装完面板即可用;页面「服务」标签上有同名开关,改完会自动重启服务 |
| `lan_interface` | 空 | 覆盖 LAN 接口名,默认从 `config.d/global.dae` 读取 |
面板访问地址也可以直接在 LuCI 页面上改:页面的「面板访问地址」一行填好后点「确定」,会立即保存并重启服务;
新地址起不来时会自动恢复旧地址并重启,不会把面板留在不可达的状态。等价的 UCI 写法:
```sh
uci set dae.main.api_listen='192.168.1.1:9527'
uci set dae.main.api_write='1'
uci commit dae
/etc/init.d/dae restart
```
`api_listen` 必须是**数值地址加端口**(`0.0.0.0:9527`、`192.168.1.1:9527`)。
`localhost` 会被改写成 `127.0.0.1`,其它主机名不接受——dae 自己要求数值地址。
LuCI 页面显示和编辑的是**面板访问地址**(如 `http://192.168.1.1:9527/ui/`);`api_listen` 是其背后的
bind 地址,普通使用不需要关心。面板由 dae 托管时,doona 的后端网址固定为当前页面地址,随它一起变化。
### 安全:API 监听与明文 HTTP
`api_listen` 默认是 `0.0.0.0:9527`,dae 的 native API 与面板都是**明文 HTTP**:
`api_secret` 和面板使用的 Bearer 令牌在局域网里明文传输,浏览器还会把它存下来。
默认保留 `0.0.0.0` 是为了装完就能从 LAN 打开面板,代价是:
* **密钥等同于 dae 的控制权。** `api_write=1`(默认)时,拿到密钥的人可以改分流配置。
只想要只读面板就关掉「面板写入」:`uci set dae.main.api_write='0'`。
* OpenWrt 默认防火墙拒绝 WAN 入站,所以暴露面主要是 LAN。
* 只在本机用面板时,把监听改成回环(本机浏览器还需要 SSH 端口转发):
`uci set dae.main.api_listen='127.0.0.1:9527'`。
* 需要 LAN 内多台设备访问时,建议监听 LAN 地址并用 HTTPS 反代,不要把 9527 直接放到公网。
## 面板
* LuCI 入口:*服务 → dae*。页面有两个标签:
- **服务**:运行状态、开机自启状态、启动/停止/重启、面板访问地址(可编辑并立即生效)、API 密钥(显示/复制)、打开面板;
- **Geo 数据**:两个数据文件的文件名/大小/修改时间,手动更新与进度日志。
* 直接访问:`http://<路由器地址>:9527/ui/`。
* 面板首次打开时会要求填写密钥,之后由浏览器记住;后端地址固定为当前页面地址。密钥也可以
`uci get dae.main.api_secret` 读取。
* 面板的「出站模式」(规则/直连/全局)写在含 `routing` 段的文件里,也就是
`config.d/routing.dae`;入口文件 `config.dae` 只读,面板不会去改它。
* 面板能不能改配置取决于 `api_write`,**默认是开的**。关掉后 doona 会把整个配置、
节点、组与规则显示为只读(「配置为只读」),只能在面板里看。开关就在页面的
**面板写入** 一行:切换后服务会重启一次,面板需要刷新页面才能看到新的写入状态。来源是 UCI 的
`dae.main.api_write`,由 init 脚本写进 `/etc/dae/api.dae`,所以别直接改那个文件
——每次启动都会被 UCI 的值覆盖。
菜单对任何已登录的 LuCI 用户可见,实际能做什么由 rpcd ACL 决定:只授
`luci-app-dae-read` 的账号只能看状态与 Geo 信息,`luci-app-dae-admin` 才能启停、
更新 Geo 数据、读取密钥。
LuCI 页面通过 rpcd 的 exec 后端读取状态。软件包安装后会自动 reload rpcd;
如果页面报"读取 dae 服务状态失败",执行 `/etc/init.d/rpcd reload` 即可。
### 启动项页面
服务在 LuCI 的*系统 → 启动项*里以 `99 dae` 出现,页面上的启用/禁用按钮就是
开机自启开关(LuCI 页面本身不再放这个开关,避免两处状态源)。
「服务」标签上的「开机自启 / 不自启」徽标读的就是 `S99dae` 这个启动链接,
和上面的开关保持同一状态源;它不影响已经启动的服务。
rpcd 读取 init 脚本时只看开头若干行里的 `USE_PROCD`、`START`、`STOP`,
所以这三行必须留在脚本的前 11 行内。
## Geo 数据
规则里的 `geosite:` 与 `geoip:` 用到的数据文件是 `geoip.dat` 与 `geosite.dat`,
位于 `/usr/share/v2ray`(`v2ray-geoip` / `v2ray-geosite` 两个包提供)。dae 只在
启动时读取它们,所以更新后要重启 dae。
更新是**手动**的:LuCI 页面的「Geo 数据」标签点「立即更新」,或命令行:
```sh
/usr/bin/dae-geo-update
```
脚本先解析上游 `release` 分支到具体 commit,再按 commit 取两个文件和它们的
`.sha256sum`,保证两者来自同一快照:
```
https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@<commit>/geoip.dat
https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@<commit>/geosite.dat
```
行为要点:
* 下载带 Range 头(实测普通 GET 只有 16KB/s,显式 Range 是 MB/s 级);中断后
下一轮用 `curl -C -` 续传。
* 完整性靠上游同目录的 `<file>.sha256sum` 判定——CDN 的 `content-length` 和
`content-range` 不可信。校验不过会丢掉重下,最多三轮;仍不过就放弃本次更新、
保留旧文件。只有上游没提供 sha256 时,才在一次完整传输之后按大小和文件头放行。
* 换文件是先在目标目录写临时文件再改名,掉电不会留下半个文件。之后重启 dae;
没起来就只把本次换过的文件放回去再重启一次。
* 上一版文件备份在 `/etc/dae/geo-backup/`。
* 日志在 `/var/log/dae-geo-update.log`,同时进 syslog(`logread | grep dae-geo-update`)。
`/var` 是 tmpfs,重启后日志不保留。
* 进度写在 `/var/run/dae-geo-update.state`,LuCI 页面靠它显示「更新中/成功/失败」。
* 这两个文件归 apk 包所有,`apk upgrade v2ray-geoip v2ray-geosite` 会用 feed
里的版本覆盖它们;下一次手动更新会装回更新的版本。
## ICMP 重定向
dae 拒绝挂到会发送 ICMP 重定向的接口上,重定向会和 dae 装的规则打架。启动
脚本会在 dae 运行期间把 `all` 与 LAN 接口的 `send_redirects` 置 0,停止时按启动
前的值恢复,所以不用手工改 sysctl。LAN 接口名取自 UCI 的 `lan_interface`,没有
设置时从 `config.d/global.dae` 里读。
## 架构
`dae` 包发布的是预编译二进制,所以每个架构一个包:x86_64、arm64、riscv64。
二进制来自 [szwjp/dae](https://github.com/szwjp/dae) 的发布产物,CI 取下来校验
摘要后重新打包,不重复编译。LuCI 包、翻译包与面板包都是纯静态构建,各架构通用。
riscv64 的二进制按 RISC-V 2023 profile(rva23u64)构建,若设备内核太老跑不起来,
需要换用上游的其它 profile 或自行编译。
eBPF 程序需要内核带 BTF。ImmortalWrt 与 OpenWrt 24.10+ 的内核自带
(`/sys/kernel/btf/vmlinux`);更老的内核需要先装 `vmlinux-btf` 包。
### 接口配置
`/etc/dae/config.d/global.dae` 里的两个接口按设备形态填:
* `lan_interface`:客户端所在的网桥,OpenWrt 默认是 `br-lan`。
* `wan_interface`:出方向流量离开的网卡。默认写 `auto`,由 dae 按默认路由解析;
**单网口设备**(唯一那个口就是 LAN 口,没有 WAN 口)要把它留空。
开机时 dae 会先等默认路由出现(最多 30 秒)再启动,避免 PPPoE 还没拨上时就挂住
LAN;`wan_interface` 留空的单网口设备不等待。
## 构建
软件包用 `apk-tools` 直接打包,不走 OpenWrt SDK:`.github/build-pkg.sh` 组装
staging 目录,`apk mkpkg` 写出容器格式。各包的 `Makefile` 只是这个脚本读取的
元数据,没有 `include luci.mk`,不能直接放进 OpenWrt 的 `package/` 目录参与官方构建。
守护进程二进制**不在本仓库里**,构建前从引擎发布取。`dae/digests.txt` 固定了三个
架构归档的 sha256,构建会拒绝不匹配的归档;升级引擎时该文件里的 `tag` 行和
`.github/workflows/build.yml` 的 `DAE_BINARY_TAG` 必须一起改:
```sh
DAE_TAG=v2026.11.14-nativeapi-r15 # 以 dae/digests.txt 的 tag 行为准
curl -fsSL -o dae.tar.xz \
"https://github.com/szwjp/dae/releases/download/$DAE_TAG/dae-linux-x86_64.tar.xz"
tar -xJf dae.tar.xz
mkdir -p dae/assets/x86_64
install -m0755 usr/bin/dae dae/assets/x86_64/dae
```
然后打包(`PKG_ASSET_DIR` 指向取下来的那一份):
```sh
PKG_ASSET_DIR=assets/x86_64 PKG_ARCH_OVERRIDE=x86_64 \
fakeroot bash .github/build-pkg.sh dae
fakeroot bash .github/build-pkg.sh luci-app-dae
fakeroot bash .github/build-pkg.sh doona # 先取面板归档到 doona/assets
```
需要 `apk` (apk-tools v3) 与 `po2lmo`(翻译包);CI 里两者都编译好后使用。
面板从 [szwjp/doona](https://github.com/szwjp/doona) 的发布归档打包:`doona/digests.txt`
固定发布 tag 与该归档的 sha256,CI 校验后解到 `doona/assets/`,再由 `build-pkg.sh doona`
装到 `/usr/share/doona`。面板界面本身仍在上游仓库开发。
包里的文件归 root。在 macOS 上本地打包时没有 fakeroot,`chown` 会失败,包会带上
构建者的 uid(安装后显示为 nobody);构建脚本会对此告警。正式出包走 CI(Linux +
fakeroot),或者手动在 Linux 上跑。
## 许可
* `dae`:AGPL-3.0-only。本仓库分发的二进制来自 `szwjp/dae` 的发布,对应源码就是
该发布 tag 的源码树。
* `luci-app-dae`:GPL-3.0-only。
* `doona`:GPL-3.0-only,许可证与第三方声明随包安装在 `/usr/share/doc/doona/`。
AGPL 与 GPL 兼容。各包是独立的程序,通过 HTTP 通信。
+49
View File
@@ -0,0 +1,49 @@
#
# Package metadata for the dae engine (eBPF transparent proxy) with the native
# HTTP control plane.
#
# The binary under assets/ is a release archive of the szwjp/dae fork, which
# carries the native API. Nothing is downloaded or compiled while packaging:
# .github/build-pkg.sh reads this Makefile and stages the files under root/
# plus the binary under assets/.
#
# The service is disabled by default. Enable it in /etc/config/dae, then adapt
# /etc/dae/config.dae to the device.
#
# This file is free software, licensed under the GNU General Public License v3
# or later.
PKG_NAME:=dae
PKG_VERSION:=2.1.1
PKG_RELEASE:=15
PKG_LICENSE:=AGPL-3.0-only
PKG_MAINTAINER:=szwjp <szwjp@users.noreply.github.com>
PKG_URL:=https://github.com/szwjp/luci-app-dae
# The daemon is a static Go binary, so it needs no libraries at runtime. Its
# eBPF datapath attaches TC programs to the LAN/WAN interfaces and creates a
# veth pair plus the daens namespace, hence the kernel modules below; its
# CO-RE programs need the kernel's BTF. ImmortalWrt and OpenWrt 24.10+ ship a
# kernel with BTF built in (/sys/kernel/btf/vmlinux), so no vmlinux-btf package
# is needed here; a kernel without it needs one before dae can start.
# The geo packages ship the dat files dae looks up as geoip:/geosite:.
# The manual geo update (usr/bin/dae-geo-update, run from the LuCI page)
# fetches them over https and verifies them against the sha256 the upstream
# publishes, so it needs curl.
PKG_DEPENDS:=+ca-bundle +kmod-sched-core +kmod-sched-bpf +kmod-veth +v2ray-geoip +v2ray-geosite +curl
PKG_DESCRIPTION:=dae is an eBPF-based transparent proxy for Linux. This build carries the native HTTP control plane, so a web panel can drive it over the daeuniverse/api-standardize contract.
PKG_ARCH:=x86_64
# The prebuilt daemon, staged outside root/ because it goes to /usr/bin. The
# path is architecture neutral: the CI puts the daemon of the architecture it
# builds into assets/<arch>/dae and points the packaging script at that
# directory, so the same Makefile serves every architecture. The binary itself
# is not kept in this repository: a copy that drifts from the engine release
# would be packaged silently, so the build fails instead of shipping it.
PKG_ASSETS:=assets/dae=usr/bin/dae
# The files that survive an upgrade untouched.
PKG_CONFFILES:=/etc/config/dae /etc/dae/config.dae /etc/dae/config.d/global.dae /etc/dae/config.d/routing.dae /etc/dae/config.d/dns.dae /etc/dae/config.d/node.dae /etc/dae/config.d/group.dae /etc/dae/config.d/subscription.dae
+14
View File
@@ -0,0 +1,14 @@
# sha256 of the daemon archives published by szwjp/dae.
#
# The release publishes a .dgst next to every archive, but a digest that ships
# beside the archive only proves the two agree: if a release is replaced, both
# are replaced. These values live in this repository instead, and the build
# refuses an archive that does not match one of them.
#
# Bump this file and DAE_BINARY_TAG in .github/workflows/build.yml in the same
# commit. The build fails when the tag here and the workflow's tag differ.
tag v2026.11.14-nativeapi-r15
e8b46936fdc6c50d4de4a193f63e0e62ea82bda38ba0855a6ed49d4dc4ddad07 dae-linux-x86_64.tar.xz
ea6aae4bd870a240bf69f54d2ad18f740c1f3798db82e1629697f5e2a1eb5c34 dae-linux-arm64.tar.xz
9dcb596269ec56a7e7c3beff4097df6fd89aaa39f655db3c26f4a50244026be3 dae-linux-riscv64_rva23u64.tar.xz
+16
View File
@@ -0,0 +1,16 @@
config dae 'main'
option enabled '0'
option config_file '/etc/dae/config.dae'
option api_listen '0.0.0.0:9527'
# The host the panel is opened at, kept for display; empty falls back to
# the LAN address. dae still binds api_listen.
option panel_host ''
option api_secret ''
# Let the doona panel edit the configuration. Without it every
# configuration page of the panel is read-only, which reads as a broken
# install; the panel still needs the API secret, and the switch can be
# turned off in the LuCI page (or here) at any time.
option api_write '1'
# The LAN interface dae attaches to. Empty means the interface is taken
# from the dae configuration file (config.d/global.dae).
option lan_interface ''
@@ -0,0 +1,17 @@
dns {
upstream {
alidns: 'udp://dns.alidns.com:53'
googledns: 'tcp+udp://dns.google:53'
}
# The panel adds the first DNS rule inside these blocks. dae requires both
# lists to name a fallback, so they are written here; the panel inserts a rule
# before the closing brace of the list it edits.
routing {
request {
fallback: asis
}
response {
fallback: accept
}
}
}
@@ -0,0 +1,13 @@
global {
# The interface the LAN clients are on. br-lan is the OpenWrt default; a
# device that names its bridge differently needs this changed.
lan_interface: br-lan
# The interface the outbound traffic leaves through. "auto" lets dae resolve
# it from the default route, so the setting fits a router with any number
# of ports. A single-port device, whose only port is the LAN port, has no
# WAN interface at all: leave this empty there.
wan_interface: auto
log_level: info
dial_mode: domain
sniffing_timeout: 30ms
}
@@ -0,0 +1,2 @@
group {
}
@@ -0,0 +1,2 @@
node {
}
@@ -0,0 +1,6 @@
routing {
dip(geoip:private) -> direct
dip(224.0.0.0/3, 'ff00::/8') -> direct
domain(geosite:cn) -> direct
fallback: direct
}
@@ -0,0 +1,2 @@
subscription {
}
+8
View File
@@ -0,0 +1,8 @@
# The entry file. It only holds one include block; the modules live in
# config.d/ and the api section is written by the init script from UCI.
#
# The panel writes through the native API only in this layout, so keep it.
include {
config.d/*.dae
api.dae
}
+447
View File
@@ -0,0 +1,447 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
STOP=10
# procd service for dae with the native HTTP control plane.
#
# The service reads /etc/config/dae (UCI) and writes the api section into its
# own file, /etc/dae/api.dae, so the listener address, the secret and the
# panel path stay in UCI while the rest of the configuration stays in dae's own
# format under /etc/dae.
#
# The default layout is the managed one: the entry file /etc/dae/config.dae
# only holds one include block, and the modules live in /etc/dae/config.d/.
# That layout is what dae's config editor needs to write through the API.
#
# USE_PROCD, START and STOP have to stay within the first eleven lines of
# this file. rpcd builds the list of init scripts that the LuCI page
# "Startup" shows from those three values, and it reads them from the head of
# the script only: a script whose START= sits further down is left out of
# that list, and its autostart state is reported as off.
. /lib/functions.sh
CONFIG=dae
PROG=/usr/bin/dae
# Set when start_service fails before procd is handed the instance.
START_FAILED=0
# The panel is shipped by the doona package, which installs it here. dae serves
# it from its own listener under /ui/.
UI_PATH=/usr/share/doona
API_FILE=/etc/dae/api.dae
REDIRECTS_STATE=/var/run/dae-redirects.state
# The dae configuration may quote an interface name and may name more than one,
# separated by commas. The redirect workaround and the boot wait each need a
# single device, so the first entry is used and the quoting is stripped.
first_interface() {
local value="$1"
value="${value%%,*}"
value="${value#\"}"
value="${value%\"}"
value="${value#\'}"
value="${value%\'}"
printf '%s\n' "$value"
}
# The interface names live in dae's own configuration under /etc/dae, next to
# the UCI options. The UCI option wins, for a device whose bridge is named
# differently. Both places are read the same way, so a quoted or comma
# separated value does not come out as part of the device name.
config_interface() {
local option="$1" config_file interface
config_get interface main "$option" ""
if [ -z "$interface" ]; then
config_get config_file main config_file "/etc/dae/config.dae"
interface="$(sed -n "s/^[[:space:]]*${option}:[[:space:]]*\"\{0,1\}\([^\"[:space:],#]*\).*/\1/p" \
"$(dirname "$config_file")"/config.d/*.dae "$config_file" 2>/dev/null | head -n 1)"
fi
first_interface "$interface"
}
# The interface dae attaches to is named in its own configuration file, so the
# redirect workaround has to look at the same place.
lan_interface() {
config_interface lan_interface
}
# dae refuses to attach to an interface that sends ICMP redirects: the
# redirects would fight with the rules dae installs. The kernel keeps the
# setting in "all" as well as in the interface itself, and the effective
# value is the larger of the two, so both are turned off while dae runs and
# restored when it stops.
redirects_disable() {
local device="$1" all old_all old_device
[ -n "$device" ] || return 0
[ -d "/proc/sys/net/ipv4/conf/$device" ] || return 0
all="$(cat /proc/sys/net/ipv4/conf/all/send_redirects 2>/dev/null)"
old_all="$all"
old_device="$(cat "/proc/sys/net/ipv4/conf/$device/send_redirects" 2>/dev/null)"
# The original values are written down once, on the first start: a
# restart must not overwrite them with the values the previous run
# left behind, or the original setting is lost for good.
if [ ! -f "$REDIRECTS_STATE" ]; then
{
echo "all=$old_all"
echo "$device=$old_device"
} > "$REDIRECTS_STATE"
fi
[ "$all" = "1" ] && echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
[ "$old_device" = "1" ] && echo 0 > "/proc/sys/net/ipv4/conf/$device/send_redirects"
return 0
}
redirects_restore() {
local key value
[ -f "$REDIRECTS_STATE" ] || return 0
while IFS='=' read -r key value; do
case "$key" in
all)
[ -n "$value" ] && echo "$value" > /proc/sys/net/ipv4/conf/all/send_redirects
;;
*)
[ -n "$value" ] && [ -d "/proc/sys/net/ipv4/conf/$key" ] && \
echo "$value" > "/proc/sys/net/ipv4/conf/$key/send_redirects"
;;
esac
done < "$REDIRECTS_STATE"
rm -f "$REDIRECTS_STATE"
return 0
}
start_service() {
local enabled config_file api_listen api_secret api_write device
config_load "$CONFIG"
config_get_bool enabled main enabled 0
if [ "$enabled" -ne "1" ]; then
# The daemon will not run, so whatever a killed instance left
# behind has to be put back: a stale state file would otherwise
# keep ICMP redirects switched off for the whole system.
redirects_restore
return 1
fi
config_get config_file main config_file "/etc/dae/config.dae"
config_get api_listen main api_listen "0.0.0.0:9527"
config_get api_secret main api_secret ""
config_get api_write main api_write "0"
write_api_section "$api_listen" "$api_secret" "$api_write" || {
# service_started reports this below: rc.common loses the return
# value of start_service, so the failure has to survive in a variable.
START_FAILED=1
return 1
}
device="$(lan_interface)"
redirects_disable "$device"
procd_open_instance dae
procd_set_param command "$PROG" run -c "$config_file"
# The geo data files live in /usr/share/v2ray, installed by the geo
# packages; point dae at them.
procd_set_param env DAE_LOCATION_ASSET=/usr/share/v2ray
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param respawn 3600 5 5
procd_set_param limits nofile="1048576 1048576"
procd_close_instance
}
# rc.common turns the return value of its start() into the exit code of the
# init script, and the one from start_service is lost on the way: the procd
# wrapper closes the service object afterwards and that close is the last
# command. A start that did not bring the daemon up would then leave exit code
# 0 behind, which reads as success to every caller. rc.common calls this hook
# right after start_service and returns its result, so the real outcome is
# reported from here.
service_started() {
local enabled
config_load "$CONFIG"
config_get_bool enabled main enabled 0
[ "$enabled" -eq "1" ] || return 1
# A start that could not write /etc/dae/api.dae never reached procd, and
# the daemon must not be reported as running.
[ "$START_FAILED" = "0" ] || return 1
return 0
}
# dae parses the listener address itself and wants a numeric IP: a host name
# makes it refuse to start. "localhost" is the one name worth accepting, so it
# is mapped to the loopback address here.
normalize_listen() {
local listen="$1" host port
case "$listen" in
*:*)
host="${listen%:*}"
port="${listen##*:}"
;;
*)
echo "$listen"
return
;;
esac
case "$host" in
localhost) host="127.0.0.1" ;;
esac
echo "$host:$port"
}
# The listener address has to survive dae's own check: a numeric address and a
# port in 1..65535. A wrong address is reported here, instead of leaving dae
# to fail with a message nobody reads.
check_listen() {
local listen="$1" host port bracketed=0
host="${listen%:*}"
port="${listen##*:}"
if [ "$host" = "$listen" ]; then
echo "the address carries no port"
return 1
fi
case "$port" in
''|*[!0-9]*)
echo "the port is not a number"
return 1
;;
esac
if [ "$port" -lt 1 ] || [ "$port" -gt 65535 ]; then
echo "the port is out of range"
return 1
fi
# dae splits "host:port" itself, so an IPv6 address has to be bracketed:
# "[::1]:9527" is one address, "::1:9527" is seven colons it cannot read.
case "$host" in
\[*)
bracketed=1
host="${host#\[}"
host="${host%%\]*}"
;;
esac
case "$host" in
'')
echo "the address has no host"
return 1
;;
*:*)
if [ "$bracketed" -ne 1 ]; then
echo "an IPv6 listener needs brackets, as in [::1]:9527"
return 1
fi
case "$host" in
*[!0-9a-fA-F:]*)
echo "the host is not a numeric address"
return 1
;;
esac
;;
*)
case "$host" in
*[!0-9.]*)
echo "the host is not a numeric address"
return 1
;;
esac
;;
esac
return 0
}
# The listener needs a secret whatever it is bound to. dae refuses to start
# without one unless the listener is loopback and anonymous access is allowed
# explicitly, and the panel authenticates either way. A secret that is missing
# is generated once and written back, so the panel works right after the first
# start.
# These values end up inside quoted strings in dae's configuration. They are
# only ever set by root, but a value with a quote or a newline would still
# corrupt the file it is written to, so the character set is checked instead
# of trusting the caller.
valid_secret() {
case "$1" in
''|*[!A-Za-z0-9._+/-]*) return 1 ;;
esac
return 0
}
write_api_section() {
local listen secret write ui reason content
listen="$1"; secret="$2"; write="$3"; ui="$UI_PATH"
listen="$(normalize_listen "$listen")"
if ! reason="$(check_listen "$listen")"; then
logger -t dae "invalid api listener '$listen': $reason"
return 1
fi
if [ -z "$secret" ]; then
# hex from /dev/urandom: a minimal busybox has neither base64
# nor od, and hex needs no quoting in the configuration file.
secret="$(head -c 32 /dev/urandom | md5sum | cut -d' ' -f1)"
if [ -z "$secret" ]; then
logger -t dae "no api secret and no random source; set dae.main.api_secret by hand"
return 1
fi
# The secret has to survive a reboot, or the next start generates
# a different one and every panel session and saved secret stops
# working. The api file alone is not enough: it is rewritten on
# every start. A write that fails is fatal, because a daemon that
# comes up with a secret nobody can read is useless.
if ! uci -q set "$CONFIG.main.api_secret=$secret" || ! uci -q commit "$CONFIG"; then
logger -t dae "cannot save the generated api secret to $CONFIG; set $CONFIG.main.api_secret by hand"
return 1
fi
logger -t dae "generated an api secret; read it with: uci show $CONFIG"
fi
# The secret and the panel path end up inside quoted strings in dae's
# configuration; a stray quote or newline would break the file, so they
# are checked before anything is written.
if ! valid_secret "$secret"; then
logger -t dae "invalid api secret (allowed: A-Za-z0-9 . _ + / -), refusing to start"
return 1
fi
content="$(
echo "api {"
echo " enabled: true"
echo " listen: '$listen'"
echo " secret: '$secret'"
[ "$write" = "1" ] && echo " config_write: true"
# The panel is a separate package. Point at it only when it is there.
if [ -n "$ui" ] && [ -d "$ui" ]; then
echo " ui: '$ui'"
fi
echo "}"
)"
# The file is rewritten on every start, but the overlay does not need a
# write when nothing changed: the secret, the listener and the switch are
# what it holds, and none of them moves on a plain restart.
mkdir -p "$(dirname "$API_FILE")"
if [ ! -f "$API_FILE" ] || [ "$content" != "$(cat "$API_FILE")" ]; then
# Written under umask 077, so the file that holds the secret never
# exists with a wider mode, not even for a moment.
( umask 077; printf '%s\n' "$content" > "$API_FILE.new" ) || {
rm -f "$API_FILE.new"
logger -t dae "cannot write $API_FILE"
return 1
}
mv -f "$API_FILE.new" "$API_FILE" || {
rm -f "$API_FILE.new"
logger -t dae "cannot replace $API_FILE"
return 1
}
chmod 600 "$API_FILE"
fi
# The managed layout needs the entry file to include the api file.
if [ -f /etc/dae/config.dae ] && ! grep -q "api.dae" /etc/dae/config.dae; then
logger -t dae "warning: /etc/dae/config.dae does not include api.dae, so the native API stays off"
fi
}
stop_service() {
# The api file is left in place. Deleting it only to write it again on the
# next start costs an overlay write and a delete per restart, and it buys
# nothing: the secret it holds is also in /etc/config/dae, and the file is
# 0600 either way. A start still rewrites it when the values changed.
redirects_restore
}
# A daemon that was killed outright never runs stop_service, so the state file
# and the disabled redirects it left behind outlive it. procd restarts the
# daemon and start_service writes the file again with the original values, so
# the window is short; but the window is not always closed. When the daemon
# stays down, the redirects stay off for the whole system. boot() runs before
# anything else at startup, so this is where the leftovers are cleared: with no
# running daemon nothing needs them switched off.
# S99 runs before the WAN is up: pppd brings pppoe-wan up a few seconds later,
# and dae attaches its eBPF programs to the interfaces the moment it starts.
# Started that early it hooks br-lan while the default route does not exist yet,
# and every packet it hands back to the LAN fails with "network is unreachable" —
# the whole LAN loses its internet, not just the proxied part. Observed on the
# first reboot after the upgrade: dae at 08:11:12, pppoe-wan at 08:11:20, and
# from 08:11:42 on the LAN had no connectivity at all until dae was stopped.
#
# So at boot the daemon is only brought up once the uplink is usable: the
# interface named in the configuration has to exist, and the default route has
# to be there. The second half matters as much as the first: pppd creates
# pppoe-wan before the session is established, and with "auto" that route is
# exactly what dae picks. The wait is bounded, because a router whose uplink
# never comes up must still end up with a running dae once the operator fixes
# it by hand.
wan_interface() {
config_interface wan_interface
}
# Whether the kernel has a default route yet. /proc/net/route is read instead
# of "ip route" so the check does not depend on which ip tool the image ships.
uplink_ready() {
awk '$2 == "00000000" { found = 1 } END { exit !found }' /proc/net/route 2>/dev/null
}
# Waits, with a bound, for the uplink to be usable: the default route has to
# be there, and a named device has to exist as well. "auto" (and any other
# name) means dae needs an uplink; an empty value means a device without a WAN
# (see the README), where there is nothing to wait for.
wait_uplink() {
local device="$1" tries=30 i=0
while [ "$i" -lt "$tries" ]; do
if uplink_ready && { [ -z "$device" ] || [ -d "/sys/class/net/$device" ]; }; then
return 0
fi
i=$((i + 1))
sleep 1
done
return 1
}
boot() {
local enabled device
config_load "$CONFIG"
config_get_bool enabled main enabled 0
if [ "$enabled" -ne "1" ]; then
redirects_restore
return 0
fi
device="$(wan_interface)"
case "$device" in
'')
# The single-NIC layout: no WAN, so there is no uplink to wait
# for.
;;
auto)
# dae resolves "auto" to the interface of the default route
# itself, so only the route has to be waited for.
wait_uplink "" ;;
*)
wait_uplink "$device" ;;
esac
start "$@"
}
service_triggers() {
procd_add_reload_trigger "$CONFIG"
}
+411
View File
@@ -0,0 +1,411 @@
#!/bin/sh
# dae-geo-update — fetch the newest geoip.dat / geosite.dat for the dae engine
# and restart dae so it picks them up.
#
# Started by the "Update now" button of the LuCI page (its rpcd backend runs
# this script as a background job and polls the state file) and runnable by
# hand with /usr/bin/dae-geo-update. There is no cron entry: the update is
# manual, so a failed download can never take the proxy down unattended.
#
# Source:
# https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@<commit>/geoip.dat
# https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@<commit>/geosite.dat
# The project publishes no tag (a @<tag> URL returns 404), only the moving
# "release" branch, so the branch is resolved to its commit first and the files
# are fetched at that commit. Fetching through the branch is not stable: the
# branch moves, and jsDelivr keeps a large file in its cache for hours while it
# revalidates the small sha256 next to it, so a run inside that window gets the
# previous build and rejects it against the new digest (seen on a live router).
# The commit URL is immutable, so the two files and their sha256 always come
# from one snapshot.
#
# Target: /usr/share/v2ray — the directory the init script points dae at with
# DAE_LOCATION_ASSET. dae reads the files when it starts, and only then.
#
# State: /var/run/dae-geo-update.state holds "state=running|ok|failed", the pid,
# the start and finish times and a message token (updated, up_to_date,
# updated_stopped, download_failed, restart_failed_rollback, rollback_failed).
# The LuCI backend reads it for the progress display; the state lives on the
# tmpfs, so a reboot clears it.
#
# Log: /var/log/dae-geo-update.log, and every line also goes to syslog under the
# dae-geo-update tag. /var is a tmpfs on OpenWrt, so the file does not survive a
# reboot.
#
# Backup: /etc/dae/geo-backup holds a copy of each file taken just before this
# run replaces it. The rollback puts those copies back, so it touches only the
# files this run changed, never a file an earlier run installed.
#
# Download: the request must carry a Range header. Measured on one router, one
# file, one node: a plain GET ran at 16KB/s, an explicit range request at MB/s.
# curl's -C - degrades to a plain GET when the local file does not exist yet, so
# the first attempt always asks for the range explicitly and only a resume of an
# existing partial file uses -C -.
#
# Verification: the sha256 the upstream publishes next to the file is the only
# trustworthy proof that the download is complete and unmodified — the CDN's
# content-length and content-range are not (the range total measured smaller
# than the real file). An unfinished transfer is kept and resumed; a finished
# file that fails the hash is dropped and fetched from scratch, at most three
# rounds. When the upstream publishes no sha256 (or it cannot be fetched), one
# finished transfer is checked against a size range and a first byte of 0x0a,
# which is a protobuf tag and rules out an HTML error page; a retry cannot
# improve that check, so it is not retried.
#
# Rollback: dae cannot load broken geo data — the configuration fails to build
# and the proxy stops. After replacing the files the daemon is restarted and
# checked, and the previous files are put back when it does not come up.
#
# Note: the two files under /usr/share/v2ray are installed by the apk packages
# v2ray-geoip and v2ray-geosite. Upgrading those packages overwrites them with
# the feed versions; the next run of this script puts the newer files back.
set -u
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH
DIR=/usr/share/v2ray
LOGFILE=/var/log/dae-geo-update.log
STATE_FILE=/var/run/dae-geo-update.state
BACKUP_DIR=/etc/dae/geo-backup
WORK=/tmp/dae-geo-update.work
LOCKFILE=/var/lock/dae-geo-update.lock
HOST=cdn.jsdelivr.net
REPO=Loyalsoldier/v2ray-rules-dat
BRANCH=release
STARTED="$(date +%s)"
# Filled by resolve_source() with the commit-pinned or, as a fallback, the
# branch-based base URL.
BASE=
FILES="geosite.dat geoip.dat"
# A floor for the download, not for the files the packages ship. The two are
# different things: v2ray-geosite installs a small geosite.dat (a couple of
# megabytes), while the build this script fetches is ten and more. The floor
# only ever runs on a file this script downloaded, so it can be set for the
# latter without rejecting the former.
MIN_BYTES=5000000
MAX_BYTES=104857600
MAX_ROUNDS=3
FETCH_TIMEOUT=900
START_TIMEOUT=90
log() {
local line
line="$(date '+%F %T') $*"
echo "$line" >> "$LOGFILE" 2>/dev/null
logger -t dae-geo-update "$*" 2>/dev/null
}
# set_state <state> <message> [finished-at]
#
# The file is replaced through a rename so a reader never sees half of it.
# "finished" stays 0 while the run is in progress.
set_state() {
local state="$1" message="$2" finished="${3:-0}"
{
echo "state=$state"
echo "pid=$$"
echo "started=$STARTED"
echo "finished=$finished"
echo "message=$message"
} > "$STATE_FILE.new" 2>/dev/null && mv -f "$STATE_FILE.new" "$STATE_FILE" 2>/dev/null
}
# die <message-token> <log text...>
#
# The token is what the page shows; the log text is for the operator.
die() {
local token="$1"
shift
set_state failed "$token" "$(date +%s)"
log "FATAL: $*"
exit 1
}
# /tmp is a tmpfs on the router, and tens of megabytes in RAM are wasted there
cleanup() {
rm -rf "$WORK" 2>/dev/null
# Files staged next to the target must not outlive an interrupted run:
# they are only renamed into place by a run that got that far.
rm -f "$DIR"/.*.new "$DIR"/.*.restore "$BACKUP_DIR"/.*.bak.new 2>/dev/null
}
trap cleanup EXIT
# A trap that only runs the cleanup does not end the script: dash and ash go
# on with the next command after the handler returns. Exit as well, or a
# cancelled update keeps downloading in the background.
trap 'exit 1' INT TERM
file_hash() {
sha256sum "$1" 2>/dev/null | awk '{print $1}'
}
# Resolve the release branch to the commit it points at and set BASE from it.
# A failed lookup (offline, GitHub rate limit) falls back to the branch: the
# run then keeps the cache race it had before, which is safer than not
# updating at all.
resolve_source() {
local commit
commit="$(curl -fsS --max-time 60 \
"https://api.github.com/repos/$REPO/branches/$BRANCH" 2>/dev/null |
sed -n 's/.*"sha"[[:space:]]*:[[:space:]]*"\([0-9a-f]\{40\}\)".*/\1/p' |
head -n 1)"
case "$commit" in
*[!0-9a-f]*|'') commit="" ;;
esac
if [ -n "$commit" ]; then
BASE="https://$HOST/gh/$REPO@$commit"
log "source: $REPO@$BRANCH is $commit"
else
BASE="https://$HOST/gh/$REPO@$BRANCH"
log "warning: cannot resolve $BRANCH to a commit, fetching the branch (the cache race stays)"
fi
}
# Fetch a file: resume an existing partial one, otherwise ask for the range
# explicitly.
fetch_file() {
local f="$1" url
url="$BASE/$f"
if [ -s "$WORK/$f" ]; then
curl -fsS -C - --connect-timeout 20 --max-time "$FETCH_TIMEOUT" -o "$WORK/$f" "$url" 2>/dev/null
else
curl -fsS -r 0- --connect-timeout 20 --max-time "$FETCH_TIMEOUT" -o "$WORK/$f" "$url" 2>/dev/null
fi
}
# Fetch a file and verify it. Returns 0 when the file is usable.
#
# The transfer and the check are separate outcomes. "curl" returning 0 means
# the file is complete; a non-zero exit means it is not, and whatever arrived
# is kept so the next round can resume it. Only a complete file that fails
# verification is deleted, because resuming it cannot help.
fetch_verified() {
local f="$1" base expected got round complete size magic
base="$BASE"
# The sha256 the upstream publishes is the only trustworthy reference
curl -fsS --max-time 60 -o "$WORK/$f.sha256sum" "$base/$f.sha256sum" 2>/dev/null
expected="$(awk '{print $1}' "$WORK/$f.sha256sum" 2>/dev/null | head -n 1)"
[ -n "$expected" ] || log "$f: no upstream sha256, size and header are the only checks left"
round=1
while [ "$round" -le "$MAX_ROUNDS" ]; do
complete=0
if fetch_file "$f"; then
complete=1
else
log "$f: round $round did not finish, keeping the partial file to resume"
fi
got="$(file_hash "$WORK/$f")"
if [ -n "$expected" ] && [ -n "$got" ] && [ "$got" = "$expected" ]; then
log "$f: sha256 matches upstream ($got)"
return 0
fi
if [ -n "$expected" ]; then
# An unfinished transfer is resumed, not discarded.
[ "$complete" = 1 ] || { round=$((round + 1)); continue; }
log "$f: round $round sha256 mismatch (local ${got:-none}, upstream $expected), fetching again"
# A complete but wrong file is not usable and cannot be resumed.
rm -f "$WORK/$f"
else
if [ "$complete" = 1 ]; then
size="$(wc -c < "$WORK/$f" 2>/dev/null)"
magic="$(hexdump -n 1 -e '1/1 "%02x"' "$WORK/$f" 2>/dev/null)"
if [ "$size" -ge "$MIN_BYTES" ] && [ "$size" -le "$MAX_BYTES" ] && [ "$magic" = "0a" ]; then
log "$f: no upstream sha256, accepted on size ($size) and header"
return 0
fi
log "$f: round $round size or header out of line ($size bytes, first byte '$magic'), fetching again"
rm -f "$WORK/$f"
fi
fi
round=$((round + 1))
done
return 1
}
log "--- start ---"
mkdir -p "$WORK" || die download_failed "cannot create the work directory $WORK"
mkdir -p "$BACKUP_DIR" || die download_failed "cannot create the backup directory $BACKUP_DIR"
# One run at a time.
#
# The work directory is a fixed path, so two runs share it: one overwrites the
# file the other is still downloading and the sha256 of both stops matching.
# The failure looks like a broken upstream rather than like a collision, and
# both runs give up. A lock on the fixed work path is enough: flock is in base,
# and the file descriptor stays open for the whole run.
mkdir -p "$(dirname "$LOCKFILE")" 2>/dev/null
if ! { exec 9>"$LOCKFILE"; } 2>/dev/null; then
die download_failed "cannot create the lock file $LOCKFILE"
fi
if ! flock -n 9; then
# The run that holds the lock owns the state file; this one must not
# overwrite it.
log "skipped: another update is already running"
exit 0
fi
set_state running ""
# The source is pinned once, before the first download: the two files and their
# sha256 have to come from the same snapshot.
resolve_source
# Both files are fetched and verified before either is installed: a failure
# halfway through leaves the running daemon on its old files.
for f in $FILES; do
fetch_verified "$f" || die download_failed "$f: download or verification failed, no file is replaced"
done
# A file that is already the newest one is left alone, so nothing has to be
# restarted for it. The other files are installed in two phases: first every
# new file is copied next to its target, then each copy is renamed into place.
# The work directory is a tmpfs and the target is on flash, so a direct "mv"
# would copy and delete, and a power loss in the middle would leave a
# truncated file where dae reads it. A copy plus a rename on the target
# filesystem cannot leave a partial file behind.
CHANGED=""
for f in $FILES; do
new="$(file_hash "$WORK/$f")"
old="$(file_hash "$DIR/$f")"
if [ -n "$old" ] && [ "$new" = "$old" ]; then
log "$f: already the newest ($new), left alone"
continue
fi
if ! cp -f "$WORK/$f" "$DIR/.$f.new"; then
rm -f "$DIR/.$f.new"
for g in $CHANGED; do rm -f "$DIR/.$g.new"; done
die download_failed "cannot stage $f"
fi
chmod 644 "$DIR/.$f.new"
CHANGED="$CHANGED $f"
done
if [ -z "$CHANGED" ]; then
set_state ok up_to_date "$(date +%s)"
log "OK: both files are already the newest, dae is not restarted"
exit 0
fi
# The backup is what the rollback restores, and it is written the same way: a
# truncated backup would be worse than no backup. Only the files this run
# replaces get a fresh .bak.
for f in $CHANGED; do
[ -f "$DIR/$f" ] || continue
if ! cp -f "$DIR/$f" "$BACKUP_DIR/.$f.bak.new"; then
rm -f "$BACKUP_DIR/.$f.bak.new"
for g in $CHANGED; do rm -f "$DIR/.$g.new"; done
die download_failed "cannot back up $f"
fi
mv -f "$BACKUP_DIR/.$f.bak.new" "$BACKUP_DIR/$f.bak" || die download_failed "cannot save the backup of $f"
done
for f in $CHANGED; do
old="$(file_hash "$DIR/$f")"
new="$(file_hash "$DIR/.$f.new")"
if ! mv -f "$DIR/.$f.new" "$DIR/$f"; then
# This rename failed; earlier iterations may already be in place, so
# put the whole set back instead of leaving a mixed pair.
log "cannot replace $f, restoring the files already replaced"
for g in $CHANGED; do
rm -f "$DIR/.$g.new"
[ -f "$BACKUP_DIR/$g.bak" ] || continue
cp -f "$BACKUP_DIR/$g.bak" "$DIR/.$g.restore" && mv -f "$DIR/.$g.restore" "$DIR/$g"
done
die download_failed "cannot replace $f"
fi
log "$f: replaced ($old -> $new)"
done
# dae reads the geo data when it starts, so a reload does not pick up the new
# files: it has to be restarted.
restart_dae() {
/etc/init.d/dae restart >/dev/null 2>&1
}
# Whether the daemon runs, asked of the init script rather than of ubus.
#
# The ubus object "dae" belongs to luci-app-dae, while this script belongs to
# the dae package. The two are installed separately: with the panel package
# absent or its rpcd backend not loaded, "ubus call dae status" fails and a
# daemon that is running perfectly well would be reported as down. That would
# roll the freshly installed geo data back on every run. The init script is
# always there, so its answer is the one to trust.
dae_running() {
/etc/init.d/dae status 2>/dev/null | grep -q '^running$'
}
# The pid of the running daemon, empty when there is none. procd stops and
# starts asynchronously, so the status word is still "running" for the old
# instance right after a restart: only a different pid proves that the new
# one is up.
dae_pid() {
pidof dae 2>/dev/null | awk '{print $1}'
}
# The service is not running: stopped by hand, disabled, or it failed to
# start. The new files are already installed and are picked up at the next
# start, so there is nothing to restart and nothing to roll back. Restarting
# here would bring up a daemon the operator stopped on purpose.
if ! dae_running; then
set_state ok updated_stopped "$(date +%s)"
log "dae is not running; the new files take effect at the next start"
exit 0
fi
before="$(dae_pid)"
restart_dae
i=0
OK=0
while [ "$i" -lt "$START_TIMEOUT" ]; do
sleep 2
pid="$(dae_pid)"
# A new pid alone is not enough: procd respawns a daemon that dies at
# once, and that instance is not a success either. It also has to report
# running for the moment it is checked.
if [ -n "$pid" ] && [ "$pid" != "$before" ] && dae_running; then
# A pid that is there is not necessarily one that stays: procd
# respawns a daemon that dies at once. The same pid after a short
# settle is the one that counts.
sleep 2
if [ "$(dae_pid)" = "$pid" ] && dae_running; then
OK=1
break
fi
fi
i=$((i + 2))
done
if [ "$OK" = "1" ]; then
set_state ok updated "$(date +%s)"
log "OK: geoip/geosite updated, dae restarted and running"
exit 0
fi
log "dae did not come up, putting back the files this run replaced"
for f in $CHANGED; do
[ -f "$BACKUP_DIR/$f.bak" ] || continue
cp -f "$BACKUP_DIR/$f.bak" "$DIR/.$f.restore" && mv -f "$DIR/.$f.restore" "$DIR/$f"
done
before="$(dae_pid)"
restart_dae
sleep 5
pid="$(dae_pid)"
if [ -n "$pid" ] && [ "$pid" != "$before" ] && dae_running; then
set_state failed restart_failed_rollback "$(date +%s)"
log "rolled back to the previous geo data, dae is running again"
else
set_state failed rollback_failed "$(date +%s)"
log "dae is still not running after the rollback, it needs a human"
fi
log "FAILED"
exit 1
+1
View File
@@ -0,0 +1 @@
../v2ray/geoip.dat
+1
View File
@@ -0,0 +1 @@
../v2ray/geosite.dat
@@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
+32
View File
@@ -0,0 +1,32 @@
#
# Package metadata for doona, the web panel dae serves from its own listener.
#
# doona has its own repository (szwjp/doona) and its own release; this package
# only re-hosts the published archive so the panel ships from the same release
# as the engine and the LuCI page, with no cross-repository version to track.
# The build fetches doona-<ver>.tar.gz, verifies it against digests.txt and
# stages its contents under /usr/share/doona.
#
# This file is free software, licensed under the GNU General Public License v3
# or later.
PKG_NAME:=doona
PKG_VERSION:=0.1.0
# The upstream version is the prerelease 0.1.0-rc.9; this repository packages
# it as 0.1.0-r9, the same number luci-app-dae carries. It sorts after the
# separately published doona 0.1.0_rc8-r1, so an upgrade replaces that package.
PKG_RELEASE:=18
PKG_LICENSE:=GPL-3.0-only
PKG_MAINTAINER:=szwjp <szwjp@users.noreply.github.com>
PKG_URL:=https://github.com/szwjp/doona
PKG_DESCRIPTION:=Static web panel for the dae engine. dae serves it at /ui/ from /usr/share/doona; the API still requires the secret.
PKG_ARCH:=noarch
# The published archive is a built frontend: index.html, assets/, fonts/ and
# the licence texts. The whole tree lands where dae looks for a UI.
PKG_ASSETS:=assets/doona=usr/share/doona
PKG_CONFFILES:=
+8
View File
@@ -0,0 +1,8 @@
# sha256 of the doona archive this package republishes.
#
# The archive comes from szwjp/doona's release, which publishes a .dgst beside
# every asset; that only proves the two agree, so the value pinned here is the
# one the build checks. Bump this file together with doona/Makefile's version.
tag v0.1.0-rc.18
4226b003e512e3516ab0df9cb9d8aecd21e41f3b5de34e103c4baa2f2f5a8df9 doona-0.1.0-rc.18.tar.gz
@@ -1,62 +0,0 @@
// SPDX-License-Identifier: Apache-2.0
'use strict';
'require form';
'require fs';
'require ui';
'require view';
return view.extend({
render() {
let m, s, o;
m = new form.Map('dae', _('Configuration'),
_('Here you can edit dae configuration. It will be hot-reloaded automatically after apply.'));
s = m.section(form.TypedSection);
s.anonymous = true;
s = m.section(form.NamedSection, 'config', 'dae');
o = s.option(form.TextValue, '_configuration');
o.rows = 30;
o.monospace = true;
o.load = function(section_id) {
return fs.read_direct('/etc/dae/config.dae', 'text')
.then(function(content) {
return content ?? '';
}).catch(function(e) {
if (e.toString().includes('NotFoundError'))
return fs.read_direct('/etc/dae/example.dae', 'text')
.then(function(content) {
return content ?? '';
}).catch(function(e) {
return '';
});
ui.addNotification(null, E('p', e.message));
return '';
});
}
o.write = function(section_id, value) {
return fs.write('/etc/dae/config.dae', value, 384 /* 0600 */)
.catch(function(e) {
ui.addNotification(null, E('p', e.message));
});
}
o.remove = function(section_id, value) {
return fs.write('/etc/dae/config.dae', '')
.catch(function(e) {
ui.addNotification(null, E('p', e.message));
});
}
return m.render();
},
handleSaveApply(ev, mode) {
return this.handleSave(ev).then(function() {
return L.resolveDefault(fs.exec_direct('/etc/init.d/dae', ['hot_reload']), null);
});
}
});
+32
View File
@@ -0,0 +1,32 @@
#
# Package metadata for luci-app-dae, the LuCI side of the dae engine.
#
# The page shows the state of the service, opens the doona panel dae serves at
# /ui/, hands out the API secret and drives the manual geo data update. The
# panel itself is the doona package this repository builds from szwjp/doona's
# release archive (installed under /usr/share/doona); this package ships only
# the LuCI page, its rpcd backend and the translations.
#
# This file is free software, licensed under the GNU General Public License v3
# or later.
PKG_NAME:=luci-app-dae
# The page is versioned by release date; the panel it opens keeps its own
# upstream version (0.1.0-rN, see ../doona/Makefile).
PKG_VERSION:=2026.11.14
PKG_RELEASE:=10
PKG_LICENSE:=GPL-3.0-only
PKG_MAINTAINER:=szwjp <szwjp@users.noreply.github.com>
PKG_URL:=https://github.com/szwjp/luci-app-dae
LUCI_DEPENDS:=+luci-base +dae +doona
PKG_DESCRIPTION:=LuCI page for the dae engine. The doona panel itself is the doona package; dae serves it from its own listener.
# The page is static, so the package is the same on every architecture.
PKG_ARCH:=noarch
# The LuCI page reads the state of the service over rpcd, so the package
# ships a small backend next to the view.
PKG_CONFFILES:=
@@ -0,0 +1,411 @@
/* SPDX-License-Identifier: GPL-3.0-only */
/* dae — page styles for the LuCI side of the engine.
Translucent surfaces so the page follows whatever light or dark theme LuCI
is using, plus the few components the page builds itself: tabs, status
cards, the API secret row and the geo data table. */
.dae-page {
--dae-accent-rgb: 0, 122, 255;
--dae-accent: rgba(var(--dae-accent-rgb), 0.9);
--dae-card-bg: rgba(128, 128, 128, 0.04);
--dae-card-border: rgba(128, 128, 128, 0.14);
--dae-field-bg: rgba(128, 128, 128, 0.05);
--dae-hover: rgba(128, 128, 128, 0.08);
--dae-muted: rgba(74, 86, 106, 0.62);
--dae-radius: 14px;
--dae-radius-sm: 9px;
--dae-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
"Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", sans-serif;
--dae-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
"Liberation Mono", monospace;
font-family: var(--dae-font);
width: 100%;
min-width: 0;
box-sizing: border-box;
}
.dae-page,
.dae-page * {
box-sizing: border-box;
}
/* LuCI themes (Argon/Bootstrap) set #view>div:first-child and .cbi-map to
flex; force block so the card layout behaves identically across themes. */
.cbi-map.dae-page {
display: block !important;
}
.dae-page [hidden] {
display: none !important;
}
/* ---------- header ---------- */
.dae-header {
margin: 4px 0 16px;
}
.dae-header h2 {
margin: 0;
padding: 0;
/* Same size as a card title: the page title sits above the tabs, not
above the whole theme, and the large heading dwarfed the content. */
font-size: 15px;
font-weight: 650;
letter-spacing: -0.01em;
line-height: 1.3;
background: transparent !important;
box-shadow: none !important;
border-radius: 0 !important;
}
.dae-header-sub {
margin: 8px 0 0;
color: var(--dae-muted);
font-size: 13px;
line-height: 1.55;
max-width: 720px;
}
/* This view's tabs take the place of LuCI's page-title tab; :has keeps the
rule scoped to the mounted view instead of leaking to the next page when the
stylesheet stays in the document. */
body:has(.dae-page) #tabmenu {
display: none !important;
}
/* ---------- tabs ---------- */
.dae-tabs {
display: inline-flex;
gap: 2px;
padding: 3px;
margin: 0 0 18px;
border-radius: var(--dae-radius-sm);
background: var(--dae-field-bg);
border: 1px solid var(--dae-card-border);
}
.dae-tab {
appearance: none;
border: 0;
background: transparent;
color: var(--dae-muted);
font: inherit;
font-size: 13px;
font-weight: 600;
padding: 7px 16px;
border-radius: 7px;
cursor: pointer;
transition: background 0.15s ease, color 0.15s ease;
}
.dae-tab:hover {
color: inherit;
background: var(--dae-hover);
}
.dae-tab--active,
.dae-tab--active:hover {
color: rgb(var(--dae-accent-rgb));
background: var(--dae-card-bg);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
/* ---------- buttons ---------- */
/* Every control on the page uses the accent colour of the theme's action
buttons (the blue outlined "Open panel"/"Stop" pair) instead of mixing blue
and grey. The theme paints .cbi-button from --on-color, so overriding that
one variable plus the border keeps the same look in light and dark mode. */
.dae-page .cbi-button {
--on-color: var(--primary-color-high, var(--dae-accent));
color: var(--on-color);
border-color: var(--on-color);
}
/* ---------- cards ---------- */
.dae-card {
margin: 0 0 18px;
padding: 16px 18px;
background: var(--dae-card-bg);
border: 1px solid var(--dae-card-border);
border-radius: var(--dae-radius);
}
.dae-card-head {
display: flex;
flex-wrap: wrap;
gap: 12px;
align-items: center;
justify-content: space-between;
}
.dae-card-head-main {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
min-width: 0;
}
.dae-card-title {
margin: 0;
padding: 0;
font-size: 15px;
font-weight: 650;
letter-spacing: -0.01em;
background: none !important;
box-shadow: none !important;
}
.dae-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
/* The panel is served by dae, so the link does nothing while it is stopped. */
.dae-actions .dae-disabled {
opacity: 0.5;
pointer-events: none;
}
/* ---------- status badge ---------- */
.dae-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 999px;
font-size: 12px;
font-weight: 600;
line-height: 1.6;
border: 1px solid transparent;
}
.dae-badge--run {
color: #1f7a37;
background: rgba(52, 199, 89, 0.14);
border-color: rgba(52, 199, 89, 0.35);
}
.dae-badge--idle {
color: #a05c00;
background: rgba(255, 149, 0, 0.13);
border-color: rgba(255, 149, 0, 0.32);
}
.dae-badge--stop {
color: #b3261e;
background: rgba(255, 59, 48, 0.12);
border-color: rgba(255, 59, 48, 0.3);
}
/* Autostart is not the same fact as running or enabled: the Startup page
turns it off by dropping the rc.d link, so it has a badge of its own. */
.dae-badge--boot {
color: var(--dae-muted);
background: var(--dae-card-bg);
border-color: var(--dae-card-border);
}
.dae-badge--boot-off {
color: #a05c00;
background: rgba(255, 149, 0, 0.1);
border-color: rgba(255, 149, 0, 0.28);
}
/* ---------- meta rows ---------- */
.dae-meta {
display: flex;
flex-wrap: wrap;
gap: 8px 28px;
margin-top: 14px;
}
.dae-meta-item {
display: inline-flex;
gap: 8px;
align-items: baseline;
font-size: 13px;
min-width: 0;
}
.dae-meta-label {
color: var(--dae-muted);
}
.dae-note {
margin: 12px 0 0;
color: var(--dae-muted);
font-size: 12.5px;
line-height: 1.55;
}
/* The listener editor. dae binds its API listener at startup, so the value is
saved by the rpcd backend, which restarts the service and rolls back to the
previous address when the new bind fails. */
.dae-listen {
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 16px;
padding-top: 14px;
border-top: 1px solid var(--dae-card-border);
}
.dae-listen-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}
.dae-listen .dae-note {
margin: 0;
}
.dae-listen-input {
width: 320px;
max-width: 100%;
font-family: var(--dae-mono);
font-size: 13px;
}
.dae-listen .cbi-button {
flex: 0 0 auto;
}
/* The panel-writes switch. dae keeps the whole configuration read-only until
its api section allows writes, so the state and its one control sit in the
same row. */
.dae-write {
display: flex;
flex-wrap: wrap;
gap: 12px;
align-items: center;
justify-content: space-between;
margin-top: 16px;
padding-top: 14px;
border-top: 1px solid var(--dae-card-border);
}
.dae-write-text {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
flex: 1 1 260px;
}
.dae-write-state {
font-size: 13px;
}
/* The label and the state line of this block are read at a glance, so they
use the theme's brightest text colour instead of the muted/accent pair. */
.dae-write .dae-meta-label,
.dae-write .dae-write-state {
color: var(--text-color-highest, #fff);
}
.dae-write .dae-note {
margin: 0;
}
.dae-status-msg {
margin: 0;
min-height: 1.4em;
color: var(--dae-muted);
font-size: 13px;
}
/* ---------- API secret ---------- */
.dae-secret-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
margin-top: 12px;
}
.dae-secret {
min-width: 0;
overflow-wrap: anywhere;
padding: 6px 10px;
border-radius: var(--dae-radius-sm);
background: var(--dae-field-bg);
border: 1px solid var(--dae-card-border);
font-family: var(--dae-mono);
font-size: 12.5px;
}
/* ---------- geo data ---------- */
.dae-geo-table {
width: 100%;
margin-top: 14px;
border-collapse: collapse;
font-size: 13px;
}
.dae-geo-table th,
.dae-geo-table td {
text-align: left;
padding: 8px 10px;
border-bottom: 1px solid var(--dae-card-border);
}
.dae-geo-table th {
color: var(--dae-muted);
font-weight: 600;
font-size: 12px;
}
.dae-geo-table tr:last-child td {
border-bottom: 0;
}
.dae-geo-table td:first-child {
font-family: var(--dae-mono);
font-size: 12.5px;
}
.dae-log {
margin: 12px 0 0;
padding: 10px 12px;
max-height: 220px;
overflow: auto;
border-radius: var(--dae-radius-sm);
background: var(--dae-field-bg);
border: 1px solid var(--dae-card-border);
font-family: var(--dae-mono);
font-size: 12px;
line-height: 1.5;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
/* The page is usable on a phone: the buttons wrap and the table scrolls. */
@media screen and (max-width: 600px) {
.dae-card-head {
align-items: flex-start;
}
.dae-actions {
width: 100%;
}
.dae-geo-table {
display: block;
overflow-x: auto;
}
}
@@ -0,0 +1,552 @@
// SPDX-License-Identifier: GPL-3.0-only
//
// The LuCI page of the dae engine. The doona panel drives dae over its native
// HTTP API and is served by dae itself from /usr/share/doona, so this page
// does not frame it: it shows the state of the service, the address the panel
// lives at and the secret the panel asks for, opens the panel in its own tab,
// and drives the manual geo data update.
'use strict';
'require poll';
'require view';
'require view.dae.rpc as dae';
function el(tag, className, children) {
return E(tag, className ? { 'class': className } : {}, children);
}
function button(label, className, onClick) {
const node = E('button', { 'class': className, 'type': 'button' }, label);
if (onClick)
node.addEventListener('click', onClick);
return node;
}
function note(text, hidden) {
const attrs = { 'class': 'dae-note' };
// E() turns every attribute into setAttribute, and "hidden=false" is still
// a hidden element: only add the attribute when it is wanted.
if (hidden)
attrs.hidden = '';
return E('p', attrs, text);
}
function formatBytes(bytes) {
const value = Number(bytes);
if (!value)
return '—';
const units = [ 'B', 'KB', 'MB', 'GB' ];
let index = 0;
let size = value;
while (size >= 1024 && index < units.length - 1) {
size = size / 1024;
index++;
}
return (index === 0 ? String(size) : size.toFixed(1)) + ' ' + units[index];
}
function formatTime(seconds) {
const value = Number(seconds);
return value ? new Date(value * 1000).toLocaleString() : '—';
}
return view.extend({
handleSave: null,
handleSaveApply: null,
handleReset: null,
load: function() {
return Promise.all([
dae.status(),
dae.geoStatus().catch(function() { return null; })
]).then(function(results) {
return { status: results[0], geo: results[1] };
}).catch(function(error) {
return { error: error.message || String(error) };
});
},
render: function(data) {
dae.installStyles();
const page = E('div', { 'class': 'cbi-map dae-page' });
const message = el('p', 'dae-status-msg', '');
message.setAttribute('role', 'status');
const ui = {};
const statusCard = el('section', 'dae-card');
const secretCard = el('section', 'dae-card');
const geoCard = el('section', 'dae-card');
let statusData = data.status || null;
let geoData = data.geo || null;
let busy = false;
let geoBusy = false;
// The tabs are two panes of one view rather than two menu entries: the
// geo update belongs to the same service as the panel link.
const tabService = button(_('Service'), 'dae-tab dae-tab--active');
const tabGeo = button(_('Geo data'), 'dae-tab');
const paneService = E('div', { 'role': 'tabpanel' });
const paneGeo = E('div', { 'role': 'tabpanel', 'hidden': true });
function selectTab(name) {
const geo = name === 'geo';
tabService.classList.toggle('dae-tab--active', !geo);
tabGeo.classList.toggle('dae-tab--active', geo);
tabService.setAttribute('aria-selected', String(!geo));
tabGeo.setAttribute('aria-selected', String(geo));
paneService.hidden = geo;
paneGeo.hidden = !geo;
if (geo)
refreshGeo();
}
tabService.addEventListener('click', function() { selectTab('service'); });
tabGeo.addEventListener('click', function() { selectTab('geo'); });
// ---- service tab ----------------------------------------------------
ui.badge = el('span', 'dae-badge dae-badge--stop', _('Disabled'));
// Autostart is a separate fact from the UCI enabled bit: the Startup
// page disables it by removing the rc.d link.
ui.bootBadge = el('span', 'dae-badge dae-badge--boot', _('Autostart'));
ui.openPanel = E('a', {
'class': 'cbi-button cbi-button-action',
'target': '_blank',
'rel': 'noopener noreferrer'
}, _('Open panel'));
ui.toggle = button(_('Start'), 'cbi-button cbi-button-action', function() {
runAction(ui.toggle.getAttribute('data-action'));
});
ui.toggle.setAttribute('data-action', 'start');
ui.restart = button(_('Restart'), 'cbi-button', function() { runAction('restart'); });
ui.listenInput = E('input', {
'class': 'cbi-input-text dae-listen-input',
'type': 'text',
'inputmode': 'url',
'spellcheck': 'false',
'autocomplete': 'off',
'placeholder': 'http://192.168.1.1:9527/ui/',
'aria-label': _('Panel address')
});
ui.listenApply = button(_('Confirm listener'), 'cbi-button', runListenSave);
ui.listenHint = note(_('The address the panel is opened at. Saving restarts the service immediately.'));
ui.reason = note('');
statusCard.appendChild(el('div', 'dae-card-head', [
el('div', 'dae-card-head-main', [
el('h3', 'dae-card-title', _('Status')),
ui.badge,
ui.bootBadge
]),
el('div', 'dae-actions', [ ui.openPanel, ui.toggle, ui.restart ])
]));
statusCard.appendChild(el('div', 'dae-listen', [
el('span', 'dae-meta-label', _('Panel address')),
el('div', 'dae-listen-row', [ ui.listenInput, ui.listenApply ]),
ui.listenHint
]));
statusCard.appendChild(ui.reason);
// dae refuses every configuration write unless its `api` section turns
// them on, and then the whole doona configuration page is read-only.
// The switch lives in UCI and is written into the api section by the
// init script, so this is the one place an operator can flip it.
ui.writeState = el('span', 'dae-write-state', '—');
ui.writeNote = el('p', 'dae-note',
_('Configuration, nodes, groups and rules can only be edited in the panel while writes are on.'));
ui.writeToggle = button(_('Allow panel writes'), 'cbi-button', runWriteToggle);
statusCard.appendChild(el('div', 'dae-write', [
el('div', 'dae-write-text', [
el('span', 'dae-meta-label', _('Panel writes')),
ui.writeState,
ui.writeNote
]),
ui.writeToggle
]));
ui.secretValue = el('code', 'dae-secret', _('Loading…'));
ui.secretShow = button(_('Show'), 'cbi-button');
ui.secretCopy = button(_('Copy'), 'cbi-button');
ui.secretCopy.disabled = true;
secretCard.appendChild(el('h3', 'dae-card-title', _('API secret')));
secretCard.appendChild(el('div', 'dae-secret-row', [
ui.secretValue, ui.secretShow, ui.secretCopy
]));
secretCard.appendChild(note(
_('The panel asks for this secret the first time it is opened. It is also readable with: uci get dae.main.api_secret')));
ui.errorAlert = el('div', 'alert-message', _('Could not read the dae service state.'));
ui.errorAlert.hidden = true;
ui.errorNote = note(_('If luci-app-dae was installed just now, restart rpcd so that its backend is registered.'), true);
paneService.appendChild(ui.errorAlert);
paneService.appendChild(ui.errorNote);
paneService.appendChild(statusCard);
paneService.appendChild(secretCard);
// ---- geo tab --------------------------------------------------------
function geoRow(name) {
const size = el('td', '', '—');
const modified = el('td', '', '—');
return {
row: el('tr', '', [ el('td', '', name), size, modified ]),
size: size,
modified: modified
};
}
ui.geoRows = [ geoRow('geoip.dat'), geoRow('geosite.dat') ];
ui.geoLast = note(_('Never updated.'));
ui.geoLog = E('pre', { 'class': 'dae-log' }, '');
ui.geoError = el('div', 'alert-message', _('Could not read the geo data state.'));
ui.geoError.hidden = true;
ui.geoUpdate = button(_('Update now'), 'cbi-button cbi-button-action', runGeoUpdate);
geoCard.appendChild(el('div', 'dae-card-head', [
el('div', 'dae-card-head-main', [ el('h3', 'dae-card-title', _('Geo data')) ]),
el('div', 'dae-actions', [ ui.geoUpdate ])
]));
geoCard.appendChild(note(
_('The geoip.dat and geosite.dat files back the geoip: and geosite: rules. dae reads them when it starts, so it is restarted after an update.')));
geoCard.appendChild(E('table', { 'class': 'dae-geo-table' }, [
E('thead', {}, E('tr', {}, [
el('th', '', _('File')), el('th', '', _('Size')), el('th', '', _('Modified'))
])),
el('tbody', '', ui.geoRows.map(function(row) { return row.row; }))
]));
geoCard.appendChild(ui.geoLast);
geoCard.appendChild(ui.geoLog);
paneGeo.appendChild(ui.geoError);
paneGeo.appendChild(geoCard);
// ---- rendering ------------------------------------------------------
function updateStatus(status, error) {
const unreadable = !!error || !status || typeof status !== 'object' ||
typeof status.listen !== 'string';
ui.errorAlert.hidden = !unreadable;
ui.errorNote.hidden = !unreadable;
statusCard.hidden = unreadable;
secretCard.hidden = unreadable;
if (unreadable)
return;
statusData = status;
const running = status.running === true;
const enabled = status.enabled === true;
ui.badge.className = 'dae-badge ' + (running
? 'dae-badge--run'
: (enabled ? 'dae-badge--idle' : 'dae-badge--stop'));
ui.badge.textContent = running ? _('Running') : (enabled ? _('Stopped') : _('Disabled'));
if (status.boot_enabled === true || status.boot_enabled === false) {
const boot = status.boot_enabled === true;
ui.bootBadge.hidden = false;
ui.bootBadge.className = 'dae-badge ' + (boot ? 'dae-badge--boot' : 'dae-badge--boot-off');
ui.bootBadge.textContent = boot ? _('Autostart') : _('No autostart');
}
else {
// A backend that predates the field cannot tell; do not claim
// either state.
ui.bootBadge.hidden = true;
}
if (document.activeElement !== ui.listenInput)
ui.listenInput.value = dae.panelAddress(status);
ui.listenInput.disabled = busy;
ui.listenApply.disabled = busy;
const write = dae.writeEnabled(status);
ui.writeState.textContent = write
? _('On — the panel can change the configuration, nodes and groups.')
: _('Off — the panel can only read the configuration.');
ui.writeState.className = 'dae-write-state ' + (write ? 'dae-write-state--on' : 'dae-write-state--off');
ui.writeToggle.textContent = write ? _('Stop panel writes') : _('Allow panel writes');
// The value is read by dae only when it starts, and a stopped
// service has nothing to restart into.
ui.writeToggle.disabled = busy || !running;
const url = dae.panelUrl(status);
if (running && url) {
ui.openPanel.setAttribute('href', url);
ui.openPanel.setAttribute('target', '_blank');
ui.openPanel.setAttribute('rel', 'noopener noreferrer');
ui.openPanel.removeAttribute('aria-disabled');
ui.openPanel.classList.remove('dae-disabled');
}
else {
// The panel is served by dae itself; a stopped daemon has no
// page to open, so the link must not look usable.
ui.openPanel.removeAttribute('href');
ui.openPanel.setAttribute('aria-disabled', 'true');
ui.openPanel.classList.add('dae-disabled');
}
ui.toggle.textContent = running ? _('Stop') : _('Start');
ui.toggle.setAttribute('data-action', running ? 'stop' : 'start');
// Starting is what turns a disabled service on: the backend sets
// enabled=1 and creates the boot links before it starts the daemon.
ui.toggle.disabled = busy || (running && !enabled);
ui.restart.disabled = busy || !running;
ui.restart.hidden = !running;
const reason = dae.panelReason(status) || '';
ui.reason.textContent = reason;
ui.reason.hidden = !reason;
}
function updateGeo(geo) {
geoData = geo || null;
if (!geo) {
ui.geoError.hidden = false;
geoCard.hidden = true;
return;
}
ui.geoError.hidden = true;
geoCard.hidden = false;
const files = Array.isArray(geo.files) ? geo.files : [];
ui.geoRows.forEach(function(row, index) {
const file = files[index] || {};
if (file.present) {
row.size.textContent = formatBytes(file.size);
row.modified.textContent = formatTime(file.modified);
}
else {
row.size.textContent = _('Not installed');
row.modified.textContent = '—';
}
});
const state = geo.state || 'idle';
if (state === 'running') {
ui.geoLast.textContent = _('Updating…');
}
else if (state === 'ok' || state === 'failed') {
const text = geo.message
? dae.statusIssue(geo.message)
: (state === 'ok' ? _('The update completed.') : _('The update failed.'));
ui.geoLast.textContent = (geo.finished ? formatTime(geo.finished) + ' · ' : '') + text;
}
else {
ui.geoLast.textContent = _('Never updated.');
}
ui.geoUpdate.disabled = geoBusy || state === 'running';
ui.geoUpdate.textContent = state === 'running' ? _('Updating…') : _('Update now');
const log = Array.isArray(geo.log) ? geo.log.join('\n') : (geo.log || '');
ui.geoLog.textContent = log;
ui.geoLog.hidden = !log;
}
// ---- actions --------------------------------------------------------
function runAction(action) {
if (busy)
return;
busy = true;
message.textContent = _('Working…');
updateStatus(statusData, null);
dae[action]().then(dae.ensureOk).then(function(result) {
message.textContent = dae.resultMessage(result, _('The operation completed.'));
}).catch(function(error) {
message.textContent = dae.errorMessage(error, _('The operation failed.'));
}).finally(function() {
busy = false;
refreshStatus();
});
}
// Saving the listener restarts dae too: the address is bound at startup,
// and the backend rolls back to the previous one when the new bind fails.
function runListenSave() {
if (busy)
return;
const value = ui.listenInput.value.trim();
if (!value) {
message.textContent = _('Enter the panel address.');
return;
}
busy = true;
message.textContent = _('Working…');
updateStatus(statusData, null);
dae.setListen(value).then(dae.ensureOk).then(function(result) {
message.textContent = dae.resultMessage(result, _('The listener was saved.'));
}).catch(function(error) {
message.textContent = dae.errorMessage(error, _('The listener was not saved.'));
}).finally(function() {
busy = false;
refreshStatus();
});
}
// Turning writes on restarts dae: the api section is read at startup
// only, and the init script writes the switch into it then.
function runWriteToggle() {
if (busy)
return;
const target = !dae.writeEnabled(statusData);
busy = true;
message.textContent = _('Working…');
updateStatus(statusData, null);
dae.setWrite(target).then(dae.ensureOk).then(function(result) {
message.textContent = dae.resultMessage(result, _('The operation completed.'));
}).catch(function(error) {
message.textContent = dae.errorMessage(error, _('The operation failed.'));
}).finally(function() {
busy = false;
refreshStatus();
});
}
function runGeoUpdate() {
if (geoBusy)
return;
geoBusy = true;
message.textContent = _('Working…');
updateGeo(geoData);
dae.geoUpdate().then(dae.ensureOk).then(function(result) {
message.textContent = dae.resultMessage(result, _('The update was started.'));
}).catch(function(error) {
message.textContent = dae.errorMessage(error, _('The operation failed.'));
}).finally(function() {
geoBusy = false;
refreshGeo();
});
}
function loadSecret() {
let shown = false;
dae.secret().then(function(result) {
const secret = result && result.secret;
if (!secret) {
ui.secretValue.textContent = _('The secret is not available to this session.');
ui.secretShow.disabled = true;
ui.secretCopy.disabled = true;
return;
}
ui.secretValue.textContent = '••••••••••••';
ui.secretShow.disabled = false;
ui.secretCopy.disabled = false;
ui.secretShow.onclick = function() {
shown = !shown;
ui.secretValue.textContent = shown ? secret : '••••••••••••';
ui.secretShow.textContent = shown ? _('Hide') : _('Show');
};
ui.secretCopy.onclick = function() {
ui.secretCopy.disabled = true;
const done = function() {
ui.secretCopy.textContent = _('Copied');
setTimeout(function() {
ui.secretCopy.textContent = _('Copy');
ui.secretCopy.disabled = false;
}, 3000);
};
// The clipboard can be out of reach: a browser that is not
// allowed to use it refuses the write. The secret is shown
// then, so it can still be taken over by hand.
const failed = function() {
shown = true;
ui.secretValue.textContent = secret;
ui.secretShow.textContent = _('Hide');
ui.secretCopy.disabled = false;
message.textContent = _('The secret could not be written to the clipboard. It is shown instead.');
};
if (navigator.clipboard && navigator.clipboard.writeText)
navigator.clipboard.writeText(secret).then(done, failed);
else
failed();
};
}).catch(function() {
ui.secretValue.textContent = _('The secret is not available to this session.');
ui.secretShow.disabled = true;
ui.secretCopy.disabled = true;
});
}
function refreshStatus() {
return dae.status().then(function(status) {
updateStatus(status, null);
}).catch(function() {
updateStatus(null, true);
});
}
function refreshGeo() {
return dae.geoStatus().then(function(geo) {
updateGeo(geo);
}).catch(function() {
updateGeo(null);
});
}
// ---- assemble -------------------------------------------------------
// The tabs replace the page title at the top of the view; the title and
// its explanation belong to the service pane, so the geo tab opens on its
// own content.
paneService.insertBefore(el('div', 'dae-header', [
el('h2', '', _('dae')),
el('p', 'dae-header-sub',
_('The doona panel drives the dae engine over its native HTTP API. dae serves the panel itself; this page shows the service state, opens the panel and updates the geo data.'))
]), paneService.firstChild);
page.appendChild(E('div', { 'class': 'dae-tabs', 'role': 'tablist' }, [ tabService, tabGeo ]));
page.appendChild(paneService);
page.appendChild(paneGeo);
page.appendChild(message);
updateStatus(data.status || null, data.error || null);
updateGeo(data.geo || null);
loadSecret();
// A hidden tab keeps polling, and every poll is an RPC call. The page
// catches up on the first tick after it is visible again.
poll.add(function() {
if (document.hidden)
return Promise.resolve();
const tasks = [ refreshStatus() ];
if (!paneGeo.hidden || (geoData && geoData.state === 'running'))
tasks.push(refreshGeo());
return Promise.all(tasks);
}, 5);
return page;
}
});
@@ -0,0 +1,280 @@
// SPDX-License-Identifier: GPL-3.0-only
'use strict';
'require baseclass';
'require rpc';
/*
* "reject: true" makes a failing ubus call raise instead of resolving with
* an empty object: LuCI replaces a reply that does not match the "expect"
* shape with a bare "{}", so without it a backend that is not registered
* looks like a service that is merely disabled.
*/
const callStatus = rpc.declare({ object: 'dae', method: 'status', expect: { '': {} }, reject: true });
const callSecret = rpc.declare({ object: 'dae', method: 'secret', expect: { '': {} }, reject: true });
const callStart = rpc.declare({ object: 'dae', method: 'start', expect: { '': {} }, reject: true });
const callStop = rpc.declare({ object: 'dae', method: 'stop', expect: { '': {} }, reject: true });
const callRestart = rpc.declare({ object: 'dae', method: 'restart', expect: { '': {} }, reject: true });
const callSetListen = rpc.declare({ object: 'dae', method: 'set_listen', params: [ 'url' ], expect: { '': {} }, reject: true });
const callSetWrite = rpc.declare({ object: 'dae', method: 'set_write', params: [ 'value' ], expect: { '': {} }, reject: true });
const callGeoStatus = rpc.declare({ object: 'dae', method: 'geo_status', expect: { '': {} }, reject: true });
const callGeoUpdate = rpc.declare({ object: 'dae', method: 'geo_update', expect: { '': {} }, reject: true });
let pageStylesInstalled = false;
/*
* The browser keeps a stylesheet in its cache, so a page that is opened
* after the package was upgraded would still use the stylesheet of the
* older version. The version on the URL makes it fetch the current one.
* It has to be raised whenever dae.css changes; the package build stamps
* the package version in.
*/
const STYLE_VERSION = '20261114-4';
function installStyles() {
if (pageStylesInstalled || document.getElementById('dae-page-styles'))
return;
const stylesheet = document.createElement('link');
stylesheet.id = 'dae-page-styles';
stylesheet.rel = 'stylesheet';
stylesheet.href = L.resource('view/dae/dae.css', '?v=' + STYLE_VERSION);
document.head.appendChild(stylesheet);
pageStylesInstalled = true;
}
function isIpLiteral(host) {
const bare = String(host || '').replace(/^\[|\]$/g, '');
if (!bare)
return false;
if (bare.indexOf(':') >= 0)
return true;
const octets = bare.split('.');
return octets.length === 4 && octets.every(function(part) {
return /^\d{1,3}$/.test(part) && Number(part) <= 255;
});
}
function authorityHost(host) {
const bare = String(host || '').replace(/^\[|\]$/g, '');
return bare.indexOf(':') >= 0 ? '[' + bare + ']' : bare;
}
function isLoopback(host) {
const bare = String(host || '').replace(/^\[|\]$/g, '').toLowerCase();
if (bare === 'localhost' || bare === '::1' || bare === '0:0:0:0:0:0:0:1')
return true;
const octets = bare.split('.');
if (octets.length !== 4 || !octets.every(function(part) { return /^\d{1,3}$/.test(part); }))
return false;
// 0.0.0.0 is the unspecified address, not a loopback one.
if (octets.every(function(part) { return Number(part) === 0; }))
return false;
return Number(octets[0]) === 127;
}
function isWildcard(host) {
const bare = String(host || '').replace(/^\[|\]$/g, '');
return bare === '0.0.0.0' || bare === '::' || bare === '';
}
// The host part of a "host:port" listener address.
function listenHost(listen) {
const value = String(listen || '');
const cut = value.lastIndexOf(':');
return cut < 0 ? '' : value.slice(0, cut);
}
/*
* The address the panel is reached at.
*
* dae serves the panel from its API listener, so the page has to name the
* same host the daemon answers on:
*
* - a wildcard bind answers on every address, so the address the browser
* already uses for the router is the right one;
* - a bind to one address answers there only, so that address is the right
* one;
* - a loopback bind answers on the router itself, which a browser on
* another machine cannot reach.
*
* The API checks the Host header: with a wildcard bind it accepts an IP
* literal or "localhost" only, so a router that was reached by name cannot use
* the browser's own host. The backend reports a list of candidates then, and
* the first one that belongs to the network the browser is already talking to
* is the one to take.
*/
function panelAddress(status) {
if (!status || typeof status !== 'object')
return '';
const port = Number(status.port);
if (!Number.isInteger(port) || port < 1 || port > 65535)
return '';
const host = status.panel_host || '';
if (host)
return 'http://' + authorityHost(host) + ':' + port + '/ui/';
const browserHost = (window.location && window.location.hostname) || '';
const bound = listenHost(status.listen);
let fallback;
if (isWildcard(bound)) {
fallback = browserHost;
if (!isIpLiteral(fallback) && fallback !== 'localhost')
fallback = pickReachableAddress(status, browserHost);
}
else {
fallback = bound;
}
return fallback ? 'http://' + authorityHost(fallback) + ':' + port + '/ui/' : '';
}
function panelUrl(status) {
if (!status || !status.running || !status.panel_available)
return null;
const address = panelAddress(status);
if (!address)
return null;
const browserHost = (window.location && window.location.hostname) || '';
const host = listenHost(address.replace(/^http:\/\//, ''));
// A loopback address only reaches a browser on the router itself.
if (isLoopback(host) && !isLoopback(browserHost))
return null;
return address;
}
/*
* Why the panel cannot be opened, or null when it can. The wording tells the
* operator what to do, not only what is wrong.
*/
function panelReason(status) {
if (!status || typeof status !== 'object')
return null;
if (!status.running) {
return status.enabled
? _('The dae service is stopped. Press Start to run it.')
: _('The dae service is not enabled yet. Press Start to enable and start it.');
}
if (!status.panel_available)
return _('The panel is not installed. Install the doona package.');
if (!panelUrl(status)) {
if (isLoopback(listenHost(status.listen)))
return _('The API listens on the router itself, so the panel is not reachable from another machine.');
return _('The panel is not reachable from this browser.');
}
return null;
}
// The first reported address that is close enough to the browser to be worth
// trying, or the first reported address when none is.
//
// "Close enough" means the same /24: a router answers on several networks, and
// the one the browser sits in is the one it can always reach.
function pickReachableAddress(status, browserHost) {
const candidates = Array.isArray(status.lan_addresses)
? status.lan_addresses.filter(isIpLiteral)
: [];
if (!candidates.length && status.lan_address)
candidates.push(status.lan_address);
if (!candidates.length)
return '';
const prefixOf = function(host) {
const bare = String(host || '').replace(/^\[|\]$/g, '');
const parts = bare.split('.');
return parts.length === 4 ? parts.slice(0, 3).join('.') : null;
};
const browserPrefix = isIpLiteral(browserHost) ? prefixOf(browserHost) : null;
if (browserPrefix) {
const sameNetwork = candidates.find(function(address) {
return prefixOf(address) === browserPrefix;
});
if (sameNetwork)
return sameNetwork;
}
return candidates[0];
}
function statusIssue(token) {
const messages = {
started: _('The dae service started.'),
stopped: _('The dae service stopped.'),
restarted: _('The dae service restarted.'),
writes_enabled: _('The panel may now change the configuration.'),
writes_disabled: _('The panel can only read the configuration now.'),
start_failed: _('The dae service did not start. Check the system log.'),
stop_failed: _('The dae service did not stop. Check the system log.'),
restart_failed: _('The dae service did not restart. Check the system log.'),
settings_write_failed: _('The settings could not be written. Check the system log.'),
invalid_operation: _('The operation is not known.'),
listen_invalid: _('The listener is invalid. Use a numeric address and a port, such as 0.0.0.0:9527.'),
listen_in_use: _('That port is already in use. Choose another one.'),
listen_unchanged: _('The listener did not change.'),
listen_saved: _('The listener was saved and is in effect.'),
listen_saved_stopped: _('The listener was saved. It takes effect when the service starts.'),
listen_restart_failed: _('The new listener did not start; the previous address was restored.'),
listen_rollback_failed: _('The new listener did not start and the previous address could not be restored. Check the system log.'),
geo_started: _('The update was started.'),
geo_busy: _('Another update is already running.'),
geo_unavailable: _('The update script is missing. Reinstall the dae package.'),
updated: _('The geo data was updated and dae was restarted.'),
up_to_date: _('The geo data is already up to date.'),
updated_stopped: _('The geo data was updated. It takes effect the next time dae starts.'),
download_failed: _('The download or verification failed. The installed files were left untouched.'),
interrupted: _('The previous update was interrupted.'),
restart_failed_rollback: _('dae did not come back up after the update; the previous files were restored.'),
rollback_failed: _('dae is not running and the previous files could not be restored. Check the system log.')
};
return messages[token] || token || _('The dae service reported an issue.');
}
function resultMessage(result, fallback) {
return result && statusIssue(result.message) || fallback;
}
function errorMessage(error, fallback) {
return error && statusIssue(error.message) || fallback;
}
function ensureOk(result) {
if (!result || result.ok !== true)
throw new Error(result && result.message ? result.message : _('The backend did not confirm the operation.'));
return result;
}
return baseclass.extend({
status: callStatus,
secret: callSecret,
start: callStart,
stop: callStop,
restart: callRestart,
setListen: callSetListen,
setWrite: callSetWrite,
writeEnabled: function(status) {
return !!(status && status.write === true);
},
geoStatus: callGeoStatus,
geoUpdate: callGeoUpdate,
panelAddress: panelAddress,
panelUrl: panelUrl,
panelReason: panelReason,
statusIssue: statusIssue,
resultMessage: resultMessage,
errorMessage: errorMessage,
ensureOk: ensureOk,
installStyles: installStyles
});
@@ -0,0 +1,285 @@
msgid ""
msgstr ""
"Project-Id-Version: luci-app-dae\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-12 16:20+0800\n"
"PO-Revision-Date: 2026-11-12 16:20+0800\n"
"Last-Translator: szwjp <szwjp@users.noreply.github.com>\n"
"Language-Team: Chinese (Simplified)\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Panel"
msgstr "面板"
msgid "Service"
msgstr "服务"
msgid "Geo data"
msgstr "Geo 数据"
msgid "Status"
msgstr "状态"
msgid "Running"
msgstr "运行中"
msgid "Stopped"
msgstr "已停止"
msgid "Disabled"
msgstr "未启用"
msgid "Autostart"
msgstr "开机自启"
msgid "No autostart"
msgstr "不自启"
msgid "Listener"
msgstr "监听地址"
msgid "Open panel"
msgstr "打开面板"
msgid "Start"
msgstr "启动"
msgid "Stop"
msgstr "停止"
msgid "Restart"
msgstr "重启"
msgid "API secret"
msgstr "API 密钥"
msgid "Show"
msgstr "显示"
msgid "Hide"
msgstr "隐藏"
msgid "Copy"
msgstr "复制"
msgid "Copied"
msgstr "已复制"
msgid "Loading…"
msgstr "读取中…"
msgid "Working…"
msgstr "处理中…"
msgid "Updating…"
msgstr "更新中…"
msgid "Update now"
msgstr "立即更新"
msgid "File"
msgstr "文件"
msgid "Size"
msgstr "大小"
msgid "Modified"
msgstr "修改时间"
msgid "Not installed"
msgstr "未安装"
msgid "Never updated."
msgstr "尚未更新。"
msgid "The update completed."
msgstr "更新完成。"
msgid "The update failed."
msgstr "更新失败。"
msgid "The operation completed."
msgstr "操作已完成。"
msgid "The operation failed."
msgstr "操作失败。"
msgid "Could not read the dae service state."
msgstr "读取 dae 服务状态失败。"
msgid "Could not read the geo data state."
msgstr "读取 Geo 数据状态失败。"
msgid "If luci-app-dae was installed just now, restart rpcd so that its backend is registered."
msgstr "如果刚安装 luci-app-dae,请重启 rpcd 使其后端生效。"
msgid "dae"
msgstr "dae 引擎"
msgid "The doona panel drives the dae engine over its native HTTP API. dae serves the panel itself; this page shows the service state, opens the panel and updates the geo data."
msgstr "doona 面板通过 dae 的原生 HTTP API 驱动引擎。面板由 dae 自己托管;本页显示服务状态、打开面板,并更新 Geo 数据。"
msgid "The dae service is not enabled yet. Press Start to enable and start it."
msgstr "dae 服务尚未启用,点「启动」即可启用并启动。"
msgid "The dae service is stopped. Press Start to run it."
msgstr "dae 服务已停止,点「启动」即可运行。"
msgid "The panel is not installed. Install the doona package."
msgstr "面板未安装,请安装 doona 软件包。"
msgid "The panel is not reachable from this browser."
msgstr "当前浏览器访问不到面板。"
msgid "The API listens on the router itself, so the panel is not reachable from another machine."
msgstr "API 只监听路由器本机,其他机器访问不到面板。"
msgid "The panel asks for this secret the first time it is opened. It is also readable with: uci get dae.main.api_secret"
msgstr "面板首次打开时会要求输入这个密钥。也可以用 uci get dae.main.api_secret 读取。"
msgid "The secret is not available to this session."
msgstr "当前会话无权读取密钥。"
msgid "The secret could not be written to the clipboard. It is shown instead."
msgstr "密钥没能写入剪贴板,已改为直接显示。"
msgid "The dae service started."
msgstr "dae 服务已启动。"
msgid "The dae service stopped."
msgstr "dae 服务已停止。"
msgid "The dae service restarted."
msgstr "dae 服务已重启。"
msgid "The dae service did not start. Check the system log."
msgstr "dae 服务启动失败,请查看系统日志。"
msgid "The dae service did not stop. Check the system log."
msgstr "dae 服务停止失败,请查看系统日志。"
msgid "The dae service did not restart. Check the system log."
msgstr "dae 服务重启失败,请查看系统日志。"
msgid "The settings could not be written. Check the system log."
msgstr "配置写入失败,请查看系统日志。"
msgid "The operation is not known."
msgstr "未知操作。"
msgid "The dae service reported an issue."
msgstr "dae 服务报告了一个问题。"
msgid "The backend did not confirm the operation."
msgstr "后端没有确认这次操作。"
msgid "The update was started."
msgstr "更新已开始。"
msgid "Another update is already running."
msgstr "已有更新正在进行。"
msgid "The update script is missing. Reinstall the dae package."
msgstr "更新脚本缺失,请重新安装 dae 软件包。"
msgid "The geo data was updated and dae was restarted."
msgstr "Geo 数据已更新,dae 已重启。"
msgid "The geo data is already up to date."
msgstr "Geo 数据已是最新。"
msgid "The geo data was updated. It takes effect the next time dae starts."
msgstr "Geo 数据已更新,下次启动 dae 时生效。"
msgid "The download or verification failed. The installed files were left untouched."
msgstr "下载或校验失败,已安装的文件未改动。"
msgid "The previous update was interrupted."
msgstr "上一次更新被中断。"
msgid "dae did not come back up after the update; the previous files were restored."
msgstr "更新后 dae 未能启动,已恢复原有文件。"
msgid "dae is not running and the previous files could not be restored. Check the system log."
msgstr "dae 未运行且原有文件无法恢复,请查看系统日志。"
msgid "The geoip.dat and geosite.dat files back the geoip: and geosite: rules. dae reads them when it starts, so it is restarted after an update."
msgstr "geoip.dat 与 geosite.dat 是 geoip: 与 geosite: 规则的数据源。dae 只在启动时读取,因此更新后会重启 dae。"
msgid "Panel writes"
msgstr "面板写入"
msgid "Off — the panel can only read the configuration."
msgstr "关闭 — 面板只能读取配置。"
msgid "On — the panel can change the configuration, nodes and groups."
msgstr "开启 — 面板可以修改配置、节点与组。"
msgid "Allow panel writes"
msgstr "允许面板写入"
msgid "Stop panel writes"
msgstr "停止面板写入"
msgid "Configuration, nodes, groups and rules can only be edited in the panel while writes are on."
msgstr "只有在写入开启时,才能在面板里编辑配置、节点、组与规则。"
msgid "The panel may now change the configuration."
msgstr "面板现在可以修改配置。"
msgid "The panel can only read the configuration now."
msgstr "面板现在只能读取配置。"
msgid "Apply"
msgstr "应用"
msgid "dae needs a numeric address and a port. Saving restarts the service immediately."
msgstr "dae 需要数值地址和端口;保存后会立即重启服务。"
msgid "Enter a listener address and port."
msgstr "请输入监听地址和端口。"
msgid "The listener was saved."
msgstr "监听地址已保存。"
msgid "The listener was not saved."
msgstr "监听地址未保存。"
msgid "The listener was saved and is in effect."
msgstr "监听地址已保存并生效。"
msgid "The listener was saved. It takes effect when the service starts."
msgstr "监听地址已保存,将在服务启动时生效。"
msgid "The listener did not change."
msgstr "监听地址没有变化。"
msgid "The listener is invalid. Use a numeric address and a port, such as 0.0.0.0:9527."
msgstr "监听地址无效。请填写数值地址和端口,例如 0.0.0.0:9527。"
msgid "The new listener did not start; the previous address was restored."
msgstr "新监听地址未能启动,已恢复原地址。"
msgid "The new listener did not start and the previous address could not be restored. Check the system log."
msgstr "新监听地址未能启动,且原地址恢复失败。请检查系统日志。"
msgid "That port is already in use. Choose another one."
msgstr "该端口已被占用,请换一个端口。"
msgid "Confirm"
msgstr "确定"
msgid "Confirm listener"
msgstr "确定"
msgid "Panel address"
msgstr "面板访问地址"
msgid "The address the panel is opened at. Saving restarts the service immediately."
msgstr "面板打开时使用的地址。保存后会立即重启服务。"
msgid "Enter the panel address."
msgstr "请输入面板地址。"
@@ -0,0 +1,285 @@
msgid ""
msgstr ""
"Project-Id-Version: luci-app-dae\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-12 16:20+0800\n"
"PO-Revision-Date: 2026-11-12 16:20+0800\n"
"Last-Translator: szwjp <szwjp@users.noreply.github.com>\n"
"Language-Team: Chinese (Traditional)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Panel"
msgstr "面板"
msgid "Service"
msgstr "服務"
msgid "Geo data"
msgstr "Geo 資料"
msgid "Status"
msgstr "狀態"
msgid "Running"
msgstr "執行中"
msgid "Stopped"
msgstr "已停止"
msgid "Disabled"
msgstr "未啟用"
msgid "Autostart"
msgstr "開機自啟"
msgid "No autostart"
msgstr "不自啟"
msgid "Listener"
msgstr "監聽位址"
msgid "Open panel"
msgstr "開啟面板"
msgid "Start"
msgstr "啟動"
msgid "Stop"
msgstr "停止"
msgid "Restart"
msgstr "重啟"
msgid "API secret"
msgstr "API 金鑰"
msgid "Show"
msgstr "顯示"
msgid "Hide"
msgstr "隱藏"
msgid "Copy"
msgstr "複製"
msgid "Copied"
msgstr "已複製"
msgid "Loading…"
msgstr "讀取中…"
msgid "Working…"
msgstr "處理中…"
msgid "Updating…"
msgstr "更新中…"
msgid "Update now"
msgstr "立即更新"
msgid "File"
msgstr "檔案"
msgid "Size"
msgstr "大小"
msgid "Modified"
msgstr "修改時間"
msgid "Not installed"
msgstr "未安裝"
msgid "Never updated."
msgstr "尚未更新。"
msgid "The update completed."
msgstr "更新完成。"
msgid "The update failed."
msgstr "更新失敗。"
msgid "The operation completed."
msgstr "操作已完成。"
msgid "The operation failed."
msgstr "操作失敗。"
msgid "Could not read the dae service state."
msgstr "讀取 dae 服務狀態失敗。"
msgid "Could not read the geo data state."
msgstr "讀取 Geo 資料狀態失敗。"
msgid "If luci-app-dae was installed just now, restart rpcd so that its backend is registered."
msgstr "如果剛安裝 luci-app-dae,請重啟 rpcd 使其後端生效。"
msgid "dae"
msgstr "dae 引擎"
msgid "The doona panel drives the dae engine over its native HTTP API. dae serves the panel itself; this page shows the service state, opens the panel and updates the geo data."
msgstr "doona 面板透過 dae 的原生 HTTP API 驅動引擎。面板由 dae 自己託管;本頁顯示服務狀態、開啟面板,並更新 Geo 資料。"
msgid "The dae service is not enabled yet. Press Start to enable and start it."
msgstr "dae 服務尚未啟用,點「啟動」即可啟用並啟動。"
msgid "The dae service is stopped. Press Start to run it."
msgstr "dae 服務已停止,點「啟動」即可執行。"
msgid "The panel is not installed. Install the doona package."
msgstr "面板未安裝,請安裝 doona 套件。"
msgid "The panel is not reachable from this browser."
msgstr "目前的瀏覽器連不到面板。"
msgid "The API listens on the router itself, so the panel is not reachable from another machine."
msgstr "API 只監聽路由器本機,其他機器連不到面板。"
msgid "The panel asks for this secret the first time it is opened. It is also readable with: uci get dae.main.api_secret"
msgstr "面板首次開啟時會要求輸入這個金鑰。也可以用 uci get dae.main.api_secret 讀取。"
msgid "The secret is not available to this session."
msgstr "目前的工作階段無權讀取金鑰。"
msgid "The secret could not be written to the clipboard. It is shown instead."
msgstr "金鑰沒能寫入剪貼簿,已改為直接顯示。"
msgid "The dae service started."
msgstr "dae 服務已啟動。"
msgid "The dae service stopped."
msgstr "dae 服務已停止。"
msgid "The dae service restarted."
msgstr "dae 服務已重新啟動。"
msgid "The dae service did not start. Check the system log."
msgstr "dae 服務啟動失敗,請查看系統記錄。"
msgid "The dae service did not stop. Check the system log."
msgstr "dae 服務停止失敗,請查看系統記錄。"
msgid "The dae service did not restart. Check the system log."
msgstr "dae 服務重新啟動失敗,請查看系統記錄。"
msgid "The settings could not be written. Check the system log."
msgstr "設定寫入失敗,請查看系統記錄。"
msgid "The operation is not known."
msgstr "未知操作。"
msgid "The dae service reported an issue."
msgstr "dae 服務回報了一個問題。"
msgid "The backend did not confirm the operation."
msgstr "後端沒有確認這次操作。"
msgid "The update was started."
msgstr "更新已開始。"
msgid "Another update is already running."
msgstr "已有更新正在進行。"
msgid "The update script is missing. Reinstall the dae package."
msgstr "更新腳本缺失,請重新安裝 dae 套件。"
msgid "The geo data was updated and dae was restarted."
msgstr "Geo 資料已更新,dae 已重新啟動。"
msgid "The geo data is already up to date."
msgstr "Geo 資料已是最新。"
msgid "The geo data was updated. It takes effect the next time dae starts."
msgstr "Geo 資料已更新,下次啟動 dae 時生效。"
msgid "The download or verification failed. The installed files were left untouched."
msgstr "下載或校驗失敗,已安裝的檔案未變動。"
msgid "The previous update was interrupted."
msgstr "上一次更新被中斷。"
msgid "dae did not come back up after the update; the previous files were restored."
msgstr "更新後 dae 未能啟動,已還原原有檔案。"
msgid "dae is not running and the previous files could not be restored. Check the system log."
msgstr "dae 未執行且原有檔案無法還原,請查看系統記錄。"
msgid "The geoip.dat and geosite.dat files back the geoip: and geosite: rules. dae reads them when it starts, so it is restarted after an update."
msgstr "geoip.dat 與 geosite.dat 是 geoip: 與 geosite: 規則的資料來源。dae 只在啟動時讀取,因此更新後會重新啟動 dae。"
msgid "Panel writes"
msgstr "面板寫入"
msgid "Off — the panel can only read the configuration."
msgstr "關閉 — 面板只能讀取設定。"
msgid "On — the panel can change the configuration, nodes and groups."
msgstr "開啟 — 面板可以修改設定、節點與群組。"
msgid "Allow panel writes"
msgstr "允許面板寫入"
msgid "Stop panel writes"
msgstr "停止面板寫入"
msgid "Configuration, nodes, groups and rules can only be edited in the panel while writes are on."
msgstr "只有在寫入開啟時,才能在面板裡編輯設定、節點、群組與規則。"
msgid "The panel may now change the configuration."
msgstr "面板現在可以修改設定。"
msgid "The panel can only read the configuration now."
msgstr "面板現在只能讀取設定。"
msgid "Apply"
msgstr "套用"
msgid "dae needs a numeric address and a port. Saving restarts the service immediately."
msgstr "dae 需要數值位址和連接埠;儲存後會立即重新啟動服務。"
msgid "Enter a listener address and port."
msgstr "請輸入監聽位址和連接埠。"
msgid "The listener was saved."
msgstr "監聽位址已儲存。"
msgid "The listener was not saved."
msgstr "監聽位址未儲存。"
msgid "The listener was saved and is in effect."
msgstr "監聽位址已儲存並生效。"
msgid "The listener was saved. It takes effect when the service starts."
msgstr "監聽位址已儲存,將在服務啟動時生效。"
msgid "The listener did not change."
msgstr "監聽位址沒有變更。"
msgid "The listener is invalid. Use a numeric address and a port, such as 0.0.0.0:9527."
msgstr "監聽位址無效。請填寫數值位址和連接埠,例如 0.0.0.0:9527。"
msgid "The new listener did not start; the previous address was restored."
msgstr "新監聽位址未能啟動,已還原原位址。"
msgid "The new listener did not start and the previous address could not be restored. Check the system log."
msgstr "新監聽位址未能啟動,且原位址還原失敗。請檢查系統日誌。"
msgid "That port is already in use. Choose another one."
msgstr "該連接埠已被佔用,請換一個連接埠。"
msgid "Confirm"
msgstr "確定"
msgid "Confirm listener"
msgstr "確定"
msgid "Panel address"
msgstr "面板存取位址"
msgid "The address the panel is opened at. Saving restarts the service immediately."
msgstr "面板開啟時使用的位址。儲存後會立即重新啟動服務。"
msgid "Enter the panel address."
msgstr "請輸入面板位址。"
+666
View File
@@ -0,0 +1,666 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only
#
# rpcd backend of the dae LuCI page.
#
# The panel is served by dae itself from /usr/share/doona, so this backend does
# not proxy it. It reports the state of the service, starts and stops the
# daemon, hands out the API secret, and drives the manual geo data update.
. /lib/functions.sh
. /lib/functions/network.sh
. /usr/share/libubox/jshn.sh
# rpcd execs this script with an environment that is not guaranteed to carry
# the usual search path; every command the user starts goes through it.
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH
CONFIG=dae
# Waits are seconds, not tries: the settle below costs two seconds of its own,
# and the LuCI RPC call behind the page times out after 20 seconds by default.
WAIT_START=12
# The manual geo update runs as a background job: the files are up to tens of
# megabytes and would blow that timeout.
GEO_SCRIPT=/usr/bin/dae-geo-update
GEO_STATE=/var/run/dae-geo-update.state
GEO_LOG=/var/log/dae-geo-update.log
# Held by the spawned script through an inherited descriptor; see geo_update.
GEO_START_LOCK=/var/run/dae-geo-update.start.lock
GEO_DIR=/usr/share/v2ray
UI_PATH=/usr/share/doona
DEFAULT_LISTEN=0.0.0.0:9527
LAN_NETWORK=lan
emit_result() {
ok=$1
message=$2
[ "$ok" = true ] && ok=1 || ok=0
json_init
json_add_boolean ok "$ok"
json_add_string message "$message"
json_dump
}
service_running() {
case "$(/etc/init.d/dae status 2>/dev/null)" in
running*) return 0 ;;
esac
return 1
}
# The pid procd has for the instance, or empty when no instance runs. Reading
# the pid instead of the status words makes the wait below reliable: a restart
# that leaves the old process in place for a moment still reports the old pid.
service_pid() {
local pid
pid="$(ubus call service list '{"name":"dae"}' 2>/dev/null |
jsonfilter -e '@.dae.instances.dae.pid' 2>/dev/null)"
case "$pid" in
''|*[!0-9]*) echo "" ;;
*) echo "$pid" ;;
esac
}
# Whether something listens on the given TCP port. /proc/net/tcp is read
# because the image may carry neither ss nor netstat; the state column is 0A
# for LISTEN and the local address ends in the port as four hex digits.
port_listening() {
local port="$1" hex
case "$port" in
''|*[!0-9]*) return 1 ;;
esac
# No proc support: the pid check is all there is, do not block on it.
[ -r /proc/net/tcp ] || return 0
hex="$(printf '%04X' "$port")"
cat /proc/net/tcp /proc/net/tcp6 2>/dev/null |
awk -v suffix=":$hex" '$2 ~ suffix"$" && $4 == "0A" { found = 1 } END { exit !found }'
}
# The port the API is configured for, for the listener check below.
configured_port() {
local listen
config_load "$CONFIG"
config_get listen main api_listen "$DEFAULT_LISTEN"
printf '%s' "${listen##*:}"
}
wait_state() {
local want="$1" tries="$2" i=0
while [ "$i" -lt "$tries" ]; do
if [ "$want" = running ]; then
service_running && return 0
else
service_running || return 0
fi
i=$((i + 1))
[ "$i" -lt "$tries" ] && sleep 1
done
return 1
}
# Waits until the instance runs under a pid other than the one it had before
# the restart. A failed start leaves the old pid gone and no new one, and a
# start that dies at once leaves no pid either, so both are reported as a
# failure instead of as a success that the next status call contradicts.
wait_new_instance() {
local before="$1" budget="$2" port="$3" deadline pid
deadline=$(( $(date +%s) + budget ))
while [ "$(date +%s)" -lt "$deadline" ]; do
pid="$(service_pid)"
if [ -n "$pid" ] && [ "$pid" != "$before" ]; then
# Up is not the same as usable: the daemon binds its listener
# a moment later, and procd respawns one that dies at once.
sleep 2
if [ "$(service_pid)" = "$pid" ] &&
{ [ -z "$port" ] || port_listening "$port"; }; then
return 0
fi
fi
sleep 1
done
return 1
}
# Every IPv4 address the daemon may be reached at, most useful first.
#
# The API answers a wildcard bind only for an IP literal in the Host header, so
# a page opened by name cannot build the address from the browser's own host.
# The addresses are listed instead, with the one of the LAN first, and the page
# picks the candidate it can actually reach.
listen_addresses() {
local lan_device device address found=" " count=0
lan_device="$(network_get_device device "$LAN_NETWORK" 2>/dev/null && echo "$device")"
if [ -n "$lan_device" ]; then
address="$(network_get_ipaddr address "$LAN_NETWORK" 2>/dev/null && echo "$address")"
case "$address" in
''|*[!0-9.]*) address= ;;
esac
if [ -n "$address" ]; then
printf '%s ' "$address"
found="$found$address "
count=$((count + 1))
fi
fi
# Then everything else that is up and carries an IPv4 address.
for device in /sys/class/net/*; do
[ -e "$device" ] || continue
device="$(basename "$device")"
[ "$device" = "lo" ] && continue
[ "$(cat "/sys/class/net/$device/operstate" 2>/dev/null)" = "up" ] || continue
address="$(ip -4 -o addr show dev "$device" 2>/dev/null |
awk '$3 == "inet" { sub(/\/.*/, "", $4); print $4; exit }')"
case "$address" in
''|*[!0-9.]*) continue ;;
esac
case "$found" in
*" $address "*) continue ;;
esac
printf '%s ' "$address"
found="$found$address "
count=$((count + 1))
[ "$count" -ge 8 ] && break
done
printf '\n'
}
status() {
local enabled boot listen port panel_available running addresses lan write panel_host
config_load "$CONFIG"
config_get_bool enabled main enabled 0
config_get listen main api_listen "$DEFAULT_LISTEN"
config_get panel_host main panel_host ""
# The switch the panel's writes depend on: dae refuses every configuration
# write without it, and the panel then shows the whole configuration as
# read-only.
config_get_bool write main api_write 0
port="$(listen_port "$listen")"
case "$port" in
''|*[!0-9]*) port=0 ;;
esac
if service_running; then running=1; else running=0; fi
# Autostart needs both: the UCI switch (the init script refuses to start
# without it) and the rc.d link (the Startup page disables the service by
# removing the links, without touching the UCI bit).
if [ "$enabled" -eq 1 ] && [ -e /etc/rc.d/S99dae ]; then boot=1; else boot=0; fi
if [ -r "$UI_PATH/index.html" ]; then panel_available=1; else panel_available=0; fi
addresses="$(listen_addresses)"
lan="${addresses%% *}"
json_init
json_add_boolean enabled "$enabled"
json_add_boolean boot_enabled "$boot"
json_add_boolean running "$running"
json_add_boolean write "$write"
json_add_string listen "$listen"
json_add_string panel_host "$panel_host"
json_add_int port "$port"
json_add_boolean panel_available "$panel_available"
json_add_string lan_address "$lan"
json_add_array lan_addresses
for lan in $addresses; do
json_add_string "" "$lan"
done
json_close_array
json_dump
}
listen_port() {
echo "${1##*:}"
}
secret() {
local secret
config_load "$CONFIG"
config_get secret main api_secret ""
json_init
json_add_string secret "$secret"
json_dump
}
# enabled=1 is persisted before the daemon is started: the init script refuses
# to start a disabled service, and a start that is not saved would come back
# disabled after a reboot.
set_enabled() {
uci -q set "$CONFIG.main.enabled=1" || return 1
uci -q commit "$CONFIG" || return 1
return 0
}
start() {
if ! set_enabled; then
emit_result false settings_write_failed
return 1
fi
# Starting from this page means "run it from now on": the rc.d links are
# what rc.common runs at boot, and the UCI enabled bit alone starts
# nothing after a reboot. Turning the autostart off is the Startup page's
# job (it runs /etc/init.d/dae disable), not a second switch here.
/etc/init.d/dae enable >/dev/null 2>&1
/etc/init.d/dae start >/dev/null 2>&1
if wait_new_instance "" "$WAIT_START" "$(configured_port)"; then
emit_result true started
else
emit_result false start_failed
fi
}
stop() {
/etc/init.d/dae stop >/dev/null 2>&1
if wait_state stopped 15; then
emit_result true stopped
else
emit_result false stop_failed
fi
}
restart() {
local pid
# Restarting is not enabling: a service the operator disabled stays
# disabled, and the restart then simply fails to bring it up.
pid="$(service_pid)"
/etc/init.d/dae restart >/dev/null 2>&1
if wait_new_instance "$pid" "$WAIT_START" "$(configured_port)"; then
emit_result true restarted
else
emit_result false restart_failed
fi
}
# Parse the panel address a user types into the host and port dae needs.
# Sets PANEL_PROBLEM (empty on success), PANEL_HOST and PANEL_PORT. It runs in
# the caller's shell, not a command substitution, so those assignments survive.
# The bind address stays an implementation detail: loopback stays loopback, any
# other host (LAN IP, router name) binds the wildcard so the typed URL works.
parse_panel_url() {
PANEL_PROBLEM=""
PANEL_HOST=""
PANEL_PORT=""
local url="$1" rest host port inner
case "$url" in
http://*) rest="${url#http://}" ;;
https://*) PANEL_PROBLEM=https_unsupported; return ;;
*://*) PANEL_PROBLEM=scheme_unsupported; return ;;
*) rest="$url" ;;
esac
rest="${rest%%/*}"
rest="${rest%%\?*}"
rest="${rest%%#*}"
case "$rest" in
*:*) host="${rest%:*}"; port="${rest##*:}" ;;
*) PANEL_PROBLEM=no_port; return ;;
esac
case "$port" in
''|*[!0-9]*) PANEL_PROBLEM=port_not_number; return ;;
esac
if [ "$port" -lt 1 ] || [ "$port" -gt 65535 ]; then
PANEL_PROBLEM=port_out_of_range
return
fi
case "$host" in
'') PANEL_PROBLEM=no_host; return ;;
\[*\])
inner="${host#\[}"
inner="${inner%%\]*}"
case "$inner" in
''|*[!0-9a-fA-F:]*) PANEL_PROBLEM=host_not_numeric; return ;;
esac
;;
*:*) PANEL_PROBLEM=ipv6_needs_brackets; return ;;
*)
case "$host" in
*[!A-Za-z0-9.-]*) PANEL_PROBLEM=host_not_numeric; return ;;
esac
;;
esac
PANEL_HOST="$host"
PANEL_PORT="$port"
}
# Save the panel address and apply it by restarting dae, because the API
# listener is bound at startup. A new address that does not come up rolls back
# to the previous one, so a typo cannot leave the panel unreachable.
set_listen() {
local raw value old_listen old_host bind host port problem
raw="$(cat 2>/dev/null)"
value="$(printf '%s' "$raw" | jsonfilter -e '@.url' 2>/dev/null)"
value="$(printf '%s' "$value" | tr -d '\r\n')"
if [ -z "$value" ]; then
emit_result false listen_invalid
return 1
fi
parse_panel_url "$value"
problem="$PANEL_PROBLEM"
if [ -n "$problem" ]; then
logger -t dae "set_listen rejected $value: $problem" 2>/dev/null
emit_result false listen_invalid
return 1
fi
host="$PANEL_HOST"
port="$PANEL_PORT"
case "$host" in
localhost|127.*|\[::1\]) bind="127.0.0.1:$port" ;;
*) bind="0.0.0.0:$port" ;;
esac
config_load "$CONFIG"
config_get old_listen main api_listen "$DEFAULT_LISTEN"
config_get old_host main panel_host ""
if [ "$bind" = "$old_listen" ] && [ "$host" = "$old_host" ]; then
emit_result true listen_unchanged
return 0
fi
# A port another service already listens on would make dae fail to bind, but
# the port check after a restart cannot tell which process owns it. Refuse it
# up front; the current daemon owns the old port.
if [ "$port" != "${old_listen##*:}" ] && port_listening "$port"; then
emit_result false listen_in_use
return 1
fi
uci -q set "$CONFIG.main.api_listen=$bind" || {
emit_result false settings_write_failed
return 1
}
uci -q set "$CONFIG.main.panel_host=$host" || {
emit_result false settings_write_failed
return 1
}
uci -q commit "$CONFIG" || {
emit_result false settings_write_failed
return 1
}
if ! service_running; then
emit_result true listen_saved_stopped
return 0
fi
# A host-only change (router name instead of LAN IP) keeps the same bind:
# the new URL is display state and needs no restart.
if [ "$bind" = "$old_listen" ]; then
emit_result true listen_saved
return 0
fi
pid="$(service_pid)"
/etc/init.d/dae restart >/dev/null 2>&1
if wait_new_instance "$pid" "$WAIT_START" "$port"; then
emit_result true listen_saved
return 0
fi
# The new address did not come up: put the previous bind and host back and
# start into it. A stop first forces the init script to rewrite
# /etc/dae/api.dae; a crash-looping instance keeps the old file otherwise.
/etc/init.d/dae stop >/dev/null 2>&1
uci -q set "$CONFIG.main.api_listen=$old_listen" || {
emit_result false listen_rollback_failed
return 1
}
uci -q set "$CONFIG.main.panel_host=$old_host" || {
emit_result false listen_rollback_failed
return 1
}
uci -q commit "$CONFIG" || {
emit_result false listen_rollback_failed
return 1
}
/etc/init.d/dae start >/dev/null 2>&1
if wait_new_instance "" "$WAIT_START" "${old_listen##*:}"; then
emit_result false listen_restart_failed
else
emit_result false listen_rollback_failed
fi
return 1
}
# Whether the panel may change the configuration. dae reads this switch only
# at startup: the api section is restart-required, so the value is saved and
# the service restarted in one step. Without it every configuration page of
# doona is read-only, which is why the LuCI page offers the switch.
set_write() {
local raw value pid
# rpcd hands the call's parameters to an exec backend on stdin. jsonfilter
# is the normal way to read them; the case below keeps the switch working
# on an image that has none, since the only parameter is one boolean.
raw="$(cat 2>/dev/null)"
value="$(printf '%s' "$raw" | jsonfilter -e '@.value' 2>/dev/null)"
if [ -z "$value" ]; then
case "$raw" in
*'"value":true'*|*'"value":1'*) value=1 ;;
*'"value":false'*|*'"value":0'*) value=0 ;;
esac
fi
case "$value" in
true|1) value=1 ;;
false|0) value=0 ;;
*)
emit_result false invalid_operation
return 1
;;
esac
uci -q set "$CONFIG.main.api_write=$value" || {
emit_result false settings_write_failed
return 1
}
uci -q commit "$CONFIG" || {
emit_result false settings_write_failed
return 1
}
# The switch only takes effect in a new process: the init script rewrites
# /etc/dae/api.dae on every start, so editing the file by hand does not
# survive a restart either.
pid="$(service_pid)"
/etc/init.d/dae restart >/dev/null 2>&1
if ! wait_new_instance "$pid" "$WAIT_START" "$(configured_port)"; then
emit_result false restart_failed
return 1
fi
if [ "$value" = 1 ]; then
emit_result true writes_enabled
else
emit_result true writes_disabled
fi
}
# ---- the geo data update ----------------------------------------------------
#
# The update itself is /usr/bin/dae-geo-update, installed by the dae package.
# It runs as a background job and records its progress in $GEO_STATE, because a
# download of tens of megabytes outlives the RPC timeout.
geo_state_read() {
GEO_STATE_VALUE=idle
GEO_PID=""
GEO_STARTED=0
GEO_FINISHED=0
GEO_MESSAGE=""
[ -f "$GEO_STATE" ] || return 0
while IFS='=' read -r key value; do
case "$key" in
state) GEO_STATE_VALUE="$value" ;;
pid) GEO_PID="$value" ;;
started) GEO_STARTED="$value" ;;
finished) GEO_FINISHED="$value" ;;
message) GEO_MESSAGE="$value" ;;
esac
done < "$GEO_STATE"
case "$GEO_STATE_VALUE" in
running|ok|failed) ;;
*) GEO_STATE_VALUE=idle ;;
esac
case "$GEO_STARTED" in ''|*[!0-9]*) GEO_STARTED=0 ;; esac
case "$GEO_FINISHED" in ''|*[!0-9]*) GEO_FINISHED=0 ;; esac
# A run that was killed outright never wrote its final state. The pid it
# recorded is what tells a live run from a stale record.
if [ "$GEO_STATE_VALUE" = running ]; then
case "$GEO_PID" in
''|*[!0-9]*)
GEO_STATE_VALUE=failed
GEO_MESSAGE=interrupted
;;
*)
kill -0 "$GEO_PID" 2>/dev/null || {
GEO_STATE_VALUE=failed
GEO_MESSAGE=interrupted
}
;;
esac
fi
}
# Stat of one geo file, as a jshn object under the open array.
json_geo_file() {
local name="$1" file="$GEO_DIR/$1" size modified
if [ -f "$file" ]; then
size="$(wc -c < "$file" 2>/dev/null | tr -d ' ')"
modified="$(date -r "$file" +%s 2>/dev/null)"
else
size=""
modified=""
fi
json_add_object ""
json_add_string name "$name"
if [ -n "$size" ]; then
json_add_boolean present 1
json_add_int size "$size"
case "$modified" in ''|*[!0-9]*) modified=0 ;; esac
json_add_int modified "$modified"
else
json_add_boolean present 0
json_add_int size 0
json_add_int modified 0
fi
json_close_object
}
geo_status() {
local log line old_ifs
geo_state_read
json_init
json_add_string state "$GEO_STATE_VALUE"
json_add_int started "$GEO_STARTED"
json_add_int finished "$GEO_FINISHED"
json_add_string message "$GEO_MESSAGE"
json_add_array files
json_geo_file geoip.dat
json_geo_file geosite.dat
json_close_array
# The log is handed over as one entry per line: a single string with
# newlines in it depends on how the JSON writer escapes control
# characters, and an array does not.
log="$(tail -n 20 "$GEO_LOG" 2>/dev/null)"
json_add_array log
old_ifs="$IFS"
IFS='
'
for line in $log; do
json_add_string "" "$line"
done
IFS="$old_ifs"
json_close_array
json_dump
}
geo_update() {
geo_state_read
if [ "$GEO_STATE_VALUE" = running ]; then
emit_result false geo_busy
return 1
fi
if [ ! -x "$GEO_SCRIPT" ]; then
emit_result false geo_unavailable
return 1
fi
# The state file is only written once the script is running, so two calls
# arriving together both saw "idle" and both spawned a script; the second
# one was then silently dropped by the script's own lock while the reply
# still said "started". This lock closes that window: the script inherits
# the open descriptor, so the lock stays held for its whole lifetime and
# a second call fails here with a truthful "busy".
exec 8>"$GEO_START_LOCK" 2>/dev/null || {
emit_result false geo_unavailable
return 1
}
if ! flock -n 8; then
emit_result false geo_busy
return 1
fi
# No wait here: the script takes the lock, writes its state and does the
# work on its own. The page polls geo_status for the progress.
#
# The update has to outlive this process: rpcd exits as soon as the reply
# is written. setsid puts it in a session of its own (busybox has it, and
# ImmortalWrt does not ship nohup); without it the daemonising shell would
# take the child down with it on some images. Descriptor 8 is inherited on
# purpose; the script uses descriptor 9 for its own lock.
if command -v setsid >/dev/null 2>&1; then
setsid "$GEO_SCRIPT" </dev/null >/dev/null 2>&1 &
else
"$GEO_SCRIPT" </dev/null >/dev/null 2>&1 &
fi
emit_result true geo_started
}
# rpcd runs an exec backend in a fixed protocol: it asks the script for its
# methods with the "list" argument and reaches a method with "call <method>".
case "$1" in
list)
echo '{"status":{},"secret":{},"start":{},"stop":{},"restart":{},"set_listen":{"url":""},"set_write":{"value":0},"geo_status":{},"geo_update":{}}'
;;
call)
case "$2" in
status) status ;;
secret) secret ;;
start) start ;;
stop) stop ;;
restart) restart ;;
set_listen) set_listen ;;
set_write) set_write ;;
geo_status) geo_status ;;
geo_update) geo_update ;;
*) emit_result false invalid_operation ;;
esac
;;
*)
exit 2
;;
esac
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
@@ -0,0 +1,17 @@
{
"admin/services/dae": {
"title": "dae",
"order": 30,
"action": {
"type": "firstchild"
}
},
"admin/services/dae/panel": {
"title": "Panel",
"order": 10,
"action": {
"type": "view",
"path": "dae/panel"
}
}
}
@@ -0,0 +1,26 @@
{
"luci-app-dae-admin": {
"description": "Grant control over the dae service",
"read": {
"ubus": {
"dae": [
"status",
"secret",
"geo_status"
]
}
},
"write": {
"ubus": {
"dae": [
"start",
"stop",
"restart",
"set_listen",
"set_write",
"geo_update"
]
}
}
}
}
@@ -0,0 +1,10 @@
{
"luci-app-dae-read": {
"description": "Grant read-only access to the dae service state",
"read": {
"ubus": {
"dae": [ "status", "geo_status" ]
}
}
}
}
-104
View File
@@ -1,104 +0,0 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:30
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:63
msgid "Collecting data…"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:71
msgid "Configration file"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:13
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:24
msgid "Configuration"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:69
msgid "Enable"
msgstr ""
#: applications/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae.json:3
msgid "Grant access to dae configuration"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:14
msgid ""
"Here you can edit dae configuration. It will be hot-reloaded automatically "
"after apply."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:28
msgid "Loading..."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:77
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:32
msgid "Log"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:46
msgid "Log file does not exist."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:37
msgid "Log is empty."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:76
msgid "Max log backups"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:81
msgid "Max log size"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
msgid "NOT RUNNING"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
msgid "RUNNING"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:83
msgid "Refresh every %s seconds."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:69
msgctxt "scroll to top (the head) of the log file"
msgid "Scroll to head"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:60
msgctxt "scroll to bottom (the tail) of the log file"
msgid "Scroll to tail"
msgstr ""
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:16
msgid "Settings"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:77
msgid "The maximum number of old log files to retain."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:82
msgid "The maximum size in megabytes of the log file before it gets rotated."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:50
msgid "Unknown error: %s"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:49
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:3
msgid "dae"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:50
msgid "eBPF-based Linux high-performance transparent proxy solution."
msgstr ""
-1
View File
@@ -1 +0,0 @@
zh_Hans
-111
View File
@@ -1,111 +0,0 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh-Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:30
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:63
msgid "Collecting data…"
msgstr "正在收集数据中…"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:71
msgid "Configration file"
msgstr "配置文件"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:13
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:24
msgid "Configuration"
msgstr "配置"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:69
msgid "Enable"
msgstr "启用"
#: applications/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae.json:3
msgid "Grant access to dae configuration"
msgstr "授予访问 dae 配置的权限"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:14
msgid ""
"Here you can edit dae configuration. It will be hot-reloaded automatically "
"after apply."
msgstr "您可以在此处修改 dae 配置文件。应用后会自动热重载。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:28
msgid "Loading..."
msgstr "加载中..."
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:77
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:32
msgid "Log"
msgstr "日志"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:46
msgid "Log file does not exist."
msgstr "日志文件不存在。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:37
msgid "Log is empty."
msgstr "日志为空"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:76
msgid "Max log backups"
msgstr "最大日志备份"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:81
msgid "Max log size"
msgstr "最大日志大小"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
msgid "NOT RUNNING"
msgstr "未运行"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
msgid "RUNNING"
msgstr "运行中"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:83
msgid "Refresh every %s seconds."
msgstr "每 %s 秒刷新。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:69
msgctxt "scroll to top (the head) of the log file"
msgid "Scroll to head"
msgstr "滚动到顶部"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:60
msgctxt "scroll to bottom (the tail) of the log file"
msgid "Scroll to tail"
msgstr "滚动到尾部"
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:16
msgid "Settings"
msgstr "设置"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:77
msgid "The maximum number of old log files to retain."
msgstr "要保留的最大旧日志文件数量。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:82
msgid "The maximum size in megabytes of the log file before it gets rotated."
msgstr "要保留的最大日志大小(单位:MB)。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:50
msgid "Unknown error: %s"
msgstr "未知错误:%s"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:49
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:3
msgid "dae"
msgstr "dae"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:50
msgid "eBPF-based Linux high-performance transparent proxy solution."
msgstr "基于 eBPF 的 Linux 高性能透明代理解决方案。"
@@ -1,39 +0,0 @@
{
"admin/services/dae": {
"title": "dae",
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-dae" ],
"fs": {
"/etc/init.d/dae": "executable"
},
"uci": { "dae": true }
}
},
"admin/services/dae/settings": {
"title": "Settings",
"order": 10,
"action": {
"type": "view",
"path": "dae/settings"
}
},
"admin/services/dae/config": {
"title": "Configuration",
"order": 20,
"action": {
"type": "view",
"path": "dae/config"
}
},
"admin/services/dae/log": {
"title": "Log",
"order": 30,
"action": {
"type": "view",
"path": "dae/log"
}
}
}
@@ -1,23 +0,0 @@
{
"luci-app-dae": {
"description": "Grant access to dae configuration",
"read": {
"file": {
"/etc/dae/config.dae": [ "read" ],
"/etc/dae/example.dae": [ "read" ],
"/var/log/dae/dae.log": [ "read" ],
"/etc/init.d/dae hot_reload": [ "exec" ]
},
"ubus": {
"service": [ "list" ]
},
"uci": [ "dae" ]
},
"write": {
"file": {
"/etc/dae/config.dae": [ "write" ]
},
"uci": [ "dae" ]
}
}
}
+7 -9
View File
@@ -1,15 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2023 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-daed
PKG_VERSION:=1.4
PKG_RELEASE:=3
LUCI_TITLE:=LuCI Support for DAED
LUCI_DEPENDS:=+daed +zoneinfo-asia +luci-compat
LUCI_TITLE:=LuCI app for dae dashboard
LUCI_DEPENDS:=+daed +daed-geoip +daed-geosite
LUCI_PKGARCH:=all
define Package/$(PKG_NAME)/conffiles
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -15,32 +15,42 @@ const callServiceList = rpc.declare({
});
function getServiceStatus() {
return L.resolveDefault(callServiceList('dae'), {}).then(function(res) {
return L.resolveDefault(callServiceList('daed'), {}).then(function(res) {
let isRunning = false;
try {
isRunning = res['dae']['instances']['dae']['running'];
isRunning = res['daed']['instances']['daed']['running'];
} catch (e) { }
return isRunning;
});
}
function renderStatus(isRunning) {
function renderStatus(isRunning, port) {
let spanTemp = '<span style="color:%s"><strong>%s %s</strong></span>';
let renderHTML;
if (isRunning)
renderHTML = spanTemp.format('green', _('dae'), _('RUNNING'));
else
renderHTML = spanTemp.format('red', _('dae'), _('NOT RUNNING'));
if (isRunning) {
let button = String.format('&#160;<a class="btn cbi-button" href="http://%s:%s" target="_blank" rel="noreferrer noopener">%s</a>',
window.location.hostname, port, _('Open Web Interface'));
renderHTML = spanTemp.format('green', _('daed'), _('RUNNING')) + button;
} else {
renderHTML = spanTemp.format('red', _('daed'), _('NOT RUNNING'));
}
return renderHTML;
}
return view.extend({
render() {
let m, s, o;
load() {
return Promise.all([
uci.load('daed')
]);
},
m = new form.Map('dae', _('dae'),
_('eBPF-based Linux high-performance transparent proxy solution.'));
render(data) {
let m, s, o;
let webport = (uci.get(data[0], 'config', 'address') || '0.0.0.0:2023').split(':').slice(-1)[0];
m = new form.Map('daed', _('daed'),
_('A modern dashboard for dae.'));
s = m.section(form.TypedSection);
s.anonymous = true;
@@ -48,33 +58,35 @@ return view.extend({
poll.add(function() {
return L.resolveDefault(getServiceStatus()).then(function(res) {
let view = document.getElementById('service_status');
view.innerHTML = renderStatus(res);
view.innerHTML = renderStatus(res, webport);
});
});
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
E('p', { id: 'service_status' }, _('Collecting data…'))
E('p', { id: 'service_status' }, _('Collecting data…'))
]);
}
s = m.section(form.NamedSection, 'config', 'dae');
s = m.section(form.NamedSection, 'config', 'daed');
o = s.option(form.Flag, 'enabled', _('Enable'));
o.default = o.disabled;
o.rmempty = false;
o = s.option(form.Value, 'config_file', _('Configration file'));
o.default = '/etc/dae/config.dae';
o = s.option(form.Value, 'listen_addr', _('Listening address'));
o.datatype = 'ipaddrport(1)';
o.default = '0.0.0.0:2023';
o.rmempty = false;
o.readonly = true;
o = s.option(form.Value, 'log_maxbackups', _('Max log backups'),
_('The maximum number of old log files to retain.'));
o.datatype = 'uinteger';
o.placeholder = '1';
o.default = '1';
o = s.option(form.Value, 'log_maxsize', _('Max log size'),
_('The maximum size in megabytes of the log file before it gets rotated.'));
o.datatype = 'uinteger';
o.placeholder = '1';
o.default = '5';
return m.render();
}
@@ -31,7 +31,7 @@ return view.extend({
);
poll.add(L.bind(function() {
return fs.read_direct('/var/log/dae/dae.log', 'text')
return fs.read_direct('/var/log/daed/daed.log', 'text')
.then(function(content) {
let log = E('pre', { 'wrap': 'pre' }, [
content.trim() || _('Log is empty.')
-34
View File
@@ -1,34 +0,0 @@
local sys = require "luci.sys"
local http = require "luci.http"
module("luci.controller.daed", package.seeall)
function index()
if not nixio.fs.access("/etc/config/daed") then
return
end
entry({"admin", "services", "daed"}, alias("admin", "services", "daed", "setting"),_("DAED"), 58).dependent = true
entry({"admin", "services", "daed", "setting"}, cbi("daed/basic"), _("Base Setting"), 1).leaf=true
entry({"admin", "services", "daed", "daed"}, template("daed/daed"), _("Dashboard"), 2).leaf = true
entry({"admin", "services", "daed", "log"}, cbi("daed/log"), _("Logs"), 3).leaf = true
entry({"admin", "services", "daed_status"}, call("act_status"))
entry({"admin", "services", "daed", "get_log"}, call("get_log")).leaf = true
entry({"admin", "services", "daed", "clear_log"}, call("clear_log")).leaf = true
end
function act_status()
local sys = require "luci.sys"
local e = { }
e.running = sys.call("pidof daed >/dev/null") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
function get_log()
http.write(sys.exec("cat /var/log/daed/daed.log"))
end
function clear_log()
sys.call("true > /var/log/daed/daed.log")
end
@@ -1,35 +0,0 @@
local m, s ,o
m = Map("daed")
m.title = translate("DAED")
m.description = translate("DAE is a Linux high-performance transparent proxy solution based on eBPF, And DAED is a modern dashboard for dae.")
m:section(SimpleSection).template = "daed/daed_status"
s = m:section(TypedSection, "daed", translate("Global Settings"))
s.addremove = false
s.anonymous = true
o = s:option(Flag,"enabled",translate("Enable"))
o.default = 0
o = s:option(Value, "log_maxbackups", translate("Logfile retention count"))
o.default = 1
o = s:option(Value, "log_maxsize", translate("Logfile Max Size (MB)"))
o.default = 5
o = s:option(Value, "listen_addr",translate("Set the DAED listen address"))
o.default = '0.0.0.0:2023'
o = s:option(Value, "dashboard_port", translate("Dashboard Access Port"))
o.placeholder = translate("Leave empty to use listen port")
o.datatype = "range(1,65535)"
o.description = translate("For reverse proxy scenarios, leave empty to use the port from listen address")
m.apply_on_parse = true
m.on_after_apply = function(self,map)
luci.sys.exec("/etc/init.d/daed restart")
end
return m
@@ -1,5 +0,0 @@
m = Map("daed")
m:append(Template("daed/daed_log"))
return m
-56
View File
@@ -1,56 +0,0 @@
<%+header%>
<%
local running = luci.sys.exec("pgrep -x /usr/bin/daed")
%>
<% if tonumber(running) ~= nil then %>
<div class="cbi-map">
<iframe id="daed" class="daed-iframe"></iframe>
</div>
<style>
.daed-iframe {
width: 100%;
height: 100vh;
min-height: 780px;
border: none;
border-radius: .375rem;
box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;
display: block;
}
</style>
<script type="text/javascript">
var listenAddr = "<%=luci.model.uci.cursor():get_first("daed", "daed", "listen_addr") or ''%>";
var dashboardPort = "<%=luci.model.uci.cursor():get_first("daed", "daed", "dashboard_port") or ''%>";
var port = "";
if (dashboardPort && dashboardPort.trim() !== "") {
port = dashboardPort.trim();
} else {
var portRegex = /:(\d+)/;
var match = listenAddr.match(portRegex);
if (match && match[1]) {
port = match[1];
}
}
if (port) {
var protocol = window.location.protocol;
var hostname = window.location.hostname;
var url = protocol + "//" + hostname;
if (!((protocol === "http:" && port === "80") || (protocol === "https:" && port === "443"))) {
url += ":" + port;
}
document.getElementById("daed").src = url;
}
</script>
<% else %>
<style>.notrunning{text-align: center;} h1{font-size: 25px; color: #333; margin-bottom: 16px;} p{font-size: 18px; color: #666; margin-bottom: 24px;}</style>
<div class="notrunning">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAAAXNSR0IArs4c6QAAIABJREFUeF7sfQd0VcX2/p5Tbu/pjdC7lNBBgqh0EFBEfCj4QEBUUKRIUZGiKHYRVEBQUB+KgkgH6V0UkBYgQEgC6cnt99xT57/m3HtjQEoo+vT9/mctykpOmTPzzZ5vf3vPPgj+Bgfea64LilwbAFcHoKqAAomAlFgAFAWAbABgAgx6ANAAAvpv0OT/S02QAUAAAA4AfBjAhQBKAUORQkEeBZADgM8DRZ9Bbb2n/tsdg/7qBuA91hqApbsVBbVGCDdHAI0BgAUMAJHWkP8DAEbkRzjyn7+6qf/nnxcakop/q6MCODxQKDI04fECBCIA/AYY/QIU3g+I2Y3auc/9lR35lwAa7zTeBwA9AUFXwFC3HLih/vkdyH/lm/8fetZf1sV/eJD6g1OAYQMArEHp/i1/drf/aYDGu00NQMGDAMGjAJDy/7H7Zw/lte9PYIUxJVNIof5y81EB5BggFwH8BxBagu72nfgzeuSOAxrvNnYCQM9gjHtHGnzHH3IHe+Lq1iu0rP6d233TXaC+UojE/VePCD2h0CoAPBfd7d98J9tzx94O7zClA4UnAeCu//VOq0QPRfqVnIpIL7BY/Y8KcCFMDitxn3LKVOGGfwPYVKbl/71zfufcpA0bQEGzUAffzjvRoNsGNN5mjgYNngUyflJt0G3f8U68ViXuQTBLmqsDAAMC7MeizAFLsyAjA6JVf/5aR/mAhIHPht5bvZ8U9gtu4B6Uu1oE/Wq/XYPp/mUEuBJ9dqdPqej8I7QQRDQJdfSW3M5jbgt+eLfxXxjD+wAQ80/CMkGeggAoCwKQsDD3K9n39jKRLnNhq14Hga+n6qR776Us2BXq8XKsRcBFmCj5wwCAniIEVQafgjCNMNIjGpPJQPz9iEpzlVmOaQCkAQAaAZAVQazgHxNhktxfAQAyQf5P+M4qJypGCJ5Hd/u/vlVQ3zKg8S7jB4Bh9HWty6226k+8ToUoAZoeIPss9vWcxEvHzytWlW+Qn2MMGg3lD2zWUZQB9DgIgAhwiRUm4CP/EuwpgMGFhTV7peCXmxW047CsNRuQNP5frDDsccYGAUxhPvysiCUiQ0buZaIIWDFfirkyL+YT4pAJLIgGhCh19kggg4AxMAiBAjT2KoBUXvQ/fESMRejfD1F7/3O38rY33UsqxaCVrwBB51t54H//mhBXBhuCme+LRS8v5GMAKEQRi0iMIrGKCPMHPtEFWran7cRCYgQKX6RwhaXAHjwtBQ5mALvvOA6evCAbS72YRRhoDBQQ9GEE8jMPsq6PZmjt4FYoLIVYGMYYkBYBmJHy00bZ++ZXIvo5Q9F4/CBViUdwdyNKrJdK2ci0OpOjuA9kKELtJAQLJmkMcVUpI3aG1d+bHrH/fo/fXAvCyMawCWRq4M1SkJvqnnBQZCVguOufTu0wS/gzJXUeEfRtPiDZCKKJS6gCGjB/bIlOaNiBNh36Sfa8/qWkrN8vs4Eg1gJWI5WUClIyMbACDMPIOp3O7/f5LWooAmHxp/d0/vs60TYoC5tnYtnNSB79iuCas0K0AgYm5I2GKA1W/wqDP+yKkCvtJuTJWamjjNGUCam8/p/e8zeGd7mxRnAMIabvzQRnKg1oAmasSOsBoFalL7px2/+cM64XXIw4gwwArkpBxhbZ02AQpwNMaSgKAw7hTx73KOs8kikzPx2UjSENJKx4hQ28ikUV1SEOQwQSTCCOAWQFQ91Uypnxo94EHGZVHhyF4L2PhdIX5og2wIiOrAgReq0+t4L3H7Lq5KYKdG9DO9fO19nAqyCQbuBE/jk9+pffVQV1CNmZQDHdKgvqSmFTpRmsspVY5r/8zSr1wMsJmHoJoRAR8EY4LAEjsa9GBECDnH9W8U1ZKMLnayULIanE7EYwpYSRTTgETfy+8rB8GMXlYP69gZEfha28cO4bvVC9DmXCMgauFALGLhwZJKKh/P6gMKcvf7Cqf5OpEaZAMoDBAH7fPj0Ag4zIGX6pEJO/OVWpolx2s9dWahzu7EnlzUVwDETq3srQj8oBeqdhIyDU+W/dB2EOrI6zAYUUBPJ2hELwGLBAHEEEYAAoPK34/j1TkNb/LBtIwhMV8gfDOQqhblRwyAdUgRXp2UqMl/pIgjmM8VtPa13jnmPsIAO8NVdyTpjH2wiBV+9biXup76LeC8njB9Ku2c+yRrBROvApQJzV0Fwo55yXgbt8rCr+mvxf7afQElbBClayNf/F0zBsQun+LjdqwQ0BLe8yfkARNUM98++bKCRKgFk7RsDQOP+sEli9RwxmZGOok0KjRzvRBks80pTkKtyC1bL40nxRgwEbQlSB/LkKvEIk+XIeUAHy5Qb7yh4ut6wYGtdkPEdWaQllgXsG8tzOI5JJRXPEut5odMK/x0ooJcioR9zkQUxw8lOsAfRICy4MWLyM+YQmsgygOqOR+FBkZTIhkq8Y+r0Xh865SSNfySbf8dPC8/KG6sd1AU10ZsDwlTrcRDcl1q6ypuWOv9J1bqgDKMrHvq83yaUHzyj2rzfLLGCsC8MR67VITIlB+MxFlajqyDBSIbcuJOFVWMX/8JQKPJnwWdXIETWNmOEIwNVeDDt44d/L6q+xcHGlXkqqRmmt7QJ+rx8sKq+5hU5ULXXYZDeoitxzXtDiezrQJmCAQRwh7iFNHPsVHjHAgggUlsKEXwuATBSc/EVy/+cnmbGaEH5hAKOjWGBUfv+3XnorjEhohRl4PZ36moBWeTOjnCRBE/V9acBgwAj8iDj25ccNTfyfDWwy0GTAEEgxXeTiUqcShUHUqACjQpMwNF7hv8mPw/z6uk0LA51waSK5RRzACoYbI0C8yWyQvV4/iTeqedqXwxXB3LFs6dMDWLOmLUeLItDUlfy5sv0TsfxKSCsn8mBabcr75lMsdU9TWsfEIbRhneQbPlvQNqpBB9e8w5pI6IZMa0SDOPktwTtrqUgolg4Ay9OGaJ2vjGOjVRXm72ikrt0vxSBR9a/Fp68N6D2mBaCEw9lmBN+ukvPKXBzz1AhDLJRRQGb/30HrV2FKOKkdwQefiO4xcwQzQhQxoiHnqoIJrviy1x7D3yGpEO8ujGCaosR+/R5y7dm3T66ammoe9ewo5d777g38evjX4NHfjpoyz5yRtFpdjFarKVy8+At7WVkpscWaCQNAfOZhnS/1Id6EEWJVA32LR0WaQxYIFdiAsUFHcbWTKXTkrEIDKBoERm/pRi1lr84bwQdCj2cEz7q9EtksEV5GsPTtdK334d6MHTwkbPoP4R0Rqkajhaidb9jVuvGq3RtKNFJ2hGO3AHYM85dA3og5NVzznz6W+uQIgxEVE54W4Z+3MUqVGNzIinjlv5FL1Z8TG6kAb7+fE11eMKlW+GZW9wg/UVSQREJ8Sp/efYo7drxH7tq1G65du7bu4sVcISk5JQ6FIinlCe8oFOwmcUDCYJTcnJyi0c+N5SnfEYu37Bz90yFsQTQJBF6TfVeiJ648JUJ9wiNN/AGsAKU1+6Wdehabfaj9I4Jv7zHZTiY26RNClXq0ZVxrFugsauBHruBY3kILbvWS22I5Kp1DHa6W0HR1QO8yEr25q9pN5AyLDB8v4t1i/Q1Z8z953z60+froMeONRigO5Rr8FZZaXfUJSImLFSDxjCsSPMlLxlHw0ceCa9T7ghVdIcNdv+NDaMYK4chql4ht2rTmP/zww9LmzZvTADgprIqGtBSCWAIcdRkIrQOqgwkARYWFrtKyMqhXr54WAGvK3EJJvfqNtMV5Z2yRnR4h/n77x9XmK6FIMVHmvF/nA/XYdL9h5xGFSJIhMBPwIsS5NmhlSzxlwu7/3iqrZiTeHtXZgNr7u/1xil/xEzWfWYFNFfNpsBXDoi8CJRej5pWNHzNSGxVXl5316GnT8+ONFihGgMWwc3X7Y3Rla8q3+xCGKvEg7z9Fudo3UBxAq5Hm8kOFFNl1GATO2CkoBzhsKnf8KtEuAlDAIE6YMMHbu/cDfNu27aIA1BSi8B5GEkUst91/uCNFUSBJoux0uf2yJGoMeoNgsVoIj1UUBfObNm7093qgFytJsp2cG5kGlWhapU+JAJxlEM+LWCJshCCYCCthKRFG9WOdH76msUNJiGrclqWsdMsqnBjWChUFKRQiq9yttSBMNTtfmU/9B1OBd5t+AKz0/l3UxAAmBNu2+vnZWx72rl/7LZtX4OLv7tADD2u7Vz9pksECLhqwoNzxzFG10WQRDy/mGIMy+gNN/quDxfioOEwDSf6JgDrkAQNEI5jxtlT2ykLeEZLkrtfrv1vmmLjY4JdLvyzt1Ol+HWAURTq6PLYS/s/Vuj7yMwLSclkz/EhFkRVJkgRASMnJyS6JjYlDL058EX/yyadVyP0pdcm58wdxYjGmAFHlu/9CqgwCzrNer5jjkPG66bF3vkmX3xEBOD3AW4yYpWlE3QqHV/udQqtQO1+fije/bLjVbVMYH//DvNUDXMzyy+3GVsk/eSrLaNRTdgzAVanZ3t+3/m7mwzf1VhygEQTCS9itTbo/vDRRyQSJErWMQtTTkI6ggKKyVyPRYBECkg0XWbqIc2hEwDtxwN6dg6AAhtDqfm0yTWiGIyqqdM+evYE6dWqnqHQi4gxeY2ArcvkI7Yg8gVxLxkiSxCDDskwoZwPA4/H4LRaLZt/+/ZeGDhliycjIcIQmwR0+Ig2psKSHJEQFxg7QON9+NWydb2+5v41Gh3cDRdp5q1iJtJ9CDStu57oM0PIu45sIYMIfjBqBk8TLTQYrgS9X5/AN6yZFE0CT8xq37husKv8gr/pM6wCFpcAblrhu65VDfFmRkJJdoiurFsdFq7cjL2EBOHcKBwdMZbyTByl0n27YgfzhBGdyCpHqoikYO5V3vfuNaFMzMq8ka+UOoKore9auXevp3r17PAEfSRIioeo/LLine truncated
<h1><font color="color:red"><%:DAED is not running%></font></h1>
<p><%:Please start the DAED service first and try again%></p>
</div>
<% end -%>
<%+footer%>
@@ -1,33 +0,0 @@
<script type="text/javascript">
//<![CDATA[
function clear_log(btn) {
XHR.get('<%=url([[admin]], [[services]], [[daed]], [[clear_log]])%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');
log_textarea.innerHTML = "";
log_textarea.scrollTop = log_textarea.scrollHeight;
}
location.reload();
}
);
}
var scrolled = false;
XHR.poll(2, '<%=url([[admin]], [[services]], [[daed]], [[get_log]])%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');
log_textarea.innerHTML = x.responseText;
if (!scrolled) {
log_textarea.scrollTop = log_textarea.scrollHeight;
scrolled = true;
}
}
}
);
//]]>
</script>
<fieldset class="cbi-section" id="_log_fieldset">
<input class="cbi-button cbi-input-remove" type="button" onclick="clear_log()" value="<%:Clear logs%>" style="margin-left: 10px; margin-top: 10px;">
<textarea id="log_textarea" class="cbi-input-textarea" style="width: calc(100% - 20px); height: 645px; margin: 10px;" data-update="change" rows="5" wrap="off" readonly="readonly"></textarea>
</fieldset>
@@ -1,24 +0,0 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[daed_status]])%>', null,
function(x, data) {
var tb = document.getElementById('daed_status');
if (data && tb)
{
if (data.running)
{
tb.innerHTML = '<em><b style=\"color:green\"><%:DAED%> <%:RUNNING%></b></em>';
}
else
{
tb.innerHTML = '<em><b style=\"color:red\"><%:DAED%> <%:NOT RUNNING%></b></em>';
}
}
}
);
//]]></script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="daed_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>
+97
View File
@@ -0,0 +1,97 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:53
msgid "A modern dashboard for dae."
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:66
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:30
msgid "Collecting data…"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:72
msgid "Enable"
msgstr ""
#: applications/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json:3
msgid "Grant access to daed configuration"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:76
msgid "Listening address"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:28
msgid "Loading..."
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:77
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:22
msgid "Log"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:46
msgid "Log file does not exist."
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:37
msgid "Log is empty."
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:81
msgid "Max log backups"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:86
msgid "Max log size"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
msgid "NOT RUNNING"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:32
msgid "Open Web Interface"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
msgid "RUNNING"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:83
msgid "Refresh every %s seconds."
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:69
msgctxt "scroll to top (the head) of the log file"
msgid "Scroll to head"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:60
msgctxt "scroll to bottom (the tail) of the log file"
msgid "Scroll to tail"
msgstr ""
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:14
msgid "Settings"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:82
msgid "The maximum number of old log files to retain."
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:87
msgid "The maximum size in megabytes of the log file before it gets rotated."
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:50
msgid "Unknown error: %s"
msgstr ""
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:52
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:3
msgid "daed"
msgstr ""
+82 -46
View File
@@ -1,68 +1,104 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh-Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "DAED"
msgstr "DAED"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:53
msgid "A modern dashboard for dae."
msgstr "dae 现代化控制面板。"
msgid "DAE is a Linux high-performance transparent proxy solution based on eBPF, And DAED is a modern dashboard for dae."
msgstr "DAE是一个基于eBPF的Linux高性能透明代理解决方案,而DAED是DAE的管理面板。"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:66
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:30
msgid "Collecting data…"
msgstr "正在收集数据中…"
msgid "Base Setting"
msgstr "基本设置"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:72
msgid "Enable"
msgstr "启用"
msgid "Dashboard"
msgstr "仪表板"
#: applications/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json:3
msgid "Grant access to daed configuration"
msgstr "授予访问 daed 配置的权限"
msgid "Logs"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:76
msgid "Listening address"
msgstr "监听地址"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:28
msgid "Loading..."
msgstr "加载中..."
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:77
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:22
msgid "Log"
msgstr "日志"
msgid "Clear logs"
msgstr "清空日志"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:46
msgid "Log file does not exist."
msgstr "日志文件不存在。"
msgid "RUNNING"
msgstr "运行中"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:37
msgid "Log is empty."
msgstr "日志为空"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:81
msgid "Max log backups"
msgstr "最大日志备份"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:86
msgid "Max log size"
msgstr "最大日志大小"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Collecting data..."
msgstr "收集数据..."
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:32
msgid "Open Web Interface"
msgstr "打开 Web 界面"
msgid "Logfile retention count"
msgstr "日志文件保留数量"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
msgid "RUNNING"
msgstr "运行中"
msgid "Logfile Max Size (MB)"
msgstr "日志文件大小(MB)"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:83
msgid "Refresh every %s seconds."
msgstr "每 %s 秒刷新。"
msgid "Set the DAED listen address"
msgstr "设置监听地址"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:69
msgctxt "scroll to top (the head) of the log file"
msgid "Scroll to head"
msgstr "滚动到顶部"
msgid "Dashboard Access Port"
msgstr "仪表板访问端口"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:60
msgctxt "scroll to bottom (the tail) of the log file"
msgid "Scroll to tail"
msgstr "滚动到尾部"
msgid "Leave empty to use listen port"
msgstr "留空则使用监听端口"
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:14
msgid "Settings"
msgstr "设置"
msgid "For reverse proxy scenarios, leave empty to use the port from listen address"
msgstr "用于反向代理场景,留空则使用监听地址的端口"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:82
msgid "The maximum number of old log files to retain."
msgstr "要保留的最大旧日志文件数量。"
msgid "DAED is not running"
msgstr "DAED 未运行"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:87
msgid "The maximum size in megabytes of the log file before it gets rotated."
msgstr "要保留的最大日志大小(单位:MB)。"
msgid "Please start the DAED service first and try again"
msgstr "请先启动 DAED 服务后重试"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:50
msgid "Unknown error: %s"
msgstr "未知错误:%s"
msgid "Enable Auto Subscribe Update"
msgstr "启用订阅自动更新"
msgid "Update Cycle"
msgstr "更新周期"
msgid "Update Time (Every Day)"
msgstr "更新时间(每天)"
msgid "Username"
msgstr "用户名"
msgid "Password"
msgstr "密码"
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:52
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:3
msgid "daed"
msgstr "daed"
@@ -1,31 +0,0 @@
#!/bin/sh
[ "$ACTION" = "ifup" ] || [ "$ACTION" = "ifupdate" ] || exit 0
[ "$ACTION" = "ifupdate" ] && [ -z "$IFUPDATE_ADDRESSES" ] && [ -z "$IFUPDATE_DATA" ] && exit 0
UPTIME=$(cut -d. -f1 /proc/uptime 2>/dev/null)
[ -n "$UPTIME" ] && [ "$UPTIME" -lt 30 ] && exit 0
. /lib/functions/network.sh
network_find_wan6 NET_IF6
network_find_wan NET_IF
[ "$INTERFACE" != "$NET_IF6" ] && [ "$INTERFACE" != "$NET_IF" ] && exit 0
[ "$(uci -q get daed.config.enabled)" = "1" ] || exit 0
DEBOUNCE_FILE="/tmp/run/daed_hotplug_gen"
mkdir -p /tmp/run
my_gen="$$.$(date +%s)"
echo "$my_gen" > "$DEBOUNCE_FILE"
(
sleep 5
[ "$(cat "$DEBOUNCE_FILE" 2>/dev/null)" = "$my_gen" ] || exit 0
if /etc/init.d/daed running; then
/etc/init.d/daed restart
else
/etc/init.d/daed start
fi
) &
-89
View File
@@ -1,89 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2023 Tianling Shen <cnsztl@immortalwrt.org>
USE_PROCD=0
START=98
CONF="daed"
PROG="/usr/bin/daed"
LOG="/var/log/daed/daed.log"
RESOLV_DAED="/tmp/resolv.conf.daed"
update_cron() {
local temp_cron="/tmp/root.cron"
if [ -f /etc/crontabs/root ]; then
grep -v '/etc/daed/daed_sub.sh' /etc/crontabs/root > "$temp_cron" 2>/dev/null
fi
: >> "$temp_cron"
local auto_update
auto_update=$(uci -q get daed.config.subscribe_auto_update)
if [ "$1" = "add" ] && [ "${auto_update:-0}" -eq 1 ]; then
local min=$((RANDOM % 60))
local hr=$(uci -q get daed.config.subscribe_update_day_time)
local wk=$(uci -q get daed.config.subscribe_update_week_time)
echo "$min ${hr:-*} * * ${wk:-*} /etc/daed/daed_sub.sh >/dev/null 2>&1" >> "$temp_cron"
fi
crontab "$temp_cron" 2>/dev/null
rm -f "$temp_cron"
}
hijack_resolv_conf() {
grep -q ' /tmp/resolv\.conf ' /proc/mounts && return 0
grep -E '^(search|domain) ' /tmp/resolv.conf > "$RESOLV_DAED" 2>/dev/null
local dns_list LOGICAL_WAN
. /lib/functions/network.sh
network_find_wan LOGICAL_WAN 2>/dev/null
if [ -n "$LOGICAL_WAN" ]; then
dns_list=$(ubus call "network.interface.$LOGICAL_WAN" status 2>/dev/null | \
jsonfilter -e '@["dns-server"][*]' 2>/dev/null)
fi
if [ -z "$dns_list" ] && [ -f "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
dns_list=$(awk '/^nameserver/{print $2}' "/tmp/resolv.conf.d/resolv.conf.auto")
fi
[ -z "$dns_list" ] && dns_list="119.29.29.29 223.5.5.5"
for dns in $dns_list; do
echo "nameserver $dns" >> "$RESOLV_DAED"
done
mount --bind "$RESOLV_DAED" /tmp/resolv.conf
mount -o remount,ro,bind /tmp/resolv.conf
}
restore_resolv_conf() {
grep -q ' /tmp/resolv\.conf ' /proc/mounts || return 0
mount -o remount,rw,bind /tmp/resolv.conf 2>/dev/null
umount /tmp/resolv.conf 2>/dev/null
rm -f "$RESOLV_DAED"
}
start_service() {
[ -f "/etc/init.d/daed" ] && grep -q "DAE_LOCATION_ASSET" "/etc/init.d/daed" || sed -i '/run/i\ procd_set_param env DAE_LOCATION_ASSET="/usr/share/v2ray"' "/etc/init.d/daed"
config_load "$CONF"
local enabled
config_get_bool enabled "config" "enabled" "0"
if [ "$enabled" -eq 0 ]; then
update_cron "remove"
restore_resolv_conf
return 1
fi
update_cron "add"
hijack_resolv_conf
}
stop_service() {
update_cron "remove"
restore_resolv_conf
}
service_triggers() {
procd_add_reload_trigger "$CONF"
}
@@ -0,0 +1,29 @@
{
"admin/services/daed": {
"title": "daed",
"order": 20,
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-daed" ],
"uci": { "daed": true }
}
},
"admin/services/daed/config": {
"title": "Settings",
"order": 10,
"action": {
"type": "view",
"path": "daed/config"
}
},
"admin/services/daed/log": {
"title": "Log",
"order": 20,
"action": {
"type": "view",
"path": "daed/log"
}
}
}
@@ -1,7 +1,13 @@
{
"luci-app-daed": {
"description": "Grant UCI access for luci-app-daed",
"description": "Grant access to daed configuration",
"read": {
"file": {
"/var/log/daed/daed.log": [ "read" ]
},
"ubus": {
"service": [ "list" ]
},
"uci": [ "daed" ]
},
"write": {
+5
View File
@@ -0,0 +1,5 @@
# Build output of scripts/build-local.sh and of the CI workflow.
dist/
# macOS
.DS_Store
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2026 szwjp
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+46
View File
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: Apache-2.0
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-nginx-console
PKG_VERSION:=0.7.0
PKG_RELEASE:=1
PKG_MAINTAINER:=szwjp <szwjp@users.noreply.github.com>
PKG_LICENSE:=Apache-2.0
LUCI_TITLE:=LuCI console for the nginx UCI configuration
LUCI_DESCRIPTION:=Browse the server sections of /etc/config/nginx in a \
master-detail layout: the sections on the left, the selected one on the \
right. The read-only views (logs, certificates, backups, access control, \
health check) and the write commands (server sections, conf.d fragments) \
are separated, so a read grant cannot change the configuration.
LUCI_PKGARCH:=all
# nginx is a virtual package provided by nginx-ssl, nginx-full and friends.
# The console calls its backend through rpcd's file.exec, so rpcd-mod-file is
# what it needs - not cgi-io. jsonfilter decodes the uci list values without
# invoking a shell, which is what keeps option values from being executed.
LUCI_DEPENDS:=+luci-base +rpcd +rpcd-mod-file +jsonfilter +nginx
include $(TOPDIR)/feeds/luci/luci.mk
# luci.mk copies root/ verbatim and does not set the execute bit, so the two
# entry points are marked here as well - a package built from a tree that lost
# the file modes would otherwise ship a non-executable helper.
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/www
$(CP) ./htdocs/* $(1)/www/
$(CP) ./root/* $(1)/
$(INSTALL_DIR) $(1)/usr/libexec
$(CHMOD) 0755 $(1)/usr/libexec/nginx-console
$(CHMOD) 0755 $(1)/usr/libexec/nginx-console-write
endef
# The rate limits live in a file inside the package, so a hand edited rate
# would be overwritten by the next upgrade. Listing it as a conffile keeps
# the local version and stores the new one next to it.
define Package/$(PKG_NAME)/conffiles
/etc/nginx/conf.d/nginx-console-limits.conf
endef
# call BuildPackage - OpenWrt buildroot signature
+187
View File
@@ -0,0 +1,187 @@
# luci-app-nginx-console
ImmortalWrt / OpenWrt 上 nginx 的 LuCI 控制台,标签页布局。
配置侧按"这段配置是干什么的"分开:服务器段、反向代理、转发、重定向。工具侧是五个只读或半只读的视图:日志、证书、备份、访问控制、体检。
## 功能
### 服务器(`/etc/config/nginx` 的 `config server` 段)
nginx-util 把这些段渲染进 `/etc/nginx/uci.conf`,所以 UCI 的 option 名就是 nginx 指令名。
- 只读详情 + 编辑:`listen`、`server_name`、`include`、`ssl_certificate`、`ssl_certificate_key`、`access_log`、`error_log`
- 证书可在 `/etc/ssl/acme`、`/etc/nginx/certs`、`/etc/luci-uploads` 里挑,也可直接上传 PEM 文本
- 安全与限流:四个响应头(HSTS / X-Frame-Options / X-Content-Type-Options / Referrer-Policy)各是一个**开关**,`server_tokens off` 也是一个开关,请求限速是**分段按钮**(不限速 / 5 / 20 / 100 请求每秒),并发连接数是**滑块**
- 新建 / 删除 server 段(`_lan` 有后端硬保护,删不掉)
- 两个内置段显示为「HTTPS 监听端口」「HTTP 监听端口」,真名仍在详情页右上和悬停提示里
### 反向代理 / 转发 / 重定向(`/etc/nginx/conf.d/*.locations`)
片段按**内容里的指令**分类,不看文件名:`proxy_pass` → 反向代理,`uwsgi_pass` 等 → 转发,`return 30x` → 重定向,其余进「其他」(该标签只在真有未归类片段时出现)。
- **反向代理**:填路径 + 后端地址即生成。WebSocket 是个**开关**,打开时自动补 `Upgrade` / `Connection` / `http_version 1.1` / `proxy_buffering off`;connect/send/read 三个超时各是一个**滑块**(5s / 15s / 30s / 60s / 2min / 5min,也能直接填自定义值),另有"额外指令"
- **转发**:路径 + 协议(uwsgi / fastcgi / scgi / grpc)+ 后端,自动带对应的 `include xxx_params;`(grpc 不带)
- **重定向**:
- 全局的 HTTP → HTTPS 跳转用一个**开关**驱动(打开写 `if ($scheme = http) { return 301 https://$host$request_uri; }`,关闭则删掉该文件)
- 路径级重定向用表单:路径 + 状态码(301/302/307/308)+ 目标地址
- **表单不会吃掉文件内容**:表单只建模它认识的指令,其余的(`proxy_set_header X-Real-IP …`、`client_max_body_size …`、注释……)收进"额外指令",保存时原样写回。块外只有注释时才用表单,块外还有别的指令(多个 location、server 级指令)就自动退回文本编辑器
滑块与开关都遵守同一条规矩:**磁盘上的值优先**。滑块停在"不设置"时,旁边的输入框里是原值;原值不在档位里就照原样显示并注明"不在档位里",用户动了滑块或输入框才写新值。
### 日志
`logread` 里的 nginx 日志(OpenWrt 上 nginx 走 syslog,没有日志文件),错误/访问切换。全局 `access_log off` 时访问日志为空,页面上说明了在服务器段填 `logd openwrt` 才会记录。
### 证书
扫描 `/etc/ssl/acme`、`/etc/nginx/certs`、`/etc/luci-uploads`,用 openssl 解析到期时间、剩余天数、SAN。
- 按证书身份合并:acme 把同一张证书写成 `.crt` / `.combined.crt` / `.fullchain.crt` 三份,只显示一条、下面列出全部路径
- 中间证书(`chain.crt`,CA:TRUE)不显示
- 剩余 <30 天转黄,<7 天转红
- 剩余天数用 openssl `-checkend` 二分求得(OpenWrt 没有能解析 `Sep 12 17:54:00 2027 GMT` 的 date)
上传的证书由后端落盘:文件名要过白名单(只允许字母数字与 `. - _`,后缀限 `crt/cer/pem/key/csr`),**私钥落盘是 0600**,证书是 0644。前端不再直接往 `/etc/luci-uploads` 写文件。
### 备份
列出 `/root/backup/nginx-console/`(UCI)和 `/root/backup/nginx-console-fragments/`(片段),各保留最近 10 份,可一键恢复。
时间从**文件名**里的时间戳读——备份用 `cp -p`,文件 mtime 是源配置被编辑的时间,不是备份时间。
恢复一份语法错误的备份时,会**先回滚再报错**:旧文件被放回去,nginx 不会被一份坏配置拖下水。
### 访问控制
`/etc/nginx/htpasswd` 的用户增删改。哈希用 `openssl passwd -apr1 -stdin` 生成,**密码经暂存文件传递而非 argv**,不会出现在 `ps` 里;暂存文件是 0600,`htpasswd` 本身也是 0600。原文件改动前留一份 `.bak`。
### 体检
查 `nginx -t` 查不出来的问题:`server_name` 重复、反代目标端口没有监听、证书即将到期、空的片段文件、`include` 指向不存在的东西。
## 权限:两个入口,一份 ACL
后端拆成两个物理文件,rpcd 的授权按**路径**分开:
| 入口 | 提供的命令 | ACL |
| --- | --- | --- |
| `/usr/libexec/nginx-console` | `status` `test` `logs` `certs` `backups list` `auth list` `audit` | `read` |
| `/usr/libexec/nginx-console-write` | `server-save` `server-add` `server-delete` `frag-save` `frag-delete` `backup-restore` `upload` `auth set/delete` | `write` |
ACL 是一个组 `luci-app-nginx-console`,组里分 `read` 与 `write` 两级。rpcd 检查的是**路径**上的 `exec` 权限:只读账号能跑只读入口,跑写入口直接 Permission denied;`ubus file exec` 这种不限路径的通道没有授权,所以只读账号也拿不到 root shell。
给一个账号只读权限:
```sh
uci set rpcd.ncsreader=login
uci set rpcd.ncsreader.username='ncsreader'
uci set rpcd.ncsreader.password='$p$……'
uci add_list rpcd.ncsreader.read='luci-app-nginx-console'
uci commit rpcd && /etc/init.d/rpcd restart
```
页面上会自动认出来:只读账号看不到"编辑 / 删除 / 新建",顶部有一条只读提示。
## 写操作的统一约定
前端只读 + 写暂存文件(每次调用一个 `/tmp/nginx-console.pending.<随机>`,模式 0600,命令结束即删),落盘由 `/usr/libexec/nginx-console-write` 完成。后端把命令最后那个参数当作暂存文件路径,并只接受匹配 `nginx-console.pending.<id>` 的路径——两个标签页同时保存时不会互相覆盖,路径也不能指向暂存区以外。每个写操作固定走同一条路:
```
备份 → 写入 → (server 段还要 commit + 重新渲染 uci.conf)→ nginx -t
├─ 失败 → 还原 → 返回带行号的 nginx 报错
└─ 通过 → reload,并等到新 worker 真正接管才返回
```
几条刻意的设计:
- **选项值不经 shell**:读当前值时用 `ubus call uci get` + `jsonfilter` 取结构化列表,不再 `eval` `uci get` 的文本输出——后者会把配置里的 `$(...)` 当命令执行
- **字段白名单**:`server-save` 只碰 `listen`、`server_name`、`include`、两个证书字段、两个日志字段、`add_header`、`server_tokens`、`limit_req`、`limit_conn`,其余(`uci_manage_ssl`、会话缓存等)原样不动
- **只碰暂存到的字段**:暂存文件里没带的字段一律不碰(空值和"没这个字段"是两回事);要清空一个列表字段,表单会明确写一行空值过去
- **值没变的字段连位置都不会动**
- **保存前校验**:`_lan` 必须存在且有 443 监听;任何监听 443/ssl 的段必须有完整证书与私钥
- **uci 返回码检查**:写入循环用 here-doc 而非管道,任一 `uci set` 失败就整体中止(管道会让循环跑在子 shell 里,错误传不出来)
## 后端命令
```
# 只读入口 /usr/libexec/nginx-console
status 运行状态、版本、段数、片段数、worker 数
test nginx -t 的原始输出
logs <error|access> [n] 读 logread
certs 证书清单
backups list 备份清单
auth list htpasswd 用户清单
audit 自检
# 写入口 /usr/libexec/nginx-console-write
server-save <段> 从 pending 读 "字段<TAB>值" 行
server-add <段> 同上,新建
server-delete <段> 删除
frag-save <文件> 整份替换
frag-delete <文件> 删除
backup-restore <path> 回滚
upload <文件名> 把 pending 里的内容装进 /etc/luci-uploads
auth set|delete [user] htpasswd 管理(密码从 pending 读)
```
每个命令都只输出一个 JSON 对象并 `exit 0`,调用方不用解释退出码。`upload` 的文件名要过白名单,私钥落盘是 0600。
`include` 与 `access_log` / `error_log` 的值在后端还有一层校验(`nginx -t` 本身不拦这两类路径):`include` 只允许配置目录内的相对路径,日志只允许 `logd` / `syslog` / `off` / `/var/log/nginx/` 下的文件。不合规的提交返回 `invalid_value`。
## 目录
```
Makefile in-tree / feed 构建用
.github/build-pkg.sh CI 打包(apk mkpkg)
.github/workflows/build.yml CI:编译 apk-tools → 打包 → 发 Release
scripts/build-local.sh 在路由器上直接打包(不用 SDK / CI)
htdocs/…/view/nginx-console/main.js 页面
root/usr/libexec/nginx-console 只读后端
root/usr/libexec/nginx-console-write 写后端
root/usr/libexec/nginx-console-lib.sh 两个入口共用的实现
root/usr/share/luci/menu.d/… 菜单:服务 → Nginx 控制台
root/usr/share/rpcd/acl.d/… ACL(read / write 分级)
root/etc/nginx/conf.d/nginx-console-limits.conf 限流 zone 定义(conffile)
```
## 打包与升级
```sh
# 改完代码,把 Makefile 里的 PKG_VERSION 或 PKG_RELEASE 加一
bash scripts/build-local.sh
scp dist/luci-app-nginx-console-<版本>.apk root@192.168.1.1:/tmp/
ssh root@192.168.1.1 'apk add --allow-untrusted /tmp/luci-app-nginx-console-<版本>.apk'
```
也可以从 Releases 直接取包(包未签名,需要 `--allow-untrusted`):
```sh
apk add --allow-untrusted https://github.com/szwjp/luci-app-nginx-console/releases/download/v<版本>/luci-app-nginx-console-<版本>.apk
```
第一次运行 `build-local.sh` 会从 Alpine 镜像取一个静态 `apk.static` 放在路由器 `/tmp` 并复用——OpenWrt 自带的 apk 没有 `mkpkg` 子命令,打不了包。包未签名,所以要 `--allow-untrusted`。
限流速率所在的 `nginx-console-limits.conf` 是 conffile:升级时保留本地那份,新版放旁边。
CI 那条路也可用:`.github/workflows/build.yml` 是手动触发(workflow_dispatch),从 Makefile 读版本,构建 apk 并发布到对应的 Release tag。
卸载:`apk del luci-app-nginx-console`(`/etc/config/nginx` 和 `conf.d` 下的片段不属于本包,不会被删)。
## 依赖
`luci-base`、`rpcd`、`rpcd-mod-file`,以及虚拟包 `nginx`——`nginx-full` / `nginx-ssl` 等任何变体都能满足。
## 前端的执行通道
`callHelper` 用 rpcd 的 `file.exec`(`fs.exec`),参数按 argv 传,不拼 shell 字符串。命令属于哪一类决定用哪个入口:只读命令走 `nginx-console`,写命令走 `nginx-console-write`。
不用 cgi-io:那台路由器上会话拿不到 `cgi-io: exec`,而且 cgi-io 的授权粒度比 path 级 `file.exec` 粗。
## 边界
- 只读 `/etc/config/nginx` 与 `/etc/nginx/conf.d`,**从不**直接改 `/etc/nginx/uci.conf`(它是 nginx-util 的生成物),也不碰证书文件本身
- 不认识 `config server` 以外的 UCI 字段,也不会主动删除它们
- 限流的 rate 写死在 `nginx-console-limits.conf` 里,控制台只引用 zone 名
- 没有做也不会做:`stream`(TCP/UDP 转发)——这台路由器上纯端口转发已有 DNAT 和 Lucky 两套,stream 只会更慢并丢掉源 IP
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,15 @@
# Managed by luci-app-nginx-console.
#
# Shared zones for the limit_req / limit_conn directives that the console can
# write into a server section. This file needs an http context, which is why
# it lives in conf.d as a .conf file: uci.conf.template ends its http block
# with "include conf.d/*.conf;". The .locations files in the same directory
# are included per server instead and cannot hold these.
#
# The console only ever references these zone names, so the rates are edited
# here rather than per section.
limit_req_zone $binary_remote_addr zone=ncs_rl_5:10m rate=5r/s;
limit_req_zone $binary_remote_addr zone=ncs_rl_20:10m rate=20r/s;
limit_req_zone $binary_remote_addr zone=ncs_rl_100:10m rate=100r/s;
limit_conn_zone $binary_remote_addr zone=ncs_cl:10m;
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
#
# nginx-console - read-only backend for luci-app-nginx-console.
#
# This entry point only serves the commands that cannot change anything:
# status, test, logs, certs, backups list, auth list and audit. Everything
# that writes lives in nginx-console-write, so a session that is only
# granted the read ACL cannot reach it - rpcd checks the exec permission of
# the path it is asked to run, and this path is not in the write ACL.
#
# Every command prints exactly one JSON object on stdout and exits 0, so the
# caller never has to interpret exit codes.
. /usr/libexec/nginx-console-lib.sh
# cmd_auth serves both the read-only listing and the writes; in this entry
# point only the listing is allowed.
AUTH_MODE=ro
case "$1" in
status) cmd_status ;;
test) cmd_test ;;
logs) cmd_logs "$2" "$3" ;;
certs) cmd_certs ;;
backups) cmd_backups "$2" ;;
auth) cmd_auth "$2" "$3" ;;
audit) cmd_audit ;;
*) json_fail unknown_command ;;
esac
# Nothing of a finished transaction is left behind: the staged form input and
# the rollback snapshot both have a lifetime of one command. Dated copies for
# manual recovery live in $BACKUP_DIR instead.
rm -f "$PENDING" "$SNAPSHOT" 2>/dev/null
exit 0
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,54 @@
#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
#
# nginx-console-write - write backend for luci-app-nginx-console.
#
# Everything that changes the nginx configuration goes through this entry
# point: editing and adding server sections, installing and removing
# conf.d fragments, restoring a backup, installing uploaded certificates and
# managing the htpasswd users.
#
# The read-only commands live in nginx-console, which is the only path the
# read ACL grants exec on, so granting read access does not hand out the
# ability to rewrite the configuration.
#
# Every write is a transaction: back up, write, run `nginx -t`, roll back
# when the test fails, and reload only after the test passed.
#
# Every command prints exactly one JSON object on stdout and exits 0, so the
# caller never has to interpret exit codes.
. /usr/libexec/nginx-console-lib.sh
AUTH_MODE=rw
# A staged file can hold a plain text password. The page writes it 0600, but a
# pre-existing file keeps whatever mode it had (open(2) only applies the mode
# when creating), so it is tightened here before anything reads it.
for staged in /tmp/nginx-console.pending.*; do
[ -f "$staged" ] && chmod 0600 "$staged" 2>/dev/null
done
# Commands that read staged input take that file's path as their last argument
# ($3 for server-save/add, $2 for fragment/upload, $3 for auth). The staging
# path is validated in set_pending(); the page deletes its own file, and the
# removal below is only a backstop for a path this run adopted.
case "$1" in
server-save) cmd_server_save "$2" "$3" ;;
server-add) cmd_server_add "$2" "$3" ;;
server-delete) cmd_server_delete "$2" ;;
frag-save) cmd_frag_save "$2" "$3" ;;
frag-delete) cmd_frag_delete "$2" ;;
backup-restore) cmd_backup_restore "$2" ;;
upload) cmd_upload "$2" "$3" ;;
auth) cmd_auth "$2" "$3" "$4" ;;
*) json_fail unknown_command ;;
esac
# Nothing of a finished transaction is left behind: the staged form input and
# the rollback snapshot both have a lifetime of one command. Dated copies for
# manual recovery live in $BACKUP_DIR instead.
[ -n "$PENDING_PATH" ] && rm -f "$PENDING_PATH" 2>/dev/null
rm -f "$SNAPSHOT" 2>/dev/null
exit 0
@@ -0,0 +1,14 @@
{
"admin/services/nginx-console": {
"title": "Nginx 控制台",
"order": 62,
"action": {
"type": "view",
"path": "nginx-console/main"
},
"depends": {
"acl": [ "luci-app-nginx-console" ],
"uci": { "nginx": true }
}
}
}
@@ -0,0 +1,26 @@
{
"luci-app-nginx-console": {
"description": "Access to the nginx console: a read grant gets the read-only commands, a write grant also gets the commands that change the configuration",
"read": {
"file": {
"/usr/libexec/nginx-console": [ "exec" ],
"/etc/nginx/conf.d": [ "list" ],
"/etc/nginx/conf.d/*": [ "read", "list" ],
"/etc/nginx/certs": [ "list" ],
"/etc/nginx/certs/*": [ "read", "list" ],
"/etc/ssl/acme": [ "list" ],
"/etc/ssl/acme/*": [ "read", "list" ],
"/etc/acme": [ "list" ],
"/etc/acme/*": [ "read", "list" ],
"/etc/luci-uploads": [ "list" ],
"/etc/luci-uploads/*": [ "read", "list" ]
}
},
"write": {
"file": {
"/usr/libexec/nginx-console-write": [ "exec" ],
"/tmp/nginx-console.pending.*": [ "write", "read", "remove" ]
}
}
}
}
+179
View File
@@ -0,0 +1,179 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
#
# Build luci-app-nginx-console on the router itself: no OpenWrt SDK, no CI
# round-trip. Useful while the package is still being built up.
#
# Usage: bash scripts/build-local.sh [router]
#
# Why the router: building an apk needs apk-tools v3 with `apk mkpkg`, and the
# apk-tools that OpenWrt ships does not have that command. A static apk-tools
# from Alpine is downloaded once and kept at /tmp/apk.static on the router.
#
# The package is architecture independent, so nothing gets compiled: everything
# under root/ and htdocs/ is the input. See .github/build-pkg.sh for the
# version that CI uses.
set -o errexit
set -o pipefail
set -o nounset
ROUTER="${1:-root@192.168.1.140}"
ALPINE_MIRROR="${ALPINE_MIRROR:-https://mirrors.tuna.tsinghua.edu.cn/alpine/edge/main/x86_64}"
# The apk-tools-static version is resolved from the mirror's APKINDEX unless it
# is given explicitly: Alpine drops old point releases from the mirror, so a
# hard coded version breaks as soon as the branch moves on.
APK_TOOLS_STATIC_VERSION="${APK_TOOLS_STATIC_VERSION:-}"
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
NAME=luci-app-nginx-console
OUT_DIR="${REPO_DIR}/dist"
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
say() { printf '\033[1m==> %s\033[0m\n' "$*"; }
fail() { printf '\033[31merror:\033[0m %s\n' "$*" >&2; exit 1; }
VERSION="$(sed -n 's/^PKG_VERSION:=//p' "$REPO_DIR/Makefile" | head -n1 | tr -d '[:space:]')"
RELEASE="$(sed -n 's/^PKG_RELEASE:=//p' "$REPO_DIR/Makefile" | head -n1 | tr -d '[:space:]')"
[ -n "$VERSION" ] && [ -n "$RELEASE" ] || fail "cannot read PKG_VERSION / PKG_RELEASE from Makefile"
PKGVER="${VERSION}-r${RELEASE}"
say "Staging file tree for ${NAME} ${PKGVER}"
TREE="${STAGE}/${NAME}"
mkdir -p "$TREE"
[ -d "$REPO_DIR/root" ] || fail "missing root/ directory"
[ -d "$REPO_DIR/htdocs" ] || fail "missing htdocs/ directory"
cp -a "$REPO_DIR/root/." "$TREE/"
mkdir -p "$TREE/www"
cp -a "$REPO_DIR/htdocs/." "$TREE/www/"
# macOS sprinkles these around; they must never reach the package.
find "$TREE" -name '._*' -delete
find "$TREE" -name '.DS_Store' -delete
find "$TREE" -type d -exec chmod 0755 {} +
find "$TREE" -type f -exec chmod 0644 {} +
chmod 0755 "$TREE/usr/libexec/nginx-console" || fail "usr/libexec/nginx-console is missing"
chmod 0755 "$TREE/usr/libexec/nginx-console-write" || fail "usr/libexec/nginx-console-write is missing"
( cd "$STAGE" && COPYFILE_DISABLE=1 tar czf "${STAGE}/tree.tgz" "$NAME" )
say "Checking the router"
ssh "$ROUTER" 'command -v apk >/dev/null' || fail "no apk on the router"
if ! ssh "$ROUTER" '[ -x /tmp/apk.static ]'; then
if [ -z "$APK_TOOLS_STATIC_VERSION" ]; then
say "Resolving the newest apk-tools-static in ${ALPINE_MIRROR}"
APKINDEX="$(mktemp)"
curl -sL --max-time 120 "${ALPINE_MIRROR}/APKINDEX.tar.gz" |
tar -xzO APKINDEX > "$APKINDEX" ||
fail "cannot read APKINDEX from ${ALPINE_MIRROR}"
APK_TOOLS_STATIC_VERSION="$(awk '
/^P:apk-tools-static$/ { hit = 1; next }
hit && /^V:/ { print substr($0, 3); exit }
hit && /^$/ { hit = 0 }
' "$APKINDEX")"
[ -n "$APK_TOOLS_STATIC_VERSION" ] ||
fail "apk-tools-static is not in ${ALPINE_MIRROR}"
fi
say "Fetching apk-tools-static ${APK_TOOLS_STATIC_VERSION} onto the router"
ssh "$ROUTER" "sh -s" <<REMOTE
set -e
cd /tmp
curl -fsL --max-time 120 -o /tmp/apk-tools-static.apk \
'${ALPINE_MIRROR}/apk-tools-static-${APK_TOOLS_STATIC_VERSION}.apk'
mkdir -p /tmp/apkstatic
tar -xzf /tmp/apk-tools-static.apk -C /tmp/apkstatic sbin/apk.static
mv /tmp/apkstatic/sbin/apk.static /tmp/apk.static
chmod 0755 /tmp/apk.static
rm -rf /tmp/apkstatic /tmp/apk-tools-static.apk
REMOTE
fi
ssh "$ROUTER" '/tmp/apk.static mkpkg 2>&1 | grep -q "required info field" ' ||
fail "the apk.static on the router cannot build packages"
say "Uploading and building on the router"
scp -q "${STAGE}/tree.tgz" "${ROUTER}:/tmp/${NAME}-tree.tgz"
ssh "$ROUTER" "sh -s" <<REMOTE
set -e
PKG=/tmp/pkgbuild/${NAME}
rm -rf /tmp/pkgbuild /tmp/pkgbuild-dist
mkdir -p "\$PKG" /tmp/pkgbuild-dist
tar xzf /tmp/${NAME}-tree.tgz -C /tmp/pkgbuild
chown -R root:root "\$PKG"
find "\$PKG" -type d -exec chmod 0755 {} +
find "\$PKG" -type f -exec chmod 0644 {} +
chmod 0755 "\$PKG/usr/libexec/nginx-console"
chmod 0755 "\$PKG/usr/libexec/nginx-console-write"
mkdir -p "\$PKG/lib/apk/packages"
cd "\$PKG"
find . -type f | grep -v '^\./lib/apk/packages/' | sed 's|^\./|/|' | sort \
> /tmp/${NAME}.list
mv /tmp/${NAME}.list "\$PKG/lib/apk/packages/${NAME}.list"
# The rate limits are a conffile: a hand edited rate must survive an upgrade.
printf '%s\n' '/etc/nginx/conf.d/nginx-console-limits.conf' \
> "\$PKG/lib/apk/packages/${NAME}.conffiles"
cat > /tmp/${NAME}-post-install <<'INNER'
#!/bin/sh
[ "\${IPKG_NO_SCRIPT}" = "1" ] && exit 0
[ -s \${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
. \${IPKG_INSTROOT}/lib/functions.sh
export root="\${IPKG_INSTROOT}"
export pkgname="${NAME}"
default_postinst \$0 \$@
[ -n "\${IPKG_INSTROOT}" ] || {
rm -f /tmp/luci-indexcache.*
rm -rf /tmp/luci-modulecache/
killall -HUP rpcd 2>/dev/null
exit 0
}
INNER
chmod 0755 /tmp/${NAME}-post-install
cp /tmp/${NAME}-post-install /tmp/${NAME}-post-upgrade
/tmp/apk.static mkpkg \
--info "name:${NAME}" \
--info "version:${PKGVER}" \
--info "description:LuCI console for the nginx UCI configuration" \
--info "arch:noarch" \
--info "license:Apache-2.0" \
--info "origin:https://github.com/szwjp/${NAME}" \
--info "url:https://github.com/szwjp/${NAME}" \
--info "maintainer:szwjp <szwjp@users.noreply.github.com>" \
--info "depends:luci-base rpcd rpcd-mod-file jsonfilter nginx" \
--script "post-install:/tmp/${NAME}-post-install" \
--script "post-upgrade:/tmp/${NAME}-post-upgrade" \
--files "\$PKG" \
--output "/tmp/pkgbuild-dist/${NAME}-${PKGVER}.apk"
rm -rf /tmp/pkgbuild /tmp/${NAME}-tree.tgz
rm -f /tmp/${NAME}-post-install /tmp/${NAME}-post-upgrade
REMOTE
mkdir -p "$OUT_DIR"
scp -q "${ROUTER}:/tmp/pkgbuild-dist/${NAME}-${PKGVER}.apk" "$OUT_DIR/"
ssh "$ROUTER" 'rm -rf /tmp/pkgbuild-dist'
say "Built ${OUT_DIR}/${NAME}-${PKGVER}.apk"
ls -la "${OUT_DIR}/${NAME}-${PKGVER}.apk"
echo
echo "Install or upgrade on the router with:"
echo " scp dist/${NAME}-${PKGVER}.apk ${ROUTER}:/tmp/"
echo " ssh ${ROUTER} 'apk add --allow-untrusted --force-overwrite /tmp/${NAME}-${PKGVER}.apk'"
+2 -2
View File
@@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-open-box
PKG_VERSION:=0.1.451
PKG_RELEASE:=85
PKG_VERSION:=0.1.452
PKG_RELEASE:=86
PKG_MAINTAINER:=liandu2024
PKG_LICENSE:=GPL-3.0-or-later
+2 -2
View File
@@ -22,11 +22,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=wwand-ims
PKG_VERSION:=0.2.0_pre3
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/ddimension/wwand-ims.git
PKG_SOURCE_VERSION:=58b626743f5f7ca5cf1093ad6daad2ac53113833
PKG_SOURCE_VERSION:=9a4bba4fbefd91b239ab38f78681f1d48aa6af6b
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=GPL-2.0-only