diff --git a/luci-app-dae/.gitignore b/luci-app-dae/.gitignore deleted file mode 100644 index fa5f574fa..000000000 --- a/luci-app-dae/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -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/ diff --git a/luci-app-dae/LICENSE b/luci-app-dae/LICENSE deleted file mode 100644 index f288702d2..000000000 --- a/luci-app-dae/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - 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. - - - Copyright (C) - - 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 . - -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: - - Copyright (C) - 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 -. - - 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 -. diff --git a/luci-app-dae/Makefile b/luci-app-dae/Makefile new file mode 100644 index 000000000..da58d3ba0 --- /dev/null +++ b/luci-app-dae/Makefile @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2024 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_LICENSE:=Apache-2.0 +PKG_MAINTAINER:=Tianling Shen + +LUCI_TITLE:=LuCI app for dae +LUCI_DEPENDS:=+dae +dae-geoip +dae-geosite + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-dae/README.md b/luci-app-dae/README.md deleted file mode 100644 index 0d34642ae..000000000 --- a/luci-app-dae/README.md +++ /dev/null @@ -1,278 +0,0 @@ -# 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--x86_64.apk` | -| arm64 | `dae--aarch64_generic.apk` | -| riscv64 | `dae--riscv64_generic.apk` | - -可选包: - -```sh -# LuCI 中文翻译,界面语言随浏览器 Accept-Language 走 -apk add --allow-untrusted ./luci-i18n-dae-zh-cn-.apk -``` - -面板不带字体归档(Noto Sans TC/SC),缺少时回退系统字体。需要自带字体时,仍可从 -szwjp/doona 的发布里装 `doona-fonts-.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@/geoip.dat -https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@/geosite.dat -``` - -行为要点: - -* 下载带 Range 头(实测普通 GET 只有 16KB/s,显式 Range 是 MB/s 级);中断后 - 下一轮用 `curl -C -` 续传。 -* 完整性靠上游同目录的 `.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 通信。 diff --git a/luci-app-dae/dae/Makefile b/luci-app-dae/dae/Makefile deleted file mode 100644 index f9c44a962..000000000 --- a/luci-app-dae/dae/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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 -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//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 diff --git a/luci-app-dae/dae/digests.txt b/luci-app-dae/dae/digests.txt deleted file mode 100644 index 43d6c210d..000000000 --- a/luci-app-dae/dae/digests.txt +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/luci-app-dae/dae/root/etc/config/dae b/luci-app-dae/dae/root/etc/config/dae deleted file mode 100644 index 00b73e41a..000000000 --- a/luci-app-dae/dae/root/etc/config/dae +++ /dev/null @@ -1,16 +0,0 @@ -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 '' diff --git a/luci-app-dae/dae/root/etc/dae/config.d/dns.dae b/luci-app-dae/dae/root/etc/dae/config.d/dns.dae deleted file mode 100644 index 97cd8fb1a..000000000 --- a/luci-app-dae/dae/root/etc/dae/config.d/dns.dae +++ /dev/null @@ -1,17 +0,0 @@ -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 - } - } -} diff --git a/luci-app-dae/dae/root/etc/dae/config.d/global.dae b/luci-app-dae/dae/root/etc/dae/config.d/global.dae deleted file mode 100644 index 55879ada9..000000000 --- a/luci-app-dae/dae/root/etc/dae/config.d/global.dae +++ /dev/null @@ -1,13 +0,0 @@ -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 -} diff --git a/luci-app-dae/dae/root/etc/dae/config.d/group.dae b/luci-app-dae/dae/root/etc/dae/config.d/group.dae deleted file mode 100644 index 31feeaf30..000000000 --- a/luci-app-dae/dae/root/etc/dae/config.d/group.dae +++ /dev/null @@ -1,2 +0,0 @@ -group { -} diff --git a/luci-app-dae/dae/root/etc/dae/config.d/node.dae b/luci-app-dae/dae/root/etc/dae/config.d/node.dae deleted file mode 100644 index a166b3306..000000000 --- a/luci-app-dae/dae/root/etc/dae/config.d/node.dae +++ /dev/null @@ -1,2 +0,0 @@ -node { -} diff --git a/luci-app-dae/dae/root/etc/dae/config.d/routing.dae b/luci-app-dae/dae/root/etc/dae/config.d/routing.dae deleted file mode 100644 index e453d9cd7..000000000 --- a/luci-app-dae/dae/root/etc/dae/config.d/routing.dae +++ /dev/null @@ -1,6 +0,0 @@ -routing { - dip(geoip:private) -> direct - dip(224.0.0.0/3, 'ff00::/8') -> direct - domain(geosite:cn) -> direct - fallback: direct -} diff --git a/luci-app-dae/dae/root/etc/dae/config.d/subscription.dae b/luci-app-dae/dae/root/etc/dae/config.d/subscription.dae deleted file mode 100644 index 0bc9cf8cd..000000000 --- a/luci-app-dae/dae/root/etc/dae/config.d/subscription.dae +++ /dev/null @@ -1,2 +0,0 @@ -subscription { -} diff --git a/luci-app-dae/dae/root/etc/dae/config.dae b/luci-app-dae/dae/root/etc/dae/config.dae deleted file mode 100644 index 1ed2a157d..000000000 --- a/luci-app-dae/dae/root/etc/dae/config.dae +++ /dev/null @@ -1,8 +0,0 @@ -# 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 -} diff --git a/luci-app-dae/dae/root/etc/init.d/dae b/luci-app-dae/dae/root/etc/init.d/dae deleted file mode 100644 index e00d90e8d..000000000 --- a/luci-app-dae/dae/root/etc/init.d/dae +++ /dev/null @@ -1,447 +0,0 @@ -#!/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" -} diff --git a/luci-app-dae/dae/root/usr/bin/dae-geo-update b/luci-app-dae/dae/root/usr/bin/dae-geo-update deleted file mode 100755 index f23f531d3..000000000 --- a/luci-app-dae/dae/root/usr/bin/dae-geo-update +++ /dev/null @@ -1,411 +0,0 @@ -#!/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@/geoip.dat -# https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@/geosite.dat -# The project publishes no tag (a @ 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 [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 -# -# 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 diff --git a/luci-app-dae/dae/root/usr/share/dae/geoip.dat b/luci-app-dae/dae/root/usr/share/dae/geoip.dat deleted file mode 120000 index 52610f541..000000000 --- a/luci-app-dae/dae/root/usr/share/dae/geoip.dat +++ /dev/null @@ -1 +0,0 @@ -../v2ray/geoip.dat \ No newline at end of file diff --git a/luci-app-dae/dae/root/usr/share/dae/geosite.dat b/luci-app-dae/dae/root/usr/share/dae/geosite.dat deleted file mode 120000 index 8f5be9666..000000000 --- a/luci-app-dae/dae/root/usr/share/dae/geosite.dat +++ /dev/null @@ -1 +0,0 @@ -../v2ray/geosite.dat \ No newline at end of file diff --git a/luci-app-dae/dae/root/usr/share/licenses/dae/LICENSE b/luci-app-dae/dae/root/usr/share/licenses/dae/LICENSE deleted file mode 100644 index bae94e189..000000000 --- a/luci-app-dae/dae/root/usr/share/licenses/dae/LICENSE +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - 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. - - - Copyright (C) - - 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 . - -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 -. \ No newline at end of file diff --git a/luci-app-dae/doona/Makefile b/luci-app-dae/doona/Makefile deleted file mode 100644 index 0cdabca98..000000000 --- a/luci-app-dae/doona/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# 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-.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 -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:= diff --git a/luci-app-dae/doona/digests.txt b/luci-app-dae/doona/digests.txt deleted file mode 100644 index b0d0e1cc1..000000000 --- a/luci-app-dae/doona/digests.txt +++ /dev/null @@ -1,8 +0,0 @@ -# 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 diff --git a/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js b/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js new file mode 100644 index 000000000..6b76a25fe --- /dev/null +++ b/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js @@ -0,0 +1,62 @@ +// 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); + }); + } +}); diff --git a/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js b/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js new file mode 100644 index 000000000..e49e38d93 --- /dev/null +++ b/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; +'require dom'; +'require fs'; +'require poll'; +'require view'; + +return view.extend({ + render() { + /* Thanks to luci-app-aria2 */ + let css = ' \ + #log_textarea { \ + text-align: left; \ + } \ + #log_textarea pre { \ + padding: .5rem; \ + word-break: break-all; \ + margin: 0; \ + } \ + .description { \ + background-color: #33ccff; \ + }'; + + let log_textarea = E('div', { 'id': 'log_textarea' }, + E('img', { + 'src': L.resource('icons/loading.svg'), + 'alt': _('Loading...'), + 'style': 'vertical-align:middle' + }, _('Collecting data…')) + ); + + poll.add(L.bind(function() { + return fs.read_direct('/var/log/dae/dae.log', 'text') + .then(function(content) { + let log = E('pre', { 'wrap': 'pre' }, [ + content.trim() || _('Log is empty.') + ]); + + dom.content(log_textarea, log); + }).catch(function(e) { + let log; + + if (e.toString().includes('NotFoundError')) + log = E('pre', { 'wrap': 'pre' }, [ + _('Log file does not exist.') + ]); + else + log = E('pre', { 'wrap': 'pre' }, [ + _('Unknown error: %s').format(e) + ]); + + dom.content(log_textarea, log); + }); + })); + + const scrollDownButton = E('button', { + 'id': 'scrollDownButton', + 'class': 'cbi-button cbi-button-neutral', + }, _('Scroll to tail', 'scroll to bottom (the tail) of the log file') + ); + scrollDownButton.addEventListener('click', () => { + scrollUpButton.scrollIntoView(); + scrollDownButton.blur(); + }); + + const scrollUpButton = E('button', { + 'id' : 'scrollUpButton', + 'class': 'cbi-button cbi-button-neutral', + }, _('Scroll to head', 'scroll to top (the head) of the log file') + ); + scrollUpButton.addEventListener('click', () => { + scrollDownButton.scrollIntoView(); + scrollUpButton.blur(); + }); + + return E([ + E('style', [ css ]), + E('h2', {}, [ _('Log') ]), + E('div', {'class': 'cbi-map'}, [ + E('div', {'style': 'padding-bottom: 20px'}, [scrollDownButton]), + E('div', {'class': 'cbi-section'}, [ + log_textarea, + E('div', {'style': 'text-align:right'}, + E('small', {}, _('Refresh every %s seconds.').format(L.env.pollinterval)) + ) + ]), + E('div', {'style': 'padding-bottom: 20px'}, [scrollUpButton]) + ]) + ]); + }, + + handleSaveApply: null, + handleSave: null, + handleReset: null +}); diff --git a/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js b/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js new file mode 100644 index 000000000..59541ada4 --- /dev/null +++ b/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; +'require form'; +'require poll'; +'require rpc'; +'require uci'; +'require view'; + +const callServiceList = rpc.declare({ + object: 'service', + method: 'list', + params: ['name'], + expect: { '': {} } +}); + +function getServiceStatus() { + return L.resolveDefault(callServiceList('dae'), {}).then(function(res) { + let isRunning = false; + try { + isRunning = res['dae']['instances']['dae']['running']; + } catch (e) { } + return isRunning; + }); +} + +function renderStatus(isRunning) { + let spanTemp = '%s %s'; + let renderHTML; + if (isRunning) + renderHTML = spanTemp.format('green', _('dae'), _('RUNNING')); + else + renderHTML = spanTemp.format('red', _('dae'), _('NOT RUNNING')); + + return renderHTML; +} + +return view.extend({ + render() { + let m, s, o; + + m = new form.Map('dae', _('dae'), + _('eBPF-based Linux high-performance transparent proxy solution.')); + + s = m.section(form.TypedSection); + s.anonymous = true; + s.render = function() { + poll.add(function() { + return L.resolveDefault(getServiceStatus()).then(function(res) { + let view = document.getElementById('service_status'); + view.innerHTML = renderStatus(res); + }); + }); + + return E('div', { class: 'cbi-section', id: 'status_bar' }, [ + E('p', { id: 'service_status' }, _('Collecting data…')) + ]); + } + + s = m.section(form.NamedSection, 'config', 'dae'); + + o = s.option(form.Flag, 'enabled', _('Enable')); + + o = s.option(form.Value, 'config_file', _('Configration file')); + o.default = '/etc/dae/config.dae'; + 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 = 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'; + + return m.render(); + } +}); diff --git a/luci-app-dae/luci-app-dae/Makefile b/luci-app-dae/luci-app-dae/Makefile deleted file mode 100644 index 876995d07..000000000 --- a/luci-app-dae/luci-app-dae/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# 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 -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:= diff --git a/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/dae.css b/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/dae.css deleted file mode 100644 index 8087bdfca..000000000 --- a/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/dae.css +++ /dev/null @@ -1,411 +0,0 @@ -/* 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; - } -} diff --git a/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/panel.js b/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/panel.js deleted file mode 100644 index 3c2bf099d..000000000 --- a/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/panel.js +++ /dev/null @@ -1,552 +0,0 @@ -// 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; - } -}); diff --git a/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/rpc.js b/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/rpc.js deleted file mode 100644 index 2604afa8e..000000000 --- a/luci-app-dae/luci-app-dae/htdocs/luci-static/resources/view/dae/rpc.js +++ /dev/null @@ -1,280 +0,0 @@ -// 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 -}); diff --git a/luci-app-dae/luci-app-dae/po/zh_Hans/luci-app-dae.po b/luci-app-dae/luci-app-dae/po/zh_Hans/luci-app-dae.po deleted file mode 100644 index ac0a949c7..000000000 --- a/luci-app-dae/luci-app-dae/po/zh_Hans/luci-app-dae.po +++ /dev/null @@ -1,285 +0,0 @@ -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 \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 "请输入面板地址。" diff --git a/luci-app-dae/luci-app-dae/po/zh_Hant/luci-app-dae.po b/luci-app-dae/luci-app-dae/po/zh_Hant/luci-app-dae.po deleted file mode 100644 index 09dd7bee7..000000000 --- a/luci-app-dae/luci-app-dae/po/zh_Hant/luci-app-dae.po +++ /dev/null @@ -1,285 +0,0 @@ -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 \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 "請輸入面板位址。" diff --git a/luci-app-dae/luci-app-dae/root/usr/libexec/rpcd/dae b/luci-app-dae/luci-app-dae/root/usr/libexec/rpcd/dae deleted file mode 100755 index 39a2919db..000000000 --- a/luci-app-dae/luci-app-dae/root/usr/libexec/rpcd/dae +++ /dev/null @@ -1,666 +0,0 @@ -#!/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 2>&1 & - else - "$GEO_SCRIPT" /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 ". -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 diff --git a/luci-app-dae/luci-app-dae/root/usr/share/licenses/luci-app-dae/LICENSE b/luci-app-dae/luci-app-dae/root/usr/share/licenses/luci-app-dae/LICENSE deleted file mode 100644 index f288702d2..000000000 --- a/luci-app-dae/luci-app-dae/root/usr/share/licenses/luci-app-dae/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - 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. - - - Copyright (C) - - 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 . - -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: - - Copyright (C) - 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 -. - - 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 -. diff --git a/luci-app-dae/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json b/luci-app-dae/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json deleted file mode 100644 index 927d30539..000000000 --- a/luci-app-dae/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "admin/services/dae": { - "title": "dae", - "order": 30, - "action": { - "type": "firstchild" - } - }, - "admin/services/dae/panel": { - "title": "Panel", - "order": 10, - "action": { - "type": "view", - "path": "dae/panel" - } - } -} diff --git a/luci-app-dae/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae-admin.json b/luci-app-dae/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae-admin.json deleted file mode 100644 index 29682a222..000000000 --- a/luci-app-dae/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae-admin.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "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" - ] - } - } - } -} diff --git a/luci-app-dae/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae-read.json b/luci-app-dae/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae-read.json deleted file mode 100644 index dd1803a34..000000000 --- a/luci-app-dae/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae-read.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "luci-app-dae-read": { - "description": "Grant read-only access to the dae service state", - "read": { - "ubus": { - "dae": [ "status", "geo_status" ] - } - } - } -} diff --git a/luci-app-dae/po/templates/dae.pot b/luci-app-dae/po/templates/dae.pot new file mode 100644 index 000000000..787f9fcaf --- /dev/null +++ b/luci-app-dae/po/templates/dae.pot @@ -0,0 +1,104 @@ +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 "" diff --git a/luci-app-hermes/po/zh-cn b/luci-app-dae/po/zh-cn similarity index 100% rename from luci-app-hermes/po/zh-cn rename to luci-app-dae/po/zh-cn diff --git a/luci-app-dae/po/zh_Hans/dae.po b/luci-app-dae/po/zh_Hans/dae.po new file mode 100644 index 000000000..26c3bbd6f --- /dev/null +++ b/luci-app-dae/po/zh_Hans/dae.po @@ -0,0 +1,111 @@ +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 高性能透明代理解决方案。" diff --git a/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json b/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json new file mode 100644 index 000000000..aa5e87131 --- /dev/null +++ b/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json @@ -0,0 +1,39 @@ +{ + "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" + } + } +} diff --git a/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae.json b/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae.json new file mode 100644 index 000000000..ee36b2787 --- /dev/null +++ b/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae.json @@ -0,0 +1,23 @@ +{ + "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" ] + } + } +} diff --git a/luci-app-devgate/Makefile b/luci-app-devgate/Makefile index 105f90903..a39a285c4 100644 --- a/luci-app-devgate/Makefile +++ b/luci-app-devgate/Makefile @@ -12,7 +12,7 @@ LUCI_PKGARCH:=all LUCI_MINIFY_CSS:=0 PKG_VERSION:=3.2.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 define Build/Compile endef diff --git a/luci-app-hermes/LICENSE b/luci-app-hermes/LICENSE deleted file mode 100644 index f288702d2..000000000 --- a/luci-app-hermes/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - 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. - - - Copyright (C) - - 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 . - -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: - - Copyright (C) - 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 -. - - 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 -. diff --git a/luci-app-hermes/Makefile b/luci-app-hermes/Makefile index e53333664..1d264b2bc 100644 --- a/luci-app-hermes/Makefile +++ b/luci-app-hermes/Makefile @@ -1,84 +1,17 @@ -# luci-app-hermes — OpenWrt LuCI plugin for Hermes Agent (Python AI Gateway) -# Dual-version: supports luci 18.06 (Lua CBI) + luci 24.10+ (JS view) -# Works as feeds source or standalone in package/ directory include $(TOPDIR)/rules.mk -PKG_NAME:=luci-app-hermes -PKG_VERSION:=2026.05.10 -PKG_RELEASE:=3 +PKG_VERSION:=1.0.0-r20240101 +PKG_RELEASE:=4 -PKG_MAINTAINER:=Hermes Agent -PKG_LICENSE:=GPL-3.0 - -LUCI_TITLE:=Hermes AI Agent Gateway -LUCI_DEPENDS:=+luci-compat +luci-base +python3 +python3-pip +LUCI_TITLE:=LuCI support for Hermes LUCI_PKGARCH:=all +LUCI_DEPENDS:=+docker +dockerd +luci-lib-taskd -# Prefer feeds/luci/luci.mk (handles install + i18n automatically) -LUCI_MK:=$(firstword $(wildcard $(TOPDIR)/feeds/luci/luci.mk)) - -ifneq ($(LUCI_MK),) - include $(LUCI_MK) -else - # Standalone mode: no luci feed available - include $(INCLUDE_DIR)/package.mk - - define Package/$(PKG_NAME) - SECTION:=luci - CATEGORY:=LuCI - SUBMENU:=3. Applications - TITLE:=$(LUCI_TITLE) - DEPENDS:=$(LUCI_DEPENDS) - PKGARCH:=all - endef - - define Package/$(PKG_NAME)/description - Hermes Agent AI Gateway LuCI management plugin. - Python-based AI agent with web UI, gateway, and terminal. - endef - - define Package/$(PKG_NAME)/install - # JS view (luci 24.10+) - $(INSTALL_DIR) $(1)/www/luci-static/resources/view - $(INSTALL_DATA) ./htdocs/luci-static/resources/view/hermes.js \ - $(1)/www/luci-static/resources/view/hermes.js - # Lua compat (luci 18.06) - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller - $(INSTALL_DATA) ./luasrc/controller/hermes.lua \ - $(1)/usr/lib/lua/luci/controller/hermes.lua - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi - $(INSTALL_DATA) ./luasrc/model/cbi/hermes.lua \ - $(1)/usr/lib/lua/luci/model/cbi/hermes.lua - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/hermes - $(INSTALL_DATA) ./luasrc/view/hermes/status.htm \ - $(1)/usr/lib/lua/luci/view/hermes/status.htm - $(INSTALL_DATA) ./luasrc/view/hermes/console.htm \ - $(1)/usr/lib/lua/luci/view/hermes/console.htm - $(INSTALL_DATA) ./luasrc/view/hermes/terminal.htm \ - $(1)/usr/lib/lua/luci/view/hermes/terminal.htm - # root overlay - $(CP) ./root/* $(1)/ - # fix permissions - chmod 755 $(1)/etc/init.d/hermes 2>/dev/null || true - chmod 755 $(1)/etc/uci-defaults/99-hermes 2>/dev/null || true - chmod 755 $(1)/usr/bin/hermes-env 2>/dev/null || true - chmod 755 $(1)/usr/share/hermes/luci-helper 2>/dev/null || true - chmod 755 $(1)/usr/share/hermes/web-pty.py 2>/dev/null || true - endef -endif - -define Package/$(PKG_NAME)/conffiles +define Package/luci-app-hermes/conffiles /etc/config/hermes endef -define Package/$(PKG_NAME)/postinst -#!/bin/sh -[ -n "$${IPKG_INSTROOT}" ] || { - ( . /etc/uci-defaults/99-hermes ) && rm -f /etc/uci-defaults/99-hermes - rm -f /tmp/luci-indexcache /tmp/luci-modulecache/* 2>/dev/null - exit 0 -} -endef +include $(TOPDIR)/feeds/luci/luci.mk -$(eval $(call BuildPackage,$(PKG_NAME))) +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-hermes/README.md b/luci-app-hermes/README.md deleted file mode 100644 index c9c815750..000000000 --- a/luci-app-hermes/README.md +++ /dev/null @@ -1,167 +0,0 @@ -# luci-app-hermes - -OpenWrt LuCI 插件,为 [Hermes Agent](https://github.com/nousresearch/hermes-agent) 提供 Web 管理界面。 - -[![Release](https://img.shields.io/github/v/release/Boos4721/luci-app-hermes)](https://github.com/Boos4721/luci-app-hermes/releases) -[![Build IPK](https://img.shields.io/github/actions/workflow/status/Boos4721/luci-app-hermes/build-ipk.yml?label=build-ipk)](https://github.com/Boos4721/luci-app-hermes/actions/workflows/build-ipk.yml) -[![License](https://img.shields.io/badge/license-GPL--3.0-blue)](LICENSE) - -## 功能特性 - -- **一键安装**:自动下载 Python3 + 创建虚拟环境 + 安装 Hermes Agent,适配 OpenWrt/ImmortalWrt -- **Web 管理界面**:概况、设置、Web 控制台、配置终端 全中文 UI -- **Web 控制台**:内嵌 Hermes Agent Gateway Web UI,支持完整 AI 交互 -- **配置终端**:内嵌 WebSocket PTY,支持交互式配置管理 -- **资源自适应**:根据设备内存自动限制 Python 进程内存,防止 OOM -- **磁盘空间优化**:安装前预检空间,PyPI 多镜像重试(阿里云 → 清华 → PyPI 官方) -- **BusyBox 兼容**:完整适配 OpenWrt BusyBox 环境 -- **OpenWrt 安全**:LuCI 鉴权保护,Token 认证机制 -- **服务管理**:支持 Gateway 和 PTY 独立启停、自动重启 - -## 支持架构 - -| 架构 | 说明 | -|------|------| -| all | 架构无关包,Python 运行时通过 opkg 自动安装 | - -支持所有 OpenWrt/ImmortalWrt 设备(x86_64、aarch64、armv7l 等)。 - ---- - -## 安装(推荐) - -在 OpenWrt 路由器上执行一条命令即可完成安装: - -```sh -opkg update && opkg install luci-app-hermes -``` - -或者使用一键脚本(从 GitHub 直接安装): - -```sh -sh -c "$(wget -qO- https://cdn.jsdelivr.net/gh/Boos4721/luci-app-hermes@main/scripts/install.sh)" -``` - -> 脚本会自动下载最新版 `.ipk`,通过 `opkg` 安装,并清除 LuCI 缓存。 - ---- - -### 方式二:手动下载 IPK - -从 [Releases](https://github.com/Boos4721/luci-app-hermes/releases) 页面下载最新版: - -```sh -wget -O /tmp/luci-app-hermes.ipk \ - https://github.com/Boos4721/luci-app-hermes/releases/latest/download/luci-app-hermes_*_all.ipk -opkg install --force-reinstall /tmp/luci-app-hermes.ipk -``` - -### 方式三:作为 OpenWrt feeds - -```bash -# 在 feeds.conf.default 中添加 -src-git hermes https://github.com/Boos4721/luci-app-hermes.git - -# 更新并安装 -./scripts/feeds update hermes -./scripts/feeds install luci-app-hermes -make package/luci-app-hermes/compile V=s -``` - ---- - -## 安装后配置 - -1. 打开 LuCI → **服务** → **Hermes Agent** -2. 点击 **更多** → **安装环境**,等待 Python3 + Hermes Agent 安装完成(约 5~15 分钟) -3. 启用服务,在 **设置** 中配置 API Endpoint 和 API Key -4. 在 **Web 控制台** 中与 AI 模型交互 - -## 磁盘空间不足解决方案 - -OpenWrt 设备 root 分区通常只有 1GB 以下,Python + Hermes Agent 安装包约 500MB。 - -**解决方案:bind mount tmpfs** - -```bash -# 在 /etc/rc.local 中添加(开机自动执行) -mkdir -p /tmp/hermes -mount --bind /tmp/hermes /opt/hermes -``` - -> `/tmp` 通常挂载为 tmpfs,大小约为物理内存的 50%,重启后数据丢失,需重新安装 - ---- - -## 目录结构 - -``` -luci-app-hermes/ -├── .github/workflows/ -│ └── build-ipk.yml # 自动编译 IPK,推送 tag 时触发 -├── htdocs/ -│ └── luci-static/resources/view/ -│ └── hermes.js # LuCI JS 视图(主 UI) -├── luasrc/ -│ ├── controller/hermes.lua # LuCI 路由控制器 -│ ├── model/cbi/hermes.lua # CBI 配置模型(兼容旧版 LuCI) -│ └── view/hermes/ # Lua 视图模板 -├── root/ -│ ├── etc/ -│ │ ├── config/hermes # UCI 默认配置 -│ │ ├── init.d/hermes # procd 服务脚本 -│ │ └── uci-defaults/ # 首次安装初始化 -│ └── usr/ -│ ├── bin/hermes-env # 安装/管理脚本(核心) -│ └── share/hermes/ -│ ├── luci-helper # LuCI RPC 辅助脚本 -│ ├── web-pty.py # WebSocket PTY 服务器 -│ └── ui/ # Web 控制台 UI -├── po/zh_Hans/hermes.po # 中文翻译 -├── scripts/ -│ └── install.sh # 一键安装脚本 -├── Makefile -├── VERSION -└── LICENSE -``` - ---- - -## 常见问题 - -**Q: 安装时提示 python3 找不到** -A: 插件依赖 `python3` 和 `python3-pip`,确保 OpenWrt 软件源已更新(`opkg update`)。 - -**Q: Hermes Agent 安装失败,pip 超时** -A: hermes-env 已内置三镜像重试(阿里云 → 清华 → PyPI 官方)。如仍失败,检查路由器 DNS 和网络连接,或手动执行 `hermes-env setup` 查看详细日志。 - -**Q: 安装完成后 Gateway 不启动** -A: 检查磁盘空间:`df -h /opt`,若已满需配置 bind mount 到 tmpfs。同时确认 Python 虚拟环境已正确安装:`hermes-env check`。 - -**Q: 内存不足设备如何使用** -A: 插件自动根据内存设置进程限制(512MB RAM → 限制 256MB),无需手动配置。 - -**Q: Web 控制台无法访问** -A: 确保服务已启用并在 **设置** 中配置了正确的 API Endpoint 和 API Key。Gateway 默认端口 3000,PTY 端口 3001。 - -**Q: 配置终端无法输入** -A: 确保点击终端区域使其获得焦点,然后输入命令并按 Enter。 - ---- - -## 版本历史 - -| 版本 | 日期 | 主要变更 | -|------|------|---------| -| 2026.05.10 | 2026-05-10 | 初始发布,支持 LuCI 24/25,Python-based 架构 | - ---- - -## 致谢 - -- [Hermes Agent](https://github.com/nousresearch/hermes-agent) — AI Agent 核心 -- [ImmortalWrt](https://immortalwrt.org) — 主要测试平台 - -## License - -GPL-3.0 © [Boos4721](https://github.com/Boos4721) diff --git a/luci-app-hermes/VERSION b/luci-app-hermes/VERSION deleted file mode 100644 index d41070355..000000000 --- a/luci-app-hermes/VERSION +++ /dev/null @@ -1 +0,0 @@ -2026.05.10 diff --git a/luci-app-hermes/htdocs/luci-static/resources/view/hermes.js b/luci-app-hermes/htdocs/luci-static/resources/view/hermes.js deleted file mode 100644 index a01dbfcb5..000000000 --- a/luci-app-hermes/htdocs/luci-static/resources/view/hermes.js +++ /dev/null @@ -1,686 +0,0 @@ -'use strict'; -'require view'; -'require dom'; -'require ui'; -'require uci'; -'require fs'; -'require poll'; - -var HELPER = '/usr/share/hermes/luci-helper'; - -function callHelper(args) { - return L.resolveDefault(fs.exec_direct(HELPER, args), '').then(function(res) { - try { return JSON.parse(String(res).trim()); } - catch(e) { return {}; } - }); -} - -function fmtMem(kb) { - kb = parseInt(kb) || 0; - if (kb <= 0) return '-'; - if (kb >= 1048576) return (kb / 1048576).toFixed(1) + ' GB'; - if (kb >= 1024) return (kb / 1024).toFixed(1) + ' MB'; - return kb + ' KB'; -} - -/* ── Logo ── */ -var LOGO_SVG = ''; - -/* ── CSS: inherit page theme ── */ -var CSS = '\ -*,*::before,*::after{box-sizing:border-box}\ -#hm-app{margin:0;padding:0;width:100%;color:inherit}\ -.hm-header{padding:6px 0 4px;display:flex;align-items:center;gap:10px}\ -.hm-header h2{margin:0;font-size:20px;font-weight:600;color:inherit}\ -.hm-header .sub{font-size:11px;opacity:.5;margin-top:2px;letter-spacing:.3px}\ -.hm-header>*,.hm-header h2,.hm-header .sub{background:transparent!important;box-shadow:none!important;border:none!important;border-radius:0!important;padding:0!important;margin:0!important}\ -.hm-tabs{display:flex;border-bottom:2px solid currentColor;border-bottom-color:rgba(128,128,128,.25);overflow:hidden}\ -.hm-tab{padding:10px 18px;font-size:13px;font-weight:500;opacity:.55;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .2s;white-space:nowrap;user-select:none;color:inherit}\ -.hm-tab:hover{opacity:.85}\ -.hm-tab.active{opacity:1;border-bottom-color:var(--primary,#5e72e4)}\ -.hm-panel{display:none;padding:20px 0}\ -.hm-panel.active{display:block}\ -.hm-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px}\ -.hm-card{border:1px solid rgba(128,128,128,.2);border-radius:10px;padding:14px 16px}\ -.hm-card .lbl{font-size:11px;opacity:.55;letter-spacing:.3px}\ -.hm-card .val{font-size:22px;font-weight:700;margin-top:4px;line-height:1.2}\ -.hm-card .val.sm{font-size:15px;font-weight:600}\ -.hm-badge{display:inline-block;padding:3px 14px;border-radius:20px;font-size:12px;font-weight:600}\ -.hm-badge-run{background:#e8f5e9;color:#2e7d32}\ -.hm-badge-stop{background:#ffebee;color:#c62828}\ -.hm-badge-start{background:#fff8e1;color:#f57f17}\ -.hm-badge-off{opacity:.5}\ -.hm-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px;vertical-align:middle}\ -.hm-dot-g{background:#2e7d32}.hm-dot-r{background:#c62828}.hm-dot-y{background:#f57f17}.hm-dot-x{background:#9e9e9e}\ -.hm-info{border:1px solid rgba(128,128,128,.2);border-radius:10px;padding:0;overflow:hidden;margin-bottom:20px}\ -.hm-info-title{padding:12px 18px;font-size:13px;font-weight:600;opacity:.7;border-bottom:1px solid rgba(128,128,128,.15)}\ -.hm-info table{width:100%;border-collapse:collapse}\ -.hm-info tr,.hm-info tr:nth-of-type(2n){background:transparent!important}\ -.hm-info td{padding:8px 16px;font-size:13px;border-bottom:1px solid rgba(128,128,128,.1)}\ -.hm-info tr:last-child td{border-bottom:none}\ -.hm-info td:first-child{width:100px;opacity:.6;font-weight:500}\ -.hm-info td:last-child{word-break:break-all}\ -.hm-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:16px}\ -.hm-btn{padding:8px 16px;border:none;border-radius:8px;font-size:13px;font-weight:500;cursor:pointer;transition:all .15s;display:inline-flex;align-items:center;gap:6px}\ -.hm-btn:hover{filter:brightness(.93)}\ -.hm-btn:active{transform:scale(.97)}\ -.hm-btn:disabled{opacity:.5;cursor:not-allowed;transform:none;filter:none}\ -.hm-btn-p{background:var(--primary,#5e72e4);color:#fff}\ -.hm-btn-s{background:#1b5e20;color:#fff;box-shadow:0 2px 6px rgba(27,94,32,.35)}\ -.hm-btn-s:hover{background:#2e7d32}\ -.hm-btn-d{background:#37474f;color:#fff;box-shadow:0 2px 6px rgba(55,71,79,.3)}\ -.hm-btn-d:hover{background:#546e7a}\ -.hm-btn-r{background:#1565c0;color:#fff;box-shadow:0 2px 6px rgba(21,101,192,.35)}\ -.hm-btn-r:hover{background:#1976d2}\ -.hm-btn-g{border:1px solid rgba(128,128,128,.3);color:inherit;background:transparent}\ -.hm-btn-icon{padding:6px 10px;font-size:16px;line-height:1;min-width:unset}\ -.hm-log-wrap{margin-top:16px;display:none}\ -.hm-log-hdr{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}\ -.hm-log-hdr span{font-weight:600;font-size:13px;opacity:.7}\ -.hm-log-st{font-size:12px}\ -.hm-log{background:#1e1e2e;color:#cdd6f4;padding:14px 16px;border-radius:8px;font-family:Consolas,Monaco,"Courier New",monospace;font-size:12px;line-height:1.6;max-height:380px;overflow-y:auto;white-space:pre-wrap;word-break:break-all;border:1px solid #313244}\ -.hm-log-result{margin-top:10px;padding:12px 16px;border-radius:8px;font-size:13px}\ -.hm-log-ok{background:#e8f5e9;border:1px solid #c8e6c9;color:#2e7d32}\ -.hm-log-fail{background:#ffebee;border:1px solid #ffcdd2;color:#c62828}\ -.hm-form{border:1px solid rgba(128,128,128,.2);border-radius:10px;overflow:hidden;margin-bottom:20px}\ -.hm-form-title{padding:12px 18px;font-size:13px;font-weight:600;opacity:.7;border-bottom:1px solid rgba(128,128,128,.15)}\ -.hm-form-body{padding:6px 18px}\ -.hm-form-row{display:flex;align-items:center;padding:12px 0;border-bottom:1px solid rgba(128,128,128,.1)}\ -.hm-form-row:last-child{border-bottom:none}\ -.hm-form-lbl{width:120px;font-size:13px;font-weight:500;opacity:.7;flex-shrink:0}\ -.hm-form-ctl{flex:1;min-width:0}\ -.hm-form-ctl input,.hm-form-ctl select{padding:7px 10px;border:1px solid rgba(128,128,128,.3);border-radius:6px;font-size:13px;width:100%;max-width:260px;outline:none;transition:border-color .2s;background:transparent;color:inherit}\ -.hm-form-ctl input:focus,.hm-form-ctl select:focus{border-color:var(--primary,#5e72e4)}\ -.hm-form-hint{font-size:11px;opacity:.5;margin-top:3px}\ -.hm-iframe-wrap{border:2px solid rgba(128,128,128,.2);border-radius:10px;overflow:hidden;margin-top:10px}\ -.hm-iframe-wrap iframe{width:100%;height:650px;border:none;display:block}\ -.hm-iframe-msg{padding:48px;text-align:center;opacity:.55;font-size:14px;line-height:1.8}\ -.hm-iframe-msg .icon{font-size:36px;margin-bottom:12px}\ -.hm-switch{position:relative;display:inline-block;width:44px;height:24px}\ -.hm-switch input{opacity:0;width:0;height:0}\ -.hm-switch .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:rgba(128,128,128,.35);border-radius:24px;transition:.3s}\ -.hm-switch .slider:before{position:absolute;content:"";height:18px;width:18px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:.3s}\ -.hm-switch input:checked+.slider{background:var(--primary,#5e72e4)}\ -.hm-switch input:checked+.slider:before{transform:translateX(20px)}\ -.hm-more-wrap{position:relative;display:inline-block}\ -.hm-more-menu{position:fixed;border:1px solid rgba(128,128,128,.2);border-radius:10px;box-shadow:0 -4px 20px rgba(0,0,0,.15);min-width:190px;z-index:9999;display:none;overflow:hidden;padding:4px 0;background:var(--background-color-low,#f8f8f8)}\ -.hm-more-item{display:flex;align-items:center;gap:8px;padding:10px 16px;font-size:13px;cursor:pointer;border:none;background:none;width:100%;text-align:left;transition:background .12s;color:inherit}\ -.hm-more-item:hover{background:rgba(128,128,128,.1)}\ -.hm-more-item.danger{color:inherit;background:none}\ -.hm-more-item.danger:hover{background:rgba(128,128,128,.1)}\ -.hm-more-sep{height:1px;background:rgba(128,128,128,.15);margin:4px 0}\ -@media(max-width:768px){\ -#hm-app{padding:0 10px;overflow-x:hidden}\ -.hm-tabs{max-width:100%}\ -.hm-header{padding:8px 0;gap:10px}\ -.hm-header h2{font-size:16px}\ -.hm-cards{grid-template-columns:repeat(2,1fr);gap:10px}\ -.hm-card .val{font-size:17px}\ -.hm-card .val.sm{font-size:13px}\ -.hm-actions{gap:6px;flex-wrap:wrap;max-width:100%}\ -.hm-actions>*{flex:0 1 auto;min-width:0}\ -.hm-actions .hm-btn{padding:7px 10px;font-size:12px;white-space:nowrap;justify-content:center}\ -.hm-form-row{flex-direction:column;align-items:stretch;gap:4px}\ -.hm-form-lbl{width:auto}\ -.hm-form-ctl input,.hm-form-ctl select{max-width:100%}\ -.hm-iframe-wrap iframe{height:400px}\ -.hm-info td:first-child{width:80px}\ -}\ -@media(max-width:420px){\ -.hm-header{padding:6px 0}\ -.hm-header h2{font-size:15px}\ -.hm-tab{padding:9px 14px;font-size:12px}\ -.hm-btn{padding:6px 10px;font-size:12px}\ -.hm-actions .hm-btn{padding:6px 8px;font-size:11px}\ -.hm-info td{padding:7px 12px;font-size:12px}\ -.hm-cards{gap:8px}\ -.hm-card{padding:10px 12px}\ -.hm-card .val{font-size:16px}\ -.hm-iframe-wrap iframe{height:350px}\ -}\ -'; - -return view.extend({ - - load: function() { - return Promise.all([ - uci.load('hermes'), - callHelper(['status']) - ]); - }, - - render: function(data) { - var st = data[1] || {}; - this._st = st; - this._setupTimer = null; - this._tabEls = {}; - - var contentEl = E('div', { 'id': 'hm-content' }, [ - this._overview(st), - this._settings(), - this._console(st), - this._terminal(st) - ]); - this._contentEl = contentEl; - - var app = E('div', { 'id': 'hm-app' }, [ - E('style', {}, [CSS]), - this._header(), - this._tabBar(), - contentEl - ]); - - this._switchTab('overview'); - poll.add(L.bind(this._poll, this), 5); - - document.addEventListener('click', function() { - var m = document.getElementById('hm-more-menu'); - if (m) m.style.display = 'none'; - }); - - return app; - }, - - /* ═══ Header ═══ */ - _header: function() { - var h = E('div', { 'class': 'hm-header' }); - h.innerHTML = LOGO_SVG + - '

Hermes Agent

' + - '
' + _('Python AI Agent Gateway for OpenWrt') + '
'; - return h; - }, - - /* ═══ Tabs ═══ */ - _tabBar: function() { - var self = this; - var tabs = [ - ['overview', _('Overview')], - ['settings', _('Settings')], - ['console', _('Web Console')], - ['terminal', _('Config Terminal')] - ]; - var bar = E('div', { 'class': 'hm-tabs' }); - tabs.forEach(function(t) { - var el = E('div', { - 'class': 'hm-tab', - 'data-tab': t[0], - 'click': function() { self._switchTab(t[0]); } - }, [t[1]]); - self._tabEls[t[0]] = el; - bar.appendChild(el); - }); - return bar; - }, - - _switchTab: function(id) { - var self = this; - Object.keys(this._tabEls).forEach(function(k) { - self._tabEls[k].classList.toggle('active', k === id); - }); - var root = this._contentEl || document.getElementById('hm-content'); - if (root) { - var panels = root.querySelectorAll('.hm-panel'); - if (panels) panels.forEach(function(p) { - p.classList.toggle('active', p.getAttribute('data-panel') === id); - }); - } - }, - - /* ═══ Overview Panel ═══ */ - _overview: function(st) { - return E('div', { 'class': 'hm-panel', 'data-panel': 'overview' }, [ - /* Status Cards */ - E('div', { 'class': 'hm-cards' }, [ - this._card('status', _('Service Status'), this._badge(st)), - this._card('port', _('Gateway Port'), st.port || '3000', true), - this._card('memory', _('Memory'), fmtMem(st.memory_kb), true), - this._card('uptime', _('Uptime'), st.uptime || '-', true) - ]), - /* Version Info */ - this._infoTable(st), - /* Action Buttons */ - this._actionBtns(), - /* Log Viewer */ - this._logViewer() - ]); - }, - - _card: function(id, label, valueHtml, small) { - var c = E('div', { 'class': 'hm-card' }, [ - E('div', { 'class': 'lbl' }, [label]), - E('div', { 'class': 'val' + (small ? ' sm' : ''), 'id': 'hm-c-' + id }) - ]); - if (typeof valueHtml === 'string' && valueHtml.indexOf('<') >= 0) - c.querySelector('.val').innerHTML = valueHtml; - else - c.querySelector('.val').textContent = valueHtml || '-'; - return c; - }, - - _badge: function(st) { - if (!st || !st.enabled) return '' + _('Unknown') + ''; - if (st.enabled !== '1') return '' + _('Disabled') + ''; - if (st.gateway_running) return '' + _('Running') + ''; - if (st.gateway_starting) return '' + _('Starting') + ''; - return '' + _('Stopped') + ''; - }, - - _infoTable: function(st) { - var rows = [ - [_('Python'), 'hm-i-python', st.python_version || _('Not installed')], - [_('Hermes'), 'hm-i-hermes', st.hermes_version || _('Not installed')], - [_('Plugin'), 'hm-i-plugin', st.plugin_version || '-'], - [_('Model'), 'hm-i-model', st.active_model || '-'], - [_('PID'), 'hm-i-pid', st.pid || '-'], - [_('Config PTY'), 'hm-i-pty', st.pty_running ? '✅ ' + _('Running') + ' (:' + (st.pty_port || '3001') + ')' : '⏹ ' + _('Stopped')] - ]; - var tbody = E('tbody'); - rows.forEach(function(r) { - tbody.appendChild(E('tr', {}, [ - E('td', {}, [r[0]]), - E('td', { 'id': r[1] }, [r[2]]) - ])); - }); - return E('div', { 'class': 'hm-info' }, [ - E('div', { 'class': 'hm-info-title' }, [_('System Information')]), - E('table', {}, [tbody]) - ]); - }, - - _actionBtns: function() { - var self = this; - var wrap = E('div', { 'class': 'hm-actions' }); - - wrap.appendChild(E('button', { - 'class': 'hm-btn hm-btn-s', 'id': 'hm-btn-start', - 'click': function() { self._svcCtl('start'); } - }, ['▶ ' + _('Start')])); - - wrap.appendChild(E('button', { - 'class': 'hm-btn hm-btn-d', 'id': 'hm-btn-stop', - 'click': function() { self._svcCtl('stop'); } - }, ['⏹ ' + _('Stop')])); - - wrap.appendChild(E('button', { - 'class': 'hm-btn hm-btn-r', 'id': 'hm-btn-restart', - 'click': function() { self._svcCtl('restart'); } - }, ['🔄 ' + _('Restart')])); - - /* More menu */ - var gearWrap = E('div', { 'class': 'hm-more-wrap' }); - gearWrap.appendChild(E('button', { - 'class': 'hm-btn hm-btn-g hm-btn-icon', 'title': _('More'), - 'click': function(ev) { - ev.stopPropagation(); - var m = document.getElementById('hm-more-menu'); - if (!m) return; - if (m.style.display === 'block') { m.style.display = 'none'; return; } - var rect = ev.currentTarget.getBoundingClientRect(); - m.style.display = 'block'; - var mh = m.offsetHeight; - m.style.top = (rect.top - mh - 6) + 'px'; - m.style.left = 'auto'; - m.style.right = (window.innerWidth - rect.right) + 'px'; - } - }, ['⚙'])); - - gearWrap.appendChild(E('div', { 'class': 'hm-more-menu', 'id': 'hm-more-menu' }, [ - E('div', { 'class': 'hm-more-item', 'click': function() { self._closeMenu(); self._showSetupDialog(); } }, ['📦 ' + _('Install Environment')]), - E('div', { 'class': 'hm-more-sep' }), - E('div', { 'class': 'hm-more-item', 'click': function() { self._closeMenu(); self._uninstall(); } }, ['🗑️ ' + _('Uninstall')]) - ])); - - wrap.appendChild(gearWrap); - return wrap; - }, - - _closeMenu: function() { - var m = document.getElementById('hm-more-menu'); - if (m) m.style.display = 'none'; - }, - - _logViewer: function() { - return E('div', { 'class': 'hm-log-wrap', 'id': 'hm-log-wrap' }, [ - E('div', { 'class': 'hm-log-hdr' }, [ - E('span', { 'id': 'hm-log-title' }, ['📋 ' + _('Log')]), - E('span', { 'class': 'hm-log-st', 'id': 'hm-log-st' }) - ]), - E('pre', { 'class': 'hm-log', 'id': 'hm-log' }), - E('div', { 'id': 'hm-log-result' }) - ]); - }, - - /* ═══ Settings Panel ═══ */ - _settings: function() { - var self = this; - var enabled = uci.get('hermes', 'main', 'enabled') === '1'; - var port = uci.get('hermes', 'main', 'port') || '3000'; - var bind = uci.get('hermes', 'main', 'bind') || 'lan'; - var ptyPort = uci.get('hermes', 'main', 'pty_port') || '3001'; - var apiEndpoint = uci.get('hermes', 'main', 'api_endpoint') || 'https://api.boos.lat/v1'; - var apiKey = uci.get('hermes', 'main', 'api_key') || ''; - var model = uci.get('hermes', 'main', 'model') || 'opus4.6'; - - return E('div', { 'class': 'hm-panel', 'data-panel': 'settings' }, [ - E('div', { 'class': 'hm-form' }, [ - E('div', { 'class': 'hm-form-title' }, [_('Basic Settings')]), - E('div', { 'class': 'hm-form-body' }, [ - this._formRow(_('Enable Service'), this._toggle('hm-f-enabled', enabled)), - this._formRow(_('Gateway Port'), this._input('hm-f-port', port, 'number', _('Default: 3000'))), - this._formRow(_('Listen Interface'), this._select('hm-f-bind', bind, [ - ['lan', 'LAN'], - ['loopback', 'Loopback'], - ['all', _('All Interfaces')] - ])), - this._formRow(_('PTY Port'), this._input('hm-f-pty-port', ptyPort, 'number', _('Default: 3001'))) - ]) - ]), - E('div', { 'class': 'hm-form' }, [ - E('div', { 'class': 'hm-form-title' }, [_('API Settings')]), - E('div', { 'class': 'hm-form-body' }, [ - this._formRow(_('API Endpoint'), this._input('hm-f-api-endpoint', apiEndpoint, 'text', _('Default: https://api.boos.lat/v1'))), - this._formRow(_('API Key'), this._input('hm-f-api-key', apiKey, 'password', _('Your API key'))), - this._formRow(_('Model'), this._input('hm-f-model', model, 'text', _('Default: opus4.6'))) - ]) - ]), - E('div', { 'class': 'hm-actions' }, [ - E('button', { 'class': 'hm-btn hm-btn-p', 'click': function() { self._saveSettings(); } }, ['💾 ' + _('Save & Apply')]), - E('button', { 'class': 'hm-btn hm-btn-g', 'click': function() { location.reload(); } }, [_('Reset')]) - ]) - ]); - }, - - _formRow: function(label, control) { - return E('div', { 'class': 'hm-form-row' }, [ - E('div', { 'class': 'hm-form-lbl' }, [label]), - E('div', { 'class': 'hm-form-ctl' }, [control]) - ]); - }, - - _toggle: function(id, checked) { - var lbl = E('label', { 'class': 'hm-switch' }); - lbl.innerHTML = ''; - return lbl; - }, - - _input: function(id, value, type, hint) { - var wrap = E('div'); - wrap.appendChild(E('input', { 'type': type || 'text', 'id': id, 'value': value })); - if (hint) wrap.appendChild(E('div', { 'class': 'hm-form-hint' }, [hint])); - return wrap; - }, - - _select: function(id, value, opts) { - var sel = E('select', { 'id': id }); - opts.forEach(function(o) { - var opt = E('option', { 'value': o[0] }, [o[1]]); - if (o[0] === value) opt.setAttribute('selected', 'selected'); - sel.appendChild(opt); - }); - return sel; - }, - - /* ═══ Console Panel ═══ */ - _console: function(st) { - var panel = E('div', { 'class': 'hm-panel', 'data-panel': 'console' }); - var container = E('div', { 'class': 'hm-iframe-wrap' }); - - if (st.gateway_running) { - var proto = window.location.protocol; - var host = window.location.hostname; - var base = proto + '//' + host + ':' + (st.port || '3000') + '/'; - - container.innerHTML = '
⏳
' + _('Connecting...') + '
'; - callHelper(['get_token']).then(function(tok) { - var url = base; - if (tok && tok.token) url += '?token=' + encodeURIComponent(tok.token); - container.innerHTML = ''; - container.appendChild(E('iframe', { - 'src': url, - 'id': 'hm-console-iframe', - 'allow': 'clipboard-read; clipboard-write', - 'style': 'width:100%;height:650px;border:none;display:block', - 'loading': 'lazy' - })); - }); - } else { - container.innerHTML = '
' + - '
🖥️
' + - '
' + _('Web console is not available.') + '
' + - '
' + _('Please start the Hermes service first.') + '
'; - } - panel.appendChild(container); - return panel; - }, - - /* ═══ Terminal Panel ═══ */ - _terminal: function(st) { - var panel = E('div', { 'class': 'hm-panel', 'data-panel': 'terminal' }); - var container = E('div', { 'class': 'hm-iframe-wrap' }); - - if (st.pty_running) { - var proto = window.location.protocol; - var host = window.location.hostname; - var ptyPort = st.pty_port || '3001'; - var url = proto + '//' + host + ':' + ptyPort + '/'; - - container.innerHTML = '
' + - '
⏳
' + - '
' + _('Connecting to config terminal...') + '
'; - callHelper(['get_token']).then(function(tok) { - if (tok && tok.pty_token) - url += '?token=' + encodeURIComponent(tok.pty_token); - container.innerHTML = ''; - container.appendChild(E('iframe', { - 'src': url, - 'allow': 'clipboard-read; clipboard-write', - 'style': 'width:100%;height:650px;border:none;display:block', - 'loading': 'lazy' - })); - }); - } else { - container.innerHTML = '
' + - '
⌨️
' + - '
' + _('Config terminal is not running.') + '
' + - '
' + _('Please start the Hermes service first.') + '
'; - } - panel.appendChild(container); - return panel; - }, - - /* ═══ Status Polling ═══ */ - _poll: function() { - var self = this; - return callHelper(['status']).then(function(st) { - self._st = st; - self._updateDisplay(st); - }); - }, - - _updateDisplay: function(st) { - var el; - /* Status card */ - el = document.getElementById('hm-c-status'); - if (el) el.innerHTML = this._badge(st); - /* Port */ - el = document.getElementById('hm-c-port'); - if (el) el.textContent = st.port || '3000'; - /* Memory */ - el = document.getElementById('hm-c-memory'); - if (el) el.textContent = fmtMem(st.memory_kb); - /* Uptime */ - el = document.getElementById('hm-c-uptime'); - if (el) el.textContent = st.uptime || '-'; - /* Info rows */ - var map = { - 'hm-i-python': st.python_version || _('Not installed'), - 'hm-i-hermes': st.hermes_version || _('Not installed'), - 'hm-i-plugin': st.plugin_version || '-', - 'hm-i-model': st.active_model || '-', - 'hm-i-pid': st.pid || '-', - 'hm-i-pty': st.pty_running ? '✅ ' + _('Running') + ' (:' + (st.pty_port || '3001') + ')' : '⏹ ' + _('Stopped') - }; - Object.keys(map).forEach(function(id) { - el = document.getElementById(id); - if (el) el.textContent = map[id]; - }); - /* Button states */ - var startBtn = document.getElementById('hm-btn-start'); - var stopBtn = document.getElementById('hm-btn-stop'); - if (startBtn) startBtn.disabled = !!st.gateway_running; - if (stopBtn) stopBtn.disabled = !st.gateway_running; - }, - - /* ═══ Service Control ═══ */ - _svcCtl: function(action) { - var self = this; - ui.showModal(_('Service Control'), [ - E('p', {}, [_('Executing: ') + action + '...']), - E('div', { 'class': 'spinning' }) - ]); - return fs.exec('/etc/init.d/hermes', [action]).then(function() { - return new Promise(function(resolve) { window.setTimeout(resolve, 2500); }); - }).then(function() { - return self._poll(); - }).then(function() { - ui.hideModal(); - }).catch(function(e) { - ui.hideModal(); - ui.addNotification(null, E('p', {}, [_('Error: ') + (e.message || e)])); - }); - }, - - /* ═══ Setup Dialog ═══ */ - _showSetupDialog: function() { - var self = this; - - var overlay = E('div', { 'class': 'hm-dialog-overlay', 'id': 'hm-setup-dlg' }); - var dlg = E('div', { 'class': 'hm-dialog' }, [ - E('h3', {}, ['📦 ' + _('Install Environment')]), - E('div', { 'class': 'hm-dialog-info' }, [ - E('p', {}, [_('This will install Python 3 and Hermes Agent via pip.')]), - E('p', {}, [_('Requires internet connection and sufficient disk space (~100MB).')]) - ]), - E('div', { 'class': 'hm-dialog-btns' }, [ - E('button', { 'class': 'hm-btn hm-btn-g', 'click': function() { overlay.remove(); } }, [_('Cancel')]), - E('button', { 'class': 'hm-btn hm-btn-p', 'click': function() { overlay.remove(); self._doSetup(); } }, [_('Install')]) - ]) - ]); - overlay.appendChild(dlg); - document.body.appendChild(overlay); - }, - - _doSetup: function() { - var self = this; - var logWrap = document.getElementById('hm-log-wrap'); - var logEl = document.getElementById('hm-log'); - var stEl = document.getElementById('hm-log-st'); - var resultEl = document.getElementById('hm-log-result'); - - if (logWrap) logWrap.style.display = 'block'; - if (logEl) logEl.textContent = _('Starting installation') + '...\n'; - if (stEl) stEl.innerHTML = '⏳ ' + _('Installing...') + ''; - if (resultEl) { resultEl.innerHTML = ''; resultEl.className = ''; } - - callHelper(['setup']).then(function() { - self._pollSetupLog(); - }); - }, - - _pollSetupLog: function() { - var self = this; - var lastLen = 0; - if (this._setupTimer) clearInterval(this._setupTimer); - - this._setupTimer = setInterval(function() { - callHelper(['setup_log']).then(function(r) { - var logEl = document.getElementById('hm-log'); - var stEl = document.getElementById('hm-log-st'); - var resultEl = document.getElementById('hm-log-result'); - if (!logEl) return; - - if (r.log && r.log.length > lastLen) { - logEl.textContent += r.log.substring(lastLen); - lastLen = r.log.length; - } - logEl.scrollTop = logEl.scrollHeight; - - if (r.state === 'running') { - if (stEl) stEl.innerHTML = '⏳ ' + _('Installing...') + ''; - } else if (r.state === 'success') { - clearInterval(self._setupTimer); - if (stEl) stEl.innerHTML = '✅ ' + _('Complete') + ''; - if (resultEl) { - resultEl.className = 'hm-log-result hm-log-ok'; - resultEl.innerHTML = '🎉 ' + _('Installation successful!') + '
' + - '' + _('Refresh the page to see updated status.') + '' + - '
'; - } - } else if (r.state === 'failed') { - clearInterval(self._setupTimer); - if (stEl) stEl.innerHTML = '❌ ' + _('Failed') + ''; - if (resultEl) { - resultEl.className = 'hm-log-result hm-log-fail'; - resultEl.textContent = '❌ ' + _('Installation failed. Check the log above for details.'); - } - } - }); - }, 1500); - }, - - /* ═══ Uninstall ═══ */ - _uninstall: function() { - var self = this; - ui.showModal(_('Confirm Uninstall'), [ - E('p', { 'style': 'color:#c62828' }, [ - '⚠️ ' + _('This will remove Python, Hermes Agent, and all related data.') - ]), - E('p', {}, [_('This action cannot be undone.')]), - E('div', { 'style': 'display:flex;gap:10px;justify-content:flex-end;margin-top:16px' }, [ - E('button', { 'class': 'hm-btn hm-btn-g', 'click': function() { ui.hideModal(); } }, [_('Cancel')]), - E('button', { 'class': 'hm-btn hm-btn-d', 'click': function() { - ui.hideModal(); - ui.showModal(_('Uninstalling...'), [E('div', { 'class': 'spinning' })]); - callHelper(['uninstall']).then(function() { - ui.hideModal(); - ui.addNotification(null, E('p', {}, ['✅ ' + _('Environment uninstalled successfully')])); - return self._poll(); - }); - } }, ['🗑️ ' + _('Confirm Uninstall')]) - ]) - ]); - }, - - /* ═══ Save Settings ═══ */ - _saveSettings: function() { - var self = this; - var enabled = document.getElementById('hm-f-enabled'); - var port = document.getElementById('hm-f-port'); - var bind = document.getElementById('hm-f-bind'); - var ptyPort = document.getElementById('hm-f-pty-port'); - var apiEndpoint = document.getElementById('hm-f-api-endpoint'); - var apiKey = document.getElementById('hm-f-api-key'); - var model = document.getElementById('hm-f-model'); - - uci.set('hermes', 'main', 'enabled', enabled && enabled.checked ? '1' : '0'); - if (port) uci.set('hermes', 'main', 'port', port.value); - if (bind) uci.set('hermes', 'main', 'bind', bind.value); - if (ptyPort) uci.set('hermes', 'main', 'pty_port', ptyPort.value); - if (apiEndpoint) uci.set('hermes', 'main', 'api_endpoint', apiEndpoint.value); - if (apiKey) uci.set('hermes', 'main', 'api_key', apiKey.value); - if (model) uci.set('hermes', 'main', 'model', model.value); - - return uci.save().then(function() { - return uci.apply(); - }).then(function() { - ui.addNotification(null, E('p', {}, ['✅ ' + _('Settings saved successfully')])); - return self._poll(); - }).catch(function(e) { - ui.addNotification(null, E('p', {}, [_('Error: ') + (e.message || e)])); - }); - }, - - handleSaveApply: null, - handleSave: null, - handleReset: null -}); diff --git a/luci-app-hermes/luasrc/controller/hermes.lua b/luci-app-hermes/luasrc/controller/hermes.lua index c6fd968c8..45b3c901d 100644 --- a/luci-app-hermes/luasrc/controller/hermes.lua +++ b/luci-app-hermes/luasrc/controller/hermes.lua @@ -1,78 +1,6 @@ --- luci-app-hermes — LuCI Controller (18.06 compat) module("luci.controller.hermes", package.seeall) function index() - -- luci 24.10+ uses menu.d JSON for registration; skip Lua menu - if nixio.fs.access("/usr/share/luci/menu.d/luci-app-hermes.json") then - return - end - - local page = entry({"admin", "services", "hermes"}, - alias("admin", "services", "hermes", "basic"), _("Hermes Agent"), 90) - page.dependent = false - - entry({"admin", "services", "hermes", "basic"}, - cbi("hermes"), _("Basic Settings"), 10).leaf = true - entry({"admin", "services", "hermes", "console"}, - template("hermes/console"), _("Web Console"), 20).leaf = true - entry({"admin", "services", "hermes", "terminal"}, - template("hermes/terminal"), _("Config Terminal"), 30).leaf = true - - -- API endpoints (used by status.htm XHR) - entry({"admin", "services", "hermes", "status_api"}, - call("action_status"), nil).leaf = true - entry({"admin", "services", "hermes", "service_ctl"}, - call("action_service_ctl"), nil).leaf = true - entry({"admin", "services", "hermes", "get_token"}, - call("action_get_token"), nil).leaf = true -end - --- ── Status API ── -function action_status() - local http = require "luci.http" - local sys = require "luci.sys" - - local raw = sys.exec("/usr/share/hermes/luci-helper status 2>/dev/null") - http.prepare_content("application/json") - http.write(raw ~= "" and raw or '{}') -end - --- ── Service Control API ── -function action_service_ctl() - local http = require "luci.http" - local sys = require "luci.sys" - - local action = http.formvalue("action") or "" - local allowed = { start = true, stop = true, restart = true, enable = true, disable = true } - - if not allowed[action] then - http.prepare_content("application/json") - http.write_json({ status = "error", message = "invalid action" }) - return - end - - if action == "stop" then - sys.exec("/etc/init.d/hermes stop >/dev/null 2>&1") - elseif action == "restart" then - sys.exec("/etc/init.d/hermes stop >/dev/null 2>&1") - sys.exec("sleep 2") - sys.exec("/etc/init.d/hermes start >/dev/null 2>&1 &") - else - sys.exec("/etc/init.d/hermes " .. action .. " >/dev/null 2>&1 &") - end - - http.prepare_content("application/json") - http.write_json({ status = "ok", action = action }) -end - --- ── Get Token API ── -function action_get_token() - local http = require "luci.http" - local uci = require "luci.model.uci".cursor() - - http.prepare_content("application/json") - http.write_json({ - token = uci:get("hermes", "main", "token") or "", - pty_token = uci:get("hermes", "main", "pty_token") or "" - }) + entry({"admin", "services", "hermes"}, alias("admin", "services", "hermes", "config"), _("Hermes"), 30).dependent = true + entry({"admin", "services", "hermes", "config"}, cbi("hermes")) end diff --git a/luci-app-hermes/luasrc/model/cbi/hermes.lua b/luci-app-hermes/luasrc/model/cbi/hermes.lua index 9b7f042ea..d81bd1582 100644 --- a/luci-app-hermes/luasrc/model/cbi/hermes.lua +++ b/luci-app-hermes/luasrc/model/cbi/hermes.lua @@ -1,52 +1,45 @@ --- luci-app-hermes — CBI Model (18.06 compat) -local sys = require "luci.sys" +--[[ +LuCI - Lua Configuration Interface +]]-- -m = Map("hermes", "Hermes Agent", +local taskd = require "luci.model.tasks" +local hermes_model = require "luci.model.hermes" +local m, s, o - translate("Python-based AI Agent Gateway for OpenWrt routers.")) +m = taskd.docker_map("hermes", "hermes", "/usr/libexec/istorec/hermes.sh", + translate("Hermes"), + translate("The self-improving AI agent that runs on your server. Layered memory that accumulates across sessions, a cron scheduler that fires while you're offline, and a skills system that saves reusable procedures automatically.") + .. translate("Official website:") .. ' https://get-hermes.ai/') --- Status panel -m:section(SimpleSection).template = "hermes/status" +s = m:section(SimpleSection, translate("Service Status"), translate("Hermes status:")) +s:append(Template("hermes/status")) --- Basic settings -s = m:section(NamedSection, "main", "hermes", translate("Basic Settings")) +s = m:section(TypedSection, "main", translate("Setup"), translate("The following parameters will only take effect during installation or upgrade:")) s.addremove = false s.anonymous = true -o = s:option(Flag, "enabled", translate("Enable Service")) -o.rmempty = false - -o = s:option(Value, "port", translate("Gateway Port")) +o = s:option(Value, "port", translate("Port") .. "*") +o.default = "8787" o.datatype = "port" -o.default = "3000" + +local blocks = hermes_model.blocks() + +o = s:option(Value, "data_path", translate("Data path") .. "*") o.rmempty = false +o.datatype = "string" +local data_paths, data_default = hermes_model.find_paths(blocks, "data") +for _, val in pairs(data_paths) do + o:value(val, val) +end +o.default = data_default -o = s:option(ListValue, "bind", translate("Listen Interface")) -o:value("lan", "LAN") -o:value("loopback", "Loopback") -o:value("all", translate("All Interfaces")) -o.default = "lan" - -o = s:option(Value, "pty_port", translate("PTY Port")) -o.datatype = "port" -o.default = "3001" -o.rmempty = false - --- API settings -s2 = m:section(NamedSection, "main", "hermes", translate("API Settings")) -s2.addremove = false -s2.anonymous = true - -o = s2:option(Value, "api_endpoint", translate("API Endpoint")) -o.default = "https://api.boos.lat/v1" -o.rmempty = false - -o = s2:option(Value, "api_key", translate("API Key")) -o.password = true -o.rmempty = true - -o = s2:option(Value, "model", translate("Model")) -o.default = "opus4.6" +o = s:option(Value, "workspace_path", translate("Workspace path") .. "*") o.rmempty = false +o.datatype = "string" +local ws_paths, ws_default = hermes_model.find_paths(blocks, "workspace") +for _, val in pairs(ws_paths) do + o:value(val, val) +end +o.default = ws_default return m diff --git a/luci-app-hermes/luasrc/model/hermes.lua b/luci-app-hermes/luasrc/model/hermes.lua new file mode 100644 index 000000000..a1c34d199 --- /dev/null +++ b/luci-app-hermes/luasrc/model/hermes.lua @@ -0,0 +1,38 @@ +local util = require "luci.util" +local jsonc = require "luci.jsonc" + +local hermes = {} + +hermes.blocks = function() + local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r") + local vals = {} + if f then + local ret = f:read("*all") + f:close() + local obj = jsonc.parse(ret) + if obj and obj["blockdevices"] then + for _, val in pairs(obj["blockdevices"]) do + local fsize = val["fssize"] + if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then + -- fsize > 1G + vals[#vals+1] = val["mountpoint"] + end + end + end + end + return vals +end + +hermes.find_paths = function(blocks, subdir) + local configs = {} + local default_path = '' + for _, mountpoint in pairs(blocks) do + table.insert(configs, mountpoint .. "/hermes/" .. subdir) + end + if #configs > 0 then + default_path = configs[1] + end + return configs, default_path +end + +return hermes diff --git a/luci-app-hermes/luasrc/view/hermes/console.htm b/luci-app-hermes/luasrc/view/hermes/console.htm deleted file mode 100644 index 4daf6895a..000000000 --- a/luci-app-hermes/luasrc/view/hermes/console.htm +++ /dev/null @@ -1,59 +0,0 @@ -<%# - luci-app-hermes — Web Console (18.06 compat) --%> -<%+header%> -<% -local uci = require "luci.model.uci".cursor() -local port = uci:get("hermes", "main", "port") or "3000" -%> - - -
-

🖥️ <%:Web Console%>

-

<%:Hermes Agent Web UI — configure AI models and interact with the AI agent.%>

-
- -
-
⏳ <%:Connecting...%>
-
- - -<%+footer%> diff --git a/luci-app-hermes/luasrc/view/hermes/status.htm b/luci-app-hermes/luasrc/view/hermes/status.htm index 31c1b011b..4884d4e45 100644 --- a/luci-app-hermes/luasrc/view/hermes/status.htm +++ b/luci-app-hermes/luasrc/view/hermes/status.htm @@ -1,86 +1,30 @@ -<%# - luci-app-hermes — Status Panel (18.06 compat) +<% +local util = require "luci.util" +local container_status = util.trim(util.exec("/usr/libexec/istorec/hermes.sh status")) +local container_install = (string.len(container_status) > 0) +local container_running = container_status == "running" -%> - - - -
-
🤖 Hermes Agent Service Status
- - - - - - - - - - -
<%:Status%>Loading...
<%:Gateway%>-
<%:Config PTY%>-
Python-
Hermes-
<%:Plugin%>-
<%:Model%>-
<%:Memory%>-
<%:Uptime%>-
+
+ +
+ <% if container_running then %> + + <% else %> + + <% end %> +
- -
- - - +<% +if container_running then + local port = util.trim(util.exec("/usr/libexec/istorec/hermes.sh port")) + if port == "" then + port = "8787" + end +-%> +
+ +
+ +
- - +<% end %> diff --git a/luci-app-hermes/luasrc/view/hermes/terminal.htm b/luci-app-hermes/luasrc/view/hermes/terminal.htm deleted file mode 100644 index 99e16d49a..000000000 --- a/luci-app-hermes/luasrc/view/hermes/terminal.htm +++ /dev/null @@ -1,62 +0,0 @@ -<%# - luci-app-hermes — Config Terminal (18.06 compat) --%> -<%+header%> -<% -local uci = require "luci.model.uci".cursor() -local pty_port = uci:get("hermes", "main", "pty_port") or "3001" -%> - - -
-

⌨️ <%:Config Terminal%>

-

<%:Interactive terminal for Hermes Agent configuration — AI models, health check, and system management.%>

-
- -
-
⏳ <%:Connecting to config terminal...%>
-
- - -<%+footer%> diff --git a/luci-app-hermes/po/zh-cn/hermes.po b/luci-app-hermes/po/zh-cn/hermes.po new file mode 100644 index 000000000..2fbe0b8a4 --- /dev/null +++ b/luci-app-hermes/po/zh-cn/hermes.po @@ -0,0 +1,44 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "Official website:" +msgstr "官方网站:" + +msgid "Hermes" +msgstr "Hermes 消息服务" + +msgid "The self-improving AI agent that runs on your server. Layered memory that accumulates across sessions, a cron scheduler that fires while you're offline, and a skills system that saves reusable procedures automatically." +msgstr "运行在您的服务器上的自我改进型人工智能代理。它采用跨会话累积的分层内存、在您离线时运行的定时任务调度程序,以及自动保存可重用程序的技能系统。" + +msgid "Port" +msgstr "端口" + +msgid "Data path" +msgstr "数据路径" + +msgid "Workspace path" +msgstr "工作目录路径" + +msgid "Service Status" +msgstr "服务状态" + +msgid "Hermes status:" +msgstr "Hermes 状态信息如下:" + +msgid "Setup" +msgstr "安装配置" + +msgid "The following parameters will only take effect during installation or upgrade:" +msgstr "以下参数只在安装或者升级时才会生效:" + +msgid "Status" +msgstr "状态" + +msgid "Hermes is running" +msgstr "Hermes 运行中" + +msgid "Hermes is not running" +msgstr "Hermes 未运行" + +msgid "Open Hermes" +msgstr "打开 Hermes" diff --git a/luci-app-hermes/po/zh_Hans b/luci-app-hermes/po/zh_Hans new file mode 120000 index 000000000..41451e4a1 --- /dev/null +++ b/luci-app-hermes/po/zh_Hans @@ -0,0 +1 @@ +zh-cn \ No newline at end of file diff --git a/luci-app-hermes/po/zh_Hans/hermes.po b/luci-app-hermes/po/zh_Hans/hermes.po deleted file mode 100644 index 607c599d6..000000000 --- a/luci-app-hermes/po/zh_Hans/hermes.po +++ /dev/null @@ -1,257 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Project-Id-Version: luci-app-hermes\n" -"Language: zh_Hans\n" - -msgid "Active Model" -msgstr "活跃模型" - -msgid "All Interfaces" -msgstr "所有接口" - -msgid "API Endpoint" -msgstr "API 端点" - -msgid "API Key" -msgstr "API 密钥" - -msgid "API Settings" -msgstr "API 设置" - -msgid "Already up to date" -msgstr "已是最新版本" - -msgid "Basic Settings" -msgstr "基本设置" - -msgid "Cancel" -msgstr "取消" - -msgid "Check Update" -msgstr "检查更新" - -msgid "Checking..." -msgstr "检查中..." - -msgid "Complete" -msgstr "完成" - -msgid "Config PTY" -msgstr "配置终端" - -msgid "Config Terminal" -msgstr "配置终端" - -msgid "Config terminal is not running." -msgstr "配置终端未运行。" - -msgid "Confirm Uninstall" -msgstr "确认卸载" - -msgid "Connecting..." -msgstr "正在连接..." - -msgid "Connecting to config terminal..." -msgstr "正在连接配置终端..." - -msgid "Default: 3000" -msgstr "默认: 3000" - -msgid "Default: 3001" -msgstr "默认: 3001" - -msgid "Disabled" -msgstr "已禁用" - -msgid "Enable Service" -msgstr "启用服务" - -msgid "Environment uninstalled successfully" -msgstr "环境已成功卸载" - -msgid "Error: " -msgstr "错误:" - -msgid "Executing: " -msgstr "正在执行:" - -msgid "Failed" -msgstr "失败" - -msgid "Failed to check status" -msgstr "检查状态失败" - -msgid "Gateway Port" -msgstr "网关端口" - -msgid "Gateway is not running. Please start the service first." -msgstr "网关未运行。请先启动服务。" - -msgid "Hermes" -msgstr "Hermes" - -msgid "Hermes Agent" -msgstr "Hermes Agent" - -msgid "Hermes Agent Web UI — configure AI models and interact with the AI agent." -msgstr "Hermes Agent Web UI — 配置 AI 模型并与 AI 代理交互。" - -msgid "Install" -msgstr "安装" - -msgid "Install Environment" -msgstr "安装环境" - -msgid "Installation failed. Check the log above for details." -msgstr "安装失败,请查看上方日志了解详情。" - -msgid "Installation successful!" -msgstr "安装成功!" - -msgid "Installing..." -msgstr "安装中..." - -msgid "Interactive terminal for Hermes Agent configuration — AI models, health check, and system management." -msgstr "Hermes Agent 交互式终端 — AI 模型配置、健康检查和系统管理。" - -msgid "Listen Interface" -msgstr "监听接口" - -msgid "Log" -msgstr "日志" - -msgid "Memory" -msgstr "内存" - -msgid "Model" -msgstr "模型" - -msgid "More" -msgstr "更多" - -msgid "Not installed" -msgstr "未安装" - -msgid "Overview" -msgstr "概览" - -msgid "PID" -msgstr "进程号" - -msgid "Plugin" -msgstr "插件" - -msgid "Please start the Hermes service first." -msgstr "请先启动 Hermes 服务。" - -msgid "Please start the service first." -msgstr "请先启动服务。" - -msgid "Python" -msgstr "Python" - -msgid "Python AI Agent Gateway for OpenWrt" -msgstr "OpenWrt 路由器 Python AI 代理网关" - -msgid "Python-based AI Agent Gateway for OpenWrt routers." -msgstr "基于 Python 的 OpenWrt 路由器 AI 代理网关。" - -msgid "PTY Port" -msgstr "终端端口" - -msgid "Refresh" -msgstr "刷新" - -msgid "Refresh the page to see updated status." -msgstr "刷新页面查看最新状态。" - -msgid "Requires internet connection and sufficient disk space (~100MB)." -msgstr "需要互联网连接和足够的磁盘空间(约100MB)。" - -msgid "Reset" -msgstr "重置" - -msgid "Restart" -msgstr "重启" - -msgid "Running" -msgstr "运行中" - -msgid "Save & Apply" -msgstr "保存并应用" - -msgid "Service Control" -msgstr "服务控制" - -msgid "Service Status" -msgstr "服务状态" - -msgid "Settings" -msgstr "设置" - -msgid "Settings saved successfully" -msgstr "设置已保存" - -msgid "Start" -msgstr "启动" - -msgid "Starting" -msgstr "启动中" - -msgid "Starting installation" -msgstr "开始安装" - -msgid "Stop" -msgstr "停止" - -msgid "Stopped" -msgstr "已停止" - -msgid "System Information" -msgstr "系统信息" - -msgid "This action cannot be undone." -msgstr "此操作不可撤销。" - -msgid "This will remove Python, Hermes Agent, and all related data." -msgstr "这将移除 Python、Hermes Agent 和所有相关数据。" - -msgid "This will install Python 3 and Hermes Agent via pip." -msgstr "这将通过 pip 安装 Python 3 和 Hermes Agent。" - -msgid "Uninstall" -msgstr "卸载" - -msgid "Uninstalling..." -msgstr "正在卸载..." - -msgid "Unknown" -msgstr "未知" - -msgid "Update Available" -msgstr "有可用更新" - -msgid "Upgrade" -msgstr "升级" - -msgid "Upgrade complete" -msgstr "升级完成" - -msgid "Upgrade successful!" -msgstr "升级成功!" - -msgid "Upgrading to " -msgstr "正在升级到 " - -msgid "Upgrading..." -msgstr "升级中..." - -msgid "Uptime" -msgstr "运行时间" - -msgid "Web Console" -msgstr "Web 控制台" - -msgid "Web console is not available." -msgstr "Web 控制台不可用。" diff --git a/luci-app-hermes/root/etc/config/hermes b/luci-app-hermes/root/etc/config/hermes index 87a14ad2b..3472a9aad 100644 --- a/luci-app-hermes/root/etc/config/hermes +++ b/luci-app-hermes/root/etc/config/hermes @@ -1,10 +1,4 @@ -config hermes 'main' - option enabled '0' - option port '3000' - option bind 'lan' - option api_endpoint '' - option api_key '' - option model '' - option pty_port '3001' - option token '' - option pty_token '' +config main + option 'port' '8787' + option 'data_path' '' + option 'workspace_path' '' diff --git a/luci-app-hermes/root/etc/init.d/hermes b/luci-app-hermes/root/etc/init.d/hermes deleted file mode 100755 index 21110aef6..000000000 --- a/luci-app-hermes/root/etc/init.d/hermes +++ /dev/null @@ -1,419 +0,0 @@ -#!/bin/sh /etc/rc.common -# luci-app-hermes — procd init script - -USE_PROCD=1 -START=99 -STOP=10 - -EXTRA_COMMANDS="setup status_service restart_gateway" -EXTRA_HELP=" setup Install Python and Hermes Agent - status_service Show service status - restart_gateway Restart only Gateway instance (does not affect Web PTY)" - -HERMES_BASE="/opt/hermes" -HERMES_VENV="${HERMES_BASE}/venv" -HERMES_DATA="${HERMES_BASE}/data" -HERMES_CONFIG="${HERMES_DATA}/config.yaml" -HERMES_BIN="${HERMES_VENV}/bin/hermes" -PYTHON_BIN="${HERMES_VENV}/bin/python3" - -# ── OverlayFS compatibility fix ── -# Docker bind mount (/overlay/upper/opt/docker) makes /opt unwritable -# Solution: bind mount upper layer /opt to merged view /opt -_hermes_fix_opt() { - mkdir -p /opt/hermes/.probe 2>/dev/null && { rmdir /opt/hermes/.probe 2>/dev/null; return 0; } - if [ -d /overlay/upper/opt ]; then - mkdir -p /overlay/upper/opt/hermes 2>/dev/null - mount --bind /overlay/upper/opt /opt 2>/dev/null && return 0 - fi - return 1 -} -_hermes_fix_opt - -# ── Port listening check ── -_ensure_port_free() { - local p="$1" - local i=0 max_wait=3 - - # Check if port is already in use - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - else - netstat -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - fi - - # Port is occupied, try to clean up - for hermes_pid in $(pgrep -f "hermes.*gateway" 2>/dev/null); do - kill "$hermes_pid" 2>/dev/null - done - - while [ $i -lt $max_wait ]; do - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - else - netstat -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - fi - sleep 1 - i=$((i + 1)) - done - - # Last resort: SIGKILL - local port_pid="" - if command -v ss >/dev/null 2>&1; then - port_pid=$(ss -tulnp 2>/dev/null | grep ":${p} " | sed -n 's/.*pid=\([0-9]*\).*/\1/p' | head -1) - else - port_pid=$(netstat -tulnp 2>/dev/null | grep ":${p} " | sed -n 's|.* \([0-9]*\)/.*|\1|p' | head -1) - fi - [ -n "$port_pid" ] && kill -9 "$port_pid" 2>/dev/null && sleep 1 - return 0 -} - -port_listening() { - local p="$1" - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${p} " - else - netstat -tulnp 2>/dev/null | grep -q ":${p} " - fi -} - -sync_uci_to_yaml() { - # Sync UCI config to /root/.hermes/config.yaml - local port bind api_endpoint api_key model - port=$(uci -q get hermes.main.port || echo "3000") - bind=$(uci -q get hermes.main.bind || echo "lan") - api_endpoint=$(uci -q get hermes.main.api_endpoint || echo "https://api.boos.lat/v1") - api_key=$(uci -q get hermes.main.api_key || echo "") - model=$(uci -q get hermes.main.model || echo "opus4.6") - - # Map UCI bind to listen address - local listen_host="127.0.0.1" - case "$bind" in - lan) listen_host="0.0.0.0" ;; - loopback) listen_host="127.0.0.1" ;; - all) listen_host="0.0.0.0" ;; - *) listen_host="0.0.0.0" ;; - esac - - # Ensure config directory exists - mkdir -p /root/.hermes 2>/dev/null - mkdir -p "$(dirname "$HERMES_CONFIG")" 2>/dev/null - - # Generate token if not set - local token - token=$(uci -q get hermes.main.token || echo "") - if [ -z "$token" ]; then - token=$(head -c 24 /dev/urandom | hexdump -e '24/1 "%02x"' 2>/dev/null || openssl rand -hex 24 2>/dev/null || echo "hermes_$(date +%s)") - uci set hermes.main.token="$token" - uci commit hermes 2>/dev/null - fi - - # Write config.yaml using shell (no Python dependency at this point) - cat > /root/.hermes/config.yaml << YAMLEOF -# Hermes Agent configuration — auto-generated by luci-app-hermes -# UCI sync: $(date '+%Y-%m-%d %H:%M:%S') - -gateway: - port: ${port} - bind: ${listen_host} - auth: - mode: token - token: ${token} - -api: - endpoint: "${api_endpoint}" - key: "${api_key}" - -model: - primary: "${model}" - -tools: - profile: coding - -update: - checkOnStart: false -YAMLEOF - - # Also sync to HERMES_DATA if different - if [ -n "$HERMES_CONFIG" ] && [ "$HERMES_CONFIG" != "/root/.hermes/config.yaml" ]; then - mkdir -p "$(dirname "$HERMES_CONFIG")" 2>/dev/null - cp /root/.hermes/config.yaml "$HERMES_CONFIG" 2>/dev/null || true - fi - - chmod 600 /root/.hermes/config.yaml 2>/dev/null || true -} - -start_service() { - local enabled port bind pty_port api_endpoint api_key model - config_load hermes - config_get enabled main enabled "0" - config_get port main port "3000" - config_get bind main bind "lan" - config_get pty_port main pty_port "3001" - config_get api_endpoint main api_endpoint "https://api.boos.lat/v1" - config_get api_key main api_key "" - config_get model main model "opus4.6" - - [ "$enabled" = "1" ] || { - echo "hermes is disabled. Set enabled to 1 in /etc/config/hermes" - return 0 - } - - # Check Python - if [ ! -x "$PYTHON_BIN" ]; then - echo "Python not found: $PYTHON_BIN" - echo "Please run: hermes-env setup" - return 1 - fi - - # Check hermes binary - if [ ! -x "$HERMES_BIN" ]; then - echo "Hermes not installed. Please run: hermes-env setup" - return 1 - fi - - # Sync UCI to config.yaml - sync_uci_to_yaml - - # Ensure gateway port is not occupied by stale processes - _ensure_port_free "$port" - - # Calculate memory limit based on system RAM - local mem_limit="" - local total_kb - total_kb=$(awk '/MemTotal/{print $2}' /proc/meminfo 2>/dev/null || echo "0") - if [ "$total_kb" -ge 3000000 ] 2>/dev/null; then - mem_limit="512m" - elif [ "$total_kb" -ge 1500000 ] 2>/dev/null; then - mem_limit="256m" - elif [ "$total_kb" -ge 700000 ] 2>/dev/null; then - mem_limit="128m" - else - mem_limit="64m" - fi - - # Start Hermes Gateway (main service, foreground) - procd_open_instance "gateway" - procd_set_param command "$HERMES_BIN" gateway run \ - --port "$port" --bind "$bind" - procd_set_param env \ - HOME="/root" \ - HERMES_HOME="/root/.hermes" \ - HERMES_CONFIG="/root/.hermes/config.yaml" \ - PATH="${HERMES_VENV}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - PYTHONPATH="${HERMES_VENV}/lib/python3*/site-packages" \ - HERMES_API_ENDPOINT="$api_endpoint" \ - HERMES_API_KEY="$api_key" \ - HERMES_MODEL="$model" - procd_set_param respawn 3600 10 5 - procd_set_param stdout 1 - procd_set_param stderr 1 - procd_set_param pidfile /var/run/hermes.pid - procd_close_instance - - # Start Web PTY config terminal (auxiliary service) - local pty_token - pty_token=$(uci -q get hermes.main.pty_token || echo "") - if [ -z "$pty_token" ]; then - pty_token=$(head -c 16 /dev/urandom | hexdump -e '16/1 "%02x"' 2>/dev/null || openssl rand -hex 16 2>/dev/null || echo "pty_$(date +%s)") - uci set hermes.main.pty_token="$pty_token" - uci commit hermes 2>/dev/null - fi - - procd_open_instance "pty" - procd_set_param command "$PYTHON_BIN" /usr/share/hermes/web-pty.py - procd_set_param env \ - HERMES_PTY_PORT="$pty_port" \ - HERMES_PTY_TOKEN="$pty_token" \ - HERMES_VENV="$HERMES_VENV" \ - HERMES_DATA="$HERMES_DATA" \ - HOME="/root" \ - PATH="${HERMES_VENV}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - procd_set_param respawn 3600 5 5 - procd_set_param stdout 1 - procd_set_param stderr 1 - procd_set_param pidfile /var/run/hermes-pty.pid - procd_close_instance -} - -_ensure_port_free() { - local p="$1" - local i=0 max_wait=3 - - # Check if port is already in use - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - else - netstat -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - fi - - # Port is occupied, try to clean up - for hermes_pid in $(pgrep -f "hermes.*gateway" 2>/dev/null); do - kill "$hermes_pid" 2>/dev/null - done - - while [ $i -lt $max_wait ]; do - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - else - netstat -tulnp 2>/dev/null | grep -q ":${p} " || return 0 - fi - sleep 1 - i=$((i + 1)) - done - - # Last resort: SIGKILL - local port_pid="" - if command -v ss >/dev/null 2>&1; then - port_pid=$(ss -tulnp 2>/dev/null | grep ":${p} " | sed -n 's/.*pid=\([0-9]*\).*/\1/p' | head -1) - else - port_pid=$(netstat -tulnp 2>/dev/null | grep ":${p} " | sed -n 's|.* \([0-9]*\)/.*|\1|p' | head -1) - fi - [ -n "$port_pid" ] && kill -9 "$port_pid" 2>/dev/null && sleep 1 - return 0 -} - -stop_service() { - local port - port=$(uci -q get hermes.main.port || echo "3000") - - # Get all related PIDs - local gw_pids="" - gw_pids=$(pgrep -f "hermes.*gateway" 2>/dev/null) - gw_pids="$gw_pids $(pgrep -f "hermes.*gateway.*run" 2>/dev/null)" - - # Send SIGTERM to all processes - for pid in $gw_pids; do - [ -n "$pid" ] && kill "$pid" 2>/dev/null - done - - # Wait for port to be released - local wait_count=0 - local max_wait=4 - while [ $wait_count -lt $max_wait ]; do - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${port} " || break - else - netstat -tulnp 2>/dev/null | grep -q ":${port} " || break - fi - sleep 1 - wait_count=$((wait_count + 1)) - done - - # Force kill if still running - if [ $wait_count -ge $max_wait ]; then - local port_pid="" - if command -v ss >/dev/null 2>&1; then - port_pid=$(ss -tulnp 2>/dev/null | grep ":${port} " | sed -n 's/.*pid=\([0-9]*\).*/\1/p' | head -1) - else - port_pid=$(netstat -tulnp 2>/dev/null | grep ":${port} " | sed -n 's|.* \([0-9]*\)/.*|\1|p' | head -1) - fi - if [ -n "$port_pid" ]; then - kill -9 "$port_pid" 2>/dev/null - sleep 1 - fi - fi -} - -service_triggers() { - procd_add_reload_trigger "hermes" -} - -reload_service() { - stop - sleep 1 - start -} - -setup() { - echo "Calling hermes-env setup..." - /usr/bin/hermes-env setup -} - -restart_gateway() { - # Restart only the Gateway process, does not affect PTY - local port - port=$(uci -q get hermes.main.port || echo "3000") - - # Get gateway PID - local port_pid="" gw_pid="" - if command -v ss >/dev/null 2>&1; then - port_pid=$(ss -tulnp 2>/dev/null | grep ":${port} " | sed -n 's/.*pid=\([0-9]*\).*/\1/p' | head -1) - else - port_pid=$(netstat -tulnp 2>/dev/null | grep ":${port} " | sed -n 's|.* \([0-9]*\)/.*|\1|p' | head -1) - fi - gw_pid=$(ubus call service list '{"name":"hermes"}' 2>/dev/null | \ - jsonfilter -e '$.hermes.instances.gateway.pid' 2>/dev/null) || true - - # Send SIGTERM - [ -n "$port_pid" ] && kill "$port_pid" 2>/dev/null - [ -n "$gw_pid" ] && kill -0 "$gw_pid" 2>/dev/null && kill "$gw_pid" 2>/dev/null - - # Kill any remaining hermes gateway processes - for pid in $(pgrep -f "hermes.*gateway" 2>/dev/null) $(pgrep -f "hermes.*gateway.*run" 2>/dev/null); do - kill "$pid" 2>/dev/null - done - - # Wait for port to be released - local wait_count=0 - while [ $wait_count -lt 3 ]; do - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${port} " || break - else - netstat -tulnp 2>/dev/null | grep -q ":${port} " || break - fi - sleep 1 - wait_count=$((wait_count + 1)) - done - - # Force kill if still running - if [ $wait_count -ge 3 ]; then - [ -n "$port_pid" ] && kill -9 "$port_pid" 2>/dev/null - sleep 1 - fi - - # If no procd gateway, restart the service - if [ -z "$gw_pid" ]; then - /etc/init.d/hermes start >/dev/null 2>&1 - fi -} - -status_service() { - local port pty_port - port=$(uci -q get hermes.main.port || echo "3000") - pty_port=$(uci -q get hermes.main.pty_port || echo "3001") - - echo "=== Hermes Agent Service Status ===" - - # Python - if [ -x "$PYTHON_BIN" ]; then - echo "Python: $($PYTHON_BIN --version 2>/dev/null)" - else - echo "Python: Not installed" - fi - - # Hermes Agent - if [ -x "$HERMES_BIN" ]; then - echo "Hermes: $($HERMES_BIN --version 2>/dev/null | head -1)" - else - echo "Hermes: Not installed" - fi - - # Gateway - if port_listening "$port"; then - echo "Gateway: ✅ Running (:$port)" - else - echo "Gateway: ⏹ Stopped" - fi - - # PTY - if port_listening "$pty_port"; then - echo "Config PTY: ✅ Running (:$pty_port)" - else - echo "Config PTY: ⏹ Stopped" - fi - - # Config - echo "Config: $HERMES_CONFIG" - echo "Data Dir: $HERMES_DATA" -} diff --git a/luci-app-hermes/root/etc/uci-defaults/99-hermes b/luci-app-hermes/root/etc/uci-defaults/99-hermes deleted file mode 100755 index 8f4b60c6b..000000000 --- a/luci-app-hermes/root/etc/uci-defaults/99-hermes +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# luci-app-hermes — First-boot setup (uci-defaults) -# This runs once after package installation - -# Set default values if not already set -uci -q set hermes.main.enabled='0' 2>/dev/null -uci -q set hermes.main.port='3000' 2>/dev/null -uci -q set hermes.main.bind='lan' 2>/dev/null -uci -q set hermes.main.api_endpoint='https://api.boos.lat/v1' 2>/dev/null -uci -q set hermes.main.api_key='' 2>/dev/null -uci -q set hermes.main.model='opus4.6' 2>/dev/null -uci -q set hermes.main.pty_port='3001' 2>/dev/null - -# Generate auth token if not set -token=$(uci -q get hermes.main.token || echo "") -if [ -z "$token" ]; then - token=$(head -c 24 /dev/urandom | hexdump -e '24/1 "%02x"' 2>/dev/null || openssl rand -hex 24 2>/dev/null || echo "hermes_$(date +%s)") - uci -q set hermes.main.token="$token" -fi - -# Generate PTY token if not set -pty_token=$(uci -q get hermes.main.pty_token || echo "") -if [ -z "$pty_token" ]; then - pty_token=$(head -c 16 /dev/urandom | hexdump -e '16/1 "%02x"' 2>/dev/null || openssl rand -hex 16 2>/dev/null || echo "pty_$(date +%s)") - uci -q set hermes.main.pty_token="$pty_token" -fi - -uci -q commit hermes 2>/dev/null - -# Create required directories -mkdir -p /root/.hermes 2>/dev/null -mkdir -p /opt/hermes/data 2>/dev/null - -exit 0 diff --git a/luci-app-hermes/root/usr/bin/hermes-env b/luci-app-hermes/root/usr/bin/hermes-env deleted file mode 100755 index 4b1f141c0..000000000 --- a/luci-app-hermes/root/usr/bin/hermes-env +++ /dev/null @@ -1,447 +0,0 @@ -#!/bin/sh -# ============================================================================ -# hermes-env — Hermes Agent environment installation management script -# Usage: hermes-env setup | check | upgrade -# Environment variables: HERMES_VERSION — specify version to install -# ============================================================================ - -# ── Version and path constants ───────────────────────────────────────────── -HERMES_BASE="/opt/hermes" -HERMES_VENV="${HERMES_BASE}/venv" -HERMES_DATA="${HERMES_BASE}/data" -HERMES_BIN="${HERMES_VENV}/bin/hermes" -PYTHON_BIN="${HERMES_VENV}/bin/python3" -HERMES_CONFIG="/root/.hermes/config.yaml" - -# PyPI mirrors -HERMES_PYPI_CN="https://mirrors.aliyun.com/pypi/simple/" -HERMES_PYPI_OFFICIAL="https://pypi.org/simple/" -HERMES_PYPI_TSINGHUA="https://pypi.tuna.tsinghua.edu.cn/simple/" - -# Default API endpoint -HERMES_DEFAULT_API="https://api.boos.lat/v1" -HERMES_DEFAULT_MODEL="opus4.6" - -export PATH="${HERMES_VENV}/bin:$PATH" - -# ── Logging tools ────────────────────────────────────────────────────────── -log_ok() { echo " [✓] $*"; } -log_warn() { echo " [!] $*"; } -log_err() { echo " [✗] $*"; } -log_step() { echo ""; echo "=== $* ==="; } - -# ── OverlayFS fix (iStoreOS Docker /opt conflict) ───────────────────────── -_fix_opt() { - mkdir -p /opt/hermes/.probe 2>/dev/null && { rmdir /opt/hermes/.probe 2>/dev/null; return 0; } - [ -d /overlay/upper/opt ] && mkdir -p /overlay/upper/opt/hermes 2>/dev/null && \ - mount --bind /overlay/upper/opt /opt 2>/dev/null && return 0 - return 1 -} -_fix_opt - -# ── Basic tools ──────────────────────────────────────────────────────────── -ensure_dir() { [ -d "$1" ] && return 0; mkdir -p "$1" 2>/dev/null || { log_err "Cannot create directory: $1"; return 1; }; } - -# Check available disk space -_df_avail() { - local p="$1" - while [ -n "$p" ] && [ "$p" != "/" ]; do - [ -e "$p" ] && break - p="${p%/*}" - done - [ -z "$p" ] && p="/" - df -m "$p" 2>/dev/null | tail -1 | awk '{print $(NF-2)}' -} - -check_space() { - local path="$1" need_mb="$2" label="$3" - local avail - avail=$(_df_avail "$path") - [ -z "$avail" ] && return 0 - if [ "$avail" -lt "$need_mb" ]; then - log_warn "${label} available space insufficient: ${avail}MB < ${need_mb}MB recommended" - else - log_ok "${label} available space: ${avail}MB" - fi -} - -# Download: wget first, curl fallback -_download() { - local url="$1" out="$2" - if command -v wget >/dev/null 2>&1; then - wget -q --no-check-certificate -O "$out" "$url" 2>/dev/null - elif command -v curl >/dev/null 2>&1; then - curl -fsSL --connect-timeout 15 --max-time 120 -o "$out" "$url" 2>/dev/null - else - log_err "No download tool available (wget/curl)"; return 1 - fi -} - -# Try multiple mirrors, return first success -_download_first() { - local out="$1"; shift - for url in "$@"; do - [ -z "$url" ] && continue - if _download "$url" "$out"; then - local sz; sz=$(wc -c < "$out" 2>/dev/null || echo 0) - [ "$sz" -gt 1000 ] && return 0 - fi - rm -f "$out" - done - return 1 -} - -# ── Architecture detection ───────────────────────────────────────────────── -detect_arch() { - case "$(uname -m)" in - x86_64) echo "x86_64" ;; - aarch64) echo "aarch64" ;; - armv7l) echo "armv7l" ;; - armv6l) echo "armv6l" ;; - *) log_err "Unsupported architecture: $(uname -m)"; exit 1 ;; - esac -} - -detect_libc() { - [ -f /etc/openwrt_release ] && echo "musl" && return - for f in /lib/ld-musl-*.so.1; do [ -f "$f" ] && echo "musl" && return; done - echo "glibc" -} - -# ── Install Python 3 ────────────────────────────────────────────────────── -install_python() { - # Check if system python3 is available - if command -v python3 >/dev/null 2>&1; then - local ver - ver=$(python3 --version 2>/dev/null | awk '{print $2}') - log_ok "System Python3 v${ver} found" - # Check if it's recent enough (3.8+) - local major minor - major=$(echo "$ver" | cut -d. -f1) - minor=$(echo "$ver" | cut -d. -f2) - if [ "$major" -ge 3 ] && [ "$minor" -ge 8 ] 2>/dev/null; then - log_ok "Python3 v${ver} meets requirements (>= 3.8)" - return 0 - fi - log_warn "Python3 v${ver} is too old, need >= 3.8" - fi - - log_step "Installing Python 3" - - # Try opkg first - opkg update >/dev/null 2>&1 || true - opkg install python3 python3-pip python3-venv 2>/dev/null | tail -5 || true - - if command -v python3 >/dev/null 2>&1; then - log_ok "Python3 installed via opkg: $(python3 --version 2>/dev/null)" - return 0 - fi - - # Fallback: try to install minimal python3 - opkg install python3-base python3-light 2>/dev/null | tail -5 || true - - if command -v python3 >/dev/null 2>&1; then - log_ok "Python3 (minimal) installed: $(python3 --version 2>/dev/null)" - # Also need pip - opkg install python3-pip 2>/dev/null || true - return 0 - fi - - log_err "Python3 installation failed" - log_err "Please install manually: opkg install python3 python3-pip python3-venv" - return 1 -} - -# ── Create virtual environment ───────────────────────────────────────────── -create_venv() { - log_step "Creating Python virtual environment" - - ensure_dir "$HERMES_BASE" || exit 1 - - # Remove old venv if exists - if [ -d "$HERMES_VENV" ]; then - log_warn "Removing old virtual environment..." - rm -rf "$HERMES_VENV" - fi - - # Create venv using system python3 - local sys_python - sys_python=$(command -v python3 2>/dev/null) - if [ -z "$sys_python" ]; then - log_err "python3 not found in PATH" - return 1 - fi - - "$sys_python" -m venv "$HERMES_VENV" 2>/dev/null - if [ ! -x "$PYTHON_BIN" ]; then - # Try without -m venv (older python) - log_warn "python3 -m venv failed, trying virtualenv..." - pip3 install virtualenv 2>/dev/null || true - "$sys_python" -m virtualenv "$HERMES_VENV" 2>/dev/null - fi - - if [ ! -x "$PYTHON_BIN" ]; then - log_err "Failed to create virtual environment" - return 1 - fi - - log_ok "Virtual environment created at $HERMES_VENV" - - # Upgrade pip - log_ok "Upgrading pip..." - "$PYTHON_BIN" -m pip install --upgrade pip 2>/dev/null | tail -2 || true - - log_ok "Python: $("$PYTHON_BIN" --version 2>/dev/null)" -} - -# ── Install Hermes Agent ─────────────────────────────────────────────────── -install_hermes() { - log_step "Installing Hermes Agent" - - # Check if already installed - if [ -x "$HERMES_BIN" ]; then - local cur - cur=$("$HERMES_BIN" --version 2>/dev/null | head -1 | tr -d '[:space:]') - log_ok "Hermes Agent v${cur} already installed" - echo " To reinstall: hermes-env setup --force" - return 0 - fi - - ensure_dir "$HERMES_VENV" || return 1 - - # Try PyPI mirrors in order - local install_ok=false - - for mirror in "$HERMES_PYPI_CN" "$HERMES_PYPI_TSINGHUA" "$HERMES_PYPI_OFFICIAL"; do - log_warn "Trying: ${mirror}" - if "$PYTHON_BIN" -m pip install hermes-agent \ - -i "$mirror" \ - --trusted-host "$(echo "$mirror" | sed 's|https://||;s|/.*||')" \ - 2>&1 | tail -10; then - install_ok=true - break - fi - done - - if [ "$install_ok" = "false" ] || [ ! -x "$HERMES_BIN" ]; then - # Try without mirror flags - log_warn "Mirror install failed, trying default PyPI..." - "$PYTHON_BIN" -m pip install hermes-agent 2>&1 | tail -10 || true - [ -x "$HERMES_BIN" ] && install_ok=true - fi - - if [ "$install_ok" = "false" ]; then - log_err "Hermes Agent installation failed" - log_err "Please check network connection and try again" - return 1 - fi - - log_ok "Hermes Agent installed: $("$HERMES_BIN" --version 2>/dev/null | head -1)" -} - -# ── Initialize Hermes configuration ──────────────────────────────────────── -init_hermes() { - log_step "Initializing Hermes configuration" - - mkdir -p /root/.hermes 2>/dev/null - - # Generate auth token - local token - token=$(uci -q get hermes.main.token 2>/dev/null || echo "") - if [ -z "$token" ]; then - token=$(head -c 24 /dev/urandom | hexdump -e '24/1 "%02x"' 2>/dev/null || openssl rand -hex 24 2>/dev/null || echo "hermes_$(date +%s)") - uci set hermes.main.token="$token" 2>/dev/null || true - uci commit hermes 2>/dev/null || true - fi - - # Generate PTY token - local pty_token - pty_token=$(uci -q get hermes.main.pty_token 2>/dev/null || echo "") - if [ -z "$pty_token" ]; then - pty_token=$(head -c 16 /dev/urandom | hexdump -e '16/1 "%02x"' 2>/dev/null || openssl rand -hex 16 2>/dev/null || echo "pty_$(date +%s)") - uci set hermes.main.pty_token="$pty_token" 2>/dev/null || true - uci commit hermes 2>/dev/null || true - fi - - # Write default config.yaml - local port bind api_endpoint api_key model - port=$(uci -q get hermes.main.port || echo "3000") - bind=$(uci -q get hermes.main.bind || echo "lan") - api_endpoint=$(uci -q get hermes.main.api_endpoint || echo "$HERMES_DEFAULT_API") - api_key=$(uci -q get hermes.main.api_key || echo "") - model=$(uci -q get hermes.main.model || echo "$HERMES_DEFAULT_MODEL") - - local listen_host="0.0.0.0" - [ "$bind" = "loopback" ] && listen_host="127.0.0.1" - - cat > /root/.hermes/config.yaml << YAMLEOF -# Hermes Agent configuration -# Initialized by luci-app-hermes on $(date '+%Y-%m-%d %H:%M:%S') - -gateway: - port: ${port} - bind: ${listen_host} - auth: - mode: token - token: ${token} - -api: - endpoint: "${api_endpoint}" - key: "${api_key}" - -model: - primary: "${model}" - -tools: - profile: coding - -update: - checkOnStart: false -YAMLEOF - - chmod 600 /root/.hermes/config.yaml 2>/dev/null || true - log_ok "Configuration written to /root/.hermes/config.yaml" -} - -# ── Command: setup ───────────────────────────────────────────────────────── -cmd_setup() { - check_space /opt 100 "Install directory (/opt)" - check_space /tmp 100 "Temp directory (/tmp)" - - # Already installed? - if [ -x "$HERMES_BIN" ]; then - echo "╔══════════════════════════════════════════════════════════════╗" - echo "║ [!] Hermes Agent already installed ║" - echo "║ To reinstall, run: hermes-env setup --force ║" - echo "╚══════════════════════════════════════════════════════════════╝" - echo " Hermes: $("$HERMES_BIN" --version 2>/dev/null | head -1)" - exit 0 - fi - - echo "╔══════════════════════════════════════════════════════════════╗" - echo "║ Hermes Agent Environment Setup ║" - echo "╚══════════════════════════════════════════════════════════════╝" - echo " Architecture: $(uname -m)" - echo " Libc: $(detect_libc)" - echo "" - - install_python || exit 1 - create_venv || exit 1 - install_hermes || exit 1 - init_hermes || exit 1 - - echo "" - echo "╔══════════════════════════════════════════════════════════════╗" - echo "║ Setup Complete! ║" - echo "╚══════════════════════════════════════════════════════════════╝" - echo " Hermes: $("$HERMES_BIN" --version 2>/dev/null | head -1)" - echo " Python: $("$PYTHON_BIN" --version 2>/dev/null)" - echo " Config: /root/.hermes/config.yaml" - echo "" - echo " Next steps:" - echo " 1. Edit /etc/config/hermes to set your API key" - echo " 2. Run: /etc/init.d/hermes enable" - echo " 3. Run: /etc/init.d/hermes start" - echo "" - echo " Or use the LuCI web interface to configure and start." -} - -# ── Command: check ───────────────────────────────────────────────────────── -cmd_check() { - echo "=== Hermes Environment Check ===" - - if [ -x "$PYTHON_BIN" ]; then - echo "Python: $("$PYTHON_BIN" --version 2>/dev/null)" - else - echo "Python: Not installed (virtual env)" - fi - - if command -v python3 >/dev/null 2>&1; then - echo "System Py: $(python3 --version 2>/dev/null)" - else - echo "System Py: Not found" - fi - - if [ -x "$HERMES_BIN" ]; then - echo "Hermes: $("$HERMES_BIN" --version 2>/dev/null | head -1)" - else - echo "Hermes: Not installed" - fi - - echo "VENV: $HERMES_VENV" - echo "Config: $HERMES_CONFIG" - - if [ -f "$HERMES_CONFIG" ]; then - echo "Config OK: Yes" - else - echo "Config OK: No (will be created on start)" - fi -} - -# ── Command: upgrade ─────────────────────────────────────────────────────── -cmd_upgrade() { - if [ ! -x "$HERMES_BIN" ]; then - log_err "Hermes Agent not installed. Run: hermes-env setup" - exit 1 - fi - - log_step "Upgrading Hermes Agent" - - local upgrade_ok=false - - for mirror in "$HERMES_PYPI_CN" "$HERMES_PYPI_TSINGHUA" "$HERMES_PYPI_OFFICIAL"; do - log_warn "Trying: ${mirror}" - if "$PYTHON_BIN" -m pip install --upgrade hermes-agent \ - -i "$mirror" \ - --trusted-host "$(echo "$mirror" | sed 's|https://||;s|/.*||')" \ - 2>&1 | tail -10; then - upgrade_ok=true - break - fi - done - - if [ "$upgrade_ok" = "false" ]; then - log_warn "Mirror install failed, trying default PyPI..." - "$PYTHON_BIN" -m pip install --upgrade hermes-agent 2>&1 | tail -10 || true - [ -x "$HERMES_BIN" ] && upgrade_ok=true - fi - - if [ "$upgrade_ok" = "true" ] && [ -x "$HERMES_BIN" ]; then - log_ok "Hermes upgraded: $("$HERMES_BIN" --version 2>/dev/null | head -1)" - else - log_err "Upgrade failed" - exit 1 - fi -} - -# ── Command: uninstall ───────────────────────────────────────────────────── -cmd_uninstall() { - log_step "Uninstalling Hermes Agent" - - /etc/init.d/hermes stop 2>/dev/null || true - /etc/init.d/hermes disable 2>/dev/null || true - uci set hermes.main.enabled=0 2>/dev/null || true - uci commit hermes 2>/dev/null || true - - [ -d "$HERMES_BASE" ] && { rm -rf "$HERMES_BASE" 2>/dev/null || true; } - [ -d "/root/.hermes" ] && { rm -rf "/root/.hermes" 2>/dev/null || true; } - - log_ok "Hermes Agent uninstalled" -} - -# ── Main entry ───────────────────────────────────────────────────────────── -case "${1:-setup}" in - setup) cmd_setup ;; - check) cmd_check ;; - upgrade) cmd_upgrade ;; - uninstall) cmd_uninstall ;; - *) - echo "Usage: hermes-env {setup|check|upgrade|uninstall}" - echo "" - echo " setup Install Python + Hermes Agent (default)" - echo " check Check installation status" - echo " upgrade Upgrade Hermes Agent to latest version" - echo " uninstall Remove all Hermes files" - exit 1 - ;; -esac diff --git a/luci-app-hermes/root/usr/libexec/istorec/hermes.sh b/luci-app-hermes/root/usr/libexec/istorec/hermes.sh new file mode 100755 index 000000000..775a611a3 --- /dev/null +++ b/luci-app-hermes/root/usr/libexec/istorec/hermes.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +ACTION=${1} +shift 1 + +do_install() { + local port=$(uci get hermes.@main[0].port 2>/dev/null | tr -d '\n\r') + local data=$(uci get hermes.@main[0].data_path 2>/dev/null | tr -d '\n\r') + local workspace=$(uci get hermes.@main[0].workspace_path 2>/dev/null | tr -d '\n\r') + + local image_name="linkease/hermes:latest" + echo "docker pull ${image_name}" + docker pull ${image_name} + docker rm -f hermes + + [ -z "$port" ] && port=8787 + + local cmd="docker run --restart=unless-stopped -d" + + [ -n "$data" ] && cmd="$cmd -v \"$data:/data/.hermes\"" + [ -n "$workspace" ] && cmd="$cmd -v \"$workspace:/workspace\"" + + cmd="$cmd -p $port:8787" + + local tz=$(uci get system.@system[0].zonename 2>/dev/null | sed 's/ /_/g') + [ -z "$tz" ] || cmd="$cmd -e TZ=$tz" + + cmd="$cmd --name hermes \"$image_name\"" + + echo "$cmd" + eval "$cmd" +} + +usage() { + echo "usage: $0 sub-command" + echo "where sub-command is one of:" + echo " install Install the hermes" + echo " upgrade Upgrade the hermes" + echo " rm/start/stop/restart Remove/Start/Stop/Restart the hermes" + echo " status Hermes status" + echo " port Hermes port" +} + +case ${ACTION} in + "install") + do_install + ;; + "upgrade") + do_install + ;; + "rm") + docker rm -f hermes + ;; + "start" | "stop" | "restart") + docker ${ACTION} hermes + ;; + "status") + docker ps --all -f 'name=^/hermes$' --format '{{.State}}' + ;; + "port") + docker ps --all -f 'name=^/hermes$' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*->8787/tcp' | sed 's/0.0.0.0:\([0-9]*\)->.*/\1/' + ;; + *) + usage + exit 1 + ;; +esac diff --git a/luci-app-hermes/root/usr/share/hermes/luci-helper b/luci-app-hermes/root/usr/share/hermes/luci-helper deleted file mode 100755 index 28b103099..000000000 --- a/luci-app-hermes/root/usr/share/hermes/luci-helper +++ /dev/null @@ -1,210 +0,0 @@ -#!/bin/sh -# luci-app-hermes — Backend helper for JS view -# Called via ubus file.exec from the LuCI frontend - -. /lib/functions.sh 2>/dev/null || true - -HERMES_VENV="/opt/hermes/venv" -HERMES_BIN="${HERMES_VENV}/bin/hermes" -HERMES_DATA="/opt/hermes/data" -HERMES_CONFIG="/root/.hermes/config.yaml" - -# ── JSON helper: escape string for JSON output ── -json_esc() { - printf '%s' "$1" | sed 's/\\/\\\\/g;s/"/\\"/g;s/\t/\\t/g' | tr '\n' ' ' -} - -# ── Port listening check (ss or netstat) ── -port_listening() { - local p="$1" - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep -q ":${p} " - else - netstat -tulnp 2>/dev/null | grep -q ":${p} " - fi -} - -pid_by_port() { - local p="$1" - if command -v ss >/dev/null 2>&1; then - ss -tulnp 2>/dev/null | grep ":${p} " | sed -n 's/.*pid=\([0-9]*\).*/\1/p' | head -1 - else - netstat -tulnp 2>/dev/null | grep ":${p} " | sed -n 's|.* \([0-9]*\)/.*|\1|p' | head -1 - fi -} - -case "$1" in - -# ═══════════════════════════════════════════ -# STATUS — gather all status info as JSON -# ═══════════════════════════════════════════ -status) - enabled=$(uci -q get hermes.main.enabled || echo "0") - port=$(uci -q get hermes.main.port || echo "3000") - pty_port=$(uci -q get hermes.main.pty_port || echo "3001") - - # Validate ports - case "$port" in *[!0-9]*) port="3000" ;; esac - case "$pty_port" in *[!0-9]*) pty_port="3001" ;; esac - - # Gateway check - gw_running=false - gw_starting=false - port_listening "$port" && gw_running=true - if [ "$gw_running" = "false" ] && [ "$enabled" = "1" ]; then - pgrep -f 'hermes.*gateway' >/dev/null 2>&1 && gw_starting=true - fi - - # PTY check - pty_running=false - port_listening "$pty_port" && pty_running=true - - # Python version - python_ver="" - if [ -x "${HERMES_VENV}/bin/python3" ]; then - python_ver=$("${HERMES_VENV}/bin/python3" --version 2>/dev/null | tr -d '[:space:]') - elif command -v python3 >/dev/null 2>&1; then - python_ver=$(python3 --version 2>/dev/null | tr -d '[:space:]') - fi - - # Hermes version - hermes_ver="" - if [ -x "$HERMES_BIN" ]; then - hermes_ver=$("$HERMES_BIN" --version 2>/dev/null | head -1 | tr -d '[:space:]') - fi - - # Plugin version - plugin_ver="" - [ -f "/usr/share/hermes/VERSION" ] && plugin_ver=$(cat /usr/share/hermes/VERSION 2>/dev/null | tr -d '[:space:]') - - # PID, memory, uptime - pid="" mem_kb=0 uptime_str="" - if [ "$gw_running" = "true" ]; then - pid=$(pid_by_port "$port") - if [ -n "$pid" ] && [ -d "/proc/$pid" ]; then - mem_kb=$(awk '/VmRSS/{print $2}' "/proc/$pid/status" 2>/dev/null) - [ -z "$mem_kb" ] && mem_kb=0 - # Calculate uptime from /proc/$pid directory mtime - start_ts=$(date -r "/proc/$pid" +%s 2>/dev/null) - if [ -n "$start_ts" ]; then - now=$(date +%s) - diff=$((now - start_ts)) - h=$((diff / 3600)) m=$(((diff % 3600) / 60)) s=$((diff % 60)) - if [ $h -gt 0 ]; then uptime_str="${h}h ${m}m" - elif [ $m -gt 0 ]; then uptime_str="${m}m ${s}s" - else uptime_str="${s}s"; fi - fi - fi - fi - - # Active model (from config.yaml) - active_model="" - if [ -f "$HERMES_CONFIG" ]; then - active_model=$(sed -n 's/.*primary: *"\{0,1\}\([^"]*\)"\{0,1\}/\1/p' "$HERMES_CONFIG" 2>/dev/null | head -1) - fi - - cat < /tmp/hermes-setup.log - : > /tmp/hermes-setup.exit - : > /tmp/hermes-setup.pid - - ( /usr/bin/hermes-env setup > /tmp/hermes-setup.log 2>&1 - RC=$? - echo $RC > /tmp/hermes-setup.exit - if [ $RC -eq 0 ]; then - uci set hermes.main.enabled=1 - uci commit hermes - /etc/init.d/hermes enable 2>/dev/null - sleep 1 - /etc/init.d/hermes start >> /tmp/hermes-setup.log 2>&1 - fi - ) & - echo $! > /tmp/hermes-setup.pid - - echo '{"status":"ok","message":"setup started"}' - ;; - -# ═══════════════════════════════════════════ -# SETUP_LOG — poll setup progress -# ═══════════════════════════════════════════ -setup_log) - log="" - [ -f /tmp/hermes-setup.log ] && log=$(cat /tmp/hermes-setup.log 2>/dev/null) - - running=false - if [ -f /tmp/hermes-setup.pid ]; then - pid=$(cat /tmp/hermes-setup.pid 2>/dev/null | tr -d '[:space:]') - [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null && running=true - fi - - exit_code=-1 - if [ "$running" = "false" ] && [ -f /tmp/hermes-setup.exit ]; then - exit_code=$(cat /tmp/hermes-setup.exit 2>/dev/null | tr -d '[:space:]') - [ -z "$exit_code" ] && exit_code=-1 - fi - - state="idle" - if [ "$running" = "true" ]; then state="running" - elif [ "$exit_code" = "0" ]; then state="success" - elif [ "$exit_code" -gt 0 ] 2>/dev/null; then state="failed" - fi - - # Escape log for JSON - log_escaped=$(printf '%s' "$log" | sed 's/\\/\\\\/g;s/"/\\"/g;s/\t/\\t/g' | tr '\n' '\\' | sed 's/\\/\\n/g') - - printf '{"state":"%s","exit_code":%s,"log":"%s"}\n' "$state" "${exit_code}" "$log_escaped" - ;; - -# ═══════════════════════════════════════════ -# GET_TOKEN — return gateway and PTY tokens -# ═══════════════════════════════════════════ -get_token) - token=$(uci -q get hermes.main.token || echo "") - pty_token=$(uci -q get hermes.main.pty_token || echo "") - printf '{"token":"%s","pty_token":"%s"}\n' "$token" "$pty_token" - ;; - -# ═══════════════════════════════════════════ -# UNINSTALL — remove environment -# ═══════════════════════════════════════════ -uninstall) - /etc/init.d/hermes stop >/dev/null 2>&1 - /etc/init.d/hermes disable 2>/dev/null - uci set hermes.main.enabled=0 - uci commit hermes 2>/dev/null - [ -d /opt/hermes ] && { find /opt/hermes -delete 2>/dev/null || true; } - [ -d /root/.hermes ] && { find /root/.hermes -delete 2>/dev/null || true; } - : > /tmp/hermes-setup.log 2>/dev/null - : > /tmp/hermes-setup.pid 2>/dev/null - : > /tmp/hermes-setup.exit 2>/dev/null - echo '{"status":"ok","message":"uninstalled"}' - ;; - -*) - echo '{"status":"error","message":"unknown command"}' - ;; -esac diff --git a/luci-app-hermes/root/usr/share/hermes/ui/index.html b/luci-app-hermes/root/usr/share/hermes/ui/index.html deleted file mode 100644 index a3b60d662..000000000 --- a/luci-app-hermes/root/usr/share/hermes/ui/index.html +++ /dev/null @@ -1,278 +0,0 @@ - - - - - -Hermes Agent Terminal - - - - -
- - ● Connecting... - -
- -
-
-

🤖 Hermes Agent Terminal

-

Connecting to terminal...

-
-
- -
- -
-

⚡ Connection Lost

-

Terminal session ended or connection interrupted

- -
- - - - - - - - - diff --git a/luci-app-hermes/root/usr/share/hermes/web-pty.py b/luci-app-hermes/root/usr/share/hermes/web-pty.py deleted file mode 100755 index 1612ae8c5..000000000 --- a/luci-app-hermes/root/usr/share/hermes/web-pty.py +++ /dev/null @@ -1,549 +0,0 @@ -#!/usr/bin/env python3 -""" -luci-app-hermes — Web PTY Server (Python implementation) -Provides WebSocket-based terminal access for Hermes Agent configuration. -Replaces the Node.js web-pty.js from luci-app-openclaw. -""" - -import http.server -import socketserver -import json -import os -import sys -import signal -import struct -import hashlib -import base64 -import subprocess -import threading -import time -import select -import pty -import fcntl -import termios -import urllib.parse - -# ── Configuration ── -PORT = int(os.environ.get('HERMES_PTY_PORT', '3001')) -HOST = os.environ.get('HERMES_PTY_HOST', '0.0.0.0') -AUTH_TOKEN = os.environ.get('HERMES_PTY_TOKEN', '') -HERMES_VENV = os.environ.get('HERMES_VENV', '/opt/hermes/venv') -HERMES_DATA = os.environ.get('HERMES_DATA', '/opt/hermes/data') -MAX_SESSIONS = int(os.environ.get('HERMES_MAX_SESSIONS', '5')) -UI_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ui') - -# Load token from UCI if not set via env -if not AUTH_TOKEN: - try: - result = subprocess.run( - ['uci', '-q', 'get', 'hermes.main.pty_token'], - capture_output=True, text=True, timeout=3 - ) - AUTH_TOKEN = result.stdout.strip() - except Exception: - pass - -# ── WebSocket helpers (RFC 6455) ── - -def decode_ws_frame(data): - """Decode a WebSocket frame. Returns (opcode, payload, total_consumed) or None.""" - if len(data) < 2: - return None - opcode = data[0] & 0x0f - masked = bool(data[1] & 0x80) - payload_len = data[1] & 0x7f - offset = 2 - - if payload_len == 126: - if len(data) < 4: - return None - payload_len = struct.unpack('>H', data[2:4])[0] - offset = 4 - elif payload_len == 127: - if len(data) < 10: - return None - payload_len = struct.unpack('>Q', data[2:10])[0] - offset = 10 - - mask = None - if masked: - if len(data) < offset + 4: - return None - mask = data[offset:offset + 4] - offset += 4 - - if len(data) < offset + payload_len: - return None - - payload = bytearray(data[offset:offset + payload_len]) - if mask: - for i in range(len(payload)): - payload[i] ^= mask[i & 3] - - return (opcode, bytes(payload), offset + payload_len) - - -def encode_ws_frame(data, opcode=0x01): - """Encode data into a WebSocket frame.""" - if isinstance(data, str): - payload = data.encode('utf-8') - else: - payload = data - length = len(payload) - - if length < 126: - header = struct.pack('>BB', 0x80 | opcode, length) - elif length < 65536: - header = struct.pack('>BBH', 0x80 | opcode, 126, length) - else: - header = struct.pack('>BBQ', 0x80 | opcode, 127, length) - - return header + payload - - -# ── PTY Session ── - -active_sessions = 0 - - -class PtySession: - def __init__(self, request_handler): - global active_sessions - self.handler = request_handler - self.proc = None - self.cols = 80 - self.rows = 24 - self.alive = True - self.buffer = b'' - self._spawn_fail_count = 0 - self._MAX_SPAWN_RETRIES = 5 - self._ping_timer = None - self._pong_received = True - - active_sessions += 1 - print(f"[hermes-pty] Session created (active: {active_sessions}/{MAX_SESSIONS})", flush=True) - - self._spawn_pty() - - def _spawn_pty(self): - """Spawn the shell process with a PTY.""" - env = os.environ.copy() - env.update({ - 'TERM': 'xterm-256color', - 'COLUMNS': str(self.cols), - 'LINES': str(self.rows), - 'COLORTERM': 'truecolor', - 'LANG': 'en_US.UTF-8', - 'HERMES_VENV': HERMES_VENV, - 'HERMES_DATA': HERMES_DATA, - 'HOME': '/root', - 'PATH': f"{HERMES_VENV}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - }) - - try: - # Create PTY - master_fd, slave_fd = pty.openpty() - - # Set terminal size - winsize = struct.pack('HHHH', self.rows, self.cols, 0, 0) - fcntl.ioctl(slave_fd, termios.TIOCSWINSZ, winsize) - - # Spawn shell - self.proc = subprocess.Popen( - ['/bin/sh', '-l'], - stdin=slave_fd, - stdout=slave_fd, - stderr=slave_fd, - env=env, - preexec_fn=os.setsid, - ) - os.close(slave_fd) - self.master_fd = master_fd - self._spawn_fail_count = 0 - - # Set master_fd to non-blocking - flags = fcntl.fcntl(master_fd, fcntl.F_GETFL) - fcntl.fcntl(master_fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) - - # Start reader thread - self._reader_thread = threading.Thread(target=self._read_pty, daemon=True) - self._reader_thread.start() - - print(f"[hermes-pty] Shell spawned (PID: {self.proc.pid})", flush=True) - - except Exception as e: - print(f"[hermes-pty] Failed to spawn shell: {e}", flush=True) - self._cleanup() - - def _read_pty(self): - """Read from PTY and send to WebSocket.""" - while self.alive and self.proc and self.proc.poll() is None: - try: - r, _, _ = select.select([self.master_fd], [], [], 0.1) - if r: - data = os.read(self.master_fd, 4096) - if data: - self._send_to_client(data) - except (OSError, IOError): - break - except Exception as e: - if self.alive: - print(f"[hermes-pty] Read error: {e}", flush=True) - break - - if self.alive: - print(f"[hermes-pty] Shell exited", flush=True) - self._spawn_fail_count += 1 - if self._spawn_fail_count > self._MAX_SPAWN_RETRIES: - print(f"[hermes-pty] Shell failed {self._spawn_fail_count} times, stopping", flush=True) - self._send_to_client(b'\r\n\x1b[31mShell failed to start after multiple attempts.\x1b[0m\r\n') - return - - # Auto-restart - self._send_to_client(b'\r\n\x1b[33mShell exited, restarting...\x1b[0m\r\n') - time.sleep(1) - if self.alive: - self._spawn_pty() - - def _send_to_client(self, data): - """Send data to WebSocket client.""" - if not self.alive: - return - try: - frame = encode_ws_frame(data, 0x01) - self.handler.request.sendall(frame) - except Exception: - pass - - def handle_message(self, text): - """Handle incoming WebSocket text message.""" - try: - msg = json.loads(text) - msg_type = msg.get('type', '') - - if msg_type == 'stdin': - data = msg.get('data', '') - # Clean bracketed paste escape sequences - data = data.replace('\x1b[?2004l', '').replace('\x1b[?2004h', '') - data = data.replace('\x1b[200~', '').replace('\x1b[201~', '') - if self.proc and self.proc.poll() is None: - os.write(self.master_fd, data.encode('utf-8')) - - elif msg_type == 'resize': - self.cols = msg.get('cols', 80) - self.rows = msg.get('rows', 24) - if self.master_fd: - winsize = struct.pack('HHHH', self.rows, self.cols, 0, 0) - try: - fcntl.ioctl(self.master_fd, termios.TIOCSWINSZ, winsize) - except Exception: - pass - - elif msg_type == 'ping': - self._send_to_client(json.dumps({'type': 'pong'})) - - except json.JSONDecodeError: - # Plain text, send directly to PTY - if self.proc and self.proc.poll() is None: - os.write(self.master_fd, text.encode('utf-8')) - - def handle_binary(self, data): - """Handle incoming binary WebSocket data.""" - if self.proc and self.proc.poll() is None: - os.write(self.master_fd, data) - - def _cleanup(self): - """Clean up session resources.""" - if not self.alive: - return - self.alive = False - - global active_sessions - active_sessions = max(0, active_sessions - 1) - print(f"[hermes-pty] Session ended (active: {active_sessions}/{MAX_SESSIONS})", flush=True) - - if self.proc and self.proc.poll() is None: - try: - os.kill(-self.proc.pid, signal.SIGTERM) - except Exception: - pass - try: - self.proc.terminate() - except Exception: - pass - - try: - if hasattr(self, 'master_fd'): - os.close(self.master_fd) - except Exception: - pass - - def __del__(self): - self._cleanup() - - -# ── WebSocket Upgrade Handler ── - -class WebSocketHandler(http.server.BaseHTTPRequestHandler): - """HTTP + WebSocket upgrade handler.""" - - sessions = [] - - def log_message(self, format, *args): - """Override to add prefix.""" - print(f"[hermes-pty] {args[0] if args else format}", flush=True) - - def do_OPTIONS(self): - self.send_response(204) - self.send_header('Access-Control-Allow-Origin', '*') - self.send_header('Access-Control-Allow-Methods', 'GET, OPTIONS') - self.send_header('Access-Control-Allow-Headers', '*') - self.end_headers() - - def do_GET(self): - path = urllib.parse.urlparse(self.path).path - - if path == '/health': - self.send_response(200) - self.send_header('Content-Type', 'application/json') - self.send_header('Access-Control-Allow-Origin', '*') - self.end_headers() - self.wfile.write(json.dumps({ - 'status': 'ok', - 'port': PORT, - 'uptime': time.time() - }).encode()) - return - - # Serve static files from UI_DIR - if path == '/' or path == '': - path = '/index.html' - - # Security: prevent directory traversal - full_path = os.path.normpath(os.path.join(UI_DIR, path.lstrip('/'))) - if not full_path.startswith(UI_DIR): - self.send_response(403) - self.end_headers() - return - - try: - with open(full_path, 'rb') as f: - data = f.read() - - # Determine content type - ext = os.path.splitext(full_path)[1] - content_types = { - '.html': 'text/html; charset=utf-8', - '.css': 'text/css', - '.js': 'application/javascript', - '.png': 'image/png', - '.svg': 'image/svg+xml', - '.json': 'application/json', - } - ct = content_types.get(ext, 'application/octet-stream') - - self.send_response(200) - self.send_header('Content-Type', ct) - self.send_header('Cache-Control', 'no-cache' if ext == '.html' else 'max-age=3600') - self.send_header('Access-Control-Allow-Origin', '*') - self.send_header('X-Frame-Options', 'ALLOWALL') - self.send_header('Content-Security-Policy', - "default-src * 'unsafe-inline' 'unsafe-eval' data: blob: ws: wss:; frame-ancestors *") - self.end_headers() - self.wfile.write(data) - - except FileNotFoundError: - # Fallback to index.html for SPA routing - try: - with open(os.path.join(UI_DIR, 'index.html'), 'rb') as f: - data = f.read() - self.send_response(200) - self.send_header('Content-Type', 'text/html; charset=utf-8') - self.send_header('Access-Control-Allow-Origin', '*') - self.end_headers() - self.wfile.write(data) - except FileNotFoundError: - self.send_response(404) - self.end_headers() - - def do_GET_ws(self): - """Handle WebSocket upgrade for GET requests to /ws.""" - self._do_websocket_upgrade() - - def _do_websocket_upgrade(self): - """Perform WebSocket handshake and start PTY session.""" - # Authenticate - parsed = urllib.parse.urlparse(self.path) - params = urllib.parse.parse_qs(parsed.query) - client_token = params.get('token', [''])[0] - - if AUTH_TOKEN and client_token != AUTH_TOKEN: - print(f"[hermes-pty] Auth failed from {self.client_address[0]}", flush=True) - self.send_error(403, 'Forbidden') - return - - # Check session limit - if active_sessions >= MAX_SESSIONS: - print(f"[hermes-pty] Max sessions reached ({active_sessions}/{MAX_SESSIONS})", flush=True) - self.send_error(503, 'Service Unavailable') - return - - # WebSocket handshake - key = self.headers.get('Sec-WebSocket-Key', '') - if not key: - self.send_error(400, 'Missing Sec-WebSocket-Key') - return - - accept = base64.b64encode( - hashlib.sha1((key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11').encode()).digest() - ).decode() - - response = ( - 'HTTP/1.1 101 Switching Protocols\r\n' - 'Upgrade: websocket\r\n' - 'Connection: Upgrade\r\n' - f'Sec-WebSocket-Accept: {accept}\r\n' - '\r\n' - ) - self.wfile.write(response.encode()) - self.wfile.flush() - - # Create PTY session - session = PtySession(self) - self.__class__.sessions.append(session) - - # Read WebSocket frames - buffer = b'' - while session.alive: - try: - self.request.setblocking(True) - self.request.settimeout(1.0) - data = self.request.recv(4096) - if not data: - break - buffer += data - - while len(buffer) > 0: - result = decode_ws_frame(buffer) - if result is None: - break - opcode, payload, consumed = result - buffer = buffer[consumed:] - - if opcode == 0x01: # Text - session.handle_message(payload.decode('utf-8', errors='replace')) - elif opcode == 0x02: # Binary - session.handle_binary(payload) - elif opcode == 0x08: # Close - print("[hermes-pty] WS close frame received", flush=True) - session._cleanup() - return - elif opcode == 0x09: # Ping - self.request.sendall(encode_ws_frame(payload, 0x0a)) - elif opcode == 0x0a: # Pong - session._pong_received = True - - except socket.timeout: - continue - except (ConnectionResetError, BrokenPipeError, OSError): - break - except Exception as e: - if session.alive: - print(f"[hermes-pty] Read error: {e}", flush=True) - break - - session._cleanup() - - def do_GET(self): - parsed = urllib.parse.urlparse(self.path) - path = parsed.path - - if path == '/ws' or path.startswith('/ws?'): - self._do_websocket_upgrade() - else: - # Serve static files - if path == '/' or path == '': - path = '/index.html' - - full_path = os.path.normpath(os.path.join(UI_DIR, path.lstrip('/'))) - if not full_path.startswith(UI_DIR): - self.send_response(403) - self.end_headers() - return - - try: - with open(full_path, 'rb') as f: - data = f.read() - - ext = os.path.splitext(full_path)[1] - content_types = { - '.html': 'text/html; charset=utf-8', - '.css': 'text/css', - '.js': 'application/javascript', - '.png': 'image/png', - '.svg': 'image/svg+xml', - '.json': 'application/json', - } - ct = content_types.get(ext, 'application/octet-stream') - - self.send_response(200) - self.send_header('Content-Type', ct) - self.send_header('Cache-Control', 'no-cache' if ext == '.html' else 'max-age=3600') - self.send_header('Access-Control-Allow-Origin', '*') - self.end_headers() - self.wfile.write(data) - - except FileNotFoundError: - try: - with open(os.path.join(UI_DIR, 'index.html'), 'rb') as f: - data = f.read() - self.send_response(200) - self.send_header('Content-Type', 'text/html; charset=utf-8') - self.send_header('Access-Control-Allow-Origin', '*') - self.end_headers() - self.wfile.write(data) - except FileNotFoundError: - self.send_response(404) - self.end_headers() - - -# ── Main ── - -if __name__ == '__main__': - import socket - - socketserver.TCPServer.allow_reuse_address = True - - class ReusableTCPServer(socketserver.TCPServer): - allow_reuse_address = True - - def handle_request_noblock(self): - try: - request, client_address = self.get_request() - except OSError: - return - if self.verify_request(request, client_address): - try: - self.process_request(request, client_address) - except Exception: - self.handle_error(request, client_address) - self.shutdown_request(request) - else: - self.shutdown_request(request) - - server = ReusableTCPServer((HOST, PORT), WebSocketHandler) - print(f"[hermes-pty] HTTP listening on {HOST}:{PORT}", flush=True) - print(f"[hermes-pty] UI directory: {UI_DIR}", flush=True) - - def shutdown(signum, frame): - print("[hermes-pty] Shutdown", flush=True) - server.shutdown() - sys.exit(0) - - signal.signal(signal.SIGTERM, shutdown) - signal.signal(signal.SIGINT, shutdown) - - try: - server.serve_forever() - except KeyboardInterrupt: - shutdown(None, None) diff --git a/luci-app-hermes/root/usr/share/luci/menu.d/luci-app-hermes.json b/luci-app-hermes/root/usr/share/luci/menu.d/luci-app-hermes.json deleted file mode 100644 index a46042e18..000000000 --- a/luci-app-hermes/root/usr/share/luci/menu.d/luci-app-hermes.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "admin/services/hermes": { - "title": "Hermes Agent", - "order": 90, - "action": { - "type": "view", - "path": "hermes" - }, - "depends": { - "acl": ["luci-app-hermes"], - "uci": { "hermes": true } - } - } -} diff --git a/luci-app-hermes/root/usr/share/rpcd/acl.d/luci-app-hermes.json b/luci-app-hermes/root/usr/share/rpcd/acl.d/luci-app-hermes.json index 4533012cb..a07cd290d 100644 --- a/luci-app-hermes/root/usr/share/rpcd/acl.d/luci-app-hermes.json +++ b/luci-app-hermes/root/usr/share/rpcd/acl.d/luci-app-hermes.json @@ -1,29 +1,11 @@ { "luci-app-hermes": { - "description": "Grant access for luci-app-hermes", + "description": "Grant UCI access for luci-app-hermes", "read": { - "uci": ["hermes"], - "ubus": { - "service": ["list"], - "file": ["exec", "read", "stat"] - }, - "file": { - "/usr/share/hermes/luci-helper": ["exec"], - "/etc/init.d/hermes": ["exec"], - "/usr/share/hermes/VERSION": ["read"], - "/tmp/hermes-setup.log": ["read"], - "/tmp/hermes-setup.exit": ["read"] - } + "uci": [ "hermes" ] }, "write": { - "uci": ["hermes"], - "ubus": { - "file": ["exec", "write"] - }, - "file": { - "/usr/share/hermes/luci-helper": ["exec"], - "/etc/init.d/hermes": ["exec"] - } + "uci": [ "hermes" ] } } } diff --git a/luci-app-hermes/scripts/install.sh b/luci-app-hermes/scripts/install.sh deleted file mode 100755 index 91efaf6a8..000000000 --- a/luci-app-hermes/scripts/install.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# ============================================================================= -# Hermes Agent LuCI 插件一键安装脚本 -# 用法: sh -c "$(wget -qO- https://cdn.jsdelivr.net/gh/Boos4721/luci-app-hermes@main/scripts/install.sh)" -# ============================================================================= -set -e - -REPO="Boos4721/luci-app-hermes" -GITHUB_RELEASE="https://github.com/${REPO}/releases/latest/download" - -_ok() { echo " [✓] $*"; } -_warn() { echo " [!] $*"; } -_err() { echo " [✗] $*"; echo ""; exit 1; } - -_download() { - local url="$1" out="$2" - if command -v wget >/dev/null 2>&1; then - wget -q --no-check-certificate -O "$out" "$url" 2>/dev/null - elif command -v curl >/dev/null 2>&1; then - curl -fsSL --connect-timeout 15 -o "$out" "$url" 2>/dev/null - else - _err "未找到 wget 或 curl" - fi -} - -echo "" -echo "╔══════════════════════════════════════════════════════════════╗" -echo "║ Hermes Agent LuCI 插件一键安装 ║" -echo "╚══════════════════════════════════════════════════════════════╝" -echo "" - -# ── 检查环境 ── -[ -f /etc/openwrt_release ] || _err "仅支持 OpenWrt / ImmortalWrt 系统" -command -v opkg >/dev/null 2>&1 || _err "未找到 opkg,仅支持 OpenWrt 系统" - -ARCH=$(uname -m) -DISTRIB=$(grep -o 'DISTRIB_DESCRIPTION="[^"]*"' /etc/openwrt_release 2>/dev/null | cut -d'"' -f2 || echo "OpenWrt") -_ok "系统: ${DISTRIB}" -_ok "架构: ${ARCH}" -echo "" - -# ── 下载 ipk ── -IPK="/tmp/luci-app-hermes_$$.ipk" -_warn "正在下载 luci-app-hermes..." - -# 主源:GitHub Releases -if ! _download "${GITHUB_RELEASE}/luci-app-hermes_all.ipk" "${IPK}"; then - _warn "GitHub 下载失败,尝试备用源..." - _download "https://github.com/${REPO}/releases/latest/download/luci-app-hermes_all.ipk" "${IPK}" || \ - _err "下载失败,请检查网络连接后重试" -fi - -SIZE=$(wc -c < "${IPK}" 2>/dev/null || echo 0) -[ "${SIZE}" -gt 5000 ] || _err "下载文件无效 (${SIZE} 字节),请稍后重试" -_ok "下载完成 ($(du -sh "${IPK}" 2>/dev/null | cut -f1))" - -# ── 安装 ── -_warn "正在安装..." -opkg update >/dev/null 2>&1 || true - -if ! opkg install --force-reinstall "${IPK}" 2>&1; then - _warn "首次安装失败,尝试强制安装..." - opkg install --force-reinstall --force-depends "${IPK}" || \ - _err "安装失败,请查看上方错误信息" -fi - -rm -f "${IPK}" -rm -f /tmp/luci-indexcache 2>/dev/null || true -rm -rf /tmp/luci-modulecache 2>/dev/null || true - -echo "" -echo "╔══════════════════════════════════════════════════════════════╗" -echo "║ [OK] 安装完成! ║" -echo "║ ║" -echo "║ → LuCI → 服务 → Hermes Agent ║" -echo "║ → 点击「更多」→「安装环境」完成 Python + Hermes 安装 ║" -echo "╚══════════════════════════════════════════════════════════════╝" -echo "" diff --git a/luci-app-podman/.editorconfig b/luci-app-podman/.editorconfig deleted file mode 100644 index 6a9ee691d..000000000 --- a/luci-app-podman/.editorconfig +++ /dev/null @@ -1,43 +0,0 @@ -root = true - -[*] -end_of_line = lf -charset = utf-8 -insert_final_newline = true -trim_trailing_whitespace = true - -# JavaScript -[*.js] -indent_style = tab -indent_size = 4 -max_line_length = 110 - -# YAML -[*.{yml,yaml}] -indent_style = space -indent_size = 2 -max_line_length = 110 - -# Markdown -[*.md] -indent_style = space -indent_size = 2 -trim_trailing_whitespace = false -max_line_length = 110 - -# POT translation templates -[*.pot] -indent_style = space -indent_size = 2 - -# Makefile -[Makefile] -indent_style = tab -indent_size = 4 - -# Shell scripts (.sh and .podman) -[*.{sh,podman}] -indent_style = tab -indent_size = 4 -end_of_line = lf -max_line_length = 110 diff --git a/luci-app-podman/.gitignore b/luci-app-podman/.gitignore deleted file mode 100644 index 554de31ee..000000000 --- a/luci-app-podman/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -docs/swagger-latest.yaml -.claude -CLAUDE.md -.DS_Store -*.bak -*-cleaned.pot -.mcp.json diff --git a/luci-app-podman/.jsbeautifyrc b/luci-app-podman/.jsbeautifyrc deleted file mode 100644 index 58217af01..000000000 --- a/luci-app-podman/.jsbeautifyrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "indent_with_tabs": true, - "editorconfig": true, - "space_after_anon_function": true, - "jslint_happy": true, - "wrap_line_length": 110 -} diff --git a/luci-app-podman/.scripts/check-translations.sh b/luci-app-podman/.scripts/check-translations.sh deleted file mode 100755 index 8e51b5d11..000000000 --- a/luci-app-podman/.scripts/check-translations.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -RED='\033[0;31m' -GREEN='\033[0;32m' -BLUE='\033[0;34m' -BOLD='\033[1m' -NC='\033[0m' - -PO_FILE="$1" -JS_DIR="$2" - -if [[ -z "$PO_FILE" || -z "$JS_DIR" ]]; then - echo -e "${BOLD}Usage:${NC} $0 " - exit 1 -fi - -TEMP_DEFINED=$(mktemp) -TEMP_USED=$(mktemp) - -echo -e "${BLUE}Read PO-File: $PO_FILE${NC}" -grep '^\s*msgid "' "$PO_FILE" | sed 's/^\s*msgid "//;s/"$//' | grep -v '^$' | sort -u > "$TEMP_DEFINED" - -COUNT_DEFINED=$(wc -l < "$TEMP_DEFINED" | xargs) -echo " -> $COUNT_DEFINED IDs found." - -echo -e "${BLUE}Search JS-Files recursive in: $JS_DIR${NC}" - -grep -r -h -o -E "_\(['\"][^'\"]+['\"]\)" "$JS_DIR" --include="*.js" > "$TEMP_USED" - -sed -i '' -E "s/^_\(['\"]//;s/['\"]\)$//" "$TEMP_USED" - -sort -u "$TEMP_USED" -o "$TEMP_USED" - -COUNT_USED=$(wc -l < "$TEMP_USED" | xargs) -echo " -> $COUNT_USED used Strings found." - -echo "---------------------------------------------------" - -echo -e "${BOLD}Not used Message IDs (in PO, not in Code):${NC}" -comm -23 "$TEMP_DEFINED" "$TEMP_USED" > "unused_ids.txt" -if [[ -s "unused_ids.txt" ]]; then - cat "unused_ids.txt" -else - echo -e "${GREEN}None. all clean!${NC}" -fi - -echo "---------------------------------------------------" - -echo -e "${BOLD}Not defined Message IDs (in Code, missing in PO):${NC}" -comm -13 "$TEMP_DEFINED" "$TEMP_USED" > "missing_ids.txt" -if [[ -s "missing_ids.txt" ]]; then - cat "missing_ids.txt" -else - echo -e "${GREEN}None. All here!${NC}" -fi - -# Aufräumen -rm "$TEMP_DEFINED" "$TEMP_USED" "unused_ids.txt" "missing_ids.txt" 2>/dev/null diff --git a/luci-app-podman/.scripts/update-pot.sh b/luci-app-podman/.scripts/update-pot.sh deleted file mode 100755 index d0f1f8832..000000000 --- a/luci-app-podman/.scripts/update-pot.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# -# POT File Updater for LuCI App Podman -# Regenerates the POT file from JavaScript source code -# Supports both singular _('...') and plural N_(n, '...', '...') forms -# - -set -e - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" -POT_FILE="$PROJECT_ROOT/po/templates/podman.pot" -HTDOCS_DIR="$PROJECT_ROOT/htdocs" - -# Colors for output -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -# Temp files -PLURAL_PAIRS=$(mktemp) -PLURAL_SKIP=$(mktemp) -CODE_STRINGS=$(mktemp) -FILTERED_STRINGS=$(mktemp) - -# Cleanup on exit -trap "rm -f $PLURAL_PAIRS $PLURAL_SKIP $CODE_STRINGS $FILTERED_STRINGS" EXIT - -echo "POT File Updater for LuCI App Podman" -echo "=====================================" -echo "" - -# Step 1: Extract plural forms N_(count, 'singular', 'plural') -echo "Extracting plural forms..." - -find "$HTDOCS_DIR" -name "*.js" -exec cat {} \; | \ - perl -0777 -ne "while (/N_\s*\([^,]+,\s*'([^']+)'\s*,\s*'([^']+)'\s*\)/gs) { print \"\$1|\$2\n\"; }" | \ - sort -u > "$PLURAL_PAIRS" - -PLURAL_COUNT=$(wc -l < "$PLURAL_PAIRS" | tr -d ' ') -# Handle empty file (wc returns 1 for empty file with no newline) -if [ ! -s "$PLURAL_PAIRS" ]; then - PLURAL_COUNT=0 -fi -echo "Found $PLURAL_COUNT plural form(s)" - -# Step 2: Build skip list (both singular and plural strings from N_() calls) -# These should not appear as standalone msgid entries -cat "$PLURAL_PAIRS" | while IFS='|' read -r singular plural; do - echo "$singular" - echo "$plural" -done | sort -u > "$PLURAL_SKIP" - -# Step 3: Extract all singular strings _('...') -echo "Extracting singular strings..." - -find "$HTDOCS_DIR" -name "*.js" -exec cat {} \; | \ - perl -0777 -ne "while (/(? "$CODE_STRINGS" - -TOTAL_SINGULAR=$(wc -l < "$CODE_STRINGS" | tr -d ' ') - -# Step 4: Filter out strings that are covered by plural forms -if [ -s "$PLURAL_SKIP" ]; then - grep -vxFf "$PLURAL_SKIP" "$CODE_STRINGS" > "$FILTERED_STRINGS" || true -else - cp "$CODE_STRINGS" "$FILTERED_STRINGS" -fi - -FILTERED_COUNT=$(wc -l < "$FILTERED_STRINGS" | tr -d ' ') -SKIPPED=$((TOTAL_SINGULAR - FILTERED_COUNT)) - -if [ $SKIPPED -gt 0 ]; then - echo -e "${YELLOW}Skipped $SKIPPED string(s) covered by plural forms${NC}" -fi -echo "Found $FILTERED_COUNT unique singular string(s)" - -# Step 5: Generate POT file -echo "" -echo "Generating POT file..." - -# Write header -cat > "$POT_FILE" << 'EOF' -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -EOF - -# Write plural entries -if [ -s "$PLURAL_PAIRS" ]; then - while IFS='|' read -r singular plural; do - echo "msgid \"$singular\"" - echo "msgid_plural \"$plural\"" - echo "msgstr[0] \"\"" - echo "msgstr[1] \"\"" - echo "" - done < "$PLURAL_PAIRS" >> "$POT_FILE" -fi - -# Write singular entries -while IFS= read -r line; do - # Skip empty lines - [ -z "$line" ] && continue - echo "msgid \"$line\"" - echo "msgstr \"\"" - echo "" -done < "$FILTERED_STRINGS" >> "$POT_FILE" - -TOTAL_ENTRIES=$((PLURAL_COUNT + FILTERED_COUNT)) - -echo "" -echo -e "${GREEN}POT file updated successfully!${NC}" -echo "Location: $POT_FILE" -echo "Entries: $TOTAL_ENTRIES ($PLURAL_COUNT plural, $FILTERED_COUNT singular)" -echo "" -echo "Note: Remember to update translation files (po/*/podman.po) with new strings." diff --git a/luci-app-podman/LICENSE b/luci-app-podman/LICENSE deleted file mode 100644 index 7be6caebd..000000000 --- a/luci-app-podman/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ -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 diff --git a/luci-app-podman/Makefile b/luci-app-podman/Makefile deleted file mode 100644 index edd5b7e8a..000000000 --- a/luci-app-podman/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME := luci-app-podman -PKG_VERSION := 2.3.4 -PKG_RELEASE := 1 -PKG_URL := https://github.com/Zerogiven-OpenWRT-Packages/luci-app-podman -PKG_MAINTAINER := Christopher Söllinger -PKG_LICENSE := Apache-2.0 -PKG_LICENSE_FILES := LICENSE - -PKG_BUILD_DEPENDS := podman - -LUCI_TITLE := LuCI Podman Application -LUCI_DESCRIPTION := LuCI Support for podman -LUCI_DEPENDS := +luci-base +rpcd +rpcd-mod-ucode +ucode-mod-socket +ucode-mod-struct +ucode-mod-uloop +ucode-mod-fs +ucode-mod-html +ucode-mod-uci +liblucihttp-ucode +coreutils-timeout -LUCI_PKGARCH := all - -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-podman/README.md b/luci-app-podman/README.md deleted file mode 100644 index 632fafe1a..000000000 --- a/luci-app-podman/README.md +++ /dev/null @@ -1,161 +0,0 @@ -[![OpenWrt](https://img.shields.io/badge/OpenWrt-25.12-darkgreen.svg?logo=openwrt&color=002B49)](https://openwrt.org/) -[![OpenWrt](https://img.shields.io/badge/OpenWrt-24.10-darkgreen.svg?logo=openwrt&color=002B49)](https://openwrt.org/) -[![GitHub Release](https://img.shields.io/github/v/release/Zerogiven-OpenWRT-Packages/luci-app-podman?logo=github)](https://github.com/Zerogiven-OpenWRT-Packages/luci-app-podman/releases) -[![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/Zerogiven-OpenWRT-Packages/luci-app-podman/total?color=blue&logo=github)](https://github.com/Zerogiven-OpenWRT-Packages/luci-app-podman/releases) -[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/Zerogiven-OpenWRT-Packages/luci-app-podman?logo=github)](https://github.com/Zerogiven-OpenWRT-Packages/luci-app-podman/issues) - -# LuCI App Podman - -Modern and feature rich LuCI web interface for managing Podman on OpenWrt. Some ideas which may come in one of the next version(s) can you find in the [todo's](./docs/TODO.md) file. Also feel free to open a ticket or send me a mail if you have suggestions, ideas or problems 🙂 - -
- -Navigation - -- [Features](#features) -- [Screenshots](#screenshots) -- [Requirements](#requirements) -- [Installation](#installation) -- [Usage](#usage) -- [Container Auto-Update](#container-auto-update) -- [Container Auto-Start](#container-auto-start) -- [Configuration](#configuration) -- [Credits](#credits) - -
- -## Features - -- **Container Management**: Start, stop, restart, create, remove containers -- **Live Streaming**: Real-time logs, stats, and process list streamed directly via a dedicated ucode controller -- **Container Auto-Update**: Check for image updates and recreate containers with latest images (see [Auto-Update](#container-auto-update)) -- **Auto-start Support**: Automatic init script generation for containers with restart policies -- **Image Management**: Pull, remove, inspect images with streaming progress -- **Volume Management**: Create, delete, export/import volumes with tar backups -- **Network Management**: Bridge, macvlan, ipvlan with VLAN support and optional OpenWrt integration (auto-creates bridge devices, network interfaces, dnsmasq exclusion, and shared `podman` firewall zone with DNS access rules) -- **Pod Management**: Create pods with shared namespaces, lifecycle actions (start/stop/restart/pause/unpause), and add containers to existing pods directly from the create form -- **Secret Management**: Encrypted storage for sensitive data -- **System Overview**: Resource usage, system-wide cleanup -- **Multilingual**: de, es, fr, nl, ru, zh_Hans, zh_Hant - -## Screenshots - -| Overview | Container List | Container Info | -|---|---|---| -| ![Overview](docs/screenshots/overview.png) | ![Container List](docs/screenshots/container-list.png) | ![Container Info](docs/screenshots/container-info.png) | - -| Live Logs | Image List | Network Create | -|---|---|---| -| ![Logs](docs/screenshots/container-log.png) | ![Images](docs/screenshots/image-list.png) | ![Network OpenWrt](docs/screenshots/network-create.png) | - -## Requirements - -- OpenWrt 25.12 / 24.10 -- Dependencies: - - `podman` - - `luci-base` - - `rpcd` - - `rpcd-mod-ucode` - - `ucode-mod-socket / -struct / -uloop / -fs / -html / -uci` - - `liblucihttp-ucode` - - `coreutils-timeout` -- Sufficient storage for images/containers - -## Installation - -### From Package Feed - -You can setup this package feed to install and update it with apk/opkg: - -[https://github.com/Zerogiven-OpenWRT-Packages/package-feed](https://github.com/Zerogiven-OpenWRT-Packages/package-feed) - -### From Package - -**OpenWrt 25.12** (apk): -```bash -wget https://github.com/Zerogiven-OpenWRT-Packages/luci-app-podman/releases/download/v2.3.4/luci-app-podman_2.3.4-r1_all.apk -apk update && apk add --allow-untrusted luci-app-podman_2.3.4-r1_all.apk -``` - -**OpenWrt 24.10** (opkg): -```bash -wget https://github.com/Zerogiven-OpenWRT-Packages/luci-app-podman/releases/download/v2.3.4/luci-app-podman_2.3.4-r1_all.ipk -opkg update && opkg install luci-app-podman_2.3.4-r1_all.ipk -``` - -### From Source - -```bash -git clone https://github.com/Zerogiven-OpenWRT-Packages/luci-app-podman.git package/luci-app-podman -make menuconfig # Navigate to: LuCI → Applications → luci-app-podman,Utilities → podman -make package/luci-app-podman/compile V=s -``` - -## Usage - -Access via **Podman** in LuCI, or directly at: - -``` -http://your-router-ip/cgi-bin/luci/admin/podman -``` - -If encountering socket errors: - -```bash -/etc/init.d/podman start -/etc/init.d/podman enable -``` - -## Container Auto-Start - -You can generate a startup script which respects the restart policy set in the container. - -> [!TIP] -> If you want save startup scripts during an upgrade you have to config your `/etc/sysupgrade.conf` with `/etc/init.d/podman-container-*`. -> ```bash -> echo "/etc/init.d/podman-container-*" >> /etc/sysupgrade.conf -> ``` - -## Container Auto-Update - -The auto-update feature checks for newer container images and recreates containers with the updated images while preserving all configuration. - -### Setup - -To enable auto-update for a container, add the label when creating it: - -```bash -podman run -d --name mycontainer \ - --label io.containers.autoupdate=registry \ - nginx:latest -``` - -Or add via the LuCI interface in the container creation form under "Labels". - -### How to Update - -1. Go to **Podman → Overview** -2. Click **"Check for Updates"** in the System Maintenance section -3. The system compares image digests without pulling (no bandwidth used until update) -4. Select which containers to update -5. Click **"Update Selected"** to pull new images and recreate containers - -Container names and init scripts are preserved - no manual reconfiguration needed. - -## Configuration - -The app stores its settings in `/etc/config/luci-podman`: - -| Option | Default | Description | -|--------|---------|-------------| -| `init_start_priority` | `99` | procd start priority for container init scripts (max 99: procd sorts rc.d symlinks as strings, so 100+ breaks ordering) | -| `socket_path` | `/run/podman/podman.sock` | Path to the Podman API socket | - -## Credits - -Inspired by: - -- [openwrt-podman](https://github.com/breeze303/openwrt-podman/) - Podman on OpenWrt -- [openwrt/luci-app-dockerman](https://github.com/openwrt/luci/tree/master/applications/luci-app-dockerman) - Docker LuCI design patterns -- [lisaac/luci-app-dockerman](https://github.com/lisaac/luci-app-dockerman) - Docker LuCI design patterns -- [OpenWrt Podman Guide](https://openwrt.org/docs/guide-user/virtualization/podman) - Official documentation diff --git a/luci-app-podman/docs/TODO.md b/luci-app-podman/docs/TODO.md deleted file mode 100644 index 336eeb504..000000000 --- a/luci-app-podman/docs/TODO.md +++ /dev/null @@ -1,80 +0,0 @@ -# ToDo's / Known issues - -## Common - -- Optimize Mobile View (4) -- Checkout new table filters for 25.12 and backwards compatibility (4) -- Sortable table (3) -- Check for duplicated code (2) - -## Overview - -- Configuration Tab (2) - -### Prune - -- Long running prune fails after 50s (1) - -### Auto Update - -- If re-create container fails, it would be nice if user could re-create the container. Some Ideas: (2) - 1. Show cli command - 2. Show spec data and make it possible to import - -## Container - -- Checkpoints export/import (3) - -### Add - -- Missing restartRetries (3) -- Missing health check settings (2) -- Fill form from cli command (3) -- Timezone field (3) - -### List - -### Details - -- Re-create container with new image (4) -- Add missing restartRetries (3) -- Healthcheck tab with form and manual health check action (2) -- Init.d priority editable. Maybe directly in the file. (3) -- Add some more informations (3) - - devices -- Attach to a container (ttyd) (3) -- Add devices show/add/remove (3) -- Add advanced update tab. Pure JSON which gets sent to update endpoint (2) -- Timezone field (3) - -## Pods - -- Think how to handle restart policy (2) - -### List - -- Replace table from container modal with one from jsapi (2) - -### Details - -- In containers tab add create/remove/refresh button (2) - -## Volumes - -### List - -- Big exports which takes more than 50s are failing (2) - -## Networks - -### Details - -- Create detail page (2) -- Update network (2) -- Disconnect container (2) - -## Secrets - -### Add - -### List diff --git a/luci-app-podman/docs/explicitly-excluded-features.md b/luci-app-podman/docs/explicitly-excluded-features.md deleted file mode 100644 index 5921b41a2..000000000 --- a/luci-app-podman/docs/explicitly-excluded-features.md +++ /dev/null @@ -1,27 +0,0 @@ -# 🚫 Explicitly Excluded Features - -The following features were considered but explicitly excluded: - -## Prune Operations -- ❌ Container Prune - Already available via System Prune in Overview -- ❌ Image Prune - Already available via System Prune in Overview -- ❌ Network Prune - Already available via System Prune in Overview -- ❌ Volume Prune - Already available via System Prune in Overview -- ❌ Pod Prune - Already available via System Prune in Overview - -**Reason:** Global system prune in overview.js handles all cleanup operations - -## Image Management -- ❌ Image Tag - Not needed for typical use cases -- ❌ Image History - Not needed for typical use cases - -**Reason:** Low value for typical OpenWrt/embedded use cases - -## Advanced Features -- ❌ Container Exec - Too complex, SSH/CLI available -- ❌ Container Archive (Copy Files) - Too complex UI -- ❌ Container Checkpoint/Restore - May not work on OpenWrt (needs CRIU) -- ❌ Image Build - Too complex, build elsewhere and pull -- ❌ Generate Systemd Units - OpenWrt doesn't use systemd -- ❌ Manifest Management - Too niche -- ❌ System Events (Real-time Updates) - Events disabled on system (`events_logger = "none"`) diff --git a/luci-app-podman/docs/screenshots/container-health.png b/luci-app-podman/docs/screenshots/container-health.png deleted file mode 100644 index 1abb80a69..000000000 Binary files a/luci-app-podman/docs/screenshots/container-health.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/container-info.png b/luci-app-podman/docs/screenshots/container-info.png deleted file mode 100644 index ec0795e4b..000000000 Binary files a/luci-app-podman/docs/screenshots/container-info.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/container-list.png b/luci-app-podman/docs/screenshots/container-list.png deleted file mode 100644 index f81382c69..000000000 Binary files a/luci-app-podman/docs/screenshots/container-list.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/container-log.png b/luci-app-podman/docs/screenshots/container-log.png deleted file mode 100644 index 802a4502e..000000000 Binary files a/luci-app-podman/docs/screenshots/container-log.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/container-resource.png b/luci-app-podman/docs/screenshots/container-resource.png deleted file mode 100644 index 6774f0317..000000000 Binary files a/luci-app-podman/docs/screenshots/container-resource.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/container-stats.png b/luci-app-podman/docs/screenshots/container-stats.png deleted file mode 100644 index a20ad0623..000000000 Binary files a/luci-app-podman/docs/screenshots/container-stats.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/image-list.png b/luci-app-podman/docs/screenshots/image-list.png deleted file mode 100644 index 4bf6f08bc..000000000 Binary files a/luci-app-podman/docs/screenshots/image-list.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/network-create.png b/luci-app-podman/docs/screenshots/network-create.png deleted file mode 100644 index 86b94f4a4..000000000 Binary files a/luci-app-podman/docs/screenshots/network-create.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/network-setup-openwrt-integration.png b/luci-app-podman/docs/screenshots/network-setup-openwrt-integration.png deleted file mode 100644 index e46b8dff6..000000000 Binary files a/luci-app-podman/docs/screenshots/network-setup-openwrt-integration.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/overview.png b/luci-app-podman/docs/screenshots/overview.png deleted file mode 100644 index 32b8d59a0..000000000 Binary files a/luci-app-podman/docs/screenshots/overview.png and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/screenshots.gif b/luci-app-podman/docs/screenshots/screenshots.gif deleted file mode 100644 index b6618375e..000000000 Binary files a/luci-app-podman/docs/screenshots/screenshots.gif and /dev/null differ diff --git a/luci-app-podman/docs/screenshots/volume-inspect.png b/luci-app-podman/docs/screenshots/volume-inspect.png deleted file mode 100644 index 9d1bc4650..000000000 Binary files a/luci-app-podman/docs/screenshots/volume-inspect.png and /dev/null differ diff --git a/luci-app-podman/docs/testing-manual.md b/luci-app-podman/docs/testing-manual.md deleted file mode 100644 index fde4fd99d..000000000 --- a/luci-app-podman/docs/testing-manual.md +++ /dev/null @@ -1,365 +0,0 @@ -# Manual UI Testing Plan - -1. xx - -## 0. Authentication - -- [x] **0.1** Navigate to `http:///cgi-bin/luci` → Redirected to login page -- [x] **0.2** Submit correct credentials → Redirected to LuCI dashboard -- [x] **0.3** Navigate to `/admin/podman` → Overview page loads without re-auth -- [x] **0.4** Open browser Console tab → No JS errors - ---- - -## 1. Overview (`/admin/podman`) - -- [x] **1.1** Load overview → Page loads; all counters visible (0 is fine) -- [x] **1.2** Podman version string visible → Not empty, not "undefined" -- [ ] **1.3** System status indicator visible → Shows running (socket available) -- [x] **1.4** Note all current counts → Baseline for comparison after later steps - -### 1a. Auto-update modal - live progress - -Prereq: at least one container with label `io.containers.autoupdate=registry`. - -- [ ] **1.5** Click "Check for Updates" → Spinner per container → "Apply Updates" modal lists candidates -- [ ] **1.6** Tick a container with an actually-newer image upstream → Click Update → Modal switches to log view with `Update image: 1/N - ` header, spinner running, Close button **disabled** -- [ ] **1.7** Log shows `Pulling `, then live `Trying to pull...`, `Copying blob ...` lines - progress lines with CR overwrite the previous line (no flood of "Copying blob X 50%, 51%, 52%, ...") -- [ ] **1.8** After pull, log shows stage markers: `→ Stopping container`, `→ Removing container`, `→ Creating container`, `→ Starting container`, `→ Reinstating init script`, `✓ Updated to ` -- [ ] **1.9** Multi-container update: each container delimited by `━━ ━━`; previous container's log remains visible above current one -- [ ] **1.10** After loop ends, counter shows `Done.`, spinner stops, Close button **enabled** -- [ ] **1.11** Click Close → modal dismisses → summary alert appears (`Containers updated successfully` for full success, list of failures otherwise) -- [ ] **1.12** Pull failure (rename the container's image to a non-existent registry before running, or change tag to bogus): log shows `✗ `, run continues to next container, summary marks failed -- [ ] **1.13** Mid-flight failure (SSH `podman run -d --name alpine sleep 3600` between Stop and Create, or simulate by other means): log shows `✗ Create failed: ...` for that container, summary marks failed -- [ ] **1.14** Old-image cleanup: after successful update of one container, log shows `━━ Cleaning up old images... ━━` then either `✓ Removed old image ` or `! Old image could not be removed - still in use by another container` -- [ ] **1.15** Modal scroll: when log overflows visible area, content auto-scrolls to bottom on append; scroll up manually → new lines append at bottom but viewport stays where the user put it (sticky-scroll) -- [ ] **1.16** Long pull crossing uhttpd `script_timeout` (~55s): server-side connection rotates transparently (auto-reconnect in `Model._stream`); log keeps growing, no spurious error - ---- - -## 2. Images (`/admin/podman/images`) - -- [x] **2.1** Load images list → Page loads (may be empty) -- [x] **2.2** Click "Pull Image" → Form/modal appears with name input -- [x] **2.3** Submit empty form → Validation error, no request sent -- [x] **2.4** Pull nonexistent image (e.g. `this-does-not-exist:fake`) → Error notification shown, list unchanged -- [x] **2.5** Pull `alpine:latest` → Progress indicator → success notification → `alpine` appears in list -- [ ] **2.6** Pull `alpine:latest` again (already exists) → Graceful result (no crash, may show "already up to date") -- [x] **2.7** Click inspect on `alpine` → Modal opens with JSON image data -- [x] **2.8** Return to overview → Image count incremented by 1 - ---- - -## 3. Containers (`/admin/podman/containers`) - -*Requires `alpine:latest` from step 2.5.* - -### 3a. Create - -- [x] **3.1** Load containers list → Page loads (may be empty) -- [x] **3.2** Click "Create Container" → Form modal opens -- [x] **3.3** Submit empty form → Validation errors on required fields -- [x] **3.4** Fill name: `test-alpine`, image: `alpine:latest`, no other changes → Submit → Container created; `test-alpine` visible in list -- [x] **3.5** Return to overview → Container count incremented - -### 3b. List operations - -- [x] **3.6** Verify `test-alpine` row shows correct Name, Image, State -- [x] **3.7** Select `test-alpine` checkbox → Only that row selected -- [x] **3.8** Click top "select all" checkbox → All rows selected -- [x] **3.9** Click top checkbox again → All deselected - -### 3c. Start / Stop / Restart - -- [x] **3.10** If container is stopped: select → Start → State changes to `Running`; success notification -- [x] **3.11** Select running container → Stop → State changes to `Exited`; success notification -- [x] **3.12** Select stopped container → Restart → State changes to `Running` - -### 3d. Detail view - Info tab - -- [x] **3.13** Click `test-alpine` name link → Navigates to container detail page -- [x] **3.14** Name, image, state displayed → Matches list view -- [x] **3.15** Edit container name to `test-alpine-renamed` → Save → Name updated; notification shown -- [x] **3.16** Change restart policy to `always` → Save → Policy updated; success notification -- [x] **3.17** Init script auto-generated → Auto-start indicator shows enabled -- [x] **3.18** Click "Show Init Script" → Modal with script content; script references `test-alpine-renamed` -- [x] **3.19** Toggle init script disabled → Indicator changes -- [x] **3.20** Toggle init script enabled again → Indicator reverts -- [x] **3.21** Change restart policy to `no` → Save → Init script removed/disabled -- [x] **3.22** Navigate back to list → Name shown as `test-alpine-renamed` - -### 3e. Detail view - Resources tab - -- [x] **3.23** Click Resources tab → Tab activates; current limits shown -- [ ] **3.24** Set CPU limit to `0.5` → Save → After page reload, Resources tab is active (tab persistence) -- [x] **3.25** Set Memory limit to `64m` → Save → Value persisted -- [x] **3.26** Enter invalid CPU value (e.g. `abc`) → Save → Validation error; no save - -### 3f. Detail view - Stats tab - -- [x] **3.27** Start container (if stopped) -- [x] **3.28** Click Stats tab → CPU%, Memory, Net I/O data appears -- [x] **3.29** Stop container; click Stats tab → Graceful empty/zero state, no JS crash - -### 3g. Detail view - Logs tab - -- [x] **3.30** Click Logs tab → Log output area visible (may be empty for alpine) -- [x] **3.31** Change line count to `50` → Apply → Fetches last 50 lines -- [ ] **3.32** Enable live streaming toggle → Toggle activates -- [x] **3.33** Disable live streaming → Streaming stops, toggle off -- [x] **3.34** Click Clear → Log area clears - -### 3h. Detail view - Processes tab - -- [x] **3.35** Start container; click Processes tab → Process table appears -- [x] **3.36** Stop container; click Processes tab → Graceful empty/error state, no JS crash - -### 3i. Network management (on detail page) - -- [x] **3.37** Note current networks attached → Baseline -- [x] **3.38** Disconnect default network → Network removed from list -- [x] **3.39** Reconnect the network → Network added back -- [x] **3.40** Connect a network with valid static IP → Network added with IP shown -- [x] **3.41** Connect a network with invalid IP → Validation error - -### 3j. Pause / Unpause - -- [ ] **3.42** List view: select a running container → click ⏸⏸ Pause → state changes to `paused`; success notification -- [ ] **3.43** List view: same paused container selected → click ▶ Start → state changes back to `running` (Start polymorphically unpauses paused containers) -- [ ] **3.44** Detail view: container is running → ▶ Start is highlighted as active, ⏸⏸ Pause is clickable -- [ ] **3.45** Detail view: click Pause → reload → state is `paused`, ⏸⏸ Pause is now highlighted, ▶ Start is clickable -- [ ] **3.46** Detail view: click Start while paused → reload → state is `running`, ▶ Start highlighted again -- [ ] **3.47** Detail view: streams (stats / logs / processes) stop before pause fires (no reconnect storm in DevTools Network panel) -- [ ] **3.48** Multi-select on list: mix of running + paused → click ▶ Start → running stays running, paused becomes running (per-container dispatch) - ---- - -## 4. Volumes (`/admin/podman/volumes`) - -- [x] **4.1** Load volumes list → Page loads (may be empty) -- [x] **4.2** Click "Create Volume" → Form appears -- [x] **4.3** Submit empty form → Name will be generated -- [x] **4.4** Create volume named `test-vol` → Appears in list with name, driver, created date -- [x] **4.5** Click inspect on `test-vol` → JSON modal shows volume data -- [x] **4.6** Return to overview → Volume count incremented -- [x] **4.7** Select `test-vol` → Delete → Confirmation modal → confirm → removed from list -- [ ] **4.8** Create volume `test-vol-prune` and leave it → Used in prune test (step 8.2) - ---- - -## 5. Networks (`/admin/podman/networks`) - -- [x] **5.1** Load networks list → Default `podman` network visible -- [x] **5.2** Note OpenWrt column for default network → Status icon shown -- [x] **5.3** Click "Create Network" → Form opens -- [x] **5.4** Submit empty form → Validation error -- [x] **5.5** Create `test_net`, subnet `10.220.0.0/24`, gateway `10.220.0.1`, OpenWrt integration checked → Network created; OpenWrt column shows `✓` -- [x] **5.6** Verify UCI config created → SSH: `uci show network.test_net` returns values -- [x] **5.7** Create `test_net_b` with no subnet, integration unchecked → Network created; OpenWrt column shows `-` -- [x] **5.8** If any network shows `X` (incomplete integration): click it → setup → icon changes to `✓` -- [x] **5.9** Return to overview → Network count incremented -- [x] **5.10** Select `test_net` → Delete → Confirmation mentions OpenWrt cleanup → confirm → network removed; UCI config removed -- [x] **5.11** Select `test_net_bare` → Delete → Removed cleanly (no UCI to clean up) - ---- - -## 6. Secrets (`/admin/podman/secrets`) - -- [x] **6.1** Load secrets list → Page loads (may be empty) -- [x] **6.2** Click "Create Secret" → Form with name + value fields -- [x] **6.3** Submit empty form → Validation error -- [x] **6.4** Create secret name `test-secret`, value `hunter2` → Appears in list; value NOT shown anywhere -- [x] **6.5** Click inspect on `test-secret` → Modal shows metadata; `SecretData` field hidden -- [x] **6.6** Delete `test-secret` → Removed from list - ---- - -## 7. Pods (`/admin/podman/pods`) - -*Requires `alpine:latest` from step 2.5. If a user-defined network exists from section 5, note its name as ``.* - -### 7a. List view - -- [x] **7.1** Load pods list → Page loads with empty/populated table; no "Work in progress…" stub -- [x] **7.2** Toolbar visible → Create / Delete / Reload / ▶ / ■ / ⟳ / ⏸ / ⏵ buttons present -- [x] **7.3** Click Reload with empty list → No error, indicator appears briefly - -### 7b. Create - minimal - -- [x] **7.4** Click "Create" → Pod form modal opens with default fields populated -- [x] **7.5** Submit empty form → No validation error (name auto-generates); pod appears with generated name -- [x] **7.6** Create pod name `pod-min`, all other defaults → Modal closes, success notification, `pod-min` row appears -- [x] **7.7** Verify SSH `podman pod inspect pod-min` → Pod exists with one infra container -- [x] **7.8** Containers column shows `1 ▸` for `pod-min` - -### 7c. Create - full options - -- [x] **7.9** Open Create form → Name `pod-full`, Hostname `pod-full-host`, Shared Namespaces `cgroup,ipc,net,uts`, Infra ON, Network ``, DNS Servers `1.1.1.1` and `9.9.9.9`, DNS Search `lan`, CPU Limit `1.0`, CPU Set `0-1`, Memory `256m`, Labels `app=demo\nenv=test` → Submit -- [x] **7.10** SSH `podman pod inspect pod-full | jq '.Hostname'` → `pod-full-host` -- [x] **7.11** SSH `podman pod inspect pod-full | jq '.InfraConfig.NetworkOptions'` → contains DNS server + search entries -- [x] **7.12** SSH `podman pod inspect pod-full | jq '.Labels'` → `app: demo`, `env: test` -- [x] **7.13** Networks column for `pod-full` → shows `` - -### 7d. Status badges - -- [x] **7.14** New pod → Status badge `Created` (gray) -- [x] **7.15** After Start → Badge `Running` (green) -- [x] **7.16** After Pause → Badge `Paused` (orange) -- [x] **7.17** After Stop → Badge `Exited` or `Stopped` (red) - -### 7e. Lifecycle - single select - -- [x] **7.18** Tick `pod-min`, click ▶ Start → Loading "Starting pod: 1/1", refresh shows `Running` -- [x] **7.19** Click ■ Stop → Status `Exited`/`Stopped` -- [x] **7.20** Click ⟳ Restart → Status `Running` -- [x] **7.21** Click ⏸ Pause → Status `Paused` -- [x] **7.22** Click ⏵ Unpause → Status `Running` - -### 7f. Lifecycle - multi-select - -- [ ] **7.23** Create `pod-a` and `pod-b` (defaults), select both → ▶ Start -- [ ] **7.24** Loading modal shows "Starting pod: 1/2" then "2/2" -- [ ] **7.25** Both pods end up `Running` -- [ ] **7.26** No JS console errors during multi-action - -### 7g. Detail page navigation (from list) - -- [ ] **7.27** Click pod **Name** in list → Navigates to `/admin/podman/pod/` (no more inspect modal) -- [ ] **7.28** Browser back button → Returns to pods list with state preserved - -### 7h. Containers expand modal - -- [x] **7.29** SSH `podman run -d --pod pod-min --name pod-min-c1 alpine sleep 3600` → container created in pod -- [x] **7.30** Reload pods list → `pod-min` Containers column shows `2 ▸` -- [x] **7.31** Click `2 ▸` link → Modal "Containers in pod pod-min" opens with 2 rows (infra + new) -- [x] **7.32** Each row shows Name, truncated ID, Status badge, Restarts count -- [x] **7.33** Click container ID link in modal → Navigates to `/admin/podman/container/` detail view - -### 7i. Pod removal - -- [ ] **7.34** Stop `pod-min` first → Status `Exited` -- [ ] **7.35** Tick `pod-min` → Delete → Confirm -- [ ] **7.36** SSH `podman pod ls` → `pod-min` gone -- [ ] **7.37** SSH `podman ps -a` → `pod-min-c1` also gone (cascade delete via force) - -### 7j. Container form integration - -- [x] **7.38** Navigate **Podman → Containers → Create** → Form shows new **Pod** ListValue (after Image) with "(none)" + existing pod names -- [x] **7.39** Select Pod = `pod-full` → Network, Hostname, Port Mappings, Expose Ports fields hide -- [x] **7.40** Select Pod = "(none)" → Hidden fields reappear -- [x] **7.41** Create container with Pod `pod-full`, Image `alpine:latest`, Command `sleep 3600`, Start ON → Success -- [x] **7.42** SSH `podman ps --filter pod=pod-full` → New container listed -- [x] **7.43** Pods list `pod-full` Containers column → count incremented - -### 7k. Edge cases - -- [ ] **7.44** Create pod with name `Bad Name!` → Validation error (uciname constraint) -- [ ] **7.45** Toggle "Create Infra Container" OFF → Network/DNS/Infra Image fields hide -- [ ] **7.46** Submit pod with Infra OFF → Pod created without infra container; SSH `podman pod inspect` confirms -- [ ] **7.47** Try Stop on already-stopped pod → No JS error (graceful handling of API 304/409) -- [ ] **7.48** Try Pause on stopped pod → Error notification, no JS crash - -### 7l. Regression - non-pod container create - -- [ ] **7.49** Create container with Pod = "(none)", port mapping `8080:80`, network ``, hostname `freebee` → Success -- [ ] **7.50** SSH inspect → port mapping, network and hostname present (confirms `if (!data.pod)` guards don't break the non-pod path) - -### 7m. Cleanup - -- [ ] **7.51** SSH `podman pod rm -f pod-full pod-a pod-b` → All test pods removed -- [ ] **7.52** SSH `podman ps -a` → No leftover test containers -- [ ] **7.53** Reload pods list → Empty/clean state - -### 7n. Detail page - load & header (`/admin/podman/pod/`) - -- [ ] **7.54** Direct URL `/admin/podman/pod/` → Detail page loads, no console errors -- [ ] **7.55** Header shows pod name and back-arrow button → back button returns to pods list -- [ ] **7.56** Lifecycle buttons visible: ▶ Start, ■ Stop, ⟳ Restart, ⏸ Pause, ⏵ Unpause, 🗑 Delete -- [ ] **7.57** "Active" highlight reflects current state: Running pod → ▶ highlighted, Paused pod → ⏸ highlighted, Exited pod → ■ highlighted (semantic: button describes current state, not "available action") -- [ ] **7.58** Tabs visible: Info, Stats, Processes, Inspect - -### 7o. Detail page - Info tab - -- [ ] **7.59** Basic Information section: Name, ID (full 64-char), Status badge, Created date populated -- [ ] **7.60** Configuration section: Hostname, Cgroup parent, Exit policy, Restart policy, Shared namespaces (comma-joined), Infra container (clickable link to `/admin/podman/container/`) -- [ ] **7.61** Resources section: CPU period (µs), CPU quota (µs or "Unlimited"), CPU shares, CPU set, Memory limit (formatted bytes or "Unlimited"). Description note "Resources are set at pod creation and cannot be edited here." present -- [ ] **7.62** Network section: Networks, Static IPv4, Static MAC, DNS servers, DNS search, DNS options, Extra hosts, Host network (Yes/No) -- [ ] **7.63** Containers section: table with Name, truncated ID (clickable → container detail), Status badge - one row per container including infra -- [ ] **7.64** Labels section: only rendered if pod has labels; otherwise omitted -- [ ] **7.65** All empty fields show `-` placeholder - -### 7p. Detail page - Stats tab (pod running) - -- [ ] **7.66** Switch to Stats tab → Table with headers: Container, CID, CPU %, Memory, Memory %, Net I/O, Block I/O, PIDs -- [ ] **7.67** Rows update live (humanized strings from `PodStatsReport`: e.g. "75.5%", "12mb / 24mb") -- [ ] **7.68** Container name column resolves from pod's containers map (not the pod-name value the API returns) -- [ ] **7.69** Switch to another tab → Stream stops (verify in DevTools Network: stream connection closes) -- [ ] **7.70** Switch back to Stats → Stream restarts -- [ ] **7.71** Pod is stopped → Stats tab shows "Pod is not running" warning, no stream attempt - -### 7q. Detail page - Processes tab (pod running) - -- [ ] **7.72** Switch to Processes tab → Table with columns Podman's `pod top` returns (USER, PID, ..., CMD) plus a CONTAINER column (native to pod top) -- [ ] **7.73** Rows update live as processes change -- [ ] **7.74** Switch away → Stream stops -- [ ] **7.75** Pod is stopped → Shows "Pod is not running" warning - -### 7r. Detail page - Inspect tab - -- [ ] **7.76** Switch to Inspect tab → Renders full raw JSON of `podman pod inspect` -- [ ] **7.77** Same content as old list-view inspect modal (sanity check no fields are lost) - -### 7s. Detail page - lifecycle actions - -- [ ] **7.78** Running pod → click ⏸ Pause → confirmation/loading → reload → status `Paused`, ⏸ now highlighted as active -- [ ] **7.79** Paused pod → click ⏵ Unpause → reload → status `Running` -- [ ] **7.80** Running pod → click ■ Stop → reload → status `Exited`, ■ highlighted -- [ ] **7.81** Stopped pod → click ▶ Start → reload → status `Running` -- [ ] **7.82** Click ⟳ Restart → reload → status briefly cycles to Running -- [ ] **7.83** Click 🗑 Delete → confirm dialog → confirm → redirects to `/admin/podman/pods`, pod gone -- [ ] **7.84** Before Stop/Pause/Restart, verify in DevTools Network: stats/processes streams close BEFORE the action fires (no reconnect storm) - -### 7t. Detail page - edge cases - -- [ ] **7.85** Pod with no containers (rare - infra-less or just created): Containers section shows "No containers in this pod" -- [ ] **7.86** Pod with no labels: Labels section is absent (not just empty) -- [ ] **7.87** Pod with `RestartPolicy` unset: Configuration shows `-` -- [ ] **7.88** Pod with `memory_limit: 0` or unset: Resources shows "Unlimited" -- [ ] **7.89** Pod with `cpu_quota: -1`: Resources shows "Unlimited" -- [ ] **7.90** Invalid pod ID in URL → Redirects to pods list (no crash) -- [ ] **7.91** Refresh page while stats stream active → No duplicate streams (Network panel shows single connection) - ---- - -## 8. Modals - -### Prune Modal - -- [x] **8.1** Open prune modal → Options shown: containers, images, volumes, networks -- [ ] **8.2** Select only "Volumes" → Prune → Only unused volumes pruned (e.g. `test-vol-prune` from step 4.8); containers/images untouched -- [ ] **8.3** Select "Containers" → Prune → Only stopped/exited containers removed - -### Auto-Update Modal - -- [x] **8.4** Open auto-update modal → Container list shown with current digest info -- [x] **8.5** Click "Check for Updates" → Digest comparison runs; up-to-date containers marked -- [x] **8.6** If outdated container detected → Update → Pulls new image, recreates container - ---- - -## 9. Error Handling - -- [ ] **9.1** Stop Podman socket (`/etc/init.d/podman stop`), load any list view → Clear RPC error message; no JS crash, no blank page -- [x] **9.2** Navigate to `/admin/podman/container/nonexistent-id` → Graceful error, not a blank page -- [ ] **9.3** Start Podman again (`/etc/init.d/podman start`); reload → Normal operation resumes -- [x] **9.4** Trigger two operations quickly in succession → No race-condition crash or duplicate requests - ---- - -## 10. Cleanup Verification - -- [x] **10.1** Delete any remaining test containers (e.g. `test-alpine-renamed`) -- [x] **10.2** Delete `alpine` image -- [x] **10.3** Containers list → Empty (or back to pre-test state) -- [x] **10.4** Images list → Empty (or back to pre-test state) -- [x] **10.5** Overview counters → Match baseline from step 1.4 diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/TableSelectSection.js b/luci-app-podman/htdocs/luci-static/resources/podman/TableSelectSection.js deleted file mode 100644 index 9e8580998..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/TableSelectSection.js +++ /dev/null @@ -1,326 +0,0 @@ -'use strict'; - -'require baseclass'; -'require dom'; -'require form'; -'require ui'; -'require podman.form as podmanForm'; -'require podman.ui as podmanUI'; -'require podman.utils as podmanUtil'; - -const FormTableSelectSection = form.TableSection.extend({ - __name__: 'Podman.Form.TableSelectSection', - - checkboxColumn: null, - view: null, - toolbarExtraButtons: [], - modalCreateBtnText: null, - modalCreateTitle: null, - handleRefreshCb: null, - - render() { - if (!this.checkboxColumn) { - this.checkboxColumn = this.option( - podmanForm.field.SelectDummyValue, - this.selectKey, - new ui.Checkbox(0, { hiddenname: 'all' }).render() - ); - this.checkboxColumn.width = 30; - - podmanUtil.moveArrayItem(this.children, this.children.length - 1, 0); - } - - return this.super('render', []); - }, - - renderContents(cfgsections, nodes) { - const config_name = this.uciconfig ?? this.map.config; - const max_cols = this.children.length; - - if (this.footer === true) { - this.footer = [ - `${_('Total')} ${nodes.length}`, - ]; - } - - const sectionEl = E('div', { - id: 'cbi-%s-%s'.format(config_name, this.sectiontype), - class: 'cbi-section cbi-tblsection', - }); - - const tableEl = E('table', { class: 'table cbi-section-table cbi-section-table-select' }); - const theadEl = E('thead', { class: 'thead cbi-section-thead' }); - const tbodyEl = E('tbody', { class: 'tbody cbi-section-tbody' }); - const tfootEl = E('tfoot', { class: 'tfoot cbi-section-tfoot' }); - - if (this.description != null && this.description !== '') { - sectionEl.appendChild(E('div', { class: 'cbi-section-descr' }, this.description)); - } - - sectionEl.appendChild(E('div', { class: 'cbi-section-actions' }, this.renderToolbar())); - - theadEl.appendChild(this.renderHeaderRows(false)); - - if (theadEl.hasChildNodes()) - tableEl.appendChild(theadEl); - - for (let i = 0; i < nodes.length; i++) { - const trEl = E('tr', { - id: 'cbi-%s-%s'.format(config_name, cfgsections[i]), - class: 'tr cbi-section-table-row', - 'data-sid': cfgsections[i], - 'data-section-id': cfgsections[i] - }); - - for (let j = 0; j < max_cols && nodes[i].firstChild; j++) { - trEl.appendChild(nodes[i].firstChild); - } - - tbodyEl.appendChild(trEl); - } - - if (nodes.length === 0) - tbodyEl.appendChild(E('tr', { class: 'tr cbi-section-table-row' }, - E('td', { class: 'td text-center', colspan: max_cols }, this.renderSectionPlaceholder()))); - - tableEl.appendChild(tbodyEl); - - tfootEl.appendChild(this.renderFooterRows(false)); - - if (tfootEl.hasChildNodes()) { - tableEl.appendChild(tfootEl); - } - - this.registerCheckboxEvents(theadEl, tableEl); - - sectionEl.appendChild(tableEl); - - dom.bindClassInstance(sectionEl, this); - - return sectionEl; - }, - - renderToolbar() { - return E('div', { class: 'list-toolbar mb-sm d-flex justify-center gap-xs' }, this.getToolbarButtons()); - }, - - getToolbarButtons() { - const buttons = []; - - if (this.handleCreate) { - buttons.push(this.getCreateButton()); - } - if (this.handleRemove) { - buttons.push(this.getRemoveButton()); - } - - if (this.handleRefresh) { - buttons.push(this.getReloadButton()); - } - - if (this.toolbarExtraButtons.length > 0) { - buttons.push(...this.toolbarExtraButtons); - } - - return buttons; - }, - - getCreateButton() { - return new podmanUI.ButtonNew(_('Create'), { - click: ui.createHandlerFn(this, 'handleCreate'), - type: 'add', - }).render(); - }, - - getRemoveButton() { - return new podmanUI.ButtonNew(_('Delete'), { - click: ui.createHandlerFn(this, 'handleRemove'), - type: 'remove', - }).render(); - }, - - getReloadButton() { - return new podmanUI.ButtonNew(_('Reload'), { - click: ui.createHandlerFn(this, 'handleRefresh'), - type: 'apply', - }).render(); - }, - - async handleCreate() { - const createForm = new this.createForm.init(); - const formElement = await createForm.render(); - const title = this.modalCreateTitle || _('Create %s').format(this.view.titleSingle || '').trim(); - - const modal = new podmanUI.Modal(title, [ formElement ]); - modal.getButtons = () => [ - modal.getCloseButton(), - new podmanUI.ButtonNew(this.modalCreateBtnText || _('Create'), { - click: () => { - createForm.handleCreate().then(() => this.handleRefresh()); - }, - type: 'positive', - }).render(), - ]; - modal.render(); - }, - - async handleRemove() { - const selected = this.getSelectedData(); - - if (selected.length === 0) { - return this.showNoneSelectedWarning(); - } - - this.view.confirm([ - E('p', {}, _('Are you sure to delete the records?')), - ], async () => { - let i = 1; - for (const item of selected) { - this.view.loading(_('Deleting records: %d/%d').format(i, selected.length)); - - await item.remove(); - - i++; - } - - ui.hideModal(); - this.handleRefresh(); - }); - }, - - async handleRefresh() { - const indicatorId = 'podman-refresh-' + this.sectiontype; - ui.showIndicator(indicatorId, _('Refreshing %s...').format(this.sectiontype)); - - const data = await this.view.load(); - - if (this.footer) { - const count = Array.isArray(data) ? data.length : 0; - this.footer = [`${_('Total')} ${count}`]; - } - - const obj = {}; - obj[this.sectiontype] = data; - - this.map.data.__init__(obj); - - this.map.root - .querySelector('input[type="hidden"][name="all"] ~ input[type=checkbox]').checked = false; - - await this.map.save(null, false); - await this.map.load(); - await this.map.reset(); - - if (this.handleRefreshCb) await this.handleRefreshCb(); - - ui.hideIndicator(indicatorId); - }, - - handleInspect(item, hiddenFields) { - this.view.loading(_('Fetching information...')); - - item.inspect().then((data) => { - ui.hideModal(); - this.showInspectModal(data, hiddenFields); - }); - }, - - showInspectModal(data, hiddenFields) { - const displayData = JSON.parse(JSON.stringify(data)); - - if (hiddenFields && hiddenFields.length > 0) { - hiddenFields.forEach((field) => { - if (displayData[field]) { - displayData[field] = '***HIDDEN***'; - } - }); - } - - const content = [ - new podmanUI.JsonArea(displayData).render(), - ]; - - if (hiddenFields && hiddenFields.length > 0) { - content.unshift(E('p', { class: 'mb-sm text-error' }, [ - E('strong', {}, _('Security Notice:')), ' ', _('Sensitive data is hidden for security reasons.') - ])); - } - - const modal = new podmanUI.Modal('', content); - modal.handleSubmit = undefined; - modal.render(); - }, - - showNoneSelectedWarning() { - this.view.warning(_('No %s selected').format(this.sectiontype)); - }, - - registerCheckboxEvents(theadEl, tableEl) { - const checkboxSelectAll = theadEl.querySelector('input[name="all"] + input[type="checkbox"]'); - const rows = tableEl.querySelectorAll('tbody tr'); - let lastClickedIndex = -1; - - if (!checkboxSelectAll) { - return; - } - - checkboxSelectAll.addEventListener('click', (event) => { - const checked = event.target.checked; - tableEl.querySelectorAll('tbody tr input[type="checkbox"]').forEach((checkbox) => { - checkbox.checked = checked; - }); - }); - - rows.forEach((row, index) => { - const checkbox = row.querySelector('input[type=checkbox]'); - - if (!checkbox) { - return; - } - - row.addEventListener('click', (ev) => { - const clickedInteractiveElement = ev.target.closest('button, a, input, .cbi-tooltip-container'); - - // If the click was inside an interactive element, ignore it and exit. - if (clickedInteractiveElement) { - return; - } - - checkbox.click(); - }); - - checkbox.addEventListener('click', (ev) => { - // Handle shift+click for range selection - if (ev.shiftKey && lastClickedIndex !== -1 && - lastClickedIndex !== index) { - const start = Math.min(lastClickedIndex, index); - const end = Math.max(lastClickedIndex, index); - const targetState = checkbox.checked; - - // Select/deselect all checkboxes in range - for (let i = start; i <= end; i++) { - rows[i].querySelector('input[type=checkbox]').checked = targetState; - } - } - - // Update last clicked index - lastClickedIndex = index; - }); - }); - }, - - getSelectedCheckboxes() { - return this.map.root.querySelectorAll('tbody tr input[type=checkbox]:checked'); - }, - - getSelectedData() { - return [...this.getSelectedCheckboxes()].map((checkbox) => { - const sectionId = checkbox.previousSibling.name; - return this.map.data.data[sectionId]; - }); - } -}); - -return baseclass.extend({ - TableSelectSection: FormTableSelectSection -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/constants.js b/luci-app-podman/htdocs/luci-static/resources/podman/constants.js deleted file mode 100644 index 663fad09b..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/constants.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -'require baseclass'; - -const NOTIFICATION_TIMEOUT = 2000; - -const ICON = { - START: '►', - STOP: '◼', - RESTART: '↻', - PAUSE: '❚❚', - CLEAR_LOG: '🗑️', - INIT_ENABLED: '✓', - INIT_MISSING: '⚠', - INIT_DISABLED: '⏼', - BACK: '🔙', -}; - -return baseclass.extend({ - NOTIFICATION_TIMEOUT, - ICON, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form.js b/luci-app-podman/htdocs/luci-static/resources/podman/form.js deleted file mode 100644 index 6e56e2ae9..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form.js +++ /dev/null @@ -1,156 +0,0 @@ -'use strict'; - -'require baseclass'; -'require ui'; -'require form'; - -'require podman.ui as podmanUI'; -'require podman.utils as podmanUtil'; - -const FormMemoryValue = form.Value.extend({ - placeholder: '512m, 1g, -1', - validate(_section_id, value) { - if (!value) return true; - if (value === '-1' || value === '0') return true; - if (!/^\d+(?:\.\d+)?\s*[kmg]b?$/i.test(value)) { - return _('Expecting: %s').format(_('512m, 1g, or -1 for unlimited')); - } - return true; - }, -}); - -/** - * - */ -const FormDummyValue = form.DummyValue.extend({ - __name__: 'Podman.Form.DummyValue', - - cfgformatter: (cfg, _data) => cfg, - cfgdatavalue: (_data) => '', - cfgtt: (_cfg, _data) => '', - - cfgvalue(section_id, set_value) { - if (section_id == null) - L.error('TypeError', 'Section ID required'); - - const data = this.map.data.data[section_id]; - const dataValue = this.cfgdatavalue(data); - - if (dataValue) { - return this._renderValue(dataValue, data); - } - - if (arguments.length === 2 && set_value) { - this.data ??= {}; - this.data[section_id] = set_value; - } - - return this._renderValue(this.data?.[section_id], data); - }, - - _renderValue(value, data) { - const tooltip = this.cfgtt(value, data); - const formatted = this.cfgformatter(value, data); - return tooltip ? new podmanUI.Tooltip(formatted, tooltip).render() : formatted; - }, -}); - -/** - * - */ -const FormSelectDummyValue = form.DummyValue.extend({ - __name__: 'Podman.Form.SelectDummyValue', - - cfgvalue(sectionId) { - return new ui.Checkbox(0, { hiddenname: sectionId }).render(); - } -}); - -/** - * - */ -const FormLinkDummyValue = FormDummyValue.extend({ - __name__: 'Podman.Form.LinkDummyValue', - - url: '#', - click: undefined, - - cfgformatter(cfg, model) { - return E('a', { - class: 'text-bold', - href: this.url, - click: (ev) => { - if (typeof this.click === 'function') { - ev.preventDefault(); - this.click(cfg, model); - } - } - }, cfg); - } -}); - -/** - * - */ -const FormDateDummyValue = FormDummyValue.extend({ - __name__: 'Podman.Form.DateDummyValue', - cfgformatter: podmanUtil.format.date, -}); - -/** - * - */ -const FormTimestampDummyValue = FormDateDummyValue.extend({ - __name__: 'Podman.Form.TimestampDummyValue', - cfgformatter: (value) => podmanUtil.format.date(parseInt(value)), -}); - -/** - * - */ -const FormByteDummyValue = FormDummyValue.extend({ - __name__: 'Podman.Form.ByteDummyValue', - cfgformatter: podmanUtil.format.bytes, -}); - -const FormEditableField = baseclass.extend({ - __name__: 'Podman.Form.EditableField', - name: null, - formField: null, - - __init__(name, formField, onSubmit) { - this.name = name; - this.formField = formField; - if (onSubmit) { - this.onSubmit = onSubmit; - } - }, - - render() { - return E('div', { class: `editable-field editable-field-${this.name}` }, [ - this.formField, - new podmanUI.Button( - _('Update'), - () => this.onSubmit(document.querySelector(`.editable-field-${this.name} [name="${this.name}"]`).value), - 'apply' - ).render() - ]); - }, - - onSubmit(_value) {} -}); - -return baseclass.extend({ - __name__: 'Podman.Form', - - EditableField: FormEditableField, - field: { - MemoryValue: FormMemoryValue, - DummyValue: FormDummyValue, - ByteDummyValue: FormByteDummyValue, - DateDummyValue: FormDateDummyValue, - LinkDummyValue: FormLinkDummyValue, - SelectDummyValue: FormSelectDummyValue, - TimestampDummyValue: FormTimestampDummyValue, - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/container.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/container.js deleted file mode 100644 index b5ab6bd66..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/container.js +++ /dev/null @@ -1,355 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; - -'require podman.form as podmanForm'; -'require podman.utils as podmanUtil'; -'require podman.rpc as podmanRPC'; -'require podman.view as podmanView'; -'require podman.model.Container as Container'; - -/** - * Create podman container - */ -const PodmanFormContainer = podmanView.form.extend({ - __name__: 'Podman.Form.Container', - - makeData() { - return { - container: { - name: '', - image: '', - pod: '', - command: null, - ports: null, - env: null, - volumes: null, - network: 'bridge', - restart: 'no', - privileged: '0', - tty: '0', - remove: '0', - autoupdate: '0', - start: '0', - workdir: null, - hostname: null, - user: null, - groups: null, - expose: null, - labels: null, - cpus: null, - memory: null, - } - }; - }, - - async createForm() { - const [images, networks, pods] = await Promise.all([ - podmanRPC.images.list(), - podmanRPC.networks.list(), - podmanRPC.pods.list() - ]); - - let field; - field = this.section.option(form.Value, 'name', _('Container Name')); - field.placeholder = 'my-container'; - field.optional = true; - field.datatype = 'maxlength(253)'; - field.description = _('Leave empty to auto-generate'); - - field = this.section.option(form.ListValue, 'image', _('Image')); - field.value('', _('-- Select %s --').format(_('Image'))); - images.forEach((img) => { - img.getRepoTags().forEach((tag) => { - if (tag !== ':') { - field.value(tag, tag); - } - }); - }); - field.rmempty = false; - field.optional = false; - field.validate = (_section_id, value) => { - if (!value) { - return _('Expecting: %s').format(_('non-empty value')); - } - return true; - }; - field.description = _('Container image to use'); - - field = this.section.option(form.ListValue, 'pod', _('Pod')); - field.value('', _('(none)')); - pods.forEach((pod) => { - const name = pod.getName(); - if (name && name !== _('Unknown')) { - field.value(name, name); - } - }); - field.description = _( - 'Add the container to an existing pod. Network, hostname and port mappings come from the pod\'s infra container.' - ); - - field = this.section.option(form.Value, 'command', _('Command')); - field.placeholder = '/bin/sh'; - field.optional = true; - field.description = _('Command to run (space-separated)'); - - field = this.section.option(form.TextValue, 'ports', _('Port Mappings')); - field.depends('pod', ''); - field.placeholder = '8080:80\n8443:443'; - field.rows = 3; - field.optional = true; - field.description = _('One per line, format: host:container[/protocol]'); - - field = this.section.option(form.Value, 'expose', _('Expose Ports')); - field.depends('pod', ''); - field.placeholder = '6052, 8080/udp'; - field.optional = true; - field.description = _('Comma-separated ports to expose (e.g., 6052, 8080/udp)'); - - field = this.section.option(form.TextValue, 'env', _('Environment Variables')); - field.placeholder = 'VAR1=value1\nVAR2=value2'; - field.rows = 4; - field.optional = true; - field.description = _('One per line, format: key=value'); - - field = this.section.option(form.TextValue, 'volumes', _('Volumes')); - field.placeholder = '/host/path:/container/path:ro\nvolume-name:/data'; - field.rows = 4; - field.optional = true; - field.description = _( - 'One per line. Format: source:destination[:options]. Options: ro, rw, Z, z'); - - field = this.section.option(form.ListValue, 'network', _('Network')); - field.depends('pod', ''); - field.value('bridge', 'bridge (default)'); - field.value('host', 'host'); - field.value('none', 'none'); - networks.forEach((net) => { - const name = net.getName(); - if (name && name !== 'bridge' && name !== 'host' && name !== 'none') { - field.value(name, name); - } - }); - field.rmempty = false; - field.description = _( - 'Select network for the new container. User-created networks provide better isolation and DNS resolution between containers.' - ); - - field = this.section.option(form.ListValue, 'restart', _('Restart Policy')); - field.value('no', _('No')); - field.value('always', _('Always')); - field.value('on-failure', _('On Failure')); - field.value('unless-stopped', _('Unless Stopped')); - - field = this.section.option(form.Flag, 'privileged', _('Privileged Mode')); - - field = this.section.option(form.Flag, 'tty', _('Allocate TTY (-t)')); - - field = this.section.option(form.Flag, 'remove', _('Auto Remove (--rm)')); - - field = this.section.option(form.Flag, 'autoupdate', _('Auto-Update')); - field.description = _( - 'Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry' - ); - - field = this.section.option(form.Flag, 'start', _('Start after creation')); - field.description = _('Automatically start the container after it is created'); - - field = this.section.option(form.Value, 'workdir', _('Working Directory')); - field.placeholder = '/app'; - field.optional = true; - - field = this.section.option(form.Value, 'hostname', _('Hostname')); - field.depends('pod', ''); - field.placeholder = 'container-host'; - field.optional = true; - field.datatype = 'hostname'; - - field = this.section.option(form.Value, 'user', _('User')); - field.placeholder = '1000:1000'; - field.optional = true; - field.description = _('User and group to run as (UID:GID)'); - - field = this.section.option(form.Value, 'groups', _('Supplementary Groups')); - field.placeholder = '500,1000'; - field.optional = true; - field.description = _('Comma-separated list of supplementary group IDs'); - - field = this.section.option(form.TextValue, 'labels', _('Labels')); - field.placeholder = 'key1=value1\nkey2=value2'; - field.rows = 3; - field.optional = true; - field.description = _('One per line, format: key=value'); - - field = this.section.option(form.Value, 'cpus', _('CPU Limit')); - field.placeholder = '1.0'; - field.optional = true; - field.datatype = 'ufloat'; - field.description = _('Number of CPUs (e.g., 0.5, 1.0, 2.0)'); - - field = this.section.option(podmanForm.field.MemoryValue, 'memory', _('Memory Limit')); - field.optional = true; - field.description = _('Memory limit (e.g., 512m, 1g)'); - }, - - async handleCreate() { - if (!this.isValid()) { - return this.scrollToInvalid(); - } - - await this.save(); - - const data = this.getFieldValues(); - const spec = { - image: data.image, - privileged: Boolean(parseInt(data.privileged)), - terminal: Boolean(parseInt(data.tty)), - remove: Boolean(parseInt(data.remove)), - }; - - if (data.name) spec.name = data.name; - if (data.pod) spec.pod = data.pod; - if (data.command) spec.command = data.command.split(/\s+/).filter((c) => c.length > 0); - - if (!data.pod && data.ports) { - spec.portmappings = []; - data.ports.split('\n').forEach((line) => { - const trimmed = line.trim(); - if (!trimmed) return; - const parts = trimmed.split(':'); - if (parts.length === 2) { - const hostPort = parseInt(parts[0], 10); - const [containerPortStr, proto] = parts[1].split('/'); - const containerPort = parseInt(containerPortStr, 10); - if (!isNaN(hostPort) && !isNaN(containerPort)) { - spec.portmappings.push({ - host_port: hostPort, - container_port: containerPort, - protocol: (proto || 'tcp').toLowerCase() - }); - } - } - }); - } - - const parseKeyValue = (text, target) => { - text.split('\n').forEach((line) => { - const parts = line.split('='); - if (parts.length >= 2) { - const key = parts[0].trim(); - const value = parts.slice(1).join('=').trim(); - if (key) target[key] = value; - } - }); - }; - - if (data.env) { - spec.env = {}; - parseKeyValue(data.env, spec.env); - } - if (data.volumes) { - const mounts = []; - const volumes = []; - data.volumes.split('\n').forEach((line) => { - const parts = line.trim().split(':'); - if (parts.length < 2) return; - - const opts = parts.length > 2 ? parts[2].split(',') : []; - if (parts[0].includes('/')) { - const mount = { - Type: 'bind', - Source: parts[0], - Destination: parts[1] - }; - if (opts.length > 0) mount.Options = opts; - mounts.push(mount); - return; - } - - const vol = { - Name: parts[0], - Dest: parts[1] - }; - if (opts.length > 0) vol.Options = opts; - volumes.push(vol); - }); - if (mounts.length > 0) spec.mounts = mounts; - if (volumes.length > 0) spec.volumes = volumes; - } - if (!data.pod) { - if (data.network === 'host') { - spec.netns = { - nsmode: 'host' - }; - } else if (data.network === 'none') { - spec.netns = { - nsmode: 'none' - }; - } else if (data.network && data.network !== 'bridge') { - spec.networks = { - [data.network]: {} - }; - } - } - if (data.restart !== 'no') spec.restart_policy = data.restart; - if (data.workdir) spec.work_dir = data.workdir; - if (!data.pod && data.hostname) spec.hostname = data.hostname; - if (data.user) spec.user = data.user; - if (data.groups) { - spec.groups = data.groups.split(',').map((g) => g.trim()).filter((g) => g); - } - if (!data.pod && data.expose) { - spec.expose = {}; - data.expose.split(',').forEach((p) => { - const trimmed = p.trim(); - if (!trimmed) return; - const parts = trimmed.split('/'); - const port = parseInt(parts[0], 10); - if (port >= 1 && port <= 65535) - spec.expose[String(port)] = (parts[1] || 'tcp').toLowerCase(); - }); - } - if (data.labels || data.autoupdate === '1') { - spec.labels = {}; - if (data.labels) parseKeyValue(data.labels, spec.labels); - if (data.autoupdate === '1') spec.labels['io.containers.autoupdate'] = 'registry'; - } - if (data.cpus || data.memory) { - spec.resource_limits = {}; - if (data.cpus) { - spec.resource_limits.cpu = { - quota: parseFloat(data.cpus) * 100000 - }; - } - if (data.memory) { - const memBytes = podmanUtil.format.parseMemory(data.memory); - if (memBytes > 0) spec.resource_limits.memory = { - limit: memBytes - }; - } - } - - const hasRestartPolicy = data.restart && data.restart !== 'no'; - const shouldStart = Boolean(parseInt(data.start)); - - const createFn = async () => { - const raw = await podmanRPC.containers.create(spec); - const inspected = await Container.getSingleton(raw).inspect(); - const container = Container.getSingleton(inspected); - - if (hasRestartPolicy) { - await container.generateInitScript(); - await container.enableInitScript(); - } - - if (shouldStart) await container.start(); - }; - - return this.super('handleCreate', [createFn, _('Container')]); - }, -}); - -return baseclass.extend({ - init: PodmanFormContainer -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/image.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/image.js deleted file mode 100644 index fa48445e9..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/image.js +++ /dev/null @@ -1,91 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; -'require ui'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.model.Image as Image'; - -/** - * Pull podman image - */ -const PodmanFormImage = podmanView.form.extend({ - __name__: 'Podman.Form.Image', - - makeData() { - return { - image: { - registry: '', - image: '', - } - }; - }, - - createForm() { - let field; - - field = this.section.option(form.ListValue, 'registry', _('Registry')); - field.value('', 'docker.io'); - field.value('quay.io/', 'quay.io'); - field.value('ghcr.io/', 'ghcr.io'); - field.value('gcr.io/', 'gcr.io'); - - field = this.section.option(form.Value, 'image', _('Image')); - field.placeholder = 'nginx:latest'; - field.rmempty = false; - }, - - async handleCreate() { - if (!this.isValid()) { - return this.scrollToInvalid(); - } - - await this.save(); - - const registry = this.getFieldValue('registry'); - const image = this.getFieldValue('image'); - - const imageName = this.buildImageName(registry, image); - const imageModel = Image.getSingleton({ RepoTags: [imageName] }); - - const progressEl = E('pre', { class: 'terminal-area' }); - const modal = new podmanUI.Modal(_('Pulling %s').format(imageName), [ progressEl ]); - - /** @type {HTMLElement} */ - const closeButton = modal.getCloseButton(); - closeButton.classList.add('d-none'); - - modal.getButtons = () => [ closeButton ]; - modal.render(); - - const append = (text) => { - progressEl.appendChild(document.createTextNode(text)); - progressEl.scrollTop = progressEl.scrollHeight; - }; - - try { - await imageModel.streamPull(append); - closeButton.classList.remove('d-none'); - podmanUI.alert(_('Image pulled successfully'), 'success', true); - } catch (error) { - this.error(error); - } - }, - - buildImageName(registry, image) { - const reg = (registry || '').trim(); - const img = (image || '').trim(); - - if (!reg) { - return img.includes('/') ? 'docker.io/' + img : 'docker.io/library/' + img; - } - - return reg.replace(/\/+$/, '') + '/' + img.replace(/^\/+/, ''); - }, -}); - -return baseclass.extend({ - init: PodmanFormImage -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/network.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/network.js deleted file mode 100644 index 7828b2f75..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/network.js +++ /dev/null @@ -1,304 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; -'require ui'; -'require uci'; -'require network'; -'require firewall'; - -'require podman.utils as utils'; -'require podman.rpc as podmanRPC'; -'require podman.view as podmanView'; -'require podman.model.Network as Network'; - -/** - * Create podman network - */ -const PodmanFormNetwork = podmanView.form.extend({ - __name__: 'Podman.Form.Network', - - existingZones: null, - parentDevices: null, - - makeData() { - return { - network: { - name: null, - driver: 'bridge', - subnet: null, - gateway: null, - ip_range: null, - ipv6: '0', - internal: '0', - labels: null, - setup_openwrt: '1', - firewall_zone: '_create_new_', - } - }; - }, - - async render() { - const [zones, parentDevices] = await Promise.all([ - firewall.getZones().then((zones) => - zones - .filter(zone => zone.data.name?.startsWith('podman')) - .map(zone => zone.data.name) - ), - network.getDevices().then((devices) => - devices.filter(this.isValidParentDevice) - ), - ]); - - this.existingZones = zones; - this.parentDevices = parentDevices; - - return this.super('render', []); - }, - - createForm: function () { - let field; - - field = this.section.option(form.Value, 'name', _('Network Name')); - field.placeholder = 'my-network'; - field.datatype = 'and(uciname,maxlength(15))'; - field.description = _('Name for the network'); - field.rmempty = false; - - field = this.section.option(form.ListValue, 'driver', _('Driver')); - field.value('bridge', 'bridge'); - field.value('macvlan', 'macvlan'); - field.value('ipvlan', 'ipvlan'); - field.description = _('Network driver'); - - field = this.section.option(form.ListValue, 'parent', _('Parent Interface')); - field.depends('driver', 'macvlan'); - field.depends('driver', 'ipvlan'); - field.description = _( - 'Existing physical interface to use as parent. Required for macvlan/ipvlan networks.' - ); - if (this.parentDevices.length > 0) { - this.parentDevices.forEach((device) => { - const name = device.getName(); - field.value(name, name + ' (' + device.getType() + ')'); - }); - } else { - field.value('', _('No suitable interfaces found')); - } - - field = this.section.option(form.Value, 'subnet', _('IPv4 Subnet (CIDR)')); - field.placeholder = '10.89.0.0/24'; - field.datatype = 'cidr4'; - field.description = _('IPv4 subnet in CIDR notation'); - // field.rmempty = false; - - field = this.section.option(form.Value, 'gateway', _('IPv4 Gateway')); - field.placeholder = '10.89.0.1'; - field.optional = true; - field.datatype = 'ip4addr'; - field.description = _('IPv4 gateway address'); - - field = this.section.option(form.Value, 'ip_range', _('IP Range (CIDR)')); - field.placeholder = '10.89.0.0/28'; - field.optional = true; - field.datatype = 'cidr4'; - field.description = _('Allocate container IP from this range'); - - field = this.section.option(form.Flag, 'ipv6', _('Enable IPv6')); - field.description = _('Enable IPv6 networking'); - - field = this.section.option(form.Flag, 'internal', _('Internal Network')); - field.description = _('Restrict external access to the network'); - - field = this.section.option(form.Flag, 'setup_openwrt', _('Setup OpenWrt Integration')); - field.description = _( - 'Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt.' - ); - - field = this.section.option(form.Value, 'bridge_name', _('Bridge Interface Name')); - field.placeholder = _('Leave empty to auto-generate'); - field.optional = true; - field.datatype = 'netdevname'; - field.depends({ - 'setup_openwrt': '1', - 'driver': 'bridge' - }); - field.description = _( - 'Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it.' - ); - - field = this.section.option(form.ListValue, 'firewall_zone', _('Firewall Zone')); - field.value('_create_new_', _('Create new zone (will be named: podman_)')); - if (this.existingZones.length > 0) { - this.existingZones.forEach((zoneName) => { - field.value(zoneName, zoneName); - }); - } - field.depends('setup_openwrt', '1'); - field.description = _( - 'Choose firewall zone for this network.' - ); - - field = this.section.option(form.TextValue, 'labels', _('Labels')); - field.placeholder = 'key1=value1\nkey2=value2'; - field.rows = 3; - field.optional = true; - field.description = _('Labels in key=value format, one per line'); - }, - - async handleCreate() { - if (!this.isValid()) { - return this.scrollToInvalid(); - } - - await this.save(); - await uci.load(['network', 'firewall', 'dhcp']); - const ulaPrefix = uci.get('network', 'globals', 'ula_prefix'); - - const podnetwork = this.getFieldValues(); - - const setupOpenwrt = podnetwork.setup_openwrt === '1'; - const driver = podnetwork.driver || 'bridge'; - const requestedZone = podnetwork.firewall_zone || '_create_new_'; - const zoneName = requestedZone === '_create_new_' ? 'podman_' + podnetwork.name : - requestedZone; - const baseBridgeName = podnetwork.bridge_name || podnetwork.name; - - let bridgeName = baseBridgeName; - let i = 1; - while (await network.getDevice(bridgeName)) { - bridgeName = `${baseBridgeName}${i}`; - i++; - } - - if ((driver === 'macvlan' || driver === 'ipvlan') && !podnetwork.parent) { - this.error(_('Parent interface is required for macvlan/ipvlan networks')); - return; - } - - // if (setupOpenwrt && !podnetwork.subnet) { - // this.error(_('OpenWrt integration requires subnet to be specified')); - // return; - // } - - if (!podnetwork.gateway && podnetwork.subnet) { - podnetwork.gateway = utils.ipv4.firstHost(podnetwork.subnet); - } - - const payload = { - name: podnetwork.name, - driver: driver - }; - - if (driver === 'bridge') { - payload.network_interface = bridgeName; - } else if (driver === 'macvlan' || driver === 'ipvlan') { - payload.network_interface = podnetwork.parent; - } - - if (podnetwork.subnet) { - payload.subnets = [{ - subnet: podnetwork.subnet - }]; - if (podnetwork.gateway) payload.subnets[0].gateway = podnetwork.gateway; - - if (podnetwork.ip_range) { - const range = utils.ipv4.cidrToRange(podnetwork.ip_range); - if (range) payload.subnets[0].lease_range = range; - } - } - - payload.ipv6_enabled = false; - if (podnetwork.ipv6 === '1') { - const ipv6obj = utils.ipv6.deriveUlaFromIpv4(podnetwork.subnet, ulaPrefix); - payload.ipv6_enabled = true; - - if (podnetwork.subnet) { - payload.subnets.push({ - subnet: ipv6obj.ipv6subnet - }); - - if (podnetwork.gateway) - payload.subnets[1].gateway = ipv6obj.ipv6gateway; - } - } - - payload.internal = podnetwork.internal === '1'; - if (podnetwork.labels) { - payload.labels = {}; - podnetwork.labels.split('\n').forEach((line) => { - const parts = line.split('='); - if (parts.length >= 2) { - const key = parts[0].trim(); - const value = parts.slice(1).join('=').trim(); - if (key) payload.labels[key] = value; - } - }); - } - - const createFn = async () => { - const newNetwork = await podmanRPC.networks.create(payload); - - if (!setupOpenwrt) return; - - const inspectData = await Network.getSingleton({ - name: podnetwork.name - }).inspect(); - const NetworkModel = Network.getSingleton(inspectData); - const deviceName = await NetworkModel.integrationCreateDevice(); - await NetworkModel.integrationCreateNetwork(deviceName); - - if (await NetworkModel.hasDnsmasq()) { - await NetworkModel.integrationAddDnsmasqExclusion(); - } - - if (await firewall.getZone(zoneName)) { - const currentNetworks = uci.get('firewall', zoneName, 'network'); - const networkList = Array.isArray(currentNetworks) ? currentNetworks : - currentNetworks ? [currentNetworks] : []; - if (!networkList.includes(podnetwork.name)) { - networkList.push(podnetwork.name); - uci.set('firewall', zoneName, 'network', networkList); - } - } else { - const zoneId = uci.add('firewall', 'zone'); - uci.set('firewall', zoneId, 'name', zoneName); - uci.set('firewall', zoneId, 'input', 'DROP'); - uci.set('firewall', zoneId, 'output', 'ACCEPT'); - uci.set('firewall', zoneId, 'forward', 'REJECT'); - uci.set('firewall', zoneId, 'network', [podnetwork.name]); - } - - const dnsRuleName = 'Allow-' + zoneName + '-DNS'; - const existingDnsRule = uci.sections('firewall', 'rule').find((s) => - uci.get('firewall', s['.name'], 'name') === dnsRuleName - ); - - if (!existingDnsRule) { - const ruleId = uci.add('firewall', 'rule'); - uci.set('firewall', ruleId, 'name', dnsRuleName); - uci.set('firewall', ruleId, 'src', zoneName); - uci.set('firewall', ruleId, 'dest_port', '53'); - uci.set('firewall', ruleId, 'target', 'ACCEPT'); - } - - await uci.save(); - ui.changes.apply(); - await network.flushCache(); - }; - - return this.super('handleCreate', [createFn, _('Network')]); - }, - - isValidParentDevice(device) { - const type = device.getType(); - const name = device.getName(); - return ['ethernet', 'bridge', 'vlan'].includes(type) && - name !== 'lo' && - !name.match(/^(podman|cni-|docker|veth)/); - } -}); - -return baseclass.extend({ - init: PodmanFormNetwork -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/pod.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/pod.js deleted file mode 100644 index a34c62185..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/pod.js +++ /dev/null @@ -1,178 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; - -'require podman.form as podmanForm'; -'require podman.utils as podmanUtil'; -'require podman.rpc as podmanRPC'; -'require podman.view as podmanView'; - -const PodmanFormPod = podmanView.form.extend({ - __name__: 'Podman.Form.Pod', - - makeData() { - return { - pod: { - name: '', - hostname: null, - share: ['cgroup', 'ipc', 'net', 'uts'], - infra: '1', - infra_image: null, - network: 'bridge', - dns_server: null, - dns_search: null, - cpus: null, - cpuset_cpus: null, - memory: null, - labels: null, - } - }; - }, - - async createForm() { - const networks = await podmanRPC.networks.list(); - - let field; - - field = this.section.option(form.Value, 'name', _('Pod Name')); - field.placeholder = 'my-pod'; - field.optional = true; - field.datatype = 'and(uciname,maxlength(63))'; - field.description = _('Leave empty to auto-generate'); - - field = this.section.option(form.Value, 'hostname', _('Hostname')); - field.placeholder = 'pod-host'; - field.optional = true; - field.datatype = 'hostname'; - field.description = _('Hostname for the pod (defaults to pod name)'); - - field = this.section.option(form.MultiValue, 'share', _('Shared Namespaces')); - field.value('cgroup', 'cgroup'); - field.value('ipc', 'ipc'); - field.value('net', 'net'); - field.value('pid', 'pid'); - field.value('uts', 'uts'); - field.description = _('Linux namespaces shared between containers in the pod. Default matches `podman pod create`.'); - - field = this.section.option(form.Flag, 'infra', _('Create Infra Container')); - field.description = _('Required for shared network namespace. Disable only if you know you do not need it.'); - - field = this.section.option(form.Value, 'infra_image', _('Infra Image')); - field.depends('infra', '1'); - field.placeholder = 'k8s.gcr.io/pause:3.5'; - field.optional = true; - field.description = _('Override the image used for the infra container'); - - field = this.section.option(form.ListValue, 'network', _('Network')); - field.depends('infra', '1'); - field.value('bridge', 'bridge (default)'); - field.value('host', 'host'); - field.value('none', 'none'); - networks.forEach((net) => { - const name = net.getName(); - if (name && name !== 'bridge' && name !== 'host' && name !== 'none') { - field.value(name, name); - } - }); - field.description = _('Network namespace for the pod. Containers in the pod share this network.'); - - field = this.section.option(form.DynamicList, 'dns_server', _('DNS Servers')); - field.depends('infra', '1'); - field.datatype = 'ipaddr'; - field.optional = true; - field.description = _('DNS servers for the infra container (shared with all pod containers)'); - - field = this.section.option(form.DynamicList, 'dns_search', _('DNS Search Domains')); - field.depends('infra', '1'); - field.optional = true; - field.description = _('DNS search domains for the infra container'); - - field = this.section.option(form.Value, 'cpus', _('CPU Limit')); - field.placeholder = '1.0'; - field.optional = true; - field.datatype = 'ufloat'; - field.description = _('Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)'); - - field = this.section.option(form.Value, 'cpuset_cpus', _('CPU Set')); - field.placeholder = '0-3'; - field.optional = true; - field.description = _('CPUs the pod is allowed to run on (e.g., "0-3" or "0,2")'); - - field = this.section.option(podmanForm.field.MemoryValue, 'memory', _('Memory Limit')); - field.optional = true; - field.description = _('Memory limit for the pod (e.g., 512m, 1g)'); - - field = this.section.option(form.TextValue, 'labels', _('Labels')); - field.placeholder = 'key1=value1\nkey2=value2'; - field.rows = 3; - field.optional = true; - field.description = _('One per line, format: key=value'); - }, - - async handleCreate() { - if (!this.isValid()) { - return this.scrollToInvalid(); - } - - await this.save(); - - const data = this.getFieldValues(); - const spec = {}; - - if (data.name) spec.name = data.name; - if (data.hostname) spec.hostname = data.hostname; - - const shareRaw = data.share; - spec.share = Array.isArray(shareRaw) - ? shareRaw - : (typeof shareRaw === 'string' && shareRaw.trim() ? shareRaw.trim().split(/\s+/) : []); - - const hasInfra = data.infra === '1'; - spec.infra = hasInfra; - if (hasInfra && data.infra_image) spec.infra_image = data.infra_image; - - if (hasInfra) { - if (data.network === 'host') { - spec.netns = { nsmode: 'host' }; - } else if (data.network === 'none') { - spec.netns = { nsmode: 'none' }; - } else if (data.network && data.network !== 'bridge') { - spec.Networks = { [data.network]: {} }; - } - - if (data.dns_server && data.dns_server.length) spec.dns_server = data.dns_server; - if (data.dns_search && data.dns_search.length) spec.dns_search = data.dns_search; - } - - if (data.cpus) spec.cpus = parseFloat(data.cpus); - if (data.cpuset_cpus) spec.cpuset_cpus = data.cpuset_cpus; - - if (data.memory) { - const memBytes = podmanUtil.format.parseMemory(data.memory); - if (memBytes > 0) { - spec.resource_limits = { memory: { limit: memBytes } }; - } - } - - if (data.labels) { - spec.labels = {}; - data.labels.split('\n').forEach((line) => { - const parts = line.split('='); - if (parts.length >= 2) { - const key = parts[0].trim(); - const value = parts.slice(1).join('=').trim(); - if (key) spec.labels[key] = value; - } - }); - } - - const createFn = () => podmanRPC.pods.create(spec); - - return this.super('handleCreate', [ createFn, _('Pod') ]); - }, -}); - -return baseclass.extend({ - init: PodmanFormPod -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/resource.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/resource.js deleted file mode 100644 index f297bfb61..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/resource.js +++ /dev/null @@ -1,117 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; - -'require podman.utils as podmanUtil'; -'require podman.form as podmanForm'; -'require podman.view as podmanView'; - -/** - * Update podman container resources - */ -const PodmanFormResource = podmanView.form.extend({ - __name__: 'Podman.Form.Resource', - - container: null, - - makeData() { - if (!this.container) { - return { resources: { cpuLimit: '', cpuShares: '', memory: '', memorySwap: '' } }; - } - - const hostConfig = this.container.getHostConfig(); - return { - resources: { - cpuLimit: hostConfig.CpuQuota > 0 ? (hostConfig.CpuQuota / 100000).toFixed(2) : '', - cpuShares: hostConfig.CpuShares || '', - memory: hostConfig.Memory > 0 ? podmanUtil.format.bytes(hostConfig.Memory, 0) : '', - memorySwap: hostConfig.MemorySwap > 0 ? podmanUtil.format.bytes(hostConfig.MemorySwap, 0) : '', - } - }; - }, - - async render(container) { - this.container = container; - - return this.super('render', []); - }, - - createForm() { - let field; - - field = this.section.option(form.Value, 'cpuLimit', _('CPU Limit')); - field.datatype = 'ufloat'; - field.placeholder = '0.5, 1.0, 2.0'; - field.description = _('Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited.'); - - field = this.section.option(form.Value, 'cpuShares', _('CPU Shares Weight')); - field.datatype = 'uinteger'; - field.placeholder = '1024'; - field.validate = (_section_id, value) => { - if (value) { - const n = parseInt(value); - if (n < 0 || n > 262144) return _('Must be between 0 and 262144'); - } - return true; - }; - field.description = _('CPU shares (relative weight). 0 = use default.'); - - field = this.section.option(podmanForm.field.MemoryValue, 'memory', _('Memory Limit')); - field.description = _('Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default.'); - - field = this.section.option(podmanForm.field.MemoryValue, 'memorySwap', _('Memory + Swap Limit')); - field.description = _('Total memory limit (memory + swap). -1 = unlimited, 0 = use default.'); - - field = this.section.option(form.Button, '_update', ' '); - field.inputtitle = _('Update Resources'); - field.inputstyle = 'save'; - field.onclick = () => this.handleUpdate(); - }, - - async handleUpdate() { - if (!this.isValid()) { - return this.scrollToInvalid(); - } - - await this.save(); - - const data = this.getFieldValues(); - const updateData = { - cpu: { - quota: 0, - period: 0, - shares: parseInt(data.cpuShares) || 0, - }, - }; - - const parseMemory = (val) => - (!val || val === '-1' || val === '0') ? -1 : podmanUtil.format.parseMemory(val); - - const memory = parseMemory(data.memory); - const memorySwap = parseMemory(data.memorySwap); - - if (data.cpuLimit) { - const period = 100000; - updateData.cpu.quota = Math.floor(parseFloat(data.cpuLimit) * period); - updateData.cpu.period = period; - } - - updateData.memory = { limit: memory }; - if (memory === -1 || memorySwap === -1) { - updateData.memory.swap = -1; - } else if (memorySwap > 0) { - updateData.memory.swap = memorySwap; - } else { - updateData.memory.swap = null; - } - - const createFn = () => this.container.update(updateData); - - return this.super('handleCreate', [ createFn, _('Saving resource'), _('Updating container'), _('Container updated successfully') ]); - }, -}); - -return baseclass.extend({ - init: PodmanFormResource -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/secret.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/secret.js deleted file mode 100644 index 9fed6b27d..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/secret.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; - -'require podman.rpc as podmanRPC'; -'require podman.view as podmanView'; - -/** - * Create podman secret - */ -const PodmanFormSecret = podmanView.form.extend({ - __name__: 'Podman.Form.Secret', - - makeData() { - return { - secret: { - name: null, - data: null, - labels: null, - } - }; - }, - - createForm() { - let field; - - field = this.section.option(form.Value, 'name', _('Secret Name')); - field.placeholder = 'my-secret'; - field.rmempty = false; - field.datatype = 'maxlength(253)'; - field.validate = (_section_id, value) => { - if (!/^[a-zA-Z0-9_-]+$/.test(value)) { - return _( - 'Secret name can only contain letters, numbers, underscores, and hyphens' - ); - } - return true; - }; - field.description = _( - '1-253 characters: letters, numbers, underscore (_), hyphen (-) only'); - - field = this.section.option(form.TextValue, 'data', _('Secret Data')); - field.placeholder = _('Enter secret data (password, token, key, etc.)'); - field.rmempty = false; - field.rows = 6; - field.description = _('The sensitive data to store securely'); - - field = this.section.option(form.TextValue, 'labels', _('Labels')); - field.placeholder = 'key1=value1\nkey2=value2'; - field.rows = 3; - field.optional = true; - field.description = _('Labels in key=value format, one per line'); - }, - - async handleCreate() { - if (!this.isValid()) { - return this.scrollToInvalid(); - } - - await this.save(); - - const data = this.getFieldValues(); - - if (!data.name || !data.data) { - return; - } - - const labels = {}; - if (data.labels) { - data.labels.split('\n').forEach((line) => { - const parts = line.split('='); - if (parts.length >= 2) { - const key = parts[0].trim(); - const value = parts.slice(1).join('=').trim(); - if (key) labels[key] = value; - } - }); - } - - const createFn = () => podmanRPC.secrets.create(data.name, data.data, labels); - - return this.super('handleCreate', [ createFn, _('Secret') ]); - }, -}); - -return baseclass.extend({ - init: PodmanFormSecret -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/volume.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/volume.js deleted file mode 100644 index 293f60c00..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/volume.js +++ /dev/null @@ -1,97 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; - -'require podman.rpc as podmanRPC'; -'require podman.view as podmanView'; - -/** - * Create podman volume - */ -const PodmanFormVolume = podmanView.form.extend({ - __name__: 'Podman.Form.Volume', - - sectionName: 'volume', - - makeData() { - return { - volume: { - name: null, - driver: 'local', - options: null, - labels: null, - } - }; - }, - - createForm() { - let field; - - field = this.section.option(form.Value, 'name', _('Volume Name')); - field.placeholder = 'my-volume'; - field.optional = true; - field.datatype = 'maxlength(253)'; - field.description = _('Volume name. Leave empty to auto-generate.'); - - field = this.section.option(form.ListValue, 'driver', _('Driver')); - field.value('local', 'local'); - field.value('image', 'image'); - field.description = _('Volume driver to use'); - - field = this.section.option(form.Value, 'options', _('Mount Options')); - field.placeholder = 'type=tmpfs,device=tmpfs,o=size=100m'; - field.optional = true; - field.description = _('Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)'); - - field = this.section.option(form.TextValue, 'labels', _('Labels')); - field.placeholder = 'key1=value1\nkey2=value2'; - field.rows = 3; - field.optional = true; - field.description = _('Labels in key=value format, one per line'); - }, - - async handleCreate() { - if (!this.isValid()) { - return this.scrollToInvalid(); - } - - await this.save(); - - const data = this.getFieldValues(); - const payload = { - Name: data.name, - Driver: data.driver, - }; - - if (data.options) { - payload.Options = {}; - data.options.split(',').forEach((opt) => { - const parts = opt.split('='); - if (parts.length >= 2) { - payload.Options[parts[0].trim()] = parts.slice(1).join('=').trim(); - } - }); - } - - if (data.labels) { - payload.Labels = {}; - data.labels.split('\n').forEach((line) => { - const parts = line.split('='); - if (parts.length >= 2) { - const key = parts[0].trim(); - const value = parts.slice(1).join('=').trim(); - if (key) payload.Labels[key] = value; - } - }); - } - - const createFn = () => podmanRPC.volumes.create(payload); - - return this.super('handleCreate', [ createFn, _('Volume') ]); - }, -}); - -return baseclass.extend({ - init: PodmanFormVolume, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/form/volumeImport.js b/luci-app-podman/htdocs/luci-static/resources/podman/form/volumeImport.js deleted file mode 100644 index e3e794383..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/form/volumeImport.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; - -'require baseclass'; -'require form'; -'require request'; - -'require podman.rpc as podmanRPC'; -'require podman.view as podmanView'; - -/** - * Import podman volume - */ -const PodmanFormVolumeImport = podmanView.form.extend({ - __name__: 'Podman.Form.VolumeImport', - - sectionName: 'volume', - - isCompressed: false, - file: null, - - makeData() { - return { - volume: { - name: null, - } - }; - }, - - async render(file) { - this.file = file; - - return this.super('render', []); - }, - - createForm() { - const isCompressed = this.file.name.endsWith('.tar.gz') || this.file.name.endsWith('.tgz'); - const volumeName = this.file.name.replace(/\.(tar\.gz|tgz|tar)$/, ''); - - this.isCompressed = isCompressed; - - const field = this.section.option(form.Value, 'name', _('Volume Name')); - field.placeholder = 'my-volume'; - field.rmempty = false; - field.datatype = 'rangelength(1,253)'; - field.default = volumeName; - }, - - async handleCreate() { - await this.save(); - - const name = this.getFieldValue('name'); - - this.loading(_('Uploading file...')); - - const formData = new FormData(); - formData.append('sessionid', L.env.sessionid); - formData.append('filename', '/tmp/podman-import'); - formData.append('filedata', this.file); - - const response = await request.post(L.env.cgi_base + '/cgi-upload', formData); - if (!response.ok) { - this.error(_('Upload failed: %s').format(response.statusText)); - return; - } - - this.loading(_('Importing volume...')); - - await podmanRPC.volumes.import(name, this.isCompressed); - this.success(_('Volume imported successfully')); - }, -}); - -return baseclass.extend({ - init: PodmanFormVolumeImport, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/model/Container.js b/luci-app-podman/htdocs/luci-static/resources/podman/model/Container.js deleted file mode 100644 index 9eb5e1092..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/model/Container.js +++ /dev/null @@ -1,897 +0,0 @@ -'use strict'; - -'require baseclass'; - -'require podman.model.Model as Model'; -'require podman.model.Network as Network'; -'require podman.model.Image as Image'; -'require podman.constants as constants'; -'require podman.utils as podmanUtil'; - - -const InitScript = { - generate: Model.declareRPC({ - object: 'podman', - method: 'init_script_generate', - params: ['name'] - }), - - show: Model.declareRPC({ - object: 'podman', - method: 'init_script_show', - params: ['name'] - }), - - status: Model.declareRPC({ - object: 'podman', - method: 'init_script_status', - params: ['name'] - }), - - setEnabled: Model.declareRPC({ - object: 'podman', - method: 'init_script_set_enabled', - params: ['name', 'enabled'] - }), - - remove: Model.declareRPC({ - object: 'podman', - method: 'init_script_remove', - params: ['name'] - }) -}; - -const ContainerRPC = { - inspect: Model.declareRPC({ - object: 'podman', - method: 'container_inspect', - params: ['id'] - }), - - update: Model.declareRPC({ - object: 'podman', - method: 'container_update', - params: ['id', 'data'] - }), - - remove: Model.declareRPC({ - object: 'podman', - method: 'container_remove', - params: ['id', 'force', 'depend'] - }), - - start: Model.declareRPC({ - object: 'podman', - method: 'container_start', - params: ['id'] - }), - - stop: Model.declareRPC({ - object: 'podman', - method: 'container_stop', - params: ['id'] - }), - - restart: Model.declareRPC({ - object: 'podman', - method: 'container_restart', - params: ['id'] - }), - - pause: Model.declareRPC({ - object: 'podman', - method: 'container_pause', - params: ['id'] - }), - - unpause: Model.declareRPC({ - object: 'podman', - method: 'container_unpause', - params: ['id'] - }), - - rename: Model.declareRPC({ - object: 'podman', - method: 'container_rename', - params: ['id', 'name'] - }), - - create: Model.declareRPC({ - object: 'podman', - method: 'container_create', - params: ['data'] - }), -}; - -const Container = Model.base.extend({ - __name__: 'Podman.Model.Container', - - getID() { - return this.Id || ''; - }, - - getName() { - if (this.Names && Array.isArray(this.Names) && this.Names.length > 0) { - return this.Names[0]; - } - - if (this.Names && !Array.isArray(this.Names) && this.Names !== '') { - return this.Names; - } - - if (this.Name) { - return this.Name; - } - - return _('Unknown'); - }, - - getState() { - if (typeof this.State === 'string') { - return this.State; - } - - return this.State?.Status || this.Status || ''; - }, - - getStateBadge() { - return E('div', { - class: `badge ${this.getState()}` - }, [this.getState()]); - }, - - getAutoUpdateLabel() { - const labels = this.Config?.Labels || this.Labels; - if (!labels) { - return false; - } - return labels['io.containers.autoupdate'] || false; - }, - - getCmdString() { - return this.Config?.Cmd ? this.Config.Cmd.join(' ') : ''; - }, - - getEntrypointString() { - return this.Config?.Entrypoint ? this.Config.Entrypoint.join(' ') : ''; - }, - - getCreateCommandString() { - return this.Config?.CreateCommand ? this.Config?.CreateCommand.join(' ') : ''; - }, - - inspectToSpec(imageRef) { - const config = this.Config || {}; - const hostConfig = this.HostConfig || {}; - const networkSettings = this.NetworkSettings || {}; - const mounts = this.Mounts || []; - - const spec = { - image: imageRef - }; - - // Name (strip leading slash added by Podman inspect) - if (this.Name) spec.name = this.Name.replace(/^\//, ''); - - // Process - if (config.Cmd && config.Cmd.length) spec.command = config.Cmd; - if (config.Entrypoint && config.Entrypoint.length) spec.entrypoint = config.Entrypoint; - if (config.Tty) spec.terminal = true; - if (config.OpenStdin) spec.stdin = true; - if (config.WorkingDir) spec.work_dir = config.WorkingDir; - if (config.User) spec.user = config.User; - if (config.Hostname) spec.hostname = config.Hostname; - if (config.StopSignal) { - const sigMap = { - SIGHUP: 1, - SIGINT: 2, - SIGQUIT: 3, - SIGILL: 4, - SIGTRAP: 5, - SIGABRT: 6, - SIGBUS: 7, - SIGFPE: 8, - SIGKILL: 9, - SIGUSR1: 10, - SIGSEGV: 11, - SIGUSR2: 12, - SIGPIPE: 13, - SIGALRM: 14, - SIGTERM: 15, - SIGCHLD: 17, - SIGCONT: 18, - SIGSTOP: 19, - SIGTSTP: 20, - SIGTTIN: 21, - SIGTTOU: 22, - SIGURG: 23, - SIGXCPU: 24, - SIGXFSZ: 25, - SIGVTALRM: 26, - SIGPROF: 27, - SIGWINCH: 28, - SIGIO: 29, - SIGPWR: 30, - SIGSYS: 31, - }; - const sigStr = String(config.StopSignal).toUpperCase().replace(/^SIG/, ''); - const sigNum = sigMap['SIG' + sigStr] ?? parseInt(config.StopSignal, 10); - if (sigNum > 0) spec.stop_signal = sigNum; - } - if (config.StopTimeout) spec.stop_timeout = config.StopTimeout; - if (config.Healthcheck) spec.healthconfig = config.Healthcheck; - - // Environment: ["KEY=val", ...] → {KEY: "val", ...} - if (config.Env && config.Env.length) { - spec.env = {}; - for (const e of config.Env) { - const idx = e.indexOf('='); - if (idx > 0) spec.env[e.substring(0, idx)] = e.substring(idx + 1); - } - } - - // Labels - if (config.Labels && Object.keys(config.Labels).length) - spec.labels = config.Labels; - - // HostConfig - if (hostConfig.Privileged) spec.privileged = true; - if (hostConfig.ReadonlyRootfs) spec.read_only_filesystem = true; - if (hostConfig.AutoRemove) spec.remove = true; - if (hostConfig.CapAdd && hostConfig.CapAdd.length) spec.cap_add = hostConfig.CapAdd; - if (hostConfig.CapDrop && hostConfig.CapDrop.length) spec.cap_drop = hostConfig.CapDrop; - if (hostConfig.Dns && hostConfig.Dns.length) spec.dns_server = hostConfig.Dns; - if (hostConfig.DnsOptions && hostConfig.DnsOptions.length) spec.dns_option = hostConfig - .DnsOptions; - if (hostConfig.DnsSearch && hostConfig.DnsSearch.length) spec.dns_search = hostConfig - .DnsSearch; - if (hostConfig.ExtraHosts && hostConfig.ExtraHosts.length) spec.hostadd = hostConfig - .ExtraHosts; - if (hostConfig.GroupAdd && hostConfig.GroupAdd.length) spec.groups = hostConfig.GroupAdd; - if (hostConfig.ShmSize) spec.shm_size = hostConfig.ShmSize; - if (hostConfig.OomScoreAdj) spec.oom_score_adj = hostConfig.OomScoreAdj; - - // Restart policy - const rp = hostConfig.RestartPolicy; - if (rp && rp.Name && rp.Name !== 'no') { - spec.restart_policy = rp.Name; - if (rp.MaximumRetryCount) spec.restart_tries = rp.MaximumRetryCount; - } - - // Exposed ports: {"8080/tcp": {}} → {8080: "tcp"} - const exposedPorts = config.ExposedPorts || {}; - if (Object.keys(exposedPorts).length) { - spec.expose = {}; - for (const portProto of Object.keys(exposedPorts)) { - const [port, proto] = portProto.split('/'); - const portNum = parseInt(port, 10); - if (portNum > 0 && portNum <= 65535) - spec.expose[portNum] = proto || 'tcp'; - } - } - - // Port mappings: {"8080/tcp": [{HostIp, HostPort}]} → array - const portBindings = hostConfig.PortBindings || {}; - if (Object.keys(portBindings).length) { - spec.portmappings = []; - for (const [portProto, bindings] of Object.entries(portBindings)) { - if (!bindings || !bindings.length) continue; - const [port, protocol] = portProto.split('/'); - const containerPort = parseInt(port, 10); - for (const b of bindings) { - const m = { - container_port: containerPort, - protocol: protocol || 'tcp' - }; - if (b.HostPort) m.host_port = parseInt(b.HostPort, 10); - if (b.HostIp && b.HostIp !== '0.0.0.0') m.host_ip = b.HostIp; - spec.portmappings.push(m); - } - } - } - - // Resource limits - use CFS quota/period directly (most precise) - if (hostConfig.Memory > 0 || hostConfig.CpuQuota > 0) { - spec.resource_limits = {}; - if (hostConfig.Memory > 0) - spec.resource_limits.memory = { - limit: hostConfig.Memory - }; - if (hostConfig.CpuQuota > 0) { - spec.resource_limits.cpu = { - quota: hostConfig.CpuQuota - }; - if (hostConfig.CpuPeriod > 0) - spec.resource_limits.cpu.period = hostConfig.CpuPeriod; - } - } - - // Volumes and bind mounts - const namedVols = mounts.filter(m => m.Type === 'volume'); - const bindMounts = mounts.filter(m => m.Type === 'bind'); - - if (namedVols.length) { - spec.volumes = namedVols.map(m => ({ - Name: m.Name, - Dest: m.Destination, - Options: m.Options || [] - })); - } - - if (bindMounts.length) { - spec.mounts = bindMounts.map(m => { - const options = (m.Options || []).slice(); - if (!m.RW) options.push('ro'); - return { - Type: 'bind', - Source: m.Source, - Destination: m.Destination, - Options: options - }; - }); - } - - // Network - const nm = hostConfig.NetworkMode || ''; - if (nm === 'host') { - spec.netns = { - nsmode: 'host' - }; - } else if (nm === 'none') { - spec.netns = { - nsmode: 'none' - }; - } else { - const nets = networkSettings.Networks || {}; - const nonDefault = Object.keys(nets).filter(n => n !== 'bridge' && n !== 'default'); - if (nonDefault.length) { - spec.networks = {}; - for (const n of nonDefault) spec.networks[n] = {}; - } - } - - return spec; - }, - - getWorkingDir() { - return this.Config?.WorkingDir; - }, - - getHostname() { - return this.Config?.Hostname; - }, - - getUser() { - return this.Config?.User; - }, - - getInteractive() { - return this.Config?.OpenStdin; - }, - - getPrivileged() { - return this.HostConfig?.Privileged; - }, - - getNetworkMode() { - return this.HostConfig?.NetworkMode; - }, - - getNetworkSettings() { - return this.NetworkSettings || {}; - }, - - getConfig() { - return this.Config || {}; - }, - - getHostConfig() { - return this.HostConfig || {}; - }, - - getTty() { - return this.Config?.Tty; - }, - - getMounts() { - return this.Mounts || []; - }, - - getEnvironmentVars() { - return this.Config?.Env || []; - }, - - getPorts() { - const ports = []; - const networkPorts = this.getNetworkSettings().Ports || {}; - - Object.keys(networkPorts).forEach((port) => { - const [portOnly, protocol] = port.split('/'); - const portBindings = networkPorts[port] || []; - - if (portBindings.length === 0) { - ports.push({ - string: port, - port: portOnly, - protocol: protocol || '', - hostPort: null, - hostIp: null - }); - return; - } - - portBindings.forEach((portBinding) => { - const bindingString = [port]; - if (portBinding.HostIp) bindingString.push(portBinding.HostIp); - if (portBinding.HostPort) bindingString.push(portBinding.HostPort); - ports.push({ - string: bindingString.join(':'), - port: portOnly, - protocol: protocol || '', - hostIp: portBinding.HostIp, - hostPort: portBinding.HostPort, - }); - }); - }); - - return ports; - }, - - getImageName() { - return (this.ImageName || this.Image).replace(/^[^\/]+\//, '').split(':')[0]; - }, - - _parseImageRef() { - const cleanUrl = this.Image.split('@')[0]; - const lastColon = cleanUrl.lastIndexOf(':'); - const lastSlash = cleanUrl.lastIndexOf('/'); - return { - cleanUrl, - lastColon, - lastSlash - }; - }, - - getImageRepo() { - const { - cleanUrl, - lastColon, - lastSlash - } = this._parseImageRef(); - return lastColon > lastSlash ? cleanUrl.substring(0, lastColon) : ''; - }, - - getImageTag() { - const { - cleanUrl, - lastColon, - lastSlash - } = this._parseImageRef(); - return lastColon > lastSlash ? cleanUrl.substring(lastColon + 1) : 'latest'; - }, - - getCreated(dateFormat) { - return dateFormat ? podmanUtil.format.date(this.Created) : this.Created; - }, - - getStartedAt(dateFormat) { - const date = this.StartedAt || this.State?.StartedAt; - return dateFormat ? podmanUtil.format.date(date) : date; - }, - - getRestartPolicyName() { - if (this.HostConfig?.RestartPolicy?.Name) { - return this.HostConfig.RestartPolicy.Name; - } - - return 'no'; - }, - - getDetailLink(text) { - return E('a', { - class: 'text-bold', - href: this.getDetailUrl(), - 'data-container-id': this.getID() - }, text || this.getID()); - }, - - getDetailUrl() { - return L.url('admin/podman/container', this.getID()); - }, - - getAutoStartStatusIcon(status) { - let text = '-'; - - if (status === 'enabled') { - text = constants.ICON.INIT_ENABLED; - } else if (status === 'missing') { - text = constants.ICON.INIT_MISSING; - } else if (status === 'disabled') { - text = constants.ICON.INIT_DISABLED; - } - - return E('span', { - class: `autostart-status autostart-${status || ''}` - }, text); - }, - - isRunning() { - const state = this.getState(); - return this.State?.Running || - state === 'running' || - state === 'starting' || - state === 'unhealthy'; - }, - - isStopped() { - const state = this.getState(); - return state === 'exited' || state === 'created'; - }, - - isPaused() { - return !!this.State?.Paused || this.getState() === 'paused'; - }, - - async checkInitScript() { - if (!this.HostConfig) { - const inspectData = await this.inspect(); - if (!inspectData) return 'none'; - this.HostConfig = inspectData.HostConfig; - } - const hasRestartPolicy = this._hasRestartPolicy(); - - if (!hasRestartPolicy) { - return 'none'; - } - - const initStatus = await InitScript.status(this.getName()); - if (!initStatus) return 'none'; - - if (initStatus.exists && initStatus.enabled) { - return 'enabled'; - } else if (!initStatus.exists) { - return 'missing'; - } else if (initStatus.exists && !initStatus.enabled) { - return 'disabled'; - } - - return 'none'; - }, - - async generateInitScript() { - return InitScript.generate(this.getName()); - }, - - async showInitScript() { - return InitScript.show(this.getName()); - }, - - async removeInitScript() { - return InitScript.remove(this.getName()); - }, - - async enableInitScript() { - return InitScript.setEnabled(this.getName(), true); - }, - - async disableInitScript() { - return InitScript.setEnabled(this.getName(), false); - }, - - _hasRestartPolicy() { - return this.getRestartPolicyName() !== 'no'; - }, - - async inspect() { - return ContainerRPC.inspect(this.getID()); - }, - - async update(data) { - await ContainerRPC.update(this.getID(), data); - - const initScriptStatus = await this.checkInitScript(); - const policy = data.RestartPolicy; - const hasRestartPolicy = policy !== 'no'; - - if (hasRestartPolicy && (initScriptStatus === 'none' || initScriptStatus === 'missing')) { - await this.generateInitScript(); - await this.enableInitScript(); - } else if (!hasRestartPolicy && (initScriptStatus === 'enabled' || initScriptStatus === - 'disabled')) { - await this.removeInitScript(); - } - }, - - async remove(force, volumes) { - const initScriptStatus = await this.checkInitScript(); - if (initScriptStatus === 'enabled' || initScriptStatus === 'disabled') { - await this.removeInitScript(); - } - return ContainerRPC.remove(this.getID(), force ?? false, volumes ?? false); - }, - - async start() { - return ContainerRPC.start(this.getID()); - }, - - async stop() { - return ContainerRPC.stop(this.getID()); - }, - - async restart() { - return ContainerRPC.restart(this.getID()); - }, - - async pause() { - return ContainerRPC.pause(this.getID()); - }, - - async unpause() { - return ContainerRPC.unpause(this.getID()); - }, - - async connect(networkName, payload) { - return Network.getSingleton({ - name: networkName - }).connect(Object.assign({ - container: this.getID() - }, payload)); - }, - - async disconnect(networkName) { - return Network.getSingleton({ - name: networkName - }).disconnect({ - Container: this.getID() - }); - }, - - streamTop(onChunk, delay, psargs) { - const params = new URLSearchParams({ - delay: String(delay || 2) - }); - if (psargs) params.set('ps_args', psargs); - const url = L.url('admin/podman/stream/top', this.getID()) + '?' + params; - return this._stream( - () => url, - (data) => { - if (!data.raw && !data.Error) onChunk(data); - } - ); - }, - - streamStats(onChunk, interval) { - const params = new URLSearchParams({ - interval: String(interval || 2) - }); - const url = L.url('admin/podman/stream/stats', this.getID()) + '?' + params; - return this._stream( - () => url, - (data) => { - if (data.raw || data.Error || !data.Stats || data.Stats.length === 0) { - return; - } - onChunk(data.Stats[0]); - } - ); - }, - - streamLogs(onChunk, { - tail = 100, - since = null, - until = null, - follow = true - } = {}) { - if (!follow) { - // Historical fetch: single request, stop after completion (no reconnect) - let handle; - handle = this._stream( - () => { - const params = new URLSearchParams(); - params.set('tail', String(tail)); - params.set('follow', 'false'); - if (since !== null) params.set('since', String(since)); - if (until !== null) params.set('until', String(until)); - return L.url('admin/podman/stream/logs', this.getID()) + '?' + params; - }, - onChunk, - () => handle?.stop() - ); - return handle; - } - - // Live stream: reconnect with since= after each disconnect - let reconnectSince = null; - return this._stream( - () => { - const params = new URLSearchParams(); - if (reconnectSince !== null) { - // Reconnect: continue from last close, no tail (would cap new lines) - params.set('since', String(reconnectSince)); - } else { - // First connect: apply user params - params.set('tail', String(tail)); - if (since !== null) params.set('since', String(since)); - } - params.set('follow', 'true'); - if (until !== null) params.set('until', String(until)); - return L.url('admin/podman/stream/logs', this.getID()) + '?' + params; - }, - onChunk, - () => { - reconnectSince = Date.now() / 1000; - } - ); - }, - - async checkImageUpdate() { - const findArchDigest = (manifest, arch, os) => { - if (!manifest || !manifest.manifests) { - return manifest.digest || null; - } - - const entry = manifest.manifests.find((m) => - m.platform && - m.platform.architecture === arch && - m.platform.os === os - ); - - return entry ? entry.digest : null; - }; - - try { - const image = await this.getImage(); - - const imageRef = image.getDisplayTag() || this.Image; - if (!imageRef || imageRef.startsWith('')) - return { - hasUpdate: false - }; - - const localArch = image.Architecture || 'amd64'; - const localOs = image.Os || 'linux'; - - const manifest = await image.inspectManifest(imageRef); - - const remoteDigest = findArchDigest(manifest, localArch, localOs); - - const repoDigests = image.RepoDigests || []; - const hasUpdate = !!(remoteDigest && !repoDigests.some(rd => rd.includes( - remoteDigest))); - - return { - hasUpdate, - remoteDigest, - }; - } catch (err) { - return { - hasUpdate: false, - error: err.message || String(err) - }; - } - }, - - async _reinstateInitScript(status) { - if (status !== 'enabled' && status !== 'disabled') return; - await this.generateInitScript(); - if (status === 'enabled') await this.enableInitScript(); - }, - - getUpdateSkipReason() { - if (this.Pod) - return _('Part of a pod ("%s")').format(this.Pod); - const hostConfig = this.getHostConfig(); - if (hostConfig.AutoRemove) - return _('Ephemeral (--rm flag)'); - if (hostConfig.NetworkMode?.startsWith('container:')) - return _('Shares network with another container'); - return null; - }, - - async updateImage(onProgress) { - const skipReason = this.getUpdateSkipReason(); - if (skipReason) throw new Error(skipReason); - - const [image, initStatus] = await Promise.all([this.getImage(), this.checkInitScript()]); - - if (!image.RepoTags?.length || image.RepoTags[0] === ':') { - const ref = this.ImageName || this.Config?.Image; - if (ref) image.RepoTags = [ref]; - } - - const imageRef = image.getDisplayTag(); - if (!imageRef || imageRef === ':') - throw new Error(_('Container image has no tag - cannot update')); - - onProgress?.(_('Pulling %s').format(imageRef) + '\n'); - const oldImageId = image.getID(); - const newImageId = await image.update(onProgress); - - if (!newImageId) - throw new Error(_('Pull did not return an image ID - pull may have failed')); - - if (newImageId === oldImageId) - throw new Error(_('Image is already up-to-date')); - - const wasRunning = this.isRunning(); - const spec = this.inspectToSpec(newImageId); - - if (wasRunning) { - onProgress?.('→ ' + _('Stopping container') + '\n'); - try { - await this.stop(); - } catch (e) { - throw new Error(_('Stop failed: %s').format(e.message || e)); - } - } - - onProgress?.('→ ' + _('Removing container') + '\n'); - try { - await this.remove(); - } catch (e) { - throw new Error(_('Remove failed: %s').format(e.message || e)); - } - - onProgress?.('→ ' + _('Creating container') + '\n'); - let created; - try { - created = await ContainerRPC.create(spec); - } catch (e) { - throw new Error(_('Create failed: %s').format(e.message || e)); - } - if (!created || created.error) - throw new Error(_('Create failed: %s').format(created?.error || _( - 'Failed to create container'))); - - if (wasRunning) { - onProgress?.('→ ' + _('Starting container') + '\n'); - try { - await ContainerRPC.start(created.Id); - } catch (e) { - throw new Error(_('Start failed: %s').format(e.message || e)); - } - } - - onProgress?.('→ ' + _('Reinstating init script') + '\n'); - try { - await this._reinstateInitScript(initStatus); - } catch (e) { - throw new Error(_('Init script reinstate failed: %s').format(e.message || e)); - } - - onProgress?.('✓ ' + _('Updated to %s').format((newImageId || '').substring(0, 12)) + - '\n'); - return { - oldImage: image - }; - }, - - async getImage() { - const image = Image.getSingleton({ - Id: this.ImageID || this.Image - }); - return Image.getSingleton(await image.inspect()); - }, - - async updateName(name) { - if (!name || name === this.getName()) return; - - await ContainerRPC.rename(this.getID(), name); - - const initScriptStatus = await this.checkInitScript(); - if (initScriptStatus === 'enabled' || initScriptStatus === 'disabled') { - await this.removeInitScript(); - } - - if (this.Names && this.Names.length > 0) this.Names[0] = name; - if (this.Name) this.Name = name; - - await this._reinstateInitScript(initScriptStatus); - }, -}); - -return baseclass.extend({ - getSingleton(container) { - return Container.extend(container).instantiate([]); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/model/Image.js b/luci-app-podman/htdocs/luci-static/resources/podman/model/Image.js deleted file mode 100644 index 53330dcb3..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/model/Image.js +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; - -'require baseclass'; - -'require podman.model.Model as Model'; - -const ImageRPC = { - inspect: Model.declareRPC({ - object: 'podman', - method: 'image_inspect', - params: ['id'], - }), - - inspectManifest: Model.declareRPCSilent({ - object: 'podman', - method: 'image_manifest_inspect', - params: ['image'] - }), - - remove: Model.declareRPC({ - object: 'podman', - method: 'image_remove', - params: ['id', 'force'], - }), -}; - -const Image = Model.base.extend({ - __name__: 'Podman.Model.Image', - - getID() { - return this.Id; - }, - - getDisplayTag() { - return this.getRepoTags()[0]; - }, - - getRepoTags() { - return this.RepoTags || [':']; - }, - - getRepository() { - const tag = this.getDisplayTag() || ':'; - return tag.split(':')[0] || ''; - }, - - getTag() { - const tag = this.getDisplayTag() || ':'; - return tag.split(':')[1] || ''; - }, - - getDigest() { - if (this.Digest) { - return this.Digest; - } - - if (this.RepoDigests && this.RepoDigests.length > 0) { - for (const rd of this.RepoDigests) { - if (rd.includes('@sha256:')) { - return rd.split('@')[1]; - } - } - } - return null; - }, - - inspect() { - return ImageRPC.inspect(this.getID()); - }, - - inspectManifest(ref) { - return ImageRPC.inspectManifest(ref || this.getDisplayTag()); - }, - - remove() { - return ImageRPC.remove(this.getID()); - }, - - update(onProgress) { - return this.streamPull(onProgress); - }, - - streamPull(onProgress) { - return new Promise((resolve, reject) => { - let handle; - handle = this._stream( - () => L.url('admin/podman/stream/pull') + '?reference=' + encodeURIComponent(this.getDisplayTag()), - (chunk) => { - if (chunk.images && chunk.images.length > 0) { resolve(chunk.images[0]); handle.stop(); return; } - if (chunk.error) { reject(new Error(chunk.error)); handle.stop(); return; } - if (chunk.stream) onProgress?.(chunk.stream); - if (chunk.raw) onProgress?.(chunk.raw + '\n'); - } - ); - }); - }, -}); - -return baseclass.extend({ - getSingleton(image) { - return Image.extend(image).instantiate([]); - } -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/model/Model.js b/luci-app-podman/htdocs/luci-static/resources/podman/model/Model.js deleted file mode 100644 index fdb125877..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/model/Model.js +++ /dev/null @@ -1,112 +0,0 @@ -'use strict'; - -'require baseclass'; -'require rpc'; -'require ui'; - -'require podman.ui as podmanUI'; - -function checkResponse(response) { - if (response?.response >= 400) { - throw new Error(response.message); - } - return response; -} - -function catchError(err) { - const msg = err?.message || String(err); - if (msg.includes('Access denied') || msg.includes('session is expired')) { - window.location.href = L.url('admin'); - return; - } - ui.hideModal(); - document.body.scrollTop = 0; - document.documentElement.scrollTop = 0; - podmanUI.alert(msg, 'error'); - throw err; -} - -function processLines(buffer, onChunk) { - const lines = buffer.split('\n'); - buffer = lines.pop() || ''; - for (const line of lines) { - if (line.trim()) { - try { - onChunk(JSON.parse(line)); - } catch (e) { - onChunk({ raw: line.trimEnd() }); - } - } - } - return buffer; -} - -const Model = baseclass.extend({ - __name: 'Podman.Model', - - _stream(getUrl, onData, onDone) { - let stopped = false; - let currentController = null; - - const doStream = async () => { - const decoder = new TextDecoder(); - let backoff = 1000; - - while (!stopped) { - currentController = new AbortController(); - try { - const response = await fetch(getUrl(), { signal: currentController.signal }); - if (response.status === 403) { - window.location.reload(); - return; - } - const reader = response.body?.getReader(); - let buffer = ''; - - while (!stopped) { - const { done, value } = await reader.read(); - if (done) { - // Flush any trailing line the server sent without a final '\n' - if (buffer.trim() && !stopped) - processLines(buffer + '\n', onData); - break; - } - buffer += decoder.decode(value, { stream: true }); - buffer = processLines(buffer, onData); - } - - backoff = 1000; - if (!stopped) onDone?.(); - } catch (err) { - if (stopped) break; // AbortController fired from stop() - // network error - reconnect with backoff - await new Promise(r => setTimeout(r, backoff)); - backoff = Math.min(backoff * 2, 30000); - } - } - }; - - doStream(); - - return { - stop: () => { - stopped = true; - if (currentController) currentController.abort(); - } - }; - }, -}); - -return baseclass.extend({ - base: Model, - declareRPC(options) { - const fn = rpc.declare(options); - return (...args) => fn(...args).then(checkResponse).catch(catchError); - }, - // Like declareRPC but does not show the global error dialog on failure. - // Use for background checks where the caller handles the error itself. - declareRPCSilent(options) { - const fn = rpc.declare(options); - return (...args) => fn(...args).then(checkResponse); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/model/Network.js b/luci-app-podman/htdocs/luci-static/resources/podman/model/Network.js deleted file mode 100644 index 787262c7f..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/model/Network.js +++ /dev/null @@ -1,316 +0,0 @@ -'use strict'; - -'require baseclass'; -'require network'; -'require firewall'; -'require uci'; -'require ui'; - -'require podman.model.Model as Model'; - -const NetworkRPC = { - inspect: Model.declareRPC({ - object: 'podman', - method: 'network_inspect', - params: ['name'] - }), - - remove: Model.declareRPC({ - object: 'podman', - method: 'network_remove', - params: ['name', 'force'] - }), - - connect: Model.declareRPC({ - object: 'podman', - method: 'network_connect', - params: ['name', 'data'] - }), - - disconnect: Model.declareRPC({ - object: 'podman', - method: 'network_disconnect', - params: ['name', 'data'] - }), -}; - -const Network = Model.base.extend({ - __name__: 'Podman.Model.Network', - - getID() { - return this.ID; - }, - - getName() { - return this.name || _('Unknown'); - }, - - getDriver() { - return this.driver; - }, - - getSubnetIP4() { - if (this.subnets?.length > 0) { - return this.subnets[0].subnet || ''; - } - if (this.IPAM?.Config?.length > 0) { - return this.IPAM.Config[0].Subnet || ''; - } - return ''; - }, - - getSubnetIP6() { - if (this.ipv6_enabled && this.subnets?.length > 1) { - return this.subnets[1].subnet || ''; - } - return ''; - }, - - getGatewayIP4() { - if (this.subnets?.length > 0) { - return this.subnets[0].gateway || ''; - } - if (this.IPAM?.Config?.length > 0) { - return this.IPAM.Config[0].Gateway || ''; - } - return ''; - }, - - getGatewayIP6() { - if (this.ipv6_enabled && this.subnets?.length > 1) { - return this.subnets[1].gateway || ''; - } - return ''; - }, - - isBridge() { - return this.getDriver() === 'bridge'; - }, - - async inspect() { - return NetworkRPC.inspect(this.getName()); - }, - - async remove(force) { - return NetworkRPC.remove(this.getName(), force ?? false); - }, - - async connect(data) { - return NetworkRPC.connect(this.getName(), data || {}); - }, - - async disconnect(data) { - return NetworkRPC.disconnect(this.getName(), data || {}); - }, - - async integrationCheck() { - const check = { - hasInterface: false, - hasDevice: false, - hasDnsmasqExclusion: false, - }; - - const networkObj = await network.getNetwork(this.getName()); - let deviceObj; - - if (networkObj) { - check.hasInterface = true; - deviceObj = networkObj.getDevice(); - - if (deviceObj) { - check.hasDevice = true; - } - } - - if (!deviceObj) { - const devices = (await network.getDevices()).map((device) => device.device); - - if (devices.includes(this.network_interface)) { - check.hasDevice = true; - } - } - - await uci.load('dhcp'); - const mainSection = await this.hasDnsmasq() ? this._getDnsmasqSection() : null; - if (mainSection) { - const notInterfaces = uci.get('dhcp', mainSection, 'notinterface'); - - if ([].concat(notInterfaces ?? []).includes(this.getName())) { - check.hasDnsmasqExclusion = true; - } - } else { - check.hasDnsmasqExclusion = true; - } - - return check; - }, - - async integrationRepair() { - await uci.load('dhcp'); - const status = await this.integrationCheck(); - if (status.hasInterface && status.hasDevice && status.hasDnsmasqExclusion) { - return; - } - - let deviceName; - let changes = false; - - if (status.hasDevice === false && this.isBridge()) { - deviceName = await this.integrationCreateDevice(); - changes = true; - - if (status.hasInterface === true) { - const net = await network.getNetwork(this.getName()); - net.addDevice(deviceName); - } - } - - if (status.hasInterface === false) { - if (status.hasDevice === true) { - deviceName = this.network_interface; - } - - await this.integrationCreateNetwork(deviceName); - changes = true; - } - - if (await this.hasDnsmasq() && status.hasDnsmasqExclusion === false) { - await this.integrationAddDnsmasqExclusion(); - changes = true; - } - - if (changes === false) { - return; - } - - await uci.save(); - ui.changes.apply(); - await network.flushCache(); - }, - - async integrationRemove() { - await uci.load('dhcp'); - const status = await this.integrationCheck(); - let changes = false; - - // Check device shared status BEFORE deleting the interface to avoid stale network cache - let removeDevice = false; - if (status.hasDevice === true && this.isBridge()) { - const device = await network.getDevice(this.network_interface); - removeDevice = device?.getNetworks().length === 1; - } - - if (status.hasInterface === true) { - const zone = await firewall.getZoneByNetwork(this.getName()); - if (zone) await zone.deleteNetwork(this.getName()); - await network.deleteNetwork(this.getName()); - changes = true; - } - - if (removeDevice) { - uci.remove('network', this.network_interface + '_device'); - changes = true; - } - - if (await this.hasDnsmasq() && status.hasDnsmasqExclusion === true) { - const mainSection = this._getDnsmasqSection(); - if (mainSection) { - const notInterfaces = [].concat(uci.get('dhcp', mainSection, 'notinterface') || []) - .filter(iface => iface !== this.getName()); - if (notInterfaces.length > 0) - uci.set('dhcp', mainSection, 'notinterface', notInterfaces); - else - uci.unset('dhcp', mainSection, 'notinterface'); - changes = true; - } - } - - if (changes === false) { - return; - } - - await uci.save(); - ui.changes.apply(); - await network.flushCache(); - }, - - async integrationCreateNetwork(deviceName) { - const networkName = this.getName(); - - if (this.subnets?.length === 0 && this.ipam_options?.driver === 'dhcp') { - uci.add('network', 'interface', networkName); - uci.set('network', networkName, 'proto', 'dhcp'); - return; - } - - const subnet = this.getSubnetIP4(); - if (!subnet) return; - - const prefix = parseInt(subnet.split('/')[1], 10); - const netmask = network.prefixToMask(prefix); - - const sid = `${networkName}`; - uci.add('network', 'interface', sid); - uci.set('network', sid, 'proto', 'static'); - if (deviceName) uci.set('network', sid, 'device', deviceName); - uci.set('network', sid, 'ipaddr', this.getGatewayIP4()); - uci.set('network', sid, 'netmask', netmask); - - if (this.ipv6_enabled) { - uci.set('network', sid, 'ip6addr', this.getGatewayIP6() + '/64'); - } - }, - - async integrationCreateDevice() { - const devices = (await network.getDevices()).map((device) => device.device); - - const baseName = this.network_interface || this.getName(); - let i = 0; - let deviceName = baseName; - - while (devices.includes(deviceName)) { - i++; - deviceName = `${baseName}${i}`; - } - - const sid = `${deviceName}_device`; - uci.add('network', 'device', sid); - uci.set('network', sid, 'type', 'bridge'); - uci.set('network', sid, 'name', deviceName); - uci.set('network', sid, 'bridge_empty', '1'); - uci.set('network', sid, 'ipv6', this.ipv6_enabled ? '1' : '0'); - - if (this.ipv6_enabled) { - uci.set('network', sid, 'ip6assign', '64'); - } - - return deviceName; - }, - - _getDnsmasqSection() { - const sections = uci.sections('dhcp', 'dnsmasq'); - return sections.length > 0 ? sections[0]['.name'] : null; - }, - - async hasDnsmasq() { - return L.hasSystemFeature('dnsmasq'); - }, - - async integrationAddDnsmasqExclusion() { - const mainSection = this._getDnsmasqSection(); - if (mainSection) { - const notInterfaces = [].concat(uci.get('dhcp', mainSection, 'notinterface') || []); - if (!notInterfaces.includes(this.getName())) { - notInterfaces.push(this.getName()); - uci.set('dhcp', mainSection, 'notinterface', notInterfaces); - } - } - }, -}); - -return baseclass.extend({ - __name__: 'Podman.Model.Network', - getSingleton(data) { - return Network.extend(data).instantiate([]); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/model/Pod.js b/luci-app-podman/htdocs/luci-static/resources/podman/model/Pod.js deleted file mode 100644 index a359db95c..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/model/Pod.js +++ /dev/null @@ -1,182 +0,0 @@ -'use strict'; - -'require baseclass'; -'require ui'; - -'require podman.model.Model as Model'; -'require podman.ui as podmanUI'; - -const PodRPC = { - inspect: Model.declareRPC({ - object: 'podman', - method: 'pod_inspect', - params: ['name'] - }), - - start: Model.declareRPC({ - object: 'podman', - method: 'pod_start', - params: ['name'] - }), - - stop: Model.declareRPC({ - object: 'podman', - method: 'pod_stop', - params: ['name'] - }), - - kill: Model.declareRPCSilent({ - object: 'podman', - method: 'pod_kill', - params: ['name', 'signal'] - }), - - restart: Model.declareRPC({ - object: 'podman', - method: 'pod_restart', - params: ['name'] - }), - - pause: Model.declareRPC({ - object: 'podman', - method: 'pod_pause', - params: ['name'] - }), - - unpause: Model.declareRPC({ - object: 'podman', - method: 'pod_unpause', - params: ['name'] - }), - - remove: Model.declareRPC({ - object: 'podman', - method: 'pod_remove', - params: ['name', 'force'] - }), -}; - -const Pod = Model.base.extend({ - __name__: 'Podman.Model.Pod', - - getID() { - return this.Id; - }, - - getName() { - return this.Name || this.Id || _('Unknown'); - }, - - getStatus() { - return this.Status || this.State || ''; - }, - - getStatusBadge() { - const status = this.getStatus(); - const cssClass = status.toLowerCase(); - return E('div', { class: `badge ${cssClass}` }, [ status ]); - }, - - getCreatedAt() { - return this.Created; - }, - - getInfraId() { - return this.InfraId || this.InfraContainerID; - }, - - getNetworks() { - return this.Networks || []; - }, - - getLabels() { - return this.Labels || {}; - }, - - getContainers() { - return this.Containers || []; - }, - - isRunning() { - return this.getStatus() === 'Running'; - }, - - isPaused() { - return this.getStatus() === 'Paused'; - }, - - isStopped() { - const state = this.getStatus(); - return state === 'Stopped' || state === 'Exited' || state === 'Created' || state === 'Dead'; - }, - - async inspect() { - return PodRPC.inspect(this.getName()); - }, - - async start() { - return PodRPC.start(this.getName()); - }, - - async stop() { - const result = await PodRPC.stop(this.getName()); - if (result?.Id) return result; - - try { - return await PodRPC.kill(this.getName(), 'SIGKILL'); - } catch (err) { - const msg = String(err?.message || err); - if (msg.includes('no running containers')) return result; - ui.hideModal(); - podmanUI.alert(msg, 'error'); - throw err; - } - }, - - async restart() { - return PodRPC.restart(this.getName()); - }, - - async pause() { - return PodRPC.pause(this.getName()); - }, - - async unpause() { - return PodRPC.unpause(this.getName()); - }, - - async remove(force) { - return PodRPC.remove(this.getName(), force ?? true); - }, - - streamTop(onChunk, delay) { - const params = new URLSearchParams({ delay: String(delay || 2) }); - const url = L.url('admin/podman/stream/pod_top', this.getName()) + '?' + params; - return this._stream( - () => url, - (data) => { if (!data.raw && !data.Error) onChunk(data); } - ); - }, - - streamStats(onChunk) { - const url = L.url('admin/podman/stream/pod_stats', this.getName()); - return this._stream( - () => url, - (data) => { - if (!Array.isArray(data)) return; - onChunk(data); - } - ); - }, - - getDetailLink(label) { - return E('a', { href: L.url('admin/podman/pod', this.getID()) }, label || this.getName()); - }, -}); - -return baseclass.extend({ - __name__: 'Podman.Model.Pod', - getSingleton(data) { - return Pod.extend(data).instantiate([]); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/model/Secret.js b/luci-app-podman/htdocs/luci-static/resources/podman/model/Secret.js deleted file mode 100644 index 55b8669a0..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/model/Secret.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -'require baseclass'; - -'require podman.model.Model as Model'; - -const SecretRPC = { - inspect: Model.declareRPC({ - object: 'podman', - method: 'secret_inspect', - params: ['name'] - }), - - remove: Model.declareRPC({ - object: 'podman', - method: 'secret_remove', - params: ['name'] - }), -}; - -const Secret = Model.base.extend({ - __name__: 'Podman.Model.Secret', - - getID() { - return this.ID; - }, - - getName() { - return this.Spec?.Name; - }, - - getDriver() { - return this.Spec?.Driver?.Name; - }, - - getLabels() { - return this.Spec?.Labels ?? {}; - }, - - async inspect() { - return SecretRPC.inspect(this.getName()); - }, - - async remove() { - return SecretRPC.remove(this.getName()); - }, -}); - -return baseclass.extend({ - getSingleton(secret) { - return Secret.extend(secret).instantiate([]); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/model/Volume.js b/luci-app-podman/htdocs/luci-static/resources/podman/model/Volume.js deleted file mode 100644 index 853e2294e..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/model/Volume.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -'require baseclass'; - -'require podman.model.Model as Model'; - -const VolumeRPC = { - inspect: Model.declareRPC({ - object: 'podman', - method: 'volume_inspect', - params: ['name'] - }), - - remove: Model.declareRPC({ - object: 'podman', - method: 'volume_remove', - params: ['name', 'force'] - }), -}; - -const Volume = Model.base.extend({ - __name__: 'Podman.Model.Volume', - - getName() { - return this.Name || _('Unknown'); - }, - - async inspect() { - return VolumeRPC.inspect(this.getName()); - }, - - async remove(force) { - return VolumeRPC.remove(this.getName(), force || false); - }, -}); - -return baseclass.extend({ - getSingleton(volume) { - return Volume.extend(volume).instantiate([]); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/rpc.js b/luci-app-podman/htdocs/luci-static/resources/podman/rpc.js deleted file mode 100644 index 9c9e873d3..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/rpc.js +++ /dev/null @@ -1,187 +0,0 @@ -'use strict'; - -'require baseclass'; -'require podman.model.Model as Model'; -'require podman.model.Container as Container'; -'require podman.model.Image as Image'; -'require podman.model.Network as Network'; -'require podman.model.Volume as Volume'; -'require podman.model.Secret as Secret'; -'require podman.model.Pod as Pod'; - -return baseclass.extend({ - /** - * Container methods. - */ - containers: { - list: Model.declareRPC({ - object: 'podman', - method: 'containers_list', - params: ['query'], - expect: { - data: [] - }, - filter: (containers) => containers - .map((container) => Container.getSingleton(container)) - .sort((containerA, containerB) => containerA - .getName() - .localeCompare(containerB.getName())) - }), - - create: Model.declareRPC({ - object: 'podman', - method: 'container_create', - params: ['data'] - }), - }, - - /** - * Image methods. - */ - images: { - list: Model.declareRPC({ - object: 'podman', - method: 'images_list', - params: [], - expect: { - data: [] - }, - filter: (images) => images - .map((image) => Image.getSingleton(image)) - .sort((imageA, imageB) => imageA.getDisplayTag().localeCompare(imageB.getDisplayTag())), - }), - }, - - /** - * Pod methods. - */ - pods: { - list: Model.declareRPC({ - object: 'podman', - method: 'pods_list', - params: [], - expect: { - data: [] - }, - filter: (pods) => pods - .map((pod) => Pod.getSingleton(pod)) - .sort((a, b) => a.getName().localeCompare(b.getName())) - }), - - create: Model.declareRPC({ - object: 'podman', - method: 'pod_create', - params: ['data'] - }), - }, - - /** - * Network management methods. - */ - networks: { - list: Model.declareRPC({ - object: 'podman', - method: 'networks_list', - params: [], - expect: { - data: [] - }, - filter: (networks) => networks - .map((network) => Network.getSingleton(network)) - .sort((networkA, networkB) => networkA.getName().localeCompare(networkB.getName())), - }), - - create: Model.declareRPC({ - object: 'podman', - method: 'network_create', - params: ['data'] - }), - }, - - /** - * Volume management methods. - */ - volumes: { - list: Model.declareRPC({ - object: 'podman', - method: 'volumes_list', - params: [], - expect: { - data: [] - }, - filter: (volumes) => volumes - .map((volume) => Volume.getSingleton(volume)) - .sort((volumeA, volumeB) => volumeA.getName().localeCompare(volumeB.getName())) - }), - - create: Model.declareRPC({ - object: 'podman', - method: 'volume_create', - params: ['data'] - }), - - import: Model.declareRPC({ - object: 'podman', - method: 'volume_import', - params: ['name', 'compressed'] - }), - }, - - /** - * Secret management methods. - */ - secrets: { - list: Model.declareRPC({ - object: 'podman', - method: 'secrets_list', - params: [], - expect: { - data: [] - }, - filter: (secrets) => secrets - .map((secret) => Secret.getSingleton(secret)) - .sort((secretA, secretB) => secretA.getName().localeCompare(secretB.getName())) - }), - - create: Model.declareRPC({ - object: 'podman', - method: 'secret_create', - params: ['name', 'data', 'labels'] - }), - }, - - /** - * System information methods. - */ - system: { - version: Model.declareRPC({ - object: 'podman', - method: 'version', - params: [] - }), - - info: Model.declareRPC({ - object: 'podman', - method: 'info', - params: [] - }), - - df: Model.declareRPC({ - object: 'podman', - method: 'system_df', - params: [] - }), - - prune: Model.declareRPC({ - object: 'podman', - method: 'system_prune', - params: ['all', 'volumes'] - }), - - debug: Model.declareRPC({ - object: 'podman', - method: 'system_debug', - params: [] - }) - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/ui.js b/luci-app-podman/htdocs/luci-static/resources/podman/ui.js deleted file mode 100644 index 3feff5391..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/ui.js +++ /dev/null @@ -1,559 +0,0 @@ -'use strict'; - -'require baseclass'; -'require ui'; -'require podman.constants as c'; - -const AbstractInputField = ui.Textfield.extend({ - __name__: 'Podman.UI.AbstractInputField', - - inputType: 'text', - - __init__(value, options) { - this.value = value; - this.options = Object.assign({ min: '', max: '' }, options); - }, - - render() { - const frameEl = E('div', { id: this.options.id }); - const inputEl = E('input', { - id: this.options.id ? `widget.${this.options.id}` : null, - name: this.options.name, - type: this.inputType, - class: 'cbi-input-text', - readonly: this.options.readonly ? '' : null, - disabled: this.options.disabled ? '' : null, - min: this.options.min, - max: this.options.max, - placeholder: this.options.placeholder, - value: this.value, - }); - - frameEl.appendChild(inputEl); - - return this.bind(frameEl); - }, -}); - -const UINumberfield = AbstractInputField.extend({ - __name__: 'Podman.UI.Numberfield', - inputType: 'number', -}); - -const UIDatefield = AbstractInputField.extend({ - __name__: 'Podman.UI.Datefield', - inputType: 'date', -}); - -const UIBase = baseclass.extend({ - __name__: 'Podman.UI', - - alert(text, type, timeLimited) { - timeLimited = timeLimited === true ? c.NOTIFICATION_TIMEOUT : timeLimited; - type = type || 'info'; - - if (Array.isArray(text) !== true) { - text = E('p', {}, text); - } - - if (parseInt(timeLimited) > 0) { - ui.addTimeLimitedNotification(type.toUpperCase(), text, timeLimited, type); - return; - } - - ui.addNotification(type.toUpperCase(), text, type); - }, - - showSpinningModal(title, text) { - ui.showModal(title, [E('div', { class: 'spinning' }, text)], 'loading-modal'); - }, -}); - -const UITooltip = baseclass.extend({ - __name__: 'Podman.UI.Tooltip', - - node: '', - tooltip: '', - options: {}, - - __init__(node, tooltip, options) { - this.node = node || ''; - this.tooltip = tooltip || ''; - this.options = options || {}; - }, - - render() { - const cssClass = 'cbi-tooltip-container'; - const cls = this.options.class ? `${this.options.class} ${cssClass}` : cssClass; - const options = Object.assign({}, this.options, { class: cls }); - - return E('div', options, [ - this.node, - E('div', { class: 'cbi-tooltip' }, this.tooltip), - ]); - } -}); - -const UISecretText = baseclass.extend({ - __name__: 'Podman.UI.SecretText', - - value: '', - censoredValue: '', - show: false, - - __init__(value, censoredValue) { - this.value = value; - this.censoredValue = censoredValue; - }, - - render() { - const me = this; - - return new UITooltip( - me.censoredValue, - _('Click to reveal/hide value'), - { - class: 'tooltip', - click() { - if (me.show) { - me.show = false; - this.childNodes[0].nodeValue = me.censoredValue; - - return; - } - - me.show = true; - this.childNodes[0].nodeValue = me.value; - }, - } - ).render(); - } -}); - -const UIButton = baseclass.extend({ - __name__: 'Podman.UI.Button', - - __init__(text, href, cssClass, tooltip) { - this.text = text; - this.href = href; - this.cssClass = cssClass; - this.tooltip = tooltip; - }, - - render() { - const attrs = { - class: this.cssClass ? 'cbi-button cbi-button-' + this.cssClass : 'cbi-button', - click: typeof this.href === 'function' ? this.href : (ev) => { - ev.preventDefault(); - window.location.href = this.href; - } - }; - - if (this.tooltip) { - attrs.title = this.tooltip; - } - - return E('button', attrs, this.text || ''); - } -}); - -const UIButtonNew = baseclass.extend({ - __name__: 'Podman.UI.ButtonNew', - - __init__(text, options) { - this.options = Object.assign({ - text: text || '', - // class: '' - type: '', - href: '', - click: () => { }, - tooltip: '', - }, options); - }, - - render() { - const click = this.options.href - ? ui.createHandlerFn(this, (event) => { - event.preventDefault(); - window.location.href = this.options.href; - }) - : this.options.click; - - const button = E('button', { - class: `cbi-button cbi-button-${this.options.type}`, - click, - }, this.options.text); - - if (this.options.tooltip) { - return new UITooltip(button, this.options.tooltip).render(); - } - - return button; - } -}); - -const UIJsonArea = baseclass.extend({ - __name__: 'Podman.UI.JsonArea', - - __init__(data) { - this.data = data || this.data; - }, - - render() { - const el = E('pre', { class: 'json-area' }); - const json = JSON.stringify(this.data, null, 2); - const nodes = []; - let last = 0; - json.replace( - /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, - (match, _p1, _p2, _p3, _p4, offset) => { - if (offset > last) - nodes.push(document.createTextNode(json.slice(last, offset))); - let cls = 'number'; - if (/^"/.test(match)) cls = /:$/.test(match) ? 'key' : 'string'; - else if (/true|false/.test(match)) cls = 'boolean'; - else if (/null/.test(match)) cls = 'null'; - nodes.push(E('span', { 'class': cls }, match)); - last = offset + match.length; - } - ); - if (last < json.length) - nodes.push(document.createTextNode(json.slice(last))); - for (const node of nodes) el.appendChild(node); - return el; - }, -}); - -const UIBashCodeArea = baseclass.extend({ - __name__: 'Podman.UI.BashCodeArea', - - code: '', - - __init__(code) { - this.code = code || this.code; - }, - - render() { - const el = E('pre', { class: 'code-area bash' }); - const code = this.code || ''; - const nodes = []; - let last = 0; - const bashRegex = /(#[^\n]*)|("(?:\\.|[^\\"])*"|'(?:\\.|[^\\'])*')|(\$\w+|\$\{[^}]+\})|\b(if|then|else|elif|fi|case|esac|for|while|do|done|in|break|continue|exit|return|stop_service|start_service)\b|(\b\d+\b)/g; - code.replace(bashRegex, (match, comment, string, variable, keyword, number, offset) => { - if (offset > last) - nodes.push(document.createTextNode(code.slice(last, offset))); - let cls = null; - if (comment) cls = 'comment'; - else if (string) cls = 'string'; - else if (variable) cls = 'variable'; - else if (keyword) cls = 'keyword'; - else if (number) cls = 'number'; - nodes.push(cls ? E('span', { 'class': cls }, match) : document.createTextNode(match)); - last = offset + match.length; - }); - if (last < code.length) - nodes.push(document.createTextNode(code.slice(last))); - for (const node of nodes) el.appendChild(node); - return el; - }, -}); - -/** - * Scrolling text log for streaming output. Each append() is one logical - * update: lines containing CR overwrite the last line (Podman pull progress - * uses CR to refresh "Copying blob X 50%"); plain lines append. Sticky - * auto-scroll: jumps to bottom on append unless the user scrolled up. - */ -const UIStreamLog = baseclass.extend({ - __name__: 'Podman.UI.StreamLog', - - maxLines: 2000, - autoScroll: true, - - __init__(opts) { - opts = opts || {}; - if (typeof opts.maxLines === 'number') this.maxLines = opts.maxLines; - if (typeof opts.autoScroll === 'boolean') this.autoScroll = opts.autoScroll; - this._container = E('div', { class: 'podman-stream-log' }); - this._lastLineNode = null; - this._lineCount = 0; - }, - - append(text) { - if (text == null) return this; - const stripped = String(text).replace(/\n+$/, ''); - if (!stripped) return this; - - const stick = this.autoScroll && this._isAtBottom(); - const cr = stripped.lastIndexOf('\r'); - const isProgress = cr >= 0; - const display = isProgress ? stripped.slice(cr + 1) : stripped; - - if (isProgress && this._lastLineNode) { - this._lastLineNode.textContent = display; - } else { - this._appendLine(display); - } - - if (stick) this._container.scrollTop = this._container.scrollHeight; - return this; - }, - - appendBlock(lines) { - if (Array.isArray(lines)) for (const l of lines) this.append(l); - return this; - }, - - clear() { - while (this._container.firstChild) this._container.removeChild(this._container.firstChild); - this._lastLineNode = null; - this._lineCount = 0; - return this; - }, - - render() { - return this._container; - }, - - _appendLine(text) { - const node = E('div', { class: 'log-line' }, [text || ' ']); - this._container.appendChild(node); - this._lastLineNode = node; - this._lineCount++; - while (this._lineCount > this.maxLines && this._container.firstChild) { - const removed = this._container.firstChild; - this._container.removeChild(removed); - this._lineCount--; - if (this._lastLineNode === removed) this._lastLineNode = this._container.lastChild; - } - }, - - _isAtBottom() { - const el = this._container; - return (el.scrollHeight - el.scrollTop - el.clientHeight) < 5; - } -}); - -/** - * Table builder with header and row chaining. - */ -const UITable = baseclass.extend({ - __name__: 'Podman.UI.Table', - - options: { class: 'table' }, - - headers: [], - rows: [], - - __init__(options) { - this.headers = []; - this.rows = []; - - const baseClass = this.options.class; - this.options = Object.assign({}, this.options, options); - if (options?.class) this.options.class = `${baseClass} ${options.class}`; - }, - - addHeader(header, options) { - this.headers.push({ - inner: header, - options: Object.assign({ class: 'th' }, options || {}), - }); - - return this; - }, - - setHeaders(headers) { - this.headers = headers; - - return this; - }, - - addRow(cells, options) { - this.rows.push({ - cells, - options: Object.assign({ class: 'tr' }, options || {}), - }); - - return this; - }, - - setRows(rows) { - this.rows = rows; - - return this; - }, - - render() { - let headerRow = ''; - - if (Array.isArray(this.headers) && this.headers.length > 0) { - headerRow = E('tr', { class: 'tr table-titles' }, - this.headers.map((header) => E('th', header.options, header.inner)) - ); - } - - let rows = ''; - - if (Array.isArray(this.rows) && this.rows.length > 0) { - rows = this.rows.map((row) => E('tr', row.options, - row.cells.map((cell) => E('td', Object.assign({ class: 'td' }, cell.options || {}), cell.inner)) - )); - } - - return E('table', this.options, [headerRow].concat(rows)); - } -}); - -const UITableList = UITable.extend({ - __name__: 'Podman.UI.TableList', - - options: { class: 'table table-list' }, - - addRow(label, value, rowOptions) { - return this.super('addRow', [[ - { inner: label }, - { inner: value } - ], rowOptions]); - }, -}); - -/** - * Tabbed interface using LuCI tabs API. - */ -const UITabs = baseclass.extend({ - __name__: 'Podman.UI.Tabs', - - tabs: [], - activeTab: null, - - __init__(activeTab) { - this.tabs = []; - this.activeTab = activeTab || null; - }, - - addTab(id, title, content, active) { - this.tabs.push({ - id, - title, - content, - active: active || false - }); - - return this; - }, - - render() { - const tabPanes = this.tabs.map((tab, index) => { - const isActive = tab.active || (!this.activeTab && index === 0) || (this.activeTab === tab.id); - - return E('div', { - class: 'tab-pane', - 'data-tab': tab.id, - 'data-tab-title': tab.title, - 'data-tab-active': isActive ? 'true' : null - }, [tab.content || E('div', { class: 'cbi-section' }, E('div', { class: 'cbi-section-node' }))]); - }); - - const tabContainer = E('div', { class: 'cbi-section' }, [ - E('div', { class: 'cbi-section-node' }, [ - E('div', { class: 'tab-panes' }, tabPanes) - ]) - ]); - - requestAnimationFrame(() => { - const panes = tabContainer.querySelectorAll('.tab-pane'); - ui.tabs.initTabGroup(panes); - }); - - return tabContainer; - } -}); - -const UIModal = baseclass.extend({ - __name__: 'Podman.UI.Modal', - - title: '', - content: null, - extraClasses: [], - - __init__(title, content, extraClasses) { - this.title = title || this.title; - this.content = content || this.content; - this.extraClasses = extraClasses || this.extraClasses; - }, - - render() { - ui.showModal(this.title, [ - E('div', {}, this.getContent()), - E('div', { class: 'd-flex justify-end mt-sm gap-5' }, this.getButtons()), - ], ...this.extraClasses); - }, - - getContent() { - return this.content; - }, - - getButtons() { - const buttons = []; - - if (typeof this.handleClose === 'function') { - buttons.push(this.getCloseButton()); - } - - if (typeof this.handleSubmit === 'function') { - buttons.push(this.getOkButton()); - } - - return buttons; - }, - - async handleClose() { - ui.hideModal(); - }, - - async handleSubmit() { - ui.hideModal(); - }, - - getOkButton() { - return new UIButtonNew(_('OK'), { - click: ui.createHandlerFn(this, 'handleSubmit'), - type: 'positive', - }).render(); - }, - - getCloseButton() { - return new UIButtonNew(_('Close'), { - click: ui.createHandlerFn(this, 'handleClose'), - type: 'negative', - }).render(); - }, -}); - -const PodmanUI = UIBase.extend({ - __name__: 'Podman.UI', - - Modal: UIModal, - - Button: UIButton, - ButtonNew: UIButtonNew, - // MultiButton: UIMultiButton, - - Numberfield: UINumberfield, - Datefield: UIDatefield, - - SecretText: UISecretText, - - JsonArea: UIJsonArea, - BashCodeArea: UIBashCodeArea, - - Table: UITable, - TableList: UITableList, - Tabs: UITabs, - Tooltip: UITooltip, - - StreamLog: UIStreamLog, -}); - -return PodmanUI; diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/utils.js b/luci-app-podman/htdocs/luci-static/resources/podman/utils.js deleted file mode 100644 index 9ca397edb..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/utils.js +++ /dev/null @@ -1,238 +0,0 @@ -'use strict'; - -'require baseclass'; - -const UtilIpv6 = baseclass.extend({ - /** - * Derive ULA IPv6 subnet and gateway from IPv4 subnet. - * Uses IPv4 octets 3-4 as subnet ID for consistent IPv4/IPv6 mapping. - * @param {string} ipv4 - IPv4 subnet in CIDR (e.g., "192.168.20.0/24") - * @param {string} ula_prefix - ULA prefix (e.g., "fd52:425:78eb::/48") - * @returns {{ipv6subnet: string, ipv6gateway: string}} IPv6 config with subnet/gateway - */ - deriveUlaFromIpv4(ipv4, ula_prefix) { - const ipv4Address = ipv4.split('/')[0]; - const octets = ipv4Address.split('.').map(Number); - const subnetIdHex = ((octets[2] << 8) | octets[3]).toString(16).padStart(4, '0'); - const ulaAddress = ula_prefix.split('/')[0]; - const ulaParts = ulaAddress.split('::'); - - let hextets = ulaParts[0].split(':'); - if (hextets.length === 1 && hextets[0] === "") { - hextets = []; - } - - while (hextets.length < 3) { - hextets.push('0'); - } - - const ipv6SubnetAddress = `${hextets.slice(0, 3).join(':')}:${subnetIdHex}::`; - - return { - ipv6subnet: `${ipv6SubnetAddress}/64`, - ipv6gateway: `${ipv6SubnetAddress}1` - }; - }, -}); - -const UtilIpv4 = baseclass.extend({ - // >>> 0 forces unsigned 32-bit interpretation (JS bitwise ops are signed) - _ipToInt(octets) { - return ((octets[0] << 24) | (octets[1] << 16) | (octets[2] << 8) | octets[3]) >>> 0; - }, - - _intToIp(n) { - return [(n >>> 24) & 0xFF, (n >>> 16) & 0xFF, (n >>> 8) & 0xFF, n & 0xFF].join('.'); - }, - - /** - * Convert a CIDR string to a start/end IP range. - * Works for both network addresses (10.89.0.0/24) and host addresses - * within a subnet (10.89.0.5/24) - the mask normalises either to the - * full network range. - * @param {string} cidr - CIDR notation (e.g., "10.89.0.128/25") - * @returns {{start_ip: string, end_ip: string}|null} Range or null if invalid - */ - cidrToRange(cidr) { - if (!cidr || typeof cidr !== 'string') return null; - - const parts = cidr.split('/'); - if (parts.length !== 2) return null; - - const octets = parts[0].split('.').map(Number); - const prefixLen = parseInt(parts[1], 10); - - if (octets.length !== 4 || octets.some(o => isNaN(o) || o < 0 || o > 255)) return null; - if (isNaN(prefixLen) || prefixLen < 0 || prefixLen > 32) return null; - - const ipInt = this._ipToInt(octets); - const mask = prefixLen === 0 ? 0 : (0xFFFFFFFF << (32 - prefixLen)) >>> 0; - - return { - start_ip: this._intToIp((ipInt & mask) >>> 0), - end_ip: this._intToIp((ipInt | (~mask >>> 0)) >>> 0), - }; - }, - - /** - * Return the first usable host address in a subnet (network address + 1). - * Conventionally used as the gateway address. - * @param {string} cidr - CIDR notation (e.g., "10.89.0.0/24") - * @returns {string|null} First host IP (e.g., "10.89.0.1") or null if invalid - */ - firstHost(cidr) { - const range = this.cidrToRange(cidr); - if (!range) return null; - - const octets = range.start_ip.split('.').map(Number); - const next = (this._ipToInt(octets) + 1) >>> 0; - - return this._intToIp(next); - }, -}); - -const UtilFormat = baseclass.extend({ - __name__: 'Podman.Util.Format', - - /** - * Format bytes to human-readable size - */ - bytes(bytes, decimals) { - if (!bytes) return '0 B'; - - decimals = decimals ?? 2; - const k = 1024; - const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; - const i = Math.floor(Math.log(bytes) / Math.log(k)); - - return parseFloat((bytes / k ** i).toFixed(decimals)) + ' ' + sizes[i]; - }, - - /** - * Format timestamp to locale string with leading zeros - */ - date(timestamp) { - if (!timestamp) { - return _('Never'); - } - - let date; - - if (typeof timestamp === 'string') { - if (timestamp === '0001-01-01T00:00:00Z' || timestamp.startsWith('0001-')) { - return _('Never'); - } - date = new Date(timestamp); - } else { - date = new Date(timestamp * 1000); - } - - if (isNaN(date.getTime())) { - return _('Unknown'); - } - - if (date.getFullYear() < 1970) { - return _('Never'); - } - - const day = ('0' + date.getDate()).slice(-2); - const month = ('0' + (date.getMonth() + 1)).slice(-2); - const year = date.getFullYear(); - const hours = ('0' + date.getHours()).slice(-2); - const minutes = ('0' + date.getMinutes()).slice(-2); - const seconds = ('0' + date.getSeconds()).slice(-2); - - return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; - }, - - /** - * Parse memory string to bytes - * Supports formats: 512m, 1g, 2gb, 1024, etc. - * @param {string} memStr - Memory string (e.g., "512m", "1g", "2gb") - * @returns {number} Size in bytes - */ - parseMemory(memStr) { - if (!memStr) return 0; - - const match = memStr.match(/^(\d+(?:\.\d+)?)\s*([kmgt]?b?)?$/i); - if (!match) return 0; - - const value = parseFloat(match[1]); - const unit = (match[2] || 'b').toLowerCase(); - - const multipliers = { - b: 1, - k: 1024, - kb: 1024, - m: 1024 * 1024, - mb: 1024 * 1024, - g: 1024 * 1024 * 1024, - gb: 1024 * 1024 * 1024, - t: 1024 * 1024 * 1024 * 1024, - tb: 1024 * 1024 * 1024 * 1024 - }; - - return Math.floor(value * (multipliers[unit] || 1)); - }, - - /** - * Parse duration string to nanoseconds (Podman format) - * Supports formats: 30s, 1m, 1h, 500ms, etc. - * @param {string} duration - Duration string (e.g., "30s", "1m", "1h") - * @returns {number} Duration in nanoseconds, or 0 if invalid - */ - parseDuration(duration) { - if (!duration) return 0; - - const match = duration.match(/^(\d+(?:\.\d+)?)\s*(ns|us|ms|s|m|h)$/); - if (!match) return 0; - - const value = parseFloat(match[1]); - const unit = match[2]; - - const multipliers = { - ns: 1, - us: 1000, - ms: 1000000, - s: 1000000000, - m: 60000000000, - h: 3600000000000 - }; - - return Math.floor(value * (multipliers[unit] || 0)); - }, -}); - -/** - * Shared utility functions. - */ -return baseclass.extend({ - ipv4: new UtilIpv4(), - - ipv6: new UtilIpv6(), - - format: new UtilFormat(), - - truncate(str, maxLength) { - if (!str || str.length <= maxLength) { - return str; - } - - return str.substring(0, maxLength) + '...'; - }, - - moveArrayItem(arr, fromIndex, toIndex) { - const [item] = arr.splice(fromIndex, 1); - arr.splice(toIndex, 0, item); - return arr; - }, - - _p(stringPlural) { - return this._n(2, '', stringPlural); - }, - - _n(length, stringSingular, stringPlural) { - return parseInt(length) === 1 ? - stringSingular : stringPlural; - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/podman/view.js b/luci-app-podman/htdocs/luci-static/resources/podman/view.js deleted file mode 100644 index 9b1fdd103..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/podman/view.js +++ /dev/null @@ -1,387 +0,0 @@ -'use strict'; - -'require baseclass'; -'require view'; -'require form'; -'require dom'; -'require ui'; - -'require podman.ui as podmanUI'; -'require podman.constants as constant'; - -const ViewDefault = { - scrollToTop() { - document.body.scrollTop = 0; - document.documentElement.scrollTop = 0; - }, - - loading(text) { - this.scrollToTop(); - podmanUI.showSpinningModal(null, text || _('Loading...')); - }, - - confirm(content, onConfirm) { - const modal = new podmanUI.Modal(_('Confirm'), content, [ 'confirm-modal' ]); - modal.getCloseButton = () => new podmanUI.ButtonNew(_('Cancel'), { - click: () => ui.hideModal(), - type: 'negative', - }).render(); - modal.handleSubmit = onConfirm; - modal.render(); - }, - - error(message) { - this.scrollToTop(); - ui.hideModal(); - podmanUI.alert(message, 'error'); - }, - - warning(message) { - this.scrollToTop(); - ui.hideModal(); - podmanUI.alert(message, 'warning', true); - }, - - success(message) { - this.scrollToTop(); - ui.hideModal(); - podmanUI.alert(message, 'success', true); - }, -}; - -const ViewBase = view.extend({ - ...ViewDefault, - __name__: 'PodmanView.Base', - - handleSaveApply: null, - handleSave: null, - handleReset: null, - - __init__() { - document.querySelector('head').appendChild(E('link', { - rel: 'stylesheet', - type: 'text/css', - href: L.resource('view/podman/podman.css'), - })); - - document.addEventListener('keydown', (event) => { - if (event.key === 'Escape') ui.hideModal(); - }); - - this.super('__init__', []); - }, -}); - -const ViewList = ViewBase.extend({ - __name__: 'Podman.View.List', - - map: null, - section: null, - title: '', - sectionName: '', - sectionHeadline: '', - TableSelectSection: null, - - async render(data) { - const listData = {}; - listData[this.sectionName] = data; - - await this.initSection(listData); - await this.updateSection(); - - return this.transformMap(await this.map.render()); - }, - - transformMap(map) { - return map; - }, - - initTableSelectSection(data) { - this.map = new form.JSONMap(data, this.title); - - this.section = this.map.section( - this.TableSelectSection, - this.sectionName, - '', - this.sectionHeadline || _('Manage podman %s').format(this.title.toLowerCase()) - ); - this.section.view = this; - this.section.anonymous = true; - this.section.footer = true; - - return this.section; - }, - - async initSection(data) { - if (!this.TableSelectSection) { - // Require on-the-fly to avoid circular dependency - const mod = await L.require('podman.TableSelectSection'); - this.TableSelectSection = mod.TableSelectSection; - } - return this.initTableSelectSection(data); - }, - - getSection() { - return this.section; - }, -}); - -/** - * Form View - */ -const ViewForm = baseclass.extend({ - ...ViewDefault, - __name__: 'Podman.View.Form', - - map: null, - section: null, - - __init__() { - - }, - - makeData() { - return {}; - }, - - async render() { - const data = this.makeData(); - const sectionName = Object.keys(data)[0]; - this.map = new form.JSONMap(data, '', ''); - this.section = this.map.section(form.TypedSection, sectionName, ''); - this.section.anonymous = true; - - await this.createForm(); - - return this.map.render(); - }, - - createForm() {}, - - getField(name) { - return this.section?.getOption(name); - }, - - getFields() { - return this.section?.getOption() || {}; - }, - - getFieldValue(name) { - return this.getField(name)?.formvalue(this.section?.sectiontype); - }, - - getFieldValues() { - const values = {}; - const fields = this.getFields(); - - Object.keys(fields).forEach((name) => { - values[name] = fields[name].formvalue(this.section?.sectiontype); - }); - - return values; - }, - - isValid() { - const fields = this.getFields(); - const sectionId = this.section.sectiontype; - - for (const [_key, field] of Object.entries(fields)) { - if (field.isValid(sectionId) === false) { - return false; - } - } - - return true; - }, - - scrollToInvalid() { - const invalidElement = this.map.root.querySelector('.cbi-input-invalid'); - invalidElement.scrollIntoView(); - }, - - async save() { - try { - await this.map.save(() => {}, true); - } catch (error) { - return false; - } - - return true; - }, - - async handleCreate(createFn, title, textLoading, textSuccess) { - ui.hideModal(); - - const loadingText = textLoading || _('Creating %s').format(title); - const successText = textSuccess || _('%s created successfully').format(title); - - this.loading(loadingText); - - await createFn(); - ui.hideModal(); - if (successText !== false) { - this.success(successText); - } - }, -}); - -const ViewTabs = ViewBase.extend({ - __name__: 'Podman.View.Tabs', - tabs: null, - - __init__() { - this.tabs = new podmanUI.Tabs('info'); - this.super('__init__', []); - }, - - renderTab(tab, content, description) { - const tabContainer = document.querySelector(`.tab-pane[data-tab="${tab}"]`); - const tabContainerNode = tabContainer?.querySelector('.cbi-section-node'); - - if (!tabContainerNode) return; - - if (description) { - tabContainer.insertBefore(E('div', { - class: 'cbi-section-descr' - }, description), tabContainer.firstChild); - } - - dom.content(tabContainerNode, content); - }, - - getTabInstance(name) { - const tabNode = document.querySelector(`.tab-pane[data-tab="${name}"]`); - return tabNode ? dom.findClassInstance(tabNode) : null; - }, -}); - -const ViewContainer = ViewTabs.extend({ - __name__: 'Podman.View.Container', - listUrl: '#', - - async render() { - window.addEventListener('pagehide', () => this.stopStreams(), { once: true }); - - return E('div', {}, [ this.createHeader(), this.tabs.render() ]); - }, - - createHeader(name, isRunning, isStopped, isPaused) { - return E('div', { class: 'mb-sm container-toolbar' }, [ - E('div', { class: 'd-flex align-start' }, [ - E('h2', { class: 'mb-sm' }, [ name ]), - new podmanUI.ButtonNew(constant.ICON.BACK, { - click: () => this.redirectToList(), - type: 'none', - }).render(), - ]), - E('div', { class: 'd-flex align-center' }, [ - new podmanUI.ButtonNew(constant.ICON.START, { - click: ui.createHandlerFn(this, 'handleStart'), - type: isRunning ? 'active' : '', - }).render(), - new podmanUI.ButtonNew(constant.ICON.STOP, { - click: ui.createHandlerFn(this, 'handleStop'), - type: isStopped ? 'active' : '', - }).render(), - new podmanUI.ButtonNew(constant.ICON.RESTART, { - click: ui.createHandlerFn(this, 'handleRestart'), - }).render(), - new podmanUI.ButtonNew(constant.ICON.PAUSE, { - click: ui.createHandlerFn(this, 'handlePause'), - type: isPaused ? 'active' : '', - }).render(), - new podmanUI.ButtonNew(_('Delete'), { - click: ui.createHandlerFn(this, 'handleRemove'), - type: 'negative', - }).render(), - ]), - ]); - }, - - redirectToList() { - this.stopStreams(); - window.location.href = this.listUrl; - }, - - stopStreams() { - }, -}); - -const ViewTabContent = baseclass.extend({ - ...ViewDefault, - __name__: 'PodmanView.TabContent', - tab: null, - active: false, - - __init__(tab) { - this.tab = tab || this.tab; - this.super('__init__', []); - - if (!this.tab) { - return; - } - - let attempts = 0; - new Promise((resolve, reject) => { - const check = () => { - if (attempts++ > 100) { reject(); return; } - const element = document.querySelector(`[data-tab="${this.tab}"]`); - if (element) resolve(element); - else setTimeout(check, 100); - }; - check(); - }).then(() => { - const mainNode = document.querySelector(`.tab-pane[data-tab="${this.tab}"]`); - - dom.bindClassInstance(mainNode, this); - - const mutationObserver = new MutationObserver((mutationsList) => { - let handled = false; - mutationsList.forEach((mutation) => { - const setActive = mutation.target.dataset.tabActive === 'true'; - - if (handled || mutation.attributeName !== 'data-tab-active') return; - handled = true; - - if (this.active === setActive) { - return; - } - - if (setActive) { - this.active = true; - this.onTabActive(); - return; - } - - this.active = false; - this.onTabInactive(); - }); - }); - - mutationObserver.observe(mainNode, { attributes: true }); - }).catch(() => {}); - }, - - async onTabActive() { }, - - async onTabInactive() { }, - - renderTabContent(headline, content) { - return E('div', {}, [ - E('h4', {}, headline), - ...(content || []), - ]); - }, - - warningContent(message) { - return E('div', { class: 'alert-message d-flex justify-center p-sm' }, message); - }, -}); - -return baseclass.extend({ - base: ViewBase, - list: ViewList, - form: ViewForm, - container: ViewContainer, - tabContent: ViewTabContent, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/info.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/info.js deleted file mode 100644 index 09fc01ff6..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/info.js +++ /dev/null @@ -1,388 +0,0 @@ -'use strict'; - -'require ui'; - -'require podman.ui as podmanUI'; -'require podman.form as podmanForm'; -'require podman.view as podmanView'; -'require podman.rpc as podmanRPC'; -'require podman.utils as utils'; - -'require podman.model.Container as Container'; - -const CENSORED_VALUE = '••••••••'; - -return podmanView.tabContent.extend({ - tab: 'info', - - container: null, - initScriptStatus: '', - - async render(container) { - this.container = container; - - const sections = await Promise.all([ - this.basicSection(), - this.configSection(), - this.networkSection(), - this.envSection(), - this.mountSection(), - ]); - - this.updateInitScriptIcon(sections[0]); - - return sections; - }, - - basicSection() { - const basicTable = new podmanUI.TableList(); - - const editableNameField = new ui.Textfield(this.container.getName(), { name: 'container-name' }).render(); - const editableName = new podmanForm.EditableField('container-name', editableNameField); - editableName.onSubmit = (value) => this.handleUpdateName(value); - - const policies = { - 'no': _('No'), - 'always': _('Always'), - 'on-failure': _('On Failure'), - 'unless-stopped': _('Unless Stopped') - }; - const currentPolicy = this.container.getRestartPolicyName(); - const editableRestartField = new ui.Select(currentPolicy, policies, { name: 'container-restart' }).render(); - const editableRestart = new podmanForm.EditableField('container-restart', editableRestartField); - editableRestart.onSubmit = (value) => this.handleUpdateRestartPolicy(value); - - basicTable - .addRow(_('Name'), editableName.render()) - .addRow(_('ID'), this.container.getID().substring(0, 64)) - .addRow(_('Image'), new podmanUI.Tooltip(this.container.getImageName(), this.container.Image, { class: 'tooltip' }).render()) - .addRow(_('Tag'), this.container.getImageTag()) - .addRow(_('Status'), this.container.getStateBadge()) - .addRow(_('Created'), this.container.getCreated(true)) - .addRow(_('Started'), this.container.getStartedAt(true)) - .addRow(_('Restart Policy'), editableRestart.render()) - .addRow(_('Auto Update'), this.container.getAutoUpdateLabel() || _('Disabled')) - .addRow(_('Init Script'), E('div', { - class: `init-script-form align-center ${this.container.getRestartPolicyName() === 'no' ? 'd-none' : 'd-flex'}` - }, [ - new podmanUI.Tooltip( - new podmanUI.ButtonNew( - this.container.getAutoStartStatusIcon(), - { - click: ui.createHandlerFn(this, 'handleToggleInitScript'), - } - ).render(), - _('Click to enable/disable'), - { - class: 'cursor-pointer', - } - ).render(), - - new podmanUI.ButtonNew(_('Show'), { - type: 'none', - click: ui.createHandlerFn(this, 'handleShowInitScript'), - }).render(), - new podmanUI.ButtonNew(_('Generate'), { - type: 'none', - click: ui.createHandlerFn(this, 'handleGenerateInitScript'), - }).render(), - ])) - ; - - return E('div', {}, [ - E('h4', {}, _('Basic Information')), - basicTable.render(), - ]); - }, - - configSection() { - const configTable = new podmanUI.TableList(); - const cmd = this.container.getCmdString() || '-'; - const entrypoint = this.container.getEntrypointString() || '-'; - const createCommand = this.container.getCreateCommandString() || '-'; - const createCommandField = new podmanUI.SecretText(createCommand, CENSORED_VALUE); - - configTable - .addRow(_('Create Command'), createCommandField.render()) - .addRow(_('Command'), cmd) - .addRow(_('Entrypoint'), entrypoint) - .addRow(_('Working Directory'), this.container.getWorkingDir()) - .addRow(_('User'), this.container.getUser()) - .addRow(_('Hostname'), this.container.getHostname()) - .addRow(_('Privileged'), this.container.getPrivileged() ? _('Yes') : _('No')) - .addRow(_('TTY'), this.container.getTty() ? _('Yes') : _('No')) - .addRow(_('Interactive'), this.container.getInteractive() ? _('Yes') : _('No')) - ; - - return E('div', {}, [ - E('h4', {}, _('Configuration')), - configTable.render(), - ]); - }, - - async networkSection () { - const table = new podmanUI.TableList(); - const { NetworkMode, Links } = this.container.getHostConfig(); - const { Networks, IPAddress } = this.container.getNetworkSettings(); - - table.addRow(_('Network Mode'), NetworkMode || _('default')); - - const systemNetworks = ['bridge', 'host', 'none', 'container', 'slirp4netns']; - let userNetworks = []; - - if (Networks && Object.keys(Networks).length > 0) { - userNetworks = Object.keys(Networks).filter((netName) => !systemNetworks.includes(netName)); - - userNetworks.forEach((netName) => { - const net = Networks[netName]; - const tooltip = (() => { - if (!this.container.isRunning()) { - return _('Container is not running'); - } - - const parts = []; - if (net.IPAddress) parts.push(`IPv4: ${net.IPAddress}`); - if (net.GlobalIPv6Address) parts.push(`IPv6: ${net.GlobalIPv6Address}`); - else parts.push('IPv6: disabled'); - if (net.Gateway) parts.push(`Gateway: ${net.Gateway}`); - if (net.MacAddress) parts.push(`MAC: ${net.MacAddress}`); - return parts.join('\n'); - })(); - - const ipContent = net.GlobalIPv6Address - ? [net.IPAddress || '-', E('br'), net.GlobalIPv6Address] - : net.IPAddress || '-'; - - table.addRow( - new podmanUI.Tooltip(E('span', { class: 'tooltip' }, netName), tooltip).render(), - E('div', { class: 'd-flex align-center' }, [ - E('span', {}, ipContent), - new podmanUI.Tooltip('✖', _('Click to disconnect'), { - class: 'text-error cursor-pointer container-icon-disconnect ml-sm border-0', - click: () => this.handleNetworkDisconnect(netName), - }).render(), - ]) - ); - }); - } - - if (IPAddress && userNetworks.length === 0) { - table.addRow(_('IP Address'), IPAddress); - } - - const podmanNetworks = await podmanRPC.networks.list(); - const networkOptions = Object.fromEntries(podmanNetworks.map(item => [item.name, item.name])); - - const networkSelectWidget = new ui.Select([''], networkOptions, { name: 'container-connect-network', optional: false }); - const ipTextWidget = new ui.Textfield('', { name: 'container-connect-ip', placeholder: '192.168.1.100', datatype: 'ip4addr' }); - - table.addRow(_('Connect to'), [ - E('div', { class: 'd-flex align-center container-connect' }, [ - networkSelectWidget.render(), - ipTextWidget.render(), - new podmanUI.Button(_('Connect'), () => { - const selectedNetwork = networkSelectWidget.getValue(); - const selectedIp = ipTextWidget.getValue(); - - networkSelectWidget.triggerValidation(); - ipTextWidget.triggerValidation(); - - if (!selectedNetwork || !ipTextWidget.isValid()) { - return; - } - - this.handleNetworkConnect(selectedNetwork, selectedIp); - }).render(), - ]), - ]); - - table.addRow(_('Ports'), E('div', {}, - this.container.getPorts().map((port) => E('div', {}, port.string)), - )); - - if (Links && Links.length > 0) { - const linkNodes = Links.reduce((nodes, link, i) => { - if (i > 0) nodes.push(E('br')); - nodes.push(link); - return nodes; - }, []); - table.addRow(_('Links'), linkNodes); - } - - return E('div', { class: 'networks' }, [ - E('h4', {}, _('Network')), - table.render(), - ]); - }, - - envSection() { - const table = new podmanUI.Table(); - table - .addHeader(_('Variable'), { style: 'width: 50%;' }) - .addHeader(_('Value'), { style: 'width: 50%;' }); - - this.container.getEnvironmentVars().forEach((env) => { - const parts = env.split('='); - const varName = parts[0]; - const varValue = parts.slice(1).join('='); - const valueField = new podmanUI.SecretText(varValue, CENSORED_VALUE); - - table.addRow([{ - inner: varName - }, - { - inner: valueField.render(), - }, - ]); - }); - - return E('div', {}, [ - E('h4', {}, _('Environment Variables')), - table.render(), - ]); - }, - - mountSection() { - const table = new podmanUI.Table(); - table - .addHeader(_('Type'), { style: 'width: 10%;' }) - .addHeader(_('Source'), { style: 'width: 35%;' }) - .addHeader(_('Destination'), { style: 'width: 35%;' }) - .addHeader(_('Mode'), { style: 'width: 10%;' }) - ; - - const truncatedField = (value) => { - const v = value || '-'; - return v.length > 50 ? new podmanUI.Tooltip(utils.truncate(v, 50), v).render() : v; - }; - - this.container.getMounts().forEach((mount) => { - const mountSourceField = truncatedField(mount.Source); - const mountDestField = truncatedField(mount.Destination); - - table.addRow([ - { inner: mount.Type || '-' }, - { inner: mountSourceField }, - { inner: mountDestField }, - { inner: mount.RW ? 'rw' : 'ro' }, - ]); - }) - - return E('div', {}, [ - E('h4', {}, _('Mounts')), - table.render(), - ]); - }, - - async _refreshContainer() { - const inspectData = await this.container.inspect(); - this.container = Container.getSingleton(inspectData); - }, - - async _refreshNetworkSection() { - const networkSection = await this.networkSection(); - document.querySelector('.networks').replaceWith(networkSection); - }, - - async updateInitScriptIcon(infoSection) { - this.initScriptStatus = await this.container.checkInitScript(); - const initScriptIconElement = (infoSection || document).querySelector('.autostart-status'); - const initScriptIcon = this.container.getAutoStartStatusIcon(this.initScriptStatus); - initScriptIconElement.replaceWith(initScriptIcon); - }, - - async handleUpdateName(name) { - if (!name || this.container.Name === name) { - return; - } - - this.loading(_('Update name')); - - await this.container.updateName(name); - - document.querySelector('.container-toolbar h2').textContent = name; - this.success(_('Name updated successfully')); - }, - - async handleUpdateRestartPolicy(policy) { - this.loading(_('Update restart policy')); - - const updateData = { RestartPolicy: policy }; - if (policy === 'on-failure') updateData.RestartRetries = 5; - - await this.container.update(updateData); - await this._refreshContainer(); - - const initScriptForm = document.querySelector('.init-script-form'); - if (policy === 'no') { - initScriptForm.classList.replace('d-flex', 'd-none'); - } else { - initScriptForm.classList.replace('d-none', 'd-flex'); - } - - this.updateInitScriptIcon(); - - this.success(_('Restart policy updated successfully')); - }, - - async handleNetworkConnect(networkName, ip) { - this.loading(_('Connecting container to network')); - - const params = {}; - if (ip) params.static_ips = [ip]; - - await this.container.connect(networkName, params); - await this._refreshContainer(); - this.success(_('Connected successfully to %s').format(networkName)); - await this._refreshNetworkSection(); - }, - - async handleNetworkDisconnect(networkName) { - this.loading(_('Disconnect container from network')); - - await this.container.disconnect(networkName); - await this._refreshContainer(); - this.success(_('Disconnected from %s').format(networkName)); - await this._refreshNetworkSection(); - }, - - async handleGenerateInitScript() { - this.loading(_('Creating auto-start configuration for %s').format(this.container.getName())); - - await this.container.generateInitScript(); - await this.container.enableInitScript(); - ui.hideModal(); - window.location.reload(); - }, - - async handleShowInitScript() { - this.loading(_('Loading init script')); - - const result = await this.container.showInitScript(); - ui.hideModal(); - - if (!result || !result.path || !result.content) return; - - const modal = new podmanUI.Modal(result.path, [ - new podmanUI.BashCodeArea(result.content.replace(/\\n/g, '\n')).render() - ]); - modal.handleSubmit = undefined; - modal.render(); - }, - - async handleToggleInitScript() { - if (this.initScriptStatus === 'missing') { - return this.handleGenerateInitScript(); - } else if (this.initScriptStatus === 'enabled') { - this.loading(_('Disabling init script')); - await this.container.disableInitScript(); - ui.hideModal(); - window.location.reload(); - } else if (this.initScriptStatus === 'disabled') { - this.loading(_('Enabling init script')); - await this.container.enableInitScript(); - ui.hideModal(); - window.location.reload(); - } - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/logs.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/logs.js deleted file mode 100644 index 01703ea2d..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/logs.js +++ /dev/null @@ -1,137 +0,0 @@ -'use strict'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; - -const TIMESTAMP_RE_GLOBAL = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})\s*/g; -const ANSI_REGEX = /\x1B\[[0-9;]*[A-Za-z]/g; -const MAX_LOG_LINES = 1000; - -return podmanView.tabContent.extend({ - tab: 'logs', - container: null, - - render(container) { - this.container = container; - - this.logViewer = E('pre', { id: 'log-viewer', class: 'terminal-area' }, []); - - return this.renderTabContent('', [ - this.renderLogToolbar(), - this.logViewer, - ]); - }, - - onTabActive() { - // Running: auto-start live stream. Stopped: load historical logs on demand via play button. - if (this.container.isRunning()) { - this.startStream(); - } - }, - - onTabInactive() { - this.stopStream(); - }, - - _setStreamActive(active) { - this.logLinesInput.disabled = active; - this.logSinceInput.disabled = active; - this.logUntilInput.disabled = active; - this.playButton.querySelector('.cbi-button').classList.toggle('cbi-button-active', active); - this.stopButton.querySelector('.cbi-button').classList.toggle('cbi-button-active', !active); - }, - - startStream() { - if (!this.container || this.logsStream) { - return; - } - - this._setStreamActive(true); - - this.logViewer.textContent = ''; - - const toUnixSince = (val) => val ? new Date(val + 'T00:00:00').getTime() / 1000 : null; - const toUnixUntil = (val) => val ? new Date(val + 'T23:59:59').getTime() / 1000 : null; - - this.logsStream = this.container.streamLogs((data) => { - if (!data || !data.raw) return; - - const line = data.raw - .replace(TIMESTAMP_RE_GLOBAL, '') - .replace(ANSI_REGEX, '') - .trim(); - - if (!line) return; - - this.logViewer.textContent += line + '\n'; - this.trimLogOutput(); - this.logViewer.scrollTop = this.logViewer.scrollHeight; - }, { - tail: this.logLinesInput.value || 100, - since: toUnixSince(this.logSinceInput.value), - until: toUnixUntil(this.logUntilInput.value), - follow: this.container.isRunning(), - }); - }, - - stopStream() { - if (!this.logsStream) return; - - this._setStreamActive(false); - - this.logsStream.stop(); - this.logsStream = null; - }, - - renderLogToolbar() { - // Fields start disabled only for running containers (stream auto-starts and locks them). - // For stopped containers they start enabled so the user can set filters before fetching. - const initialDisabled = this.container.isRunning(); - const linesField = new podmanUI.Numberfield(100, { id: 'log-lines', min: '10', max: '250', disabled: initialDisabled }).render(); - const sinceField = new podmanUI.Datefield(null, { id: 'log-since', disabled: initialDisabled }).render(); - const untilField = new podmanUI.Datefield(null, { id: 'log-until', disabled: initialDisabled }).render(); - - this.logLinesInput = linesField.querySelector('input'); - this.logSinceInput = sinceField.querySelector('input'); - this.logUntilInput = untilField.querySelector('input'); - - this.stopButton = new podmanUI.ButtonNew('◼', { - click: () => this.stopStream(), - type: ' stop-button', - tooltip: _('Stop stream'), - }).render(); - - this.playButton = new podmanUI.ButtonNew('►', { - click: () => this.startStream(), - type: 'active play-button', - tooltip: _('Start stream'), - }).render(); - - return E('div', { class: 'd-flex align-center mb-sm' }, [ - E('label', { class: 'mr-xs' }, _('Number of lines')), - linesField, - '', - E('label', { class: 'ml-xs mr-xs' }, _('Since')), - sinceField, - - E('label', { class: 'ml-xs mr-xs' }, _('Until')), - untilField, - - E('div', { class: 'ml-xs' }, ''), - - new podmanUI.ButtonNew('🗑️', { - click: () => this.logViewer.textContent = '', - tooltip: _('Clear logs'), - }).render(), - this.stopButton, - this.playButton, - ]); - }, - - trimLogOutput() { - const lines = this.logViewer.textContent.split('\n'); - if (lines.length > MAX_LOG_LINES) { - this.logViewer.textContent = lines.slice(lines.length - MAX_LOG_LINES).join('\n'); - } - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/processes.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/processes.js deleted file mode 100644 index a691da6e5..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/processes.js +++ /dev/null @@ -1,99 +0,0 @@ -'use strict'; - -'require dom'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; - -return podmanView.tabContent.extend({ - tab: 'ps', - container: null, - - render(container) { - this.container = container; - - if (!this.container.isRunning()) { - return this.warningContent(_('Container is not running')); - } - - this.tableContent = E('div', { class: 'ps-table-content' }, []); - - return this.renderTabContent('', [ - this.tableContent, - ]); - }, - - onTabActive() { - if (!this.container || !this.container.isRunning() || this.processStream) { - return; - } - - this.processStream = this.container.streamTop((ps) => { - this.updateProcessList(ps); - }); - }, - - onTabInactive() { - if (!this.processStream) return; - - this.processStream.stop(); - this.processStream = null; - }, - - updateProcessList(ps) { - if (!ps || !ps.Titles || !ps.Processes || ps.Titles.length === 0) { - return; - } - - const psTable = new podmanUI.Table(); - const columnWidth = `width: ${100 / ps.Titles.length}%;`; - const timeIndex = ps.Titles.indexOf('ELAPSED'); - - ps.Titles.forEach((title) => { - psTable.addHeader(_(title), { style: columnWidth }); - }); - - ps.Processes.forEach((process) => { - psTable.addRow(process.map((detail, i) => ({ - inner: i === timeIndex ? this._formatElapsedTime(detail) : detail - }))); - }); - - dom.content(this.tableContent, psTable.render()); - }, - - _formatElapsedTime(timeStr) { - if (!timeStr) return '-'; - - const result = []; - const pattern = /(\d+(?:\.\d+)?)([ydhms])/g; - let match; - - while ((match = pattern.exec(timeStr)) !== null) { - let value = parseFloat(match[1]); - const unit = match[2]; - - if (unit === 's' && value > 1000) { - value = Math.floor(value / 1000000000); - - if (value >= 60) { - const mins = Math.floor(value / 60); - const secs = value % 60; - if (mins > 0) result.push(`${mins}m`); - if (secs > 0) result.push(`${secs}s`); - continue; - } - } else { - value = Math.floor(value); - } - - if (unit === 's' || unit === 'm') { - result.push(String(value).padStart(2, '0') + unit); - } else { - result.push(value + unit); - } - } - - return result.length > 0 ? result.join('') : timeStr; - } -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/stats.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/stats.js deleted file mode 100644 index 0aff2a19c..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/container-tab/stats.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict'; - -'require dom'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.utils as podmanUtil'; - -return podmanView.tabContent.extend({ - tab: 'stats', - container: null, - - render(container) { - this.container = container; - - if (!this.container.isRunning()) { - return this.warningContent(_('Container is not running')); - } - - return this.renderTabContent(_('Statistics'), [ - this.renderStatsTable(), - ]); - }, - - onTabActive() { - if (!this.container || !this.container.isRunning() || this.statsStream) { - return; - } - - this.statsStream = this.container.streamStats((stats) => { - this.updateStatsDisplay(stats); - }); - }, - - onTabInactive() { - if (!this.statsStream) { - return; - } - - this.statsStream.stop(); - this.statsStream = null; - }, - - renderStatsTable() { - const table = new podmanUI.TableList(); - - table - .addRow(_('CPU Usage'), '-', { 'data-stat': 'cpu' }) - .addRow(_('Memory Usage'), '-', { 'data-stat': 'memory' }) - .addRow(_('Memory Limit'), '-', { 'data-stat': 'memory-limit' }) - .addRow(_('Memory %'), '-', { 'data-stat': 'memory-percent' }) - .addRow(_('Network I/O'), '-', { 'data-stat': 'network-io' }) - .addRow(_('Block I/O'), '-', { 'data-stat': 'block-io' }) - .addRow(_('PIDs'), '-', { 'data-stat': 'pids' }) - ; - - return table.render(); - }, - - updateStatsDisplay(stats) { - if (!stats) return; - - if (!this.statElements) { - this.statElements = {}; - for (const key of ['cpu', 'memory', 'memory-limit', 'memory-percent', 'network-io', 'block-io', 'pids']) { - this.statElements[key] = document.querySelector(`[data-stat="${key}"] td:last-of-type`); - } - } - - const updates = [ - ['cpu', stats.CPU != null ? stats.CPU.toFixed(2) + '%' : '-'], - ['memory', podmanUtil.format.bytes(stats.MemUsage) || '-'], - ['memory-limit', podmanUtil.format.bytes(stats.MemLimit) || '-'], - ['memory-percent', stats.MemPerc != null ? stats.MemPerc.toFixed(2) + '%' : '-'], - ['network-io', this._formatNetworkIO(stats.Network)], - ['block-io', this._formatBlockIO(stats.BlockInput, stats.BlockOutput)], - ['pids', stats.PIDs], - ]; - - for (const [key, value] of updates) { - if (this.statElements[key]) - dom.content(this.statElements[key], value); - } - }, - - _formatNetworkIO(networks) { - const parts = Object.keys(networks || {}).map((iface) => { - const net = networks[iface]; - return `${iface}: ↓ ${podmanUtil.format.bytes(net.RxBytes)} / ↑ ${podmanUtil.format.bytes(net.TxBytes)}`; - }); - - if (parts.length === 0) return '-'; - - return parts.reduce((nodes, part, i) => { - if (i > 0) nodes.push(E('br')); - nodes.push(part); - return nodes; - }, []); - }, - - _formatBlockIO(blockInput, blockOutput) { - return _('Read: %s / Write: %s').format( - podmanUtil.format.bytes(blockInput || 0), - podmanUtil.format.bytes(blockOutput || 0) - ); - } -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/container.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/container.js deleted file mode 100644 index ae3b14412..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/container.js +++ /dev/null @@ -1,167 +0,0 @@ -'use strict'; - -'require ui'; -'require dom'; - -'require podman.constants as constant'; -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.model.Container as Container'; -'require podman.form.resource as PodmanFormResource'; - -'require view.podman.container-tab.info as ContainerInfoTab'; -'require view.podman.container-tab.stats as ContainerStatsTab'; -'require view.podman.container-tab.processes as ContainerProcessesTab'; -'require view.podman.container-tab.logs as ContainerLogsTab'; - -/** - * Container detail view with tabbed interface - */ -return podmanView.container.extend({ - container: null, - data: null, - listUrl: L.url('admin/podman/containers'), - - async load() { - // Extract container ID from URL path - // URL format: /cgi-bin/luci/admin/podman/container/ - const path = L.location(); - const matches = path.match(/container\/([a-f0-9]+)/i); - - if (!matches || !matches[1]) { - this.redirectToList(); - return; - } - - const containerId = matches[1]; - const container = Container.getSingleton({ Id: containerId }); - - const inspectData = await container.inspect(); - this.data = inspectData; - return Container.getSingleton(inspectData); - }, - - async render(container) { - if (!container) { - this.redirectToList(); - return; - } - - this.container = container; - this.tabs - .addTab('info', _('Info')) - .addTab('resources', _('Resources')) - .addTab('stats', _('Stats')) - .addTab('ps', _('Processes')) - .addTab('logs', _('Logs')) - // .addTab('health', _('Health')) - .addTab('inspect', _('Inspect')) - // .addTab('console', _('Console')) - ; - - requestAnimationFrame(() => { - this.renderInfoTab(); - this.renderResourcesTab(); - this.renderStatsTab(); - this.renderProcessesTab(); - this.renderLogsTab(); - this.renderInspectTab(); - }); - - return this.super('render', []); - }, - - createHeader() { - return this.super('createHeader', [ - this.container.getName(), - this.container.isRunning(), - this.container.isStopped(), - this.container.isPaused(), - ]); - }, - - stopStreams() { - this.getTabInstance('stats')?.onTabInactive(); - this.getTabInstance('ps')?.onTabInactive(); - this.getTabInstance('logs')?.onTabInactive(); - }, - - async renderInfoTab() { - const content = await ContainerInfoTab.render(this.container); - this.renderTab('info', content); - }, - - async renderResourcesTab() { - const resourceForm = await new PodmanFormResource.init().render(this.container); - this.renderTab('resources', resourceForm, _('Configure resource limits for this container.')); - }, - - async renderStatsTab() { - const content = await ContainerStatsTab.render(this.container); - this.renderTab('stats', content); - }, - - async renderProcessesTab() { - const content = await ContainerProcessesTab.render(this.container); - this.renderTab('ps', content); - }, - - async renderLogsTab() { - const content = await ContainerLogsTab.render(this.container); - this.renderTab('logs', content); - }, - - renderInspectTab() { - this.renderTab('inspect', new podmanUI.JsonArea(this.data).render()); - }, - - async handleStart() { - if (this.container.isRunning()) { - return; - } - - this.loading(_('Start container')); - - if (this.container.isPaused()) { - this.container.unpause().then(() => window.location.reload()); - return; - } - - this.container.start().then(() => window.location.reload()); - }, - - async handleStop() { - if (this.container.isStopped()) { - return; - } - - this.loading(_('Stop container')); - this.stopStreams(); - this.container.stop().then(() => window.location.reload()); - }, - - async handleRestart() { - this.loading(_('Restart container')); - this.stopStreams(); - this.container.restart().then(() => window.location.reload()); - }, - - async handlePause() { - if (!this.container.isRunning()) { - return; - } - - this.loading(_('Pause container')); - this.stopStreams(); - this.container.pause().then(() => window.location.reload()); - }, - - async handleRemove() { - this.confirm([ - E('p', {}, _('Are you sure to remove container?')), - ], async () => { - this.loading(_('Remove container')); - this.container.remove().then(() => this.redirectToList()); - }); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/containers.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/containers.js deleted file mode 100644 index 1c2afd188..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/containers.js +++ /dev/null @@ -1,151 +0,0 @@ -'use strict'; - -'require dom'; -'require ui'; - -'require podman.constants as constant'; -'require podman.rpc as podmanRPC'; -'require podman.utils as utils'; -'require podman.ui as podmanUI'; -'require podman.form as podmanForm'; -'require podman.view as podmanView'; -'require podman.form.container as PodmanFormContainer'; - -/** - * Manage podman containers - */ -return podmanView.list.extend({ - sectionName: 'containers', - - title: _('Containers'), - titleSingle: _('Container'), - - async load() { - return podmanRPC.containers.list('all=true'); - }, - - /** - * Update list section - */ - async updateSection() { - this.section.selectKey = 'Id'; - this.section.createForm = PodmanFormContainer; - this.section.handleRefreshCb = () => this.checkInitScripts(); - this.section.toolbarExtraButtons = [ - new podmanUI.Button(constant.ICON.START, ui.createHandlerFn(this, 'handleStart')).render(), - new podmanUI.Button(constant.ICON.STOP, ui.createHandlerFn(this, 'handleStop')).render(), - new podmanUI.Button(constant.ICON.RESTART, ui.createHandlerFn(this, 'handleRestart')).render(), - new podmanUI.Button(constant.ICON.PAUSE, ui.createHandlerFn(this, 'handlePause')).render(), - ]; - - let o; - - o = this.section.option(podmanForm.field.DummyValue, 'Names', _('Name')); - - o = this.section.option(podmanForm.field.DummyValue, 'Id', _('ID')); - o.cfgdatavalue = (container) => container.getDetailLink(utils.truncate(container.getID(), 10)); - o.width = '12%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Image', _('Image')); - o.cfgdatavalue = (container) => container.getImageName(); - o.width = '25%'; - - o = this.section.option(podmanForm.field.DummyValue, 'ImageTag', _('Tag')); - o.cfgdatavalue = (container) => container.getImageTag(); - o.cfgformatter = (imageTag) => utils.truncate(imageTag, 10); - o.cfgtt = (imageTag) => imageTag.length > 10 ? imageTag : ''; - o.width = '11%'; - - o = this.section.option(podmanForm.field.DummyValue, 'State', _('Status')); - o.cfgdatavalue = (container) => container.getStateBadge(); - o.width = '8%'; - - o = this.section.option(podmanForm.field.TimestampDummyValue, 'StartedAt', _('Started At')); - o.width = '17%'; - - o = this.section.option(podmanForm.field.DummyValue, 'InitScript', _('Boot')); - o.cfgvalue = () => E('span', { class: 'autostart-status autostart-' }, '...'); - o.width = '6%'; - }, - - transformMap(map) { - this.checkInitScripts(map); - return map; - }, - - async checkInitScripts(renderedTable) { - const data = this.map.data.data; - - for (const [key, container] of Object.entries(data)) { - const iconEl = (renderedTable || document) - .querySelector(`tr[data-sid="${key}"] td[data-name="InitScript"] .autostart-status`); - - container.checkInitScript().then((initScriptStatus) => { - let initScriptIcon = container.getAutoStartStatusIcon(initScriptStatus); - - if (initScriptStatus === 'missing') { - initScriptIcon = new podmanUI.Tooltip( - initScriptIcon, - _('Start script missing\n\nClick to generate'), - { - class: 'border-0', - click: ui.createHandlerFn(this, 'handleGenerateInitScript') - } - ).render(); - } else if (initScriptStatus === 'disabled') { - initScriptIcon = new podmanUI.Tooltip(initScriptIcon, _('Start script disabled'), { class: 'border-0' }).render(); - } else if (initScriptStatus === 'enabled') { - initScriptIcon = new podmanUI.Tooltip(initScriptIcon, _('Start on boot'), { class: 'border-0' }).render(); - } - - if (iconEl) iconEl.replaceWith(initScriptIcon); - }).catch(() => {}); - } - }, - - async handleGenerateInitScript(event) { - const clickedIcon = event.target; - const recordRow = dom.parent(clickedIcon, 'tr'); - const container = this.map.data.data[recordRow.getAttribute('data-sid')]; - - await container.generateInitScript(); - await container.enableInitScript(); - - this.section.handleRefresh(); - }, - - handleStart() { - return this.updateContainersStatus( - (container) => container.isPaused() ? container.unpause() : container.start(), - _('Start container') - ); - }, - - handleStop() { - return this.updateContainersStatus((container) => container.stop(), _('Stop container')); - }, - - handleRestart() { - return this.updateContainersStatus((container) => container.restart(), _('Restart container')); - }, - - handlePause() { - return this.updateContainersStatus((container) => container.pause(), _('Pause container')); - }, - - async updateContainersStatus(statusFunction, textLoad) { - const section = this.getSection(); - const selected = section.getSelectedData(); - if (selected.length === 0) { - return section.showNoneSelectedWarning(); - } - - for (const [i, container] of selected.entries()) { - this.loading(_('%s: %d/%d').format(textLoad, i + 1, selected.length)); - await statusFunction(container); - } - - ui.hideModal(); - section.handleRefresh(); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/images.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/images.js deleted file mode 100644 index e3cee49ed..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/images.js +++ /dev/null @@ -1,118 +0,0 @@ -'use strict'; - -'require form'; -'require ui'; - -'require podman.rpc as podmanRPC'; -'require podman.utils as utils'; -'require podman.ui as podmanUI'; -'require podman.form as podmanForm'; -'require podman.view as podmanView'; -'require podman.form.image as PodmanFormImage'; - -const IMAGE_ID_TRUNCATE_LEN = 12; -const IMAGE_TAG_TRUNCATE_LEN = 14; - -/** - * Manage podman images - */ -return podmanView.list.extend({ - sectionName: 'images', - - title: _('Images'), - titleSingle: _('Image'), - - async load() { - return podmanRPC.images.list(); - }, - - /** - * Update list section - */ - async updateSection() { - this.section.selectKey = 'Id'; - this.section.handleCreateText = _('Pull Image'); - this.section.getCreateButton = function() { - return new podmanUI.ButtonNew(_('Pull Image'), { - click: ui.createHandlerFn(this, 'handleCreate'), - type: 'add', - }).render(); - }; - this.section.modalCreateTitle = _('Pull Image'); - this.section.createForm = PodmanFormImage; - this.section.toolbarExtraButtons = [ - new podmanUI.Button(_('Update'), ui.createHandlerFn(this, 'handlePullImages')).render(), - ]; - - let o; - - o = this.section.option(podmanForm.field.DummyValue, 'Repository', _('Repository')); - o.cfgdatavalue = async (image) => image.getRepository(); - - o = this.section.option(podmanForm.field.DummyValue, 'Tag', _('Tag')); - o.cfgdatavalue = async (image) => { - const tagValue = image.getTag(); - - if (tagValue.length > IMAGE_TAG_TRUNCATE_LEN) { - return new podmanUI.Tooltip(utils.truncate(tagValue, IMAGE_TAG_TRUNCATE_LEN), tagValue).render(); - } - - return tagValue; - }; - o.width = '17%'; - - o = this.section.option(podmanForm.field.LinkDummyValue, 'ImageId', _('Image ID')); - o.click = (_value, image) => this.section.handleInspect(image); - o.cfgdatavalue = (image) => utils.truncate(image.getID(), IMAGE_ID_TRUNCATE_LEN); - o.width = '15%'; - - o = this.section.option(podmanForm.field.ByteDummyValue, 'Size', _('Size')); - o.width = '12%'; - - o = this.section.option(podmanForm.field.TimestampDummyValue, 'Created', _('Created')); - o.width = '18%'; - - return this.map.render(); - }, - - handlePullImages: async function () { - const selected = this.section.getSelectedData(); - - if (selected.length === 0) { - return this.section.showNoneSelectedWarning(); - } - - const progressEl = E('pre', { class: 'terminal-area' }); - const modal = new podmanUI.Modal(_('Updating Images'), [ progressEl ]); - - /** @type {HTMLElement} */ - const closeButton = modal.getCloseButton(); - closeButton.classList.add('d-none'); - - modal.getButtons = () => [ closeButton ]; - modal.render(); - - const append = (text) => { - progressEl.textContent += text; - progressEl.scrollTop = progressEl.scrollHeight; - }; - - let errors = 0; - let first = true; - for (const image of selected) { - if (!first) append('\n'); - first = false; - try { - await image.streamPull((text) => append(text)); - } catch (err) { - podmanUI.alert(`${_('Error')}: ${err.message}`); - errors++; - } - } - - this.section.handleRefresh(); - closeButton.classList.remove('d-none'); - if (errors === 0) - podmanUI.alert(_('All images updated successfully'), 'success', true); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/modal/autoUpdate.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/modal/autoUpdate.js deleted file mode 100644 index fa2e6b79c..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/modal/autoUpdate.js +++ /dev/null @@ -1,216 +0,0 @@ -'use strict'; - -'require ui'; - -'require podman.rpc as podmanRPC'; -'require podman.ui as podmanUI'; -'require podman.model.Container as Container'; - -return podmanUI.Modal.extend({ - title: _('Auto Update'), - containers: [], - buttons: [], - - getContent() { - if (!this.containers || this.containers.length === 0) { - this.buttons = [ this.getCloseButton() ]; - return [ - E('p', {}, _('No containers with auto-update label found.')), - E('p', { class: 'mt-sm' }, - _('To enable auto-update for a container, add the label: io.containers.autoupdate=registry') - ), - ]; - } - - this.buttons = [ - this.getCloseButton(), - new podmanUI.ButtonNew(_('Check'), { - click: ui.createHandlerFn(this, 'handleCheckUpdate'), - type: 'positive', - }).render() - ]; - - return [ - E('p', {}, _('Check %d containers for updates?').format(this.containers.length)) - ]; - }, - - setContainers(containers) { - this.containers = containers ?? []; - return this; - }, - - getButtons() { - return this.buttons; - }, - - getCloseButton() { - return new podmanUI.ButtonNew(_('Close'), { - click: () => ui.hideModal(), - type: 'remove', - }).render(); - }, - - async handleCheckUpdate() { - const containersWithUpdates = []; - const checkErrors = []; - - for (const [index, container] of this.containers.entries()) { - podmanUI.showSpinningModal(null, _('Check for updates: %s/%s').format(index + 1, this.containers.length)); - - const updateState = await container.checkImageUpdate(); - if (updateState.hasUpdate) { - containersWithUpdates.push(container); - } else if (updateState.error) { - checkErrors.push({ name: container.getName(), error: updateState.error }); - } - } - - if (containersWithUpdates.length === 0) { - const content = [ E('p', {}, _('No new updates available.')) ]; - if (checkErrors.length > 0) { - content.push(E('p', { class: 'mt-sm' }, _('%d check(s) failed:').format(checkErrors.length))); - checkErrors.forEach((e) => content.push(E('p', { class: 'text-error' }, `${e.name}: ${e.error}`))); - } - const modal = new podmanUI.Modal(_('Check Complete'), content); - modal.getButtons = () => [ this.getCloseButton() ]; - modal.render(); - return; - } - - const updateContent = [ - E('p', {}, _('Select containers to update')), - ]; - - const checkboxes = {}; - containersWithUpdates.forEach((container) => { - const skipReason = container.getUpdateSkipReason(); - const checkbox = new ui.Checkbox(0); - const checkboxNode = checkbox.render(); - const checkboxInputNode = checkboxNode.querySelector('input[type="checkbox"]'); - const checkboxId = checkboxInputNode.id; - - if (skipReason) { - checkboxInputNode.disabled = true; - } else { - checkboxes[container.getID()] = { container, checkbox }; - } - - const inner = skipReason - ? new podmanUI.Tooltip(checkboxNode, skipReason).render() - : checkboxNode; - - updateContent.push(E('div', { class: 'd-flex align-center checkbox-with-label mb-xs' }, [ - inner, - E('label', { for: checkboxId }, container.getName()), - ])); - }); - - const modal = new podmanUI.Modal(_('Apply Updates'), updateContent); - modal.getButtons = () => [ - this.getCloseButton(), - new podmanUI.ButtonNew(_('Update'), { - click: async () => { - const selectedUpdates = Object.values(checkboxes) - .filter(({ checkbox }) => checkbox.isChecked()) - .map(({ container }) => container); - - if (selectedUpdates.length === 0) { - return; - } - - await this.handleUpdate(selectedUpdates); - }, - type: 'positive', - }).render() - ]; - modal.render(); - }, - - async handleUpdate(containers) { - const failures = []; - const oldImages = []; - - const counterEl = E('strong', {}, ''); - const spinnerEl = E('div', { class: 'spinning' }); - const headerEl = E('div', { class: 'd-flex align-center mb-sm gap-5' }, [ - counterEl, - spinnerEl, - ]); - const log = new podmanUI.StreamLog(); - - const finalize = () => { - ui.hideModal(); - if (failures.length === 0 && imageWarnings.length === 0) { - podmanUI.alert(_('Containers updated successfully'), 'success', true); - return; - } - const lines = []; - if (failures.length > 0) { - const succeeded = containers.length - failures.length; - lines.push(E('p', {}, _('%d updated, %d failed:').format(succeeded, failures.length))); - failures.forEach(f => lines.push(E('p', {}, `${f.name}: ${f.error}`))); - } else { - lines.push(E('p', {}, _('Containers updated successfully.'))); - } - imageWarnings.forEach(w => lines.push(E('p', { class: 'mt-sm' }, w))); - podmanUI.alert(lines, failures.length > 0 ? 'warning' : 'info'); - }; - - const closeBtn = new podmanUI.ButtonNew(_('Close'), { - click: () => finalize(), - type: 'negative', - }).render(); - closeBtn.disabled = true; - - const modal = new podmanUI.Modal(_('Apply Updates'), [ headerEl, log.render() ]); - modal.getButtons = () => [ closeBtn ]; - modal.render(); - - let imageWarnings = []; - - for (const [i, container] of containers.entries()) { - counterEl.textContent = _('Update image: %d/%d - %s').format(i + 1, containers.length, container.getName()); - log.append('━━ ' + container.getName() + ' ━━\n'); - try { - const inspected = Container.getSingleton(await container.inspect()); - const result = await inspected.updateImage((line) => log.append(line)); - if (result?.oldImage) oldImages.push({ image: result.oldImage }); - } catch (err) { - const msg = err.message || String(err); - log.append('✗ ' + msg + '\n'); - failures.push({ name: container.getName(), error: msg }); - } - log.append('\n'); - } - - if (oldImages.length > 0) { - counterEl.textContent = _('Cleaning up old images...'); - log.append('━━ ' + _('Cleaning up old images...') + ' ━━\n'); - - const allContainers = await podmanRPC.containers.list('all=true').catch(() => []); - const normalize = id => (id || '').replace(/^sha256:/, '').toLowerCase(); - const usedIds = new Set(allContainers.map(c => normalize(c.ImageID))); - - const seen = new Set(); - for (const { image } of oldImages) { - const id = normalize(image.getID()); - if (seen.has(id)) continue; - seen.add(id); - - if (usedIds.has(id)) { - const warning = _('Old image still used by other containers'); - imageWarnings.push(warning); - log.append('! ' + warning + '\n'); - } else { - await image.remove(); - log.append('✓ ' + _('Removed old image %s').format(image.getID().substring(0, 12)) + '\n'); - } - } - } - - counterEl.textContent = _('Done.'); - spinnerEl.classList.remove('spinning'); - closeBtn.disabled = false; - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/modal/prune.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/modal/prune.js deleted file mode 100644 index 8a1cef4c3..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/modal/prune.js +++ /dev/null @@ -1,120 +0,0 @@ -'use strict'; - -'require ui'; - -'require podman.rpc as podmanRPC'; -'require podman.utils as podmanUtil'; -'require podman.ui as podmanUI'; - -return podmanUI.Modal.extend({ - title: _('Cleanup Unused Resources'), - - getContent() { - this.checkboxPruneAll = new ui.Checkbox(1, { - hiddenname: 'prune-all-images' - }); - this.checkboxPruneVolumes = new ui.Checkbox(0, { - hiddenname: 'prune-volumes' - }); - - const pruneAllNode = this.checkboxPruneAll.render(); - const pruneVolumesNode = this.checkboxPruneVolumes.render(); - const pruneAllId = pruneAllNode.querySelector('input[type="checkbox"]').id; - const pruneVolumesId = pruneVolumesNode.querySelector('input[type="checkbox"]').id; - - return E('div', {}, [ - E('p', {}, _('Select what to clean up:')), - - E('div', { - class: 'd-flex align-center checkbox-with-label', - style: 'margin-bottom: 2px;' - }, [ - pruneAllNode, - E('label', { - for: pruneAllId - }, _('Remove all unused images (not just dangling)')), - ]), - - E('div', { - class: 'd-flex align-center checkbox-with-label' - }, [ - pruneVolumesNode, - E('label', { - for: pruneVolumesId - }, _('Remove unused volumes')), - ]), - ]); - }, - - getButtons() { - return [ - this.getCloseButton(), - new podmanUI.ButtonNew(_('Clean Up Now'), { - click: ui.createHandlerFn(this, 'handlePrune'), - type: 'positive', - }).render() - ]; - }, - - async handlePrune() { - const allImages = this.checkboxPruneAll.getValue() === '1'; - const volumes = this.checkboxPruneVolumes.getValue() === '1'; - podmanUI.showSpinningModal(_('Clean Up Now'), _( - 'Removing unused resources, please wait...')); - - const result = await podmanRPC.system.prune(allImages, volumes); - let freedSpace = 0; - const deletedItems = []; - - const reportTypes = [{ - key: 'ContainerPruneReports', - label: _('Containers') - }, - { - key: 'ImagePruneReports', - label: _('Images') - }, - { - key: 'VolumePruneReports', - label: _('Volumes') - } - ]; - - reportTypes.forEach((type) => { - const reports = result[type.key]; - if (reports && reports.length > 0) { - reports.forEach((r) => { - if (r.Size > 0) freedSpace += r.Size; - }); - deletedItems.push('%d %s'.format(reports.length, type.label - .toLowerCase())); - } - }); - - const modal = new podmanUI.Modal(_('Cleanup Complete')); - modal.handleClose = null; - modal.handleSubmit = () => { - ui.hideModal(); - window.location.reload(); - }; - modal.content = [ - E('p', {}, _('Cleanup successful!')), - ]; - - if (deletedItems.length > 0) { - modal.content.push(E('p', { - class: 'mt-sm' - }, _('Removed: %s').format(deletedItems.join(', ')))); - } else { - modal.content.push(E('p', { - class: 'mt-sm' - }, _('No unused resources found'))); - } - - modal.content.push(E('p', { - class: 'mt-sm text-success text-bold' - }, _('Space freed: %s').format(podmanUtil.format.bytes(freedSpace)))); - - modal.render(); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/networks.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/networks.js deleted file mode 100644 index 1bc2cf5d9..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/networks.js +++ /dev/null @@ -1,128 +0,0 @@ -'use strict'; - -'require network'; -'require ui'; - -'require podman.rpc as podmanRPC'; -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.form as podmanForm'; -'require podman.form.network as PodmanFormNetwork'; - -/** - * Manage podman networks - */ -return podmanView.list.extend({ - sectionName: 'networks', - - title: _('Networks'), - titleSingle: _('Network'), - - async load() { - return podmanRPC.networks.list(); - }, - - /** - * Update list section - */ - async updateSection() { - this.section.selectKey = 'ID'; - this.section.createForm = PodmanFormNetwork; - this.section.handleRemove = async () => this.removeNetworks(); - - let o; - - o = this.section.option(podmanForm.field.LinkDummyValue, 'name', _('Name')); - o.click = (_value, net) => this.section.handleInspect(net); - - o = this.section.option(podmanForm.field.DummyValue, 'Int', _('Int')); - o.cfgdatavalue = (net) => this.getIntegrationIcon(net); - o.width = '5%'; - - o = this.section.option(podmanForm.field.DummyValue, 'driver', _('Driver')); - o.width = '10%'; - - const ipPairCell = (getV4, getV6) => (net) => E('div', {}, [ - E('span', {}, getV4(net) || '-'), - E('br'), - E('span', {}, getV6(net) || '-'), - ]); - - o = this.section.option(podmanForm.field.DummyValue, 'Subnet', _('Subnet')); - o.cfgdatavalue = ipPairCell(n => n.getSubnetIP4(), n => n.getSubnetIP6()); - o.width = '20%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Gateway', _('Gateway')); - o.cfgdatavalue = ipPairCell(n => n.getGatewayIP4(), n => n.getGatewayIP6()); - o.width = '20%'; - - o = this.section.option(podmanForm.field.DateDummyValue, 'created', _('Created')); - o.width = '20%'; - - await network.flushCache(); - }, - - async removeNetworks() { - const selected = this.section.getSelectedData(); - if (selected.length === 0) { - return this.section.showNoneSelectedWarning(); - } - - const checkboxRemoveIntegration = new ui.Checkbox('1', { hiddenname: 'remove-integration' }); - const checkboxNode = checkboxRemoveIntegration.render(); - const checkboxId = checkboxNode.querySelector('input[type="checkbox"]').id; - - this.confirm([ - E('p', {}, _('Are you sure to delete the records?')), - E('div', { class: 'd-flex align-center checkbox-with-label' }, [ - checkboxNode, - E('label', { for: checkboxId }, _('Remove OpenWrt integration')), - ]), - ], async () => { - for (const [i, item] of selected.entries()) { - this.loading(_('Deleting records: %s/%s').format(i + 1, selected.length)); - - await item.remove(); - if (checkboxRemoveIntegration.getValue() === '1') { - await item.integrationRemove(); - } - } - - ui.hideModal(); - this.section.handleRefresh(); - }); - }, - - async getIntegrationIcon(net) { - const { hasInterface, hasDevice, hasDnsmasqExclusion } = await net.integrationCheck(); - - if (hasInterface && hasDevice && hasDnsmasqExclusion) { - return new podmanUI.Tooltip('✅', _('OpenWrt integration exists\n\nClick to remove'), { - click: () => { - this.confirm([ - E('p', {}, _('Are you sure to remove integration?')), - ], async () => { - await net.integrationRemove(); - this.section.handleRefresh(); - }); - }, - }).render(); - } - - const tooltip = []; - tooltip.push(_('OpenWrt integration incomplete')); - tooltip.push(''); - tooltip.push(`${_('Interface')}: ${String(hasInterface)}`); - tooltip.push(`${_('Device')}: ${String(hasDevice)}`); - if (await net.hasDnsmasq()) { - tooltip.push(`${_('Dnsmasq')}: ${String(hasDnsmasqExclusion)}`); - } - tooltip.push(''); - tooltip.push(_('Click icon to repair')); - - return new podmanUI.Tooltip('❌', tooltip.join('\n'), { - click: () => - net.integrationRepair().then(() => this.section.handleRefresh()), - }).render(); - } -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/overview.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/overview.js deleted file mode 100644 index 6ef3a1258..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/overview.js +++ /dev/null @@ -1,202 +0,0 @@ -'use strict'; - -'require dom'; -'require ui'; - -'require podman.rpc as podmanRPC'; -'require podman.utils as podmanUtil'; -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; - -'require view.podman.modal.prune as PruneModal'; -'require view.podman.modal.autoUpdate as AutoUpdateModal'; - -/** - * Podman Overview Dashboard View - */ -return podmanView.base.extend({ - async load() { - return Promise.all([ - podmanRPC.system.version(), - podmanRPC.system.info(), - ]) - }, - - async render([version, info]) { - const sections = await Promise.all([ - this.createToolbar(), - this.createInfoSection(version, info), - this.createDebugSection(), - this.createResourcesSection(), - ]); - - this.loadAdditionalInformation(); - - return E('div', {}, sections.filter(Boolean)); - }, - - async loadAdditionalInformation() { - const [containers, images, volumes, networks, pods] = await Promise.all([ - podmanRPC.containers.list('all=true'), - podmanRPC.images.list(), - podmanRPC.volumes.list(), - podmanRPC.networks.list(), - podmanRPC.pods.list() - ]); - - const runningContainers = containers.filter((container) => container.isRunning()).length; - const runningPods = pods.filter((p) => p.Status === 'Running').length; - - if (this.resourceCardsEl) { - dom.content(this.resourceCardsEl, [ - this.createResourceCards(containers, pods, images, networks, volumes, - runningContainers, runningPods) - ]); - } - }, - - createToolbar() { - return E('div', { class: 'overview-actions mb-sm' }, [ - new podmanUI.Button( - _('Check for Updates'), - ui.createHandlerFn(this, 'handleAutoUpdate'), - 'positive' - ).render(), - new podmanUI.Button( - _('Cleanup / Prune'), - ui.createHandlerFn(this, 'handlePrune'), - 'remove' - ).render() - ]); - }, - - createInfoSection(version, info) { - const memTotal = podmanUtil.format.bytes(info.host?.memTotal); - const memFree = podmanUtil.format.bytes(info.host?.memFree); - - const table = new podmanUI.TableList() - .addRow(_('Podman Version'), version.Version || _('Unknown')) - .addRow(_('API Version'), version.ApiVersion || _('Unknown')) - .addRow(_('CPU'), info.host?.cpus?.toString() || _('Unknown')) - .addRow(_('Memory'), memFree + ' / ' + memTotal) - .addRow(_('Socket Path'), info.host?.remoteSocket?.path || '/run/podman/podman.sock') - .addRow(_('Graph Root'), info.store?.graphRoot || _('Unknown')) - .addRow(_('Run Root'), info.store?.runRoot || _('Unknown')) - .addRow(_('Registries'), this.getRegistries(info)) - ; - - return this.createSection(_('Information'), table.render()); - }, - - createDebugSection() { - this.systemDiagnosticsEl = E('div', { class: 'system-diagnostics', style: 'margin-bottom: 18px;' }, [ - new podmanUI.Button( - _('Load'), - ui.createHandlerFn(this, 'handleLoadSystemDiagnostics'), - 'positive' - ).render(), - ]); - - return this.createSection(_('System Diagnostics'), this.systemDiagnosticsEl); - }, - - createResourcesSection() { - this.resourceCardsEl = E('div', { class: 'resources-cards' }, [ - E('div', { class: 'loading-placeholder' }, [ - E('em', { class: 'spinning' }, _('Loading...')), - ]), - ]); - - return this.createSection(_('Resources'), this.resourceCardsEl); - }, - - createSection(headline, content) { - return E('div', {}, [ - E('h3', {}, headline), - content, - ]); - }, - - getRegistries(info) { - if (info.registries && info.registries.search) { - return info.registries.search.join(', '); - } - return 'docker.io, registry.fedoraproject.org, registry.access.redhat.com'; - }, - - createResourceCards(containers, pods, images, networks, volumes, runningContainers, - runningPods) { - - return E('div', { class: 'overview-cards' }, [ - this.createCard('🐳', _('Containers'), 'containers', containers.length, runningContainers, 'admin/podman/containers'), - this.createCard('🔗', _('Pods'), 'pods', pods.length, runningPods, 'admin/podman/pods'), - this.createCard('💿', _('Images'), 'images', images.length, null, 'admin/podman/images'), - this.createCard('🌐', _('Networks'), 'networks', networks.length, null, 'admin/podman/networks'), - this.createCard('💾', _('Volumes'), 'volumes', volumes.length, null, 'admin/podman/volumes'), - ]); - }, - - createCard(icon, title, slug, total, running, url) { - const statsText = running !== null ? running + ' / ' + total : total.toString(); - - return E('a', { - href: L.url(url), - class: 'd-flex flex-column cursor-pointer align-center overview-card-link overview-card-' + slug, - }, [ - E('div', { class: 'card-link-header d-flex align-center w-100' }, [ - E('span', { class: 'card-link-title text-bold' }, title), - icon, - ]), - E('div', { class: 'w-100' }, [ - E('div', { class: 'card-link-headline text-bold' }, statsText), - running !== null - ? E('div', { class: 'card-link-text' }, _('running') + ' / ' + _('total')) - : E('div', { class: 'card-link-text' }, _('total')) - ]) - ]); - }, - - async handleLoadSystemDiagnostics() { - this.loading(_('Load System diagnostics')); - - const debugData = await podmanRPC.system.debug(); - const statusIcons = { ok: '\u2713', warn: '\u26A0', error: '\u2717' }; - const statusColors = { ok: '#2ecc71', warn: '#e67e22', error: '#e74c3c' }; - - const table = new podmanUI.TableList(); - - (debugData.checks || []).forEach((check) => { - const icon = statusIcons[check.status] || '?'; - const color = statusColors[check.status] || '#666'; - const detail = check.detail || ''; - const message = check.message ? ' \u2014 ' + check.message : ''; - - table.addRow( - _(check.label), - E('span', { style: 'color:' + color }, [ - E('strong', {}, icon + ' '), - E('span', { class: 'cli-value' }, detail), - message - ]) - ); - }); - - dom.content(this.systemDiagnosticsEl, [table.render()]); - ui.hideModal(); - }, - - handlePrune() { - PruneModal.render(); - }, - - handleAutoUpdate() { - this.loading(_('Find updateable containers')); - - // @todo Use podman api filter - return podmanRPC.containers.list('all=true').then((containers) => { - AutoUpdateModal - .setContainers(containers.filter((c) => c.getAutoUpdateLabel())) - .render(); - }); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/containers.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/containers.js deleted file mode 100644 index da496fe42..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/containers.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict'; - -'require dom'; -'require form'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.form as podmanForm'; -'require podman.model.Container as Container'; -'require podman.utils as podmanUtil'; -'require podman.TableSelectSection as TableSelectSection'; - -return podmanView.tabContent.extend({ - tab: 'ps', - pod: null, - - async render(pod) { - this.pod = pod; - - const containers = []; - - for (const podContainer of this.pod.getContainers()) { - const containerInspect = await Container.getSingleton(podContainer).inspect(); - const container = Container.getSingleton(containerInspect); - containers.push(container); - } - - this.map = new form.JSONMap({ containers }, ''); - - this.section = this.map.section( - TableSelectSection.TableSelectSection, - 'containers', - '', - '' - ); - this.section.view = this; - this.section.anonymous = true; - this.section.footer = true; - - this.section.selectKey = 'Id'; - // this.section.createForm = PodmanFormContainer; - this.section.handleCreate = null; - this.section.handleRemove = null; - this.section.handleRefresh = null; - - // this.section.handleRefreshCb = () => this.checkInitScripts(); - // this.section.handleRefreshCb = null; - // this.section.toolbarExtraButtons = [ - // new podmanUI.Button('►', ui.createHandlerFn(this, 'handleStart')).render(), - // new podmanUI.Button('◼', ui.createHandlerFn(this, 'handleStop')).render(), - // new podmanUI.Button('↻', ui.createHandlerFn(this, 'handleRestart')).render(), - // ]; - - let o; - - o = this.section.option(podmanForm.field.DummyValue, 'Names', _('Name')); - o.cfgdatavalue = (container) => container.getName(); - - o = this.section.option(podmanForm.field.DummyValue, 'Id', _('ID')); - o.cfgdatavalue = (container) => container.getDetailLink(podmanUtil.truncate(container.getID(), 10)); - o.width = '12%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Image', _('Image')); - o.cfgdatavalue = (container) => container.getImageName(); - o.width = '25%'; - - o = this.section.option(podmanForm.field.DummyValue, 'ImageTag', _('Tag')); - o.cfgdatavalue = (container) => container.getImageTag(); - o.cfgformatter = (imageTag) => podmanUtil.truncate(imageTag, 10); - o.cfgtt = (imageTag) => imageTag.length > 10 ? imageTag : ''; - o.width = '11%'; - - o = this.section.option(podmanForm.field.DummyValue, 'State', _('Status')); - o.cfgdatavalue = (container) => container.getStateBadge(); - o.width = '8%'; - - o = this.section.option(podmanForm.field.DummyValue, 'StartedAt', _('Started At')); - o.cfgdatavalue = (container) => container.getStartedAt(true); - o.width = '17%'; - - o = this.section.option(podmanForm.field.DummyValue, 'InitScript', _('Boot')); - o.cfgvalue = () => E('span', { class: 'autostart-status autostart-' }, '...'); - o.width = '6%'; - - return this.map.render(); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/info.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/info.js deleted file mode 100644 index 07a2a639e..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/info.js +++ /dev/null @@ -1,135 +0,0 @@ -'use strict'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.utils as podmanUtil'; -'require podman.model.Container as Container'; - -const DASH = '-'; - -function joinOrDash(values) { - return Array.isArray(values) && values.length > 0 ? values.join(', ') : DASH; -} - -function valueOrDash(value) { - return (value === undefined || value === null || value === '') ? DASH : value; -} - -return podmanView.tabContent.extend({ - tab: 'info', - pod: null, - - render(pod) { - this.pod = pod; - - const sections = [ - this.basicSection(), - this.configSection(), - this.resourcesSection(), - this.networkSection(), - ]; - - const labels = this.labelsSection(); - if (labels) sections.push(labels); - - return sections; - }, - - basicSection() { - const table = new podmanUI.TableList(); - - table - .addRow(_('Name'), this.pod.getName()) - .addRow(_('ID'), (this.pod.getID() || '').substring(0, 64)) - .addRow(_('Status'), this.pod.getStatusBadge()) - .addRow(_('Created'), podmanUtil.format.date(this.pod.getCreatedAt())); - - return E('div', {}, [ - E('h4', {}, _('Basic Information')), - table.render(), - ]); - }, - - configSection() { - const table = new podmanUI.TableList(); - - const infraId = this.pod.getInfraId(); - const infraIdCell = infraId - ? E('a', { href: L.url('admin/podman/container', infraId) }, infraId.substring(0, 12)) - : DASH; - - table - .addRow(_('Hostname'), valueOrDash(this.pod.Hostname)) - .addRow(_('Cgroup parent'), valueOrDash(this.pod.CgroupParent)) - .addRow(_('Exit policy'), valueOrDash(this.pod.ExitPolicy)) - .addRow(_('Restart policy'), valueOrDash(this.pod.RestartPolicy)) - .addRow(_('Shared namespaces'), joinOrDash(this.pod.SharedNamespaces)) - .addRow(_('Infra container'), infraIdCell); - - return E('div', {}, [ - E('h4', {}, _('Configuration')), - table.render(), - ]); - }, - - resourcesSection() { - const table = new podmanUI.TableList(); - - const memLimit = this.pod.memory_limit; - const memLimitDisplay = memLimit > 0 ? podmanUtil.format.bytes(memLimit) : _('Unlimited'); - - const cpuQuota = this.pod.cpu_quota; - const cpuQuotaDisplay = (cpuQuota === undefined || cpuQuota < 0) ? _('Unlimited') : `${cpuQuota} µs`; - - const cpuPeriod = this.pod.cpu_period; - const cpuPeriodDisplay = cpuPeriod > 0 ? `${cpuPeriod} µs` : DASH; - - table - .addRow(_('CPU period'), cpuPeriodDisplay) - .addRow(_('CPU quota'), cpuQuotaDisplay) - .addRow(_('CPU shares'), valueOrDash(this.pod.cpu_shares)) - .addRow(_('CPU set'), valueOrDash(this.pod.cpuset_cpus)) - .addRow(_('Memory limit'), memLimitDisplay); - - return E('div', {}, [ - E('h4', {}, _('Resources')), - table.render(), - ]); - }, - - networkSection() { - const table = new podmanUI.TableList(); - const infra = this.pod.InfraConfig || {}; - - table - .addRow(_('Networks'), joinOrDash(infra.Networks || this.pod.getNetworks())) - .addRow(_('Static IPv4'), valueOrDash(infra.StaticIP)) - .addRow(_('Static MAC'), valueOrDash(infra.StaticMAC)) - .addRow(_('DNS servers'), joinOrDash(infra.DNSServer)) - .addRow(_('DNS search'), joinOrDash(infra.DNSSearch)) - .addRow(_('DNS options'), joinOrDash(infra.DNSOption)) - .addRow(_('Extra hosts'), joinOrDash(infra.HostAdd)) - .addRow(_('Host network'), infra.HostNetwork ? _('Yes') : _('No')); - - return E('div', {}, [ - E('h4', {}, _('Network')), - table.render(), - ]); - }, - - labelsSection() { - const labels = this.pod.getLabels(); - const keys = Object.keys(labels || {}); - if (keys.length === 0) return null; - - const table = new podmanUI.TableList(); - for (const key of keys) { - table.addRow(key, labels[key]); - } - - return E('div', {}, [ - E('h4', {}, _('Labels')), - table.render(), - ]); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/processes.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/processes.js deleted file mode 100644 index d6f577643..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/processes.js +++ /dev/null @@ -1,96 +0,0 @@ -'use strict'; - -'require dom'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; - -return podmanView.tabContent.extend({ - tab: 'ps', - pod: null, - - render(pod) { - this.pod = pod; - - if (!this.pod.isRunning()) { - return this.warningContent(_('Pod is not running')); - } - - this.tableContent = E('div', { class: 'ps-table-content' }, []); - - return this.renderTabContent('', [ this.tableContent ]); - }, - - onTabActive() { - if (!this.pod || !this.pod.isRunning() || this.processStream) return; - - this.processStream = this.pod.streamTop((ps) => { - this.updateProcessList(ps); - }); - }, - - onTabInactive() { - if (!this.processStream) return; - - this.processStream.stop(); - this.processStream = null; - }, - - updateProcessList(ps) { - if (!ps || !ps.Titles || !ps.Processes || ps.Titles.length === 0) { - return; - } - - const psTable = new podmanUI.Table(); - const columnWidth = `width: ${100 / ps.Titles.length}%;`; - const timeIndex = ps.Titles.indexOf('ELAPSED'); - - ps.Titles.forEach((title) => { - psTable.addHeader(_(title), { style: columnWidth }); - }); - - ps.Processes.forEach((process) => { - psTable.addRow(process.map((detail, i) => ({ - inner: i === timeIndex ? this._formatElapsedTime(detail) : detail - }))); - }); - - dom.content(this.tableContent, psTable.render()); - }, - - // @todo: duplicated code (containers-tab/processes.js) - _formatElapsedTime(timeStr) { - if (!timeStr) return '-'; - - const result = []; - const pattern = /(\d+(?:\.\d+)?)([ydhms])/g; - let match; - - while ((match = pattern.exec(timeStr)) !== null) { - let value = parseFloat(match[1]); - const unit = match[2]; - - if (unit === 's' && value > 1000) { - value = Math.floor(value / 1000000000); - - if (value >= 60) { - const mins = Math.floor(value / 60); - const secs = value % 60; - if (mins > 0) result.push(`${mins}m`); - if (secs > 0) result.push(`${secs}s`); - continue; - } - } else { - value = Math.floor(value); - } - - if (unit === 's' || unit === 'm') { - result.push(String(value).padStart(2, '0') + unit); - } else { - result.push(value + unit); - } - } - - return result.length > 0 ? result.join('') : timeStr; - } -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/stats.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/stats.js deleted file mode 100644 index 8f832aa70..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod-tab/stats.js +++ /dev/null @@ -1,83 +0,0 @@ -'use strict'; - -'require dom'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.utils as podmanUtil'; - -return podmanView.tabContent.extend({ - tab: 'stats', - pod: null, - - render(pod) { - this.pod = pod; - - if (!this.pod.isRunning()) { - return this.warningContent(_('Pod is not running')); - } - - this.containerNames = this.buildContainerNameMap(); - this.tableContent = E('div', { class: 'stats-table-content' }, []); - - return this.renderTabContent('', [ this.tableContent ]); - }, - - onTabActive() { - if (!this.pod || !this.pod.isRunning() || this.statsStream) return; - - this.statsStream = this.pod.streamStats((reports) => { - this.updateStats(reports); - }); - }, - - onTabInactive() { - if (!this.statsStream) return; - - this.statsStream.stop(); - this.statsStream = null; - }, - - buildContainerNameMap() { - const map = {}; - for (const c of (this.pod.getContainers() || [])) { - if (c?.Id) map[c.Id] = c.Name; - } - return map; - }, - - updateStats(reports) { - if (!Array.isArray(reports)) return; - - const table = new podmanUI.Table(); - const headers = [ - _('Container'), - _('CID'), - _('CPU %'), - _('Memory'), - _('Memory %'), - _('Net I/O'), - _('Block I/O'), - _('PIDs'), - ]; - const columnWidth = `width: ${100 / headers.length}%;`; - headers.forEach((h) => table.addHeader(h, { style: columnWidth })); - - for (const r of reports) { - const cid = r.CID || ''; - const name = this.containerNames[cid] || r.Name || '-'; - table.addRow([ - { inner: name }, - { inner: podmanUtil.truncate(cid, 12) }, - { inner: r.CPU || '-' }, - { inner: r.MemUsage || '-' }, - { inner: r.Mem || '-' }, - { inner: r.NetIO || '-' }, - { inner: r.BlockIO || '-' }, - { inner: r.PIDS || '-' }, - ]); - } - - dom.content(this.tableContent, table.render()); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/pod.js deleted file mode 100644 index 15a791c60..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/pod.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict'; - -'require ui'; -'require dom'; - -'require podman.ui as podmanUI'; -'require podman.view as podmanView'; -'require podman.model.Pod as Pod'; - -'require view.podman.pod-tab.info as PodInfoTab'; -'require view.podman.pod-tab.containers as PodContainersTab'; -'require view.podman.pod-tab.stats as PodStatsTab'; -'require view.podman.pod-tab.processes as PodProcessesTab'; - -return podmanView.container.extend({ - pod: null, - data: null, - listUrl: L.url('admin/podman/pods'), - - async load() { - const path = L.location(); - const matches = path.match(/pod\/([a-f0-9]+)/i); - - if (!matches || !matches[1]) { - this.redirectToList(); - return; - } - - const podId = matches[1]; - const pod = Pod.getSingleton({ Id: podId }); - - const inspectData = await pod.inspect(); - this.data = inspectData; - - return Pod.getSingleton(inspectData); - }, - - async render(pod) { - if (!pod) { - this.redirectToList(); - return; - } - - this.pod = pod; - this.tabs - .addTab('info', _('Info')) - .addTab('containers', _('Containers')) - .addTab('stats', _('Stats')) - .addTab('ps', _('Processes')) - .addTab('inspect', _('Inspect')); - - requestAnimationFrame(() => { - this.renderInfoTab(); - this.renderContainersTab(); - this.renderStatsTab(); - this.renderProcessesTab(); - this.renderInspectTab(); - }); - - return this.super('render', []); - }, - - createHeader() { - return this.super('createHeader', [ - this.pod.getName(), - this.pod.isRunning(), - this.pod.isStopped(), - this.pod.isPaused(), - ]); - }, - - stopStreams() { - this.getTabInstance('stats')?.onTabInactive(); - this.getTabInstance('ps')?.onTabInactive(); - }, - - async renderInfoTab() { - const content = await PodInfoTab.render(this.pod); - this.renderTab('info', content); - }, - - async renderContainersTab() { - const content = await PodContainersTab.render(this.pod); - this.renderTab('containers', content); - }, - - async renderStatsTab() { - const content = await PodStatsTab.render(this.pod); - this.renderTab('stats', content); - }, - - async renderProcessesTab() { - const content = await PodProcessesTab.render(this.pod); - this.renderTab('ps', content); - }, - - renderInspectTab() { - this.renderTab('inspect', new podmanUI.JsonArea(this.data).render()); - }, - - async handleStart() { - if (this.pod.isRunning()) { - return; - } - - this.loading(_('Start pod')); - - if (this.pod.isPaused()) { - this.pod.unpause().then(() => window.location.reload()); - return; - } - - this.pod.start().then(() => window.location.reload()); - }, - - async handleStop() { - if (!this.pod.isRunning() && !this.pod.isPaused()) { - return; - } - - this.loading(_('Stop pod')); - this.stopStreams(); - this.pod.stop().then(() => window.location.reload()); - }, - - async handleRestart() { - this.loading(_('Restart pod')); - this.stopStreams(); - this.pod.restart().then(() => window.location.reload()); - }, - - async handlePause() { - if (!this.pod.isRunning()) { - return; - } - - this.loading(_('Pause pod')); - this.stopStreams(); - this.pod.pause().then(() => window.location.reload()); - }, - - async handleRemove() { - this.confirm([ - E('p', {}, _('Are you sure to remove pod?')), - ], async () => { - this.loading(_('Remove pod')); - this.pod.remove().then(() => this.redirectToList()); - }); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/podman.css b/luci-app-podman/htdocs/luci-static/resources/view/podman/podman.css deleted file mode 100644 index 55088c1ce..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/podman.css +++ /dev/null @@ -1,431 +0,0 @@ -:root { - --podman-terminal-bg: #1a1a1a; - --podman-terminal-fg: #0f0; - --warn-background-color-dark: rgba(166, 141, 69, 0.2); -} - -.overview-cards { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); - gap: 1.3125rem; -} - -div.cbi-tooltip-container { - width: fit-content; -} - -div.cbi-tooltip-container div.cbi-tooltip { - font-size: 13px; - font-weight: 400; - line-height: normal; -} - -.overview-card-link, -.overview-card-link:hover, -.overview-card-link:focus { - text-decoration: none; - color: inherit; - justify-content: space-between; - min-height: 120px; - padding: 1.3125rem; - margin: 0 0 .625rem 0; - transition: all 0.2s ease-in-out; -} - -.overview-card-link .card-link-header { - justify-content: space-between; - margin-bottom: .625rem; - font-size: 20px; -} - -.overview-card-link .card-link-title { - font-size: 16px; - opacity: 0.8; -} - -.overview-card-link .card-link-icon { - font-size: 24px; - opacity: 0.6; -} - -.overview-card-link .card-link-headline { - font-size: 32px; -} - -.overview-card-link .card-link-text { - font-size: 12px; - opacity: 0.7; - margin-top: .3125rem; -} - -.overview-card-containers { - border-left: 4px solid #3498db; -} - -.overview-card-containers .card-link-headline { - color: #3498db; -} - -.overview-card-pods { - border-left: 4px solid #2ecc71; -} - -.overview-card-pods .card-link-headline { - color: #2ecc71; -} - -.overview-card-images { - border-left: 4px solid #9b59b6; -} - -.overview-card-images .card-link-headline { - color: #9b59b6; -} - -.overview-card-networks { - border-left: 4px solid #e67e22; -} - -.overview-card-networks .card-link-headline { - color: #e67e22; -} - -.overview-card-volumes { - border-left: 4px solid #34495e; -} - -.overview-card-volumes .card-link-headline { - color: #34495e; -} - -.border-0 { - border: 0 !important; -} - -.cursor-pointer { - cursor: pointer; -} - -.d-flex { - display: flex; -} - -.align-center { - align-items: center; -} - -.align-start { - align-items: start; -} - -.justify-center { - justify-content: center; -} - -.justify-end { - justify-content: end; -} - -.flex-column { - flex-direction: column; -} - -.gap-5 { - gap: .3125rem; -} - -.cbi-button-active { - background: linear-gradient(lightgray, lightgray 25%, var(--background-color-low)); -} - -.badge { - font-size: 0.85em; - padding: 0 4px; - text-align: center; - border-radius: .3125rem; - width: fit-content; -} - -.badge.running { - background-color: var(--success-color-high); -} - -.badge.exited { - background-color: var(--error-color-high); -} - -.badge.created { - background-color: var(--background-color-low); -} - -.badge.paused { - background-color: var(--warning-color-high, #d68a00); -} - -.badge.degraded { - background-color: var(--warning-color-high, #d68a00); -} - -.badge.stopped, -.badge.dead { - background-color: var(--error-color-high); -} - -.badge.running, -.badge.error, -.badge.exited, -.badge.paused, -.badge.degraded, -.badge.stopped, -.badge.dead { - color: white; -} - -.tooltip { - border-bottom: 1px dotted; -} - -.w-100 { - width: 100%; -} - -.d-none { - display: none; -} - -.modal.loading-modal { - padding: 1em; -} - -.cbi-checkbox + label { - margin-left: 3px; -} - -.text-success { - color: var(--success-color-high); -} - -.text-error { - color: var(--error-color-high); -} - -.mr-xs { - margin-right: .3125rem; -} - -.ml-xs { - margin-left: .3125rem; -} - -.ml-sm { - margin-left: .625rem; -} - -.mt-sm { - margin-top: .625rem; -} - -.mb-xs { - margin-bottom: .3125rem; -} - -.mb-sm { - margin-bottom: .625rem; -} - -.p-sm { - padding: .625rem; -} - -.text-bold { - font-weight: bold; -} - -.text-center { - text-align: center !important; -} - -.d-flex { - display: flex; -} - -.gap-xs { - gap: .25rem; -} - -.gap-sm { - gap: .625rem; -} - -.editable-field { - width: 100%; - display: flex; -} - -.table-list>tr>td:first-of-type { - width: 33%; - font-weight: bold; -} - -.code-area, -.json-area, -.terminal-area { - max-height: 600px; - font-weight: 100; - overflow: auto !important; - white-space: pre !important; - display: block; - word-wrap: normal; -} - -.json-area .key { - color: #660066; - font-weight: bold; -} - -.json-area .string { - color: #007700; -} - -.json-area .boolean { - color: #aa5500; -} - -.json-area .null { - color: #777777; -} - -.json-area .number { - color: #0000ff; -} - -.code-area.bash .comment { - color: #888888; - font-style: italic; -} - -.code-area.bash .string { - color: #007700; -} - -.code-area.bash .variable { - color: #aa5500; -} - -.code-area.bash .keyword { - color: #0000ff; - font-weight: bold; -} - -.code-area.bash .number { - color: #ff4500; -} - -.terminal-area { - min-height: 100px; - background: var(--podman-terminal-bg); - color: var(--podman-terminal-fg); -} - -.autostart-enabled { - color: var(--success-color-high); -} - -.autostart-none, -.autostart-disabled { - color: var(--text-color-medium); -} - -.autostart-missing { - color: var(--warn-color-high); - cursor: pointer; -} - -.autostart-error { - color: var(--error-color-high); -} - -.loading-placeholder { - text-align: center; - padding: 30px; -} - -.cbi-button-none { - border: 0; - background: transparent; - box-shadow: none; -} - -.container-toolbar .d-flex { - gap: .25rem; -} - -.checkbox-with-label .cbi-checkbox { - display: flex; - align-items: center; -} - -.container-icon-disconnect { - border: 0; -} - -#log-viewer { - height: 600px; - overflow: auto; - white-space: pre; -} - -#log-lines { - width: 50px; -} - -#log-since, -#log-until { - width: 100px; -} - -#log-lines input, -#log-since input, -#log-until input { - width: inherit; -} - -.cbi-section-table-select { - table-layout: fixed; -} - -th[data-widget="Podman.Form.SelectDummyValue"] { - padding: .625rem .625rem 8px !important; -} - -th[data-widget="Podman.Form.SelectDummyValue"] .cbi-checkbox { - margin-top: 1px; -} - -td[data-widget="Podman.Form.SelectDummyValue"] { - padding: .625rem .625rem 7px !important; -} - -td[data-widget="Podman.Form.SelectDummyValue"] .cbi-checkbox { - margin-top: 2px; -} - -.podman-stream-log { - font-family: monospace; - font-size: 0.85rem; - line-height: 1.35; - background: #1e1e1e; - color: #e8e8e8; - border: 1px solid #444; - border-radius: 3px; - padding: 0.5rem 0.75rem; - max-height: 320px; - overflow-y: auto; - overflow-x: auto; - white-space: pre; -} - -.podman-stream-log .log-line { - white-space: pre; - word-break: keep-all; -} diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/pods.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/pods.js deleted file mode 100644 index 83d21960d..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/pods.js +++ /dev/null @@ -1,172 +0,0 @@ -'use strict'; - -'require ui'; - -'require podman.rpc as podmanRPC'; -'require podman.utils as utils'; -'require podman.ui as podmanUI'; -'require podman.form as podmanForm'; -'require podman.view as podmanView'; -'require podman.form.pod as PodmanFormPod'; -'require podman.model.Container as Container'; - -return podmanView.list.extend({ - sectionName: 'pods', - - title: _('Pods'), - titleSingle: _('Pod'), - - async load() { - return podmanRPC.pods.list(); - }, - - async updateSection() { - this.section.selectKey = 'Id'; - this.section.createForm = PodmanFormPod; - this.section.toolbarExtraButtons = [ - new podmanUI.Button('►', ui.createHandlerFn(this, 'handleStart')).render(), - new podmanUI.Button('◼', ui.createHandlerFn(this, 'handleStop')).render(), - new podmanUI.Button('↻', ui.createHandlerFn(this, 'handleRestart')).render(), - new podmanUI.Button('❚❚', ui.createHandlerFn(this, 'handlePause')).render(), - ]; - - let o; - - o = this.section.option(podmanForm.field.DummyValue, 'Name', _('Name')); - - o = this.section.option(podmanForm.field.DummyValue, 'Id', _('ID')); - o.cfgdatavalue = (pod) => pod.getDetailLink(utils.truncate(pod.getID(), 16)); - o.width = '20%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Status', _('Status')); - o.cfgdatavalue = (pod) => pod.getStatusBadge(); - o.width = '10%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Containers', _('Containers')); - o.cfgdatavalue = (pod) => this.renderContainersCell(pod); - o.width = '12%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Networks', _('Networks')); - o.cfgdatavalue = (pod) => { - const nets = pod.getNetworks(); - return nets.length > 0 ? nets.join(', ') : '-'; - }; - o.width = '15%'; - - o = this.section.option(podmanForm.field.DateDummyValue, 'Created', _('Created')); - o.width = '20%'; - }, - - renderContainersCell(pod) { - const count = pod.getContainers().length; - if (count === 0) { - return E('span', {}, '0'); - } - - return E('a', { - href: '#', - class: 'text-bold', - click: (ev) => { - ev.preventDefault(); - this.handleShowContainers(pod); - } - }, `${count} ▸`); - }, - - handleShowContainers(pod) { - const containers = pod.getContainers(); - - const headerRow = E('tr', {}, [ - E('th', {}, _('Name')), - E('th', {}, _('ID')), - E('th', {}, _('Status')), - ]); - - const rows = containers.map((c) => { - const container = Container.getSingleton(c); - const idShort = utils.truncate(container.getID(), 10); - const idCell = container.getDetailLink(idShort); - - return E('tr', {}, [ - E('td', {}, container.getName()), - E('td', {}, idCell), - E('td', {}, container.getStateBadge()), - ]); - }); - - // @todo: create table with helpers or show a simpler list - const table = E('table', { - class: 'table cbi-section-table' - }, [ - E('thead', {}, headerRow), - E('tbody', {}, rows.length > 0 ? rows : [ - E('tr', {}, E('td', { - colspan: 3, - class: 'text-center' - }, _('No containers in this pod'))), - ]), - ]); - - const title = _('Containers in pod %s').format(pod.getName()); - const modal = new podmanUI.Modal(title, [table]); - modal.render(); - }, - - handleStart() { - return this.runOnSelected( - (pod) => pod.isPaused() ? pod.unpause() : pod.start(), - _('Starting pod') - ); - }, - - handleStop() { - return this.runOnSelected((pod) => pod.stop(), _('Stopping pod')); - }, - - handleRestart() { - return this.runOnSelected((pod) => pod.restart(), _('Restarting pod')); - }, - - handlePause() { - return this.runOnSelected((pod) => pod.pause(), _('Pausing pod')); - }, - - async runOnSelected(action, textLoad) { - const section = this.getSection(); - const selected = section.getSelectedData(); - if (selected.length === 0) { - return section.showNoneSelectedWarning(); - } - - const failures = []; - for (const [i, pod] of selected.entries()) { - this.loading(_('%s: %d/%d').format(textLoad, i + 1, selected.length)); - const result = await action(pod); - if (result?.Errs?.length > 0) { - failures.push({ - name: pod.getName(), - errs: result.Errs - }); - } - } - - ui.hideModal(); - - if (failures.length > 0) { - const blocks = failures.map(({ - name, - errs - }) => E('div', { - class: 'mb-sm' - }, [ - E('strong', {}, name + ':'), - E('ul', { - class: 'm-0' - }, errs.map((e) => E('li', {}, e))), - ])); - podmanUI.alert(blocks, 'error'); - } - - section.handleRefresh(); - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/secrets.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/secrets.js deleted file mode 100644 index accec5a5c..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/secrets.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -'require form'; - -'require podman.utils as utils'; -'require podman.rpc as podmanRPC'; -'require podman.form as podmanForm'; -'require podman.view as podmanView'; -'require podman.form.secret as PodmanFormSecret'; - -const SECRET_LABELS_TRUNCATE_LEN = 30; - -/** - * Manage podman secrets - */ -return podmanView.list.extend({ - sectionName: 'secrets', - - title: _('Secrets'), - titleSingle: _('Secret'), - - /** - * Load secret data - */ - async load() { - return podmanRPC.secrets.list(); - }, - - /** - * Update list section - */ - async updateSection() { - this.section.selectKey = 'ID'; - this.section.createForm = PodmanFormSecret; - - let o; - - o = this.section.option(podmanForm.field.LinkDummyValue, 'Name', _('Name')); - o.cfgdatavalue = (secret) => secret.getName(); - o.click = (_value, secret) => this.section.handleInspect(secret, ['SecretData']); - - o = this.section.option(podmanForm.field.DummyValue, 'Driver', _('Driver')); - o.cfgdatavalue = (secret) => secret.getDriver(); - o.width = '10%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Labels', _('Labels')); - o.cfgdatavalue = (secret) => { - const labels = secret.getLabels(); - const keys = Object.keys(labels); - return keys.length ? keys.map((key) => `${key}=${labels[key]}`).join(', ') : '-'; - }; - o.cfgformatter = (labels) => utils.truncate(labels, SECRET_LABELS_TRUNCATE_LEN); - o.cfgtt = (labels) => labels.length > SECRET_LABELS_TRUNCATE_LEN ? labels : ''; - o.width = '20%'; - - o = this.section.option(podmanForm.field.DateDummyValue, 'CreatedAt', _('Created')); - o.width = '20%'; - }, -}); diff --git a/luci-app-podman/htdocs/luci-static/resources/view/podman/volumes.js b/luci-app-podman/htdocs/luci-static/resources/view/podman/volumes.js deleted file mode 100644 index 1c7b68a93..000000000 --- a/luci-app-podman/htdocs/luci-static/resources/view/podman/volumes.js +++ /dev/null @@ -1,122 +0,0 @@ -'use strict'; - -'require ui'; -'require fs'; - -'require podman.utils as utils'; -'require podman.rpc as podmanRPC'; -'require podman.ui as podmanUI'; -'require podman.form as podmanForm'; -'require podman.view as podmanView'; -'require podman.form.volume as PodmanFormVolume'; -'require podman.form.volumeImport as PodmanFormVolumeImport'; - -const VOLUME_MOUNT_TRUNCATE_LEN = 30; - -return podmanView.list.extend({ - sectionName: 'volumes', - - title: _('Volumes'), - titleSingle: _('Volume'), - - async load() { - return podmanRPC.volumes.list(); - }, - - async updateSection() { - this.section.selectKey = 'Name'; - this.section.createForm = PodmanFormVolume; - this.section.toolbarExtraButtons = [ - new podmanUI.ButtonNew(_('Import'), { - click: ui.createHandlerFn(this, 'handleImport'), - }).render(), - new podmanUI.ButtonNew(_('Export'), { - click: ui.createHandlerFn(this, 'handleExport'), - }).render(), - ]; - - let o; - - o = this.section.option(podmanForm.field.LinkDummyValue, 'VolumeName', _('Name')); - o.cfgdatavalue = (volume) => utils.truncate(volume.getName(), 20); - o.cfgtt = (_cfg, volume) => volume.getName().length > 20 ? volume.getName() : ''; - o.click = (_cfg, volume) => this.section.handleInspect(volume); - - o = this.section.option(podmanForm.field.DummyValue, 'Driver', _('Driver')); - o.width = '10%'; - - o = this.section.option(podmanForm.field.DummyValue, 'Mountpoint', _('Mountpoint')); - o.cfgformatter = (mountpoint) => utils.truncate(mountpoint, VOLUME_MOUNT_TRUNCATE_LEN); - o.cfgtt = (mountpoint) => mountpoint.length > VOLUME_MOUNT_TRUNCATE_LEN ? mountpoint : ''; - o.width = '35%'; - - o = this.section.option(podmanForm.field.DateDummyValue, 'CreatedAt', _('Created')); - o.width = '20%'; - }, - - handleImport() { - const fileInput = E('input', { - type: 'file', - accept: '.tar,.tar.gz,.tgz', - class: 'hidden' - }); - - fileInput.addEventListener('change', async (ev) => { - document.body.removeChild(fileInput); - const file = ev.target.files[0]; - if (!file) return; - - const importForm = new PodmanFormVolumeImport.init(); - const formContent = await importForm.render(file); - const title = _('Import from archive: %s').format(file.name); - const modal = new podmanUI.Modal(title, [ formContent ]); - modal.getButtons = () => [ - modal.getCloseButton(), - new podmanUI.ButtonNew(_('Import'), { - click: async () => { - await importForm.handleCreate(); - await this.section.handleRefresh(); - }, - type: 'positive', - }).render(), - ]; - modal.render(); - }); - - document.body.appendChild(fileInput); - fileInput.click(); - }, - - async handleExport() { - const selected = this.section.getSelectedData(); - - if (selected.length === 0) { - return this.section.showNoneSelectedWarning(); - } - - let errors = 0; - for (const [index, volume] of selected.entries()) { - this.loading(_('Exporting selected volumes: %d/%d').format(index + 1, selected.length)); - - const volumeName = volume.getName(); - try { - const blob = await fs.exec_direct('/usr/libexec/podman-api', ['volume_export', volumeName], 'blob'); - - const url = URL.createObjectURL(blob); - const a = E('a', { href: url, download: `${volumeName}.tar` }); - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - setTimeout(() => URL.revokeObjectURL(url), 100); - } catch (err) { - podmanUI.alert(_('Error: %s').format(err.message), 'error'); - errors++; - } - } - - ui.hideModal(); - - if (errors === 0) - this.success(_('All volumes exported successfully')); - }, -}); diff --git a/luci-app-podman/po/de/podman.po b/luci-app-podman/po/de/podman.po deleted file mode 100644 index f0825b810..000000000 --- a/luci-app-podman/po/de/podman.po +++ /dev/null @@ -1,1090 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: luci-app-podman\n" -"PO-Revision-Date: 2026-05-03 11:05+0000\n" -"Last-Translator:\n" -"Language-Team: German \n" -"Language: de\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "%d check(s) failed:" -msgstr "%d Prüfung(en) fehlgeschlagen:" - -msgid "%d updated, %d failed:" -msgstr "%d aktualisiert, %d fehlgeschlagen:" - -msgid "%s created successfully" -msgstr "%s erfolgreich erstellt" - -msgid "%s: %d/%d" -msgstr "%s: %d/%d" - -msgid "(none)" -msgstr "(keine)" - -msgid "-- Select %s --" -msgstr "-- %s auswählen --" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "1-253 Zeichen: Nur Buchstaben, Zahlen, Unterstriche (_) und Bindestriche (-)" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "512m, 1g oder -1 für unbegrenzt" - -msgid "API Version" -msgstr "API-Version" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "Container zu einem bestehenden Pod hinzufügen. Netzwerk, Hostname und Port-Mappings stammen vom Infra-Container des Pods." - -msgid "All images updated successfully" -msgstr "Alle Images erfolgreich aktualisiert" - -msgid "All volumes exported successfully" -msgstr "Alle Volumes erfolgreich exportiert" - -msgid "Allocate TTY (-t)" -msgstr "TTY zuweisen (-t)" - -msgid "Allocate container IP from this range" -msgstr "Container-IP aus diesem Bereich zuweisen" - -msgid "Always" -msgstr "Immer" - -msgid "Apply Updates" -msgstr "Updates anwenden" - -msgid "Are you sure to delete the records?" -msgstr "Einträge wirklich löschen?" - -msgid "Are you sure to remove container?" -msgstr "Container wirklich entfernen?" - -msgid "Are you sure to remove integration?" -msgstr "Integration wirklich entfernen?" - -msgid "Auto Remove (--rm)" -msgstr "Automatisch entfernen (--rm)" - -msgid "Auto Update" -msgstr "Automatische Aktualisierung" - -msgid "Auto-Update" -msgstr "Auto-Update" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "Netzwerkschnittstelle, Bridge und Firewall-Zone in OpenWrt automatisch konfigurieren. Dringend empfohlen für korrektes Container-Networking unter OpenWrt." - -msgid "Automatically start the container after it is created" -msgstr "Container nach der Erstellung automatisch starten" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "Container automatisch aktualisieren, wenn ein neueres Image verfügbar ist. Fügt Label hinzu: io.containers.autoupdate=registry" - -msgid "Basic Information" -msgstr "Basisinformationen" - -msgid "Block I/O" -msgstr "Block-I/O" - -msgid "Boot" -msgstr "Systemstart" - -msgid "Bridge Interface Name" -msgstr "Schnittstellenname der Bridge" - -msgid "CPU" -msgstr "CPU" - -msgid "CPU Limit" -msgstr "CPU-Limit" - -msgid "CPU Set" -msgstr "CPU-Set" - -msgid "CPU Shares Weight" -msgstr "CPU-Shares Gewichtung" - -msgid "CPU Usage" -msgstr "CPU-Auslastung" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "CPU-Anteile (relatives Gewicht). 0 = Standard." - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "CPUs, auf denen der Pod laufen darf (z. B. \"0-3\" oder \"0,2\")" - -msgid "Cancel" -msgstr "Abbrechen" - -msgid "Check" -msgstr "Prüfen" - -msgid "Check %d containers for updates?" -msgstr "%d Container auf Updates prüfen?" - -msgid "Check Complete" -msgstr "Prüfung abgeschlossen" - -msgid "Check for Updates" -msgstr "Auf Updates prüfen" - -msgid "Check for updates: %s/%s" -msgstr "Auf Updates prüfen: %s/%s" - -msgid "Choose firewall zone for this network." -msgstr "Firewall-Zone für dieses Netzwerk wählen." - -msgid "Clean Up Now" -msgstr "Jetzt bereinigen" - -msgid "Cleaning up old images..." -msgstr "Alte Images werden bereinigt..." - -msgid "Cleanup / Prune" -msgstr "Bereinigen / Prune" - -msgid "Cleanup Complete" -msgstr "Bereinigung abgeschlossen" - -msgid "Cleanup Unused Resources" -msgstr "Nicht verwendete Ressourcen bereinigen" - -msgid "Cleanup successful!" -msgstr "Bereinigung erfolgreich!" - -msgid "Clear logs" -msgstr "Protokolle leeren" - -msgid "Click icon to repair" -msgstr "Symbol anklicken zum Reparieren" - -msgid "Click to disconnect" -msgstr "Klicken zum Trennen" - -msgid "Click to enable/disable" -msgstr "Klicken zum Aktivieren/Deaktivieren" - -msgid "Click to reveal/hide value" -msgstr "Klicken zum Ein-/Ausblenden des Wertes" - -msgid "Close" -msgstr "Schließen" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "Kommagetrennte Liste zusätzlicher Gruppen-IDs" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "Durch Komma getrennte freizugebende Ports (z.B. 6052, 8080/udp)" - -msgid "Command" -msgstr "Befehl" - -msgid "Command to run (space-separated)" -msgstr "Auszuführender Befehl (leerzeichengetrennt)" - -msgid "Configuration" -msgstr "Konfiguration" - -msgid "Configure resource limits for this container." -msgstr "Ressourcenlimits für diesen Container konfigurieren." - -msgid "Confirm" -msgstr "Bestätigen" - -msgid "Connect" -msgstr "Verbinden" - -msgid "Connect to" -msgstr "Verbinden mit" - -msgid "Connected successfully to %s" -msgstr "Erfolgreich mit %s verbunden" - -msgid "Connecting container to network" -msgstr "Container mit Netzwerk verbinden" - -msgid "Console" -msgstr "Konsole" - -msgid "Container" -msgstr "Container" - -msgid "Container Name" -msgstr "Container-Name" - -msgid "Container image has no tag - cannot update" -msgstr "Container-Image hat kein Tag – Aktualisierung nicht möglich" - -msgid "Container image to use" -msgstr "Zu verwendendes Container-Image" - -msgid "Container is not running" -msgstr "Container läuft nicht" - -msgid "Container updated successfully" -msgstr "Container erfolgreich aktualisiert" - -msgid "Containers" -msgstr "Container" - -msgid "Containers in pod %s" -msgstr "Container im Pod %s" - -msgid "Containers updated successfully" -msgstr "Container erfolgreich aktualisiert" - -msgid "Containers updated successfully." -msgstr "Container erfolgreich aktualisiert." - -msgid "Create" -msgstr "Erstellen" - -msgid "Create %s" -msgstr "%s erstellen" - -msgid "Create Command" -msgstr "Erstellungsbefehl" - -msgid "Create Infra Container" -msgstr "Infra-Container erstellen" - -msgid "Create new zone (will be named: podman_)" -msgstr "Neue Zone erstellen (Name: podman_)" - -msgid "Created" -msgstr "Erstellt" - -msgid "Creating %s" -msgstr "Erstelle %s" - -msgid "Creating auto-start configuration for %s" -msgstr "Erstelle Autostart-Konfiguration für %s" - -msgid "DNS Search Domains" -msgstr "DNS-Suchdomänen" - -msgid "DNS Servers" -msgstr "DNS-Server" - -msgid "DNS search domains for the infra container" -msgstr "DNS-Suchdomänen für den Infra-Container" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "DNS-Server für den Infra-Container (gemeinsam für alle Container im Pod)" - -msgid "Delete" -msgstr "Löschen" - -msgid "Deleting records: %d/%d" -msgstr "Einträge werden gelöscht: %d/%d" - -msgid "Deleting records: %s/%s" -msgstr "Einträge werden gelöscht: %s/%s" - -msgid "Destination" -msgstr "Ziel" - -msgid "Device" -msgstr "Gerät" - -msgid "Disabled" -msgstr "Deaktiviert" - -msgid "Disabling init script" -msgstr "Init-Skript wird deaktiviert" - -msgid "Disconnect container from network" -msgstr "Container vom Netzwerk trennen" - -msgid "Disconnected from %s" -msgstr "Von %s getrennt" - -msgid "Dnsmasq" -msgstr "Dnsmasq" - -msgid "Driver" -msgstr "Treiber" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "Treiberspezifische Optionen (kommagetrennt, z. B. type=tmpfs,o=size=100m)" - -msgid "Enable IPv6" -msgstr "IPv6 aktivieren" - -msgid "Enable IPv6 networking" -msgstr "IPv6-Networking aktivieren" - -msgid "Enabling init script" -msgstr "Init-Skript wird aktiviert" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "Geheimnisdaten eingeben (Passwort, Token, Schlüssel etc.)" - -msgid "Entrypoint" -msgstr "Entrypoint" - -msgid "Environment Variables" -msgstr "Umgebungsvariablen" - -msgid "Ephemeral (--rm flag)" -msgstr "Temporär (--rm Flag)" - -msgid "Error" -msgstr "Fehler" - -msgid "Error: %s" -msgstr "Fehler: %s" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "Bestehende physische Schnittstelle als Parent. Erforderlich für macvlan/ipvlan-Netzwerke." - -msgid "Expecting: %s" -msgstr "Erwartet: %s" - -msgid "Export" -msgstr "Exportieren" - -msgid "Exporting selected volumes: %d/%d" -msgstr "Ausgewählte Volumes werden exportiert: %d/%d" - -msgid "Expose Ports" -msgstr "Ports freigeben" - -msgid "Failed to create container" -msgstr "Container konnte nicht erstellt werden" - -msgid "Fetching information..." -msgstr "Informationen werden abgerufen..." - -msgid "Find updateable containers" -msgstr "Aktualisierbare Container suchen" - -msgid "Firewall Zone" -msgstr "Firewall-Zone" - -msgid "Gateway" -msgstr "Gateway" - -msgid "Generate" -msgstr "Generieren" - -msgid "Graph Root" -msgstr "Graph-Root" - -msgid "Health" -msgstr "Gesundheit" - -msgid "Hostname" -msgstr "Hostname" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "Hostname des Pods (Standard: Pod-Name)" - -msgid "ID" -msgstr "ID" - -msgid "IP Address" -msgstr "IP-Adresse" - -msgid "IP Range (CIDR)" -msgstr "IP-Bereich (CIDR)" - -msgid "IPv4 Gateway" -msgstr "IPv4-Gateway" - -msgid "IPv4 Subnet (CIDR)" -msgstr "IPv4-Subnetz (CIDR)" - -msgid "IPv4 gateway address" -msgstr "IPv4-Gateway-Adresse" - -msgid "IPv4 subnet in CIDR notation" -msgstr "IPv4-Subnetz in CIDR-Notation" - -msgid "Image" -msgstr "Image" - -msgid "Image ID" -msgstr "Image-ID" - -msgid "Image is already up-to-date" -msgstr "Image ist bereits aktuell" - -msgid "Image pulled successfully" -msgstr "Image erfolgreich abgerufen" - -msgid "Images" -msgstr "Images" - -msgid "Import" -msgstr "Importieren" - -msgid "Import from archive: %s" -msgstr "Aus Archiv importieren: %s" - -msgid "Importing volume..." -msgstr "Importiere Volume..." - -msgid "Info" -msgstr "Info" - -msgid "Information" -msgstr "Informationen" - -msgid "Infra Image" -msgstr "Infra-Image" - -msgid "Init Script" -msgstr "Init-Skript" - -msgid "Inspect" -msgstr "Inspizieren" - -msgid "Int" -msgstr "Ganz" - -msgid "Interactive" -msgstr "Interaktiv" - -msgid "Interface" -msgstr "Schnittstelle" - -msgid "Internal Network" -msgstr "Internes Netzwerk" - -msgid "Labels" -msgstr "Labels" - -msgid "Labels in key=value format, one per line" -msgstr "Labels im Format Schlüssel=Wert, eines pro Zeile" - -msgid "Leave empty to auto-generate" -msgstr "Leer lassen für automatische Generierung" - -msgid "Links" -msgstr "Links" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "Linux-Namespaces, die von den Containern im Pod gemeinsam genutzt werden. Standard entspricht `podman pod create`." - -msgid "Load" -msgstr "Laden" - -msgid "Load System diagnostics" -msgstr "Systemdiagnose laden" - -msgid "Loading init script" -msgstr "Init-Skript wird geladen" - -msgid "Loading..." -msgstr "Lade..." - -msgid "Logs" -msgstr "Logs" - -msgid "Manage podman %s" -msgstr "Podman %s verwalten" - -msgid "Memory" -msgstr "Arbeitsspeicher" - -msgid "Memory %" -msgstr "Speicher %" - -msgid "Memory + Swap Limit" -msgstr "Limit für Arbeitsspeicher + Swap" - -msgid "Memory Limit" -msgstr "Speicherlimit" - -msgid "Memory Usage" -msgstr "Speicherauslastung" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "Speicherlimit (z. B. 512m, 1g)" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "Speicherlimit (z.B. 512m, 1g). -1 = unbegrenzt, 0 = Standard." - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "Speicherlimit für den Pod (z. B. 512m, 1g)" - -msgid "Mode" -msgstr "Modus" - -msgid "Mount Options" -msgstr "Mount-Optionen" - -msgid "Mountpoint" -msgstr "Mountpoint" - -msgid "Mounts" -msgstr "Mounts" - -msgid "Must be between 0 and 262144" -msgstr "Muss zwischen 0 und 262144 sein" - -msgid "Name" -msgstr "Name" - -msgid "Name for the network" -msgstr "Name für das Netzwerk" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "Name der Bridge-Schnittstelle (z. B. podman0, mynet0). Leer lassen für: <Netzwerkname>0. Hinweis: Falls der generierte Name mit einer bestehenden Schnittstelle kollidiert, wird OpenWrt ihn automatisch hochzählen." - -msgid "Name updated successfully" -msgstr "Name erfolgreich aktualisiert" - -msgid "Network" -msgstr "Netzwerk" - -msgid "Network I/O" -msgstr "Netzwerk-I/O" - -msgid "Network Mode" -msgstr "Netzwerkmodus" - -msgid "Network Name" -msgstr "Netzwerkname" - -msgid "Network driver" -msgstr "Netzwerktreiber" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "Netzwerk-Namespace für den Pod. Container im Pod teilen sich dieses Netzwerk." - -msgid "Networks" -msgstr "Netzwerke" - -msgid "Never" -msgstr "Nie" - -msgid "No" -msgstr "Nein" - -msgid "No %s selected" -msgstr "Keine %s ausgewählt" - -msgid "No containers in this pod" -msgstr "Keine Container in diesem Pod" - -msgid "No containers with auto-update label found." -msgstr "Keine Container mit Auto-Update-Label gefunden." - -msgid "No new updates available." -msgstr "Keine neuen Updates verfügbar." - -msgid "No suitable interfaces found" -msgstr "Keine geeigneten Schnittstellen gefunden" - -msgid "No unused resources found" -msgstr "Keine ungenutzten Ressourcen gefunden" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "Anzahl der CPUs (z. B. 0.5, 1.0, 2.0)" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "Anzahl der CPUs (z. B. 0.5, 1.0, 2.0). Leer lassen für unbegrenzt." - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "Anzahl der CPUs für den Pod (z. B. 0.5, 1.0, 2.0)" - -msgid "Number of lines" -msgstr "Anzahl der Zeilen" - -msgid "OK" -msgstr "OK" - -msgid "Old image still used by other containers" -msgstr "Altes Image wird noch von anderen Containern verwendet" - -msgid "On Failure" -msgstr "Bei Fehler" - -msgid "One per line, format: host:container[/protocol]" -msgstr "Einer pro Zeile, Format: Host:Container[/Protokoll]" - -msgid "One per line, format: key=value" -msgstr "Einer pro Zeile, Format: Schlüssel=Wert" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "Einer pro Zeile. Format: Quelle:Ziel[:Optionen]. Optionen: ro, rw, Z, z" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "OpenWrt-Integration vorhanden\n\nKlicken zum Entfernen" - -msgid "OpenWrt integration incomplete" -msgstr "OpenWrt-Integration unvollständig" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "OpenWrt-Integration erfordert die Angabe eines Subnetzes" - -msgid "Override the image used for the infra container" -msgstr "Image für den Infra-Container überschreiben" - -msgid "PIDs" -msgstr "PIDs" - -msgid "Parent Interface" -msgstr "Parent-Schnittstelle" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "Parent-Schnittstelle ist für macvlan/ipvlan-Netzwerke erforderlich" - -msgid "Part of a pod (\"%s\")" -msgstr "Teil eines Pods (\"%s\")" - -msgid "Pausing pod" -msgstr "Pod wird pausiert" - -msgid "Pod" -msgstr "Pod" - -msgid "Pod Name" -msgstr "Pod-Name" - -msgid "Podman Version" -msgstr "Podman-Version" - -msgid "Pods" -msgstr "Pods" - -msgid "Port Mappings" -msgstr "Port-Mappings" - -msgid "Ports" -msgstr "Ports" - -msgid "Privileged" -msgstr "Privilegiert" - -msgid "Privileged Mode" -msgstr "Privilegierter Modus" - -msgid "Processes" -msgstr "Prozesse" - -msgid "Pull Image" -msgstr "Image abrufen" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "Pull hat keine Image-ID zurückgegeben – Pull möglicherweise fehlgeschlagen" - -msgid "Pulling %s" -msgstr "%s wird abgerufen" - -msgid "Read: %s / Write: %s" -msgstr "Gelesen: %s / Geschrieben: %s" - -msgid "Refreshing %s..." -msgstr "Aktualisiere %s..." - -msgid "Registries" -msgstr "Registries" - -msgid "Registry" -msgstr "Registry" - -msgid "Reload" -msgstr "Neu laden" - -msgid "Remove OpenWrt integration" -msgstr "OpenWrt-Integration entfernen" - -msgid "Remove all unused images (not just dangling)" -msgstr "Alle ungenutzten Images entfernen (nicht nur verwaiste)" - -msgid "Remove container" -msgstr "Container entfernen" - -msgid "Remove unused volumes" -msgstr "Ungenutzte Volumes entfernen" - -msgid "Removed: %s" -msgstr "Entfernt: %s" - -msgid "Removing unused resources, please wait..." -msgstr "Ungenutzte Ressourcen werden entfernt, bitte warten..." - -msgid "Repository" -msgstr "Repository" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "Erforderlich für gemeinsamen Netzwerk-Namespace. Nur deaktivieren, wenn nicht benötigt." - -msgid "Resources" -msgstr "Ressourcen" - -msgid "Restart Policy" -msgstr "Restart-Policy" - -msgid "Restart container" -msgstr "Container neu starten" - -msgid "Restart policy updated successfully" -msgstr "Restart-Policy erfolgreich aktualisiert" - -msgid "Restarting pod" -msgstr "Pod wird neu gestartet" - -msgid "Restrict external access to the network" -msgstr "Externen Zugriff auf das Netzwerk einschränken" - -msgid "Run Root" -msgstr "Run-Root" - -msgid "Saving resource" -msgstr "Ressource wird gespeichert" - -msgid "Secret" -msgstr "Geheimnis (Secret)" - -msgid "Secret Data" -msgstr "Geheimnisdaten" - -msgid "Secret Name" -msgstr "Geheimnis-Name" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "Name des Geheimnisses darf nur Buchstaben, Zahlen, Unterstriche und Bindestriche enthalten" - -msgid "Secrets" -msgstr "Geheimnisse" - -msgid "Security Notice:" -msgstr "Sicherheitshinweis:" - -msgid "Select containers to update" -msgstr "Container zum Aktualisieren auswählen" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "Netzwerk für den neuen Container auswählen. Benutzerdefinierte Netzwerke bieten bessere Isolation und DNS-Auflösung zwischen Containern." - -msgid "Select what to clean up:" -msgstr "Wählen Sie aus, was bereinigt werden soll:" - -msgid "Sensitive data is hidden for security reasons." -msgstr "Sensible Daten sind aus Sicherheitsgründen ausgeblendet." - -msgid "Setup OpenWrt Integration" -msgstr "OpenWrt-Integration einrichten" - -msgid "Shared Namespaces" -msgstr "Gemeinsame Namespaces" - -msgid "Shares network with another container" -msgstr "Teilt Netzwerk mit einem anderen Container" - -msgid "Show" -msgstr "Anzeigen" - -msgid "Since" -msgstr "Seit" - -msgid "Size" -msgstr "Größe" - -msgid "Socket Path" -msgstr "Socket-Pfad" - -msgid "Source" -msgstr "Quelle" - -msgid "Space freed: %s" -msgstr "Freigewordener Platz: %s" - -msgid "Start after creation" -msgstr "Nach Erstellung starten" - -msgid "Start container" -msgstr "Container starten" - -msgid "Start on boot" -msgstr "Beim Systemstart starten" - -msgid "Start script disabled" -msgstr "Startskript deaktiviert" - -msgid "Start script missing\n\nClick to generate" -msgstr "Startskript fehlt\n\nKlicken zum Generieren" - -msgid "Start stream" -msgstr "Stream starten" - -msgid "Started" -msgstr "Gestartet" - -msgid "Started At" -msgstr "Gestartet um" - -msgid "Starting pod" -msgstr "Pod wird gestartet" - -msgid "Statistics" -msgstr "Statistiken" - -msgid "Stats" -msgstr "Stats" - -msgid "Status" -msgstr "Status" - -msgid "Stop container" -msgstr "Container stoppen" - -msgid "Stop stream" -msgstr "Stream stoppen" - -msgid "Stopping pod" -msgstr "Pod wird gestoppt" - -msgid "Subnet" -msgstr "Subnetz" - -msgid "Supplementary Groups" -msgstr "Zusätzliche Gruppen" - -msgid "System Diagnostics" -msgstr "Systemdiagnose" - -msgid "TTY" -msgstr "TTY" - -msgid "Tag" -msgstr "Tag" - -msgid "The sensitive data to store securely" -msgstr "Die sensiblen Daten, die sicher gespeichert werden sollen" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "Für automatische Aktualisierung das Label hinzufügen: io.containers.autoupdate=registry" - -msgid "Total" -msgstr "Gesamt" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "Gesamtspeicherlimit (Speicher + Swap). -1 = unbegrenzt, 0 = Standard." - -msgid "Type" -msgstr "Typ" - -msgid "Unknown" -msgstr "Unbekannt" - -msgid "Unless Stopped" -msgstr "Sofern nicht gestoppt" - -msgid "Until" -msgstr "Bis" - -msgid "Update" -msgstr "Aktualisieren" - -msgid "Update Resources" -msgstr "Ressourcen aktualisieren" - -msgid "Update name" -msgstr "Name aktualisieren" - -msgid "Update restart policy" -msgstr "Neustart-Richtlinie aktualisieren" - -msgid "Updating Images" -msgstr "Images werden aktualisiert" - -msgid "Updating container" -msgstr "Container wird aktualisiert" - -msgid "Upload failed: %s" -msgstr "Upload fehlgeschlagen: %s" - -msgid "Uploading file..." -msgstr "Datei wird hochgeladen..." - -msgid "User" -msgstr "Benutzer" - -msgid "User and group to run as (UID:GID)" -msgstr "Benutzer und Gruppe (UID:GID)" - -msgid "Value" -msgstr "Wert" - -msgid "Variable" -msgstr "Variable" - -msgid "Volume" -msgstr "Volume" - -msgid "Volume Name" -msgstr "Volume-Name" - -msgid "Volume driver to use" -msgstr "Zu verwendender Volume-Treiber" - -msgid "Volume imported successfully" -msgstr "Volume erfolgreich importiert" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "Volume-Name. Leer lassen für automatische Generierung." - -msgid "Volumes" -msgstr "Volumes" - -msgid "Working Directory" -msgstr "Arbeitsverzeichnis" - -msgid "Yes" -msgstr "Ja" - -msgid "default" -msgstr "Standard" - -msgid "non-empty value" -msgstr "nicht leerer Wert" - -msgid "running" -msgstr "läuft" - -msgid "total" -msgstr "gesamt" - -msgid "Are you sure to remove pod?" -msgstr "Pod wirklich entfernen?" - -msgid "Cgroup parent" -msgstr "Cgroup-Parent" - -msgid "CID" -msgstr "CID" - -msgid "CPU %" -msgstr "CPU-%" - -msgid "CPU period" -msgstr "CPU-Periode" - -msgid "CPU quota" -msgstr "CPU-Quote" - -msgid "CPU set" -msgstr "CPU-Set" - -msgid "CPU shares" -msgstr "CPU-Shares" - -msgid "DNS options" -msgstr "DNS-Optionen" - -msgid "DNS search" -msgstr "DNS-Suche" - -msgid "DNS servers" -msgstr "DNS-Server" - -msgid "Exit policy" -msgstr "Exit-Policy" - -msgid "Extra hosts" -msgstr "Zusätzliche Hosts" - -msgid "Host network" -msgstr "Host-Netzwerk" - -msgid "Infra container" -msgstr "Infra-Container" - -msgid "Memory limit" -msgstr "Speicherlimit" - -msgid "Net I/O" -msgstr "Netzwerk-I/O" - -msgid "Pause pod" -msgstr "Pod pausieren" - -msgid "Pod is not running" -msgstr "Pod läuft nicht" - -msgid "Remove pod" -msgstr "Pod entfernen" - -msgid "Restart policy" -msgstr "Restart-Policy" - -msgid "Restart pod" -msgstr "Pod neustarten" - -msgid "Shared namespaces" -msgstr "Gemeinsame Namespaces" - -msgid "Start pod" -msgstr "Pod starten" - -msgid "Static IPv4" -msgstr "Statische IPv4" - -msgid "Static MAC" -msgstr "Statische MAC" - -msgid "Stop pod" -msgstr "Pod stoppen" - -msgid "Unlimited" -msgstr "Unbegrenzt" - -msgid "Unpause pod" -msgstr "Pod fortsetzen" - -msgid "Stopping container" -msgstr "Container wird gestoppt" - -msgid "Stop failed: %s" -msgstr "Stoppen fehlgeschlagen: %s" - -msgid "Removing container" -msgstr "Container wird entfernt" - -msgid "Remove failed: %s" -msgstr "Entfernen fehlgeschlagen: %s" - -msgid "Creating container" -msgstr "Container wird erstellt" - -msgid "Create failed: %s" -msgstr "Erstellen fehlgeschlagen: %s" - -msgid "Starting container" -msgstr "Container wird gestartet" - -msgid "Start failed: %s" -msgstr "Start fehlgeschlagen: %s" - -msgid "Reinstating init script" -msgstr "Init-Skript wird wiederhergestellt" - -msgid "Init script reinstate failed: %s" -msgstr "Wiederherstellen des Init-Skripts fehlgeschlagen: %s" - -msgid "Updated to %s" -msgstr "Auf %s aktualisiert" - -msgid "Update image: %d/%d - %s" -msgstr "Image aktualisieren: %d/%d - %s" - -msgid "Removed old image %s" -msgstr "Altes Image %s entfernt" - -msgid "Done." -msgstr "Fertig." - -msgid "Pause container" -msgstr "Container pausieren" - -msgid "Unpause container" -msgstr "Container fortsetzen" diff --git a/luci-app-podman/po/es/podman.po b/luci-app-podman/po/es/podman.po deleted file mode 100644 index 129901400..000000000 --- a/luci-app-podman/po/es/podman.po +++ /dev/null @@ -1,1090 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: luci-app-podman\n" -"PO-Revision-Date: 2026-05-03 11:05+0000\n" -"Last-Translator:\n" -"Language-Team: Dutch \n" -"Language: es\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "%d check(s) failed:" -msgstr "%d comprobación(es) fallida(s):" - -msgid "%d updated, %d failed:" -msgstr "%d actualizados, %d fallidos:" - -msgid "%s created successfully" -msgstr "%s creado correctamente" - -msgid "%s: %d/%d" -msgstr "%s: %d/%d" - -msgid "(none)" -msgstr "(ninguno)" - -msgid "-- Select %s --" -msgstr "-- Seleccionar %s --" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "1-253 caracteres: solo letras, números, guion bajo (_) y guion (-)" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "512m, 1g o -1 para ilimitado" - -msgid "API Version" -msgstr "Versión de la API" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "Añadir el contenedor a un pod existente. La red, el nombre de host y los mapeos de puertos provienen del contenedor infra del pod." - -msgid "All images updated successfully" -msgstr "Todas las imágenes actualizadas correctamente" - -msgid "All volumes exported successfully" -msgstr "Todos los volúmenes se exportaron correctamente" - -msgid "Allocate TTY (-t)" -msgstr "Asignar TTY (-t)" - -msgid "Allocate container IP from this range" -msgstr "Asignar IP del contenedor desde este rango" - -msgid "Always" -msgstr "Siempre" - -msgid "Apply Updates" -msgstr "Aplicar actualizaciones" - -msgid "Are you sure to delete the records?" -msgstr "¿Eliminar los registros?" - -msgid "Are you sure to remove container?" -msgstr "¿Eliminar el contenedor?" - -msgid "Are you sure to remove integration?" -msgstr "¿Eliminar la integración?" - -msgid "Auto Remove (--rm)" -msgstr "Eliminación automática (--rm)" - -msgid "Auto Update" -msgstr "Actualización automática" - -msgid "Auto-Update" -msgstr "Actualización automática" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "Configura automáticamente la interfaz de red, el puente y la zona de firewall de OpenWrt. Muy recomendado para una red de contenedores adecuada en OpenWrt." - -msgid "Automatically start the container after it is created" -msgstr "Iniciar automáticamente el contenedor después de crearlo" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "Actualizar automáticamente el contenedor cuando haya una imagen más reciente. Añade la etiqueta: io.containers.autoupdate=registry" - -msgid "Basic Information" -msgstr "Información básica" - -msgid "Block I/O" -msgstr "E/S de bloque" - -msgid "Boot" -msgstr "Arranque" - -msgid "Bridge Interface Name" -msgstr "Nombre de la interfaz puente" - -msgid "CPU" -msgstr "CPU" - -msgid "CPU Limit" -msgstr "Límite de CPU" - -msgid "CPU Set" -msgstr "Conjunto de CPU" - -msgid "CPU Shares Weight" -msgstr "Peso de CPU shares" - -msgid "CPU Usage" -msgstr "Uso de CPU" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "Cuotas de CPU (peso relativo). 0 = usar predeterminado." - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "CPUs en las que el pod puede ejecutarse (p. ej., \"0-3\" o \"0,2\")" - -msgid "Cancel" -msgstr "Cancelar" - -msgid "Check" -msgstr "Comprobar" - -msgid "Check %d containers for updates?" -msgstr "¿Comprobar actualizaciones de %d contenedores?" - -msgid "Check Complete" -msgstr "Comprobación completa" - -msgid "Check for Updates" -msgstr "Buscar actualizaciones" - -msgid "Check for updates: %s/%s" -msgstr "Buscando actualizaciones: %s/%s" - -msgid "Choose firewall zone for this network." -msgstr "Elegir zona de firewall para esta red." - -msgid "Clean Up Now" -msgstr "Limpiar ahora" - -msgid "Cleaning up old images..." -msgstr "Eliminando imágenes antiguas..." - -msgid "Cleanup / Prune" -msgstr "Limpiar / Purgar" - -msgid "Cleanup Complete" -msgstr "Limpieza completada" - -msgid "Cleanup Unused Resources" -msgstr "Limpiar recursos no utilizados" - -msgid "Cleanup successful!" -msgstr "¡Limpieza exitosa!" - -msgid "Clear logs" -msgstr "Borrar registros" - -msgid "Click icon to repair" -msgstr "Haz clic en el icono para reparar" - -msgid "Click to disconnect" -msgstr "Clic para desconectar" - -msgid "Click to enable/disable" -msgstr "Clic para habilitar/deshabilitar" - -msgid "Click to reveal/hide value" -msgstr "Haga clic para mostrar/ocultar el valor" - -msgid "Close" -msgstr "Cerrar" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "Lista de IDs de grupos suplementarios separados por coma" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "Puertos a exponer separados por coma (ej. 6052, 8080/udp)" - -msgid "Command" -msgstr "Comando" - -msgid "Command to run (space-separated)" -msgstr "Comando a ejecutar (separado por espacios)" - -msgid "Configuration" -msgstr "Configuración" - -msgid "Configure resource limits for this container." -msgstr "Configurar límites de recursos para este contenedor." - -msgid "Confirm" -msgstr "Confirmar" - -msgid "Connect" -msgstr "Conectar" - -msgid "Connect to" -msgstr "Conectar a" - -msgid "Connected successfully to %s" -msgstr "Conectado correctamente a %s" - -msgid "Connecting container to network" -msgstr "Conectando contenedor a la red" - -msgid "Console" -msgstr "Consola" - -msgid "Container" -msgstr "Contenedor" - -msgid "Container Name" -msgstr "Nombre del contenedor" - -msgid "Container image has no tag - cannot update" -msgstr "La imagen del contenedor no tiene etiqueta - no se puede actualizar" - -msgid "Container image to use" -msgstr "Imagen de contenedor a usar" - -msgid "Container is not running" -msgstr "El contenedor no está en ejecución" - -msgid "Container updated successfully" -msgstr "Contenedor actualizado correctamente" - -msgid "Containers" -msgstr "Contenedores" - -msgid "Containers in pod %s" -msgstr "Contenedores en el pod %s" - -msgid "Containers updated successfully" -msgstr "Contenedores actualizados correctamente" - -msgid "Containers updated successfully." -msgstr "Contenedores actualizados correctamente." - -msgid "Create" -msgstr "Crear" - -msgid "Create %s" -msgstr "Crear %s" - -msgid "Create Command" -msgstr "Comando de creación" - -msgid "Create Infra Container" -msgstr "Crear contenedor infra" - -msgid "Create new zone (will be named: podman_)" -msgstr "Crear nueva zona (se llamará: podman_)" - -msgid "Created" -msgstr "Creado" - -msgid "Creating %s" -msgstr "Creando %s" - -msgid "Creating auto-start configuration for %s" -msgstr "Creando configuración de inicio automático para %s" - -msgid "DNS Search Domains" -msgstr "Dominios de búsqueda DNS" - -msgid "DNS Servers" -msgstr "Servidores DNS" - -msgid "DNS search domains for the infra container" -msgstr "Dominios de búsqueda DNS para el contenedor infra" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "Servidores DNS para el contenedor infra (compartidos con todos los contenedores del pod)" - -msgid "Delete" -msgstr "Eliminar" - -msgid "Deleting records: %d/%d" -msgstr "Eliminando registros: %d/%d" - -msgid "Deleting records: %s/%s" -msgstr "Eliminando registros: %s/%s" - -msgid "Destination" -msgstr "Destino" - -msgid "Device" -msgstr "Dispositivo" - -msgid "Disabled" -msgstr "Desactivado" - -msgid "Disabling init script" -msgstr "Desactivando script de inicio" - -msgid "Disconnect container from network" -msgstr "Desconectar contenedor de la red" - -msgid "Disconnected from %s" -msgstr "Desconectado de %s" - -msgid "Dnsmasq" -msgstr "Dnsmasq" - -msgid "Driver" -msgstr "Controlador" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "Opciones específicas del controlador (separadas por comas, ej. type=tmpfs,o=size=100m)" - -msgid "Enable IPv6" -msgstr "Activar IPv6" - -msgid "Enable IPv6 networking" -msgstr "Activar red IPv6" - -msgid "Enabling init script" -msgstr "Activando script de inicio" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "Introduzca datos secretos (contraseña, token, clave, etc.)" - -msgid "Entrypoint" -msgstr "Punto de entrada (Entrypoint)" - -msgid "Environment Variables" -msgstr "Variables de entorno" - -msgid "Ephemeral (--rm flag)" -msgstr "Efímero (opción --rm)" - -msgid "Error" -msgstr "Error" - -msgid "Error: %s" -msgstr "Error: %s" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "Interfaz física existente para usar como padre. Requerido para redes macvlan/ipvlan." - -msgid "Expecting: %s" -msgstr "Se espera: %s" - -msgid "Export" -msgstr "Exportar" - -msgid "Exporting selected volumes: %d/%d" -msgstr "Exportando volúmenes seleccionados: %d/%d" - -msgid "Expose Ports" -msgstr "Exponer puertos" - -msgid "Failed to create container" -msgstr "Error al crear el contenedor" - -msgid "Fetching information..." -msgstr "Obteniendo información..." - -msgid "Find updateable containers" -msgstr "Buscar contenedores actualizables" - -msgid "Firewall Zone" -msgstr "Zona de firewall" - -msgid "Gateway" -msgstr "Puerta de enlace" - -msgid "Generate" -msgstr "Generar" - -msgid "Graph Root" -msgstr "Raíz del gráfico (Graph Root)" - -msgid "Health" -msgstr "Salud" - -msgid "Hostname" -msgstr "Nombre de host" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "Nombre de host del pod (por defecto, el nombre del pod)" - -msgid "ID" -msgstr "ID" - -msgid "IP Address" -msgstr "Dirección IP" - -msgid "IP Range (CIDR)" -msgstr "Rango de IP (CIDR)" - -msgid "IPv4 Gateway" -msgstr "Puerta de enlace IPv4" - -msgid "IPv4 Subnet (CIDR)" -msgstr "Subred IPv4 (CIDR)" - -msgid "IPv4 gateway address" -msgstr "Dirección de puerta de enlace IPv4" - -msgid "IPv4 subnet in CIDR notation" -msgstr "Subred IPv4 en notación CIDR" - -msgid "Image" -msgstr "Imagen" - -msgid "Image ID" -msgstr "ID de imagen" - -msgid "Image is already up-to-date" -msgstr "La imagen ya está actualizada" - -msgid "Image pulled successfully" -msgstr "Imagen descargada correctamente" - -msgid "Images" -msgstr "Imágenes" - -msgid "Import" -msgstr "Importar" - -msgid "Import from archive: %s" -msgstr "Importar desde archivo: %s" - -msgid "Importing volume..." -msgstr "Importando volumen..." - -msgid "Info" -msgstr "Info" - -msgid "Information" -msgstr "Información" - -msgid "Infra Image" -msgstr "Imagen infra" - -msgid "Init Script" -msgstr "Script de inicio" - -msgid "Inspect" -msgstr "Inspeccionar" - -msgid "Int" -msgstr "Ent" - -msgid "Interactive" -msgstr "Interactivo" - -msgid "Interface" -msgstr "Interfaz" - -msgid "Internal Network" -msgstr "Red interna" - -msgid "Labels" -msgstr "Etiquetas" - -msgid "Labels in key=value format, one per line" -msgstr "Etiquetas en formato clave=valor, una por línea" - -msgid "Leave empty to auto-generate" -msgstr "Dejar vacío para generar automáticamente" - -msgid "Links" -msgstr "Enlaces" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "Namespaces de Linux compartidos entre los contenedores del pod. El valor por defecto coincide con `podman pod create`." - -msgid "Load" -msgstr "Cargar" - -msgid "Load System diagnostics" -msgstr "Cargar diagnósticos del sistema" - -msgid "Loading init script" -msgstr "Cargando script de inicio" - -msgid "Loading..." -msgstr "Cargando..." - -msgid "Logs" -msgstr "Registros" - -msgid "Manage podman %s" -msgstr "Gestionar podman %s" - -msgid "Memory" -msgstr "Memoria" - -msgid "Memory %" -msgstr "Memoria %" - -msgid "Memory + Swap Limit" -msgstr "Límite de memoria + intercambio" - -msgid "Memory Limit" -msgstr "Límite de memoria" - -msgid "Memory Usage" -msgstr "Uso de memoria" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "Límite de memoria (ej. 512m, 1g)" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "Límite de memoria (ej. 512m, 1g). -1 = ilimitado, 0 = predeterminado." - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "Límite de memoria para el pod (p. ej., 512m, 1g)" - -msgid "Mode" -msgstr "Modo" - -msgid "Mount Options" -msgstr "Opciones de montaje" - -msgid "Mountpoint" -msgstr "Punto de montaje" - -msgid "Mounts" -msgstr "Montajes" - -msgid "Must be between 0 and 262144" -msgstr "Debe estar entre 0 y 262144" - -msgid "Name" -msgstr "Nombre" - -msgid "Name for the network" -msgstr "Nombre para la red" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "Nombre de la interfaz puente (ej. podman0, mynet0). Dejar vacío para usar: <nombre-de-red>0. Nota: Si el nombre entra en conflicto con uno existente, OpenWrt lo incrementará." - -msgid "Name updated successfully" -msgstr "Nombre actualizado correctamente" - -msgid "Network" -msgstr "Red" - -msgid "Network I/O" -msgstr "E/S de red" - -msgid "Network Mode" -msgstr "Modo de red" - -msgid "Network Name" -msgstr "Nombre de la red" - -msgid "Network driver" -msgstr "Controlador de red" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "Namespace de red para el pod. Los contenedores del pod comparten esta red." - -msgid "Networks" -msgstr "Redes" - -msgid "Never" -msgstr "Nunca" - -msgid "No" -msgstr "No" - -msgid "No %s selected" -msgstr "No hay %s seleccionado" - -msgid "No containers in this pod" -msgstr "No hay contenedores en este pod" - -msgid "No containers with auto-update label found." -msgstr "No se encontraron contenedores con la etiqueta de actualización automática." - -msgid "No new updates available." -msgstr "No hay nuevas actualizaciones disponibles." - -msgid "No suitable interfaces found" -msgstr "No se encontraron interfaces adecuadas" - -msgid "No unused resources found" -msgstr "No se encontraron recursos sin usar" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "Número de CPUs (ej. 0.5, 1.0, 2.0)" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "Número de CPUs (ej. 0.5, 1.0, 2.0). Dejar vacío para ilimitado." - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "Número de CPUs disponibles para el pod (p. ej., 0.5, 1.0, 2.0)" - -msgid "Number of lines" -msgstr "Número de líneas" - -msgid "OK" -msgstr "Aceptar" - -msgid "Old image still used by other containers" -msgstr "La imagen antigua aún la usan otros contenedores" - -msgid "On Failure" -msgstr "En caso de fallo" - -msgid "One per line, format: host:container[/protocol]" -msgstr "Uno por línea, formato: host:contenedor[/protocolo]" - -msgid "One per line, format: key=value" -msgstr "Uno por línea, formato: clave=valor" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "Uno por línea. Formato: origen:destino[:opciones]. Opciones: ro, rw, Z, z" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "Integración OpenWrt existente\n\nClic para eliminar" - -msgid "OpenWrt integration incomplete" -msgstr "Integración OpenWrt incompleta" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "La integración de OpenWrt requiere especificar una subred" - -msgid "Override the image used for the infra container" -msgstr "Sobrescribir la imagen utilizada para el contenedor infra" - -msgid "PIDs" -msgstr "PIDs" - -msgid "Parent Interface" -msgstr "Interfaz padre" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "La interfaz padre es obligatoria para redes macvlan/ipvlan" - -msgid "Part of a pod (\"%s\")" -msgstr "Parte de un pod (\"%s\")" - -msgid "Pausing pod" -msgstr "Pausando pod" - -msgid "Pod" -msgstr "Pod" - -msgid "Pod Name" -msgstr "Nombre del pod" - -msgid "Podman Version" -msgstr "Versión de Podman" - -msgid "Pods" -msgstr "Pods" - -msgid "Port Mappings" -msgstr "Mapeo de puertos" - -msgid "Ports" -msgstr "Puertos" - -msgid "Privileged" -msgstr "Privilegiado" - -msgid "Privileged Mode" -msgstr "Modo privilegiado" - -msgid "Processes" -msgstr "Procesos" - -msgid "Pull Image" -msgstr "Descargar imagen" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "El pull no devolvió un ID de imagen - el pull puede haber fallado" - -msgid "Pulling %s" -msgstr "Descargando %s" - -msgid "Read: %s / Write: %s" -msgstr "Lectura: %s / Escritura: %s" - -msgid "Refreshing %s..." -msgstr "Actualizando %s..." - -msgid "Registries" -msgstr "Registros (Registries)" - -msgid "Registry" -msgstr "Registro" - -msgid "Reload" -msgstr "Recargar" - -msgid "Remove OpenWrt integration" -msgstr "Eliminar integración OpenWrt" - -msgid "Remove all unused images (not just dangling)" -msgstr "Eliminar todas las imágenes sin usar (no solo las huérfanas)" - -msgid "Remove container" -msgstr "Eliminar contenedor" - -msgid "Remove unused volumes" -msgstr "Eliminar volúmenes sin usar" - -msgid "Removed: %s" -msgstr "Eliminado: %s" - -msgid "Removing unused resources, please wait..." -msgstr "Eliminando recursos sin usar, espere..." - -msgid "Repository" -msgstr "Repositorio" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "Requerido para el namespace de red compartido. Desactivar solo si está seguro de no necesitarlo." - -msgid "Resources" -msgstr "Recursos" - -msgid "Restart Policy" -msgstr "Política de reinicio" - -msgid "Restart container" -msgstr "Reiniciar contenedor" - -msgid "Restart policy updated successfully" -msgstr "Política de reinicio actualizada correctamente" - -msgid "Restarting pod" -msgstr "Reiniciando pod" - -msgid "Restrict external access to the network" -msgstr "Restringir el acceso externo a la red" - -msgid "Run Root" -msgstr "Raíz de ejecución (Run Root)" - -msgid "Saving resource" -msgstr "Guardando recurso" - -msgid "Secret" -msgstr "Secreto (Secret)" - -msgid "Secret Data" -msgstr "Datos secretos" - -msgid "Secret Name" -msgstr "Nombre del secreto" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "El nombre del secreto solo puede contener letras, números, guiones bajos y guiones" - -msgid "Secrets" -msgstr "Secretos" - -msgid "Security Notice:" -msgstr "Aviso de seguridad:" - -msgid "Select containers to update" -msgstr "Seleccionar contenedores para actualizar" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "Seleccionar red para el nuevo contenedor. Las redes de usuario ofrecen mejor aislamiento y resolución DNS entre contenedores." - -msgid "Select what to clean up:" -msgstr "Seleccione qué limpiar:" - -msgid "Sensitive data is hidden for security reasons." -msgstr "Los datos sensibles están ocultos por razones de seguridad." - -msgid "Setup OpenWrt Integration" -msgstr "Configurar integración de OpenWrt" - -msgid "Shared Namespaces" -msgstr "Namespaces compartidos" - -msgid "Shares network with another container" -msgstr "Comparte red con otro contenedor" - -msgid "Show" -msgstr "Mostrar" - -msgid "Since" -msgstr "Desde" - -msgid "Size" -msgstr "Tamaño" - -msgid "Socket Path" -msgstr "Ruta del socket" - -msgid "Source" -msgstr "Origen" - -msgid "Space freed: %s" -msgstr "Espacio liberado: %s" - -msgid "Start after creation" -msgstr "Iniciar tras la creación" - -msgid "Start container" -msgstr "Iniciar contenedor" - -msgid "Start on boot" -msgstr "Iniciar al arrancar" - -msgid "Start script disabled" -msgstr "Script de inicio desactivado" - -msgid "Start script missing\n\nClick to generate" -msgstr "Script de inicio faltante\n\nHaga clic para generar" - -msgid "Start stream" -msgstr "Iniciar transmisión" - -msgid "Started" -msgstr "Iniciado" - -msgid "Started At" -msgstr "Iniciado en" - -msgid "Starting pod" -msgstr "Iniciando pod" - -msgid "Statistics" -msgstr "Estadísticas" - -msgid "Stats" -msgstr "Estadísticas" - -msgid "Status" -msgstr "Estado" - -msgid "Stop container" -msgstr "Detener contenedor" - -msgid "Stop stream" -msgstr "Detener transmisión" - -msgid "Stopping pod" -msgstr "Deteniendo pod" - -msgid "Subnet" -msgstr "Subred" - -msgid "Supplementary Groups" -msgstr "Grupos suplementarios" - -msgid "System Diagnostics" -msgstr "Diagnósticos del sistema" - -msgid "TTY" -msgstr "TTY" - -msgid "Tag" -msgstr "Etiqueta" - -msgid "The sensitive data to store securely" -msgstr "Los datos sensibles a almacenar de forma segura" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "Para habilitar la actualización automática, añadir la etiqueta: io.containers.autoupdate=registry" - -msgid "Total" -msgstr "Total" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "Límite de memoria total (memoria + swap). -1 = ilimitado, 0 = predeterminado." - -msgid "Type" -msgstr "Tipo" - -msgid "Unknown" -msgstr "Desconocido" - -msgid "Unless Stopped" -msgstr "A menos que se detenga (Unless Stopped)" - -msgid "Until" -msgstr "Hasta" - -msgid "Update" -msgstr "Actualizar" - -msgid "Update Resources" -msgstr "Actualizar recursos" - -msgid "Update name" -msgstr "Actualizar nombre" - -msgid "Update restart policy" -msgstr "Actualizar política de reinicio" - -msgid "Updating Images" -msgstr "Actualizando imágenes" - -msgid "Updating container" -msgstr "Actualizando contenedor" - -msgid "Upload failed: %s" -msgstr "Error al subir: %s" - -msgid "Uploading file..." -msgstr "Subiendo archivo..." - -msgid "User" -msgstr "Usuario" - -msgid "User and group to run as (UID:GID)" -msgstr "Usuario y grupo (UID:GID)" - -msgid "Value" -msgstr "Valor" - -msgid "Variable" -msgstr "Variable" - -msgid "Volume" -msgstr "Volumen" - -msgid "Volume Name" -msgstr "Nombre del volumen" - -msgid "Volume driver to use" -msgstr "Controlador de volumen a usar" - -msgid "Volume imported successfully" -msgstr "Volumen importado correctamente" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "Nombre del volumen. Dejar vacío para generar automáticamente." - -msgid "Volumes" -msgstr "Volúmenes" - -msgid "Working Directory" -msgstr "Directorio de trabajo" - -msgid "Yes" -msgstr "Sí" - -msgid "default" -msgstr "predeterminado" - -msgid "non-empty value" -msgstr "valor no vacío" - -msgid "running" -msgstr "en ejecución" - -msgid "total" -msgstr "total" - -msgid "Are you sure to remove pod?" -msgstr "¿Está seguro de eliminar el pod?" - -msgid "Cgroup parent" -msgstr "Cgroup padre" - -msgid "CID" -msgstr "CID" - -msgid "CPU %" -msgstr "CPU %" - -msgid "CPU period" -msgstr "Período de CPU" - -msgid "CPU quota" -msgstr "Cuota de CPU" - -msgid "CPU set" -msgstr "Conjunto de CPU" - -msgid "CPU shares" -msgstr "Shares de CPU" - -msgid "DNS options" -msgstr "Opciones DNS" - -msgid "DNS search" -msgstr "Búsqueda DNS" - -msgid "DNS servers" -msgstr "Servidores DNS" - -msgid "Exit policy" -msgstr "Política de salida" - -msgid "Extra hosts" -msgstr "Hosts adicionales" - -msgid "Host network" -msgstr "Red del host" - -msgid "Infra container" -msgstr "Contenedor infra" - -msgid "Memory limit" -msgstr "Límite de memoria" - -msgid "Net I/O" -msgstr "I/O de red" - -msgid "Pause pod" -msgstr "Pausar pod" - -msgid "Pod is not running" -msgstr "El pod no está en ejecución" - -msgid "Remove pod" -msgstr "Eliminar pod" - -msgid "Restart policy" -msgstr "Política de reinicio" - -msgid "Restart pod" -msgstr "Reiniciar pod" - -msgid "Shared namespaces" -msgstr "Namespaces compartidos" - -msgid "Start pod" -msgstr "Iniciar pod" - -msgid "Static IPv4" -msgstr "IPv4 estática" - -msgid "Static MAC" -msgstr "MAC estática" - -msgid "Stop pod" -msgstr "Detener pod" - -msgid "Unlimited" -msgstr "Ilimitado" - -msgid "Unpause pod" -msgstr "Reanudar pod" - -msgid "Stopping container" -msgstr "Deteniendo contenedor" - -msgid "Stop failed: %s" -msgstr "Error al detener: %s" - -msgid "Removing container" -msgstr "Eliminando contenedor" - -msgid "Remove failed: %s" -msgstr "Error al eliminar: %s" - -msgid "Creating container" -msgstr "Creando contenedor" - -msgid "Create failed: %s" -msgstr "Error al crear: %s" - -msgid "Starting container" -msgstr "Iniciando contenedor" - -msgid "Start failed: %s" -msgstr "Error al iniciar: %s" - -msgid "Reinstating init script" -msgstr "Restableciendo script de inicio" - -msgid "Init script reinstate failed: %s" -msgstr "Error al restablecer el script de inicio: %s" - -msgid "Updated to %s" -msgstr "Actualizado a %s" - -msgid "Update image: %d/%d - %s" -msgstr "Actualizar imagen: %d/%d - %s" - -msgid "Removed old image %s" -msgstr "Imagen antigua %s eliminada" - -msgid "Done." -msgstr "Listo." - -msgid "Pause container" -msgstr "Pausar contenedor" - -msgid "Unpause container" -msgstr "Reanudar contenedor" diff --git a/luci-app-podman/po/fr/podman.po b/luci-app-podman/po/fr/podman.po deleted file mode 100644 index ca943674a..000000000 --- a/luci-app-podman/po/fr/podman.po +++ /dev/null @@ -1,1090 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: luci-app-podman\n" -"PO-Revision-Date: 2026-05-03 11:05+0000\n" -"Last-Translator:\n" -"Language-Team: French \n" -"Language: fr\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "%d check(s) failed:" -msgstr "%d vérification(s) échouée(s) :" - -msgid "%d updated, %d failed:" -msgstr "%d mis à jour, %d échoué(s) :" - -msgid "%s created successfully" -msgstr "%s créé avec succès" - -msgid "%s: %d/%d" -msgstr "%s : %d/%d" - -msgid "(none)" -msgstr "(aucun)" - -msgid "-- Select %s --" -msgstr "-- Sélectionner %s --" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "1-253 caractères : lettres, chiffres, underscore (_) et trait d'union (-) uniquement" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "512m, 1g ou -1 pour illimité" - -msgid "API Version" -msgstr "Version de l'API" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "Ajouter le conteneur à un pod existant. Le réseau, le nom d'hôte et les mappages de ports proviennent du conteneur infra du pod." - -msgid "All images updated successfully" -msgstr "Toutes les images mises à jour avec succès" - -msgid "All volumes exported successfully" -msgstr "Tous les volumes ont été exportés avec succès" - -msgid "Allocate TTY (-t)" -msgstr "Allouer un TTY (-t)" - -msgid "Allocate container IP from this range" -msgstr "Allouer l'IP du conteneur à partir de cette plage" - -msgid "Always" -msgstr "Toujours" - -msgid "Apply Updates" -msgstr "Appliquer les mises à jour" - -msgid "Are you sure to delete the records?" -msgstr "Supprimer les enregistrements ?" - -msgid "Are you sure to remove container?" -msgstr "Supprimer le conteneur ?" - -msgid "Are you sure to remove integration?" -msgstr "Supprimer l'intégration ?" - -msgid "Auto Remove (--rm)" -msgstr "Suppression automatique (--rm)" - -msgid "Auto Update" -msgstr "Mise à jour automatique" - -msgid "Auto-Update" -msgstr "Mise à jour automatique" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "Configurer automatiquement l'interface réseau, le pont et la zone de pare-feu OpenWrt. Fortement recommandé pour un réseau de conteneurs correct sur OpenWrt." - -msgid "Automatically start the container after it is created" -msgstr "Démarrer automatiquement le conteneur après sa création" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "Mettre à jour automatiquement le conteneur lorsqu'une image plus récente est disponible. Ajoute l'étiquette : io.containers.autoupdate=registry" - -msgid "Basic Information" -msgstr "Informations de base" - -msgid "Block I/O" -msgstr "E/S bloc" - -msgid "Boot" -msgstr "Démarrage" - -msgid "Bridge Interface Name" -msgstr "Nom de l'interface pont" - -msgid "CPU" -msgstr "CPU" - -msgid "CPU Limit" -msgstr "Limite CPU" - -msgid "CPU Set" -msgstr "Ensemble CPU" - -msgid "CPU Shares Weight" -msgstr "Poids des CPU shares" - -msgid "CPU Usage" -msgstr "Utilisation CPU" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "Parts CPU (poids relatif). 0 = valeur par défaut." - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "CPUs sur lesquels le pod peut s'exécuter (p. ex., \"0-3\" ou \"0,2\")" - -msgid "Cancel" -msgstr "Annuler" - -msgid "Check" -msgstr "Vérifier" - -msgid "Check %d containers for updates?" -msgstr "Vérifier les mises à jour de %d conteneurs ?" - -msgid "Check Complete" -msgstr "Vérification terminée" - -msgid "Check for Updates" -msgstr "Rechercher des mises à jour" - -msgid "Check for updates: %s/%s" -msgstr "Vérification des mises à jour : %s/%s" - -msgid "Choose firewall zone for this network." -msgstr "Choisir la zone de pare-feu pour ce réseau." - -msgid "Clean Up Now" -msgstr "Nettoyer maintenant" - -msgid "Cleaning up old images..." -msgstr "Nettoyage des anciennes images..." - -msgid "Cleanup / Prune" -msgstr "Nettoyage / Prune" - -msgid "Cleanup Complete" -msgstr "Nettoyage terminé" - -msgid "Cleanup Unused Resources" -msgstr "Nettoyer les ressources inutilisées" - -msgid "Cleanup successful!" -msgstr "Nettoyage réussi !" - -msgid "Clear logs" -msgstr "Effacer les journaux" - -msgid "Click icon to repair" -msgstr "Cliquer sur l'icône pour réparer" - -msgid "Click to disconnect" -msgstr "Cliquer pour déconnecter" - -msgid "Click to enable/disable" -msgstr "Cliquer pour activer/désactiver" - -msgid "Click to reveal/hide value" -msgstr "Cliquer pour afficher/masquer la valeur" - -msgid "Close" -msgstr "Fermer" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "Liste d'ID de groupes supplémentaires séparés par des virgules" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "Ports à exposer séparés par des virgules (ex. 6052, 8080/udp)" - -msgid "Command" -msgstr "Commande" - -msgid "Command to run (space-separated)" -msgstr "Commande à exécuter (séparée par des espaces)" - -msgid "Configuration" -msgstr "Configuration" - -msgid "Configure resource limits for this container." -msgstr "Configurer les limites de ressources pour ce conteneur." - -msgid "Confirm" -msgstr "Confirmer" - -msgid "Connect" -msgstr "Connecter" - -msgid "Connect to" -msgstr "Se connecter à" - -msgid "Connected successfully to %s" -msgstr "Connecté avec succès à %s" - -msgid "Connecting container to network" -msgstr "Connexion du conteneur au réseau" - -msgid "Console" -msgstr "Console" - -msgid "Container" -msgstr "Conteneur" - -msgid "Container Name" -msgstr "Nom du conteneur" - -msgid "Container image has no tag - cannot update" -msgstr "L'image du conteneur n'a pas de tag - impossible de mettre à jour" - -msgid "Container image to use" -msgstr "Image de conteneur à utiliser" - -msgid "Container is not running" -msgstr "Le conteneur n'est pas en cours d'exécution" - -msgid "Container updated successfully" -msgstr "Conteneur mis à jour avec succès" - -msgid "Containers" -msgstr "Conteneurs" - -msgid "Containers in pod %s" -msgstr "Conteneurs dans le pod %s" - -msgid "Containers updated successfully" -msgstr "Conteneurs mis à jour avec succès" - -msgid "Containers updated successfully." -msgstr "Conteneurs mis à jour avec succès." - -msgid "Create" -msgstr "Créer" - -msgid "Create %s" -msgstr "Créer %s" - -msgid "Create Command" -msgstr "Commande de création" - -msgid "Create Infra Container" -msgstr "Créer le conteneur infra" - -msgid "Create new zone (will be named: podman_)" -msgstr "Créer une nouvelle zone (sera nommée : podman_)" - -msgid "Created" -msgstr "Créé" - -msgid "Creating %s" -msgstr "Création de %s" - -msgid "Creating auto-start configuration for %s" -msgstr "Création de la configuration de démarrage automatique pour %s" - -msgid "DNS Search Domains" -msgstr "Domaines de recherche DNS" - -msgid "DNS Servers" -msgstr "Serveurs DNS" - -msgid "DNS search domains for the infra container" -msgstr "Domaines de recherche DNS pour le conteneur infra" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "Serveurs DNS pour le conteneur infra (partagés avec tous les conteneurs du pod)" - -msgid "Delete" -msgstr "Supprimer" - -msgid "Deleting records: %d/%d" -msgstr "Suppression des enregistrements : %d/%d" - -msgid "Deleting records: %s/%s" -msgstr "Suppression des enregistrements : %s/%s" - -msgid "Destination" -msgstr "Destination" - -msgid "Device" -msgstr "Périphérique" - -msgid "Disabled" -msgstr "Désactivé" - -msgid "Disabling init script" -msgstr "Désactivation du script d'initialisation" - -msgid "Disconnect container from network" -msgstr "Déconnecter le conteneur du réseau" - -msgid "Disconnected from %s" -msgstr "Déconnecté de %s" - -msgid "Dnsmasq" -msgstr "Dnsmasq" - -msgid "Driver" -msgstr "Pilote" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "Options spécifiques au pilote (séparées par des virgules, ex: type=tmpfs,o=size=100m)" - -msgid "Enable IPv6" -msgstr "Activer IPv6" - -msgid "Enable IPv6 networking" -msgstr "Activer le réseau IPv6" - -msgid "Enabling init script" -msgstr "Activation du script d'initialisation" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "Saisir les données secrètes (mot de passe, jeton, clé, etc.)" - -msgid "Entrypoint" -msgstr "Point d'entrée (Entrypoint)" - -msgid "Environment Variables" -msgstr "Variables d'environnement" - -msgid "Ephemeral (--rm flag)" -msgstr "Éphémère (option --rm)" - -msgid "Error" -msgstr "Erreur" - -msgid "Error: %s" -msgstr "Erreur : %s" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "Interface physique existante comme parent. Requis pour les réseaux macvlan/ipvlan." - -msgid "Expecting: %s" -msgstr "Attendu : %s" - -msgid "Export" -msgstr "Exporter" - -msgid "Exporting selected volumes: %d/%d" -msgstr "Exportation des volumes sélectionnés : %d/%d" - -msgid "Expose Ports" -msgstr "Exposer les ports" - -msgid "Failed to create container" -msgstr "Échec de la création du conteneur" - -msgid "Fetching information..." -msgstr "Récupération des informations..." - -msgid "Find updateable containers" -msgstr "Rechercher les conteneurs pouvant être mis à jour" - -msgid "Firewall Zone" -msgstr "Zone de pare-feu" - -msgid "Gateway" -msgstr "Passerelle" - -msgid "Generate" -msgstr "Générer" - -msgid "Graph Root" -msgstr "Racine du graphe" - -msgid "Health" -msgstr "Santé" - -msgid "Hostname" -msgstr "Nom d'hôte" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "Nom d'hôte du pod (par défaut, le nom du pod)" - -msgid "ID" -msgstr "ID" - -msgid "IP Address" -msgstr "Adresse IP" - -msgid "IP Range (CIDR)" -msgstr "Plage IP (CIDR)" - -msgid "IPv4 Gateway" -msgstr "Passerelle IPv4" - -msgid "IPv4 Subnet (CIDR)" -msgstr "Sous-réseau IPv4 (CIDR)" - -msgid "IPv4 gateway address" -msgstr "Adresse de la passerelle IPv4" - -msgid "IPv4 subnet in CIDR notation" -msgstr "Sous-réseau IPv4 en notation CIDR" - -msgid "Image" -msgstr "Image" - -msgid "Image ID" -msgstr "ID de l'image" - -msgid "Image is already up-to-date" -msgstr "L'image est déjà à jour" - -msgid "Image pulled successfully" -msgstr "Image récupérée avec succès" - -msgid "Images" -msgstr "Images" - -msgid "Import" -msgstr "Importer" - -msgid "Import from archive: %s" -msgstr "Importer depuis l'archive : %s" - -msgid "Importing volume..." -msgstr "Importation du volume..." - -msgid "Info" -msgstr "Info" - -msgid "Information" -msgstr "Informations" - -msgid "Infra Image" -msgstr "Image infra" - -msgid "Init Script" -msgstr "Script d'initialisation" - -msgid "Inspect" -msgstr "Inspecter" - -msgid "Int" -msgstr "Ent" - -msgid "Interactive" -msgstr "Interactif" - -msgid "Interface" -msgstr "Interface" - -msgid "Internal Network" -msgstr "Réseau interne" - -msgid "Labels" -msgstr "Étiquettes" - -msgid "Labels in key=value format, one per line" -msgstr "Étiquettes au format clé=valeur, une par ligne" - -msgid "Leave empty to auto-generate" -msgstr "Laisser vide pour l'auto-génération" - -msgid "Links" -msgstr "Liens" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "Namespaces Linux partagés entre les conteneurs du pod. La valeur par défaut correspond à `podman pod create`." - -msgid "Load" -msgstr "Charger" - -msgid "Load System diagnostics" -msgstr "Charger les diagnostics système" - -msgid "Loading init script" -msgstr "Chargement du script d'initialisation" - -msgid "Loading..." -msgstr "Chargement..." - -msgid "Logs" -msgstr "Journaux" - -msgid "Manage podman %s" -msgstr "Gérer podman %s" - -msgid "Memory" -msgstr "Mémoire" - -msgid "Memory %" -msgstr "Mémoire %" - -msgid "Memory + Swap Limit" -msgstr "Limite Mémoire + Swap" - -msgid "Memory Limit" -msgstr "Limite Mémoire" - -msgid "Memory Usage" -msgstr "Utilisation mémoire" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "Limite mémoire (ex: 512m, 1g)" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "Limite mémoire (ex. 512m, 1g). -1 = illimité, 0 = par défaut." - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "Limite de mémoire pour le pod (p. ex., 512m, 1g)" - -msgid "Mode" -msgstr "Mode" - -msgid "Mount Options" -msgstr "Options de montage" - -msgid "Mountpoint" -msgstr "Point de montage" - -msgid "Mounts" -msgstr "Montages" - -msgid "Must be between 0 and 262144" -msgstr "Doit être entre 0 et 262144" - -msgid "Name" -msgstr "Nom" - -msgid "Name for the network" -msgstr "Nom du réseau" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "Nom de l'interface pont (ex: podman0). Laisser vide pour utiliser : <nom-réseau>0. Note : En cas de conflit, OpenWrt l'incrémentera automatiquement." - -msgid "Name updated successfully" -msgstr "Nom mis à jour avec succès" - -msgid "Network" -msgstr "Réseau" - -msgid "Network I/O" -msgstr "E/S réseau" - -msgid "Network Mode" -msgstr "Mode réseau" - -msgid "Network Name" -msgstr "Nom du réseau" - -msgid "Network driver" -msgstr "Pilote réseau" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "Namespace réseau pour le pod. Les conteneurs du pod partagent ce réseau." - -msgid "Networks" -msgstr "Réseaux" - -msgid "Never" -msgstr "Jamais" - -msgid "No" -msgstr "Non" - -msgid "No %s selected" -msgstr "Aucun %s sélectionné" - -msgid "No containers in this pod" -msgstr "Aucun conteneur dans ce pod" - -msgid "No containers with auto-update label found." -msgstr "Aucun conteneur avec l'étiquette de mise à jour automatique trouvé." - -msgid "No new updates available." -msgstr "Aucune nouvelle mise à jour disponible." - -msgid "No suitable interfaces found" -msgstr "Aucune interface appropriée trouvée" - -msgid "No unused resources found" -msgstr "Aucune ressource inutilisée trouvée" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "Nombre de CPUs (ex: 0.5, 1.0, 2.0)" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "Nombre de CPUs (ex: 0.5, 1.0, 2.0). Laisser vide pour illimité." - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "Nombre de CPUs disponibles pour le pod (p. ex., 0.5, 1.0, 2.0)" - -msgid "Number of lines" -msgstr "Nombre de lignes" - -msgid "OK" -msgstr "OK" - -msgid "Old image still used by other containers" -msgstr "L'ancienne image est encore utilisée par d'autres conteneurs" - -msgid "On Failure" -msgstr "En cas d'échec" - -msgid "One per line, format: host:container[/protocol]" -msgstr "Un par ligne, format : hôte:conteneur[/protocole]" - -msgid "One per line, format: key=value" -msgstr "Une par ligne, format : clé=valeur" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "Un par ligne. Format : source:destination[:options]. Options : ro, rw, Z, z" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "Intégration OpenWrt existante\n\nCliquer pour supprimer" - -msgid "OpenWrt integration incomplete" -msgstr "Intégration OpenWrt incomplète" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "L'intégration OpenWrt nécessite la spécification d'un sous-réseau" - -msgid "Override the image used for the infra container" -msgstr "Remplacer l'image utilisée pour le conteneur infra" - -msgid "PIDs" -msgstr "PIDs" - -msgid "Parent Interface" -msgstr "Interface parent" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "L'interface parent est requise pour les réseaux macvlan/ipvlan" - -msgid "Part of a pod (\"%s\")" -msgstr "Fait partie du pod « %s »" - -msgid "Pausing pod" -msgstr "Mise en pause du pod" - -msgid "Pod" -msgstr "Pod" - -msgid "Pod Name" -msgstr "Nom du pod" - -msgid "Podman Version" -msgstr "Version de Podman" - -msgid "Pods" -msgstr "Pods" - -msgid "Port Mappings" -msgstr "Mappages de ports" - -msgid "Ports" -msgstr "Ports" - -msgid "Privileged" -msgstr "Privilégié" - -msgid "Privileged Mode" -msgstr "Mode privilégié" - -msgid "Processes" -msgstr "Processus" - -msgid "Pull Image" -msgstr "Récupérer l'image" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "Le pull n'a pas retourné d'ID d'image - le pull a peut-être échoué" - -msgid "Pulling %s" -msgstr "Téléchargement de %s" - -msgid "Read: %s / Write: %s" -msgstr "Lecture : %s / Écriture : %s" - -msgid "Refreshing %s..." -msgstr "Actualisation de %s..." - -msgid "Registries" -msgstr "Registres (Registries)" - -msgid "Registry" -msgstr "Registre" - -msgid "Reload" -msgstr "Recharger" - -msgid "Remove OpenWrt integration" -msgstr "Supprimer l'intégration OpenWrt" - -msgid "Remove all unused images (not just dangling)" -msgstr "Supprimer toutes les images inutilisées (pas seulement les orphelines)" - -msgid "Remove container" -msgstr "Supprimer le conteneur" - -msgid "Remove unused volumes" -msgstr "Supprimer les volumes inutilisés" - -msgid "Removed: %s" -msgstr "Supprimé : %s" - -msgid "Removing unused resources, please wait..." -msgstr "Suppression des ressources inutilisées, veuillez patienter..." - -msgid "Repository" -msgstr "Dépôt" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "Requis pour le namespace réseau partagé. Désactivez uniquement si vous savez que vous n'en avez pas besoin." - -msgid "Resources" -msgstr "Ressources" - -msgid "Restart Policy" -msgstr "Politique de redémarrage" - -msgid "Restart container" -msgstr "Redémarrer le conteneur" - -msgid "Restart policy updated successfully" -msgstr "Politique de redémarrage mise à jour avec succès" - -msgid "Restarting pod" -msgstr "Redémarrage du pod" - -msgid "Restrict external access to the network" -msgstr "Restreindre l'accès externe au réseau" - -msgid "Run Root" -msgstr "Run Root" - -msgid "Saving resource" -msgstr "Sauvegarde de la ressource" - -msgid "Secret" -msgstr "Secret" - -msgid "Secret Data" -msgstr "Données secrètes" - -msgid "Secret Name" -msgstr "Nom du secret" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "Le nom du secret ne peut contenir que des lettres, chiffres, underscores et tirets" - -msgid "Secrets" -msgstr "Secrets" - -msgid "Security Notice:" -msgstr "Avis de sécurité :" - -msgid "Select containers to update" -msgstr "Sélectionner les conteneurs à mettre à jour" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "Sélectionner le réseau pour le nouveau conteneur. Les réseaux utilisateur offrent un meilleur isolement et une meilleure résolution DNS entre conteneurs." - -msgid "Select what to clean up:" -msgstr "Sélectionner ce qu'il faut nettoyer :" - -msgid "Sensitive data is hidden for security reasons." -msgstr "Les données sensibles sont masquées pour des raisons de sécurité." - -msgid "Setup OpenWrt Integration" -msgstr "Configurer l'intégration OpenWrt" - -msgid "Shared Namespaces" -msgstr "Namespaces partagés" - -msgid "Shares network with another container" -msgstr "Partage le réseau avec un autre conteneur" - -msgid "Show" -msgstr "Afficher" - -msgid "Since" -msgstr "Depuis" - -msgid "Size" -msgstr "Taille" - -msgid "Socket Path" -msgstr "Chemin du socket" - -msgid "Source" -msgstr "Source" - -msgid "Space freed: %s" -msgstr "Espace libéré : %s" - -msgid "Start after creation" -msgstr "Démarrer après création" - -msgid "Start container" -msgstr "Démarrer le conteneur" - -msgid "Start on boot" -msgstr "Démarrer au démarrage" - -msgid "Start script disabled" -msgstr "Script de démarrage désactivé" - -msgid "Start script missing\n\nClick to generate" -msgstr "Script de démarrage manquant\n\nCliquez pour générer" - -msgid "Start stream" -msgstr "Démarrer le flux" - -msgid "Started" -msgstr "Démarré" - -msgid "Started At" -msgstr "Démarré à" - -msgid "Starting pod" -msgstr "Démarrage du pod" - -msgid "Statistics" -msgstr "Statistiques" - -msgid "Stats" -msgstr "Stats" - -msgid "Status" -msgstr "État" - -msgid "Stop container" -msgstr "Arrêter le conteneur" - -msgid "Stop stream" -msgstr "Arrêter le flux" - -msgid "Stopping pod" -msgstr "Arrêt du pod" - -msgid "Subnet" -msgstr "Sous-réseau" - -msgid "Supplementary Groups" -msgstr "Groupes supplémentaires" - -msgid "System Diagnostics" -msgstr "Diagnostics système" - -msgid "TTY" -msgstr "TTY" - -msgid "Tag" -msgstr "Tag" - -msgid "The sensitive data to store securely" -msgstr "Les données sensibles à stocker en toute sécurité" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "Pour activer la mise à jour automatique, ajouter l'étiquette : io.containers.autoupdate=registry" - -msgid "Total" -msgstr "Total" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "Limite mémoire totale (mémoire + swap). -1 = illimité, 0 = par défaut." - -msgid "Type" -msgstr "Type" - -msgid "Unknown" -msgstr "Inconnu" - -msgid "Unless Stopped" -msgstr "Sauf si arrêté (Unless Stopped)" - -msgid "Until" -msgstr "Jusqu'à" - -msgid "Update" -msgstr "Mettre à jour" - -msgid "Update Resources" -msgstr "Mettre à jour les ressources" - -msgid "Update name" -msgstr "Mettre à jour le nom" - -msgid "Update restart policy" -msgstr "Mettre à jour la politique de redémarrage" - -msgid "Updating Images" -msgstr "Mise à jour des images" - -msgid "Updating container" -msgstr "Mise à jour du conteneur" - -msgid "Upload failed: %s" -msgstr "Échec du téléchargement : %s" - -msgid "Uploading file..." -msgstr "Téléchargement du fichier..." - -msgid "User" -msgstr "Utilisateur" - -msgid "User and group to run as (UID:GID)" -msgstr "Utilisateur et groupe (UID:GID)" - -msgid "Value" -msgstr "Valeur" - -msgid "Variable" -msgstr "Variable" - -msgid "Volume" -msgstr "Volume" - -msgid "Volume Name" -msgstr "Nom du volume" - -msgid "Volume driver to use" -msgstr "Pilote de volume à utiliser" - -msgid "Volume imported successfully" -msgstr "Volume importé avec succès" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "Nom du volume. Laisser vide pour l'auto-génération." - -msgid "Volumes" -msgstr "Volumes" - -msgid "Working Directory" -msgstr "Répertoire de travail" - -msgid "Yes" -msgstr "Oui" - -msgid "default" -msgstr "par défaut" - -msgid "non-empty value" -msgstr "valeur non vide" - -msgid "running" -msgstr "en cours" - -msgid "total" -msgstr "total" - -msgid "Are you sure to remove pod?" -msgstr "Êtes-vous sûr de supprimer le pod ?" - -msgid "Cgroup parent" -msgstr "Cgroup parent" - -msgid "CID" -msgstr "CID" - -msgid "CPU %" -msgstr "CPU %" - -msgid "CPU period" -msgstr "Période CPU" - -msgid "CPU quota" -msgstr "Quota CPU" - -msgid "CPU set" -msgstr "Ensemble CPU" - -msgid "CPU shares" -msgstr "Shares CPU" - -msgid "DNS options" -msgstr "Options DNS" - -msgid "DNS search" -msgstr "Recherche DNS" - -msgid "DNS servers" -msgstr "Serveurs DNS" - -msgid "Exit policy" -msgstr "Politique de sortie" - -msgid "Extra hosts" -msgstr "Hôtes supplémentaires" - -msgid "Host network" -msgstr "Réseau hôte" - -msgid "Infra container" -msgstr "Conteneur infra" - -msgid "Memory limit" -msgstr "Limite de mémoire" - -msgid "Net I/O" -msgstr "I/O réseau" - -msgid "Pause pod" -msgstr "Mettre le pod en pause" - -msgid "Pod is not running" -msgstr "Le pod n'est pas en cours d'exécution" - -msgid "Remove pod" -msgstr "Supprimer le pod" - -msgid "Restart policy" -msgstr "Politique de redémarrage" - -msgid "Restart pod" -msgstr "Redémarrer le pod" - -msgid "Shared namespaces" -msgstr "Namespaces partagés" - -msgid "Start pod" -msgstr "Démarrer le pod" - -msgid "Static IPv4" -msgstr "IPv4 statique" - -msgid "Static MAC" -msgstr "MAC statique" - -msgid "Stop pod" -msgstr "Arrêter le pod" - -msgid "Unlimited" -msgstr "Illimité" - -msgid "Unpause pod" -msgstr "Reprendre le pod" - -msgid "Stopping container" -msgstr "Arrêt du conteneur" - -msgid "Stop failed: %s" -msgstr "Échec de l'arrêt : %s" - -msgid "Removing container" -msgstr "Suppression du conteneur" - -msgid "Remove failed: %s" -msgstr "Échec de la suppression : %s" - -msgid "Creating container" -msgstr "Création du conteneur" - -msgid "Create failed: %s" -msgstr "Échec de la création : %s" - -msgid "Starting container" -msgstr "Démarrage du conteneur" - -msgid "Start failed: %s" -msgstr "Échec du démarrage : %s" - -msgid "Reinstating init script" -msgstr "Restauration du script d'initialisation" - -msgid "Init script reinstate failed: %s" -msgstr "Échec de la restauration du script d'initialisation : %s" - -msgid "Updated to %s" -msgstr "Mis à jour vers %s" - -msgid "Update image: %d/%d - %s" -msgstr "Mise à jour de l'image : %d/%d - %s" - -msgid "Removed old image %s" -msgstr "Ancienne image %s supprimée" - -msgid "Done." -msgstr "Terminé." - -msgid "Pause container" -msgstr "Mettre le conteneur en pause" - -msgid "Unpause container" -msgstr "Reprendre le conteneur" diff --git a/luci-app-podman/po/nl/podman.po b/luci-app-podman/po/nl/podman.po deleted file mode 100644 index da95baac1..000000000 --- a/luci-app-podman/po/nl/podman.po +++ /dev/null @@ -1,1090 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: luci-app-podman\n" -"PO-Revision-Date: 2026-05-03 11:05+0000\n" -"Last-Translator:\n" -"Language-Team: Dutch \n" -"Language: nl\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "%d check(s) failed:" -msgstr "%d controle(s) mislukt:" - -msgid "%d updated, %d failed:" -msgstr "%d bijgewerkt, %d mislukt:" - -msgid "%s created successfully" -msgstr "%s succesvol aangemaakt" - -msgid "%s: %d/%d" -msgstr "%s: %d/%d" - -msgid "(none)" -msgstr "(geen)" - -msgid "-- Select %s --" -msgstr "-- Selecteer %s --" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "1-253 tekens: alleen letters, cijfers, laag streepje (_) en koppelteken (-)" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "512m, 1g of -1 voor onbeperkt" - -msgid "API Version" -msgstr "API-versie" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "Container toevoegen aan een bestaande pod. Netwerk, hostnaam en poort-mappings komen van de infra-container van de pod." - -msgid "All images updated successfully" -msgstr "Alle images succesvol bijgewerkt" - -msgid "All volumes exported successfully" -msgstr "Alle volumes succesvol geëxporteerd" - -msgid "Allocate TTY (-t)" -msgstr "TTY toewijzen (-t)" - -msgid "Allocate container IP from this range" -msgstr "Container IP toewijzen uit dit bereik" - -msgid "Always" -msgstr "Altijd" - -msgid "Apply Updates" -msgstr "Updates toepassen" - -msgid "Are you sure to delete the records?" -msgstr "Records verwijderen?" - -msgid "Are you sure to remove container?" -msgstr "Container verwijderen?" - -msgid "Are you sure to remove integration?" -msgstr "Integratie verwijderen?" - -msgid "Auto Remove (--rm)" -msgstr "Automatisch verwijderen (--rm)" - -msgid "Auto Update" -msgstr "Automatisch bijwerken" - -msgid "Auto-Update" -msgstr "Automatisch bijwerken" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "Automatisch OpenWrt netwerkinterface, bridge en firewallzone configureren. Ten zeerste aanbevolen voor correct container-netwerkgebruik op OpenWrt." - -msgid "Automatically start the container after it is created" -msgstr "De container automatisch starten nadat deze is aangemaakt" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "Container automatisch bijwerken wanneer een nieuwer image beschikbaar is. Voegt label toe: io.containers.autoupdate=registry" - -msgid "Basic Information" -msgstr "Basis informatie" - -msgid "Block I/O" -msgstr "Blok I/O" - -msgid "Boot" -msgstr "Opstarten" - -msgid "Bridge Interface Name" -msgstr "Bridge interfacenaam" - -msgid "CPU" -msgstr "CPU" - -msgid "CPU Limit" -msgstr "CPU-limiet" - -msgid "CPU Set" -msgstr "CPU-set" - -msgid "CPU Shares Weight" -msgstr "CPU shares gewicht" - -msgid "CPU Usage" -msgstr "CPU-gebruik" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "CPU-aandelen (relatief gewicht). 0 = standaard." - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "CPU's waarop de pod mag draaien (bijv. \"0-3\" of \"0,2\")" - -msgid "Cancel" -msgstr "Annuleren" - -msgid "Check" -msgstr "Controleren" - -msgid "Check %d containers for updates?" -msgstr "%d containers controleren op updates?" - -msgid "Check Complete" -msgstr "Controle voltooid" - -msgid "Check for Updates" -msgstr "Controleren op updates" - -msgid "Check for updates: %s/%s" -msgstr "Controleren op updates: %s/%s" - -msgid "Choose firewall zone for this network." -msgstr "Firewallzone kiezen voor dit netwerk." - -msgid "Clean Up Now" -msgstr "Nu opruimen" - -msgid "Cleaning up old images..." -msgstr "Oude images opruimen..." - -msgid "Cleanup / Prune" -msgstr "Opruimen / Prune" - -msgid "Cleanup Complete" -msgstr "Opruimen voltooid" - -msgid "Cleanup Unused Resources" -msgstr "Ongebruikte bronnen opruimen" - -msgid "Cleanup successful!" -msgstr "Opruimen succesvol!" - -msgid "Clear logs" -msgstr "Logboeken wissen" - -msgid "Click icon to repair" -msgstr "Klik op het pictogram om te repareren" - -msgid "Click to disconnect" -msgstr "Klikken om te verbreken" - -msgid "Click to enable/disable" -msgstr "Klikken om in/uit te schakelen" - -msgid "Click to reveal/hide value" -msgstr "Klik om waarde te tonen/verbergen" - -msgid "Close" -msgstr "Sluiten" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "Door komma's gescheiden lijst van aanvullende groeps-ID's" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "Door komma's gescheiden poorten om te exposeren (bijv. 6052, 8080/udp)" - -msgid "Command" -msgstr "Opdracht" - -msgid "Command to run (space-separated)" -msgstr "Uit te voeren opdracht (spatie-gescheiden)" - -msgid "Configuration" -msgstr "Configuratie" - -msgid "Configure resource limits for this container." -msgstr "Resourcelimieten configureren voor deze container." - -msgid "Confirm" -msgstr "Bevestigen" - -msgid "Connect" -msgstr "Verbinden" - -msgid "Connect to" -msgstr "Verbinden met" - -msgid "Connected successfully to %s" -msgstr "Succesvol verbonden met %s" - -msgid "Connecting container to network" -msgstr "Container verbinden met netwerk" - -msgid "Console" -msgstr "Console" - -msgid "Container" -msgstr "Container" - -msgid "Container Name" -msgstr "Container naam" - -msgid "Container image has no tag - cannot update" -msgstr "Container-image heeft geen tag - kan niet bijwerken" - -msgid "Container image to use" -msgstr "Te gebruiken container image" - -msgid "Container is not running" -msgstr "Container is niet actief" - -msgid "Container updated successfully" -msgstr "Container succesvol bijgewerkt" - -msgid "Containers" -msgstr "Containers" - -msgid "Containers in pod %s" -msgstr "Containers in pod %s" - -msgid "Containers updated successfully" -msgstr "Containers succesvol bijgewerkt" - -msgid "Containers updated successfully." -msgstr "Containers succesvol bijgewerkt." - -msgid "Create" -msgstr "Aanmaken" - -msgid "Create %s" -msgstr "%s aanmaken" - -msgid "Create Command" -msgstr "Aanmaakcommando" - -msgid "Create Infra Container" -msgstr "Infra-container aanmaken" - -msgid "Create new zone (will be named: podman_)" -msgstr "Nieuwe zone aanmaken (naam wordt: podman_)" - -msgid "Created" -msgstr "Aangemaakt" - -msgid "Creating %s" -msgstr "Aanmaken van %s" - -msgid "Creating auto-start configuration for %s" -msgstr "Automatische start configuratie aanmaken voor %s" - -msgid "DNS Search Domains" -msgstr "DNS-zoekdomeinen" - -msgid "DNS Servers" -msgstr "DNS-servers" - -msgid "DNS search domains for the infra container" -msgstr "DNS-zoekdomeinen voor de infra-container" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "DNS-servers voor de infra-container (gedeeld met alle containers in de pod)" - -msgid "Delete" -msgstr "Verwijderen" - -msgid "Deleting records: %d/%d" -msgstr "Records verwijderen: %d/%d" - -msgid "Deleting records: %s/%s" -msgstr "Records verwijderen: %s/%s" - -msgid "Destination" -msgstr "Bestemming" - -msgid "Device" -msgstr "Apparaat" - -msgid "Disabled" -msgstr "Uitgeschakeld" - -msgid "Disabling init script" -msgstr "Init-script uitschakelen" - -msgid "Disconnect container from network" -msgstr "Container verbreken van netwerk" - -msgid "Disconnected from %s" -msgstr "Verbroken van %s" - -msgid "Dnsmasq" -msgstr "Dnsmasq" - -msgid "Driver" -msgstr "Driver" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "Driver-specifieke opties (komma-gescheiden, bijv. type=tmpfs,o=size=100m)" - -msgid "Enable IPv6" -msgstr "IPv6 inschakelen" - -msgid "Enable IPv6 networking" -msgstr "IPv6-netwerkgebruik inschakelen" - -msgid "Enabling init script" -msgstr "Init-script inschakelen" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "Voer geheime gegevens in (wachtwoord, token, sleutel, etc.)" - -msgid "Entrypoint" -msgstr "Entrypoint" - -msgid "Environment Variables" -msgstr "Omgevingsvariabelen" - -msgid "Ephemeral (--rm flag)" -msgstr "Efemeer (--rm vlag)" - -msgid "Error" -msgstr "Fout" - -msgid "Error: %s" -msgstr "Fout: %s" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "Bestaande fysieke interface om als parent te gebruiken. Vereist voor macvlan/ipvlan netwerken." - -msgid "Expecting: %s" -msgstr "Verwacht: %s" - -msgid "Export" -msgstr "Exporteren" - -msgid "Exporting selected volumes: %d/%d" -msgstr "Exporteren van geselecteerde volumes: %d/%d" - -msgid "Expose Ports" -msgstr "Poorten blootstellen" - -msgid "Failed to create container" -msgstr "Aanmaken van container mislukt" - -msgid "Fetching information..." -msgstr "Informatie ophalen..." - -msgid "Find updateable containers" -msgstr "Bijwerkbare containers zoeken" - -msgid "Firewall Zone" -msgstr "Firewallzone" - -msgid "Gateway" -msgstr "Gateway" - -msgid "Generate" -msgstr "Genereren" - -msgid "Graph Root" -msgstr "Grafiek-root" - -msgid "Health" -msgstr "Gezondheid" - -msgid "Hostname" -msgstr "Hostnaam" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "Hostnaam voor de pod (standaard: pod-naam)" - -msgid "ID" -msgstr "ID" - -msgid "IP Address" -msgstr "IP-adres" - -msgid "IP Range (CIDR)" -msgstr "IP-bereik (CIDR)" - -msgid "IPv4 Gateway" -msgstr "IPv4 Gateway" - -msgid "IPv4 Subnet (CIDR)" -msgstr "IPv4 Subnet (CIDR)" - -msgid "IPv4 gateway address" -msgstr "IPv4 gateway-adres" - -msgid "IPv4 subnet in CIDR notation" -msgstr "IPv4-subnet in CIDR-notatie" - -msgid "Image" -msgstr "Image" - -msgid "Image ID" -msgstr "Image-ID" - -msgid "Image is already up-to-date" -msgstr "Image is al up-to-date" - -msgid "Image pulled successfully" -msgstr "Image succesvol opgehaald" - -msgid "Images" -msgstr "Images" - -msgid "Import" -msgstr "Importeren" - -msgid "Import from archive: %s" -msgstr "Importeren uit archief: %s" - -msgid "Importing volume..." -msgstr "Volume importeren..." - -msgid "Info" -msgstr "Info" - -msgid "Information" -msgstr "Informatie" - -msgid "Infra Image" -msgstr "Infra-image" - -msgid "Init Script" -msgstr "Init-script" - -msgid "Inspect" -msgstr "Inspecteren" - -msgid "Int" -msgstr "Geh" - -msgid "Interactive" -msgstr "Interactief" - -msgid "Interface" -msgstr "Interface" - -msgid "Internal Network" -msgstr "Intern netwerk" - -msgid "Labels" -msgstr "Labels" - -msgid "Labels in key=value format, one per line" -msgstr "Labels in sleutel=waarde formaat, één per regel" - -msgid "Leave empty to auto-generate" -msgstr "Leeg laten voor automatisch genereren" - -msgid "Links" -msgstr "Links" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "Linux-namespaces gedeeld tussen de containers in de pod. Standaard komt overeen met `podman pod create`." - -msgid "Load" -msgstr "Laden" - -msgid "Load System diagnostics" -msgstr "Systeemdiagnostiek laden" - -msgid "Loading init script" -msgstr "Init-script laden" - -msgid "Loading..." -msgstr "Laden..." - -msgid "Logs" -msgstr "Logs" - -msgid "Manage podman %s" -msgstr "Podman %s beheren" - -msgid "Memory" -msgstr "Geheugen" - -msgid "Memory %" -msgstr "Geheugen %" - -msgid "Memory + Swap Limit" -msgstr "Geheugen + Swap limiet" - -msgid "Memory Limit" -msgstr "Geheugenlimiet" - -msgid "Memory Usage" -msgstr "Geheugengebruik" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "Geheugenlimiet (bijv. 512m, 1g)" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "Geheugenlimiet (bijv. 512m, 1g). -1 = onbeperkt, 0 = standaard." - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "Geheugenlimiet voor de pod (bijv. 512m, 1g)" - -msgid "Mode" -msgstr "Modus" - -msgid "Mount Options" -msgstr "Mount-opties" - -msgid "Mountpoint" -msgstr "Mountpoint" - -msgid "Mounts" -msgstr "Mounts" - -msgid "Must be between 0 and 262144" -msgstr "Moet tussen 0 en 262144 zijn" - -msgid "Name" -msgstr "Naam" - -msgid "Name for the network" -msgstr "Naam voor het netwerk" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "Naam van de bridge interface (bijv. podman0, mynet0). Leeg laten voor: <netwerknaam>0. Let op: Bij conflict met een bestaande interface zal OpenWrt dit automatisch ophogen." - -msgid "Name updated successfully" -msgstr "Naam succesvol bijgewerkt" - -msgid "Network" -msgstr "Netwerk" - -msgid "Network I/O" -msgstr "Netwerk I/O" - -msgid "Network Mode" -msgstr "Netwerkmodus" - -msgid "Network Name" -msgstr "Netwerknaam" - -msgid "Network driver" -msgstr "Netwerkdriver" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "Netwerk-namespace voor de pod. Containers in de pod delen dit netwerk." - -msgid "Networks" -msgstr "Netwerken" - -msgid "Never" -msgstr "Nooit" - -msgid "No" -msgstr "Nee" - -msgid "No %s selected" -msgstr "Geen %s geselecteerd" - -msgid "No containers in this pod" -msgstr "Geen containers in deze pod" - -msgid "No containers with auto-update label found." -msgstr "Geen containers met auto-update label gevonden." - -msgid "No new updates available." -msgstr "Geen nieuwe updates beschikbaar." - -msgid "No suitable interfaces found" -msgstr "Geen geschikte interfaces gevonden" - -msgid "No unused resources found" -msgstr "Geen ongebruikte bronnen gevonden" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "Aantal CPU's (bijv. 0.5, 1.0, 2.0)" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "Aantal CPU's (bijv. 0.5, 1.0, 2.0). Leeg laten voor onbeperkt." - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "Aantal CPU's beschikbaar voor de pod (bijv. 0.5, 1.0, 2.0)" - -msgid "Number of lines" -msgstr "Aantal regels" - -msgid "OK" -msgstr "OK" - -msgid "Old image still used by other containers" -msgstr "Oude image wordt nog gebruikt door andere containers" - -msgid "On Failure" -msgstr "Bij fout" - -msgid "One per line, format: host:container[/protocol]" -msgstr "Één per regel, formaat: host:container[/protocol]" - -msgid "One per line, format: key=value" -msgstr "Eén per regel, formaat: sleutel=waarde" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "Één per regel. Formaat: bron:bestemming[:opties]. Opties: ro, rw, Z, z" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "OpenWrt-integratie bestaat\n\nKlik om te verwijderen" - -msgid "OpenWrt integration incomplete" -msgstr "OpenWrt-integratie onvolledig" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "OpenWrt-integratie vereist opgave van een subnet" - -msgid "Override the image used for the infra container" -msgstr "Image overschrijven die voor de infra-container wordt gebruikt" - -msgid "PIDs" -msgstr "PIDs" - -msgid "Parent Interface" -msgstr "Parent-interface" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "Parent-interface is vereist voor macvlan/ipvlan netwerken" - -msgid "Part of a pod (\"%s\")" -msgstr "Onderdeel van pod \"%s\"" - -msgid "Pausing pod" -msgstr "Pod wordt gepauzeerd" - -msgid "Pod" -msgstr "Pod" - -msgid "Pod Name" -msgstr "Pod-naam" - -msgid "Podman Version" -msgstr "Podman-versie" - -msgid "Pods" -msgstr "Pods" - -msgid "Port Mappings" -msgstr "Poort-mappings" - -msgid "Ports" -msgstr "Poorten" - -msgid "Privileged" -msgstr "Privileged" - -msgid "Privileged Mode" -msgstr "Privileged-modus" - -msgid "Processes" -msgstr "Processen" - -msgid "Pull Image" -msgstr "Image ophalen" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "Pull heeft geen image-ID geretourneerd - pull is mogelijk mislukt" - -msgid "Pulling %s" -msgstr "%s ophalen" - -msgid "Read: %s / Write: %s" -msgstr "Lezen: %s / Schrijven: %s" - -msgid "Refreshing %s..." -msgstr "Vernieuwen van %s..." - -msgid "Registries" -msgstr "Registries" - -msgid "Registry" -msgstr "Registry" - -msgid "Reload" -msgstr "Herladen" - -msgid "Remove OpenWrt integration" -msgstr "OpenWrt-integratie verwijderen" - -msgid "Remove all unused images (not just dangling)" -msgstr "Alle ongebruikte images verwijderen (niet alleen dangling)" - -msgid "Remove container" -msgstr "Container verwijderen" - -msgid "Remove unused volumes" -msgstr "Ongebruikte volumes verwijderen" - -msgid "Removed: %s" -msgstr "Verwijderd: %s" - -msgid "Removing unused resources, please wait..." -msgstr "Ongebruikte bronnen verwijderen, even geduld..." - -msgid "Repository" -msgstr "Repository" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "Vereist voor gedeeld netwerk-namespace. Alleen uitschakelen als u weet dat dit niet nodig is." - -msgid "Resources" -msgstr "Bronnen" - -msgid "Restart Policy" -msgstr "Herstartbeleid" - -msgid "Restart container" -msgstr "Container opnieuw starten" - -msgid "Restart policy updated successfully" -msgstr "Herstartbeleid succesvol bijgewerkt" - -msgid "Restarting pod" -msgstr "Pod wordt herstart" - -msgid "Restrict external access to the network" -msgstr "Externe toegang tot het netwerk beperken" - -msgid "Run Root" -msgstr "Run-root" - -msgid "Saving resource" -msgstr "Resource opslaan" - -msgid "Secret" -msgstr "Geheim (Secret)" - -msgid "Secret Data" -msgstr "Geheime gegevens" - -msgid "Secret Name" -msgstr "Geheim naam" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "Geheim naam mag alleen letters, cijfers, underscores en koppeltekens bevatten" - -msgid "Secrets" -msgstr "Geheimen" - -msgid "Security Notice:" -msgstr "Veiligheidswaarschuwing:" - -msgid "Select containers to update" -msgstr "Containers selecteren om bij te werken" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "Netwerk selecteren voor de nieuwe container. Door gebruikers aangemaakte netwerken bieden betere isolatie en DNS-resolutie tussen containers." - -msgid "Select what to clean up:" -msgstr "Selecteer wat op te ruimen:" - -msgid "Sensitive data is hidden for security reasons." -msgstr "Gevoelige gegevens zijn verborgen om veiligheidsredenen." - -msgid "Setup OpenWrt Integration" -msgstr "OpenWrt-integratie instellen" - -msgid "Shared Namespaces" -msgstr "Gedeelde namespaces" - -msgid "Shares network with another container" -msgstr "Deelt netwerk met een andere container" - -msgid "Show" -msgstr "Tonen" - -msgid "Since" -msgstr "Vanaf" - -msgid "Size" -msgstr "Grootte" - -msgid "Socket Path" -msgstr "Socket-pad" - -msgid "Source" -msgstr "Bron" - -msgid "Space freed: %s" -msgstr "Ruimte vrijgemaakt: %s" - -msgid "Start after creation" -msgstr "Starten na aanmaak" - -msgid "Start container" -msgstr "Container starten" - -msgid "Start on boot" -msgstr "Starten bij opstarten" - -msgid "Start script disabled" -msgstr "Startscript uitgeschakeld" - -msgid "Start script missing\n\nClick to generate" -msgstr "Opstartscript ontbreekt\n\nKlik om te genereren" - -msgid "Start stream" -msgstr "Stream starten" - -msgid "Started" -msgstr "Gestart" - -msgid "Started At" -msgstr "Gestart om" - -msgid "Starting pod" -msgstr "Pod wordt gestart" - -msgid "Statistics" -msgstr "Statistieken" - -msgid "Stats" -msgstr "Statistieken" - -msgid "Status" -msgstr "Status" - -msgid "Stop container" -msgstr "Container stoppen" - -msgid "Stop stream" -msgstr "Stream stoppen" - -msgid "Stopping pod" -msgstr "Pod wordt gestopt" - -msgid "Subnet" -msgstr "Subnet" - -msgid "Supplementary Groups" -msgstr "Aanvullende groepen" - -msgid "System Diagnostics" -msgstr "Systeemdiagnose" - -msgid "TTY" -msgstr "TTY" - -msgid "Tag" -msgstr "Tag" - -msgid "The sensitive data to store securely" -msgstr "De gevoelige gegevens om veilig op te slaan" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "Voeg het label toe om automatisch bijwerken in te schakelen: io.containers.autoupdate=registry" - -msgid "Total" -msgstr "Totaal" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "Totale geheugenlimiet (geheugen + swap). -1 = onbeperkt, 0 = standaard." - -msgid "Type" -msgstr "Type" - -msgid "Unknown" -msgstr "Onbekend" - -msgid "Unless Stopped" -msgstr "Unless Stopped" - -msgid "Until" -msgstr "Tot" - -msgid "Update" -msgstr "Bijwerken" - -msgid "Update Resources" -msgstr "Bronnen bijwerken" - -msgid "Update name" -msgstr "Naam bijwerken" - -msgid "Update restart policy" -msgstr "Herstartbeleid bijwerken" - -msgid "Updating Images" -msgstr "Images bijwerken" - -msgid "Updating container" -msgstr "Container bijwerken" - -msgid "Upload failed: %s" -msgstr "Upload mislukt: %s" - -msgid "Uploading file..." -msgstr "Bestand uploaden..." - -msgid "User" -msgstr "Gebruiker" - -msgid "User and group to run as (UID:GID)" -msgstr "Gebruiker en groep (UID:GID)" - -msgid "Value" -msgstr "Waarde" - -msgid "Variable" -msgstr "Variabele" - -msgid "Volume" -msgstr "Volume" - -msgid "Volume Name" -msgstr "Volume naam" - -msgid "Volume driver to use" -msgstr "Te gebruiken volumedriver" - -msgid "Volume imported successfully" -msgstr "Volume succesvol geïmporteerd" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "Volumenaam. Leeg laten voor automatisch genereren." - -msgid "Volumes" -msgstr "Volumes" - -msgid "Working Directory" -msgstr "Werkmap" - -msgid "Yes" -msgstr "Ja" - -msgid "default" -msgstr "standaard" - -msgid "non-empty value" -msgstr "niet-lege waarde" - -msgid "running" -msgstr "actief" - -msgid "total" -msgstr "totaal" - -msgid "Are you sure to remove pod?" -msgstr "Weet u zeker dat u de pod wilt verwijderen?" - -msgid "Cgroup parent" -msgstr "Cgroup-parent" - -msgid "CID" -msgstr "CID" - -msgid "CPU %" -msgstr "CPU %" - -msgid "CPU period" -msgstr "CPU-periode" - -msgid "CPU quota" -msgstr "CPU-quotum" - -msgid "CPU set" -msgstr "CPU-set" - -msgid "CPU shares" -msgstr "CPU-shares" - -msgid "DNS options" -msgstr "DNS-opties" - -msgid "DNS search" -msgstr "DNS-zoek" - -msgid "DNS servers" -msgstr "DNS-servers" - -msgid "Exit policy" -msgstr "Exit-beleid" - -msgid "Extra hosts" -msgstr "Extra hosts" - -msgid "Host network" -msgstr "Host-netwerk" - -msgid "Infra container" -msgstr "Infra-container" - -msgid "Memory limit" -msgstr "Geheugenlimiet" - -msgid "Net I/O" -msgstr "Netwerk-I/O" - -msgid "Pause pod" -msgstr "Pod pauzeren" - -msgid "Pod is not running" -msgstr "Pod is niet actief" - -msgid "Remove pod" -msgstr "Pod verwijderen" - -msgid "Restart policy" -msgstr "Herstartbeleid" - -msgid "Restart pod" -msgstr "Pod herstarten" - -msgid "Shared namespaces" -msgstr "Gedeelde namespaces" - -msgid "Start pod" -msgstr "Pod starten" - -msgid "Static IPv4" -msgstr "Statische IPv4" - -msgid "Static MAC" -msgstr "Statische MAC" - -msgid "Stop pod" -msgstr "Pod stoppen" - -msgid "Unlimited" -msgstr "Onbeperkt" - -msgid "Unpause pod" -msgstr "Pod hervatten" - -msgid "Stopping container" -msgstr "Container wordt gestopt" - -msgid "Stop failed: %s" -msgstr "Stoppen mislukt: %s" - -msgid "Removing container" -msgstr "Container wordt verwijderd" - -msgid "Remove failed: %s" -msgstr "Verwijderen mislukt: %s" - -msgid "Creating container" -msgstr "Container wordt aangemaakt" - -msgid "Create failed: %s" -msgstr "Aanmaken mislukt: %s" - -msgid "Starting container" -msgstr "Container wordt gestart" - -msgid "Start failed: %s" -msgstr "Starten mislukt: %s" - -msgid "Reinstating init script" -msgstr "Init-script wordt hersteld" - -msgid "Init script reinstate failed: %s" -msgstr "Herstellen van init-script mislukt: %s" - -msgid "Updated to %s" -msgstr "Bijgewerkt naar %s" - -msgid "Update image: %d/%d - %s" -msgstr "Image bijwerken: %d/%d - %s" - -msgid "Removed old image %s" -msgstr "Oude image %s verwijderd" - -msgid "Done." -msgstr "Klaar." - -msgid "Pause container" -msgstr "Container pauzeren" - -msgid "Unpause container" -msgstr "Container hervatten" diff --git a/luci-app-podman/po/ru/podman.po b/luci-app-podman/po/ru/podman.po deleted file mode 100644 index af132e24d..000000000 --- a/luci-app-podman/po/ru/podman.po +++ /dev/null @@ -1,1093 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: luci-app-podman\n" -"PO-Revision-Date: 2026-05-03 11:05+0000\n" -"Last-Translator:\n" -"Language-Team: Russian \n" -"Language: ru\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "" -"Start script missing\n" -"\n" -"Click to generate" -msgstr "Скрипт запуска отсутствует\n\nНажмите для создания" - -msgid "%d check(s) failed:" -msgstr "%d проверок не удалось:" - -msgid "%d updated, %d failed:" -msgstr "%d обновлено, %d не удалось:" - -msgid "%s created successfully" -msgstr "%s успешно создан" - -msgid "%s: %d/%d" -msgstr "%s: %d/%d" - -msgid "(none)" -msgstr "(нет)" - -msgid "-- Select %s --" -msgstr "-- Выберите %s --" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "1-253 символа: только буквы, цифры, подчёркивание (_) и дефис (-)" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "512m, 1g или -1 для неограниченно" - -msgid "API Version" -msgstr "Версия API" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "Добавить контейнер в существующий под. Сеть, имя хоста и сопоставления портов берутся из infra-контейнера пода." - -msgid "All images updated successfully" -msgstr "Все образы успешно обновлены" - -msgid "All volumes exported successfully" -msgstr "Все тома успешно экспортированы" - -msgid "Allocate TTY (-t)" -msgstr "Выделить TTY (-t)" - -msgid "Allocate container IP from this range" -msgstr "Выделить IP контейнера из этого диапазона" - -msgid "Always" -msgstr "Всегда" - -msgid "Apply Updates" -msgstr "Применить обновления" - -msgid "Are you sure to delete the records?" -msgstr "Вы уверены, что хотите удалить записи?" - -msgid "Are you sure to remove container?" -msgstr "Вы уверены, что хотите удалить контейнер?" - -msgid "Are you sure to remove integration?" -msgstr "Вы уверены, что хотите удалить интеграцию?" - -msgid "Auto Remove (--rm)" -msgstr "Автоудаление (--rm)" - -msgid "Auto Update" -msgstr "Автообновление" - -msgid "Auto-Update" -msgstr "Автообновление" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "Автоматически настроить сетевой интерфейс OpenWrt, мост и зону брандмауэра. Настоятельно рекомендуется для правильной работы сети контейнеров на OpenWrt." - -msgid "Automatically start the container after it is created" -msgstr "Автоматически запускать контейнер после создания" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "Автоматически обновлять контейнер при наличии нового образа. Добавляет метку: `io.containers.autoupdate=registry`" - -msgid "Basic Information" -msgstr "Основная информация" - -msgid "Block I/O" -msgstr "Блочный ввод/вывод" - -msgid "Boot" -msgstr "Загрузка" - -msgid "Bridge Interface Name" -msgstr "Имя интерфейса моста" - -msgid "CPU" -msgstr "ЦП" - -msgid "CPU Limit" -msgstr "Ограничение ЦП" - -msgid "CPU Set" -msgstr "Набор CPU" - -msgid "CPU Shares Weight" -msgstr "Вес долей ЦП" - -msgid "CPU Usage" -msgstr "Использование ЦП" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "Доли ЦП (относительный вес). 0 = использовать по умолчанию." - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "CPU, на которых разрешено выполнять под (например, \"0-3\" или \"0,2\")" - -msgid "Cancel" -msgstr "Отмена" - -msgid "Check" -msgstr "Проверить" - -msgid "Check %d containers for updates?" -msgstr "Проверить %d контейнеров на обновления?" - -msgid "Check Complete" -msgstr "Проверка завершена" - -msgid "Check for Updates" -msgstr "Проверить обновления" - -msgid "Check for updates: %s/%s" -msgstr "Проверка обновлений: %s/%s" - -msgid "Choose firewall zone for this network." -msgstr "Выберите зону брандмауэра для этой сети." - -msgid "Clean Up Now" -msgstr "Очистить сейчас" - -msgid "Cleaning up old images..." -msgstr "Очистка старых образов..." - -msgid "Cleanup / Prune" -msgstr "Очистка / Удаление неиспользуемого" - -msgid "Cleanup Complete" -msgstr "Очистка завершена" - -msgid "Cleanup Unused Resources" -msgstr "Очистка неиспользуемых ресурсов" - -msgid "Cleanup successful!" -msgstr "Очистка успешна!" - -msgid "Clear logs" -msgstr "Очистить логи" - -msgid "Click icon to repair" -msgstr "Нажмите значок для восстановления" - -msgid "Click to disconnect" -msgstr "Нажмите для отключения" - -msgid "Click to enable/disable" -msgstr "Нажмите для включения/отключения" - -msgid "Click to reveal/hide value" -msgstr "Нажмите для отображения/скрытия значения" - -msgid "Close" -msgstr "Закрыть" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "Список дополнительных идентификаторов групп через запятую" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "Порты для публикации через запятую (например, 6052, 8080/udp)" - -msgid "Command" -msgstr "Команда" - -msgid "Command to run (space-separated)" -msgstr "Команда для запуска (разделённая пробелами)" - -msgid "Configuration" -msgstr "Конфигурация" - -msgid "Configure resource limits for this container." -msgstr "Настройте ограничения ресурсов для этого контейнера." - -msgid "Confirm" -msgstr "Подтвердить" - -msgid "Connect" -msgstr "Подключить" - -msgid "Connect to" -msgstr "Подключить к" - -msgid "Connected successfully to %s" -msgstr "Успешно подключено к %s" - -msgid "Connecting container to network" -msgstr "Подключение контейнера к сети" - -msgid "Console" -msgstr "Консоль" - -msgid "Container" -msgstr "Контейнер" - -msgid "Container Name" -msgstr "Имя контейнера" - -msgid "Container image has no tag - cannot update" -msgstr "Образ контейнера не имеет тега - невозможно обновить" - -msgid "Container image to use" -msgstr "Образ контейнера для использования" - -msgid "Container is not running" -msgstr "Контейнер не запущен" - -msgid "Container updated successfully" -msgstr "Контейнер успешно обновлён" - -msgid "Containers" -msgstr "Контейнеры" - -msgid "Containers in pod %s" -msgstr "Контейнеры в поде %s" - -msgid "Containers updated successfully" -msgstr "Контейнеры успешно обновлены" - -msgid "Containers updated successfully." -msgstr "Контейнеры успешно обновлены." - -msgid "Create" -msgstr "Создать" - -msgid "Create %s" -msgstr "Создать %s" - -msgid "Create Command" -msgstr "Команда создания" - -msgid "Create Infra Container" -msgstr "Создать infra-контейнер" - -msgid "Create new zone (will be named: podman_)" -msgstr "Создать новую зону (будет названа: podman_<имя-сети>)" - -msgid "Created" -msgstr "Создано" - -msgid "Creating %s" -msgstr "Создание %s" - -msgid "Creating auto-start configuration for %s" -msgstr "Создание конфигурации автозапуска для %s" - -msgid "DNS Search Domains" -msgstr "Домены поиска DNS" - -msgid "DNS Servers" -msgstr "DNS-серверы" - -msgid "DNS search domains for the infra container" -msgstr "Домены поиска DNS для infra-контейнера" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "DNS-серверы для infra-контейнера (общие для всех контейнеров пода)" - -msgid "Delete" -msgstr "Удалить" - -msgid "Deleting records: %d/%d" -msgstr "Удаление записей: %d/%d" - -msgid "Deleting records: %s/%s" -msgstr "Удаление записей: %s/%s" - -msgid "Destination" -msgstr "Назначение" - -msgid "Device" -msgstr "Устройство" - -msgid "Disabled" -msgstr "Отключено" - -msgid "Disabling init script" -msgstr "Отключение скрипта инициализации" - -msgid "Disconnect container from network" -msgstr "Отключить контейнер от сети" - -msgid "Disconnected from %s" -msgstr "Отключено от %s" - -msgid "Dnsmasq" -msgstr "Dnsmasq" - -msgid "Driver" -msgstr "Драйвер" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "Опции драйвера (разделённые запятыми, например, type=tmpfs,o=size=100m)" - -msgid "Enable IPv6" -msgstr "Включить IPv6" - -msgid "Enable IPv6 networking" -msgstr "Включить сеть IPv6" - -msgid "Enabling init script" -msgstr "Включение скрипта инициализации" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "Введите секретные данные (пароль, токен, ключ и т.д.)" - -msgid "Entrypoint" -msgstr "Точка входа" - -msgid "Environment Variables" -msgstr "Переменные окружения" - -msgid "Ephemeral (--rm flag)" -msgstr "Эфемерный (флаг --rm)" - -msgid "Error" -msgstr "Ошибка" - -msgid "Error: %s" -msgstr "Ошибка: %s" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "Существующий физический интерфейс для использования в качестве родительского. Требуется для сетей macvlan/ipvlan." - -msgid "Expecting: %s" -msgstr "Ожидается: %s" - -msgid "Export" -msgstr "Экспорт" - -msgid "Exporting selected volumes: %d/%d" -msgstr "Экспорт выбранных томов: %d/%d" - -msgid "Expose Ports" -msgstr "Открываемые порты" - -msgid "Failed to create container" -msgstr "Не удалось создать контейнер" - -msgid "Fetching information..." -msgstr "Получение информации..." - -msgid "Find updateable containers" -msgstr "Найти контейнеры с доступными обновлениями" - -msgid "Firewall Zone" -msgstr "Зона брандмауэра" - -msgid "Gateway" -msgstr "Шлюз" - -msgid "Generate" -msgstr "Сгенерировать" - -msgid "Graph Root" -msgstr "Корень графа" - -msgid "Health" -msgstr "Состояние" - -msgid "Hostname" -msgstr "Имя хоста" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "Имя хоста для пода (по умолчанию — имя пода)" - -msgid "ID" -msgstr "ID" - -msgid "IP Address" -msgstr "IP-адрес" - -msgid "IP Range (CIDR)" -msgstr "Диапазон IP (CIDR)" - -msgid "IPv4 Gateway" -msgstr "Шлюз IPv4" - -msgid "IPv4 Subnet (CIDR)" -msgstr "Подсеть IPv4 (CIDR)" - -msgid "IPv4 gateway address" -msgstr "Адрес шлюза IPv4" - -msgid "IPv4 subnet in CIDR notation" -msgstr "Подсеть IPv4 в нотации CIDR" - -msgid "Image" -msgstr "Образ" - -msgid "Image ID" -msgstr "ID образа" - -msgid "Image is already up-to-date" -msgstr "Образ уже актуален" - -msgid "Image pulled successfully" -msgstr "Образ успешно загружен" - -msgid "Images" -msgstr "Образы" - -msgid "Import" -msgstr "Импорт" - -msgid "Import from archive: %s" -msgstr "Импорт из архива: %s" - -msgid "Importing volume..." -msgstr "Импорт тома..." - -msgid "Info" -msgstr "Инфо" - -msgid "Information" -msgstr "Информация" - -msgid "Infra Image" -msgstr "Infra-образ" - -msgid "Init Script" -msgstr "Скрипт инициализации" - -msgid "Inspect" -msgstr "Проверить" - -msgid "Int" -msgstr "Целое число" - -msgid "Interactive" -msgstr "Интерактивный" - -msgid "Interface" -msgstr "Интерфейс" - -msgid "Internal Network" -msgstr "Внутренняя сеть" - -msgid "Labels" -msgstr "Метки" - -msgid "Labels in key=value format, one per line" -msgstr "Метки в формате key=value, по одной на строку" - -msgid "Leave empty to auto-generate" -msgstr "Оставьте пустым для автогенерации" - -msgid "Links" -msgstr "Ссылки" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "Пространства имён Linux, общие для контейнеров пода. По умолчанию соответствует `podman pod create`." - -msgid "Load" -msgstr "Загрузить" - -msgid "Load System diagnostics" -msgstr "Загрузить системную диагностику" - -msgid "Loading init script" -msgstr "Загрузка скрипта инициализации" - -msgid "Loading..." -msgstr "Загрузка..." - -msgid "Logs" -msgstr "Логи" - -msgid "Manage podman %s" -msgstr "Управление podman %s" - -msgid "Memory" -msgstr "Память" - -msgid "Memory %" -msgstr "Память %" - -msgid "Memory + Swap Limit" -msgstr "Память + Ограничение Swap" - -msgid "Memory Limit" -msgstr "Ограничение памяти" - -msgid "Memory Usage" -msgstr "Использование памяти" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "Ограничение памяти (например, 512м, 1г)" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "Ограничение памяти (например, 512m, 1g). -1 = неограниченно, 0 = использовать по умолчанию." - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "Лимит памяти для пода (например, 512m, 1g)" - -msgid "Mode" -msgstr "Режим" - -msgid "Mount Options" -msgstr "Опции монтирования" - -msgid "Mountpoint" -msgstr "Точка монтирования" - -msgid "Mounts" -msgstr "Монтирования" - -msgid "Must be between 0 and 262144" -msgstr "Должно быть между 0 и 262144" - -msgid "Name" -msgstr "Имя" - -msgid "Name for the network" -msgstr "Имя для сети" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "Имя интерфейса моста (например, podman0, mynet0). Оставьте пустым для использования: <имя-сети>0. Примечание: Если сгенерированное имя конфликтует с существующим интерфейсом, OpenWrt автоматически увеличит его." - -msgid "Name updated successfully" -msgstr "Имя успешно обновлено" - -msgid "Network" -msgstr "Сеть" - -msgid "Network I/O" -msgstr "Сетевой ввод/вывод" - -msgid "Network Mode" -msgstr "Сетевой режим" - -msgid "Network Name" -msgstr "Имя сети" - -msgid "Network driver" -msgstr "Сетевой драйвер" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "Сетевое пространство имён для пода. Контейнеры в поде используют общую сеть." - -msgid "Networks" -msgstr "Сети" - -msgid "Never" -msgstr "Никогда" - -msgid "No" -msgstr "Нет" - -msgid "No %s selected" -msgstr "%s не выбрано" - -msgid "No containers in this pod" -msgstr "В этом поде нет контейнеров" - -msgid "No containers with auto-update label found." -msgstr "Контейнеры с меткой автообновления не найдены." - -msgid "No new updates available." -msgstr "Новые обновления недоступны." - -msgid "No suitable interfaces found" -msgstr "Подходящие интерфейсы не найдены" - -msgid "No unused resources found" -msgstr "Неиспользуемые ресурсы не найдены" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "Количество ЦП (например, 0.5, 1.0, 2.0)" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "Количество ЦП (например, 0.5, 1.0, 2.0). Оставьте пустым для неограниченно." - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "Количество CPU, доступных поду (например, 0.5, 1.0, 2.0)" - -msgid "Number of lines" -msgstr "Количество строк" - -msgid "OK" -msgstr "OK" - -msgid "Old image still used by other containers" -msgstr "Старый образ ещё используется другими контейнерами" - -msgid "On Failure" -msgstr "При ошибке" - -msgid "One per line, format: host:container[/protocol]" -msgstr "По одному на строку, формат: хост:контейнер[/протокол]" - -msgid "One per line, format: key=value" -msgstr "По одному на строку, формат: key=value" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "По одному на строку. Формат: источник:назначение[:опции]. Опции: ro, rw, Z, z" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "Интеграция OpenWrt существует\n\nНажмите для удаления" - -msgid "OpenWrt integration incomplete" -msgstr "Интеграция с OpenWrt неполная" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "Интеграция с OpenWrt требует указания подсети" - -msgid "Override the image used for the infra container" -msgstr "Переопределить образ, используемый для infra-контейнера" - -msgid "PIDs" -msgstr "PID" - -msgid "Parent Interface" -msgstr "Родительский интерфейс" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "Родительский интерфейс требуется для сетей macvlan/ipvlan" - -msgid "Part of a pod (\"%s\")" -msgstr "Часть пода (\"%s\")" - -msgid "Pausing pod" -msgstr "Приостановка пода" - -msgid "Pod" -msgstr "Под" - -msgid "Pod Name" -msgstr "Имя пода" - -msgid "Podman Version" -msgstr "Версия Podman" - -msgid "Pods" -msgstr "Поды" - -msgid "Port Mappings" -msgstr "Маппинг портов" - -msgid "Ports" -msgstr "Порты" - -msgid "Privileged" -msgstr "Привилегированный" - -msgid "Privileged Mode" -msgstr "Привилегированный режим" - -msgid "Processes" -msgstr "Процессы" - -msgid "Pull Image" -msgstr "Загрузить образ" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "Загрузка не вернула ID образа - возможно, загрузка не удалась" - -msgid "Pulling %s" -msgstr "Загрузка %s" - -msgid "Read: %s / Write: %s" -msgstr "Чтение: %s / Запись: %s" - -msgid "Refreshing %s..." -msgstr "Обновление %s..." - -msgid "Registries" -msgstr "Реестры" - -msgid "Registry" -msgstr "Реестр" - -msgid "Reload" -msgstr "Перезагрузить" - -msgid "Remove OpenWrt integration" -msgstr "Удалить интеграцию с OpenWrt" - -msgid "Remove all unused images (not just dangling)" -msgstr "Удалить все неиспользуемые образы (не только висячие)" - -msgid "Remove container" -msgstr "Удалить контейнер" - -msgid "Remove unused volumes" -msgstr "Удалить неиспользуемые тома" - -msgid "Removed: %s" -msgstr "Удалено: %s" - -msgid "Removing unused resources, please wait..." -msgstr "Удаление неиспользуемых ресурсов, пожалуйста, подождите..." - -msgid "Repository" -msgstr "Репозиторий" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "Требуется для общего сетевого пространства имён. Отключайте только если уверены, что это не нужно." - -msgid "Resources" -msgstr "Ресурсы" - -msgid "Restart Policy" -msgstr "Политика перезапуска" - -msgid "Restart container" -msgstr "Перезапустить контейнер" - -msgid "Restart policy updated successfully" -msgstr "Политика перезапуска успешно обновлена" - -msgid "Restarting pod" -msgstr "Перезапуск пода" - -msgid "Restrict external access to the network" -msgstr "Ограничить внешний доступ к сети" - -msgid "Run Root" -msgstr "Корень запуска" - -msgid "Saving resource" -msgstr "Сохранение ресурса" - -msgid "Secret" -msgstr "Секрет" - -msgid "Secret Data" -msgstr "Секретные данные" - -msgid "Secret Name" -msgstr "Имя секрета" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "Имя секрета может содержать только буквы, цифры, подчёркивания и дефисы" - -msgid "Secrets" -msgstr "Секреты" - -msgid "Security Notice:" -msgstr "Уведомление о безопасности:" - -msgid "Select containers to update" -msgstr "Выберите контейнеры для обновления" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "Выберите сеть для нового контейнера. Пользовательские сети обеспечивают лучшую изоляцию и разрешение DNS между контейнерами." - -msgid "Select what to clean up:" -msgstr "Выберите, что очистить:" - -msgid "Sensitive data is hidden for security reasons." -msgstr "Конфиденциальные данные скрыты по соображениям безопасности." - -msgid "Setup OpenWrt Integration" -msgstr "Настроить интеграцию с OpenWrt" - -msgid "Shared Namespaces" -msgstr "Общие пространства имён" - -msgid "Shares network with another container" -msgstr "Использует общую сеть с другим контейнером" - -msgid "Show" -msgstr "Показать" - -msgid "Since" -msgstr "С" - -msgid "Size" -msgstr "Размер" - -msgid "Socket Path" -msgstr "Путь к сокету" - -msgid "Source" -msgstr "Источник" - -msgid "Space freed: %s" -msgstr "Освобождено места: %s" - -msgid "Start after creation" -msgstr "Запустить после создания" - -msgid "Start container" -msgstr "Запустить контейнер" - -msgid "Start on boot" -msgstr "Запускать при загрузке" - -msgid "Start script disabled" -msgstr "Скрипт запуска отключён" - -msgid "Start stream" -msgstr "Начать поток" - -msgid "Started" -msgstr "Запущено" - -msgid "Started At" -msgstr "Запущено в" - -msgid "Starting pod" -msgstr "Запуск пода" - -msgid "Statistics" -msgstr "Статистика" - -msgid "Stats" -msgstr "Статистика" - -msgid "Status" -msgstr "Статус" - -msgid "Stop container" -msgstr "Остановить контейнер" - -msgid "Stop stream" -msgstr "Остановить поток" - -msgid "Stopping pod" -msgstr "Остановка пода" - -msgid "Subnet" -msgstr "Подсеть" - -msgid "Supplementary Groups" -msgstr "Дополнительные группы" - -msgid "System Diagnostics" -msgstr "Системная диагностика" - -msgid "TTY" -msgstr "TTY" - -msgid "Tag" -msgstr "Тег" - -msgid "The sensitive data to store securely" -msgstr "Конфиденциальные данные для безопасного хранения" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "Для включения автообновления контейнера добавьте метку: `io.containers.autoupdate=registry`" - -msgid "Total" -msgstr "Всего" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "Общее ограничение памяти (память + swap). -1 = неограниченно, 0 = использовать по умолчанию." - -msgid "Type" -msgstr "Тип" - -msgid "Unknown" -msgstr "Неизвестно" - -msgid "Unless Stopped" -msgstr "Пока не остановлен" - -msgid "Until" -msgstr "До" - -msgid "Update" -msgstr "Обновить" - -msgid "Update Resources" -msgstr "Обновить ресурсы" - -msgid "Update name" -msgstr "Обновить имя" - -msgid "Update restart policy" -msgstr "Обновить политику перезапуска" - -msgid "Updating Images" -msgstr "Обновление образов" - -msgid "Updating container" -msgstr "Обновление контейнера" - -msgid "Upload failed: %s" -msgstr "Загрузка не удалась: %s" - -msgid "Uploading file..." -msgstr "Загрузка файла..." - -msgid "User" -msgstr "Пользователь" - -msgid "User and group to run as (UID:GID)" -msgstr "Пользователь и группа для запуска (UID:GID)" - -msgid "Value" -msgstr "Значение" - -msgid "Variable" -msgstr "Переменная" - -msgid "Volume" -msgstr "Том" - -msgid "Volume Name" -msgstr "Имя тома" - -msgid "Volume driver to use" -msgstr "Драйвер тома для использования" - -msgid "Volume imported successfully" -msgstr "Том успешно импортирован" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "Имя тома. Оставьте пустым для автогенерации." - -msgid "Volumes" -msgstr "Тома" - -msgid "Working Directory" -msgstr "Рабочая директория" - -msgid "Yes" -msgstr "Да" - -msgid "default" -msgstr "по умолчанию" - -msgid "non-empty value" -msgstr "непустое значение" - -msgid "running" -msgstr "запущен" - -msgid "total" -msgstr "всего" - -msgid "Are you sure to remove pod?" -msgstr "Действительно удалить под?" - -msgid "Cgroup parent" -msgstr "Родитель cgroup" - -msgid "CID" -msgstr "CID" - -msgid "CPU %" -msgstr "ЦП %" - -msgid "CPU period" -msgstr "Период CPU" - -msgid "CPU quota" -msgstr "Квота CPU" - -msgid "CPU set" -msgstr "Набор CPU" - -msgid "CPU shares" -msgstr "Доли CPU" - -msgid "DNS options" -msgstr "Параметры DNS" - -msgid "DNS search" -msgstr "Поиск DNS" - -msgid "DNS servers" -msgstr "DNS-серверы" - -msgid "Exit policy" -msgstr "Политика выхода" - -msgid "Extra hosts" -msgstr "Дополнительные хосты" - -msgid "Host network" -msgstr "Сеть хоста" - -msgid "Infra container" -msgstr "Infra-контейнер" - -msgid "Memory limit" -msgstr "Лимит памяти" - -msgid "Net I/O" -msgstr "Сетевой I/O" - -msgid "Pause pod" -msgstr "Приостановить под" - -msgid "Pod is not running" -msgstr "Под не запущен" - -msgid "Remove pod" -msgstr "Удалить под" - -msgid "Restart policy" -msgstr "Политика перезапуска" - -msgid "Restart pod" -msgstr "Перезапустить под" - -msgid "Shared namespaces" -msgstr "Общие пространства имён" - -msgid "Start pod" -msgstr "Запустить под" - -msgid "Static IPv4" -msgstr "Статический IPv4" - -msgid "Static MAC" -msgstr "Статический MAC" - -msgid "Stop pod" -msgstr "Остановить под" - -msgid "Unlimited" -msgstr "Без ограничений" - -msgid "Unpause pod" -msgstr "Возобновить под" - -msgid "Stopping container" -msgstr "Остановка контейнера" - -msgid "Stop failed: %s" -msgstr "Ошибка остановки: %s" - -msgid "Removing container" -msgstr "Удаление контейнера" - -msgid "Remove failed: %s" -msgstr "Ошибка удаления: %s" - -msgid "Creating container" -msgstr "Создание контейнера" - -msgid "Create failed: %s" -msgstr "Ошибка создания: %s" - -msgid "Starting container" -msgstr "Запуск контейнера" - -msgid "Start failed: %s" -msgstr "Ошибка запуска: %s" - -msgid "Reinstating init script" -msgstr "Восстановление скрипта инициализации" - -msgid "Init script reinstate failed: %s" -msgstr "Ошибка восстановления скрипта инициализации: %s" - -msgid "Updated to %s" -msgstr "Обновлено до %s" - -msgid "Update image: %d/%d - %s" -msgstr "Обновление образа: %d/%d - %s" - -msgid "Removed old image %s" -msgstr "Старый образ %s удалён" - -msgid "Done." -msgstr "Готово." - -msgid "Pause container" -msgstr "Приостановить контейнер" - -msgid "Unpause container" -msgstr "Возобновить контейнер" diff --git a/luci-app-podman/po/templates/podman.pot b/luci-app-podman/po/templates/podman.pot deleted file mode 100644 index 2641b17eb..000000000 --- a/luci-app-podman/po/templates/podman.pot +++ /dev/null @@ -1,1081 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -msgid "%d check(s) failed:" -msgstr "" - -msgid "%d updated, %d failed:" -msgstr "" - -msgid "%s created successfully" -msgstr "" - -msgid "%s: %d/%d" -msgstr "" - -msgid "(none)" -msgstr "" - -msgid "-- Select %s --" -msgstr "" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "" - -msgid "API Version" -msgstr "" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "" - -msgid "All images updated successfully" -msgstr "" - -msgid "All volumes exported successfully" -msgstr "" - -msgid "Allocate TTY (-t)" -msgstr "" - -msgid "Allocate container IP from this range" -msgstr "" - -msgid "Always" -msgstr "" - -msgid "Apply Updates" -msgstr "" - -msgid "Are you sure to delete the records?" -msgstr "" - -msgid "Are you sure to remove container?" -msgstr "" - -msgid "Are you sure to remove integration?" -msgstr "" - -msgid "Auto Remove (--rm)" -msgstr "" - -msgid "Auto Update" -msgstr "" - -msgid "Auto-Update" -msgstr "" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "" - -msgid "Automatically start the container after it is created" -msgstr "" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "" - -msgid "Basic Information" -msgstr "" - -msgid "Block I/O" -msgstr "" - -msgid "Boot" -msgstr "" - -msgid "Bridge Interface Name" -msgstr "" - -msgid "CPU" -msgstr "" - -msgid "CPU Limit" -msgstr "" - -msgid "CPU Set" -msgstr "" - -msgid "CPU Shares Weight" -msgstr "" - -msgid "CPU Usage" -msgstr "" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "" - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "" - -msgid "Cancel" -msgstr "" - -msgid "Check" -msgstr "" - -msgid "Check %d containers for updates?" -msgstr "" - -msgid "Check Complete" -msgstr "" - -msgid "Check for Updates" -msgstr "" - -msgid "Check for updates: %s/%s" -msgstr "" - -msgid "Choose firewall zone for this network." -msgstr "" - -msgid "Clean Up Now" -msgstr "" - -msgid "Cleaning up old images..." -msgstr "" - -msgid "Cleanup / Prune" -msgstr "" - -msgid "Cleanup Complete" -msgstr "" - -msgid "Cleanup Unused Resources" -msgstr "" - -msgid "Cleanup successful!" -msgstr "" - -msgid "Clear logs" -msgstr "" - -msgid "Click icon to repair" -msgstr "" - -msgid "Click to disconnect" -msgstr "" - -msgid "Click to enable/disable" -msgstr "" - -msgid "Click to reveal/hide value" -msgstr "" - -msgid "Close" -msgstr "" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "" - -msgid "Command" -msgstr "" - -msgid "Command to run (space-separated)" -msgstr "" - -msgid "Configuration" -msgstr "" - -msgid "Configure resource limits for this container." -msgstr "" - -msgid "Confirm" -msgstr "" - -msgid "Connect" -msgstr "" - -msgid "Connect to" -msgstr "" - -msgid "Connected successfully to %s" -msgstr "" - -msgid "Connecting container to network" -msgstr "" - -msgid "Console" -msgstr "" - -msgid "Container" -msgstr "" - -msgid "Container Name" -msgstr "" - -msgid "Container image has no tag - cannot update" -msgstr "" - -msgid "Container image to use" -msgstr "" - -msgid "Container is not running" -msgstr "" - -msgid "Container updated successfully" -msgstr "" - -msgid "Containers" -msgstr "" - -msgid "Containers in pod %s" -msgstr "" - -msgid "Containers updated successfully" -msgstr "" - -msgid "Containers updated successfully." -msgstr "" - -msgid "Create" -msgstr "" - -msgid "Create %s" -msgstr "" - -msgid "Create Command" -msgstr "" - -msgid "Create Infra Container" -msgstr "" - -msgid "Create new zone (will be named: podman_)" -msgstr "" - -msgid "Created" -msgstr "" - -msgid "Creating %s" -msgstr "" - -msgid "Creating auto-start configuration for %s" -msgstr "" - -msgid "DNS Search Domains" -msgstr "" - -msgid "DNS Servers" -msgstr "" - -msgid "DNS search domains for the infra container" -msgstr "" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "" - -msgid "Delete" -msgstr "" - -msgid "Deleting records: %d/%d" -msgstr "" - -msgid "Deleting records: %s/%s" -msgstr "" - -msgid "Destination" -msgstr "" - -msgid "Device" -msgstr "" - -msgid "Disabled" -msgstr "" - -msgid "Disabling init script" -msgstr "" - -msgid "Disconnect container from network" -msgstr "" - -msgid "Disconnected from %s" -msgstr "" - -msgid "Dnsmasq" -msgstr "" - -msgid "Driver" -msgstr "" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "" - -msgid "Enable IPv6" -msgstr "" - -msgid "Enable IPv6 networking" -msgstr "" - -msgid "Enabling init script" -msgstr "" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "" - -msgid "Entrypoint" -msgstr "" - -msgid "Environment Variables" -msgstr "" - -msgid "Ephemeral (--rm flag)" -msgstr "" - -msgid "Error" -msgstr "" - -msgid "Error: %s" -msgstr "" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "" - -msgid "Expecting: %s" -msgstr "" - -msgid "Export" -msgstr "" - -msgid "Exporting selected volumes: %d/%d" -msgstr "" - -msgid "Expose Ports" -msgstr "" - -msgid "Failed to create container" -msgstr "" - -msgid "Fetching information..." -msgstr "" - -msgid "Find updateable containers" -msgstr "" - -msgid "Firewall Zone" -msgstr "" - -msgid "Gateway" -msgstr "" - -msgid "Generate" -msgstr "" - -msgid "Graph Root" -msgstr "" - -msgid "Health" -msgstr "" - -msgid "Hostname" -msgstr "" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "" - -msgid "ID" -msgstr "" - -msgid "IP Address" -msgstr "" - -msgid "IP Range (CIDR)" -msgstr "" - -msgid "IPv4 Gateway" -msgstr "" - -msgid "IPv4 Subnet (CIDR)" -msgstr "" - -msgid "IPv4 gateway address" -msgstr "" - -msgid "IPv4 subnet in CIDR notation" -msgstr "" - -msgid "Image" -msgstr "" - -msgid "Image ID" -msgstr "" - -msgid "Image is already up-to-date" -msgstr "" - -msgid "Image pulled successfully" -msgstr "" - -msgid "Images" -msgstr "" - -msgid "Import" -msgstr "" - -msgid "Import from archive: %s" -msgstr "" - -msgid "Importing volume..." -msgstr "" - -msgid "Info" -msgstr "" - -msgid "Information" -msgstr "" - -msgid "Infra Image" -msgstr "" - -msgid "Init Script" -msgstr "" - -msgid "Inspect" -msgstr "" - -msgid "Int" -msgstr "" - -msgid "Interactive" -msgstr "" - -msgid "Interface" -msgstr "" - -msgid "Internal Network" -msgstr "" - -msgid "Labels" -msgstr "" - -msgid "Labels in key=value format, one per line" -msgstr "" - -msgid "Leave empty to auto-generate" -msgstr "" - -msgid "Links" -msgstr "" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "" - -msgid "Load" -msgstr "" - -msgid "Load System diagnostics" -msgstr "" - -msgid "Loading init script" -msgstr "" - -msgid "Loading..." -msgstr "" - -msgid "Logs" -msgstr "" - -msgid "Manage podman %s" -msgstr "" - -msgid "Memory" -msgstr "" - -msgid "Memory %" -msgstr "" - -msgid "Memory + Swap Limit" -msgstr "" - -msgid "Memory Limit" -msgstr "" - -msgid "Memory Usage" -msgstr "" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "" - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "" - -msgid "Mode" -msgstr "" - -msgid "Mount Options" -msgstr "" - -msgid "Mountpoint" -msgstr "" - -msgid "Mounts" -msgstr "" - -msgid "Must be between 0 and 262144" -msgstr "" - -msgid "Name" -msgstr "" - -msgid "Name for the network" -msgstr "" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "" - -msgid "Name updated successfully" -msgstr "" - -msgid "Network" -msgstr "" - -msgid "Network I/O" -msgstr "" - -msgid "Network Mode" -msgstr "" - -msgid "Network Name" -msgstr "" - -msgid "Network driver" -msgstr "" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "" - -msgid "Networks" -msgstr "" - -msgid "Never" -msgstr "" - -msgid "No" -msgstr "" - -msgid "No %s selected" -msgstr "" - -msgid "No containers in this pod" -msgstr "" - -msgid "No containers with auto-update label found." -msgstr "" - -msgid "No new updates available." -msgstr "" - -msgid "No suitable interfaces found" -msgstr "" - -msgid "No unused resources found" -msgstr "" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "" - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "" - -msgid "Number of lines" -msgstr "" - -msgid "OK" -msgstr "" - -msgid "Old image still used by other containers" -msgstr "" - -msgid "On Failure" -msgstr "" - -msgid "One per line, format: host:container[/protocol]" -msgstr "" - -msgid "One per line, format: key=value" -msgstr "" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "" - -msgid "OpenWrt integration incomplete" -msgstr "" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "" - -msgid "Override the image used for the infra container" -msgstr "" - -msgid "PIDs" -msgstr "" - -msgid "Parent Interface" -msgstr "" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "" - -msgid "Part of a pod (\"%s\")" -msgstr "" - -msgid "Pausing pod" -msgstr "" - -msgid "Pod" -msgstr "" - -msgid "Pod Name" -msgstr "" - -msgid "Podman Version" -msgstr "" - -msgid "Pods" -msgstr "" - -msgid "Port Mappings" -msgstr "" - -msgid "Ports" -msgstr "" - -msgid "Privileged" -msgstr "" - -msgid "Privileged Mode" -msgstr "" - -msgid "Processes" -msgstr "" - -msgid "Pull Image" -msgstr "" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "" - -msgid "Pulling %s" -msgstr "" - -msgid "Read: %s / Write: %s" -msgstr "" - -msgid "Refreshing %s..." -msgstr "" - -msgid "Registries" -msgstr "" - -msgid "Registry" -msgstr "" - -msgid "Reload" -msgstr "" - -msgid "Remove OpenWrt integration" -msgstr "" - -msgid "Remove all unused images (not just dangling)" -msgstr "" - -msgid "Remove container" -msgstr "" - -msgid "Remove unused volumes" -msgstr "" - -msgid "Removed: %s" -msgstr "" - -msgid "Removing unused resources, please wait..." -msgstr "" - -msgid "Repository" -msgstr "" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "" - -msgid "Resources" -msgstr "" - -msgid "Restart Policy" -msgstr "" - -msgid "Restart container" -msgstr "" - -msgid "Restart policy updated successfully" -msgstr "" - -msgid "Restarting pod" -msgstr "" - -msgid "Restrict external access to the network" -msgstr "" - -msgid "Run Root" -msgstr "" - -msgid "Saving resource" -msgstr "" - -msgid "Secret" -msgstr "" - -msgid "Secret Data" -msgstr "" - -msgid "Secret Name" -msgstr "" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "" - -msgid "Secrets" -msgstr "" - -msgid "Security Notice:" -msgstr "" - -msgid "Select containers to update" -msgstr "" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "" - -msgid "Select what to clean up:" -msgstr "" - -msgid "Sensitive data is hidden for security reasons." -msgstr "" - -msgid "Setup OpenWrt Integration" -msgstr "" - -msgid "Shared Namespaces" -msgstr "" - -msgid "Shares network with another container" -msgstr "" - -msgid "Show" -msgstr "" - -msgid "Since" -msgstr "" - -msgid "Size" -msgstr "" - -msgid "Socket Path" -msgstr "" - -msgid "Source" -msgstr "" - -msgid "Space freed: %s" -msgstr "" - -msgid "Start after creation" -msgstr "" - -msgid "Start container" -msgstr "" - -msgid "Start on boot" -msgstr "" - -msgid "Start script disabled" -msgstr "" - -msgid "Start script missing\n\nClick to generate" -msgstr "" - -msgid "Start stream" -msgstr "" - -msgid "Started" -msgstr "" - -msgid "Started At" -msgstr "" - -msgid "Starting pod" -msgstr "" - -msgid "Statistics" -msgstr "" - -msgid "Stats" -msgstr "" - -msgid "Status" -msgstr "" - -msgid "Stop container" -msgstr "" - -msgid "Stop stream" -msgstr "" - -msgid "Stopping pod" -msgstr "" - -msgid "Subnet" -msgstr "" - -msgid "Supplementary Groups" -msgstr "" - -msgid "System Diagnostics" -msgstr "" - -msgid "TTY" -msgstr "" - -msgid "Tag" -msgstr "" - -msgid "The sensitive data to store securely" -msgstr "" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "" - -msgid "Total" -msgstr "" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "" - -msgid "Type" -msgstr "" - -msgid "Unknown" -msgstr "" - -msgid "Unless Stopped" -msgstr "" - -msgid "Until" -msgstr "" - -msgid "Update" -msgstr "" - -msgid "Update Resources" -msgstr "" - -msgid "Update name" -msgstr "" - -msgid "Update restart policy" -msgstr "" - -msgid "Updating Images" -msgstr "" - -msgid "Updating container" -msgstr "" - -msgid "Upload failed: %s" -msgstr "" - -msgid "Uploading file..." -msgstr "" - -msgid "User" -msgstr "" - -msgid "User and group to run as (UID:GID)" -msgstr "" - -msgid "Value" -msgstr "" - -msgid "Variable" -msgstr "" - -msgid "Volume" -msgstr "" - -msgid "Volume Name" -msgstr "" - -msgid "Volume driver to use" -msgstr "" - -msgid "Volume imported successfully" -msgstr "" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "" - -msgid "Volumes" -msgstr "" - -msgid "Working Directory" -msgstr "" - -msgid "Yes" -msgstr "" - -msgid "default" -msgstr "" - -msgid "non-empty value" -msgstr "" - -msgid "running" -msgstr "" - -msgid "total" -msgstr "" -msgid "Are you sure to remove pod?" -msgstr "" - -msgid "Cgroup parent" -msgstr "" - -msgid "CID" -msgstr "" - -msgid "CPU %" -msgstr "" - -msgid "CPU period" -msgstr "" - -msgid "CPU quota" -msgstr "" - -msgid "CPU set" -msgstr "" - -msgid "CPU shares" -msgstr "" - -msgid "DNS options" -msgstr "" - -msgid "DNS search" -msgstr "" - -msgid "DNS servers" -msgstr "" - -msgid "Exit policy" -msgstr "" - -msgid "Extra hosts" -msgstr "" - -msgid "Host network" -msgstr "" - -msgid "Infra container" -msgstr "" - -msgid "Memory limit" -msgstr "" - -msgid "Net I/O" -msgstr "" - -msgid "Pause pod" -msgstr "" - -msgid "Pod is not running" -msgstr "" - -msgid "Remove pod" -msgstr "" - -msgid "Restart policy" -msgstr "" - -msgid "Restart pod" -msgstr "" - -msgid "Shared namespaces" -msgstr "" - -msgid "Start pod" -msgstr "" - -msgid "Static IPv4" -msgstr "" - -msgid "Static MAC" -msgstr "" - -msgid "Stop pod" -msgstr "" - -msgid "Unlimited" -msgstr "" - -msgid "Unpause pod" -msgstr "" - -msgid "Stopping container" -msgstr "" - -msgid "Stop failed: %s" -msgstr "" - -msgid "Removing container" -msgstr "" - -msgid "Remove failed: %s" -msgstr "" - -msgid "Creating container" -msgstr "" - -msgid "Create failed: %s" -msgstr "" - -msgid "Starting container" -msgstr "" - -msgid "Start failed: %s" -msgstr "" - -msgid "Reinstating init script" -msgstr "" - -msgid "Init script reinstate failed: %s" -msgstr "" - -msgid "Updated to %s" -msgstr "" - -msgid "Update image: %d/%d - %s" -msgstr "" - -msgid "Removed old image %s" -msgstr "" - -msgid "Done." -msgstr "" - -msgid "Pause container" -msgstr "" - -msgid "Unpause container" -msgstr "" diff --git a/luci-app-podman/po/zh-cn b/luci-app-podman/po/zh-cn deleted file mode 120000 index 8d69574dd..000000000 --- a/luci-app-podman/po/zh-cn +++ /dev/null @@ -1 +0,0 @@ -zh_Hans \ No newline at end of file diff --git a/luci-app-podman/po/zh_Hans/podman.po b/luci-app-podman/po/zh_Hans/podman.po deleted file mode 100644 index ee7814ee5..000000000 --- a/luci-app-podman/po/zh_Hans/podman.po +++ /dev/null @@ -1,1090 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: luci-app-podman\n" -"PO-Revision-Date: 2026-06-03 05:20+0000\n" -"Last-Translator:\n" -"Language-Team: Chinese (Simplified Han script) \n" -"Language: zh_Hans\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "%d check(s) failed:" -msgstr "%d 次检查失败:" - -msgid "%d updated, %d failed:" -msgstr "%d 已更新,%d 失败:" - -msgid "%s created successfully" -msgstr "%s 创建成功" - -msgid "%s: %d/%d" -msgstr "%s:%d/%d" - -msgid "(none)" -msgstr "(无)" - -msgid "-- Select %s --" -msgstr "-- 选择 %s --" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "1-253 个字符:仅限字母、数字、下划线 (_) 和连字符 (-)" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "512m、1g 或 -1(无限制)" - -msgid "API Version" -msgstr "API 版本" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "将容器添加到现有 Pod。网络、主机名和端口映射来自 Pod 的 infra 容器。" - -msgid "All images updated successfully" -msgstr "所有镜像更新成功" - -msgid "All volumes exported successfully" -msgstr "所有卷已成功导出" - -msgid "Allocate TTY (-t)" -msgstr "分配 TTY (-t)" - -msgid "Allocate container IP from this range" -msgstr "从此范围分配容器 IP" - -msgid "Always" -msgstr "始终" - -msgid "Apply Updates" -msgstr "应用更新" - -msgid "Are you sure to delete the records?" -msgstr "确定删除这些记录吗?" - -msgid "Are you sure to remove container?" -msgstr "确定移除此容器吗?" - -msgid "Are you sure to remove integration?" -msgstr "确定移除此集成吗?" - -msgid "Auto Remove (--rm)" -msgstr "自动删除 (--rm)" - -msgid "Auto Update" -msgstr "自动更新" - -msgid "Auto-Update" -msgstr "自动更新" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "自动配置 OpenWrt 网络接口、桥接和防火墙区域。强烈建议勾选以在 OpenWrt 上进行正确的容器网络设置。" - -msgid "Automatically start the container after it is created" -msgstr "容器创建后自动启动" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "当有新镜像可用时自动更新容器。添加标签:io.containers.autoupdate=registry" - -msgid "Basic Information" -msgstr "基本信息" - -msgid "Block I/O" -msgstr "块 I/O" - -msgid "Boot" -msgstr "开机自启" - -msgid "Bridge Interface Name" -msgstr "网桥接口名称" - -msgid "CPU" -msgstr "CPU" - -msgid "CPU Limit" -msgstr "CPU 限制" - -msgid "CPU Set" -msgstr "CPU 集合" - -msgid "CPU Shares Weight" -msgstr "CPU 份额权重" - -msgid "CPU Usage" -msgstr "CPU 使用率" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "CPU 份额(相对权重)。0 = 使用默认值。" - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "允许 Pod 运行的 CPU(例如 \"0-3\" 或 \"0,2\")" - -msgid "Cancel" -msgstr "取消" - -msgid "Check" -msgstr "检查" - -msgid "Check %d containers for updates?" -msgstr "检查 %d 个容器的更新?" - -msgid "Check Complete" -msgstr "检查完成" - -msgid "Check for Updates" -msgstr "检查更新" - -msgid "Check for updates: %s/%s" -msgstr "检查更新:%s/%s" - -msgid "Choose firewall zone for this network." -msgstr "为此网络选择防火墙区域。" - -msgid "Clean Up Now" -msgstr "立即清理" - -msgid "Cleaning up old images..." -msgstr "正在清理旧镜像..." - -msgid "Cleanup / Prune" -msgstr "清理 / 修剪" - -msgid "Cleanup Complete" -msgstr "清理完成" - -msgid "Cleanup Unused Resources" -msgstr "清理未使用的资源" - -msgid "Cleanup successful!" -msgstr "清理成功!" - -msgid "Clear logs" -msgstr "清除日志" - -msgid "Click icon to repair" -msgstr "点击图标进行修复" - -msgid "Click to disconnect" -msgstr "点击断开连接" - -msgid "Click to enable/disable" -msgstr "点击启用/禁用" - -msgid "Click to reveal/hide value" -msgstr "点击显示/隐藏值" - -msgid "Close" -msgstr "关闭" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "以逗号分隔的附加组 ID 列表" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "以逗号分隔的要暴露的端口(例如 6052、8080/udp)" - -msgid "Command" -msgstr "命令" - -msgid "Command to run (space-separated)" -msgstr "运行的命令(以空格分隔)" - -msgid "Configuration" -msgstr "配置" - -msgid "Configure resource limits for this container." -msgstr "为此容器配置资源限制。" - -msgid "Confirm" -msgstr "确认" - -msgid "Connect" -msgstr "连接" - -msgid "Connect to" -msgstr "连接到" - -msgid "Connected successfully to %s" -msgstr "已成功连接到 %s" - -msgid "Connecting container to network" -msgstr "正在将容器连接到网络" - -msgid "Console" -msgstr "控制台" - -msgid "Container" -msgstr "容器" - -msgid "Container Name" -msgstr "容器名称" - -msgid "Container image has no tag - cannot update" -msgstr "容器镜像没有标签 - 无法更新" - -msgid "Container image to use" -msgstr "要使用的容器镜像" - -msgid "Container is not running" -msgstr "容器未在运行" - -msgid "Container updated successfully" -msgstr "容器更新成功" - -msgid "Containers" -msgstr "容器" - -msgid "Containers in pod %s" -msgstr "Pod %s 中的容器" - -msgid "Containers updated successfully" -msgstr "容器更新成功" - -msgid "Containers updated successfully." -msgstr "容器更新成功。" - -msgid "Create" -msgstr "创建" - -msgid "Create %s" -msgstr "创建 %s" - -msgid "Create Command" -msgstr "创建命令" - -msgid "Create Infra Container" -msgstr "创建 Infra 容器" - -msgid "Create new zone (will be named: podman_)" -msgstr "创建新区域(命名为:podman_<网络名称>)" - -msgid "Created" -msgstr "创建时间" - -msgid "Creating %s" -msgstr "正在创建 %s" - -msgid "Creating auto-start configuration for %s" -msgstr "正在为 %s 创建自启动配置" - -msgid "DNS Search Domains" -msgstr "DNS 搜索域" - -msgid "DNS Servers" -msgstr "DNS 服务器" - -msgid "DNS search domains for the infra container" -msgstr "Infra 容器的 DNS 搜索域" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "Infra 容器的 DNS 服务器(与 Pod 中所有容器共享)" - -msgid "Delete" -msgstr "删除" - -msgid "Deleting records: %d/%d" -msgstr "正在删除记录:%d/%d" - -msgid "Deleting records: %s/%s" -msgstr "正在删除记录:%s/%s" - -msgid "Destination" -msgstr "目的地" - -msgid "Device" -msgstr "设备" - -msgid "Disabled" -msgstr "已禁用" - -msgid "Disabling init script" -msgstr "正在禁用初始化脚本" - -msgid "Disconnect container from network" -msgstr "断开容器与网络的连接" - -msgid "Disconnected from %s" -msgstr "已从 %s 断开连接" - -msgid "Dnsmasq" -msgstr "Dnsmasq" - -msgid "Driver" -msgstr "驱动程序" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "特定驱动选项(逗号分隔,例如 type=tmpfs,o=size=100m)" - -msgid "Enable IPv6" -msgstr "启用 IPv6" - -msgid "Enable IPv6 networking" -msgstr "启用 IPv6 网络" - -msgid "Enabling init script" -msgstr "正在启用初始化脚本" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "输入机密数据(密码、令牌、密钥等)" - -msgid "Entrypoint" -msgstr "入口点 (Entrypoint)" - -msgid "Environment Variables" -msgstr "环境变量" - -msgid "Ephemeral (--rm flag)" -msgstr "临时容器(--rm 标志)" - -msgid "Error" -msgstr "错误" - -msgid "Error: %s" -msgstr "错误:%s" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "用作父接口的现有物理接口。macvlan/ipvlan 网络必需。" - -msgid "Expecting: %s" -msgstr "期望:%s" - -msgid "Export" -msgstr "导出" - -msgid "Exporting selected volumes: %d/%d" -msgstr "正在导出选定的卷:%d/%d" - -msgid "Expose Ports" -msgstr "暴露端口" - -msgid "Failed to create container" -msgstr "创建容器失败" - -msgid "Fetching information..." -msgstr "正在获取信息..." - -msgid "Find updateable containers" -msgstr "查找可更新的容器" - -msgid "Firewall Zone" -msgstr "防火墙区域" - -msgid "Gateway" -msgstr "网关" - -msgid "Generate" -msgstr "生成" - -msgid "Graph Root" -msgstr "图表根目录 (Graph Root)" - -msgid "Health" -msgstr "健康状态" - -msgid "Hostname" -msgstr "主机名" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "Pod 的主机名(默认为 Pod 名称)" - -msgid "ID" -msgstr "ID" - -msgid "IP Address" -msgstr "IP 地址" - -msgid "IP Range (CIDR)" -msgstr "IP 范围 (CIDR)" - -msgid "IPv4 Gateway" -msgstr "IPv4 网关" - -msgid "IPv4 Subnet (CIDR)" -msgstr "IPv4 子网 (CIDR)" - -msgid "IPv4 gateway address" -msgstr "IPv4 网关地址" - -msgid "IPv4 subnet in CIDR notation" -msgstr "CIDR 表示法的 IPv4 子网" - -msgid "Image" -msgstr "镜像" - -msgid "Image ID" -msgstr "镜像 ID" - -msgid "Image is already up-to-date" -msgstr "镜像已是最新版本" - -msgid "Image pulled successfully" -msgstr "镜像拉取成功" - -msgid "Images" -msgstr "镜像" - -msgid "Import" -msgstr "导入" - -msgid "Import from archive: %s" -msgstr "从存档导入:%s" - -msgid "Importing volume..." -msgstr "正在导入卷..." - -msgid "Info" -msgstr "信息" - -msgid "Information" -msgstr "信息" - -msgid "Infra Image" -msgstr "Infra 镜像" - -msgid "Init Script" -msgstr "Init 脚本" - -msgid "Inspect" -msgstr "检查 (Inspect)" - -msgid "Int" -msgstr "集成" - -msgid "Interactive" -msgstr "交互式" - -msgid "Interface" -msgstr "接口" - -msgid "Internal Network" -msgstr "内部网络" - -msgid "Labels" -msgstr "标签" - -msgid "Labels in key=value format, one per line" -msgstr "标签格式为 键=值,每行一个" - -msgid "Leave empty to auto-generate" -msgstr "留空以自动生成" - -msgid "Links" -msgstr "链接" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "Pod 中容器共享的 Linux 命名空间。默认与 `podman pod create` 一致。" - -msgid "Load" -msgstr "加载" - -msgid "Load System diagnostics" -msgstr "加载系统诊断" - -msgid "Loading init script" -msgstr "正在加载初始化脚本" - -msgid "Loading..." -msgstr "正在加载..." - -msgid "Logs" -msgstr "日志" - -msgid "Manage podman %s" -msgstr "管理 Podman %s" - -msgid "Memory" -msgstr "内存" - -msgid "Memory %" -msgstr "内存 %" - -msgid "Memory + Swap Limit" -msgstr "内存 + 交换限制" - -msgid "Memory Limit" -msgstr "内存限制" - -msgid "Memory Usage" -msgstr "内存使用情况" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "内存限制(例如 512m, 1g)" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "内存限制(例如 512m、1g)。-1 = 无限制,0 = 默认。" - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "Pod 的内存限制(例如 512m、1g)" - -msgid "Mode" -msgstr "模式" - -msgid "Mount Options" -msgstr "挂载选项" - -msgid "Mountpoint" -msgstr "挂载点" - -msgid "Mounts" -msgstr "挂载" - -msgid "Must be between 0 and 262144" -msgstr "必须介于 0 到 262144 之间" - -msgid "Name" -msgstr "名称" - -msgid "Name for the network" -msgstr "网络名称" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "桥接接口名称(例如 podman0, mynet0)。留空以使用:<网络名称>0。注意:如果生成的名称与现有接口冲突,OpenWrt 将自动递增。" - -msgid "Name updated successfully" -msgstr "名称更新成功" - -msgid "Network" -msgstr "网络" - -msgid "Network I/O" -msgstr "网络 I/O" - -msgid "Network Mode" -msgstr "网络模式" - -msgid "Network Name" -msgstr "网络名称" - -msgid "Network driver" -msgstr "网络驱动" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "Pod 的网络命名空间。Pod 中的容器共享此网络。" - -msgid "Networks" -msgstr "网络" - -msgid "Never" -msgstr "从不" - -msgid "No" -msgstr "否" - -msgid "No %s selected" -msgstr "未选择 %s" - -msgid "No containers in this pod" -msgstr "此 Pod 中没有容器" - -msgid "No containers with auto-update label found." -msgstr "沒有找到有自动更新标签的容器。" - -msgid "No new updates available." -msgstr "没有新的更新可用。" - -msgid "No suitable interfaces found" -msgstr "未找到合适的接口" - -msgid "No unused resources found" -msgstr "未找到未使用的资源" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "CPU 数量(例如 0.5, 1.0, 2.0)" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "CPU 数量(例如 0.5, 1.0, 2.0)。留空表示无限制。" - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "Pod 可用的 CPU 数量(例如 0.5、1.0、2.0)" - -msgid "Number of lines" -msgstr "行数" - -msgid "OK" -msgstr "确定" - -msgid "Old image still used by other containers" -msgstr "旧镜像仍被其他容器使用" - -msgid "On Failure" -msgstr "失败时" - -msgid "One per line, format: host:container[/protocol]" -msgstr "每行一个,格式:主机:容器[/协议]" - -msgid "One per line, format: key=value" -msgstr "每行一个,格式为:键=值" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "每行一个。格式:源:目标[:选项]。选项:ro, rw, Z, z" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "OpenWrt 集成已存在\n\n点击移除" - -msgid "OpenWrt integration incomplete" -msgstr "OpenWrt 集成不完整" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "OpenWrt 集成需要指定子网" - -msgid "Override the image used for the infra container" -msgstr "覆盖用于 Infra 容器的镜像" - -msgid "PIDs" -msgstr "PID" - -msgid "Parent Interface" -msgstr "父接口" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "macvlan/ipvlan 网络需要父接口" - -msgid "Part of a pod (\"%s\")" -msgstr "Pod 的一部分(\"%s\")" - -msgid "Pausing pod" -msgstr "正在暂停 Pod" - -msgid "Pod" -msgstr "Pod" - -msgid "Pod Name" -msgstr "Pod 名称" - -msgid "Podman Version" -msgstr "Podman 版本" - -msgid "Pods" -msgstr "Pod" - -msgid "Port Mappings" -msgstr "端口映射" - -msgid "Ports" -msgstr "端口" - -msgid "Privileged" -msgstr "特权" - -msgid "Privileged Mode" -msgstr "特权模式" - -msgid "Processes" -msgstr "进程" - -msgid "Pull Image" -msgstr "拉取镜像" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "拉取未返回镜像 ID - 拉取可能已失败" - -msgid "Pulling %s" -msgstr "正在拉取 %s" - -msgid "Read: %s / Write: %s" -msgstr "读:%s / 写:%s" - -msgid "Refreshing %s..." -msgstr "正在刷新 %s..." - -msgid "Registries" -msgstr "注册表 (Registries)" - -msgid "Registry" -msgstr "注册表" - -msgid "Reload" -msgstr "重新加载" - -msgid "Remove OpenWrt integration" -msgstr "移除 OpenWrt 集成" - -msgid "Remove all unused images (not just dangling)" -msgstr "移除所有未使用的镜像(不只是悬空的)" - -msgid "Remove container" -msgstr "移除容器" - -msgid "Remove unused volumes" -msgstr "移除未使用的卷" - -msgid "Removed: %s" -msgstr "已移除:%s" - -msgid "Removing unused resources, please wait..." -msgstr "正在移除未使用的资源,请稍候..." - -msgid "Repository" -msgstr "仓库" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "共享网络命名空间所必需。仅在确认不需要时禁用。" - -msgid "Resources" -msgstr "资源" - -msgid "Restart Policy" -msgstr "重启策略" - -msgid "Restart container" -msgstr "重启容器" - -msgid "Restart policy updated successfully" -msgstr "重启策略更新成功" - -msgid "Restarting pod" -msgstr "正在重启 Pod" - -msgid "Restrict external access to the network" -msgstr "限制网络的外部访问" - -msgid "Run Root" -msgstr "运行根目录 (Run Root)" - -msgid "Saving resource" -msgstr "正在保存资源" - -msgid "Secret" -msgstr "机密 (Secret)" - -msgid "Secret Data" -msgstr "机密数据" - -msgid "Secret Name" -msgstr "机密名称" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "机密名称只能包含字母、数字、下划线和连字符" - -msgid "Secrets" -msgstr "机密" - -msgid "Security Notice:" -msgstr "安全声明:" - -msgid "Select containers to update" -msgstr "选择要更新的容器" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "为新容器选择网络。用户创建的网络可提供更好的隔离性和容器间 DNS 解析。" - -msgid "Select what to clean up:" -msgstr "选择要清理的内容:" - -msgid "Sensitive data is hidden for security reasons." -msgstr "出于安全原因,敏感数据已隐藏。" - -msgid "Setup OpenWrt Integration" -msgstr "设置 OpenWrt 集成" - -msgid "Shared Namespaces" -msgstr "共享命名空间" - -msgid "Shares network with another container" -msgstr "与其他容器共享网络" - -msgid "Show" -msgstr "显示" - -msgid "Since" -msgstr "自" - -msgid "Size" -msgstr "大小" - -msgid "Socket Path" -msgstr "Socket 路径" - -msgid "Source" -msgstr "源" - -msgid "Space freed: %s" -msgstr "已释放空间:%s" - -msgid "Start after creation" -msgstr "创建后启动" - -msgid "Start container" -msgstr "启动容器" - -msgid "Start on boot" -msgstr "开机启动" - -msgid "Start script disabled" -msgstr "启动脚本已禁用" - -msgid "Start script missing\n\nClick to generate" -msgstr "启动脚本缺失\n\n点击生成" - -msgid "Start stream" -msgstr "开始流" - -msgid "Started" -msgstr "启动时间" - -msgid "Started At" -msgstr "启动时间" - -msgid "Starting pod" -msgstr "正在启动 Pod" - -msgid "Statistics" -msgstr "统计" - -msgid "Stats" -msgstr "统计" - -msgid "Status" -msgstr "状态" - -msgid "Stop container" -msgstr "停止容器" - -msgid "Stop stream" -msgstr "停止流" - -msgid "Stopping pod" -msgstr "正在停止 Pod" - -msgid "Subnet" -msgstr "子网" - -msgid "Supplementary Groups" -msgstr "附加组" - -msgid "System Diagnostics" -msgstr "系统诊断" - -msgid "TTY" -msgstr "TTY" - -msgid "Tag" -msgstr "标签" - -msgid "The sensitive data to store securely" -msgstr "要安全存储的敏感数据" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "要为容器启用自动更新,添加标签:io.containers.autoupdate=registry" - -msgid "Total" -msgstr "总计" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "总内存限制(内存 + swap)。-1 = 无限制,0 = 默认。" - -msgid "Type" -msgstr "类型" - -msgid "Unknown" -msgstr "未知" - -msgid "Unless Stopped" -msgstr "除非已停止 (Unless Stopped)" - -msgid "Until" -msgstr "直到" - -msgid "Update" -msgstr "更新" - -msgid "Update Resources" -msgstr "更新资源" - -msgid "Update name" -msgstr "更新名称" - -msgid "Update restart policy" -msgstr "更新重启策略" - -msgid "Updating Images" -msgstr "正在更新镜像" - -msgid "Updating container" -msgstr "正在更新容器" - -msgid "Upload failed: %s" -msgstr "上传失败:%s" - -msgid "Uploading file..." -msgstr "正在上传文件..." - -msgid "User" -msgstr "用户" - -msgid "User and group to run as (UID:GID)" -msgstr "运行用户和组 (UID:GID)" - -msgid "Value" -msgstr "值" - -msgid "Variable" -msgstr "变量" - -msgid "Volume" -msgstr "卷" - -msgid "Volume Name" -msgstr "卷名称" - -msgid "Volume driver to use" -msgstr "要使用的卷驱动" - -msgid "Volume imported successfully" -msgstr "卷导入成功" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "卷名称。留空以自动生成。" - -msgid "Volumes" -msgstr "卷" - -msgid "Working Directory" -msgstr "工作目录" - -msgid "Yes" -msgstr "是" - -msgid "default" -msgstr "默认" - -msgid "non-empty value" -msgstr "非空值" - -msgid "running" -msgstr "正在运行" - -msgid "total" -msgstr "总计" - -msgid "Are you sure to remove pod?" -msgstr "确定要删除 Pod 吗?" - -msgid "Cgroup parent" -msgstr "Cgroup 父级" - -msgid "CID" -msgstr "CID" - -msgid "CPU %" -msgstr "CPU %" - -msgid "CPU period" -msgstr "CPU 周期" - -msgid "CPU quota" -msgstr "CPU 配额" - -msgid "CPU set" -msgstr "CPU 集合" - -msgid "CPU shares" -msgstr "CPU 份额" - -msgid "DNS options" -msgstr "DNS 选项" - -msgid "DNS search" -msgstr "DNS 搜索" - -msgid "DNS servers" -msgstr "DNS 服务器" - -msgid "Exit policy" -msgstr "退出策略" - -msgid "Extra hosts" -msgstr "额外主机" - -msgid "Host network" -msgstr "主机网络" - -msgid "Infra container" -msgstr "Infra 容器" - -msgid "Memory limit" -msgstr "内存限制" - -msgid "Net I/O" -msgstr "网络 I/O" - -msgid "Pause pod" -msgstr "暂停 Pod" - -msgid "Pod is not running" -msgstr "Pod 未运行" - -msgid "Remove pod" -msgstr "删除 Pod" - -msgid "Restart policy" -msgstr "重启策略" - -msgid "Restart pod" -msgstr "重启 Pod" - -msgid "Shared namespaces" -msgstr "共享命名空间" - -msgid "Start pod" -msgstr "启动 Pod" - -msgid "Static IPv4" -msgstr "静态 IPv4" - -msgid "Static MAC" -msgstr "静态 MAC" - -msgid "Stop pod" -msgstr "停止 Pod" - -msgid "Unlimited" -msgstr "无限制" - -msgid "Unpause pod" -msgstr "恢复 Pod" - -msgid "Stopping container" -msgstr "正在停止容器" - -msgid "Stop failed: %s" -msgstr "停止失败:%s" - -msgid "Removing container" -msgstr "正在删除容器" - -msgid "Remove failed: %s" -msgstr "删除失败:%s" - -msgid "Creating container" -msgstr "正在创建容器" - -msgid "Create failed: %s" -msgstr "创建失败:%s" - -msgid "Starting container" -msgstr "正在启动容器" - -msgid "Start failed: %s" -msgstr "启动失败:%s" - -msgid "Reinstating init script" -msgstr "正在恢复初始化脚本" - -msgid "Init script reinstate failed: %s" -msgstr "恢复初始化脚本失败:%s" - -msgid "Updated to %s" -msgstr "已更新到 %s" - -msgid "Update image: %d/%d - %s" -msgstr "更新镜像:%d/%d - %s" - -msgid "Removed old image %s" -msgstr "已删除旧镜像 %s" - -msgid "Done." -msgstr "完成。" - -msgid "Pause container" -msgstr "暂停容器" - -msgid "Unpause container" -msgstr "恢复容器" diff --git a/luci-app-podman/po/zh_Hant/podman.po b/luci-app-podman/po/zh_Hant/podman.po deleted file mode 100644 index fa7eca0d3..000000000 --- a/luci-app-podman/po/zh_Hant/podman.po +++ /dev/null @@ -1,1090 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: luci-app-podman\n" -"PO-Revision-Date: 2026-05-03 11:05+0000\n" -"Last-Translator:\n" -"Language-Team: Chinese (Traditional Han script) \n" -"Language: zh_Hant\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "%d check(s) failed:" -msgstr "%d 次檢查失敗:" - -msgid "%d updated, %d failed:" -msgstr "%d 已更新,%d 失敗:" - -msgid "%s created successfully" -msgstr "%s 成功建立" - -msgid "%s: %d/%d" -msgstr "%s:%d/%d" - -msgid "(none)" -msgstr "(無)" - -msgid "-- Select %s --" -msgstr "-- 選擇 %s --" - -msgid "1-253 characters: letters, numbers, underscore (_), hyphen (-) only" -msgstr "1-253 字元:僅限英文、數字、底線(_)、破折號(-)" - -msgid "512m, 1g, or -1 for unlimited" -msgstr "512m、1g 或 -1(無限制)" - -msgid "API Version" -msgstr "API 版本" - -msgid "Add the container to an existing pod. Network, hostname and port mappings come from the pod's infra container." -msgstr "將容器加入現有 Pod。網路、主機名稱和連接埠對應來自 Pod 的 infra 容器。" - -msgid "All images updated successfully" -msgstr "所有映像更新成功" - -msgid "All volumes exported successfully" -msgstr "所有儲存區都成功匯出" - -msgid "Allocate TTY (-t)" -msgstr "配發 TTY(-t)" - -msgid "Allocate container IP from this range" -msgstr "從這個範圍配發容器 IP 地址" - -msgid "Always" -msgstr "總是" - -msgid "Apply Updates" -msgstr "套用更新" - -msgid "Are you sure to delete the records?" -msgstr "確定刪除這些記錄嗎?" - -msgid "Are you sure to remove container?" -msgstr "確定移除此容器嗎?" - -msgid "Are you sure to remove integration?" -msgstr "確定移除此整合嗎?" - -msgid "Auto Remove (--rm)" -msgstr "自動移除(--rm)" - -msgid "Auto Update" -msgstr "自動更新" - -msgid "Auto-Update" -msgstr "自動更新" - -msgid "Automatically configure OpenWrt network interface, bridge, and firewall zone. Highly recommended for proper container networking on OpenWrt." -msgstr "自動設定 OpenWrt 網路界面、橋接器、以及防火牆區域。強烈建議啟用,在 OpenWrt 上建立合適的容器網路。" - -msgid "Automatically start the container after it is created" -msgstr "建立容器後自動啟動" - -msgid "Automatically update container when newer image is available. Adds label: io.containers.autoupdate=registry" -msgstr "新的映像檔可用時自動更新容器。增加標籤:io.containers.autoupdate=registry" - -msgid "Basic Information" -msgstr "基本資訊" - -msgid "Block I/O" -msgstr "區塊 I/O" - -msgid "Boot" -msgstr "開機" - -msgid "Bridge Interface Name" -msgstr "橋接界面名稱" - -msgid "CPU" -msgstr "中央處理器" - -msgid "CPU Limit" -msgstr "CPU 上限" - -msgid "CPU Set" -msgstr "CPU 集合" - -msgid "CPU Shares Weight" -msgstr "CPU 分享權重" - -msgid "CPU Usage" -msgstr "CPU 用量" - -msgid "CPU shares (relative weight). 0 = use default." -msgstr "CPU 份額(相對權重)。0 = 使用預設值。" - -msgid "CPUs the pod is allowed to run on (e.g., \"0-3\" or \"0,2\")" -msgstr "允許 Pod 執行的 CPU(例如 \"0-3\" 或 \"0,2\")" - -msgid "Cancel" -msgstr "取消" - -msgid "Check" -msgstr "檢查" - -msgid "Check %d containers for updates?" -msgstr "檢查 %d 個容器的更新?" - -msgid "Check Complete" -msgstr "檢查完成" - -msgid "Check for Updates" -msgstr "檢查更新" - -msgid "Check for updates: %s/%s" -msgstr "檢查更新:%s/%s" - -msgid "Choose firewall zone for this network." -msgstr "為此網路選擇防火牆區域。" - -msgid "Clean Up Now" -msgstr "現在清理" - -msgid "Cleaning up old images..." -msgstr "正在清理舊映像..." - -msgid "Cleanup / Prune" -msgstr "清理 / 裁剪" - -msgid "Cleanup Complete" -msgstr "清理完成" - -msgid "Cleanup Unused Resources" -msgstr "清理非使用中的資源" - -msgid "Cleanup successful!" -msgstr "清理成功!" - -msgid "Clear logs" -msgstr "清除日誌" - -msgid "Click icon to repair" -msgstr "點擊圖示進行修復" - -msgid "Click to disconnect" -msgstr "點擊斷開連接" - -msgid "Click to enable/disable" -msgstr "點擊啟用/禁用" - -msgid "Click to reveal/hide value" -msgstr "點擊以顯示/隱藏數值" - -msgid "Close" -msgstr "關閉" - -msgid "Comma-separated list of supplementary group IDs" -msgstr "以逗號分隔的附加組 ID 列表" - -msgid "Comma-separated ports to expose (e.g., 6052, 8080/udp)" -msgstr "以逗號分隔的要暴露的端口(例如 6052、8080/udp)" - -msgid "Command" -msgstr "指令" - -msgid "Command to run (space-separated)" -msgstr "要執行的指令(使用空格字元分隔)" - -msgid "Configuration" -msgstr "設定" - -msgid "Configure resource limits for this container." -msgstr "為此容器配置資源限制。" - -msgid "Confirm" -msgstr "確認" - -msgid "Connect" -msgstr "連線" - -msgid "Connect to" -msgstr "連線至" - -msgid "Connected successfully to %s" -msgstr "已成功連接到 %s" - -msgid "Connecting container to network" -msgstr "正在將容器連接到網路" - -msgid "Console" -msgstr "終端機" - -msgid "Container" -msgstr "容器" - -msgid "Container Name" -msgstr "容器名稱" - -msgid "Container image has no tag - cannot update" -msgstr "容器映像沒有標籤 - 無法更新" - -msgid "Container image to use" -msgstr "要使用的容器映像檔" - -msgid "Container is not running" -msgstr "容器未在運行" - -msgid "Container updated successfully" -msgstr "容器更新成功" - -msgid "Containers" -msgstr "容器" - -msgid "Containers in pod %s" -msgstr "Pod %s 中的容器" - -msgid "Containers updated successfully" -msgstr "容器更新成功" - -msgid "Containers updated successfully." -msgstr "容器更新成功。" - -msgid "Create" -msgstr "建立" - -msgid "Create %s" -msgstr "建立 %s" - -msgid "Create Command" -msgstr "建立命令" - -msgid "Create Infra Container" -msgstr "建立 Infra 容器" - -msgid "Create new zone (will be named: podman_)" -msgstr "建立新的區域(會命名為:podman_)" - -msgid "Created" -msgstr "已建立" - -msgid "Creating %s" -msgstr "正在建立 %s" - -msgid "Creating auto-start configuration for %s" -msgstr "正在為 %s 建立自動啟動設定" - -msgid "DNS Search Domains" -msgstr "DNS 搜尋網域" - -msgid "DNS Servers" -msgstr "DNS 伺服器" - -msgid "DNS search domains for the infra container" -msgstr "Infra 容器的 DNS 搜尋網域" - -msgid "DNS servers for the infra container (shared with all pod containers)" -msgstr "Infra 容器的 DNS 伺服器(與 Pod 中所有容器共用)" - -msgid "Delete" -msgstr "刪除" - -msgid "Deleting records: %d/%d" -msgstr "正在刪除記錄:%d/%d" - -msgid "Deleting records: %s/%s" -msgstr "正在刪除記錄:%s/%s" - -msgid "Destination" -msgstr "目標" - -msgid "Device" -msgstr "裝置" - -msgid "Disabled" -msgstr "已停用" - -msgid "Disabling init script" -msgstr "正在禁用初始化腳本" - -msgid "Disconnect container from network" -msgstr "斷開容器與網路的連接" - -msgid "Disconnected from %s" -msgstr "已從 %s 斷開連接" - -msgid "Dnsmasq" -msgstr "Dnsmasq" - -msgid "Driver" -msgstr "驅動程式" - -msgid "Driver-specific options (comma-separated, e.g., type=tmpfs,o=size=100m)" -msgstr "驅動程式相關選項(逗號分隔,例如 type=tmpfs,o=size=100m)" - -msgid "Enable IPv6" -msgstr "啟用 IPv6" - -msgid "Enable IPv6 networking" -msgstr "啟用 IPv6 網路" - -msgid "Enabling init script" -msgstr "正在啟用初始化腳本" - -msgid "Enter secret data (password, token, key, etc.)" -msgstr "輸入私密資料(密碼、令牌、金鑰… 等等)" - -msgid "Entrypoint" -msgstr "進入點" - -msgid "Environment Variables" -msgstr "環境變數" - -msgid "Ephemeral (--rm flag)" -msgstr "臨時容器(--rm 標誌)" - -msgid "Error" -msgstr "錯誤" - -msgid "Error: %s" -msgstr "錯誤:%s" - -msgid "Existing physical interface to use as parent. Required for macvlan/ipvlan networks." -msgstr "用來當作母設備的實體界面,macvlan/ipvlan 需要它。" - -msgid "Expecting: %s" -msgstr "期望:%s" - -msgid "Export" -msgstr "匯出" - -msgid "Exporting selected volumes: %d/%d" -msgstr "正在匯出選定的儲存區:%d/%d" - -msgid "Expose Ports" -msgstr "暴露端口" - -msgid "Failed to create container" -msgstr "建立容器失敗" - -msgid "Fetching information..." -msgstr "獲取資訊…" - -msgid "Find updateable containers" -msgstr "尋找可更新的容器" - -msgid "Firewall Zone" -msgstr "防火牆區域" - -msgid "Gateway" -msgstr "閘道器" - -msgid "Generate" -msgstr "產生" - -msgid "Graph Root" -msgstr "儲存圖根目錄" - -msgid "Health" -msgstr "健康度" - -msgid "Hostname" -msgstr "主機名稱" - -msgid "Hostname for the pod (defaults to pod name)" -msgstr "Pod 的主機名稱(預設為 Pod 名稱)" - -msgid "ID" -msgstr "ID" - -msgid "IP Address" -msgstr "IP 地址" - -msgid "IP Range (CIDR)" -msgstr "IP 範圍(CIDR)" - -msgid "IPv4 Gateway" -msgstr "IPv4 閘道器" - -msgid "IPv4 Subnet (CIDR)" -msgstr "IPv4 子網域(CIDR)" - -msgid "IPv4 gateway address" -msgstr "IPv4 閘道器地址" - -msgid "IPv4 subnet in CIDR notation" -msgstr "CIDR 註記的 IPv4 子網域" - -msgid "Image" -msgstr "映像檔" - -msgid "Image ID" -msgstr "映像檔 ID" - -msgid "Image is already up-to-date" -msgstr "映像已是最新版本" - -msgid "Image pulled successfully" -msgstr "映像檔成功拉回" - -msgid "Images" -msgstr "映像檔" - -msgid "Import" -msgstr "匯入" - -msgid "Import from archive: %s" -msgstr "從存檔導入:%s" - -msgid "Importing volume..." -msgstr "正在匯入儲存區…" - -msgid "Info" -msgstr "資訊" - -msgid "Information" -msgstr "資訊" - -msgid "Infra Image" -msgstr "Infra 映像檔" - -msgid "Init Script" -msgstr "初始化指令稿" - -msgid "Inspect" -msgstr "檢視" - -msgid "Int" -msgstr "整數" - -msgid "Interactive" -msgstr "互動式" - -msgid "Interface" -msgstr "介面" - -msgid "Internal Network" -msgstr "內部網路" - -msgid "Labels" -msgstr "標籤" - -msgid "Labels in key=value format, one per line" -msgstr "使用 key=value 格式的標籤,一行一個" - -msgid "Leave empty to auto-generate" -msgstr "留空會自動產生" - -msgid "Links" -msgstr "連結" - -msgid "Linux namespaces shared between containers in the pod. Default matches `podman pod create`." -msgstr "Pod 中容器共用的 Linux 命名空間。預設與 `podman pod create` 一致。" - -msgid "Load" -msgstr "載入" - -msgid "Load System diagnostics" -msgstr "載入系統診斷" - -msgid "Loading init script" -msgstr "正在載入初始化腳本" - -msgid "Loading..." -msgstr "正在載入…" - -msgid "Logs" -msgstr "日誌" - -msgid "Manage podman %s" -msgstr "管理 Podman %s" - -msgid "Memory" -msgstr "記憶體" - -msgid "Memory %" -msgstr "記憶體 %" - -msgid "Memory + Swap Limit" -msgstr "記憶體 + 置換區限制" - -msgid "Memory Limit" -msgstr "記憶體限制" - -msgid "Memory Usage" -msgstr "記憶體用量" - -msgid "Memory limit (e.g., 512m, 1g)" -msgstr "記憶體限制(例如 512m、1g)" - -msgid "Memory limit (e.g., 512m, 1g). -1 = unlimited, 0 = use default." -msgstr "記憶體限制(例如 512m、1g)。-1 = 無限制,0 = 預設。" - -msgid "Memory limit for the pod (e.g., 512m, 1g)" -msgstr "Pod 的記憶體限制(例如 512m、1g)" - -msgid "Mode" -msgstr "模式" - -msgid "Mount Options" -msgstr "掛載選項" - -msgid "Mountpoint" -msgstr "掛載點" - -msgid "Mounts" -msgstr "掛載" - -msgid "Must be between 0 and 262144" -msgstr "必須介於 0 與 262144 之間" - -msgid "Name" -msgstr "名稱" - -msgid "Name for the network" -msgstr "網路的名稱" - -msgid "Name of the bridge interface (e.g., podman0, mynet0). Leave empty to use: <network-name>0. Note: If the generated name conflicts with an existing interface, OpenWrt will auto-increment it." -msgstr "橋接器界面的名稱(例如 podman0、mynet0)。留空使用 <network-name>0。注意:如果自動產生的名稱與現有界面名稱衝突,OpenWrt 會自動增加編號。" - -msgid "Name updated successfully" -msgstr "名稱更新成功" - -msgid "Network" -msgstr "網路" - -msgid "Network I/O" -msgstr "網路 I/O" - -msgid "Network Mode" -msgstr "網路模式" - -msgid "Network Name" -msgstr "網路名稱" - -msgid "Network driver" -msgstr "網路驅動程式" - -msgid "Network namespace for the pod. Containers in the pod share this network." -msgstr "Pod 的網路命名空間。Pod 中的容器共用此網路。" - -msgid "Networks" -msgstr "網路" - -msgid "Never" -msgstr "永不" - -msgid "No" -msgstr "否" - -msgid "No %s selected" -msgstr "沒有 %s 被選擇" - -msgid "No containers in this pod" -msgstr "此 Pod 中沒有容器" - -msgid "No containers with auto-update label found." -msgstr "沒有找到有自動更新標籤的容器。" - -msgid "No new updates available." -msgstr "沒有新的更新可用。" - -msgid "No suitable interfaces found" -msgstr "沒有適合的界面" - -msgid "No unused resources found" -msgstr "沒有非使用中的資源" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0)" -msgstr "CPU 數量(例如 0.5、1.0、2.0)" - -msgid "Number of CPUs (e.g., 0.5, 1.0, 2.0). Leave empty for unlimited." -msgstr "CPU 數量(例如 0.5、1.0、2.0)。留空表示無上限。" - -msgid "Number of CPUs available to the pod (e.g., 0.5, 1.0, 2.0)" -msgstr "Pod 可用的 CPU 數量(例如 0.5、1.0、2.0)" - -msgid "Number of lines" -msgstr "行數" - -msgid "OK" -msgstr "確定" - -msgid "Old image still used by other containers" -msgstr "舊映像檔仍被其他容器使用" - -msgid "On Failure" -msgstr "於錯誤發生時" - -msgid "One per line, format: host:container[/protocol]" -msgstr "每行一個,格式:主機:容器[/協議]" - -msgid "One per line, format: key=value" -msgstr "一行一個,格式 key=value" - -msgid "One per line. Format: source:destination[:options]. Options: ro, rw, Z, z" -msgstr "每行一個。格式:源:目標[:選項]。選項:ro, rw, Z, z" - -msgid "OpenWrt integration exists\n\nClick to remove" -msgstr "OpenWrt 整合已存在\n\n點擊移除" - -msgid "OpenWrt integration incomplete" -msgstr "OpenWrt 整合不完整" - -msgid "OpenWrt integration requires subnet to be specified" -msgstr "OpenWrt 整合需要指定子網路" - -msgid "Override the image used for the infra container" -msgstr "覆寫用於 Infra 容器的映像檔" - -msgid "PIDs" -msgstr "PIDs" - -msgid "Parent Interface" -msgstr "母界面" - -msgid "Parent interface is required for macvlan/ipvlan networks" -msgstr "macvlan/ipvlan 網路需要母界面" - -msgid "Part of a pod (\"%s\")" -msgstr "Pod 的一部分(\"%s\")" - -msgid "Pausing pod" -msgstr "正在暫停 Pod" - -msgid "Pod" -msgstr "容器群組" - -msgid "Pod Name" -msgstr "Pod 名稱" - -msgid "Podman Version" -msgstr "Podman 版本" - -msgid "Pods" -msgstr "容器群組" - -msgid "Port Mappings" -msgstr "連接埠對應" - -msgid "Ports" -msgstr "端口" - -msgid "Privileged" -msgstr "有特權的" - -msgid "Privileged Mode" -msgstr "特權模式" - -msgid "Processes" -msgstr "進程" - -msgid "Pull Image" -msgstr "獲取映像檔" - -msgid "Pull did not return an image ID - pull may have failed" -msgstr "拉取未返回映像 ID - 拉取可能已失敗" - -msgid "Pulling %s" -msgstr "正在拉取 %s" - -msgid "Read: %s / Write: %s" -msgstr "讀取:%s / 寫入:%s" - -msgid "Refreshing %s..." -msgstr "正在更新 %s…" - -msgid "Registries" -msgstr "註冊表" - -msgid "Registry" -msgstr "註冊表" - -msgid "Reload" -msgstr "重新載入" - -msgid "Remove OpenWrt integration" -msgstr "移除 OpenWrt 整合" - -msgid "Remove all unused images (not just dangling)" -msgstr "移除所有未使用的映像檔(而非只是空懸的)" - -msgid "Remove container" -msgstr "移除容器" - -msgid "Remove unused volumes" -msgstr "移除未使用的儲存區" - -msgid "Removed: %s" -msgstr "移除了:%s" - -msgid "Removing unused resources, please wait..." -msgstr "正在移除未使用的資源,請稍候…" - -msgid "Repository" -msgstr "儲存庫" - -msgid "Required for shared network namespace. Disable only if you know you do not need it." -msgstr "共用網路命名空間所必需。僅在確認不需要時停用。" - -msgid "Resources" -msgstr "資源" - -msgid "Restart Policy" -msgstr "重新啟動原則" - -msgid "Restart container" -msgstr "重啟容器" - -msgid "Restart policy updated successfully" -msgstr "重新啟動原則成功更新" - -msgid "Restarting pod" -msgstr "正在重新啟動 Pod" - -msgid "Restrict external access to the network" -msgstr "限制對外部網路的操作" - -msgid "Run Root" -msgstr "執行時根目錄" - -msgid "Saving resource" -msgstr "正在儲存資源" - -msgid "Secret" -msgstr "私密資料" - -msgid "Secret Data" -msgstr "私密資料" - -msgid "Secret Name" -msgstr "私密資料名稱" - -msgid "Secret name can only contain letters, numbers, underscores, and hyphens" -msgstr "私密資料名稱只能包含字母、數字、底線、及破折號" - -msgid "Secrets" -msgstr "私密資料" - -msgid "Security Notice:" -msgstr "安全性警告:" - -msgid "Select containers to update" -msgstr "選擇要更新的容器" - -msgid "Select network for the new container. User-created networks provide better isolation and DNS resolution between containers." -msgstr "為新容器選擇網路。用戶建立的網路可提供更好的隔離性和容器間 DNS 解析。" - -msgid "Select what to clean up:" -msgstr "選擇要清理的項目:" - -msgid "Sensitive data is hidden for security reasons." -msgstr "敏感資料因安全緣故隱藏。" - -msgid "Setup OpenWrt Integration" -msgstr "設定 OpenWrt 整合" - -msgid "Shared Namespaces" -msgstr "共用命名空間" - -msgid "Shares network with another container" -msgstr "與其他容器共享網路" - -msgid "Show" -msgstr "顯示" - -msgid "Since" -msgstr "自" - -msgid "Size" -msgstr "大小" - -msgid "Socket Path" -msgstr "通訊端路徑" - -msgid "Source" -msgstr "來源" - -msgid "Space freed: %s" -msgstr "釋放的空間:%s" - -msgid "Start after creation" -msgstr "建立後啟動" - -msgid "Start container" -msgstr "啟動容器" - -msgid "Start on boot" -msgstr "開機啟動" - -msgid "Start script disabled" -msgstr "啟動腳本已禁用" - -msgid "Start script missing\n\nClick to generate" -msgstr "啟動腳本缺失\n\n點擊生成" - -msgid "Start stream" -msgstr "開始串流" - -msgid "Started" -msgstr "已啟動" - -msgid "Started At" -msgstr "啟動時間" - -msgid "Starting pod" -msgstr "正在啟動 Pod" - -msgid "Statistics" -msgstr "統計" - -msgid "Stats" -msgstr "狀態" - -msgid "Status" -msgstr "狀態" - -msgid "Stop container" -msgstr "停止容器" - -msgid "Stop stream" -msgstr "停止串流" - -msgid "Stopping pod" -msgstr "正在停止 Pod" - -msgid "Subnet" -msgstr "子網路" - -msgid "Supplementary Groups" -msgstr "附加組" - -msgid "System Diagnostics" -msgstr "系統診斷" - -msgid "TTY" -msgstr "TTY" - -msgid "Tag" -msgstr "標籤" - -msgid "The sensitive data to store securely" -msgstr "要被安全保存的敏感資料" - -msgid "To enable auto-update for a container, add the label: io.containers.autoupdate=registry" -msgstr "要啟用容器的自動更新,增加這個標籤:io.containers.autoupdate=registry" - -msgid "Total" -msgstr "總計" - -msgid "Total memory limit (memory + swap). -1 = unlimited, 0 = use default." -msgstr "總記憶體限制(記憶體 + swap)。-1 = 無限制,0 = 預設。" - -msgid "Type" -msgstr "類型" - -msgid "Unknown" -msgstr "未知" - -msgid "Unless Stopped" -msgstr "除非停止" - -msgid "Until" -msgstr "直到" - -msgid "Update" -msgstr "更新" - -msgid "Update Resources" -msgstr "更新資源" - -msgid "Update name" -msgstr "更新名稱" - -msgid "Update restart policy" -msgstr "更新重啟策略" - -msgid "Updating Images" -msgstr "正在更新映像" - -msgid "Updating container" -msgstr "正在更新容器" - -msgid "Upload failed: %s" -msgstr "上傳失敗:%s" - -msgid "Uploading file..." -msgstr "正在上傳文件..." - -msgid "User" -msgstr "使用者" - -msgid "User and group to run as (UID:GID)" -msgstr "運行用戶和組 (UID:GID)" - -msgid "Value" -msgstr "值" - -msgid "Variable" -msgstr "變數" - -msgid "Volume" -msgstr "儲存區" - -msgid "Volume Name" -msgstr "儲存區名稱" - -msgid "Volume driver to use" -msgstr "要使用的儲存區驅動器" - -msgid "Volume imported successfully" -msgstr "儲存區成功匯入" - -msgid "Volume name. Leave empty to auto-generate." -msgstr "儲存區名稱。留空會自動產生。" - -msgid "Volumes" -msgstr "儲存區" - -msgid "Working Directory" -msgstr "工作目錄" - -msgid "Yes" -msgstr "是" - -msgid "default" -msgstr "預設" - -msgid "non-empty value" -msgstr "非空值" - -msgid "running" -msgstr "執行中" - -msgid "total" -msgstr "總共" - -msgid "Are you sure to remove pod?" -msgstr "確定要移除 Pod 嗎?" - -msgid "Cgroup parent" -msgstr "Cgroup 父層" - -msgid "CID" -msgstr "CID" - -msgid "CPU %" -msgstr "CPU %" - -msgid "CPU period" -msgstr "CPU 週期" - -msgid "CPU quota" -msgstr "CPU 配額" - -msgid "CPU set" -msgstr "CPU 集合" - -msgid "CPU shares" -msgstr "CPU 份額" - -msgid "DNS options" -msgstr "DNS 選項" - -msgid "DNS search" -msgstr "DNS 搜尋" - -msgid "DNS servers" -msgstr "DNS 伺服器" - -msgid "Exit policy" -msgstr "結束原則" - -msgid "Extra hosts" -msgstr "額外主機" - -msgid "Host network" -msgstr "主機網路" - -msgid "Infra container" -msgstr "Infra 容器" - -msgid "Memory limit" -msgstr "記憶體限制" - -msgid "Net I/O" -msgstr "網路 I/O" - -msgid "Pause pod" -msgstr "暫停 Pod" - -msgid "Pod is not running" -msgstr "Pod 未在運行" - -msgid "Remove pod" -msgstr "移除 Pod" - -msgid "Restart policy" -msgstr "重新啟動原則" - -msgid "Restart pod" -msgstr "重新啟動 Pod" - -msgid "Shared namespaces" -msgstr "共用命名空間" - -msgid "Start pod" -msgstr "啟動 Pod" - -msgid "Static IPv4" -msgstr "靜態 IPv4" - -msgid "Static MAC" -msgstr "靜態 MAC" - -msgid "Stop pod" -msgstr "停止 Pod" - -msgid "Unlimited" -msgstr "無限制" - -msgid "Unpause pod" -msgstr "恢復 Pod" - -msgid "Stopping container" -msgstr "正在停止容器" - -msgid "Stop failed: %s" -msgstr "停止失敗:%s" - -msgid "Removing container" -msgstr "正在移除容器" - -msgid "Remove failed: %s" -msgstr "移除失敗:%s" - -msgid "Creating container" -msgstr "正在建立容器" - -msgid "Create failed: %s" -msgstr "建立失敗:%s" - -msgid "Starting container" -msgstr "正在啟動容器" - -msgid "Start failed: %s" -msgstr "啟動失敗:%s" - -msgid "Reinstating init script" -msgstr "正在還原初始化指令稿" - -msgid "Init script reinstate failed: %s" -msgstr "還原初始化指令稿失敗:%s" - -msgid "Updated to %s" -msgstr "已更新至 %s" - -msgid "Update image: %d/%d - %s" -msgstr "更新映像檔:%d/%d - %s" - -msgid "Removed old image %s" -msgstr "已移除舊映像檔 %s" - -msgid "Done." -msgstr "完成。" - -msgid "Pause container" -msgstr "暫停容器" - -msgid "Unpause container" -msgstr "恢復容器" diff --git a/luci-app-podman/root/etc/config/luci-podman-opkg b/luci-app-podman/root/etc/config/luci-podman-opkg deleted file mode 100644 index 52ae83bfc..000000000 --- a/luci-app-podman/root/etc/config/luci-podman-opkg +++ /dev/null @@ -1,3 +0,0 @@ -config luci_podman 'globals' - option init_start_priority '100' - option socket_path 'unix:///run/podman/podman.sock' diff --git a/luci-app-podman/root/etc/uci-defaults/80_luci-app-podman b/luci-app-podman/root/etc/uci-defaults/80_luci-app-podman deleted file mode 100755 index a5d245bd8..000000000 --- a/luci-app-podman/root/etc/uci-defaults/80_luci-app-podman +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Handle config: podman-opkg is the shipped default, podman is the live config -if [ ! -f /etc/config/luci-podman ]; then - mv /etc/config/luci-podman-opkg /etc/config/luci-podman -else - echo "Existing /etc/config/luci-podman preserved. New defaults at /etc/config/luci-podman-opkg" -fi - -exit 0 diff --git a/luci-app-podman/root/usr/libexec/podman-api b/luci-app-podman/root/usr/libexec/podman-api deleted file mode 100755 index 18284eda3..000000000 --- a/luci-app-podman/root/usr/libexec/podman-api +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env ucode - -'use strict'; - -import { popen, writefile, unlink } from 'fs'; -import * as podman_socket from 'luci.podman_socket'; // ucode-lsp disable -import { validate_int, validate_name, require_param } from 'luci.podman_validate'; // ucode-lsp disable - -function die(msg) { - warn(`${msg}\n`); - exit(1); -} - -// Volume export/import here shells out to the local `podman` CLI, which can -// only reach a Podman daemon running on the same host. When the user has -// configured a remote TCP Podman, refuse upfront rather than failing weirdly. -if (podman_socket.is_remote()) - die(`Volume operations are not supported with a remote Podman (${podman_socket.get_dest()}); the CLI helper requires a local daemon.`); - -// --- Main --- - -let action = ARGV[0]; - -if (action === 'volume_export') { - let volumeName = ARGV[1]; - let err = require_param('volumeName', volumeName) || validate_name(volumeName); - if (err) die(err); - - // volume export outputs a tar stream - use podman CLI directly - let escaped = replace(volumeName, /'/g, "'\\''"); - let p = popen(`/usr/bin/podman volume export '${escaped}'`, 'r'); - if (!p) - die('Failed to run podman volume export'); - - let chunk; - while ((chunk = p.read(65536)) != null && length(chunk) > 0) - print(chunk); - p.close(); -} -else if (action === 'volume_import') { - let volumeName = ARGV[1]; - let compressed = ARGV[2]; - let volumeData = ARGV[3]; - - let err = require_param('volumeName', volumeName) || validate_name(volumeName) - || require_param('volumeData', volumeData) - || require_param('compressed', compressed) || validate_int(compressed); - if (err) die(err); - - // Validate base64 content - if (!match(volumeData, /^[A-Za-z0-9+\/]*={0,2}$/) || (length(volumeData) % 4) !== 0) - die('Invalid Base64 content'); - - let decoded = b64dec(volumeData); - if (decoded == null) - die('Failed to decode import data'); - - // Decompress if needed - if (compressed === '1') { - let tp = popen('mktemp /tmp/podman_import_XXXXXX', 'r'); - let tmppath = tp ? trim(tp.read('all') || '') : ''; - if (tp) tp.close(); - if (!tmppath) - die('Failed to create temp file'); - - writefile(tmppath, decoded); - - let p = popen(`gunzip -c '${tmppath}'`, 'r'); - decoded = p ? p.read('all') : null; - if (p) p.close(); - unlink(tmppath); - - if (!decoded) - die('Failed to decompress import data'); - } - - // Ensure volume exists - let escaped = replace(volumeName, /'/g, "'\\''"); - let p = popen(`/usr/bin/podman volume exists '${escaped}' 2>/dev/null; echo $?`, 'r'); - let rc = p ? trim(p.read('all') || '') : ''; - if (p) p.close(); - - if (rc !== '0') { - p = popen(`/usr/bin/podman volume create '${escaped}' 2>/dev/null`, 'r'); - if (p) { p.read('all'); p.close(); } - } - - // Import via stdin pipe - p = popen(`/usr/bin/podman volume import '${escaped}' -`, 'w'); - if (!p) - die('Failed to start volume import'); - p.write(decoded); - let exit_code = p.close(); - - if (exit_code) { - // Cleanup on failure - popen(`/usr/bin/podman volume rm '${escaped}' 2>/dev/null`, 'r')?.close(); - die('Import failed'); - } -} -else { - die(`Unknown action: ${action}`); -} diff --git a/luci-app-podman/root/usr/share/luci/menu.d/luci-app-podman.json b/luci-app-podman/root/usr/share/luci/menu.d/luci-app-podman.json deleted file mode 100644 index 0f6c5ff6c..000000000 --- a/luci-app-podman/root/usr/share/luci/menu.d/luci-app-podman.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "admin/podman": { - "title": "Podman", - "order": 60, - "action": { - "type": "firstchild" - }, - "depends": { - "acl": [ - "luci-app-podman" - ] - } - }, - "admin/podman/overview": { - "title": "Overview", - "order": 10, - "action": { - "type": "view", - "path": "podman/overview" - } - }, - "admin/podman/containers": { - "title": "Containers", - "order": 20, - "action": { - "type": "view", - "path": "podman/containers" - } - }, - "admin/podman/container/*": { - "action": { - "type": "view", - "path": "podman/container" - } - }, - "admin/podman/pods": { - "title": "Pods", - "order": 25, - "action": { - "type": "view", - "path": "podman/pods" - } - }, - "admin/podman/pod/*": { - "action": { - "type": "view", - "path": "podman/pod" - } - }, - "admin/podman/images": { - "title": "Images", - "order": 30, - "action": { - "type": "view", - "path": "podman/images" - } - }, - "admin/podman/networks": { - "title": "Networks", - "order": 40, - "action": { - "type": "view", - "path": "podman/networks" - } - }, - "admin/podman/volumes": { - "title": "Volumes", - "order": 50, - "action": { - "type": "view", - "path": "podman/volumes" - } - }, - "admin/podman/secrets": { - "title": "Secrets", - "order": 60, - "action": { - "type": "view", - "path": "podman/secrets" - } - }, - "admin/podman/stream/logs/*": { - "action": { - "type": "function", - "module": "luci.controller.podman", - "function": "container_logs" - }, - "auth": { - "methods": [ - "cookie:sysauth_https", - "cookie:sysauth_http" - ], - "login": true - } - }, - "admin/podman/stream/top/*": { - "action": { - "type": "function", - "module": "luci.controller.podman", - "function": "container_top" - }, - "auth": { - "methods": [ - "cookie:sysauth_https", - "cookie:sysauth_http" - ], - "login": true - } - }, - "admin/podman/stream/stats/*": { - "action": { - "type": "function", - "module": "luci.controller.podman", - "function": "container_stats" - }, - "auth": { - "methods": [ - "cookie:sysauth_https", - "cookie:sysauth_http" - ], - "login": true - } - }, - "admin/podman/stream/pull": { - "action": { - "type": "function", - "module": "luci.controller.podman", - "function": "image_pull" - }, - "auth": { - "methods": [ - "cookie:sysauth_https", - "cookie:sysauth_http" - ], - "login": true - } - }, - "admin/podman/stream/pod_top/*": { - "action": { - "type": "function", - "module": "luci.controller.podman", - "function": "pod_top" - }, - "auth": { - "methods": [ - "cookie:sysauth_https", - "cookie:sysauth_http" - ], - "login": true - } - }, - "admin/podman/stream/pod_stats/*": { - "action": { - "type": "function", - "module": "luci.controller.podman", - "function": "pod_stats" - }, - "auth": { - "methods": [ - "cookie:sysauth_https", - "cookie:sysauth_http" - ], - "login": true - } - } -} diff --git a/luci-app-podman/root/usr/share/podman/procd-startup-template.sh b/luci-app-podman/root/usr/share/podman/procd-startup-template.sh deleted file mode 100755 index 8d3f9c06e..000000000 --- a/luci-app-podman/root/usr/share/podman/procd-startup-template.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh /etc/rc.common - -# Podman's restart policy handles runtime restarts to avoid conflicts - -START={start_priority} -STOP=20 -USE_PROCD=1 - -NAME={script_name} -PROG=/usr/bin/podman - -case "{name}" in - *[!A-Za-z0-9._-]*|'') - logger -t "${NAME}" "Invalid container name '{name}'; only [A-Za-z0-9._-] allowed" - exit 1 - ;; -esac - -start_service() { - # Register procd instance - socket wait happens inside command (non-blocking) - procd_open_instance "${NAME}" - procd_set_param command /bin/sh -c " - # Wait for Podman socket with timeout (120s) - max_wait=120 - count=0 - logger -t ${NAME} 'Waiting for Podman socket...' - while [ \"\$count\" -lt \"\$max_wait\" ]; do - [ -S /run/podman/podman.sock ] && break - sleep 1 - count=\$((count + 1)) - done - if [ ! -S /run/podman/podman.sock ]; then - logger -t ${NAME} 'Timeout: Podman socket not available' - exit 1 - fi - logger -t ${NAME} \"Podman socket available after \${count}s\" - - # Check container exists - if ! $PROG container exists '{name}' 2>/dev/null; then - logger -t ${NAME} 'Container {name} does not exist' - exit 1 - fi - - # Start container if not running - if ! $PROG container inspect '{name}' --format '{{.State.Running}}' 2>/dev/null | grep -q true; then - logger -t ${NAME} 'Starting container {name}' - $PROG start '{name}' || exit 1 - else - logger -t ${NAME} 'Container {name} already running' - fi - " - # Bounded retries: if S99podman's tie-break puts it after this script, - # the socket wait above may time out on a slow first boot. A capped - # respawn gives extra 120s windows without looping forever. - procd_set_param respawn 3600 5 5 - procd_close_instance -} - -stop_service() { - logger -t ${NAME} "Stopping container {name}" - $PROG stop "{name}" 2>/dev/null || true -} diff --git a/luci-app-podman/root/usr/share/podman/pull-worker.uc b/luci-app-podman/root/usr/share/podman/pull-worker.uc deleted file mode 100644 index 796087c93..000000000 --- a/luci-app-podman/root/usr/share/podman/pull-worker.uc +++ /dev/null @@ -1,102 +0,0 @@ -'use strict'; - -import { open, unlink } from 'fs'; -import { urlencode, ENCODE_FULL } from 'lucihttp'; // ucode-lsp disable -import * as podman_socket from 'luci.podman_socket'; // ucode-lsp disable -import { API_BASE } from 'luci.podman_socket'; // ucode-lsp disable -import { build_request, parse_status, read_headers } from 'luci.podman_http'; // ucode-lsp disable - -const BLOCKSIZE = 4096; - -const reference = ARGV[0]; -const logfile = ARGV[1]; -const pidfile = ARGV[2]; - -/** - * @param {string} msg - */ -function write_error(msg) { - let f = open(logfile, 'a'); - if (f) { - f.write('{"error":"' + replace(replace(msg, /\\/g, '\\\\'), /"/g, '\\"') + '"}\n'); - f.flush(); - f.close(); - } -} - -/** - * @param {int} code - */ -function cleanup(code) { - unlink(pidfile); - exit(code ?? 0); -} - -if (!reference || !logfile || !pidfile) - exit(1); - -// Write own PID to pidfile so the streaming endpoint can check if we are running -let ps = open('/proc/self/stat', 'r'); -if (ps) { - let pid = +(split(ps.read(200) || '0', ' ')[0]); - ps.close(); - let pf = open(pidfile, 'w'); - if (pf) { pf.write(pid + '\n'); pf.close(); } -} - -// Connect to Podman socket -let sock = podman_socket.connect(); -if (!sock) { - write_error('Cannot connect to Podman socket'); - cleanup(1); -} - -let encoded = urlencode(reference, ENCODE_FULL); - -sock.send(build_request( - 'POST', - sprintf('%s/images/pull?reference=%s&quiet=false', API_BASE, encoded), - null -)); - -// Read HTTP response headers (blocking recv - no uloop needed in standalone process) -let lf = null; - -let hdrs = read_headers(sock, BLOCKSIZE); -if (!hdrs) { - write_error('Podman closed connection before responding'); - sock.close(); - cleanup(1); -} - -let code = parse_status(hdrs.header_buf) || 502; -let body = hdrs.body_remainder; - -if (code !== 200) { - let parsed = null; - try { parsed = json(body); } catch(e) {} - let msg = (parsed?.message) || (parsed?.cause) - || replace(body, /\s+$/, '') - || sprintf('Podman error %d', code); - write_error(msg); - sock.close(); - cleanup(1); -} - -lf = open(logfile, 'a'); -if (!lf) { sock.close(); cleanup(1); } - -// Write any body bytes that arrived together with headers -if (length(body)) { lf.write(body); lf.flush(); } - -// Stream response body to logfile - Podman sends NDJSON, we write it as-is -while (true) { - let chunk = sock.recv(BLOCKSIZE); - if (!chunk) break; // EOF or error - Podman finished - lf.write(chunk); - lf.flush(); -} - -lf.close(); -sock.close(); -cleanup(0); diff --git a/luci-app-podman/root/usr/share/rpcd/acl.d/luci-app-podman.json b/luci-app-podman/root/usr/share/rpcd/acl.d/luci-app-podman.json deleted file mode 100644 index f7aa1c39d..000000000 --- a/luci-app-podman/root/usr/share/rpcd/acl.d/luci-app-podman.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "luci-app-podman": { - "description": "Grant access to Podman RPC methods", - "read": { - "cgi-io": [ - "exec" - ], - "file": { - "/usr/libexec/podman-api volume_export *": [ - "exec" - ] - }, - "ubus": { - "podman": [ - "containers_list", - "container_inspect", - "container_stats", - "container_top", - "container_healthcheck_run", - "images_list", - "image_inspect", - "image_manifest_inspect", - "networks_list", - "network_inspect", - "volumes_list", - "volume_inspect", - "pods_list", - "pod_inspect", - "secrets_list", - "secret_inspect", - "system_df", - "version", - "info", - "init_script_status", - "init_script_show", - "system_debug" - ] - }, - "uci": [ - "luci-podman", - "firewall", - "network", - "dhcp" - ] - }, - "write": { - "cgi-io": [ - "exec", - "upload" - ], - "file": { - "/tmp/podman-import": [ - "write" - ] - }, - "ubus": { - "podman": [ - "container_start", - "container_stop", - "container_restart", - "container_pause", - "container_unpause", - "container_remove", - "container_create", - "container_rename", - "container_update", - "container_healthcheck_run", - "image_remove", - "image_pull", - "network_create", - "network_remove", - "network_connect", - "network_disconnect", - "volume_create", - "volume_remove", - "volume_import", - "pod_start", - "pod_stop", - "pod_kill", - "pod_restart", - "pod_pause", - "pod_unpause", - "pod_remove", - "pod_create", - "secret_create", - "secret_remove", - "system_prune", - "init_script_generate", - "init_script_set_enabled", - "init_script_remove" - ] - }, - "uci": [ - "luci-podman", - "firewall", - "network", - "dhcp" - ] - } - } -} diff --git a/luci-app-podman/root/usr/share/rpcd/ucode/podman.uc b/luci-app-podman/root/usr/share/rpcd/ucode/podman.uc deleted file mode 100644 index 53bd51885..000000000 --- a/luci-app-podman/root/usr/share/rpcd/ucode/podman.uc +++ /dev/null @@ -1,1007 +0,0 @@ -'use strict'; - -// --- Table of Contents --- -// -// Infrastructure (lines 30-225) -// Configuration, validation, HTTP client, helpers -// -// RPC Methods (line 228+) -// Containers: list inspect start stop restart remove stats create rename -// update healthcheck top -// Images: list inspect remove manifest_inspect pull -// Networks: list inspect remove create connect disconnect -// Volumes: list inspect remove create import -// Pods: list inspect start stop restart pause unpause remove create stats -// Secrets: list inspect create remove -// System: df prune version info debug -// Init Scripts: generate show status set_enabled remove -// (exempt from socket check - operate on /etc/init.d/ only) -// -// Socket wrapper (end of file) - -import { readfile, writefile, popen, stat, chmod, unlink, glob, access } from 'fs'; -import { cursor } from 'uci'; -import { urlencode, ENCODE_FULL } from 'lucihttp'; // ucode-lsp disable -import * as podman_socket from 'luci.podman_socket'; // ucode-lsp disable -import { API_BASE } from 'luci.podman_socket'; // ucode-lsp disable -import { - validate_id, validate_name, validate_image_ref, validate_query_params, - validate_restart_policy, require_param, BODY_KEYS -} from 'luci.podman_validate'; // ucode-lsp disable -import { - build_request, parse_status, parse_content_length, read_headers -} from 'luci.podman_http'; // ucode-lsp disable - -import { connect } from 'ubus'; -let ubus = connect(); - -// --- Configuration --- - -const uci = cursor(); -const _prio = uci.get('luci-podman', 'globals', 'init_start_priority'); -// Capped at 99: procd sorts rc.d symlinks as plain strings, so a 3-digit -// value like 100 sorts *before* 2-digit priorities (e.g. network at 19-20). -const INIT_START_PRIORITY = (type(_prio) === 'string' && match(_prio, /^([0-9]|[1-9][0-9])$/)) ? _prio : '99'; -uci.unload('luci-podman'); - -// "podman" is a strict string prefix of this, so generated init scripts -// always sort after the real /etc/init.d/podman at any tied START value. -const INIT_SCRIPT_PREFIX = 'podman-container-'; - -// Validators come from luci.podman_validate (imported above). - -// --- HTTP Client --- - -/** - * @param {string} method - * @param {string} path - * @param {string} body - * @param {bool} raw - */ -function podman_request(method, path, body, raw) { - let sock = podman_socket.connect(); - if (!sock) - return { error: 'Failed to connect to Podman socket' }; - - sock.send(build_request(method, path, body)); - - let hdrs = read_headers(sock); - if (!hdrs) { - sock.close(); - return { error: 'Empty response from Podman API' }; - } - let header_buf = hdrs.header_buf; - let body_remainder = hdrs.body_remainder; - let chunk = ''; - - let status_code = parse_status(header_buf); - - // For 204 No Content (success with no body - e.g., start/stop/restart) - if (status_code === 204) { - sock.close(); - if (raw) return { status: 204, body: '' }; - return {}; - } - - let content_length = parse_content_length(header_buf); - - // Read body - let resp_body = `${body_remainder}`; - if (content_length >= 0) { - // Read exactly content_length bytes - while (length(resp_body) < content_length) { - chunk = sock.recv(65536); - if (!chunk) - break; - resp_body += `${chunk}`; - } - } else { - // No Content-Length - read until EOF - while (true) { - chunk = sock.recv(65536); - if (!chunk) - break; - resp_body += `${chunk}`; - } - } - - sock.close(); - - // Raw mode: return status + body without JSON parsing - if (raw) { - if (status_code >= 400) - return { error: trim(resp_body || `HTTP ${status_code}`) }; - return { status: status_code, body: resp_body }; - } - - // Try to parse JSON body - if (resp_body !== '') { - let parsed = null; - try { parsed = json(resp_body); } catch(e) {} - - if (parsed != null) { - // Wrap arrays in { data: [...] } for frontend compatibility - if (type(parsed) === 'array') - return { data: parsed }; - return parsed; - } - // Non-JSON response (e.g., plain text error) - if (status_code >= 400) - return { error: trim(resp_body) }; - return { data: resp_body }; - } - - if (status_code >= 400) - return { error: `HTTP ${status_code}` }; - - return {}; -} - -/** - * @param {string} id - */ -function encode_id(id) { - return urlencode(id, ENCODE_FULL); -} - - -/** - * @param {object} params - */ -function build_bool_query(params) { - let parts = []; - for (let k in params) { - if (params[k] === true || params[k] === 1) - push(parts, `${k}=true`); - } - return length(parts) ? '?' + join('&', parts) : ''; -} - -/** @param {any} data */ -function to_json_body(data) { - return (type(data) === 'string') ? data : sprintf('%J', data); -} - -// --- Init Script Helpers --- - -/** - * @param {string} name - */ -function init_script_path(name) { - return `/etc/init.d/${INIT_SCRIPT_PREFIX}${name}`; -} - -// --- RPC Methods --- - -const methods = { - // ==================== Containers ==================== - - containers_list: { - args: { query: '' }, - call: function(req) { - let path = `${API_BASE}/containers/json`; - if (req.args.query && req.args.query !== '') { - let err = validate_query_params(req.args.query); - if (err) return { error: err }; - path += `?${req.args.query}`; - } - return podman_request('GET', path); - } - }, - - container_inspect: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/containers/${encode_id(req.args.id)}/json`); - } - }, - - container_start: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/containers/${encode_id(req.args.id)}/start`); - } - }, - - container_stop: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/containers/${encode_id(req.args.id)}/stop`); - } - }, - - container_restart: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/containers/${encode_id(req.args.id)}/restart`); - } - }, - - container_pause: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/containers/${encode_id(req.args.id)}/pause`); - } - }, - - container_unpause: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/containers/${encode_id(req.args.id)}/unpause`); - } - }, - - container_remove: { - args: { id: '', force: false, depend: false }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - let query = build_bool_query({ force: req.args.force, depend: req.args.depend }); - return podman_request('DELETE', `${API_BASE}/containers/${encode_id(req.args.id)}${query}`); - } - }, - - container_stats: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/containers/${encode_id(req.args.id)}/stats?stream=false`); - } - }, - - container_create: { - args: { data: {} }, - call: function(req) { - let data = req.args.data; - let err = require_param('data', data); - if (err) return { error: err }; - let body = to_json_body(data); - return podman_request('POST', `${API_BASE}/containers/create`, body); - } - }, - - container_rename: { - args: { id: '', name: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id) - || require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - let name_enc = encode_id(req.args.name); - return podman_request('POST', `${API_BASE}/containers/${encode_id(req.args.id)}/rename?name=${name_enc}`); - } - }, - - container_update: { - args: { id: '', data: {} }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id) - || require_param('data', req.args.data); - if (err) return { error: err }; - - let data = req.args.data; - if (type(data) === 'string') - data = json(data); - if (!data) - return { error: 'Invalid JSON data' }; - - let id_enc = encode_id(req.args.id); - - // Build query params for restart policy - let query_parts = []; - if (data.RestartPolicy) { - let perr = validate_restart_policy(data.RestartPolicy); - if (perr) return { error: perr }; - push(query_parts, `restartPolicy=${data.RestartPolicy}`); - } - if (data.RestartRetries != null) - push(query_parts, `restartRetries=${+data.RestartRetries | 0}`); - - let query = length(query_parts) ? '?' + join('&', query_parts) : ''; - - // Determine if body is needed (resource/health updates) - let body_str = sprintf('%J', data); - let has_body_fields = false; - for (let k in data) { - if (k in BODY_KEYS) { has_body_fields = true; break; } - } - - return podman_request('POST', `${API_BASE}/containers/${id_enc}/update${query}`, - has_body_fields ? body_str : '{}'); - } - }, - - container_healthcheck_run: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/containers/${encode_id(req.args.id)}/healthcheck`); - } - }, - - container_top: { - args: { id: '', ps_args: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_id(req.args.id); - if (err) return { error: err }; - let path = `${API_BASE}/containers/${encode_id(req.args.id)}/top`; - if (req.args.ps_args && req.args.ps_args !== '') - path += `?ps_args=${encode_id(req.args.ps_args)}`; - return podman_request('GET', path); - } - }, - - // ==================== Images ==================== - - images_list: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/images/json`); - } - }, - - image_inspect: { - args: { id: '' }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_image_ref(req.args.id); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/images/${encode_id(req.args.id)}/json`); - } - }, - - image_remove: { - args: { id: '', force: false }, - call: function(req) { - let err = require_param('id', req.args.id) || validate_image_ref(req.args.id); - if (err) return { error: err }; - return podman_request('DELETE', `${API_BASE}/images/${encode_id(req.args.id)}${build_bool_query({ force: req.args.force })}`); - } - }, - - image_manifest_inspect: { - args: { image: '' }, - call: function(req) { - let err = require_param('image', req.args.image) || validate_image_ref(req.args.image); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/manifests/${encode_id(req.args.image)}/json`); - } - }, - - image_pull: { - args: { image: '' }, - call: function(req) { - let err = require_param('image', req.args.image) || validate_image_ref(req.args.image); - if (err) return { error: err }; - - let image_enc = urlencode(req.args.image, ENCODE_FULL); - let resp = podman_request('POST', `${API_BASE}/images/pull?reference=${image_enc}`, null, true); - if (resp.error) return resp; - - // Response is newline-delimited JSON: {"stream":"..."} lines - // Last line contains {"images":[...],"id":"..."} - let body = `${resp.body || ''}`; - let output = ''; - let images = null; - let id = null; - - let lines = split(body, '\n'); - for (let i = 0; i < length(lines); i++) { - let raw = lines[i]; - if (type(raw) !== 'string') continue; - let line = trim(raw); - if (!line) continue; - let parsed = null; - try { parsed = json(line); } catch(e) {} - if (!parsed) continue; - - if (parsed.stream) - output += parsed.stream; - if (parsed.images) - images = parsed.images; - if (parsed.id) - id = parsed.id; - if (parsed.error) - return { error: parsed.error }; - } - - return { output: output, images: images, id: id }; - } - }, - - // ==================== Networks ==================== - - networks_list: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/networks/json`); - } - }, - - network_inspect: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/networks/${encode_id(req.args.name)}/json`); - } - }, - - network_remove: { - args: { name: '', force: false }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('DELETE', `${API_BASE}/networks/${encode_id(req.args.name)}${build_bool_query({ force: req.args.force })}`); - } - }, - - network_create: { - args: { data: {} }, - call: function(req) { - let data = req.args.data; - let err = require_param('data', data); - if (err) return { error: err }; - let body = to_json_body(data); - return podman_request('POST', `${API_BASE}/networks/create`, body); - } - }, - - network_connect: { - args: { name: '', data: {} }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name) - || require_param('data', req.args.data); - if (err) return { error: err }; - let body = to_json_body(req.args.data); - return podman_request('POST', `${API_BASE}/networks/${encode_id(req.args.name)}/connect`, body); - } - }, - - network_disconnect: { - args: { name: '', data: {} }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name) - || require_param('data', req.args.data); - if (err) return { error: err }; - let body = to_json_body(req.args.data); - return podman_request('POST', `${API_BASE}/networks/${encode_id(req.args.name)}/disconnect`, body); - } - }, - - // ==================== Volumes ==================== - - volumes_list: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/volumes/json`); - } - }, - - volume_inspect: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/volumes/${encode_id(req.args.name)}/json`); - } - }, - - volume_remove: { - args: { name: '', force: false }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('DELETE', `${API_BASE}/volumes/${encode_id(req.args.name)}${build_bool_query({ force: req.args.force })}`); - } - }, - - volume_create: { - args: { data: {} }, - call: function(req) { - let data = req.args.data; - let err = require_param('data', data); - if (err) return { error: err }; - let body = to_json_body(data); - return podman_request('POST', `${API_BASE}/volumes/create`, body); - } - }, - - volume_import: { - args: { name: '', compressed: false }, - call: function(req) { - let name = req.args.name; - let err = require_param('name', name) || validate_name(name); - if (err) return { error: err }; - - let filepath = '/tmp/podman-import'; - if (!stat(filepath)) - return { error: 'Upload file not found' }; - - let existing = podman_request('GET', `${API_BASE}/volumes/${encode_id(name)}/json`); - if (!existing.Name) { - let created = podman_request('POST', `${API_BASE}/volumes/create`, - sprintf('%J', { Name: name })); - if (created.error) return created; - } - - let cmd; - if (req.args.compressed === true || req.args.compressed === 1) - cmd = sprintf('gunzip -c "%s" | /usr/bin/podman volume import "%s" - 2>&1', filepath, name); - else - cmd = sprintf('/usr/bin/podman volume import "%s" "%s" 2>&1', name, filepath); - - let p = popen(cmd, 'r'); - let output = p ? trim(p.read('all') || '') : ''; - let exit_code = p ? p.close() : 1; - - unlink(filepath); - - if (exit_code) - return { error: output || 'Import failed' }; - - return {}; - } - }, - - // ==================== Pods ==================== - - pods_list: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/pods/json`); - } - }, - - pod_inspect: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/pods/${encode_id(req.args.name)}/json`); - } - }, - - pod_start: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/pods/${encode_id(req.args.name)}/start`); - } - }, - - pod_stop: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/pods/${encode_id(req.args.name)}/stop`); - } - }, - - pod_kill: { - args: { name: '', signal: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - let sig = req.args.signal || 'SIGKILL'; - return podman_request('POST', `${API_BASE}/pods/${encode_id(req.args.name)}/kill?signal=${sig}`); - } - }, - - pod_restart: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/pods/${encode_id(req.args.name)}/restart`); - } - }, - - pod_pause: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/pods/${encode_id(req.args.name)}/pause`); - } - }, - - pod_unpause: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('POST', `${API_BASE}/pods/${encode_id(req.args.name)}/unpause`); - } - }, - - pod_remove: { - args: { name: '', force: false }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('DELETE', `${API_BASE}/pods/${encode_id(req.args.name)}${build_bool_query({ force: req.args.force })}`); - } - }, - - pod_create: { - args: { data: {} }, - call: function(req) { - let data = req.args.data; - let err = require_param('data', data); - if (err) return { error: err }; - let body = to_json_body(data); - return podman_request('POST', `${API_BASE}/pods/create`, body); - } - }, - - // ==================== Secrets ==================== - - secrets_list: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/secrets/json`); - } - }, - - secret_inspect: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('GET', `${API_BASE}/secrets/${encode_id(req.args.name)}/json`); - } - }, - - secret_create: { - args: { name: '', data: '', labels: {} }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name) - || require_param('data', req.args.data); - if (err) return { error: err }; - let query = `?name=${encode_id(req.args.name)}`; - let labels = req.args.labels; - if (type(labels) === 'object' && length(labels) > 0) - query += `&labels=${urlencode(sprintf('%J', labels), ENCODE_FULL)}`; - return podman_request('POST', `${API_BASE}/secrets/create${query}`, `${req.args.data}`); - } - }, - - secret_remove: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - return podman_request('DELETE', `${API_BASE}/secrets/${encode_id(req.args.name)}`); - } - }, - - // ==================== System ==================== - - system_df: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/system/df`); - } - }, - - system_prune: { - args: { all: false, volumes: false }, - call: function(req) { - let query = build_bool_query({ all: req.args.all, volumes: req.args.volumes }); - return podman_request('POST', `${API_BASE}/system/prune${query}`); - } - }, - - version: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/version`); - } - }, - - info: { - args: {}, - call: function() { - return podman_request('GET', `${API_BASE}/info`); - } - }, - - // ==================== System Debug ==================== - - system_debug: { - args: {}, - call: function() { - let checks = []; - - // 1. Podman binary - let podman_stat = stat('/usr/bin/podman'); - if (podman_stat) { - let proc = popen('/usr/bin/podman --version 2>/dev/null', 'r'); - let ver = proc ? trim(proc.read('line') || '') : ''; - if (proc) proc.close(); - push(checks, { name: 'podman_binary', label: 'Podman Binary', status: 'ok', detail: '/usr/bin/podman', message: ver }); - } else { - push(checks, { name: 'podman_binary', label: 'Podman Binary', status: 'error', detail: '/usr/bin/podman', message: 'Not found or not executable' }); - } - - // 2. Podman socket reachable - let dest = podman_socket.get_dest(); - let local_path = podman_socket.get_local_path(); - let socket_stat = null; - if (!local_path) { - push(checks, { name: 'podman_socket', label: 'Podman Socket', status: 'ok', detail: dest, message: 'Remote TCP (cannot stat)' }); - } else { - socket_stat = stat(local_path); - if (socket_stat && socket_stat.type === 'socket') { - push(checks, { name: 'podman_socket', label: 'Podman Socket', status: 'ok', detail: dest, message: 'Socket file exists' }); - } else { - push(checks, { name: 'podman_socket', label: 'Podman Socket', status: 'error', detail: dest, message: 'Socket not found' }); - } - } - - // 3. Socket responsive - if (podman_socket.is_remote() || (socket_stat && socket_stat.type === 'socket')) { - let ping = podman_request('GET', `${API_BASE}/_ping`); - if (ping && ping.data === 'OK') { - push(checks, { name: 'socket_responsive', label: 'Socket Responsive', status: 'ok', detail: 'API responding', message: '' }); - } else { - push(checks, { name: 'socket_responsive', label: 'Socket Responsive', status: 'warn', detail: 'API not responding', message: ping ? (ping.error || '') : '' }); - } - } else { - push(checks, { name: 'socket_responsive', label: 'Socket Responsive', status: 'error', detail: 'Skipped', message: 'Socket not available' }); - } - - // 4. ucode-mod-socket - push(checks, { name: 'ucode_socket', label: 'ucode-mod-socket', status: 'ok', detail: 'Built-in', message: 'Available (running ucode)' }); - - // 5. Init directory writable - let init_stat = stat('/etc/init.d'); - if (init_stat && init_stat.type === 'directory') { - // Test writability by checking we can create a temp file - let test_path = '/etc/init.d/.podman_write_test'; - let ok = writefile(test_path, ''); - if (ok != null) { - unlink(test_path); - push(checks, { name: 'init_dir_writable', label: 'Init Directory', status: 'ok', detail: '/etc/init.d/', message: 'Writable' }); - } else { - push(checks, { name: 'init_dir_writable', label: 'Init Directory', status: 'warn', detail: '/etc/init.d/', message: 'Not writable - init scripts cannot be created' }); - } - } else { - push(checks, { name: 'init_dir_writable', label: 'Init Directory', status: 'error', detail: '/etc/init.d/', message: 'Directory not found' }); - } - - // 6. Startup template - let template = '/usr/share/podman/procd-startup-template.sh'; - let tmpl_stat = stat(template); - if (tmpl_stat) { - let content = readfile(template); - if (content != null) { - push(checks, { name: 'startup_template', label: 'Startup Template', status: 'ok', detail: template, message: 'Readable' }); - } else { - push(checks, { name: 'startup_template', label: 'Startup Template', status: 'warn', detail: template, message: 'Exists but not readable' }); - } - } else { - push(checks, { name: 'startup_template', label: 'Startup Template', status: 'warn', detail: template, message: 'Not found - init script generation will fail' }); - } - - // 7. RPC plugin (self-check - if we're running, we exist) - push(checks, { name: 'rpc_plugin', label: 'RPC Plugin', status: 'ok', detail: '/usr/share/rpcd/ucode/podman.uc', message: 'Running (ucode)' }); - - // 8. Podman API helper - let api_helper = '/usr/libexec/podman-api'; - let helper_stat = stat(api_helper); - if (access(api_helper, 'x')) { - push(checks, { name: 'podman_api_helper', label: 'Podman API Helper', status: 'ok', detail: api_helper, message: 'Executable' }); - } else if (stat(api_helper)) { - push(checks, { name: 'podman_api_helper', label: 'Podman API Helper', status: 'warn', detail: api_helper, message: 'Exists but not executable' }); - } else { - push(checks, { name: 'podman_api_helper', label: 'Podman API Helper', status: 'warn', detail: api_helper, message: 'Not found - volume export/import will fail' }); - } - - // 9. UCI config - let uci_ctx = cursor(); - let socket_cfg = uci_ctx.get('luci-podman', 'globals', 'socket_path'); - let globals_ok = uci_ctx.get('luci-podman', 'globals'); - uci_ctx.unload('luci-podman'); - if (globals_ok) { - push(checks, { name: 'uci_config', label: 'UCI Config', status: 'ok', detail: 'luci-podman.globals', message: `socket_path=${socket_cfg || 'default'}` }); - } else { - push(checks, { name: 'uci_config', label: 'UCI Config', status: 'warn', detail: '/etc/config/luci-podman', message: 'Config not found or not loadable' }); - } - - // 10. Containers config - let containers_conf = '/etc/containers/containers.conf'; - let cc_stat = stat(containers_conf); - if (cc_stat) { - push(checks, { name: 'containers_conf', label: 'Containers Config', status: 'ok', detail: containers_conf, message: 'Readable' }); - } else { - push(checks, { name: 'containers_conf', label: 'Containers Config', status: 'warn', detail: containers_conf, message: 'Not found - using Podman defaults' }); - } - - // 11. Network config directory - let net_dir = '/etc/containers/networks'; - let nd_stat = stat(net_dir); - if (nd_stat && nd_stat.type === 'directory') { - let count = length(glob('/etc/containers/networks/*.json') ?? []); - push(checks, { name: 'network_config_dir', label: 'Network Config Dir', status: 'ok', detail: net_dir, message: `${count} network(s)` }); - } else { - push(checks, { name: 'network_config_dir', label: 'Network Config Dir', status: 'warn', detail: net_dir, message: 'Not found' }); - } - - return { checks: checks }; - } - }, - - // ==================== Init Scripts ==================== - - init_script_generate: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - - let name = `${req.args.name}`; - let start_priority = `${INIT_START_PRIORITY}`; - let script_name = `${INIT_SCRIPT_PREFIX}${name}`; - let script_path = init_script_path(name); - - let template = readfile('/usr/share/podman/procd-startup-template.sh'); - if (!template) - return { error: 'Failed to read startup template' }; - - let content = replace(template, /\{name\}/g, name); - content = replace(content, /\{start_priority\}/g, start_priority); - content = replace(content, /\{script_name\}/g, script_name); - - let written = writefile(script_path, content); - if (written == null) - return { error: 'Failed to create init script' }; - - chmod(script_path, 0755); - - return { success: true, path: script_path }; - } - }, - - init_script_show: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - - let path = init_script_path(req.args.name); - let content = readfile(path); - if (content == null) - return { error: 'Init script not found' }; - - return { content: content, path: path }; - } - }, - - init_script_status: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - - let name = `${INIT_SCRIPT_PREFIX}${req.args.name}`; - return ubus.defer( - 'rc', 'list', { name: name }, - function (rc, reply) { - if (reply[name] == null) { - req.reply({ exists: false, enabled: false }); - } else { - req.reply({ exists: true, enabled: reply[name].enabled }); - } - } - ); - } - }, - - init_script_set_enabled: { - args: { name: '', enabled: false }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - - let script_path = init_script_path(req.args.name); - if (!stat(script_path)) - return { error: 'Init script not found. Generate it first.' }; - - let name = `${INIT_SCRIPT_PREFIX}${req.args.name}`; - let action = (req.args.enabled === true || req.args.enabled === 1) ? 'enable' : 'disable'; - return ubus.defer( - 'rc', 'init', { name: name, action: action }, - function (rc, reply) { - if (rc == 0) { - req.reply({ success: true, enabled: (action === 'enable')}); - } else { - req.reply({ error: `Failed to ${action} service: ${reply}`}); - } - } - ); - } - }, - - init_script_remove: { - args: { name: '' }, - call: function(req) { - let err = require_param('name', req.args.name) || validate_name(req.args.name); - if (err) return { error: err }; - - let script_path = init_script_path(req.args.name); - if (!stat(script_path)) - return { success: true, message: 'Init script does not exist' }; - - // Disable before removing - let name = `${INIT_SCRIPT_PREFIX}${req.args.name}`; - return ubus.call( - 'rc', 'init', { name: name, action: 'disable' }, - function (rc, reply) { - if (rc == 0) { - unlink(script_path); - if (stat(script_path)) { - req.reply({ error: 'failed to remove init script' }); - } else { - req.reply({ success: true }); - } - } else { - req.reply({ error: `Failed to disable service: ${reply}` }); - } - } - ); - } - } -}; - -// --- Socket check wrapper --- -// Wrap all methods except system_debug with a socket availability check - -const no_socket_check = { - system_debug: true, - init_script_generate: true, - init_script_show: true, - init_script_status: true, - init_script_set_enabled: true, - init_script_remove: true -}; - -const _local_socket_path = podman_socket.get_local_path(); - -const wrapped_methods = {}; -for (let name in methods) { - let method = methods[name]; - if (no_socket_check[name]) { - wrapped_methods[name] = method; - } else { - wrapped_methods[name] = { - args: method.args, - call: function(req) { - // Cheap pre-check for unix sockets only; TCP relies on actual connect failures. - if (_local_socket_path) { - let s = stat(_local_socket_path); - if (!s || s.type !== 'socket') - return { error: 'Podman socket not found or not accessible' }; - } - return method.call(req); - } - }; - } -} - -return { 'podman': wrapped_methods }; diff --git a/luci-app-podman/ucode/controller/podman.uc b/luci-app-podman/ucode/controller/podman.uc deleted file mode 100644 index ec36bd05f..000000000 --- a/luci-app-podman/ucode/controller/podman.uc +++ /dev/null @@ -1,479 +0,0 @@ -'use strict'; - -import { open, stat, unlink } from 'fs'; -import * as uloop from 'uloop'; -import * as struct from 'struct'; -import { cursor } from 'uci'; -import { connect as ubus_connect } from 'ubus'; -import * as podman_socket from 'luci.podman_socket'; // ucode-lsp disable -import { API_BASE } from 'luci.podman_socket'; // ucode-lsp disable -import { validate_id } from 'luci.podman_validate'; // ucode-lsp disable -import { build_request, parse_status } from 'luci.podman_http'; // ucode-lsp disable - -const BLOCKSIZE = 4096; - -const FLUSH_SIZE = 1500; -const PAD_STR = (() => { - let s = ''; let i = 0; - while (i < FLUSH_SIZE) { s += ' '; i++; } - return s; -})(); - -/** @param {string} data */ -function http_write_padded(data) { - let n = length(data); - if (n >= FLUSH_SIZE) - return http.write(data); - return http.write(data + substr(PAD_STR, 0, FLUSH_SIZE - n)); // ucode-lsp disable -} - -const _uci_timeouts = (() => { - let c = cursor(); - let s = c.get('uhttpd', 'main', 'script_timeout'); - let n = c.get('uhttpd', 'main', 'network_timeout'); - c.unload('uhttpd'); - return { script: s ? +s : 60, network: n ? +n : 30 }; -})(); - - -/** - * @param {int} code - * @param {string} message - */ -function error_response(code, message) { - if (http.eoh) return; // ucode-lsp disable - http.status(code, message); - http.header('Content-Type', 'text/plain'); - http.write(message + '\n'); -} - - -/** - * @param {string} sid - */ -function session_timer(sid) { - let uci = cursor(); - let script_timeout = +(uci.get('uhttpd', 'main', 'script_timeout') ?? 60); - let sessiontime = +(uci.get('luci', 'sauth', 'sessiontime') ?? 3600); - let timeout_ms = (script_timeout - 5) * 1000; - - if (!sid) - return { timeout_ms, is_final: false, on_expire: () => uloop.end() }; - - let uconn = ubus_connect(); - let now = time(); - - let sdat = uconn.call('session', 'get', { ubus_rpc_session: sid }); - let deadline = +(sdat?.values?.podman_stream_deadline ?? 0); - let last_seen = +(sdat?.values?.podman_stream_last_seen ?? 0); - - let is_fresh = !deadline || (now - last_seen > script_timeout); - - if (is_fresh) - deadline = now + sessiontime; - - uconn.call('session', 'set', { - ubus_rpc_session: sid, - values: { podman_stream_deadline: deadline, podman_stream_last_seen: now } - }); - - let remaining_ms = (deadline - now) * 1000; - - if (remaining_ms <= 0) { - uconn.call('session', 'destroy', { ubus_rpc_session: sid }); - return null; - } - - let is_final = remaining_ms <= timeout_ms; - let fire_ms = is_final ? remaining_ms : timeout_ms; - - return { - timeout_ms: fire_ms, - is_final, - on_expire: () => { - if (is_final) - uconn.call('session', 'destroy', { ubus_rpc_session: sid }); - uloop.end(); - } - }; -} - -/** - * @param {string} api_path - * @param {function} on_data - * @param {boolean} early_headers - * @param {int} timer - */ -function stream_podman(api_path, on_data, early_headers, timer) { - let sock = podman_socket.connect(); - if (!sock) { - error_response(502, 'Cannot connect to Podman socket'); - return; - } - - sock.send(build_request('GET', api_path, null)); - - let t = _uci_timeouts; - let ka_ms = (t.network - 5) * 1000; - - uloop.init(); - - let response_started = early_headers; - if (early_headers) { - http.status(200, 'OK'); - http.header('Content-Type', 'text/plain'); - http.write_headers(); - http.write('\n'); - } - - let buf = ''; - let podman_headers_done = false; - - let handle = uloop.handle(sock, () => { - let chunk = sock.recv(BLOCKSIZE); - if (type(chunk) !== 'string') return; // EAGAIN - keep waiting - - if (!podman_headers_done) { - // Phase 1: consuming Podman's HTTP response headers - if (!length(chunk)) { - // EOF before Podman sent headers - if (!response_started) - error_response(502, 'Podman closed connection'); - uloop.end(); - return; - } - buf += chunk; - if (type(buf) !== 'string') return; - let sep = index(buf, '\r\n\r\n'); - if (type(sep) !== 'int' || sep < 0) return; // headers not complete yet - - let code = parse_status(buf) || 502; - if (code != 200) { - if (!response_started) - error_response(code, substr(buf, sep + 4) || sprintf('Podman error %d', code)); - uloop.end(); - return; - } - - sep = sep + 4; - let body_start = substr(buf, sep); - buf = ''; - podman_headers_done = true; - - if (!response_started) { - // Stats: start our response now that Podman confirmed 200 - http.status(200, 'OK'); - http.header('Content-Type', 'application/x-ndjson'); - http.write_headers(); - http.write('\n'); - response_started = true; - } - - if (body_start && length(body_start)) { - if (!on_data(body_start)) { uloop.end(); return; } - } - } else { - // Phase 2: streaming data - if (!length(chunk)) { uloop.end(); return; } // Podman closed stream - if (!on_data(chunk)) uloop.end(); - } - }, uloop.ULOOP_READ); - - if (early_headers) - uloop.timer(ka_ms, () => http_write_padded('\n')); - - let effective_timeout = early_headers ? min(timer.timeout_ms, ka_ms * 2) : timer.timeout_ms; - uloop.timer(effective_timeout, timer.on_expire); - - uloop.run(); - - handle.delete(); - sock.close(); - - if (!response_started) - error_response(504, 'Podman did not respond'); -} - -return { - container_logs: (id) => { - if (validate_id(id)) { error_response(400, 'Invalid container ID'); return; } - - let timer = session_timer(ctx?.authsession); // ucode-lsp disable - if (!timer) { error_response(403, 'Session expired'); return; } - - let tail = http.formvalue('tail') || '100'; - let since = http.formvalue('since') || ''; - let until = http.formvalue('until') || ''; - let follow = http.formvalue('follow') !== 'false'; - - if (tail !== 'all' && !match(`${tail}`, /^[0-9]+$/)) { - error_response(400, 'Invalid tail parameter'); - return; - } - - if (since && !match(`${since}`, /^[0-9]+(\.[0-9]+)?$/)) { - error_response(400, 'Invalid since parameter'); - return; - } - - if (until && !match(`${until}`, /^[0-9]+(\.[0-9]+)?$/)) { - error_response(400, 'Invalid until parameter'); - return; - } - - let api_path = sprintf( - '%s/containers/%s/logs?follow=%s&stdout=true&stderr=true×tamps=false', - API_BASE, id, follow ? 'true' : 'false' - ); - if (tail) api_path += sprintf('&tail=%s', tail); - if (since) api_path += sprintf('&since=%s', since); - if (until) api_path += sprintf('&until=%s', until); - - let framebuf = ''; - - stream_podman(api_path, (chunk) => { - framebuf += `${chunk}`; - let out = ''; - while (length(framebuf) >= 8) { - let hdr = struct.unpack('!BxxxI', substr(framebuf, 0, 8)); - if (!hdr) break; - let stream_type = hdr[0]; - let payload_len = int(`${hdr[1]}`); - if (length(framebuf) < 8 + payload_len) break; // wait for more data - let payload = substr(framebuf, 8, payload_len); - framebuf = substr(framebuf, 8 + payload_len); - // Emit stdout (1) and stderr (2); skip others - if (stream_type >= 1 && stream_type <= 2) - out += payload; - } - if (length(out)) http_write_padded(out); - return true; - }, true, timer); - }, - - container_top: (id) => { - if (validate_id(id)) { error_response(400, 'Invalid container ID'); return; } - - let timer = session_timer(ctx?.authsession); // ucode-lsp disable - if (!timer) { error_response(403, 'Session expired'); return; } - - let delay = http.formvalue('delay') || '5'; - let ps_args = http.formvalue('ps_args') || ''; - - if (!match(`${delay}`, /^[0-9]+$/) || +delay < 2) { - error_response(400, 'Invalid delay parameter'); - return; - } - - if (ps_args && !match(`${ps_args}`, /^[-a-zA-Z0-9_, ]+$/)) { - error_response(400, 'Invalid ps_args parameter'); - return; - } - - let api_path = sprintf('%s/containers/%s/top?stream=true&delay=%s', API_BASE, id, delay); - - if (ps_args) - api_path += sprintf('&ps_args=%s', replace(ps_args, / /g, '%20')); - - stream_podman(api_path, (chunk) => { - return http_write_padded(chunk); - }, false, timer); - }, - - container_stats: (id) => { - if (validate_id(id)) { error_response(400, 'Invalid container ID'); return; } - - let timer = session_timer(ctx?.authsession); // ucode-lsp disable - if (!timer) { error_response(403, 'Session expired'); return; } - - let interval = `${http.formvalue('interval') || '3'}`; - if (!match(interval, /^[0-9]+$/) || +interval < 1) { - error_response(400, 'Invalid interval parameter'); - return; - } - let api_path = sprintf('%s/containers/stats?containers=%s&stream=true&interval=%s', - API_BASE, id, interval); - - stream_podman(api_path, (chunk) => { - return http_write_padded(chunk); - }, false, timer); - }, - - pod_top: (name) => { - if (validate_id(name)) { error_response(400, 'Invalid pod name or ID'); return; } - - let timer = session_timer(ctx?.authsession); // ucode-lsp disable - if (!timer) { error_response(403, 'Session expired'); return; } - - let delay = http.formvalue('delay') || '5'; - - if (!match(`${delay}`, /^[0-9]+$/) || +delay < 2) { - error_response(400, 'Invalid delay parameter'); - return; - } - - let api_path = sprintf('%s/pods/%s/top?stream=true&delay=%s', API_BASE, name, delay); - - stream_podman(api_path, (chunk) => { - return http_write_padded(chunk); - }, false, timer); - }, - - pod_stats: (name) => { - if (validate_id(name)) { error_response(400, 'Invalid pod name or ID'); return; } - - let timer = session_timer(ctx?.authsession); // ucode-lsp disable - if (!timer) { error_response(403, 'Session expired'); return; } - - let api_path = sprintf('%s/pods/stats?namesOrIDs=%s&stream=true', API_BASE, name); - - stream_podman(api_path, (chunk) => { - return http_write_padded(chunk); - }, false, timer); - }, - - image_pull: () => { - let timer = session_timer(ctx?.authsession); // ucode-lsp disable - if (!timer) { error_response(403, 'Session expired'); return; } - - let reference = `${http.formvalue('reference')}`; - if (!reference || !match(reference, /^[a-zA-Z0-9._/:@-]+$/)) { - error_response(400, 'Invalid or missing reference parameter'); - return; - } - - if (!match(reference, /[/:@]/)) { - error_response(400, 'Reference must be a registry reference (e.g. name:tag), not a raw image ID'); - return; - } - - let sid = ctx?.authsession; // ucode-lsp disable - let ref_id = replace(reference, /[/:@]/g, '-'); - let logfile = '/tmp/podman-pull-' + ref_id + '.ndjson'; - let pidfile = '/tmp/podman-pull-' + ref_id + '.pid'; - - // Check if a worker is already running for this reference - let pid = 0; - let pf = open(pidfile, 'r'); - if (pf) { pid = +(trim(pf.read(200) || '0')); pf.close(); } - let is_running = pid > 0 && stat('/proc/' + pid); - - // Read (and reuse) the ubus connection for session offset - let uconn_rw = sid ? ubus_connect() : null; - let offset = 0; - if (uconn_rw) { - let sdat = uconn_rw.call('session', 'get', { ubus_rpc_session: sid }); - offset = +(sdat?.values?.['pull_' + ref_id] || 0); - } - - // Check if the existing logfile has bytes we haven't sent yet - // (worker may have just finished between two reconnects) - let lstat = stat(logfile); - let has_unread = lstat && offset < lstat.size; - - let is_completed_pull = false; - if (!is_running && lstat && lstat.size > 0) { - let f = open(logfile, 'r'); - if (f) { - let tail_start = lstat.size > 512 ? lstat.size - 512 : 0; - if (tail_start > 0) f.seek(tail_start); - let tail = f.read(512); - f.close(); - is_completed_pull = !!(tail && (index(tail, '"images"') >= 0 || index(tail, '"error"') >= 0)); - } - } - - // Fresh start: worker not running AND (previous pull completed, OR no unread - // progress from a prior session, OR stale offset=0 logfile from a closed tab). - let is_fresh_start = !is_running && (is_completed_pull || !(has_unread && offset > 0)); - - if (is_fresh_start) { - // Clean up any stale files and reset offset - unlink(logfile); - unlink(pidfile); - offset = 0; - if (uconn_rw) { - let vals = {}; - vals['pull_' + ref_id] = 0; - uconn_rw.call('session', 'set', { ubus_rpc_session: sid, values: vals }); - } - // Safety: single quotes are used as shell delimiters below. - // The regex on line 295 already rejects them; this is a belt-and-suspenders guard. - if (index(reference, "'") >= 0 || index(logfile, "'") >= 0 || index(pidfile, "'") >= 0) { - error_response(400, 'Invalid characters in reference'); - return; - } - system(sprintf( - "timeout 600 /usr/bin/ucode /usr/share/podman/pull-worker.uc '%s' '%s' '%s' /dev/null 2>/dev/null &", - reference, logfile, pidfile - )); - } - - http.status(200, 'OK'); - http.header('Content-Type', 'text/plain'); - http.write_headers(); - http.write('\n'); - - let t = _uci_timeouts; - let ka_ms = (t.network - 5) * 1000; - let last_saved = offset; - - uloop.init(); - - let poll_fn; - poll_fn = () => { - // Read and forward any new bytes written to the logfile - let lf = open(logfile, 'r'); - if (lf) { - if (offset > 0) lf.seek(offset); - let chunk = lf.read(8192); - lf.close(); - if (chunk && length(chunk)) { - if (!http_write_padded(chunk)) { uloop.end(); return; } - offset += length(chunk); - // Persist offset to session (rate-limited) - if (uconn_rw && offset - last_saved >= 1024) { - let vals = {}; - vals['pull_' + ref_id] = offset; - uconn_rw.call('session', 'set', { ubus_rpc_session: sid, values: vals }); - last_saved = offset; - } - } - } - - // If worker has finished and we've consumed all bytes: close cleanly - let cpid = 0; - let cpf = open(pidfile, 'r'); - if (cpf) { cpid = +(trim(cpf.read(200) || '0')); cpf.close(); } - if (!cpid || !stat('/proc/' + cpid)) { - let sf = stat(logfile); - if (!sf || offset >= sf.size) { - unlink(logfile); - uloop.end(); - return; - } - } - - uloop.timer(200, poll_fn); - }; - uloop.timer(0, poll_fn); - - // Self-rearming keepalive - prevents network_timeout during slow layer downloads - let ka; - ka = () => { http_write_padded('\n'); uloop.timer(ka_ms, ka); }; - uloop.timer(ka_ms, ka); - - // Session expiry timer - same pattern as other streams - uloop.timer(timer.timeout_ms, timer.on_expire); - - uloop.run(); - - // Persist final offset before this script exits (next reconnect will resume here) - if (uconn_rw && offset !== last_saved) { - let vals = {}; - vals['pull_' + ref_id] = offset; - uconn_rw.call('session', 'set', { ubus_rpc_session: sid, values: vals }); - } - }, - -}; diff --git a/luci-app-podman/ucode/podman_http.uc b/luci-app-podman/ucode/podman_http.uc deleted file mode 100644 index a417f5146..000000000 --- a/luci-app-podman/ucode/podman_http.uc +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 Christopher Söllinger -// Licensed to the public under the Apache License 2.0. -// -// Small helpers for the wire-format HTTP/1.0 conversation the rpcd plugin, -// the LuCI streaming controller and the pull-worker all have with the -// Podman API socket. None of them need a full HTTP client — just request -// construction and a couple of header parsers. - -'use strict'; - -/** - * @param {string} method GET / POST / PUT / DELETE - * @param {string} path Request-URI including any query string - * @param {string|null} body JSON body (or null/empty for GET-style requests) - * @returns {string} The complete request bytes - */ -export function build_request(method, path, body) { - let req = sprintf('%s %s HTTP/1.0\r\nHost: localhost\r\n', method, path); - if (body != null && body !== '') { - let s = `${body}`; - req += sprintf('Content-Type: application/json\r\nContent-Length: %d\r\n', length(s)); - req += '\r\n'; - req += s; - return req; - } - return req + '\r\n'; -}; - -/** - * Extract HTTP status code from the start of a response buffer. - * - * @param {string} buf Buffer that begins with the status line - * @returns {number} Status code, or 0 if the line doesn't match - */ -export function parse_status(buf) { - let m = match(buf, /^HTTP\/[0-9.]+ ([0-9]+)/); - return m ? +m[1] : 0; -}; - -/** - * Extract a Content-Length value from a response header buffer. - * - * @param {string} buf Header buffer (status line + headers) - * @returns {number} Bytes declared by Content-Length, or -1 if absent - */ -export function parse_content_length(buf) { - let m = match(buf, /[Cc]ontent-[Ll]ength:\s*([0-9]+)/); - return m ? +m[1] : -1; -}; - -/** - * Blocking read of HTTP response headers from a connected socket. Reads - * until the \r\n\r\n separator is seen, then returns the header block - * (without trailing CRLFCRLF) and any body bytes that arrived together - * with the headers. Returns null if the peer closes before headers are - * complete. - * - * @param {any} sock Connected socket - * @param {number|null} blocksize recv chunk size (default 65536) - * @returns {{header_buf:string, body_remainder:string}|null} - */ -export function read_headers(sock, blocksize) { - let bs = blocksize || 65536; - let buf = ''; - while (true) { - let chunk = sock.recv(bs); - if (!chunk) return null; - buf += `${chunk}`; - let sep = index(buf, '\r\n\r\n'); - if (type(sep) !== 'int' || sep < 0) continue; - return { - header_buf: substr(buf, 0, sep), - body_remainder: substr(buf, sep + 4) - }; - } -}; diff --git a/luci-app-podman/ucode/podman_socket.uc b/luci-app-podman/ucode/podman_socket.uc deleted file mode 100644 index ad33534e2..000000000 --- a/luci-app-podman/ucode/podman_socket.uc +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2026 Christopher Söllinger -// Licensed to the public under the Apache License 2.0. -// -// Shared Podman socket helper for the rpcd plugin, the LuCI streaming -// controller, the pull-worker and the podman-api CLI helper. Reads the -// destination once at module load from UCI: -// luci-podman.globals.socket_path -// Accepted URI schemes: -// unix:///path/to/socket AF_UNIX -// tcp://host:port AF_INET -// tcp6://[::1]:port AF_INET6 -// /path/to/socket bare path, treated as unix:///path -// Fallback: unix:///run/podman/podman.sock. - -'use strict'; - -import { cursor } from 'uci'; -import * as socket from 'socket'; - -const DEFAULT_DEST = 'unix:///run/podman/podman.sock'; - -/** Path prefix for all libpod REST API endpoints. */ -export const API_BASE = '/v5.0.0/libpod'; - -const _dest = (() => { - let c = cursor(); - let v = c.get('luci-podman', 'globals', 'socket_path'); - c.unload('luci-podman'); - return v || DEFAULT_DEST; -})(); - -const _parsed = (() => { - if (substr(_dest, 0, 1) === '/') - return { scheme: 'unix', addr: _dest }; - let m = match(_dest, /^([a-z0-9]+):\/\/(.+)$/i); - if (!m) - return null; - return { scheme: lc(m[1]), addr: m[2] }; -})(); - -/** @returns {?Socket} connected socket, or null on failure */ -export function connect() { - if (!_parsed) - return null; - - if (_parsed.scheme === 'unix') { - let sock = socket.create(socket.AF_UNIX, socket.SOCK_STREAM); - if (!sock) return null; - if (!sock.connect(socket.sockaddr(_parsed.addr))) { - sock.close(); - return null; - } - return sock; - } - - if (_parsed.scheme === 'tcp' || _parsed.scheme === 'tcp6') { - let family = _parsed.scheme === 'tcp6' ? socket.AF_INET6 : socket.AF_INET; - let raw = _parsed.addr; - let colon = rindex(raw, ':'); - if (colon < 0) return null; - let host = substr(raw, 0, colon); - let port = +substr(raw, colon + 1); - host = replace(host, /^\[|\]$/g, ''); - if (!port || !host) return null; - - let ai = socket.addrinfo(host, `${port}`, { family, socktype: socket.SOCK_STREAM }); - if (!ai || !length(ai)) return null; - let sock = socket.create(family, socket.SOCK_STREAM); - if (!sock) return null; - if (!sock.connect(ai[0].addr)) { - sock.close(); - return null; - } - return sock; - } - - return null; -}; - -/** @returns {boolean} true if destination is a TCP scheme */ -export function is_remote() { - return _parsed && (_parsed.scheme === 'tcp' || _parsed.scheme === 'tcp6'); -}; - -/** @returns {string} the raw URI from UCI (or the default), for logging */ -export function get_dest() { - return _dest; -}; - -/** - * @returns {?string} filesystem path of the unix socket, or null for tcp/tcp6. - * Useful for pre-flight stat() checks before connect(). - */ -export function get_local_path() { - if (!_parsed || _parsed.scheme !== 'unix') return null; - return _parsed.addr; -}; diff --git a/luci-app-podman/ucode/podman_validate.uc b/luci-app-podman/ucode/podman_validate.uc deleted file mode 100644 index c4cb2a3ea..000000000 --- a/luci-app-podman/ucode/podman_validate.uc +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 Christopher Söllinger -// Licensed to the public under the Apache License 2.0. -// -// Shared parameter validators for the rpcd plugin, the LuCI streaming -// controller and the podman-api CLI helper. -// -// Convention: every exported validator returns an error message **string** -// on failure and `null` on success, so call sites can chain with || : -// -// let err = require_param('name', v) || validate_name(v); -// if (err) return { error: err }; - -'use strict'; - -const VALID_RESTART_POLICIES = { 'no': true, 'always': true, 'on-failure': true, 'unless-stopped': true }; - -const CONTAINER_BODY_KEYS = { - cpu: true, memory: true, blockIO: true, devices: true, - hugepageLimits: true, network: true, pids: true, rdma: true, unified: true, - BlkIOWeightDevice: true, - DeviceReadBPs: true, DeviceReadIOPs: true, - DeviceWriteBPs: true, DeviceWriteIOPs: true, - Env: true, UnsetEnv: true, - health_cmd: true, health_interval: true, health_log_destination: true, - health_max_log_count: true, health_max_log_size: true, - health_on_failure: true, health_retries: true, health_start_period: true, - health_startup_cmd: true, health_startup_interval: true, - health_startup_retries: true, health_startup_success: true, - health_startup_timeout: true, health_timeout: true, - no_healthcheck: true -}; - -/** @param {string} id */ -export function validate_id(id) { - if (!id || type(id) !== 'string' || !match(id, /^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/)) - return 'Invalid id format'; -}; - -/** @param {string} name */ -export function validate_name(name) { - if (!name || type(name) !== 'string' || !match(name, /^[a-zA-Z0-9_.-]+$/)) - return 'Invalid name format'; -}; - -/** @param {string} ref */ -export function validate_image_ref(ref) { - if (!ref || type(ref) !== 'string' || !match(ref, /^[a-zA-Z0-9_.:\/@-]+$/)) - return 'Invalid image reference'; -}; - -/** @param {string} query */ -export function validate_query_params(query) { - if (!query || type(query) !== 'string' || !match(query, /^[a-zA-Z0-9=&_.,-]+$/)) - return 'Invalid query parameters'; -}; - -/** @param {string} policy */ -export function validate_restart_policy(policy) { - if (policy && !(policy in VALID_RESTART_POLICIES)) - return 'Invalid restart policy'; -}; - -/** @param {string} val */ -export function validate_int(val) { - if (!val || type(val) !== 'string' || !match(val, /^[0-9]+$/)) - return 'Invalid number'; -}; - -/** - * @param {string} name - * @param {any} value - */ -export function require_param(name, value) { - if (value == null || value === '' - || (type(value) === 'object' && length(keys(value)) === 0)) - return `Missing required parameter: ${name}`; -}; - -export const BODY_KEYS = CONTAINER_BODY_KEYS;