From 4e24fe7535c4bba83430ccf1c56d23d4b7fbfe02 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Nov 2026 17:29:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=84=20Sync=202026-11-14=2017:29:54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luci-theme-carbon/.gitattributes | 9 + luci-theme-carbon/.gitignore | 13 + luci-theme-carbon/LICENSE | 202 ++ luci-theme-carbon/Makefile | 43 + luci-theme-carbon/README.md | 186 + luci-theme-carbon/README.zh-CN.md | 184 + luci-theme-carbon/docs/apk-install.md | 70 + luci-theme-carbon/docs/apk-signing.md | 44 + luci-theme-carbon/docs/online-update.md | 68 + luci-theme-carbon/docs/releases/install.md | 47 + luci-theme-carbon/docs/releases/v1.1.1.md | 15 + luci-theme-carbon/docs/releases/v1.1.2.md | 10 + luci-theme-carbon/docs/releases/v1.1.3.md | 17 + luci-theme-carbon/docs/releases/v1.1.4.md | 35 + luci-theme-carbon/docs/releases/v1.1.5.md | 33 + .../htdocs/luci-static/carbon/brands.js | 10 + .../htdocs/luci-static/carbon/carbon.css | 3157 +++++++++++++++++ .../htdocs/luci-static/carbon/carbon.js | 2099 +++++++++++ .../htdocs/luci-static/carbon/i18n/de.js | 170 + .../htdocs/luci-static/carbon/i18n/es.js | 170 + .../htdocs/luci-static/carbon/i18n/fr.js | 170 + .../htdocs/luci-static/carbon/i18n/it.js | 170 + .../htdocs/luci-static/carbon/i18n/ja.js | 170 + .../htdocs/luci-static/carbon/i18n/ko.js | 170 + .../htdocs/luci-static/carbon/i18n/pt-br.js | 170 + .../htdocs/luci-static/carbon/i18n/ru.js | 170 + .../htdocs/luci-static/carbon/i18n/tr.js | 170 + .../htdocs/luci-static/carbon/i18n/vi.js | 170 + .../htdocs/luci-static/carbon/i18n/zh-cn.js | 170 + .../htdocs/luci-static/carbon/i18n/zh-tw.js | 170 + .../htdocs/luci-static/carbon/logo.svg | 1 + .../luci-static/resources/carbon/markdown.js | 230 ++ .../luci-static/resources/menu-carbon.js | 284 ++ .../resources/view/system/carbon-update.js | 296 ++ luci-theme-carbon/keys/SHA256SUMS | 1 + luci-theme-carbon/keys/carbon-apk.pem | 4 + luci-theme-carbon/package-lock.json | 546 +++ luci-theme-carbon/package.json | 17 + luci-theme-carbon/po/de/carbon.po | 674 ++++ luci-theme-carbon/po/es/carbon.po | 674 ++++ luci-theme-carbon/po/fr/carbon.po | 674 ++++ luci-theme-carbon/po/it/carbon.po | 674 ++++ luci-theme-carbon/po/ja/carbon.po | 674 ++++ luci-theme-carbon/po/ko/carbon.po | 674 ++++ luci-theme-carbon/po/pt_BR/carbon.po | 674 ++++ luci-theme-carbon/po/ru/carbon.po | 674 ++++ luci-theme-carbon/po/templates/carbon.pot | 673 ++++ luci-theme-carbon/po/tr/carbon.po | 674 ++++ luci-theme-carbon/po/vi/carbon.po | 674 ++++ luci-theme-carbon/po/zh-cn | 1 + luci-theme-carbon/po/zh_Hans/carbon.po | 674 ++++ luci-theme-carbon/po/zh_Hant/carbon.po | 674 ++++ luci-theme-carbon/preview/demo.css | 21 + luci-theme-carbon/preview/demo.js | 215 ++ luci-theme-carbon/preview/form.html | 17 + luci-theme-carbon/preview/index.html | 61 + luci-theme-carbon/preview/lang.js | 18 + luci-theme-carbon/preview/login.html | 45 + luci-theme-carbon/preview/mock.js | 166 + .../etc/uci-defaults/30_luci-theme-carbon | 24 + .../root/lib/upgrade/keep.d/luci-theme-carbon | 2 + .../root/usr/libexec/rpcd/luci.carbon_update | 309 ++ .../root/usr/share/carbon/keys/carbon-apk.pem | 4 + .../root/usr/share/carbon/version | 1 + .../share/luci/menu.d/luci-theme-carbon.json | 8 + .../rpcd/acl.d/luci-theme-carbon-update.json | 10 + .../share/rpcd/acl.d/luci-theme-carbon.json | 43 + luci-theme-carbon/scripts/build-css.py | 42 + luci-theme-carbon/scripts/build-demo.py | 37 + luci-theme-carbon/scripts/build-installer.sh | 86 + luci-theme-carbon/scripts/build-ipk.sh | 107 + luci-theme-carbon/scripts/check-version.sh | 15 + luci-theme-carbon/scripts/gen-brands.py | 217 ++ luci-theme-carbon/scripts/gen-i18n.py | 158 + luci-theme-carbon/scripts/installer-head.sh | 285 ++ luci-theme-carbon/scripts/minify.mjs | 42 + luci-theme-carbon/scripts/release-notes.sh | 65 + luci-theme-carbon/scripts/sign-apk.sh | 30 + luci-theme-carbon/styles/00-header.css | 8 + luci-theme-carbon/styles/01-tokens.css | 117 + luci-theme-carbon/styles/02-base.css | 67 + luci-theme-carbon/styles/03-shell.css | 656 ++++ luci-theme-carbon/styles/04-login.css | 95 + .../styles/05-luci-structure.css | 191 + luci-theme-carbon/styles/06-forms.css | 187 + luci-theme-carbon/styles/07-buttons.css | 152 + luci-theme-carbon/styles/08-dropdown.css | 234 ++ luci-theme-carbon/styles/09-dynlist.css | 59 + luci-theme-carbon/styles/10-tabs.css | 96 + luci-theme-carbon/styles/11-tables.css | 133 + luci-theme-carbon/styles/12-alerts.css | 210 ++ luci-theme-carbon/styles/13-modals.css | 100 + luci-theme-carbon/styles/14-misc.css | 76 + luci-theme-carbon/styles/15-dashboard.css | 359 ++ luci-theme-carbon/styles/16-responsive.css | 224 ++ luci-theme-carbon/styles/17-update-page.css | 124 + luci-theme-carbon/styles/18-plugins.css | 58 + luci-theme-carbon/styles/19-print.css | 9 + luci-theme-carbon/tests/README.md | 38 + luci-theme-carbon/tests/apk-signing.sh | 37 + .../tests/browser/preview.test.js | 545 +++ luci-theme-carbon/tests/carbon.test.js | 285 ++ .../tests/fixtures/settings.html | 54 + .../tests/installer-integration.py | 153 + luci-theme-carbon/tests/installer-stubs/apk | 23 + luci-theme-carbon/tests/installer-stubs/opkg | 19 + luci-theme-carbon/tests/installer-stubs/uci | 8 + luci-theme-carbon/tests/installer.test.js | 179 + .../tests/make-update-fixtures.sh | 20 + luci-theme-carbon/tests/markdown.test.js | 105 + luci-theme-carbon/tests/menu-cache.test.js | 71 + luci-theme-carbon/tests/menu-carbon.test.js | 99 + luci-theme-carbon/tests/navigation.html | 81 + luci-theme-carbon/tests/opkg-update.py | 90 + luci-theme-carbon/tests/release-notes.test.js | 52 + luci-theme-carbon/tests/render-template.uc | 25 + .../tests/settings-backend.test.js | 120 + luci-theme-carbon/tests/shell-stubs/jshn.sh | 9 + luci-theme-carbon/tests/template-render.sh | 38 + .../tests/ucode-stubs/luci/core.uc | 3 + luci-theme-carbon/tests/update-integration.py | 220 ++ .../ucode/template/themes/carbon/footer.ut | 30 + .../ucode/template/themes/carbon/header.ut | 141 + 123 files changed, 26051 insertions(+) create mode 100644 luci-theme-carbon/.gitattributes create mode 100644 luci-theme-carbon/.gitignore create mode 100644 luci-theme-carbon/LICENSE create mode 100644 luci-theme-carbon/Makefile create mode 100644 luci-theme-carbon/README.md create mode 100644 luci-theme-carbon/README.zh-CN.md create mode 100644 luci-theme-carbon/docs/apk-install.md create mode 100644 luci-theme-carbon/docs/apk-signing.md create mode 100644 luci-theme-carbon/docs/online-update.md create mode 100644 luci-theme-carbon/docs/releases/install.md create mode 100644 luci-theme-carbon/docs/releases/v1.1.1.md create mode 100644 luci-theme-carbon/docs/releases/v1.1.2.md create mode 100644 luci-theme-carbon/docs/releases/v1.1.3.md create mode 100644 luci-theme-carbon/docs/releases/v1.1.4.md create mode 100644 luci-theme-carbon/docs/releases/v1.1.5.md create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/brands.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/carbon.css create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/carbon.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/de.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/es.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/fr.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/it.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/ja.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/ko.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/pt-br.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/ru.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/tr.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/vi.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/zh-cn.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/i18n/zh-tw.js create mode 100644 luci-theme-carbon/htdocs/luci-static/carbon/logo.svg create mode 100644 luci-theme-carbon/htdocs/luci-static/resources/carbon/markdown.js create mode 100644 luci-theme-carbon/htdocs/luci-static/resources/menu-carbon.js create mode 100644 luci-theme-carbon/htdocs/luci-static/resources/view/system/carbon-update.js create mode 100644 luci-theme-carbon/keys/SHA256SUMS create mode 100644 luci-theme-carbon/keys/carbon-apk.pem create mode 100644 luci-theme-carbon/package-lock.json create mode 100644 luci-theme-carbon/package.json create mode 100644 luci-theme-carbon/po/de/carbon.po create mode 100644 luci-theme-carbon/po/es/carbon.po create mode 100644 luci-theme-carbon/po/fr/carbon.po create mode 100644 luci-theme-carbon/po/it/carbon.po create mode 100644 luci-theme-carbon/po/ja/carbon.po create mode 100644 luci-theme-carbon/po/ko/carbon.po create mode 100644 luci-theme-carbon/po/pt_BR/carbon.po create mode 100644 luci-theme-carbon/po/ru/carbon.po create mode 100644 luci-theme-carbon/po/templates/carbon.pot create mode 100644 luci-theme-carbon/po/tr/carbon.po create mode 100644 luci-theme-carbon/po/vi/carbon.po create mode 120000 luci-theme-carbon/po/zh-cn create mode 100644 luci-theme-carbon/po/zh_Hans/carbon.po create mode 100644 luci-theme-carbon/po/zh_Hant/carbon.po create mode 100644 luci-theme-carbon/preview/demo.css create mode 100644 luci-theme-carbon/preview/demo.js create mode 100644 luci-theme-carbon/preview/form.html create mode 100644 luci-theme-carbon/preview/index.html create mode 100644 luci-theme-carbon/preview/lang.js create mode 100644 luci-theme-carbon/preview/login.html create mode 100644 luci-theme-carbon/preview/mock.js create mode 100755 luci-theme-carbon/root/etc/uci-defaults/30_luci-theme-carbon create mode 100644 luci-theme-carbon/root/lib/upgrade/keep.d/luci-theme-carbon create mode 100755 luci-theme-carbon/root/usr/libexec/rpcd/luci.carbon_update create mode 100644 luci-theme-carbon/root/usr/share/carbon/keys/carbon-apk.pem create mode 100644 luci-theme-carbon/root/usr/share/carbon/version create mode 100644 luci-theme-carbon/root/usr/share/luci/menu.d/luci-theme-carbon.json create mode 100644 luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon-update.json create mode 100644 luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon.json create mode 100644 luci-theme-carbon/scripts/build-css.py create mode 100644 luci-theme-carbon/scripts/build-demo.py create mode 100755 luci-theme-carbon/scripts/build-installer.sh create mode 100755 luci-theme-carbon/scripts/build-ipk.sh create mode 100644 luci-theme-carbon/scripts/check-version.sh create mode 100755 luci-theme-carbon/scripts/gen-brands.py create mode 100644 luci-theme-carbon/scripts/gen-i18n.py create mode 100755 luci-theme-carbon/scripts/installer-head.sh create mode 100644 luci-theme-carbon/scripts/minify.mjs create mode 100644 luci-theme-carbon/scripts/release-notes.sh create mode 100644 luci-theme-carbon/scripts/sign-apk.sh create mode 100644 luci-theme-carbon/styles/00-header.css create mode 100644 luci-theme-carbon/styles/01-tokens.css create mode 100644 luci-theme-carbon/styles/02-base.css create mode 100644 luci-theme-carbon/styles/03-shell.css create mode 100644 luci-theme-carbon/styles/04-login.css create mode 100644 luci-theme-carbon/styles/05-luci-structure.css create mode 100644 luci-theme-carbon/styles/06-forms.css create mode 100644 luci-theme-carbon/styles/07-buttons.css create mode 100644 luci-theme-carbon/styles/08-dropdown.css create mode 100644 luci-theme-carbon/styles/09-dynlist.css create mode 100644 luci-theme-carbon/styles/10-tabs.css create mode 100644 luci-theme-carbon/styles/11-tables.css create mode 100644 luci-theme-carbon/styles/12-alerts.css create mode 100644 luci-theme-carbon/styles/13-modals.css create mode 100644 luci-theme-carbon/styles/14-misc.css create mode 100644 luci-theme-carbon/styles/15-dashboard.css create mode 100644 luci-theme-carbon/styles/16-responsive.css create mode 100644 luci-theme-carbon/styles/17-update-page.css create mode 100644 luci-theme-carbon/styles/18-plugins.css create mode 100644 luci-theme-carbon/styles/19-print.css create mode 100644 luci-theme-carbon/tests/README.md create mode 100644 luci-theme-carbon/tests/apk-signing.sh create mode 100644 luci-theme-carbon/tests/browser/preview.test.js create mode 100644 luci-theme-carbon/tests/carbon.test.js create mode 100644 luci-theme-carbon/tests/fixtures/settings.html create mode 100644 luci-theme-carbon/tests/installer-integration.py create mode 100755 luci-theme-carbon/tests/installer-stubs/apk create mode 100755 luci-theme-carbon/tests/installer-stubs/opkg create mode 100755 luci-theme-carbon/tests/installer-stubs/uci create mode 100644 luci-theme-carbon/tests/installer.test.js create mode 100644 luci-theme-carbon/tests/make-update-fixtures.sh create mode 100644 luci-theme-carbon/tests/markdown.test.js create mode 100644 luci-theme-carbon/tests/menu-cache.test.js create mode 100644 luci-theme-carbon/tests/menu-carbon.test.js create mode 100644 luci-theme-carbon/tests/navigation.html create mode 100644 luci-theme-carbon/tests/opkg-update.py create mode 100644 luci-theme-carbon/tests/release-notes.test.js create mode 100644 luci-theme-carbon/tests/render-template.uc create mode 100644 luci-theme-carbon/tests/settings-backend.test.js create mode 100644 luci-theme-carbon/tests/shell-stubs/jshn.sh create mode 100644 luci-theme-carbon/tests/template-render.sh create mode 100644 luci-theme-carbon/tests/ucode-stubs/luci/core.uc create mode 100644 luci-theme-carbon/tests/update-integration.py create mode 100644 luci-theme-carbon/ucode/template/themes/carbon/footer.ut create mode 100644 luci-theme-carbon/ucode/template/themes/carbon/header.ut diff --git a/luci-theme-carbon/.gitattributes b/luci-theme-carbon/.gitattributes new file mode 100644 index 000000000..d7331a339 --- /dev/null +++ b/luci-theme-carbon/.gitattributes @@ -0,0 +1,9 @@ +# Public-key file checksums must stay identical across Windows and Linux. +Makefile text eol=lf +keys/*.pem text eol=lf +keys/SHA256SUMS text eol=lf +*.sh text eol=lf +root/usr/libexec/rpcd/* text eol=lf +root/etc/uci-defaults/* text eol=lf +root/usr/share/carbon/keys/*.pem text eol=lf +root/usr/share/carbon/version text eol=lf diff --git a/luci-theme-carbon/.gitignore b/luci-theme-carbon/.gitignore new file mode 100644 index 000000000..7014bee41 --- /dev/null +++ b/luci-theme-carbon/.gitignore @@ -0,0 +1,13 @@ +# build output +dist/ +.cache/ +.private/ +*.private.pem +__pycache__/ + +# OS / editor +.DS_Store +*.swp +.idea/ +.vscode/ +node_modules/ diff --git a/luci-theme-carbon/LICENSE b/luci-theme-carbon/LICENSE new file mode 100644 index 000000000..57bc88a15 --- /dev/null +++ b/luci-theme-carbon/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/luci-theme-carbon/Makefile b/luci-theme-carbon/Makefile new file mode 100644 index 000000000..5a68e75c4 --- /dev/null +++ b/luci-theme-carbon/Makefile @@ -0,0 +1,43 @@ +# +# Carbon — an Apple-style LuCI theme for everyday users +# Licensed under the Apache License, Version 2.0 +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Carbon Theme (Apple-style, beginner friendly) +LUCI_DEPENDS:=+luci-base +curl +ca-bundle +flock +LUCI_PKGARCH:=all + +PKG_VERSION:=1.1.5 +PKG_RELEASE:=1 +PKG_LICENSE:=Apache-2.0 + +# Keep modern CSS/JS intact (csstidy/jsmin do not understand +# backdrop-filter, color-mix() or template literals). +CONFIG_LUCI_CSSTIDY:= +CONFIG_LUCI_JSMIN:= + +define Package/luci-theme-carbon/postrm +#!/bin/sh +if [ "$${PKG_UPGRADE}" = 1 ] || [ "$$1" = upgrade ]; then exit 0; fi +[ -n "$${IPKG_INSTROOT}" ] || { + uci -q delete luci.themes.Carbon + if [ "$$(uci -q get luci.main.mediaurlbase)" = "/luci-static/carbon" ]; then + if [ -d /www/luci-static/bootstrap ]; then + uci set luci.main.mediaurlbase=/luci-static/bootstrap + else + uci -q delete luci.main.mediaurlbase + fi + fi + uci commit luci + rm -f /etc/config/carbon + rm -rf /www/luci-static/carbon/custom + rmdir /www/luci-static/carbon 2>/dev/null +} +exit 0 +endef + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-theme-carbon/README.md b/luci-theme-carbon/README.md new file mode 100644 index 000000000..01cf2bc23 --- /dev/null +++ b/luci-theme-carbon/README.md @@ -0,0 +1,186 @@ +
+ +Carbon + +# luci-theme-carbon + +A clean, glass-style LuCI theme for OpenWrt — built for everyday users. + +**English** · [简体中文](README.zh-CN.md) + +[![Build](https://github.com/mrjoechen/luci-theme-carbon/actions/workflows/build.yml/badge.svg)](https://github.com/mrjoechen/luci-theme-carbon/actions/workflows/build.yml) +[![Release](https://img.shields.io/github/v/release/mrjoechen/luci-theme-carbon)](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) +[![License](https://img.shields.io/github/license/mrjoechen/luci-theme-carbon)](LICENSE) +[![Download](https://img.shields.io/github/downloads/mrjoechen/luci-theme-carbon/total?style=flat)](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) +[![Star](https://img.shields.io/github/stars/mrjoechen/luci-theme-carbon)](https://github.com/mrjoechen/ShowcaseApp/stargazers) + + +**[Live demo](https://mrjoechen.github.io/luci-theme-carbon/) · [English demo](https://mrjoechen.github.io/luci-theme-carbon/?lang=en)** + +
+ +## Screenshots + + +

Light

+ +

Dark

+ +## Features + +- **Dashboard** on *Status → Overview*: live traffic chart for any interface, CPU / memory / storage rings, memory breakdown, load sparkline, connection count, uptime, temperature sensors (thermal zones and hwmon), WAN IPv4/IPv6, connected devices and interface status. LuCI's original status widgets are kept behind *Show detailed status* and stop polling while collapsed. +- **Discovered devices** — DHCPv4/v6 leases, Wi‑Fi stations (band and signal) and IPv4 ARP neighbours are merged by MAC. Discovery still works with the local DHCP server disabled, including when LAN obtains its own address by DHCP. Gateways, neighbour entries and DHCP leases are labelled separately; a missing local lease does not imply a fixed IP. Devices are recognised by hostname and MAC vendor prefix (35 brands, ~9,200 IEEE OUI prefixes). The count includes devices known to this router, possibly offline ones, and is not a live census of the entire network. Recognisable separate uplinks are excluded; a gateway sharing LAN is retained and labelled. Without an interface named `lan`, custom interface roles may be ambiguous, so discoveries on those interfaces are retained. +- **Simple / Pro navigation** — *Simple* shows only the pages most people need (overview, internet, Wi‑Fi, software, password, backup, reboot); *Pro* shows the full LuCI menu with an icon for every page. +- **Frosted-glass sidebar** that collapses into an icon rail (button on the sidebar edge or Ctrl/⌘ + \\); hovering a rail icon opens its sub-menu. +- **Light / dark / auto** theme switch (top-right) and a **language switch** (bottom-left) for every installed LuCI language. Theme strings ship in English, Simplified and Traditional Chinese, German, Spanish, French, Italian, Japanese, Korean, Brazilian Portuguese, Russian, Turkish and Vietnamese; more can be added as gettext files in `po/`. +- **Keyboard and touch friendly** — arrow keys in segmented controls, a focus-managed phone drawer, and rail sub-menus that open with a tap, Enter or →. +- **Mobile friendly** — drawer navigation and tables that reflow into cards. +- **Custom logo** — upload a PNG, JPEG, WebP, GIF or SVG in *System → Carbon Theme Settings*. It replaces the sidebar, login, overview and browser-tab logo, and is kept across theme and firmware upgrades. SVGs with scripts or embedded content are rejected. +- **Online updates** — check and install stable releases from *System → Carbon Theme Settings*, optionally through an HTTPS download mirror. APK signatures remain verified; download size and SHA-256 are checked against GitHub before installation. +- Existing LuCI pages and plugins keep working; +- Architecture independent: one theme package for every router. + +## Installation & Usage + +### Compatibility + +| Firmware | Package manager | Package | +|---|---|---| +| OpenWrt / ImmortalWrt 23.05, 24.10 | opkg | `.ipk` or install script | +| OpenWrt / ImmortalWrt 25.x, snapshot | apk | `.apk` or install script | + +Requires the ucode-based LuCI (23.05 or newer). + +All files are on the [Releases](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) page. + +### Option 1 — install script (any firmware) + +Run on the router (SSH): + +```bash +wget -O /tmp/carbon-install.sh https://github.com/mrjoechen/luci-theme-carbon/releases/latest/download/carbon-install.sh && sh /tmp/carbon-install.sh +``` + +The script embeds the release's signed `.apk`, its `.ipk` and Carbon's public key, and installs through the system package manager — so online updates work and **no key import is needed**. The APK signature is checked with the embedded key in a private key directory; `/etc/apk/keys` is left alone. Missing dependencies (`curl`, `ca-bundle`, `flock`) come from your firmware's feeds. Options: + +| Command | Effect | +|---|---| +| `sh carbon-install.sh --trust-key` | also add Carbon's key to `/etc/apk/keys`, so later LuCI uploads of Carbon APKs work | +| `sh carbon-install.sh --files` | only copy files (no package record, no online updates) | + +Running the script again upgrades in place, and turns an older script-only install into a registered package. If a native install is impossible (for example offline with missing dependencies), it falls back to copying files and says so. + +If the router has no internet access, download `carbon-install.sh` on your computer and copy it over (`-O` is needed because OpenWrt's SSH server has no SFTP): + +```bash +scp -O carbon-install.sh root@192.168.1.1:/tmp/ +``` + +```bash +ssh root@192.168.1.1 "sh /tmp/carbon-install.sh" +``` + +### Option 2 — opkg (`.ipk`, 23.05 / 24.10) + +Upload `luci-theme-carbon_*_all.ipk` in *System → Software → Upload Package*, or: + +```bash +opkg install /tmp/luci-theme-carbon_*_all.ipk +``` + +### Option 3 — apk (`.apk`, 25.x / snapshot) + +**v1.0.1 and newer Release APKs are signed.** Import `carbon-apk.pem` once per device, then install or upgrade directly in LuCI: + +1. Download the public key and APK from [Releases](https://github.com/mrjoechen/luci-theme-carbon/releases/latest). +2. In Pro mode, open **System → Administration → Repo Public Keys**, paste the full public key and click **Add key** (if your firmware provides this page). +3. Open **System → Software → Upload Package**, upload the APK and install. + +Older LuCI needs a one-time SSH key import. See [APK configuration and troubleshooting](docs/apk-install.md) for the verified key fingerprint, commands and preserving the key across firmware upgrades. The old v1.0.0 APK is unsigned; download a new version. Repository `wget` / `packages.adb` errors are separate network/feed problems and still need fixing for reliable web installs. + +### After installing + +Carbon becomes the default theme. Refresh the page, then **log out and log in once** so the dashboard gets its read-only permissions. Switch themes any time in *System → System → Language and Style*. + +### Usage + +| What | Where | +|---|---| +| Simple / Pro menu | segmented control at the top of the sidebar | +| Collapse sidebar | round button on the sidebar edge, or Ctrl/⌘ + \\ | +| Light / dark / auto | top-right of the toolbar | +| Language | bottom-left of the sidebar (changes LuCI's language, same as *System → Language*; a list when more than two are installed) | +| Live traffic interface | picker in the *Live Traffic* card: *Auto* follows the WAN; any interface or network device (e.g. an xPON port such as `pon0` that also carries IPTV) can be picked, remembered per browser | +| Check and install theme updates | System → Carbon Theme Settings (Simple and Pro modes) | +| Custom logo | System → Carbon Theme Settings → Logo (*Restore default* undoes it) | +| LuCI's original status page | *Show detailed status* under the dashboard | + +### Online upgrades (v1.1.0+) + +Install v1.1.0 or newer through the native package manager once. Open **System → Carbon Theme Settings** (**Carbon Update** in v1.1.0), click **Check for updates**, then **Install update** and confirm. The page shows release notes, progress and installation logs; refreshing it resumes monitoring. Theme preferences and router configuration are retained. Same-version installs, downgrades and expired update requests are rejected. + +APK updates verify the bundled Carbon public key, then use APK's normal signature verification again during installation. They use already-installed dependencies without fetching firmware indexes. This does not change `/etc/apk/keys`; standard LuCI package uploads still need the one-time key import above. IPK updates use HTTPS plus the release asset's SHA-256 and size checks. Update checks need router access to GitHub and correct system time. See [online update details](docs/online-update.md). + +If GitHub downloads are slow or blocked, enter an HTTPS **Download mirror** prefix on the same page. Only the package bytes use the mirror; version, size and SHA-256 still come from GitHub, and the updater falls back to GitHub if the mirror fails. + +Required packages: `curl`, `ca-bundle`, `flock` (installed as native package dependencies). Installs made with `--files` or with installers before v1.1.3 are not registered with apk/opkg; run the current `carbon-install.sh` once to enable online updates. + +### Uninstall + +```bash +sh /tmp/carbon-install.sh uninstall +``` + +or remove the package with `opkg remove luci-theme-carbon` / `apk del luci-theme-carbon`. The previous theme is restored automatically. + +## Build from source + +**Without the SDK** (produces the install script and an `.ipk`): + +```bash +sh scripts/build-installer.sh +``` + +```bash +sh scripts/build-ipk.sh +``` + +**With the OpenWrt SDK**: put this directory under `package/` and run `make package/luci-theme-carbon/compile`. + +**APK signing**: raw SDK APKs are unsigned. See [signing setup and validation](docs/apk-signing.md) for local signing and the `APK_SIGNING_KEY` Actions secret required for releases. + +**Brand data** (`brands.js`) is regenerated with `python3 -I scripts/gen-brands.py`. + +### Development + +| Source | Generated | Command | +|---|---|---| +| `styles/NN-*.css` (one file per section) | `htdocs/luci-static/carbon/carbon.css` | `python3 -I scripts/build-css.py` | +| `po//carbon.po` (gettext) | `po/templates/carbon.pot`, `htdocs/luci-static/carbon/i18n/.js` | `python3 -I scripts/gen-i18n.py` | +| `Makefile` `PKG_VERSION` / `PKG_RELEASE` | `root/usr/share/carbon/version` (keep in sync) | `sh scripts/check-version.sh` | + +Generated files are committed so every install path works without a build step; CI fails if they are stale (`--check`). The version file is the only version source: the theme template appends it to asset URLs and `carbon.js` reads it from there. + +To add a language, create `po//carbon.po` (copy the template), translate it and run `gen-i18n.py`. The SDK also builds it into a `luci-i18n-carbon-` package. + +Release notes: write `docs/releases/vX.Y.Z.md` (copy the layout of the previous one) with a `## English` and a `## 简体中文` section. The release job (`scripts/release-notes.sh`) appends the matching section of `docs/releases/install.md` to each, so every language reads through once. + +Release packages ship minified CSS/JS (`node scripts/minify.mjs`, run by CI on a disposable checkout). Tests: + +```bash +npm ci && npm test +``` + +```bash +npx playwright install chromium && npm run test:browser +``` + +See [tests/README.md](tests/README.md) for the Docker-based updater and template tests. + +## Notices + +- Brand glyphs: [Simple Icons](https://simpleicons.org) (CC0 1.0). All trademarks belong to their respective owners. +- MAC vendor prefixes: IEEE Registration Authority MA-L registry. +- Widget behaviour follows the official `luci-theme-bootstrap`. + +Licensed under [Apache License 2.0](LICENSE). diff --git a/luci-theme-carbon/README.zh-CN.md b/luci-theme-carbon/README.zh-CN.md new file mode 100644 index 000000000..369bc654d --- /dev/null +++ b/luci-theme-carbon/README.zh-CN.md @@ -0,0 +1,184 @@ +
+ +Carbon + +# luci-theme-carbon + +简洁的毛玻璃风格 OpenWrt LuCI 主题,为每一个人设计。 + +[English](README.md) · **简体中文** + +[![Build](https://github.com/mrjoechen/luci-theme-carbon/actions/workflows/build.yml/badge.svg)](https://github.com/mrjoechen/luci-theme-carbon/actions/workflows/build.yml) +[![Release](https://img.shields.io/github/v/release/mrjoechen/luci-theme-carbon)](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) +[![License](https://img.shields.io/github/license/mrjoechen/luci-theme-carbon)](LICENSE) +[![Download](https://img.shields.io/github/downloads/mrjoechen/luci-theme-carbon/total?style=flat)](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) +[![Star](https://img.shields.io/github/stars/mrjoechen/luci-theme-carbon)](https://github.com/mrjoechen/ShowcaseApp/stargazers) + +**[在线演示](https://mrjoechen.github.io/luci-theme-carbon/) · [English demo](https://mrjoechen.github.io/luci-theme-carbon/?lang=en)** + +
+ +## 界面预览 + +

浅色

+ +

深色

+ +## 功能 + +- **仪表盘**(状态 → 概览):可选接口的实时流量图、CPU / 内存 / 存储圆环、内存构成条、负载迷你图、连接数、运行时间、温度传感器(热区与 hwmon)、外网 IPv4/IPv6、已发现设备和网络接口状态。LuCI 原有的状态信息保留在「显示详细状态」里,收起时停止轮询。 +- **已发现设备**:合并 DHCPv4/v6 租约、Wi‑Fi 关联列表(频段和信号)与 IPv4 ARP 邻居,按 MAC 去重。关闭本机 DHCP 服务后,仍可发现邻居和 Wi‑Fi 设备;LAN 自身通过 DHCP 获取地址也受支持。列表区分网关、邻居记录和 DHCP 租约,不把缺少本机租约的设备标为固定 IP;根据主机名和 MAC 厂商前缀识别品牌(35 个品牌,约 9200 条 IEEE OUI 前缀)。数量表示本机已发现的设备,可能包含离线设备,不代表全网实时在线数。自动排除可识别的独立上联接口;共用 LAN 的网关保留并标注。没有名为 `lan` 的接口时,自定义接口的角色可能无法判定,会保留不确定接口的发现结果。 +- **简洁 / 专业双模式**:简洁模式只显示常用功能(概览、上网、Wi‑Fi、软件包、密码、备份、重启);专业模式显示完整 LuCI 菜单,每个页面都有对应图标。 +- **毛玻璃侧栏**,可收起为只显示图标的窄栏(点侧栏边缘的圆形按钮,或按 Ctrl/⌘ + \\),鼠标悬停图标弹出子菜单。 +- 右上角切换**浅色 / 深色 / 跟随系统**,左下角**切换语言**(列出所有已安装的 LuCI 语言)。主题文案内置英文、简体中文、繁体中文、德语、西班牙语、法语、意大利语、日语、韩语、巴西葡萄牙语、俄语、土耳其语和越南语,其他语言可在 `po/` 中以 gettext 文件补充。 +- **键盘与触屏友好**:分段按钮支持方向键,手机抽屉菜单管理焦点,收起的侧栏可点按、Enter 或 → 打开子菜单。 +- **适配手机**:侧栏变为抽屉,表格自动变成卡片。 +- **自定义 Logo**:在「系统 → Carbon 主题」上传 PNG、JPEG、WebP、GIF 或 SVG,替换侧栏、登录页、概览页和浏览器标签上的 Logo;主题升级和保留配置的固件升级后仍然保留。含脚本或嵌入内容的 SVG 会被拒绝。 +- **网页在线升级**:在「系统 → Carbon 主题」检查并安装稳定版,可选 HTTPS 下载镜像;APK 保留签名校验,安装前按 GitHub 公布的信息核对文件大小和 SHA-256。 +- 所有 LuCI 页面和插件照常使用;更新器仅安装 Carbon 主题包。 +- 与架构无关,所有路由器通用一个主题包。 + +## 安装与使用 + +### 兼容性 + +| 固件 | 包管理器 | 安装包 | +|---|---|---| +| OpenWrt / ImmortalWrt 23.05、24.10 | opkg | `.ipk` 或安装脚本 | +| OpenWrt / ImmortalWrt 25.x、snapshot | apk | `.apk` 或安装脚本 | + +需要 ucode 版 LuCI(23.05 及以后)。 + +所有文件都在 [Releases](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) 页面。 + +### 方式一:安装脚本(所有固件通用) + +在路由器上执行(SSH 登录后): + +```bash +wget -O /tmp/carbon-install.sh https://github.com/mrjoechen/luci-theme-carbon/releases/latest/download/carbon-install.sh && sh /tmp/carbon-install.sh +``` + +脚本内置当前 Release 的已签名 `.apk`、`.ipk` 和 Carbon 公钥,通过系统包管理器安装,因此在线升级可用,**无需手动导入公钥**。APK 签名用内置公钥在独立目录中校验,不修改 `/etc/apk/keys`。缺少的依赖(`curl`、`ca-bundle`、`flock`)从固件自带软件源安装。可选参数: + +| 命令 | 作用 | +|---|---| +| `sh carbon-install.sh --trust-key` | 同时把 Carbon 公钥加入 `/etc/apk/keys`,之后可在 LuCI 直接上传 Carbon 的 APK | +| `sh carbon-install.sh --files` | 只复制文件(不登记到包管理器,无法在线升级) | + +再次运行脚本即可原地升级,也会把旧版脚本安装的主题转为包管理器登记的安装。无法通过包管理器安装时(例如离线且缺少依赖),会自动改为复制文件并给出提示。 + +如果路由器不能上网,先在电脑上下载 `carbon-install.sh` 再传过去(`-O` 不能省,OpenWrt 的 SSH 服务没有 SFTP): + +```bash +scp -O carbon-install.sh root@192.168.1.1:/tmp/ +``` + +```bash +ssh root@192.168.1.1 "sh /tmp/carbon-install.sh" +``` + +### 方式二:opkg(`.ipk`,23.05 / 24.10) + +在「系统 → 软件包 → 上传软件包」上传 `luci-theme-carbon_*_all.ipk`,或执行: + +```bash +opkg install /tmp/luci-theme-carbon_*_all.ipk +``` + +### 方式三:apk(`.apk`,25.x / snapshot) + +**从 v1.0.1 开始,Release 中的 APK 已签名。** 每台设备只需导入一次 `carbon-apk.pem`,后续直接通过 LuCI 上传安装或升级: + +1. 从 [Releases](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) 下载公钥和 APK。 +2. 切换到专业模式,在 **系统 → 管理权 → 软件源公钥(Repo Public Keys)** 中粘贴完整公钥并添加(需固件提供此页面)。 +3. 在 **系统 → 软件包 → 上传软件包** 中上传 APK 并安装。 + +旧版 LuCI 没有公钥管理页时,只需一次 SSH 导入。公钥指纹、导入命令、刷机保留配置及排错见 [APK 配置说明](docs/apk-install.md)。旧 v1.0.0 APK 未签名,请重新下载新版。`wget` / `packages.adb` 报错属于独立的软件源或网络问题,要稳定通过网页安装仍需修复软件源。 + +### 安装之后 + +Carbon 会自动设为默认主题。刷新页面,然后**退出并重新登录一次**,仪表盘才能读取 CPU、连接数等数据。随时可以在「系统 → 系统 → 语言和界面」切换回其他主题。 + +### 使用 + +| 功能 | 位置 | +|---|---| +| 简洁 / 专业菜单 | 侧栏顶部的分段按钮 | +| 收起侧栏 | 侧栏边缘的圆形按钮,或 Ctrl/⌘ + \\ | +| 浅色 / 深色 / 自动 | 工具栏右上角 | +| 语言 | 侧栏左下角(修改的是 LuCI 的界面语言,等同「系统 → 语言」;安装超过两种语言时显示下拉框) | +| 实时流量统计接口 | 「实时流量」卡片右上角的选择框:「自动」跟随 WAN;也可选任意接口或网络设备(如同时承载 IPTV 的光口 `pon0`),按浏览器记住 | +| 检查更新与一键升级 | 系统 → Carbon 主题(简洁、专业模式均可见) | +| 自定义 Logo | 系统 → Carbon 主题 → Logo(「恢复默认」可撤销) | +| LuCI 原版状态页 | 仪表盘下方「显示详细状态」 | + +### 网页在线升级(v1.1.0 起) + +首次通过系统包管理器安装 v1.1.0 或更新版本,然后打开 **系统 → Carbon 主题**(v1.1.0 中名为「Carbon 更新」),点击「检查更新」,再点击「一键升级」并确认。页面显示更新说明、后台进度和安装日志;刷新页面后可继续查看进度。主题偏好与路由器配置会保留,不允许同版本重复安装、降级或使用过期的更新信息。 + +APK 在线更新先使用包内固定的 Carbon 公钥验证,再由 APK 包管理器验签安装;使用已安装依赖,不读取固件软件源索引。此过程不修改 `/etc/apk/keys`,LuCI 标准「上传软件包」仍需前面的一次性公钥导入。IPK 更新通过 HTTPS 下载并核对发布附件的 SHA-256 与大小。检查更新需要路由器能访问 GitHub,且系统时间正确。详见 [在线升级说明](docs/online-update.md)。 + +GitHub 下载缓慢或无法访问时,可在同一页面填写 HTTPS **下载镜像**前缀。镜像只用于下载安装包,版本、大小和 SHA-256 仍以 GitHub 为准;镜像失败时自动改用 GitHub。 + +依赖 `curl`、`ca-bundle`、`flock`,使用原生包安装时自动处理。使用 `--files` 或 v1.1.3 之前的安装脚本安装的主题没有登记到 apk/opkg,重新运行一次当前的 `carbon-install.sh` 即可启用在线升级。 + +### 卸载 + +```bash +sh /tmp/carbon-install.sh uninstall +``` + +或使用 `opkg remove luci-theme-carbon` / `apk del luci-theme-carbon`。卸载后会自动切回原来的主题。 + +## 自行构建 + +**不需要 SDK**(生成安装脚本和 `.ipk`): + +```bash +sh scripts/build-installer.sh +``` + +```bash +sh scripts/build-ipk.sh +``` + +**使用 OpenWrt SDK**:把本目录放到 SDK 的 `package/` 下,执行 `make package/luci-theme-carbon/compile`。 + +**APK 签名**:SDK 原始 APK 未签名;本地签名方法、验证步骤和发布所需的 `APK_SIGNING_KEY` Actions Secret 见 [签名构建说明](docs/apk-signing.md)。 + +**品牌数据**(`brands.js`)可用 `python3 -I scripts/gen-brands.py` 重新生成。 + +### 开发 + +| 源文件 | 生成文件 | 命令 | +|---|---|---| +| `styles/NN-*.css`(每个章节一个文件) | `htdocs/luci-static/carbon/carbon.css` | `python3 -I scripts/build-css.py` | +| `po/<语言>/carbon.po`(gettext) | `po/templates/carbon.pot`、`htdocs/luci-static/carbon/i18n/<语言>.js` | `python3 -I scripts/gen-i18n.py` | +| `Makefile` 的 `PKG_VERSION` / `PKG_RELEASE` | `root/usr/share/carbon/version`(保持一致) | `sh scripts/check-version.sh` | + +生成文件随仓库提交,各种安装方式都无需构建步骤;文件过期时 CI(`--check`)会失败。version 文件是唯一的版本来源:主题模板把它加到资源链接上,`carbon.js` 从链接中读取。 + +新增语言:复制模板为 `po/<语言>/carbon.po`,翻译后运行 `gen-i18n.py`。使用 SDK 构建时还会生成 `luci-i18n-carbon-<语言>` 语言包。 + +发布说明:编写 `docs/releases/vX.Y.Z.md`(参照上一版的格式),文件中分为 `## English` 和 `## 简体中文` 两节。发布任务(`scripts/release-notes.sh`)会把 `docs/releases/install.md` 中对应语言的安装说明接在各自一节后面,每种语言从头到尾连续阅读。 + +发布包中的 CSS/JS 会被压缩(`node scripts/minify.mjs`,由 CI 在临时检出目录中执行)。测试: + +```bash +npm ci && npm test +``` + +```bash +npx playwright install chromium && npm run test:browser +``` + +基于 Docker 的更新器和模板测试见 [tests/README.md](tests/README.md)。 + +## 声明 + +- 品牌图标:[Simple Icons](https://simpleicons.org)(CC0 1.0),所有商标归各自所有者。 +- MAC 厂商前缀:IEEE Registration Authority MA-L 注册表。 +- 组件行为参照官方 `luci-theme-bootstrap`。 + +本项目采用 [Apache License 2.0](LICENSE) 许可。 diff --git a/luci-theme-carbon/docs/apk-install.md b/luci-theme-carbon/docs/apk-install.md new file mode 100644 index 000000000..3b8549a56 --- /dev/null +++ b/luci-theme-carbon/docs/apk-install.md @@ -0,0 +1,70 @@ +# APK 安装 / APK installation + +## 中文 + +从 **v1.0.1** 开始,Release 中的 APK 使用 Carbon 固定公钥对应的私钥签名。每台设备只需导入一次公钥,后续可以直接通过 LuCI 上传安装或升级,无需每次 SSH。v1.0.0 的旧 APK 未签名,导入公钥后也不能直接上传安装,请重新下载新版。 + +> **最简单的方式:** 使用 Release 中的 `carbon-install.sh`。它内置签名 APK 和公钥,在独立的密钥目录中验签后通过 apk 安装,无需导入公钥,在线升级也可用。加 `--trust-key` 参数时会同时把公钥加入 `/etc/apk/keys`。下面的步骤用于在 LuCI 中手动上传 APK。 + +### 首次配置:优先通过网页导入公钥 + +1. 从 [Release](https://github.com/mrjoechen/luci-theme-carbon/releases/latest) 下载 `carbon-apk.pem` 和 `luci-theme-carbon-*.apk`。公钥也保存在仓库的 `keys/carbon-apk.pem`。 +2. 切到 Carbon「专业」模式,在 **系统 → 管理权(Administration)→ 软件源公钥(Repo Public Keys)** 中,粘贴公钥文件的完整内容并点击「添加密钥」。有些版本也支持拖入公钥文件。此页面与 SSH 公钥页面不同。 +3. 在 **系统 → 软件包 → 上传软件包** 中上传新版 `.apk` 并安装。重复安装相同版本时,如界面提供「重新安装」选项,可勾选它。 +4. 刷新页面。首次安装更新器时,退出并重新登录 LuCI,使新增 RPC 权限生效;已有 v1.1.x 升级到 v1.1.2 或更新版本,只需刷新,无需退出。 + +菜单名称取决于固件翻译;较旧的 LuCI 可能没有公钥管理页。这种情况使用下面的一次性 SSH 配置,之后仍通过网页上传 APK。 + +### 旧版 LuCI:一次性 SSH 配置 + +下面命令先下载到临时目录,核对公钥文件的 SHA-256,再加入信任目录;不修改固件自带密钥,也不关闭签名校验。 + +```sh +( + set -eu + key=/tmp/carbon-apk.pem + wget -O "$key" https://github.com/mrjoechen/luci-theme-carbon/releases/download/v1.0.1/carbon-apk.pem + printf '%s %s\n' c5187568040b024559e6dddbd752c4661455b0ccfb94a66b013f05eb28ef9a0b "$key" | sha256sum -c - + mkdir -p /etc/apk/keys + cp "$key" /etc/apk/keys/carbon-apk.pem + chmod 644 /etc/apk/keys/carbon-apk.pem +) +``` + +路由器无法下载时,在电脑下载公钥后,用 SCP(例如 `scp -O carbon-apk.pem root@192.168.1.1:/tmp/`)传到 `/tmp`,跳过上面的 `wget`,继续校验和复制。公钥文件 SHA-256: + +```text +c5187568040b024559e6dddbd752c4661455b0ccfb94a66b013f05eb28ef9a0b +``` + +固件升级时需要保留此公钥。可在 **系统 → 备份/升级 → 配置** 的保留文件列表加入 `/etc/apk/keys/carbon-apk.pem`;恢复出厂设置或不保留配置刷机后重新导入。卸载主题不会移除手动导入的公钥。不再信任本项目时,删除这一个公钥文件即可;不要删除官方密钥。APK 的信任是按密钥而不是按包名授权,请仅从本项目获取公钥和发布包。 + +### 排错 + +- **`UNTRUSTED signature`**:确认上传的是 v1.0.1 或更新 Release 的 APK,且已导入匹配的公钥。SDK 原始构建产物、Actions 的 `sdk-*` 临时产物以及旧 v1.0.0 APK 不带正式发布签名。必要时用 `apk verify /tmp/upload.apk` 检查(LuCI 安装结束可能已清理上传文件)。 +- **`wget: exited with error 4` / `packages.adb: unexpected end of file`**:这是固件软件源索引下载失败,与 Carbon 签名无关。先在软件包页面尝试「更新列表」,检查路由器时间、DNS、WAN 和 HTTPS 连通性,以及软件源与当前 ImmortalWrt/OpenWrt 版本、target、架构是否匹配。不要混用两个发行版的软件源,也不要随意切到其它 snapshot 或发行版来解决依赖。签名修复不会修复软件源连接。 +- **离线安装**:依赖已经安装时,可用 `apk add --repositories-file /dev/null /tmp/luci-theme-carbon-1.0.1-r1.apk` 跳过软件源,仅校验本地包。它仍验证签名,不需要 `--allow-untrusted`。标准 LuCI 上传流程没有通用的“忽略所有软件源”开关;要持续使用网页安装,应修复软件源问题。 +- **`Read-only file system`**:系统根目录必须可写。这是容器或存储配置问题,与包签名不同。 + +## English + +The simplest route is the release's `carbon-install.sh`: it embeds the signed APK and the public key, verifies the APK in a private key directory and installs it with apk — no key import needed, and online updates work. `--trust-key` additionally adds the key to `/etc/apk/keys`. The steps below are for manual LuCI uploads. + +Release APKs are individually signed starting with **v1.0.1**. Import the Carbon public key once per device; subsequent installs and upgrades can use LuCI's package upload. The old v1.0.0 APK is unsigned and must be replaced with a new download. + +1. Download `carbon-apk.pem` and the APK from [Releases](https://github.com/mrjoechen/luci-theme-carbon/releases/latest). +2. In Carbon's **Pro** mode, open **System → Administration → Repo Public Keys** if your firmware provides it. Paste the full public key and click **Add key**. This is separate from SSH authorized keys. +3. Open **System → Software → Upload Package**, select the APK and install. Select reinstall if the interface offers it when installing the same version again. +4. Refresh and log out/back in. + +Older LuCI versions need a one-time SSH import: use the shell block above, which verifies the public PEM's SHA-256 before copying it to `/etc/apk/keys/carbon-apk.pem`. If the router cannot download the key, copy it from your computer to `/tmp/carbon-apk.pem` and skip `wget`. No global signature bypass is needed. + +Add `/etc/apk/keys/carbon-apk.pem` to the backup file list in **System → Backup / Flash Firmware → Configuration** to retain it across upgrades. Re-import after a factory reset or an upgrade without preserved settings. Removing the theme does not remove this manually imported key. Delete only this key to revoke trust; preserve official keys. A trusted APK key is not restricted to a particular package name. + +`UNTRUSTED signature` means the key is absent/mismatched, the file is an old unsigned release, or it is a raw SDK/Actions artifact. Use signed **Release assets**. `wget` / truncated `packages.adb` warnings are separate firmware repository download failures: check time, DNS, WAN, HTTPS, and firmware/target/architecture compatibility. Do not mix OpenWrt and ImmortalWrt feeds. If dependencies are already installed, the offline command above skips feeds while retaining signature verification; standard LuCI uploads still need working feed configuration. A read-only root filesystem must also be fixed separately. + +## References + +- [LuCI public-key management](https://github.com/openwrt/luci/blob/master/modules/luci-mod-system/htdocs/luci-static/resources/view/system/repokeys.js) +- [APK v3 signing](https://github.com/alpinelinux/apk-tools/blob/master/doc/apk-adbsign.8.scd) +- [APK trust directories and repository options](https://github.com/alpinelinux/apk-tools/blob/master/doc/apk.8.scd) diff --git a/luci-theme-carbon/docs/apk-signing.md b/luci-theme-carbon/docs/apk-signing.md new file mode 100644 index 000000000..b694f2880 --- /dev/null +++ b/luci-theme-carbon/docs/apk-signing.md @@ -0,0 +1,44 @@ +# Building signed APK releases + +The SDK creates the APK; the release job then signs the **individual APK**, verifies it using only `keys/carbon-apk.pem`, and publishes it together with the public key, installation guide and `SHA256SUMS`. Signing only a repository index is insufficient for LuCI's local package upload. + +## Maintainer setup + +The production private key belongs in the repository's GitHub Actions secret **`APK_SIGNING_KEY`** (complete PEM content). It must match `keys/carbon-apk.pem`. Keep an encrypted backup outside the repository; `.private/` and `*.private.pem` are ignored as an extra precaution. Never commit the private key, print it in CI, or include it in artifacts. Ordinary builds and pull requests do not receive it. A release fails if the secret is missing or verification fails. + +The existing project key is persistent: **do not generate a new key for each release**. Fork maintainers should generate their own key pair, replace the public key and its checksum, and update the installation guide's fingerprint and download URLs: + +```sh +umask 077 +mkdir -p .private keys +# For a NEW project/fork only. Do not overwrite an existing production key. +test ! -e .private/carbon-apk.private.pem && +openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out .private/carbon-apk.private.pem +openssl pkey -in .private/carbon-apk.private.pem -pubout -out keys/carbon-apk.pem +(cd keys && sha256sum carbon-apk.pem > SHA256SUMS) +``` + +Configure `APK_SIGNING_KEY` in **Settings → Secrets and variables → Actions**. With an authenticated GitHub CLI, the file can be supplied through stdin without printing it: + +```sh +gh secret set APK_SIGNING_KEY < .private/carbon-apk.private.pem +``` + +After the secret is configured, push a version tag matching `PKG_VERSION`. The release job uses a pinned Alpine image with apk-tools 3, no container network, an ephemeral private-key file and a separate public-key trust directory. The private-key file is removed on exit. Only signed APKs enter the Release; `sdk-*` build artifacts remain unsigned development outputs. Existing published releases are not silently replaced. + +## Local signing and validation + +On a system with apk-tools 3: + +```sh +sh scripts/sign-apk.sh .private/carbon-apk.private.pem keys/carbon-apk.pem dist/*.apk +apk --keys-dir keys verify dist/*.apk +``` + +The integration test needs apk-tools 3, OpenSSL and an unsigned SDK package. It creates disposable keys and checks rejection of unsigned packages, missing/mismatched keys, untrusted keys and damaged payloads, plus successful verification after signing: + +```sh +sh tests/apk-signing.sh path/to/unsigned-sdk-package.apk +``` + +User setup: [APK installation](apk-install.md). If rotating a lost or compromised key, publish the new fingerprint and explicit import/revocation instructions; devices trusting the old key will not automatically trust the new one. diff --git a/luci-theme-carbon/docs/online-update.md b/luci-theme-carbon/docs/online-update.md new file mode 100644 index 000000000..c98ccb6cc --- /dev/null +++ b/luci-theme-carbon/docs/online-update.md @@ -0,0 +1,68 @@ +# Carbon online updates / 网页在线升级 + +## 使用 + +1. 首次手动安装 v1.1.0 或更新的原生 APK/IPK 包,退出并重新登录 LuCI,使新增 RPC 权限生效。 +2. 打开「系统 → Carbon 主题」(v1.1.0 中名为「Carbon 更新」)。简洁和专业模式都有入口。 +3. 点击「检查更新」,查看当前版本、最新稳定版和更新说明。 +4. 点击「一键升级」,确认目标版本。后台执行下载、校验和安装,页面显示进度及日志;刷新页面不会取消安装。 +5. 成功后点击「刷新页面」。升级到 v1.1.2 或更新版本时,主题自动刷新当前会话的菜单缓存,无需退出登录或重启路由器。 + +v1.1.0 / v1.1.1 的旧菜单名称缓存问题已在 v1.1.2 修复。可以直接从这两个版本通过网页升级到最新版,完成后刷新即可。首次安装更新器带来的新增 RPC 权限与菜单缓存不同,仍需按第 1 步重新登录一次。 + +更新保留 LuCI 语言、当前主题选择及浏览器中的浅色/深色、导航偏好。安装过程中请不要断电或同时操作其他软件包。安装失败时会显示原生包管理器日志;更新器不会声称自动回滚,也不会强制覆盖文件或忽略依赖。 + +更新说明以本地 Markdown 预览显示(v1.1.2 之后的版本),包括标题、列表、表格、引用、链接和代码块。原始 HTML 作为文本显示,不执行其中的脚本;链接在新标签页打开,状态轮询不会重建内容。 + +只读 LuCI 用户可以查看状态和检查更新,安装操作单独要求 `luci-theme-carbon-update` 的写权限。没有安装权限时升级按钮禁用。后台只接受已检查的目标版本,不接受浏览器传入下载地址、包路径、Shell 命令或密钥。 + +## 下载镜像(可选) + +GitHub 下载缓慢或无法访问时,在同一页面的「下载镜像」中填写一个 HTTPS 前缀,例如 `https://mirror.example.com/`。下载地址变为前缀加原始链接:`https://mirror.example.com/https://github.com/mrjoechen/luci-theme-carbon/releases/download/…`。设置保存在 `/etc/config/carbon`(`carbon.update.mirror`),升级时保留。 + +- 镜像只用于下载安装包。版本、文件大小和 SHA-256 仍直接从 `api.github.com` 读取;镜像返回的文件必须与之完全一致,APK 还要通过签名校验。镜像无法篡改要安装的内容。 +- 镜像失败或文件不一致时,自动改用 GitHub 直连;日志会显示每次尝试的来源。 +- 只接受 `https://` 前缀,主机名和路径仅允许字母、数字及 `. _ ~ % + -`,最长 200 字符。留空即关闭。 +- 检查更新本身仍需能访问 `api.github.com`。 + +## 签名与下载 + +- 固定来源:`mrjoechen/luci-theme-carbon` 的最新非草稿、非预发布 GitHub Release。 +- APK:检查 GitHub 发布附件的 SHA-256、大小、实际包名和版本,再通过 `/usr/share/carbon/keys/carbon-apk.pem` 验证签名。安装时再次启用 APK 原生签名校验。没有 `--allow-untrusted`、自动下载新密钥或全局关闭验签的回退。 +- 包内公钥仅用于 Carbon 更新器的独立信任目录,不会自动加入系统 `/etc/apk/keys`。标准 LuCI 上传仍按 [APK 配置说明](apk-install.md)导入公钥。 +- APK 使用本地包及已安装依赖,跳过远端固件索引。缺失依赖时会失败,请先修复软件源并安装依赖。 +- IPK:通过 HTTPS 获取发布元数据和包,核对 SHA-256、大小及包名/版本,使用原生 opkg 安装。IPK 不具有本项目 APK 的签名保证。 +- 版本判断由设备原生包管理器执行,只允许更高版本;检查结果有效期为 30 分钟。 +- 同一设备只运行一个任务。任务采用独立进程及文件锁,页面关闭或 rpcd 重载不会主动取消它。设备重启后临时状态会丢失;重新打开页面以包管理器中的实际版本为准。 + +## 常见问题 + +- **没有更新入口**:旧版未包含更新器,先安装新包并重新登录。确认 `rpcd` 已加载 `luci.carbon_update`。 +- **提示「请先通过系统包管理器安装一次 Carbon」**:主题是复制文件安装的(`--files` 或 v1.1.3 之前的安装脚本),apk/opkg 中没有记录。重新运行一次当前的 `carbon-install.sh`:它会通过包管理器安装内置的签名包,无需导入公钥;也可以手动安装 APK/IPK。更新器本身不会把未登记的文件强制接管给包管理器。 +- **缺少工具**:需要 `curl`、`ca-bundle` 和 `flock`,通常随包依赖安装。不要为解决 HTTPS 问题关闭证书校验。 +- **下载失败**:检查路由器时间、DNS、外网和 GitHub 连通性;GitHub API 限流也会导致检查失败,稍后重试。 +- **签名/校验失败**:没有执行安装。重新检查并下载;若持续失败,请提供错误和日志,不要禁用签名验证。 +- **安装失败或中断**:查看日志及已安装版本。包管理器可能已部分执行,先处理其报错再重试;不要在安装过程中强行中止。 +- **原始 SDK/Actions 临时产物**:在线更新只使用正式 Release 中的已签名 APK,不使用未签名的 CI 构建产物。 + +## English + +Install the native v1.1.0+ APK/IPK once, then log out/back in to activate the newly added RPC permissions. Open **System → Carbon Theme Settings** (**Carbon Update** in v1.1.0), check for updates, review the notes and confirm **Install update**. Progress and logs survive page refreshes. When upgrading to v1.1.2 or later, reload after success; neither logout nor a router reboot is needed. Read-only users cannot install updates. + +v1.1.2 refreshes LuCI's cached menu automatically when the Carbon version changes, including upgrades from v1.1.0 and v1.1.1. It preserves the login session and unrelated session data. First-time RPC permission activation still requires the initial login described above. + +The updater only accepts newer stable releases from the fixed Carbon repository. It verifies size, SHA-256, package name/version and, for APK, the bundled Carbon public key. APK verifies the signature again during installation with the same isolated key directory and no firmware repository access. System trust settings are unchanged. IPK uses HTTPS, size and SHA-256 validation rather than APK signing. Existing dependencies must be available. Checks expire after 30 minutes, and a lock prevents overlapping updates. + +Preferences and router configuration are retained. Installs made by copying files (`carbon-install.sh --files`, or installers before v1.1.3) are not registered with apk/opkg; run the current `carbon-install.sh` once, which installs the embedded signed package natively. Failed installations display logs and do not promise rollback; check the actual installed version before retrying. GitHub connectivity, correct system time, `curl`, `ca-bundle` and `flock` are required. + +### Download mirror + +If GitHub downloads are slow or blocked, set an optional HTTPS prefix under **Download mirror** on the same page (stored as `carbon.update.mirror` in `/etc/config/carbon`). The package URL becomes `https://github.com/…`. Only the package bytes use the mirror: release metadata, size and SHA-256 still come from `api.github.com`, and APKs are signature-checked as before, so a mirror cannot change what gets installed. If the mirror fails or returns a mismatching file, the updater falls back to GitHub. Checking for updates still needs `api.github.com`. + +## Maintainers + +Publish version tags matching `Makefile`; GitHub Release asset names must remain `luci-theme-carbon-VERSION-rN.apk` and `luci-theme-carbon_VERSION-rN_all.ipk`. GitHub supplies each asset's SHA-256 digest through its release API. Upload APKs only after signing. Keep `root/usr/share/carbon/version` in sync with the package version and the bundled public key identical to `keys/carbon-apk.pem`. The CI checks both. + +Run `python tests/update-integration.py` with Docker to test the production RPC script against OpenWrt's real APK manager, disposable signed packages and deterministic download fixtures. Signing and installation are never mocked. This suite checks bad signatures, bad checksums, incorrect metadata, network errors, expired requests, downgrades, concurrency, progress recovery, configuration preservation, mirror validation and fallback from a failing or tampered mirror. + +Run `python tests/opkg-update.py` for the native OpenWrt 24.10 IPK upgrade regression, including legacy removal hooks that reset the theme. Both suites run before Release publication. diff --git a/luci-theme-carbon/docs/releases/install.md b/luci-theme-carbon/docs/releases/install.md new file mode 100644 index 000000000..66283f2d7 --- /dev/null +++ b/luci-theme-carbon/docs/releases/install.md @@ -0,0 +1,47 @@ +## English + +### Install + +| Firmware | Package manager | File | +|---|---|---| +| OpenWrt / ImmortalWrt 23.05, 24.10 | opkg | `luci-theme-carbon_*_all.ipk` | +| OpenWrt / ImmortalWrt 25.x, snapshot | apk | `luci-theme-carbon-*.apk` (signed) | +| Any of the above | apk or opkg | `carbon-install.sh` | + +**Install script.** Run on the router. It installs the signed APK or the IPK through apk/opkg, so online updates work and no key import is needed: + +```sh +wget -O /tmp/carbon-install.sh https://github.com/@REPOSITORY@/releases/latest/download/carbon-install.sh && sh /tmp/carbon-install.sh +``` + +Add `--trust-key` to also trust Carbon's key for LuCI package uploads, or `--files` to only copy the files. + +**Upload in LuCI (apk).** Import the attached `carbon-apk.pem` once in System → Administration → Repo Public Keys, then upload the APK in System → Software. The attached `APK-INSTALL.md` covers firmware without that page. + +**Online updates.** Once installed through apk/opkg, System → Carbon Theme Settings checks and installs new releases. APK signatures stay verified; IPK downloads are checked against this release's SHA-256 and size. + +After a first install, log out and back in once so the dashboard and settings permissions take effect. + +## 简体中文 + +### 安装 + +| 固件 | 包管理器 | 文件 | +|---|---|---| +| OpenWrt / ImmortalWrt 23.05、24.10 | opkg | `luci-theme-carbon_*_all.ipk` | +| OpenWrt / ImmortalWrt 25.x、snapshot | apk | `luci-theme-carbon-*.apk`(已签名) | +| 以上任意固件 | apk 或 opkg | `carbon-install.sh` | + +**安装脚本。** 在路由器上执行。脚本通过 apk/opkg 安装已签名的 APK 或 IPK,在线升级可用,无需导入公钥: + +```sh +wget -O /tmp/carbon-install.sh https://github.com/@REPOSITORY@/releases/latest/download/carbon-install.sh && sh /tmp/carbon-install.sh +``` + +加 `--trust-key` 可同时信任 Carbon 公钥(用于在 LuCI 上传软件包),加 `--files` 只复制文件。 + +**在 LuCI 上传(apk)。** 首次在「系统 → 管理权 → 软件源公钥」导入附件 `carbon-apk.pem`,之后在「系统 → 软件包」上传 APK。没有该页面的固件请参考附件 `APK-INSTALL.md`。 + +**在线升级。** 通过 apk/opkg 安装后,可在「系统 → Carbon 主题」检查并安装新版本。APK 保留签名校验;IPK 按本版本公布的 SHA-256 和文件大小校验。 + +首次安装后请退出并重新登录一次,让仪表盘和设置页的权限生效。 diff --git a/luci-theme-carbon/docs/releases/v1.1.1.md b/luci-theme-carbon/docs/releases/v1.1.1.md new file mode 100644 index 000000000..06e1d60f9 --- /dev/null +++ b/luci-theme-carbon/docs/releases/v1.1.1.md @@ -0,0 +1,15 @@ +### v1.1.1 + +- 将「Carbon 更新」统一更名为「Carbon 主题设置」,同步菜单、页面标题、中英文文案和使用说明。 +- 左侧菜单改用 Carbon 六边形与中心圆点的单色线框图标,与其他菜单的尺寸、线宽和状态配色一致,简洁与专业模式均生效。 +- 沿用原 Carbon APK 签名公钥,升级继续验证签名、SHA-256 和文件大小。 + +**从 v1.1.0 升级:** 打开「系统 → Carbon 更新」,点击「检查更新」,确认目标为 `1.1.1-r1`,然后点击「一键升级」并确认。完成后刷新页面,入口变为「Carbon 主题设置」。无需重新导入公钥;主题与语言偏好保留。 + +**English:** Renames Carbon Update to Carbon Theme Settings and uses a monochrome Carbon outline icon matching the other navigation icons in Simple and Pro modes. From v1.1.0, open **System → Carbon Update → Check for updates → Install update**, confirm `1.1.1-r1`, and reload after completion. The existing signing key and signature verification remain in use; theme and language preferences are retained. + +**菜单缓存提示:** 升级后若菜单或面包屑仍显示 `Carbon Update` /「Carbon 更新」,请退出并重新登录 LuCI 一次,清除旧会话菜单缓存。无需重新安装或重新导入公钥。 + +**发布后验证:** 在隔离的 OpenWrt 25.12.6(APK)与 24.10.8(IPK)中,从未经修改的 v1.1.0 正式包,通过 LuCI 网页发现并安装 v1.1.1 正式发布包,均成功升级至 `1.1.1-r1`。APK 签名校验通过;主题与中文配置保留。重新登录后两种模式均显示新名称与线框图标。 + +**Verification:** Both original v1.1.0 Release packages successfully discovered and installed the published v1.1.1 through LuCI in isolated OpenWrt 25.12.6 (APK) and 24.10.8 (IPK) environments. APK signature verification passed and theme/language settings were preserved. If the old menu name remains, log out and back in once to clear LuCI's session menu cache; no reinstall or key import is needed. diff --git a/luci-theme-carbon/docs/releases/v1.1.2.md b/luci-theme-carbon/docs/releases/v1.1.2.md new file mode 100644 index 000000000..e5d32c766 --- /dev/null +++ b/luci-theme-carbon/docs/releases/v1.1.2.md @@ -0,0 +1,10 @@ +### v1.1.2 + +- 升级后无需退出登录:检测 Carbon 版本变化,自动刷新 LuCI 菜单缓存;成功页的「刷新页面」也会清理菜单缓存。登录状态、主题与语言偏好保留。 +- 修复移动端多页面 luci-app 的顶部导航:自动将当前子页面滚动到可见位置,支持嵌套页面、异步生成的表单标签和屏幕尺寸变化。 +- 自动定位仅滚动标签栏,不移动输入焦点或垂直页面;不会在普通状态刷新时打断手动滑动。 +- 继续使用原有 Carbon 公钥及 APK 原生签名校验,无需重新导入密钥。 + +**升级:** 在「系统 → Carbon 主题设置」点击「检查更新」和「一键升级」,成功后点击「刷新页面」。v1.1.0 的入口仍叫「Carbon 更新」。首次安装更新器新增 RPC 权限时,仍需重新登录一次。 + +**English:** Refresh after upgrading without logging out. Carbon invalidates only the menu cache when its version changes. Mobile route and form tabs now reveal the active page, including nested and dynamically inserted tabs, without moving keyboard focus or scrolling the document. The existing APK signing key and native signature checks remain in use. First-time installation of the updater still requires a new login to activate its RPC permissions. diff --git a/luci-theme-carbon/docs/releases/v1.1.3.md b/luci-theme-carbon/docs/releases/v1.1.3.md new file mode 100644 index 000000000..d675cb497 --- /dev/null +++ b/luci-theme-carbon/docs/releases/v1.1.3.md @@ -0,0 +1,17 @@ +### v1.1.3 + +- **更轻的概览页:** 「详细状态」收起时暂停 LuCI 原生状态组件的轮询,路由器不再被重复查询;展开后恢复。 +- **在线设备更准确:** 合并 DHCPv4/v6 租约、Wi‑Fi 关联列表和 ARP 邻居,固定 IP 设备也能显示;Wi‑Fi 设备显示频段和信号强度,名称来自 LuCI 主机信息。 +- **IPv6 与流量:** 概览显示外网 IPv6 地址;「实时流量」可选择统计的接口(自动跟随 WAN,或指定 LAN 等)。 +- **温度:** 读取所有热区和 hwmon 传感器(CPU、SoC、无线芯片、x86 coretemp),最多显示三项。 +- **多语言:** 主题文案改用标准 gettext(`po/`),新增繁体中文;侧栏语言切换列出所有已安装的 LuCI 语言(超过两种时使用下拉框,可选「自动」),不再把其他语言覆盖为英文。 +- **下载镜像:** 「Carbon 主题设置」可填写 HTTPS 镜像前缀。只用于下载安装包,版本、大小和 SHA-256 仍以 GitHub 为准;镜像失败自动改用 GitHub。 +- **无障碍:** 手机抽屉菜单打开时锁定背景并管理焦点;分段按钮支持方向键;收起的侧栏在触屏上点按展开子菜单,键盘可用 Enter / → 进入、Esc 返回。 +- **安装脚本走包管理器:** `carbon-install.sh` 内置签名 APK、IPK 和公钥,通过 apk/opkg 安装,在线升级可用,无需手动导入公钥(APK 在独立密钥目录中验签,不修改 `/etc/apk/keys`)。重新运行即可把旧版脚本安装转为正式安装;`--trust-key` 可同时信任公钥,`--files` 保留原来的复制文件方式。离线且缺少依赖时自动改为复制文件。 +- **体积:** 发布包中的 CSS/JS 经过压缩(约小 20%),源码保持可读。 + +**升级:** 新增的仪表盘数据(Wi‑Fi 关联、ARP、主机信息、全部温度传感器)需要新的 RPC 权限,升级后**退出并重新登录一次**才会显示;未重新登录前仪表盘按原方式工作。 + +**以前用安装脚本安装、页面提示「请先通过系统包管理器安装一次 Carbon」的设备:** 重新运行一次本版本的 `carbon-install.sh`,之后即可在网页一键升级,无需导入公钥。 + +**English:** The overview pauses LuCI's own status polling while its details are collapsed. Connected devices now merge DHCPv4/v6 leases, Wi‑Fi stations (band and signal) and ARP neighbours, so static-IP clients appear. The hero shows the WAN IPv6 address, live traffic can follow any interface, and all thermal/hwmon sensors are read. Theme strings use gettext catalogues (`po/`) with a new Traditional Chinese translation, and the language switch lists every installed LuCI language. The updater accepts an optional HTTPS download mirror; metadata and SHA-256 still come from GitHub, with automatic fallback. Accessibility improves for the phone drawer, segmented controls and the collapsed rail on touch and keyboard. `carbon-install.sh` now embeds the signed APK, the IPK and the public key and installs through apk/opkg, so script installs get online updates without importing a key (the APK is verified in a private key directory); rerunning it converts older script-only installs. `--trust-key` also trusts the key for LuCI uploads, `--files` keeps the copy-only mode. Release assets are minified. Log out and back in once after upgrading to grant the new dashboard permissions. Devices that show "install Carbon through the package manager" after a script install: run this release's `carbon-install.sh` once to enable online updates. diff --git a/luci-theme-carbon/docs/releases/v1.1.4.md b/luci-theme-carbon/docs/releases/v1.1.4.md new file mode 100644 index 000000000..ecd00e711 --- /dev/null +++ b/luci-theme-carbon/docs/releases/v1.1.4.md @@ -0,0 +1,35 @@ +## English + +### What's new + +- **Custom logo.** Upload a PNG, JPEG, WebP, GIF or SVG (up to 256 KB) in System → Carbon Theme Settings. It replaces the logo in the sidebar, on the login page, on the overview and in the browser tab, and is kept across theme updates and firmware upgrades that keep settings. SVGs with scripts, event handlers or embedded documents are rejected. +- **Ten more languages.** German, Spanish, French, Italian, Japanese, Korean, Brazilian Portuguese, Russian, Turkish and Vietnamese, alongside English and Simplified and Traditional Chinese. +- **Language menu.** With more than two languages installed, the sidebar shows a Carbon-styled list instead of the browser's own select. It works with keyboard (arrows, type-ahead, Esc) and touch, and opens beside the collapsed rail. +- **Live traffic.** Physical network devices, such as an xPON port carrying several VLANs, can be picked in addition to interfaces. +- **Docker.** The Docker menu uses a whale icon, and each Docker page has its own icon. +- **Plugins.** The DiskMan partition bar fits its card on desktops and phones; the ttyd terminal fills the window. +- **Carbon Theme Settings.** Buttons, links and fields line up on one line, and the download-mirror explanation opens from a "?" hint. +- **Login page.** Shows the logo and hostname only, without the device model. +- **Smaller package.** Despite the new languages, the package is smaller than 1.1.3: release notes are rendered by a small built-in renderer instead of a bundled Markdown library. + +### Upgrade notes + +- If uploading a logo reports *Permission denied*, log out and back in once. + +## 简体中文 + +### 更新内容 + +- **自定义 Logo。** 在「系统 → Carbon 主题」上传 PNG、JPEG、WebP、GIF 或 SVG(不超过 256 KB),替换侧栏、登录页、概览页和浏览器标签上的 Logo;主题升级和保留配置的固件升级后仍会保留。含脚本、事件处理或嵌入文档的 SVG 会被拒绝。 +- **新增十种语言。** 德语、西班牙语、法语、意大利语、日语、韩语、巴西葡萄牙语、俄语、土耳其语和越南语,加上原有的英文、简体中文和繁体中文。 +- **语言菜单。** 安装了两种以上语言时,侧栏使用与主题风格一致的下拉列表,不再使用浏览器自带的下拉框;支持键盘(方向键、首字母跳转、Esc)和触屏,侧栏收起时在旁边弹出。 +- **实时流量。** 除接口外,还可以选择物理网络设备,例如承载多个 VLAN 的 xPON 光口。 +- **Docker。** Docker 菜单使用鲸鱼图标,各个 Docker 页面也有各自的图标。 +- **插件适配。** DiskMan 分区条在电脑和手机上都不再超出卡片;ttyd 终端铺满窗口。 +- **Carbon 主题页面。** 菜单项「Carbon 主题设置」更名为「Carbon 主题」;按钮、链接和输入框对齐在同一行,下载镜像的说明收进「?」提示中。 +- **登录页。** 只显示 Logo 和主机名,不再显示设备型号。 +- **安装包更小。** 虽然新增了多种语言,安装包仍比 1.1.3 小:更新说明改用内置的小型渲染器显示,不再打包完整的 Markdown 库。 + +### 升级须知 + +- 如果上传 Logo 时提示「权限不足」,请退出并重新登录一次。 diff --git a/luci-theme-carbon/docs/releases/v1.1.5.md b/luci-theme-carbon/docs/releases/v1.1.5.md new file mode 100644 index 000000000..cac06844a --- /dev/null +++ b/luci-theme-carbon/docs/releases/v1.1.5.md @@ -0,0 +1,33 @@ +## English + +### What's new + +- **Side-router device discovery.** Fix LAN neighbours being omitted when LAN obtains its own address by DHCP. Device discovery continues to combine DHCP leases, Wi-Fi associations and IPv4 ARP neighbours with the local DHCP server disabled. Recognisable separate uplinks are excluded; ambiguous custom interfaces are retained. Addresses [issue #3](https://github.com/mrjoechen/luci-theme-carbon/issues/3). +- **Clearer device information.** The overview now says "Discovered devices": lease records and neighbour caches may include offline devices and do not represent every device on the network. Gateways, neighbour entries and DHCP leases are labelled separately, instead of assuming that a missing local lease means a fixed IP. Labels are translated into all bundled languages and wrap on phones to preserve room for device names. +- **Dashboard data permissions.** Allow ARP and temperature readings through their resolved procfs/sysfs paths, fixing missing data on systems whose rpcd checks those paths. +- **Traffic selector.** Use the Carbon listbox for the live-traffic interface picker, with grouped choices and keyboard support. Listboxes stay open when a page update triggers a scroll without moving the control. +- **Layout.** Use more space for dashboards and tables on wide screens, with two columns of devices where space permits. Improve phone layouts for menus, tables and dashboard content. +- **Device brands.** Show brand logos in LuCI's native lease tables as well as the overview, and add Midea and Haier device badges. +- **Dark mode.** Fix the colour of enabled switches. + +### Upgrade notes + +- After upgrading, log out of LuCI and back in once so the updated dashboard permissions take effect, especially if ARP devices or temperatures are missing. +- "Discovered devices" is based on data visible to this router. It may contain offline records and cannot guarantee a complete live count of the network. + +## 简体中文 + +### 更新内容 + +- **旁路由设备发现。** 修复 LAN 自身通过 DHCP 获取地址时,邻居设备被遗漏的问题。关闭本机 DHCP 服务后,仍通过 DHCP 租约、Wi-Fi 关联列表与 IPv4 ARP 邻居合并发现设备;排除可识别的独立上联接口,对角色不明确的自定义接口保留发现结果。对应 [issue #3](https://github.com/mrjoechen/luci-theme-carbon/issues/3)。 +- **设备信息更准确。** 概览改为“已发现设备”:租约和邻居缓存可能包含离线设备,也不代表全网所有设备。明确区分网关、邻居记录和 DHCP 租约,不再将缺少本机租约的设备一律标为固定 IP。同步全部内置语言,手机端标签换行,避免挤压设备名称。 +- **仪表盘数据权限。** 补充 ARP 与温度文件解析后的 procfs/sysfs 实际路径权限,修复部分 rpcd 版本下无法读取数据的问题。 +- **流量接口选择。** 实时流量的接口选择改为 Carbon 样式列表,支持选项分组与键盘操作;页面更新引起滚动、但控件位置未改变时,下拉列表不再意外关闭。 +- **布局优化。** 宽屏下的仪表盘和表格充分利用空间,设备列表在空间足够时显示为两列;改善手机端菜单、表格与仪表盘内容的布局。 +- **设备品牌。** LuCI 原生租约表也显示品牌图标,新增美的和海尔设备标识。 +- **深色模式。** 修复开关启用状态的颜色。 + +### 升级须知 + +- 升级后请退出 LuCI 并重新登录一次,让更新后的仪表盘权限生效;尤其适用于 ARP 设备或温度信息缺失的情况。 +- “已发现设备”来自本机可见的数据,可能包含离线记录,不能保证完整的全网实时在线数量。 diff --git a/luci-theme-carbon/htdocs/luci-static/carbon/brands.js b/luci-theme-carbon/htdocs/luci-static/carbon/brands.js new file mode 100644 index 000000000..a99630441 --- /dev/null +++ b/luci-theme-carbon/htdocs/luci-static/carbon/brands.js @@ -0,0 +1,10 @@ +/*! + * Carbon — brand data for the connected-devices list (generated by scripts/gen-brands.py). + * Brand glyphs: Simple Icons 16.37.0 (CC0 1.0). All trademarks belong to their owners. + * MAC prefixes: IEEE Registration Authority MA-L registry. + */ +(function (C) { + 'use strict'; + C.BRAND_DATA = {"brands":{"apple":{"n":"Apple","inv":1,"p":"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"},"xiaomi":{"n":"Xiaomi","bg":"#FF6900","p":"M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z"},"huawei":{"n":"Huawei","bg":"#FF0000","p":"M3.67 6.14S1.82 7.91 1.72 9.78v.35c.08 1.51 1.22 2.4 1.22 2.4 1.83 1.79 6.26 4.04 7.3 4.55 0 0 .06.03.1-.01l.02-.04v-.04C7.52 10.8 3.67 6.14 3.67 6.14zM9.65 18.6c-.02-.08-.1-.08-.1-.08l-7.38.26c.8 1.43 2.15 2.53 3.56 2.2.96-.25 3.16-1.78 3.88-2.3.06-.05.04-.09.04-.09zm.08-.78C6.49 15.63.21 12.28.21 12.28c-.15.46-.2.9-.21 1.3v.07c0 1.07.4 1.82.4 1.82.8 1.69 2.34 2.2 2.34 2.2.7.3 1.4.31 1.4.31.12.02 4.4 0 5.54 0 .05 0 .08-.05.08-.05v-.06c0-.03-.03-.05-.03-.05zM9.06 3.19a3.42 3.42 0 00-2.57 3.15v.41c.03.6.16 1.05.16 1.05.66 2.9 3.86 7.65 4.55 8.65.05.05.1.03.1.03a.1.1 0 00.06-.1c1.06-10.6-1.11-13.42-1.11-13.42-.32.02-1.19.23-1.19.23zm8.299 2.27s-.49-1.8-2.44-2.28c0 0-.57-.14-1.17-.22 0 0-2.18 2.81-1.12 13.43.01.07.06.08.06.08.07.03.1-.03.1-.03.72-1.03 3.9-5.76 4.55-8.64 0 0 .36-1.4.02-2.34zm-2.92 13.07s-.07 0-.09.05c0 0-.01.07.03.1.7.51 2.85 2 3.88 2.3 0 0 .16.05.43.06h.14c.69-.02 1.9-.37 3-2.26l-7.4-.25zm7.83-8.41c.14-2.06-1.94-3.97-1.94-3.98 0 0-3.85 4.66-6.67 10.8 0 0-.03.08.02.13l.04.01h.06c1.06-.53 5.46-2.77 7.28-4.54 0 0 1.15-.93 1.21-2.42zm1.52 2.14s-6.28 3.37-9.52 5.55c0 0-.05.04-.03.11 0 0 .03.06.07.06 1.16 0 5.56 0 5.67-.02 0 0 .57-.02 1.27-.29 0 0 1.56-.5 2.37-2.27 0 0 .73-1.45.17-3.14z"},"honor":{"n":"Honor","inv":1,"m":"H"},"samsung":{"n":"Samsung","bg":"#1428A0","m":"S"},"oppo":{"n":"OPPO","bg":"#2D683D","m":"O"},"vivo":{"n":"vivo","bg":"#415FFF","m":"v"},"oneplus":{"n":"OnePlus","bg":"#F5010C","p":"M0 3.74V24h20.26V12.428h-2.256v9.317H2.254V5.995h9.318V3.742zM18.004 0v3.74h-3.758v2.256h3.758v3.758h2.255V5.996H24V3.74h-3.758V0zm-6.45 18.756V8.862H9.562c0 .682-.228 1.189-.577 1.504-.367.297-.91.437-1.556.437h-.245v1.625h2.133v6.31h2.237z"},"realme":{"n":"realme","bg":"#FFC915","m":"r","fg":"#1d1d1f"},"meizu":{"n":"Meizu","bg":"#FF4132","p":"M20.045 18.818h3.546A.41.41 0 0 0 24 18.41v-3.545a.41.41 0 0 0-.41-.41h-3.545a.41.41 0 0 0-.409.41v3.545c0 .226.184.41.41.41zM13.8 12.11a.095.095 0 0 1-.163-.068V5.591a.41.41 0 0 0-.409-.41H10.59a.545.545 0 0 0-.385.16L.16 15.387a.545.545 0 0 0-.16.385v2.638c0 .226.183.41.41.41h2.637a.547.547 0 0 0 .385-.16l6.769-6.769a.096.096 0 0 1 .163.068v6.451c0 .226.183.41.409.41h2.638a.547.547 0 0 0 .385-.16L23.84 8.613A.545.545 0 0 0 24 8.23V5.59a.41.41 0 0 0-.41-.41h-2.637a.546.546 0 0 0-.386.16z"},"google":{"n":"Google","bg":"#4285F4","p":"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"},"android":{"n":"Android","bg":"#3DDC84","p":"M18.4395 5.5586c-.675 1.1664-1.352 2.3318-2.0274 3.498-.0366-.0155-.0742-.0286-.1113-.043-1.8249-.6957-3.484-.8-4.42-.787-1.8551.0185-3.3544.4643-4.2597.8203-.084-.1494-1.7526-3.021-2.0215-3.4864a1.1451 1.1451 0 0 0-.1406-.1914c-.3312-.364-.9054-.4859-1.379-.203-.475.282-.7136.9361-.3886 1.5019 1.9466 3.3696-.0966-.2158 1.9473 3.3593.0172.031-.4946.2642-1.3926 1.0177C2.8987 12.176.452 14.772 0 18.9902h24c-.119-1.1108-.3686-2.099-.7461-3.0683-.7438-1.9118-1.8435-3.2928-2.7402-4.1836a12.1048 12.1048 0 0 0-2.1309-1.6875c.6594-1.122 1.312-2.2559 1.9649-3.3848.2077-.3615.1886-.7956-.0079-1.1191a1.1001 1.1001 0 0 0-.8515-.5332c-.5225-.0536-.9392.3128-1.0488.5449zm-.0391 8.461c.3944.5926.324 1.3306-.1563 1.6503-.4799.3197-1.188.0985-1.582-.4941-.3944-.5927-.324-1.3307.1563-1.6504.4727-.315 1.1812-.1086 1.582.4941zM7.207 13.5273c.4803.3197.5506 1.0577.1563 1.6504-.394.5926-1.1038.8138-1.584.4941-.48-.3197-.5503-1.0577-.1563-1.6504.4008-.6021 1.1087-.8106 1.584-.4941z"},"amazon":{"n":"Amazon","bg":"#FF9900","g":"speaker"},"nintendo":{"n":"Nintendo","bg":"#E60012","g":"gamepad"},"playstation":{"n":"PlayStation","bg":"#0070D1","p":"M8.984 2.596v17.547l3.915 1.261V6.688c0-.69.304-1.151.794-.991.636.18.76.814.76 1.505v5.875c2.441 1.193 4.362-.002 4.362-3.152 0-3.237-1.126-4.675-4.438-5.827-1.307-.448-3.728-1.186-5.39-1.502zm4.656 16.241l6.296-2.275c.715-.258.826-.625.246-.818-.586-.192-1.637-.139-2.357.123l-4.205 1.5V14.98l.24-.085s1.201-.42 2.913-.615c1.696-.18 3.785.03 5.437.661 1.848.601 2.04 1.472 1.576 2.072-.465.6-1.622 1.036-1.622 1.036l-8.544 3.107V18.86zM1.807 18.6c-1.9-.545-2.214-1.668-1.352-2.32.801-.586 2.16-1.052 2.16-1.052l5.615-2.013v2.313L4.205 17c-.705.271-.825.632-.239.826.586.195 1.637.15 2.343-.12L8.247 17v2.074c-.12.03-.256.044-.39.073-1.939.331-3.996.196-6.038-.479z"},"sony":{"n":"Sony","inv":1,"m":"S"},"microsoft":{"n":"Microsoft","bg":"#737373","g":"pc"},"windows":{"n":"Windows","bg":"#0078D4","g":"pc"},"lenovo":{"n":"Lenovo","bg":"#E2231A","m":"L"},"dell":{"n":"Dell","bg":"#007DB8","p":"M17.963 14.6V9.324h1.222v4.204h2.14v1.07h-3.362zm-9.784-3.288l2.98-2.292c.281.228.56.458.841.687l-2.827 2.14.611.535 2.827-2.216c.281.228.56.458.841.688a295.83 295.83 0 0 1-2.827 2.216l.61.536 2.83-2.295-.001-1.986h1.223v4.204h2.216v1.07h-3.362v-1.987c-.995.763-1.987 1.529-2.981 2.292l-2.981-2.292c-.144.729-.653 1.36-1.312 1.694-.285.147-.597.24-.915.276-.183.022-.367.017-.551.017H3.516V9.325H5.69a2.544 2.544 0 0 1 1.563.557c.454.36.778.872.927 1.43m-3.516-.917v3.21l.953-.001a1.377 1.377 0 0 0 1.036-.523 1.74 1.74 0 0 0 .182-1.889 1.494 1.494 0 0 0-.976-.766c-.166-.04-.338-.03-.507-.032h-.688zM11.82 0h.337a11.94 11.94 0 0 1 5.405 1.373 12.101 12.101 0 0 1 4.126 3.557A11.93 11.93 0 0 1 24 11.82v.36a11.963 11.963 0 0 1-3.236 8.033A11.967 11.967 0 0 1 12.182 24h-.361a11.993 11.993 0 0 1-4.145-.806 12.04 12.04 0 0 1-4.274-2.836A12.057 12.057 0 0 1 .576 15.67 12.006 12.006 0 0 1 0 12.181v-.361a11.924 11.924 0 0 1 1.992-6.396 12.211 12.211 0 0 1 4.71-4.172A11.875 11.875 0 0 1 11.82 0m-.153 1.23a10.724 10.724 0 0 0-6.43 2.375 10.78 10.78 0 0 0-3.319 4.573 10.858 10.858 0 0 0 .193 8.12 10.788 10.788 0 0 0 3.546 4.421 10.698 10.698 0 0 0 4.786 1.946c1.456.209 2.955.124 4.376-.26a10.756 10.756 0 0 0 5.075-3.062 10.742 10.742 0 0 0 2.686-5.28 10.915 10.915 0 0 0-.122-4.682 10.77 10.77 0 0 0-7.098-7.626 10.78 10.78 0 0 0-3.693-.525z"},"hp":{"n":"HP","bg":"#0096D6","p":"M12.0069 24h-.3572l2.459-6.7453h3.3796c.5907 0 1.2364-.4533 1.4424-1.0166l2.6652-7.3085c.4396-1.1952-.2473-2.1706-1.525-2.1706h-4.6983l-3.929 10.798-2.2255 6.127C3.929 22.434 0 17.6806 0 12.007 0 6.498 3.7092 1.8546 8.7647.4396L6.4705 6.759 2.6514 17.2547h2.5415L8.4488 8.339h1.9095l-3.2558 8.9158H9.644l3.0223-8.3251c.4396-1.1952-.2473-2.1706-1.525-2.1706h-2.143l2.459-6.7453C11.636 0 11.8145 0 11.9931 0 18.6285 0 24 5.3715 24 12.007c.0137 6.6216-5.3578 11.993-11.9931 11.993zM19.2742 8.325h-1.9096l-2.6789 7.336h1.9096l2.6789-7.336z"},"asus":{"n":"ASUS","inv":1,"m":"A"},"tplink":{"n":"TP-Link","bg":"#4ACBD6","p":"M15.185 0C10.218 0 6.25 3.984 6.25 8.903V10.8h4.99V8.903c0-2.135 1.736-3.863 3.946-3.863 2.187 0 3.708 1.536 3.708 3.815 0 2.257-1.64 3.912-3.827 3.912h-1.878v5.039h1.878c4.874 0 8.819-4.007 8.819-8.952C23.885 3.72 20.2 0 15.185 0zM.115 12.6v4.103c0 .624.523 1.248 1.236 1.248h4.753v4.801c0 .624.523 1.248 1.236 1.248h4.065V12.6Z"},"raspberrypi":{"n":"Raspberry Pi","bg":"#A22846","p":"m19.8955 10.8961-.1726-.3028c.0068-2.1746-1.0022-3.061-2.1788-3.7348.356-.0938.7237-.1711.8245-.6182.6118-.1566.7397-.4398.8011-.7398.16-.1066.6955-.4061.6394-.9211.2998-.2069.4669-.4725.3819-.8487.3222-.3515.407-.6419.2702-.9096.3868-.4805.2152-.7295.05-.9817.2897-.5254.0341-1.0887-.7758-.9944-.3221-.4733-1.0244-.3659-1.133-.3637-.1215-.1519-.2819-.2821-.7755-.219-.3197-.2851-.6771-.2364-1.0458-.0964-.4378-.3403-.7275-.0675-1.0584.0356-.53-.1706-.6513.0631-.9117.1583-.5781-.1203-.7538.1416-1.0309.4182l-.3224-.0063c-.8719.5061-1.305 1.5366-1.4585 2.0664-.1536-.5299-.5858-1.5604-1.4575-2.0664l-.3223.0063C9.942.5014 9.7663.2394 9.1883.3597 8.9279.2646 8.807.0309 8.2766.2015c-.2172-.0677-.417-.2084-.6522-.2012l.0004.0002C7.5017.0041 7.369.049 7.2185.166c-.3688-.1401-.7262-.1887-1.0459.0964-.4936-.0631-.654.0671-.7756.219C5.2887.4791 4.5862.3717 4.264.845c-.8096-.0943-1.0655.4691-.7756.9944-.1653.2521-.3366.5013.05.9819-.1367.2677-.0519.5581.2703.9096-.085.3763.0822.6418.3819.8487-.0561.515.4795.8144.6394.9211.0614.3001.1894.5832.8011.7398.1008.4472.4685.5244.8245.6183-1.1766.6737-2.1856 1.56-2.1788 3.7348l-.1724.3028c-1.3491.8082-2.5629 3.4056-.6648 5.5167.124.6609.3319 1.1355.5171 1.6609.2769 2.117 2.0841 3.1082 2.5608 3.2255.6984.524 1.4423 1.0212 2.449 1.3696.949.964 1.977 1.3314 3.0107 1.3308.0152 0 .0306.0002.0457 0 1.0337.0006 2.0618-.3668 3.0107-1.3308 1.0067-.3483 1.7506-.8456 2.4491-1.3696.4766-.1173 2.2838-1.1085 2.5607-3.2255.1851-.5253.3931-1 .517-1.6609 1.8981-2.1113.6843-4.7089-.6649-5.517zm-1.0386-.3715c-.0704.8759-4.6354-3.0504-3.8472-3.1808 2.1391-.3558 3.9191.896 3.8472 3.1808zm-2.0155 4.3649c-1.1481.7409-2.8025.2626-3.6953-1.0681-.8928-1.3306-.6858-3.0101.4623-3.7509 1.1481-.7409 2.8025-.2627 3.6953 1.068.8927 1.3307.6858 3.0101-.4623 3.751zM13.6591 1.3721c.0396.1967.0843.321.1354.3577.2537-.272.4611-.5506.7878-.8123.0011.1537-.0776.3205.1169.4425.1752-.2356.4119-.4459.7263-.6244-.1514.2611-.026.3404.0554.4486.24-.2059.4681-.4144.9109-.5759-.121.1474-.2902.2914-.1108.4607.2473-.1544.496-.3086 1.0833-.4183-.1323.1475-.4059.295-.2401.4426.3104-.1186.6539-.2047 1.034-.2546-.182.1496-.3337.2963-.1846.4122.3323-.1022.7899-.2398 1.2372-.1212l-.2832.2849c-.0314.0382.6623.0297 1.1202.0364-.167.2321-.3375.4562-.437.8548.0454.0459.2723.0204.4862 0-.2194.4618-.6004.5783-.6893.776.134.1015.32.075.5232.006-.158.3254-.4892.5484-.7509.8123.0662.047.1818.075.4555.0425-.2418.257-.5339.492-.8802.7032.0614.0708.2722.0681.4678.0727-.3136.3069-.7173.466-1.0955.6668.1885.1288.3234.0988.4678.097-.2676.2198-.7225.3342-1.1448.4668.0803.1249.1607.1589.3324.194-.447.2473-1.0873.1343-1.2679.2607.0435.1243.1665.2053.3139.2728-.7197.0418-2.6879-.0262-3.0652-1.5156.7367-.8094 2.0813-1.7593 4.394-2.934-1.7994.6022-3.4229 1.405-4.7817 2.5096-1.5978-.7436-.4965-2.6197.283-3.3645zm-1.6126 5.3718c1.1329-.0123 2.5356.8325 2.53 1.6286-.005.7027-.9851 1.2715-2.5213 1.2607-1.5043-.0177-2.5172-.7148-2.5137-1.3957.003-.5603 1.2282-1.5263 2.505-1.4936zm-5.7646-.6006c.1717-.0351.252-.0692.3323-.194-.4223-.1327-.8772-.247-1.1448-.4668.1444.0018.2792.0318.4678-.097-.3783-.2008-.782-.3599-1.0956-.6668.1955-.0048.4064-.002.4677-.0728-.3462-.2113-.6383-.4463-.8801-.7033.2738.0325.3893.0045.4555-.0425-.2617-.264-.593-.487-.7509-.8123.2032.069.3892.0954.5232-.006-.089-.1977-.47-.3142-.6894-.776.214.0204.4409.0459.4863 0-.0994-.3985-.2698-.6226-.4369-.8547.4579-.0067 1.1516.0018 1.1202-.0364l-.2831-.2849c.4472-.1186.9049.019 1.2371.1213.1492-.1159-.0026-.2626-.1847-.4123.3801.05.7236.1361 1.034.2547.1659-.1476-.1076-.2951-.24-.4426.5872.1097.8361.2639 1.0833.4183.1794-.1694.0103-.3133-.1108-.4607.4428.1615.6709.37.911.5759.0814-.1082.2068-.1875.0554-.4486.3143.1785.5511.3888.7263.6244.1945-.122.1159-.2888.1169-.4426.3267.2618.534.5404.7879.8124.0511-.0366.0959-.161.1354-.3577.7794.7448 1.8807 2.6208.2831 3.3646-1.3589-1.1039-2.9817-1.9064-4.78-2.5086 2.3115 1.174 3.6556 2.1239 4.392 2.9328-.3773 1.4895-2.3455 1.5575-3.0651 1.5157.1473-.0676.2703-.1485.3139-.2728-.1806-.1264-.8209-.0134-1.2679-.2607zm2.8175 1.1334c.7881.1304-3.7769 4.0567-3.8472 3.1809-.0719-2.2846 1.7079-3.5367 3.8472-3.1809zm-4.847 8.7567c-1.1094-.8789-1.4668-3.4529.5901-4.6097 1.2394-.3273.4184 5.051-.5901 4.6097zm4.2656 4.5989c-.6257.3719-2.1452.2187-3.2252-1.3095-.7283-1.2823-.6345-2.5872-.123-2.9705.7648-.4589 1.9464.1609 2.8559 1.2003.7923.9405 1.1536 2.5927.4923 3.0797zm-1.2415-5.6086c-1.1481-.7409-1.3551-2.4203-.4623-3.7511.8928-1.3307 2.5472-1.8089 3.6952-1.068 1.1481.7409 1.3551 2.4203.4623 3.7509-.8926 1.3308-2.5471 1.809-3.6952 1.0682zm4.7948 8.2279c-1.3763.0584-2.7258-1.1105-2.7081-1.5157-.0206-.594 1.6758-1.0578 2.782-1.0306 1.1131-.0479 2.6068.3531 2.6097.8851.0184.5166-1.3547 1.6838-2.6836 1.6612zm2.7584-5.8578c.0081 1.3899-1.226 2.5225-2.7562 2.5299-1.5302.0073-2.7773-1.1135-2.7854-2.5033v-.0265c-.008-1.3899 1.2259-2.5226 2.7562-2.5299 1.5302-.0073 2.7773 1.1134 2.7853 2.5033a.7794.7794 0 0 1 .0001.0265zm3.855 2.0029c-1.186 1.6208-2.7916 1.684-3.3896 1.2325-.6255-.5811-.148-2.3854.7094-3.3747v-.0003c.9812-1.0912 2.0302-1.8037 2.7609-1.2469.4919.4828.7805 2.3008-.0807 3.3894zm1.0724-3.4301c-1.0086.4413-1.8298-4.9372-.5901-4.61 2.0568 1.1569 1.6994 3.731.5901 4.61zm-.0256-8.3279h.2985v-.5304h.2986c.1502 0 .2053.0624.2262.2052.0152.1088.0113.2395.0477.3253h.2984c-.0533-.0763-.0515-.2358-.0571-.3213-.0097-.1373-.0513-.2796-.1977-.3176v-.0037c.1502-.061.2149-.1807.2149-.341 0-.2048-.1539-.3738-.3974-.3738h-.732v1.3573zm.2985-1.1255h.3269c.1333 0 .2054.0573.2054.188 0 .1369-.0721.1942-.2054.1942H20.03v-.3822zm-1.0337.4633c0 .7009.5682 1.2694 1.2695 1.2694s1.2695-.5684 1.2695-1.2694c0-.7013-.5683-1.2697-1.2695-1.2697-.7013 0-1.2695.5684-1.2695 1.2697zm2.3275 0c0 .5845-.4737 1.058-1.058 1.058s-1.058-.4735-1.058-1.058c0-.5849.4737-1.058 1.058-1.058s1.058.4731 1.058 1.058z"},"synology":{"n":"Synology","bg":"#3A3A3C","m":"S"},"espressif":{"n":"Espressif","bg":"#E7352C","p":"M12.926 19.324a7.6 7.6 0 00-2.983-6.754 7.44 7.44 0 00-3.828-1.554.697.697 0 01-.606-.731.674.674 0 01.743-.617 8.97 8.97 0 018 9.805 7.828 7.828 0 01-.298 1.542l1.989.56a11.039 11.039 0 001.714-.651 12.159 12.159 0 00.217-2.343A12.57 12.57 0 007.212 6.171a5.53 5.53 0 00-2 0 4.354 4.354 0 00-2.16 1.337 4.274 4.274 0 001.909 6.856 9.896 9.896 0 001.074.195 4.011 4.011 0 013.337 3.954 3.965 3.965 0 01-.64 2.16l1.371.88a10.182 10.182 0 002.057.342 7.52 7.52 0 00.754-2.628m.16 4.73A13.073 13.073 0 01.001 10.983 12.982 12.982 0 013.83 1.737l.743.697a12.067 12.067 0 000 17.141 12.067 12.067 0 0017.141 0l.697.697a12.97 12.97 0 01-9.336 3.726M24 10.993A10.993 10.993 0 0012.949 0c-.389 0-.766 0-1.143.057l-.252.732a18.912 18.912 0 0111.588 11.576l.731-.263c0-.366.069-.732.069-1.143m-1.269 5.165A17.53 17.53 0 007.818 1.27a11.119 11.119 0 00-2.457 1.77v1.635A13.919 13.919 0 0119.268 18.57h1.634a11.713 11.713 0 001.771-2.446M7.92 17.884a1.691 1.691 0 11-1.69-1.691 1.691 1.691 0 011.69 1.691"},"lg":{"n":"LG","bg":"#A50034","p":"M14.522 14.078h3.27v1.33h-4.847v-6.83h1.577v5.5zm6.74-1.274h1.284v1.195c-.236.09-.698.18-1.137.18-1.42 0-1.893-.721-1.893-2.186 0-1.398.45-2.221 1.869-2.221.791 0 1.24.248 1.612.722l.982-.903c-.6-.855-1.646-1.114-2.629-1.114-2.208 0-3.368 1.205-3.368 3.504 0 2.288 1.047 3.528 3.358 3.528 1.06 0 2.096-.27 2.66-.665V11.53h-2.739v1.274zM5.291 6.709a5.29 5.29 0 1 1 0 10.582 5.291 5.291 0 1 1 0-10.582m3.16 8.457a4.445 4.445 0 0 0 1.31-3.161v-.242l-.22.001H6.596v.494h2.662l-.001.015a3.985 3.985 0 0 1-3.965 3.708 3.95 3.95 0 0 1-2.811-1.165 3.952 3.952 0 0 1-1.164-2.811c0-1.061.414-2.059 1.164-2.81a3.951 3.951 0 0 1 2.81-1.164l.252.003v-.495l-.251-.003a4.475 4.475 0 0 0-4.47 4.469c0 1.194.465 2.316 1.309 3.161a4.444 4.444 0 0 0 3.16 1.31 4.444 4.444 0 0 0 3.162-1.31m-2.91-1.297V9.644H5.04v4.72h1.556v-.495H5.543zm-1.265-3.552a.676.676 0 1 0-.675.674.676.676 0 0 0 .675-.674"},"roku":{"n":"Roku","bg":"#662D91","m":"R"},"dji":{"n":"DJI","inv":1,"p":"M19.2 7.8a716.856 716.856 0 0 0-1.232 4.63c-.202.772-.401 1.544-.634 2.308-.226.743-.504 1.535-.91 2.21-.422.703-.969 1.253-1.726 1.604-.3.137-.615.24-.939.306-.46.09-.926.146-1.394.165-1.163.065-3.628.056-4.79.056l.713-2.64c.539 0 1.078.002 1.617-.013.52-.014 1.092-.042 1.605-.163.56-.133.984-.36 1.355-.817.337-.416.564-.935.75-1.424.34-.893.688-2.173.934-3.093.277-1.041.544-2.085.812-3.129zm4.8 0-2.072 7.68h-3.84l2.073-7.68ZM11.339 4.92h3.84c-.403 1.5-.805 2.999-1.212 4.496-.283 1.044-.565 2.088-.872 3.124-.135.452-.269.903-.445 1.342-.141.352-.3.666-.591.93a1.908 1.908 0 0 1-.734.405c-.356.112-.717.154-1.085.184-.53.043-1.06.054-1.591.063-1.991.02-3.983.02-5.974-.001a21.408 21.408 0 0 1-.954-.034 5.319 5.319 0 0 1-.632-.07 1.851 1.851 0 0 1-.412-.119c-.44-.192-.664-.575-.677-1.043 0-.263.032-.525.093-.78.076-.367.171-.728.265-1.09.179-.691.506-1.966.762-2.638.2-.526.464-1.05.966-1.382.28-.186.576-.285.901-.35.241-.05.483-.075.728-.093.41-.03.82-.04 1.23-.047.582-.01 1.165-.013 1.748-.015L8.148 7.8h1.454l-.518 1.92c-.864 0-1.728-.002-2.593.003-.252.001-.504 0-.756.016a.968.968 0 0 0-.264.042c-.113.04-.17.11-.22.213-.073.15-.115.31-.162.468a84.804 84.804 0 0 0-.503 1.857c-.035.14-.07.28-.1.42-.022.099-.04.197-.05.298-.01.11-.014.242.053.345.068.103.182.127.29.143.12.018.241.021.363.025.199.006.398.007.597.008.544.003 1.089.003 1.633 0 .25-.002.501-.004.752-.014.173-.007.343-.013.513-.054.13-.031.23-.08.318-.186.056-.071.1-.15.133-.235.088-.209.15-.425.213-.641.245-.83.466-1.665.692-2.499l.675-2.503.67-2.505h3.84z"},"ubiquiti":{"n":"Ubiquiti","bg":"#0559C9","p":"M23.1627 0h-1.4882v1.4882h1.4882zm-5.2072 10.4226V7.4409l.0007.001h2.9755v2.9762h2.9756v.9433c0 1.0906-.0927 2.3827-.306 3.3973-.1194.5672-.3004 1.1308-.5127 1.672-.2175.5537-.468 1.0841-.7408 1.5595a11.6795 11.6795 0 0 1-1.2456 1.7762l-.0253.0294-.0417.0488c-.1148.1347-.2283.2679-.3531.398a11.7612 11.7612 0 0 1-.4494.4492c-1.9046 1.8343-4.3861 2.98-6.9808 3.243-.3122.032-.939.0652-1.2519.0652-.3139-.001-.9397-.0331-1.252-.0651-2.5946-.263-5.0761-1.4097-6.9806-3.243a11.75 11.75 0 0 1-.4495-.4494c-.131-.1356-.249-.2748-.3683-.4154l-.0006-.0004-.0512-.0603a11.6576 11.6576 0 0 1-1.2456-1.7762c-.2727-.4763-.5233-1.0058-.7408-1.5595-.2123-.5414-.3933-1.1048-.5128-1.6718C.1854 13.743.0927 12.452.0927 11.3616V.1864h5.9518v10.2362s0 .7847.0099 1.0415l.0022.0599v.0004c.0127.332.0247.6575.0594.9812.098.919.3014 1.7913.7203 2.5288.1213.213.2443.42.3915.616.8953 1.1939 2.2577 2.0901 3.9573 2.3398.2022.0294.6108.0552.8149.0552.204 0 .6125-.0258.8149-.0552 1.6996-.2497 3.062-1.146 3.9573-2.3398.148-.196.2701-.403.3914-.616.419-.7375.6224-1.6095.7204-2.5288.0346-.3243.047-.6503.0594-.9831l.0022-.0584c.0099-.2568.0099-1.0415.0099-1.0415zm.7427-8.19h2.2326v2.2319h2.9764v2.9764h-2.9764V4.4654h-2.2326V2.2328Z"},"philipshue":{"n":"Philips Hue","bg":"#0065D3","p":"M20.672 9.6c-2.043 0-3.505 1.386-3.682 3.416h-.664c-.247 0-.395.144-.395.384 0 .24.148.384.395.384h.661c.152 2.09 1.652 3.423 3.915 3.423.944 0 1.685-.144 2.332-.453.158-.075.337-.217.292-.471a.334.334 0 0 0-.15-.242c-.104-.065-.25-.072-.422-.02a7.93 7.93 0 0 0-.352.12c-.414.146-.771.273-1.599.273-1.75 0-2.908-1.023-2.952-2.605v-.025h5.444c.313 0 .492-.164.505-.463v-.058C23.994 9.865 21.452 9.6 20.672 9.6zm2.376 3.416h-5l.004-.035c.121-1.58 1.161-2.601 2.649-2.601 1.134 0 2.347.685 2.347 2.606zM9.542 10.221c0-.335-.195-.534-.52-.534s-.52.2-.52.534v2.795h1.04zm4.29 3.817c0 1.324-.948 2.361-2.16 2.361-1.433 0-2.13-.763-2.13-2.333v-.282h-1.04v.34c0 2.046.965 3.083 2.868 3.083 1.12 0 1.943-.486 2.443-1.445l.02-.036v.861c0 .334.193.534.519.534.325 0 .52-.2.52-.534v-2.803h-1.04zm.52-4.351c-.326 0-.52.2-.52.534v2.795h1.04v-2.795c0-.335-.195-.534-.52-.534zM3.645 9.6c-1.66 0-2.31 1.072-2.471 1.4l-.135.278V7.355c0-.347-.199-.562-.52-.562-.32 0-.519.215-.519.562v5.661h1.039v-.015c0-1.249.72-2.592 2.304-2.592 1.29 0 2.001.828 2.001 2.332v.275h1.04v-.246c0-2.044-.973-3.17-2.739-3.17zM0 16.558c0 .347.199.563.52.563.32 0 .519-.216.519-.563v-2.774H0zm5.344 0c0 .347.2.563.52.563s.52-.216.52-.563v-2.774h-1.04z"},"zte":{"n":"ZTE","bg":"#0081CC","m":"Z"},"tcl":{"n":"TCL","bg":"#E4002B","m":"T"},"hisense":{"n":"Hisense","bg":"#00A99D","m":"H"},"midea":{"n":"Midea","bg":"#03B0EF","m":"M"},"haier":{"n":"Haier","bg":"#005AAB","m":"H"},"_pc":{"n":null,"g":"pc"}},"host":[["iphone","apple","phone"],["ipad","apple","tablet"],["macbook|imac|mac-?mini|mac-?pro|mac-?studio|^mac\\b","apple","pc"],["apple-?tv|appletv","apple","tv"],["homepod","apple","speaker"],["apple-?watch|ipod|airport|apple","apple",null],["redmi|xiaomi|^mi[-_ ]|^mi\\d|poco|mijia|miwifi|xiaoai|zhimi|chuangmi|yeelink|lumi-|roborock|dreame|viomi|mibox|mitv","xiaomi",null],["honor","honor","phone"],["huawei|matebook|matepad|harmony","huawei",null],["samsung|galaxy|^sm-[a-z]\\d","samsung",null],["oneplus","oneplus","phone"],["realme|^rmx\\d","realme","phone"],["oppo|^cph\\d|^pd[a-z]m\\d","oppo","phone"],["vivo|iqoo","vivo","phone"],["meizu","meizu","phone"],["pixel|chromecast|google|nest-?(hub|mini|audio|wifi)","google",null],["echo|kindle|fire-?tv|amazon|alexa","amazon",null],["nintendo","nintendo","game"],["playstation|^ps[345]\\b|^ps[345]-","playstation","game"],["xbox","microsoft","game"],["^desktop-|^laptop-|^win-|windows|surface","windows","pc"],["bravia","sony","tv"],["lenovo|thinkpad|thinkbook|legion|yoga","lenovo","pc"],["dell|xps|inspiron|latitude|optiplex","dell","pc"],["^hp[-_]|hewlett|laserjet|deskjet|officejet|envy|pavilion|elitebook","hp",null],["asus|rog-|zenbook|vivobook","asus",null],["tp-?link|^tl-|deco","tplink",null],["raspberry|^rpi|raspi","raspberrypi","pc"],["synology|diskstation|^ds\\d{3}","synology","nas"],["^esp[-_]|esp32|esp8266|tasmota|espressif","espressif","iot"],["lgwebos|^lg[-_]","lg","tv"],["roku","roku","tv"],["dji","dji",null],["unifi|ubnt|ubiquiti","ubiquiti",null],["hue-?bridge|philips-?hue","philipshue","iot"],["hisense|vidaa","hisense","tv"],["tcl","tcl","tv"],["midea","midea","iot"],["haier","haier","iot"],["zte","zte",null],["^android|android-","android","phone"],["printer|epson|canon|brother",null,"printer"],["camera|ipcam|^ipc|ezviz|hikvision|imou|xiaovv",null,"camera"],["tv\\b|-tv|tv-|电视",null,"tv"],["speaker|sonos",null,"speaker"],["phone|手机",null,"phone"],["pad\\b|tablet|平板",null,"tablet"],["nas\\b",null,"nas"],["pc\\b|desktop|laptop|notebook|电脑",null,"pc"]],"oui":{"apple":"AAOTAAUCAAonAAqVAA2TABD6ABEkABRRABbLABfyABnjABtjAByzAB1PAB5SAB7CAB9bAB/zACHpACJBACMSACMyACNsACPfACQ2ACUAACVLACW8ACYIACZKACawACa7ADBlAD7hAFDkAFbNAFuUAGFxAGbcAG1SAH1gAIEqAIhlAIp2AJI1AJfxAKBAALNiAMWFAMYQAM3+ANtwAPOfAPS5APdvBAzOBBN6BBVSBB5kBCZlBC7BBDTPBEGlBEiaBEvtBFLzBFRTBGhlBGn4BHKVBHLvBJm5BJm7BJ0FBLWyBLxtBL/VBNPPBNtWBOU2BPE+BPfkCAAHCCQLCCVzCCy2CF1TCGICCGUYCGaYCG1BCHBFCHQCCIfHCI7cCJVCCMcpCMe1COZLCOaJCPSrCPacCPi8CP9EDBU5DBVjDBn4DC1xDDAhDDtQDD6fDE3pDFEBDFF+DFO3DGrEDG+LDHTCDHcaDIXhDKOyDLyfDMVsDMxdDM5rDNdGDNvqDORBDOWhDPvPEAAgEBwMEClZEC/KEDAlEEDzEEF/EEIQEH3IEJPpEJS7EJrdEJ5rEJ9BEKHaEKLTEKTJELWIELnEEL06EM7pEM8PENpjEN2xEOLJFASYFBCfFBR9FBqXFBugFCBeFCh2FC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Q0xAOoxA8IxCNgxDqlxD0axEdOxHWrxIUIxL3lxNDjxNmHxP+ZyAmoyBVOyCFYyDSOyFizyFjAyF6pyG4IyIqayJXOyLKbyMueyOJlyPczyP8ozBUxzC9xzD2CzEdAzLDazMUwzNmszPnk0DlX0Dwf0FNJ0Fd70Fd+0GV40H410KvV0MXT0MY30N+a0OeC1CWL1DsE1FSL1G1t1JSp1Jr21Kth1NJS1NhT1OmK1PMt2Du/2L9C2MCm2PLK2PO82PiD2PyT3Buh3CFI3CFc3EGp3EVG3EYo3FNg3HGW3IXe3Iso3JAJ3Je63Klx3PUF3PtI4Ar24Cvp4C4L4Dqq4HJW4I9M4JRn4J0x4Lml4MJk4Mky4NBF4NRk4NTo4NVd4OJY5AKb5A025B/V5EKm5Erg5F435GAX5HC45KRx5Keg5Krq5LMY5Mdn5Pic5Pr95P1F6CpE6Crq6GF+6GK+6ISl6LDF6LH86L+46L/h6MdP6Mgp6ND86NgZ6PQI6Psc7C6Y7DpW7EyM7GPX7I537Oen7O0E7PM88AOM8CD/8EIc8Fem8Gjj8HfD8J5K8LK58LYe8NQV8NW/9AZp9CZ59DvY9EY39E7j9Grd9G0/9HsJ9IxQ9JY09KR19LMB9MiK9M4j9NEI+BZU+CgZ+DRB+D3G+FT2+Flx+F6g+GM/+JTC+J6U+KLW+Kxl+LVN+M9S+OTj+PIe+P5e/ESC/G13/Hd0/J5T/LOq/LO8/Piu"}}; + if (typeof C.onBrands === 'function') C.onBrands(); +})(window.Carbon = window.Carbon || {}); diff --git a/luci-theme-carbon/htdocs/luci-static/carbon/carbon.css b/luci-theme-carbon/htdocs/luci-static/carbon/carbon.css new file mode 100644 index 000000000..6d51f5418 --- /dev/null +++ b/luci-theme-carbon/htdocs/luci-static/carbon/carbon.css @@ -0,0 +1,3157 @@ +/*! + * Carbon — an Apple-style LuCI theme for everyday users + * Licensed under the Apache License 2.0. + * + * Widget behaviour rules (dropdowns, dynlists, tabs, modals, tooltips …) + * mirror luci-theme-bootstrap so all LuCI views keep working; only the + * visual layer is redesigned. + */ +/* Generated by scripts/build-css.py from styles/*.css. Do not edit. */ + +/* ========================================================================== + 1. Design tokens + ========================================================================== */ + +:root { + /* Carbon palette — status & data colours */ + --cb-blue: #3b82f6; + --cb-green: #16a34a; + --cb-orange: #e8870b; + --cb-red: #e5484d; + --cb-purple: #8b5cf6; + --cb-teal: #0d9f9b; + --cb-indigo: #4f5bea; + --cb-pink: #e2367f; + --cb-yellow: #eab308; + --cb-gray: #8b91a1; + + --cb-green-t: rgba(22, 163, 74, .12); + --cb-orange-t: rgba(232, 135, 11, .13); + --cb-red-t: rgba(229, 72, 77, .11); + + /* Carbon indigo — the one accent used for actions, focus and selection */ + --cb-accent: #4f5bea; + --cb-accent-strong: #3d49d6; + --cb-accent-t: rgba(79, 91, 234, .11); + --cb-focus: rgba(79, 91, 234, .26); + --cb-on-accent: #ffffff; + + /* surfaces */ + --cb-bg: #f3f4f8; + --cb-card: rgba(255, 255, 255, .84); + --cb-card-solid: #ffffff; + --cb-card-2: rgba(15, 23, 42, .025); + --cb-card-edge: rgba(15, 23, 42, .06); + --cb-field: #ffffff; + --cb-fill: rgba(15, 23, 42, .06); + --cb-fill-2: rgba(15, 23, 42, .035); + --cb-hover: rgba(79, 91, 234, .05); + + --cb-text: #1a1f36; + --cb-text-2: rgba(26, 31, 54, .62); + --cb-text-3: rgba(26, 31, 54, .36); + + --cb-sep: rgba(15, 23, 42, .07); + --cb-border: rgba(15, 23, 42, .08); + --cb-border-strong: rgba(15, 23, 42, .15); + + --cb-toolbar: rgba(243, 244, 248, .74); + --cb-popover: rgba(255, 255, 255, .88); + + --cb-shadow: 0 0 0 1px var(--cb-card-edge), 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -18px rgba(30, 41, 90, .22); + --cb-shadow-pop: 0 0 0 1px var(--cb-card-edge), 0 22px 50px -14px rgba(30, 41, 90, .3); + + --cb-radius: 18px; + --cb-radius-md: 12px; + --cb-radius-sm: 10px; + + --cb-font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif; + --cb-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace; + --cb-ease: cubic-bezier(.25, .1, .25, 1); + + --cb-content-max: 1240px; + /* dashboards and table pages grow with the screen (see 16-responsive) */ + --cb-content-wide: 1240px; + + color-scheme: light; +} + +:root[data-darkmode="true"] { + --cb-blue: #60a5fa; + --cb-green: #34d399; + --cb-orange: #fbb03b; + --cb-red: #f87171; + --cb-purple: #a78bfa; + --cb-teal: #2dd4bf; + --cb-indigo: #8b95ff; + --cb-pink: #f472b6; + --cb-yellow: #facc15; + --cb-gray: #9aa1b2; + + --cb-green-t: rgba(52, 211, 153, .14); + --cb-orange-t: rgba(251, 176, 59, .15); + --cb-red-t: rgba(248, 113, 113, .15); + + --cb-accent: #8b95ff; + --cb-accent-strong: #aab3ff; + --cb-accent-t: rgba(139, 149, 255, .16); + --cb-focus: rgba(139, 149, 255, .32); + --cb-on-accent: #0e1024; + + --cb-bg: #0c0d12; + --cb-card: rgba(24, 26, 34, .8); + --cb-card-solid: #181a22; + --cb-card-2: rgba(255, 255, 255, .03); + --cb-card-edge: rgba(255, 255, 255, .06); + --cb-field: rgba(255, 255, 255, .045); + --cb-fill: rgba(255, 255, 255, .08); + --cb-fill-2: rgba(255, 255, 255, .05); + --cb-hover: rgba(255, 255, 255, .04); + + --cb-text: #e9ebf5; + --cb-text-2: rgba(233, 235, 245, .6); + --cb-text-3: rgba(233, 235, 245, .32); + + --cb-sep: rgba(255, 255, 255, .07); + --cb-border: rgba(255, 255, 255, .08); + --cb-border-strong: rgba(255, 255, 255, .15); + + --cb-toolbar: rgba(12, 13, 18, .7); + --cb-popover: rgba(30, 32, 42, .9); + + --cb-shadow: 0 0 0 1px var(--cb-card-edge), 0 10px 30px -18px rgba(0, 0, 0, .7); + --cb-shadow-pop: 0 0 0 1px var(--cb-card-edge), 0 24px 56px -14px rgba(0, 0, 0, .75); + + color-scheme: dark; +} + +/* ========================================================================== + 2. Base + ========================================================================== */ + +*, *::before, *::after { box-sizing: border-box; } + +html { + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; +} + +body { + margin: 0; + min-height: 100vh; + background: var(--cb-bg); + color: var(--cb-text); + font: 14px/1.5 var(--cb-font); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-feature-settings: "kern"; +} + +a { color: var(--cb-accent); text-decoration: none; } +/* :where() keeps hover underline at class specificity, so button-like links + can opt out without !important */ +:where(a):hover { text-decoration: underline; text-underline-offset: 2px; } + +h1, h2, h3, h4, h5, h6 { margin: 0 0 .5em; font-weight: 600; line-height: 1.25; color: var(--cb-text); } +h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; } +h3 { font-size: 17px; } +h4 { font-size: 15px; } +h5 { font-size: 14px; } +p { margin: 0 0 .75em; } +hr { border: 0; border-top: 1px solid var(--cb-sep); margin: 16px 0; } +small { font-size: 12px; } +code, kbd, pre, samp, var, tt { font-family: var(--cb-mono); font-size: 12.5px; } +pre { + background: var(--cb-card-2); + border: 1px solid var(--cb-sep); + border-radius: var(--cb-radius-sm); + padding: 10px 12px; + overflow: auto; + white-space: pre-wrap; +} +img { max-width: 100%; } +ul, ol { padding-left: 1.4em; } +abbr[title] { text-decoration: underline dotted; cursor: help; } +strong, b { font-weight: 600; } +em { font-style: normal; color: var(--cb-text-2); } +fieldset { border: 0; margin: 0 0 16px; padding: 0; } +legend { font-size: 17px; font-weight: 600; padding: 0 0 8px; } + +::selection { background: var(--cb-accent-t); } +:focus-visible { outline: 3px solid var(--cb-focus); outline-offset: 1px; } + +.hidden { display: none !important; } +.left { text-align: left !important; } +.right { text-align: right !important; } +.center { text-align: center !important; } +.top { vertical-align: top !important; } +.middle { vertical-align: middle !important; } +.bottom { vertical-align: bottom !important; } +.pull-right { float: right; } +.pull-left { float: left; } +form.inline { display: inline; margin: 0; } +.nowrap { white-space: nowrap; } + +/* ========================================================================== + 3. App shell — sidebar, toolbar, content + ========================================================================== */ + +.cb-app { + display: flex; + min-height: 100vh; +} + +/* ---- Carbon glass sidebar ------------------------------------------- + A floating frosted panel over a soft ambient backdrop. Monochrome line + icons sit in small glass chips; the active page gets a solid Carbon + indigo chip, a soft glow and an edge indicator. No gradients on controls. + ---------------------------------------------------------------------- */ +:root { + --cb-side-w: 264px; + --cb-side-w-mini: 76px; + --cb-gutter: 12px; + + + --cb-amb-1: rgba(79, 91, 234, .16); + --cb-amb-2: rgba(139, 92, 246, .13); + --cb-amb-3: rgba(45, 212, 191, .13); + + --cb-glass: rgba(255, 255, 255, .56); + --cb-glass-solid: #f6f7fb; + --cb-glass-edge: rgba(255, 255, 255, .8); + --cb-glass-line: rgba(15, 23, 42, .07); + --cb-glass-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 18px 50px -12px rgba(30, 41, 90, .22), 0 2px 8px rgba(30, 41, 90, .06); + --cb-chip: rgba(255, 255, 255, .7); + --cb-chip-edge: rgba(15, 23, 42, .07); + --cb-nav-fg: #27304a; + --cb-nav-fg-2: rgba(39, 48, 74, .62); + --cb-nav-hover: rgba(79, 91, 234, .06); + --cb-nav-active-fg: var(--cb-accent-strong); + --cb-seg-track: rgba(15, 23, 42, .06); + --cb-seg-thumb: #ffffff; +} +:root[data-darkmode="true"] { + --cb-amb-1: rgba(37, 99, 235, .26); + --cb-amb-2: rgba(124, 58, 237, .22); + --cb-amb-3: rgba(20, 184, 166, .12); + + --cb-glass: rgba(26, 28, 36, .58); + --cb-glass-solid: #16171d; + --cb-glass-edge: rgba(255, 255, 255, .08); + --cb-glass-line: rgba(255, 255, 255, .07); + --cb-glass-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 18px 50px -10px rgba(0, 0, 0, .6); + --cb-chip: rgba(255, 255, 255, .06); + --cb-chip-edge: rgba(255, 255, 255, .07); + --cb-nav-fg: #e7e9f3; + --cb-nav-fg-2: rgba(231, 233, 243, .58); + --cb-nav-hover: rgba(255, 255, 255, .06); + --cb-nav-active-fg: var(--cb-accent-strong); + --cb-seg-track: rgba(255, 255, 255, .07); + --cb-seg-thumb: rgba(255, 255, 255, .16); +} + +/* ambient backdrop — gives the glass something to refract */ +.cb-app::before { + content: ""; + position: fixed; + inset: 0; + z-index: -1; + pointer-events: none; + background: + radial-gradient(620px 520px at -4% -6%, var(--cb-amb-1), transparent 70%), + radial-gradient(560px 520px at -2% 104%, var(--cb-amb-2), transparent 70%), + radial-gradient(700px 560px at 104% 18%, var(--cb-amb-3), transparent 70%); +} + +.cb-sidebar { + position: fixed; + z-index: 300; + top: var(--cb-gutter); + bottom: var(--cb-gutter); + left: var(--cb-gutter); + width: var(--cb-side-w); + display: flex; + flex-direction: column; + padding: 14px 10px 10px; + border-radius: 22px; + border: 1px solid var(--cb-glass-edge); + background: var(--cb-glass-solid); + box-shadow: var(--cb-glass-shadow); + color: var(--cb-nav-fg); + transition: width .3s var(--cb-ease), transform .3s var(--cb-ease), padding .3s var(--cb-ease); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-sidebar { + background: var(--cb-glass); + -webkit-backdrop-filter: blur(28px) saturate(170%); + backdrop-filter: blur(28px) saturate(170%); + } +} +/* top sheen */ +.cb-sidebar::before { + content: ""; + position: absolute; + inset: 0; + border-radius: inherit; + pointer-events: none; + background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 120px); + opacity: .7; +} +:root[data-darkmode="true"] .cb-sidebar::before { background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 120px); opacity: 1; } +.cb-sidebar > * { position: relative; } + +/* brand */ +.cb-brand { + display: flex; + align-items: center; + gap: 11px; + min-height: 44px; + padding: 2px 6px 12px; + color: var(--cb-nav-fg); + text-decoration: none; +} +.cb-brand-logo { + width: 38px; + height: 38px; + flex: none; + border-radius: 12px; + box-shadow: 0 6px 16px -6px rgba(79, 91, 234, .6); +} +/* uploaded logo: any aspect ratio, no brand-coloured glow */ +.cb-brand-logo[data-custom] { object-fit: contain; border-radius: 10px; box-shadow: none; } +.cb-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; } +.cb-brand-text strong { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.cb-brand-text small { color: var(--cb-nav-fg-2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +/* collapse handle on the panel edge */ +.cb-collapse { + position: absolute !important; + z-index: 2; + top: 24px; + right: -13px; + display: inline-flex; + align-items: center; + justify-content: center; + width: 26px; + height: 26px; + padding: 0; + border: 1px solid var(--cb-glass-edge); + border-radius: 50%; + background: var(--cb-glass-solid); + color: var(--cb-nav-fg-2); + box-shadow: 0 4px 12px rgba(30, 41, 90, .16); + cursor: pointer; + opacity: 0; + transition: opacity .2s var(--cb-ease), color .2s, transform .3s var(--cb-ease); +} +.cb-collapse svg { width: 14px; height: 14px; } +.cb-sidebar:hover .cb-collapse, +.cb-collapse:focus-visible { opacity: 1; } +.cb-collapse:hover { color: var(--cb-nav-active-fg); } + +/* mode switch */ +.cb-mode { padding: 0 4px 6px; } +.cb-mode .cb-seg { width: 100%; } + +/* nav list */ +.cb-nav { + flex: 1; + overflow-y: auto; + overflow-x: hidden; + margin: 0 -10px; + padding: 2px 10px 12px; + scrollbar-width: none; +} +.cb-nav::-webkit-scrollbar { display: none; } + +.cb-nav-sect { + padding: 16px 12px 6px; + color: var(--cb-nav-fg-2); + font-size: 10.5px; + font-weight: 700; + letter-spacing: .1em; + text-transform: uppercase; + white-space: nowrap; + overflow: hidden; +} +.cb-nav-sect:first-child { padding-top: 8px; } + +.cb-nav-link, +.cb-nav-head { + position: relative; + display: flex; + align-items: center; + gap: 11px; + width: 100%; + height: 42px; + margin: 2px 0; + padding: 0 10px 0 6px; + border: 0; + border-radius: 13px; + background: transparent; + color: var(--cb-nav-fg); + font: inherit; + font-size: 13.5px; + font-weight: 500; + text-align: left; + text-decoration: none; + cursor: pointer; + transition: background-color .18s var(--cb-ease), color .18s var(--cb-ease); +} +.cb-nav-link:hover, +.cb-nav-head:hover { background: var(--cb-nav-hover); } + +/* plain line icon — no chip, no fill; state is shown by colour only */ +.cb-nav-ico { + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 24px; + height: 30px; + color: var(--cb-nav-fg-2); + transition: color .18s var(--cb-ease); +} +.cb-nav-ico svg { width: 18px; height: 18px; stroke-width: 1.8; } +.cb-nav-link:hover .cb-nav-ico, +.cb-nav-head:hover .cb-nav-ico { color: var(--cb-nav-fg); } + +.cb-nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +/* active page: colour only — no background, no edge indicator */ +.cb-nav-link.active { + color: var(--cb-nav-active-fg); + font-weight: 600; +} +.cb-nav-link.active .cb-nav-ico, +.cb-nav-group.active > .cb-nav-head .cb-nav-ico { color: var(--cb-accent); } +.cb-nav-group.active > .cb-nav-head { color: var(--cb-nav-fg); font-weight: 600; } + +.cb-chev { + flex: none; + width: 14px; + height: 14px; + color: var(--cb-nav-fg-2); + opacity: .7; + transition: transform .25s var(--cb-ease); +} +.cb-chev svg { width: 14px; height: 14px; display: block; } +.cb-nav-group.open > .cb-nav-head .cb-chev { transform: rotate(90deg); } + +/* sub pages */ +.cb-nav-items { + display: grid; + grid-template-rows: 0fr; + transition: grid-template-rows .26s var(--cb-ease); +} +.cb-nav-group.open > .cb-nav-items { grid-template-rows: 1fr; } +.cb-nav-items > .cb-nav-sub { + position: relative; + overflow: hidden; + min-height: 0; + padding-left: 24px; +} +/* guide line under the category icon */ +.cb-nav-items > .cb-nav-sub::before { + content: ""; + position: absolute; + left: 17.5px; + top: 0; + bottom: 14px; + width: 1px; + background: var(--cb-glass-line); +} + +.cb-nav-item { + position: relative; + display: flex; + align-items: center; + gap: 10px; + height: 34px; + margin: 1px 0; + padding: 0 10px; + border-radius: 10px; + color: var(--cb-nav-fg-2); + font-size: 13px; + font-weight: 500; + text-decoration: none; + white-space: nowrap; + transition: background-color .18s var(--cb-ease), color .18s var(--cb-ease); +} +.cb-nav-item:hover { background: var(--cb-nav-hover); color: var(--cb-nav-fg); } +.cb-nav-item.active { color: var(--cb-nav-active-fg); font-weight: 600; } +.cb-nav-item.active .cb-sub-ico { color: var(--cb-accent); } +/* sub pages keep a short highlight on the guide line */ +.cb-nav-sub > .cb-nav-item.active::before { + content: ""; + position: absolute; + left: -7.5px; + top: 50%; + width: 3px; + height: 16px; + margin-top: -8px; + border-radius: 2px; + background: var(--cb-accent); +} +.cb-sub-ico { display: inline-flex; flex: none; width: 16px; height: 16px; opacity: .85; } +.cb-sub-ico svg { width: 16px; height: 16px; stroke-width: 1.8; } +.cb-nav-item.active .cb-sub-ico { opacity: 1; } + +/* hint card in simple mode */ +.cb-nav-hint { + display: flex; + gap: 10px; + margin: 18px 2px 0; + padding: 12px; + border-radius: 14px; + border: 1px solid var(--cb-chip-edge); + background: var(--cb-chip); + color: var(--cb-nav-fg-2); + font-size: 12px; + line-height: 1.5; +} +.cb-nav-hint a { font-weight: 600; color: var(--cb-nav-active-fg); } +.cb-nav-hint-ico { + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 20px; + height: 20px; + color: var(--cb-accent); +} +.cb-nav-hint-ico svg { width: 18px; height: 18px; } + +/* footer */ +.cb-sidebar-foot { + display: flex; + align-items: center; + gap: 8px; + padding: 10px 4px 2px; + border-top: 1px solid var(--cb-glass-line); +} +.cb-sidebar-foot .cb-seg { flex: 1; } + +/* language switch in the sidebar footer (bottom-left) */ +.cb-lang { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; transition: opacity .2s; } +.cb-lang-ico { display: inline-flex; flex: none; width: 18px; height: 18px; color: var(--cb-nav-fg-2); } +.cb-lang-ico svg { width: 18px; height: 18px; } +.cb-lang .cb-seg-btn { font-size: 12px; font-weight: 600; } +.cb-lang.busy { opacity: .55; pointer-events: none; } +.cb-lang.err .cb-seg, +.cb-lang.err .cb-lb, +.cb-lang.err .cb-mini { box-shadow: 0 0 0 1.5px var(--cb-red); } +.cb-lang-mini { font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; } +.cb-lang .cb-lb { flex: 1; min-width: 0; } +.cb-logout { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 5px; + height: 30px; + padding: 0 10px; + border-radius: 9px; + color: var(--cb-red); + font-size: 12.5px; + font-weight: 600; + white-space: nowrap; + text-decoration: none; +} +.cb-logout:hover { background: var(--cb-red-t); } +.cb-logout svg { width: 16px; height: 16px; } + +/* icon-only buttons used on the rail */ +.cb-mini { + display: none; + align-items: center; + justify-content: center; + width: 40px; + height: 36px; + margin: 0 auto; + padding: 0; + border: 0; + border-radius: 11px; + background: transparent; + color: var(--cb-nav-fg-2); + cursor: pointer; +} +.cb-mini:hover { background: var(--cb-nav-hover); color: var(--cb-nav-fg); } +.cb-mini svg { width: 17px; height: 17px; } + +/* flyout next to the rail */ +.cb-fly { + position: fixed; + z-index: 1000; + min-width: 200px; + max-width: 280px; + padding: 6px; + border-radius: 16px; + border: 1px solid var(--cb-glass-edge); + background: var(--cb-glass-solid); + box-shadow: var(--cb-glass-shadow); + color: var(--cb-nav-fg); + opacity: 0; + visibility: hidden; + transform: translateX(-6px); + transition: opacity .16s var(--cb-ease), transform .16s var(--cb-ease), visibility .16s; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-fly { + background: var(--cb-glass); + -webkit-backdrop-filter: blur(28px) saturate(170%); + backdrop-filter: blur(28px) saturate(170%); + } +} +/* visible at once when opening, so keyboard focus can move into it */ +.cb-fly.show { opacity: 1; visibility: visible; transform: none; transition-property: opacity, transform; } +.cb-fly-title { padding: 6px 10px 6px; color: var(--cb-nav-fg-2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; } +.cb-fly.cb-fly-tip { min-width: 0; padding: 4px; border-radius: 10px; } +.cb-fly.cb-fly-tip .cb-fly-title { padding: 4px 8px; color: var(--cb-nav-fg); font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; } +.cb-fly .cb-nav-item.active::before { display: none; } + +/* ---- collapsed rail (desktop only) ---- */ +@media (min-width: 1024px) { + html.cb-collapsed .cb-sidebar { width: var(--cb-side-w-mini); padding-left: 8px; padding-right: 8px; } + html.cb-collapsed .cb-collapse { opacity: 1; transform: rotate(180deg); } + html.cb-collapsed .cb-brand { justify-content: center; padding-left: 0; padding-right: 0; } + html.cb-collapsed .cb-brand-text, + html.cb-collapsed .cb-sidebar .cb-nav-label, + html.cb-collapsed .cb-chev, + html.cb-collapsed .cb-nav-items, + html.cb-collapsed .cb-nav-hint, + html.cb-collapsed .cb-mode .cb-seg, + html.cb-collapsed .cb-sidebar-foot .cb-seg, + html.cb-collapsed .cb-lang .cb-lb, + html.cb-collapsed .cb-lang-ico, + html.cb-collapsed .cb-logout span { display: none; } + html.cb-collapsed .cb-mini { display: inline-flex; } + html.cb-collapsed .cb-mode { padding: 0 0 4px; display: flex; } + html.cb-collapsed .cb-nav { margin: 0 -8px; padding: 2px 8px 12px; } + html.cb-collapsed .cb-nav-sect { + height: 1px; + margin: 12px 14px; + padding: 0; + background: var(--cb-glass-line); + font-size: 0; + } + html.cb-collapsed .cb-nav-sect:first-child { margin-top: 6px; } + html.cb-collapsed .cb-nav-link, + html.cb-collapsed .cb-nav-head { justify-content: center; padding: 0; } + html.cb-collapsed .cb-nav-ico { width: 36px; height: 36px; } + html.cb-collapsed .cb-nav-ico svg { width: 20px; height: 20px; } + html.cb-collapsed .cb-sidebar-foot { flex-direction: column; gap: 6px; padding: 10px 0 2px; } + html.cb-collapsed .cb-lang { flex: none; justify-content: center; } + html.cb-collapsed .cb-logout { width: 40px; height: 36px; padding: 0; } + html.cb-collapsed .cb-main { margin-left: calc(var(--cb-side-w-mini) + var(--cb-gutter) * 2); } +} +.cb-main { transition: margin-left .3s var(--cb-ease); } + +/* ---- segmented control ---- */ +.cb-seg { + --n: 2; + --i: 0; + position: relative; + display: inline-flex; + padding: 2px; + border-radius: 11px; + background: var(--cb-seg-track); + isolation: isolate; +} +.cb-seg::before { + content: ""; + position: absolute; + z-index: -1; + top: 2px; + bottom: 2px; + left: 2px; + width: calc((100% - 4px) / var(--n)); + border-radius: 9px; + background: var(--cb-seg-thumb); + box-shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 0 0 .5px rgba(15, 23, 42, .04); + transform: translateX(calc(var(--i) * 100%)); + transition: transform .25s var(--cb-ease); +} +.cb-seg > .cb-seg-btn { + flex: 1 1 0; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 4px; + min-width: 0; + height: 28px; + padding: 0 10px; + border: 0; + border-radius: 9px; + background: transparent; + color: var(--cb-text); + font: inherit; + font-size: 12.5px; + font-weight: 500; + white-space: nowrap; + cursor: pointer; +} +.cb-seg > .cb-seg-btn[aria-checked="false"] { color: var(--cb-text-2); } +.cb-seg > .cb-seg-btn svg { width: 15px; height: 15px; } + +/* ---- main ---- */ +.cb-main { + flex: 1; + min-width: 0; + margin-left: calc(var(--cb-side-w) + var(--cb-gutter) * 2); + display: flex; + flex-direction: column; + min-height: 100vh; +} + +.cb-toolbar { + position: sticky; + z-index: 200; + top: 0; + display: flex; + align-items: center; + gap: 12px; + min-height: 52px; + padding: 8px 28px 8px 16px; + background: var(--cb-bg); + border-bottom: .5px solid transparent; + transition: border-color .2s var(--cb-ease); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-toolbar { + background: var(--cb-toolbar); + -webkit-backdrop-filter: saturate(180%) blur(20px); + backdrop-filter: saturate(180%) blur(20px); + } +} +.cb-scrolled .cb-toolbar { border-bottom-color: var(--cb-border); } + +.cb-title { + flex: 1; + min-width: 0; + display: flex; + align-items: center; + gap: 6px; + font-size: 15px; + font-weight: 600; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.cb-title .cb-crumb { color: var(--cb-text-2); font-weight: 500; } +.cb-title .cb-crumb-sep { width: 12px; height: 12px; color: var(--cb-text-3); flex: none; } + +.cb-burger { + display: none; + position: relative; + width: 34px; + height: 34px; + margin-left: -6px; + border: 0; + border-radius: 8px; + background: transparent; + cursor: pointer; +} +.cb-burger:hover { background: var(--cb-hover); } +.cb-burger span, +.cb-burger span::before, +.cb-burger span::after { + position: absolute; + left: 9px; + width: 16px; + height: 1.75px; + border-radius: 2px; + background: var(--cb-text); +} +.cb-burger span { top: 16px; } +.cb-burger span::before, +.cb-burger span::after { content: ""; left: 0; } +.cb-burger span::before { top: -5px; } +.cb-burger span::after { top: 5px; } + +/* theme switch in the toolbar (top-right) */ +.cb-appearance { flex: none; } +.cb-appearance:empty { display: none; } +.cb-appearance .cb-seg-btn { height: 26px; min-width: 32px; padding: 0 8px; } +.cb-appearance .cb-seg-btn svg { width: 15px; height: 15px; } + +.cb-github { + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 32px; + height: 32px; + border-radius: 8px; + color: var(--cb-text-2); + transition: color .2s var(--cb-ease), background .2s var(--cb-ease); +} +.cb-github svg { width: 19px; height: 19px; } +.cb-github:hover { color: var(--cb-accent); background: var(--cb-hover); } +.cb-github:focus-visible { outline: 2px solid var(--cb-accent); outline-offset: 2px; } + +.cb-indicators, +#indicators { + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + gap: 6px; +} + +[data-indicator] { + display: inline-flex; + align-items: center; + gap: 6px; + height: 26px; + padding: 0 10px; + border-radius: 8px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 12px; + font-weight: 600; + white-space: nowrap; +} +[data-indicator][data-clickable] { cursor: pointer; } +[data-indicator][data-clickable]:hover { filter: brightness(.96); } +[data-indicator][data-style="active"] { + background: var(--cb-orange-t); + color: var(--cb-orange); +} +[data-indicator][data-style="active"]::before { + content: ""; + width: 7px; + height: 7px; + border-radius: 50%; + background: currentColor; +} +[data-indicator="poll-status"][data-style="active"] { + background: var(--cb-green-t); + color: var(--cb-green); +} + +.cb-content { + flex: 1; + width: 100%; + max-width: var(--cb-content-max); + margin: 0 auto; + padding: 12px 28px 28px; +} + +.cb-footer { + width: 100%; + max-width: var(--cb-content-max); + margin: 0 auto; + padding: 8px 28px 28px; + color: var(--cb-text-3); + font-size: 12px; +} +.cb-footer a { color: var(--cb-text-2); } + +.cb-scrim { display: none; } + +/* ========================================================================== + 4. Login page + ========================================================================== */ + +body.cb-login { + display: flex; + align-items: center; + justify-content: center; + padding: 24px 16px; + background: + radial-gradient(900px 620px at 10% 0%, var(--cb-amb-1), transparent 65%), + radial-gradient(800px 640px at 95% 100%, var(--cb-amb-2), transparent 65%), + radial-gradient(700px 520px at 90% 10%, var(--cb-amb-3), transparent 65%), + var(--cb-bg); + background-attachment: fixed; +} +.cb-login-wrap { width: 100%; max-width: 380px; } +.cb-login-brand { text-align: center; margin-bottom: 22px; } +.cb-login-logo { + width: 72px; + height: 72px; + border-radius: 17px; + box-shadow: 0 12px 30px -8px rgba(79, 91, 234, .55); +} +.cb-login-logo[data-custom] { object-fit: contain; box-shadow: none; } +.cb-login-brand h1 { margin: 16px 0 0; font-size: 24px; font-weight: 700; } + +.cb-login-card { + padding: 22px 22px 18px; + border-radius: 22px; + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-login-card { + -webkit-backdrop-filter: saturate(180%) blur(30px); + backdrop-filter: saturate(180%) blur(30px); + } +} +.cb-login-card .cbi-map { margin: 0; } +.cb-login-card .cbi-map > h2 { display: none; } +.cb-login-card .cbi-map-descr { margin: 0 0 14px; text-align: center; color: var(--cb-text-2); font-size: 13px; } +.cb-login-card .cbi-section { margin: 0; padding: 0; background: none; box-shadow: none; border: 0; } +.cb-login-card .cbi-section-node { background: none; box-shadow: none; border: 0; border-radius: 0; padding: 0; } +.cb-login-card .cbi-value { + display: block; + padding: 0; + margin: 0 0 12px; + border: 0 !important; +} +.cb-login-card .cbi-value-title { + display: block; + width: auto !important; + padding: 0 0 5px 2px !important; + text-align: left !important; + font-size: 12.5px; + color: var(--cb-text-2); +} +.cb-login-card .cbi-value-field { margin: 0; } +.cb-login-card .cbi-value-field input:where(:not([type="checkbox"]):not([type="radio"])) { + width: 100%; + height: 42px; + font-size: 15px; + border-radius: 10px; +} +.cb-login-card .cbi-page-actions { + position: static; + display: flex; + flex-direction: column; + gap: 8px; + margin: 18px 0 0; + padding: 0; + background: none; + border: 0; + box-shadow: none; + -webkit-backdrop-filter: none; + backdrop-filter: none; +} +.cb-login-card .cbi-page-actions .cbi-button { + width: 100%; + height: 42px; + margin: 0; + font-size: 15px; + border-radius: 10px; +} +.cb-login-card .cbi-page-actions .cbi-button-reset { display: none; } +.cb-login-card .alert-message { margin-bottom: 14px; animation: cb-shake .4s var(--cb-ease); } +.cb-login-foot { margin: 18px 0 0; text-align: center; color: var(--cb-text-3); font-size: 12px; } + +@keyframes cb-shake { + 0%, 100% { transform: translateX(0); } + 20%, 60% { transform: translateX(-6px); } + 40%, 80% { transform: translateX(6px); } +} + +/* ========================================================================== + 5. LuCI page structure — maps, sections, value rows + ========================================================================== */ + +#view > h2, +.cbi-map > h2, +#maincontent > h2, +#view > .cbi-map > h2, +h2[name="content"] { + margin: 8px 0 6px; + font-size: 26px; + font-weight: 750; + letter-spacing: -.022em; +} + +.cbi-map-descr, +.cbi-section-descr, +.cbi-tab-descr { + margin: 0 0 18px; + color: var(--cb-text-2); + font-size: 13.5px; + line-height: 1.55; + max-width: 760px; +} +.cbi-section-descr:empty, .cbi-map-descr:empty { display: none; } + +.cbi-map { margin-bottom: 20px; } +.cbi-map > .cbi-section:first-of-type { margin-top: 10px; } + +.cbi-section, +.cbi-tblsection { + margin: 0 0 22px; +} +.cbi-section > h3, +.cbi-section > legend, +.cbi-tblsection > h3 { + margin: 0 0 10px; + padding: 0 4px; + font-size: 11px; + font-weight: 700; + color: var(--cb-text-2); + text-transform: uppercase; + letter-spacing: .09em; +} +.cbi-section > h3:empty { display: none; } + +.cbi-section-node, +.cbi-section > .table, +.cbi-section > .cbi-section-table, +.cbi-tblsection > .table, +#view > .table, +#view > .cbi-section > div:not([class]) > .table { + background: var(--cb-card); + border-radius: var(--cb-radius); + box-shadow: var(--cb-shadow); +} +.cbi-section-node { + padding: 4px 20px; +} +.cbi-section-node-tabbed { padding-top: 14px; } +.cbi-section-node:empty { display: none; } + +.cbi-section > div:not([class]):not([id]) > .cbi-value:first-child { margin-top: 0; } + +/* value rows */ +.cbi-value { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 6px 20px; + padding: 14px 0; + border-top: 1px solid var(--cb-sep); +} +.cbi-section-node > .cbi-value:first-child, +.cbi-section-node > [data-tab] > .cbi-value:first-child, +.cbi-section-node > div > .cbi-value:first-child, +[data-tab-title] > .cbi-value:first-of-type { border-top: 0; } + +.cbi-value-title, +.cbi-value label.cbi-value-title { + flex: 0 0 210px; + padding: 0; + color: var(--cb-text); + font-size: 13.5px; + font-weight: 600; + line-height: 1.4; + text-align: left; + word-break: break-word; +} +.cbi-value-field { + flex: 1 1 280px; + min-width: 0; + line-height: 1.5; +} +.cbi-value > .cbi-section, +.cbi-value > .cbi-tblsection { width: 100%; } +.cbi-value-field > .cbi-checkbox, +.cbi-value-field > div > .cbi-radio { min-height: 32px; display: inline-flex; align-items: center; } +/* inline button groups inside a field (e.g. System → Local time) */ +.cbi-value-field .control-group { + display: inline-flex; + flex-wrap: wrap; + gap: 6px; + margin-top: 8px; +} +.cbi-value-field .control-group > * { margin: 0 !important; } + +/* multi-line fields: keep the label at the top of the box */ +.cbi-value[data-widget="CBI.TextValue"], +.cbi-value:has(> .cbi-value-field textarea) { align-items: flex-start; } +.cbi-value[data-widget="CBI.TextValue"] > .cbi-value-title, +.cbi-value:has(> .cbi-value-field textarea) > .cbi-value-title { padding-top: 7px; } + +/* firewall zone forwarding cell: src ⇒ dest side by side (mirrors bootstrap) */ +.zone-forwards { display: flex; align-items: center; gap: 8px; min-width: 10em; } +.zone-forwards > * { flex: 1 1 45%; padding: 1px; } +.zone-forwards > span { flex: 0 0 auto; color: var(--cb-text-3); text-align: center; } +.zone-forwards .zone-src, +.zone-forwards .zone-dest { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; } + +/* zero-width text gives the switch a centred baseline for row alignment */ +.cbi-checkbox::before { content: "\200b"; width: 0; line-height: 32px; overflow: hidden; } + +.cbi-value-description { + position: relative; + margin: 6px 0 0; + padding-left: 0; + color: var(--cb-text-2); + font-size: 12.5px; + line-height: 1.5; +} +.cbi-value-description:empty { display: none; } + +.cbi-value-helpicon img { display: none; } + +.cbi-section-error { + margin-bottom: 14px; + padding: 10px 14px; + border-radius: var(--cb-radius-md); + background: var(--cb-red-t); + color: var(--cb-red); +} +.cbi-section-error ul { margin: 0; padding-left: 1.2em; } + +.cbi-section-create { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; + margin: 12px 0 0; +} +.cbi-section-create > * { margin: 0 !important; } +.cbi-section-create > div > input { margin: 0; } + +.cbi-section-remove { text-align: right; padding: 10px 0 4px; } +.cbi-section-remove:empty { display: none; } + +.cbi-optionals { padding: 10px 0; } + +.cbi-title-ref { color: var(--cb-accent); } +.cbi-title-ref::after { content: " →"; } + +/* page actions bar (Save & Apply) */ +.cbi-page-actions { + position: sticky; + z-index: 100; + bottom: 12px; + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + align-items: center; + gap: 8px; + margin: 22px 0 0; + padding: 10px 12px; + border-radius: var(--cb-radius); + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cbi-page-actions { + -webkit-backdrop-filter: saturate(180%) blur(20px); + backdrop-filter: saturate(180%) blur(20px); + } +} +.cbi-page-actions:empty { display: none; } +.cbi-page-actions > * { margin: 0 !important; } +.cbi-page-actions > :not([method="post"]):not(.cbi-button-apply):not(.cbi-button-negative):not(.cbi-button-save):not(.cbi-button-reset) { + margin-right: auto !important; +} +.cbi-page-actions.control-group { justify-content: flex-start; } + +/* ========================================================================== + 6. Form controls + ========================================================================== */ + +input, +textarea, +select, +button { + font-family: var(--cb-font); + font-size: 13.5px; +} + +input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"])), +textarea, +select, +.cbi-select, +.cbi-dropdown:not(.btn):not(.cbi-button) { + display: inline-block; + width: 260px; + max-width: 100%; + min-height: 34px; + padding: 6px 12px; + border: 1px solid var(--cb-border-strong); + border-radius: var(--cb-radius-sm); + background: var(--cb-field); + color: var(--cb-text); + line-height: 20px; + box-shadow: 0 1px 2px rgba(15, 23, 42, .04); + transition: border-color .15s var(--cb-ease), box-shadow .15s var(--cb-ease); +} +input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"])), +select, +.cbi-select { height: 34px; } + +textarea { width: 100%; min-height: 120px; font-family: var(--cb-mono); font-size: 12.5px; resize: vertical; } + +select { + -webkit-appearance: none; + appearance: none; + padding-right: 30px; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14' fill='none' stroke='%238b91a1' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: right 10px center; + background-size: 10px 14px; + cursor: pointer; +} +select[multiple] { height: auto; background-image: none; padding-right: 10px; } +select option { background: var(--cb-card-solid); color: var(--cb-text); } + +.cbi-select { position: relative; padding: 0; } +.cbi-select select { + width: 100%; + height: 100%; + border: 0; + box-shadow: none; + background-color: transparent; +} + +input:focus, +textarea:focus, +select:focus, +.cbi-select.focus, +.cbi-dropdown:not(.btn):not(.cbi-button):focus, +.cbi-dropdown:not(.btn):not(.cbi-button)[open] { + outline: 0; + border-color: var(--cb-accent) !important; + box-shadow: 0 0 0 4px var(--cb-focus); +} + +::placeholder { color: var(--cb-text-3); opacity: 1; } + +input[readonly], +textarea[readonly] { background: var(--cb-card-2); color: var(--cb-text-2); } + +input[disabled], +button[disabled], +select[disabled], +textarea[disabled], +.cbi-dropdown[disabled] { + opacity: .5; + pointer-events: none; + cursor: default; +} + +input[type="file"] { width: auto !important; max-width: 100%; font-size: 13px; color: var(--cb-text-2); } +input[type="file"]::file-selector-button { + margin-right: 10px; + height: 32px; + padding: 0 14px; + border: 0; + border-radius: 9px; + background: var(--cb-fill); + color: var(--cb-text); + font: inherit; + font-weight: 500; + cursor: pointer; +} + +.cbi-input-invalid, +.cbi-input-invalid:focus, +.cbi-value-error input, +.cbi-dropdown.cbi-input-invalid { + border-color: var(--cb-red) !important; + color: var(--cb-red) !important; +} +.cbi-input-invalid:focus { box-shadow: 0 0 0 3.5px var(--cb-red-t) !important; } + +/* checkboxes & radios */ +input[type="checkbox"], +input[type="radio"] { + -webkit-appearance: none; + appearance: none; + position: relative; + flex: none; + width: 18px; + height: 18px; + margin: 0 6px 0 0; + vertical-align: -4px; + border: 1.5px solid var(--cb-border-strong); + border-radius: 6px; + background: var(--cb-field); + cursor: pointer; + transition: background-color .15s var(--cb-ease), border-color .15s var(--cb-ease); +} +input[type="radio"] { border-radius: 50%; } +input[type="checkbox"]:checked, +input[type="radio"]:checked { + border-color: var(--cb-accent); + background: var(--cb-accent); +} +input[type="checkbox"]:checked::after { + content: ""; + position: absolute; + left: 4.5px; + top: 1px; + width: 5px; + height: 10px; + border: solid #fff; + border-width: 0 2px 2px 0; + transform: rotate(45deg); +} +input[type="radio"]:checked::after { + content: ""; + position: absolute; + inset: 4px; + border-radius: 50%; + background: #fff; +} +input[type="checkbox"]:focus-visible, +input[type="radio"]:focus-visible { outline: 0; box-shadow: 0 0 0 3.5px var(--cb-focus); } +input[type="checkbox"].cbi-input-invalid, +input[type="radio"].cbi-input-invalid { border-color: var(--cb-red); } + +/* LuCI flag fields → iOS switch */ +.cbi-checkbox { display: inline-flex; align-items: center; gap: 8px; } +.cbi-checkbox > label:empty { display: none; } +.cbi-checkbox > input[type="checkbox"] { + width: 42px; + height: 24px; + margin: 0; + border: 0; + border-radius: 8px; + background: var(--cb-border-strong); + box-shadow: none; + transition: background-color .22s var(--cb-ease); +} +/* Keep the dark off-state fill from overriding the checked accent. */ +:root[data-darkmode="true"] .cbi-checkbox > input[type="checkbox"]:not(:checked) { background: rgba(255, 255, 255, .16); } +.cbi-checkbox > input[type="checkbox"]::after { + content: ""; + position: absolute; + top: 2px; + left: 2px; + width: 20px; + height: 20px; + border: 0; + border-radius: 6px; + background: #fff; + box-shadow: 0 1px 3px rgba(15, 23, 42, .25); + transform: none; + transition: transform .22s var(--cb-ease); +} +.cbi-checkbox > input[type="checkbox"]:checked { background: var(--cb-accent); } +.cbi-checkbox > input[type="checkbox"]:checked::after { transform: translateX(18px); } + +.cbi-radio { display: inline-flex; align-items: center; margin-right: 14px; cursor: pointer; gap: 2px; } + +/* ========================================================================== + 7. Buttons — solid colours only (no gradients) + ========================================================================== */ + +/* secondary: glass chip */ +.btn, +.cbi-button, +button:where(:not([class*="cb-"])), +input[type="submit"], +input[type="button"], +input[type="reset"] { + --btn-bg: var(--cb-card-solid); + --btn-fg: var(--cb-text); + --btn-ring: var(--cb-border-strong); + display: inline-flex; + align-items: center; + justify-content: center; + gap: 6px; + width: auto; + min-height: 34px; + padding: 6px 15px; + border: 0; + border-radius: var(--cb-radius-sm); + background: var(--btn-bg); + color: var(--btn-fg); + box-shadow: inset 0 0 0 1px var(--btn-ring), 0 1px 2px rgba(15, 23, 42, .05); + font: inherit; + font-size: 13.5px; + font-weight: 600; + line-height: 20px; + letter-spacing: .005em; + white-space: nowrap; + text-decoration: none; + vertical-align: middle; + cursor: pointer; + transition: background-color .15s var(--cb-ease), box-shadow .15s var(--cb-ease), color .15s, transform .1s var(--cb-ease); + -webkit-user-select: none; + user-select: none; +} +:root[data-darkmode="true"] .btn, +:root[data-darkmode="true"] .cbi-button, +:root[data-darkmode="true"] input[type="submit"], +:root[data-darkmode="true"] input[type="button"], +:root[data-darkmode="true"] input[type="reset"], +:root[data-darkmode="true"] button:where(:not([class*="cb-"])) { --btn-bg: rgba(255, 255, 255, .06); } + +.btn:hover, +.cbi-button:hover, +input[type="submit"]:hover, +input[type="button"]:hover, +input[type="reset"]:hover, +button:where(:not([class*="cb-"])):hover { --btn-ring: var(--cb-accent); color: var(--cb-accent-strong); } +.btn:active, +.cbi-button:active, +button:where(:not([class*="cb-"])):active { transform: translateY(1px); } +.btn:focus-visible, +.cbi-button:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px var(--cb-accent), 0 0 0 4px var(--cb-focus); } + +/* primary: solid Carbon indigo */ +.btn.primary, +.btn.important, +.cbi-button-apply, +.cbi-button-save, +.cbi-button-positive.important, +.cbi-button-action.important, +.cbi-button.important, +.cbi-page-actions .cbi-button-apply, +.cbi-section-actions .cbi-button-edit, +input[type="submit"].cbi-button-apply { + --btn-bg: var(--cb-accent) !important; + --btn-fg: var(--cb-on-accent) !important; + --btn-ring: transparent !important; + color: var(--cb-on-accent) !important; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 6px 14px -6px rgba(79, 91, 234, .55); +} +.btn.primary:hover, +.btn.important:hover, +.cbi-button-apply:hover, +.cbi-button-save:hover, +.cbi-button.important:hover, +.cbi-section-actions .cbi-button-edit:hover { --btn-bg: var(--cb-accent-strong) !important; } + +/* tinted variants */ +.cbi-button-positive, +.cbi-button-add, +.btn.success { + --btn-bg: var(--cb-green-t); + --btn-fg: var(--cb-green); + --btn-ring: transparent; +} +.cbi-button-negative, +.cbi-button-remove, +.btn.danger, +.btn.error { + --btn-bg: var(--cb-red-t); + --btn-fg: var(--cb-red); + --btn-ring: transparent; +} +.cbi-button-action, +.cbi-button-edit, +.cbi-button-find, +.cbi-button-link, +.cbi-button-download { + --btn-bg: var(--cb-accent-t); + --btn-fg: var(--cb-accent-strong); + --btn-ring: transparent; +} +:root[data-darkmode="true"] .cbi-button-positive, +:root[data-darkmode="true"] .cbi-button-add { --btn-bg: var(--cb-green-t); } +:root[data-darkmode="true"] .cbi-button-negative, +:root[data-darkmode="true"] .cbi-button-remove { --btn-bg: var(--cb-red-t); } +:root[data-darkmode="true"] .cbi-button-action, +:root[data-darkmode="true"] .cbi-button-edit, +:root[data-darkmode="true"] .cbi-button-find, +:root[data-darkmode="true"] .cbi-button-link, +:root[data-darkmode="true"] .cbi-button-download { --btn-bg: var(--cb-accent-t); } +.cbi-button-positive:hover, +.cbi-button-add:hover { --btn-ring: var(--cb-green); color: var(--cb-green); } +.cbi-button-negative:hover, +.cbi-button-remove:hover { --btn-ring: var(--cb-red); color: var(--cb-red); } + +.cbi-button-negative.important { + --btn-bg: var(--cb-red) !important; + --btn-fg: #fff !important; + color: #fff !important; + box-shadow: 0 6px 14px -6px rgba(229, 72, 77, .55); +} + +.cbi-button-reset, +.cbi-button-neutral, +.cbi-button-up, +.cbi-button-down, +.cbi-button-fieldadd, +.cbi-button-reload { --btn-bg: var(--cb-fill); --btn-ring: transparent; } +:root[data-darkmode="true"] .cbi-button-reset, +:root[data-darkmode="true"] .cbi-button-neutral { --btn-bg: var(--cb-fill); } + +.cbi-page-actions .cbi-button-apply + .cbi-button-save, +.cbi-page-actions .cbi-button-negative + .cbi-button-save { + --btn-bg: var(--cb-card-solid) !important; + --btn-fg: var(--cb-text) !important; + --btn-ring: var(--cb-border-strong) !important; + color: var(--cb-text) !important; + box-shadow: inset 0 0 0 1px var(--btn-ring); +} +:root[data-darkmode="true"] .cbi-page-actions .cbi-button-apply + .cbi-button-save { --btn-bg: rgba(255, 255, 255, .06) !important; } + +.cbi-button-up, +.cbi-button-down { min-width: 34px; padding: 0 8px; } + +.btn .close, .alert-message .close { font-family: inherit; } + +/* ========================================================================== + 8. Dropdown (ui.Dropdown / ui.ComboButton) — behaviour mirrors bootstrap + ========================================================================== */ + +.cbi-dropdown { + display: inline-flex !important; + cursor: pointer; + height: auto; + position: relative; + padding: 0 !important; +} +.cbi-dropdown:not(.btn):not(.cbi-button) { + min-width: 260px; + max-width: 100%; + width: auto; + padding: 0 !important; +} +.cbi-dropdown img { max-height: 1.6em; width: auto; } + +.cbi-dropdown > ul { + margin: 0 !important; + padding: 0; + list-style: none; + overflow-x: hidden; + overflow-y: hidden; + display: flex; + width: 100%; +} +.cbi-dropdown.btn > ul:not(.dropdown), +.cbi-dropdown.cbi-button > ul:not(.dropdown) { margin: 0 0 0 14px !important; } +.cbi-dropdown.btn.spinning > ul:not(.dropdown), +.cbi-dropdown.cbi-button.spinning > ul:not(.dropdown) { margin: 0 !important; } +.cbi-dropdown > ul.preview { display: none; } + +.cbi-dropdown > .open, +.cbi-dropdown > .more { + flex-grow: 0; + flex-shrink: 0; + display: flex; + flex-direction: column; + justify-content: center; + text-align: center; + line-height: 2em; + padding: 0 .55em; + color: var(--cb-text-2); + font-size: 11px; +} +.cbi-dropdown.btn > .open, +.cbi-dropdown.cbi-button > .open { + padding: 0 .7em; + margin-left: .6em; + border-left: 1px solid rgba(255, 255, 255, .35); + color: inherit; +} +.cbi-dropdown > .more, +.cbi-dropdown:not(.btn):not(.cbi-button) > ul > li[placeholder] { + color: var(--cb-text-3); + display: none; +} + +.cbi-dropdown > ul > li { + display: none; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + flex-shrink: 1; + flex-grow: 1; + align-items: center; + align-self: center; + color: inherit; +} +.cbi-dropdown > ul.dropdown > li, +.cbi-dropdown:not(.btn):not(.cbi-button) > ul > li { + min-height: 30px; + padding: 5px 10px; + color: var(--cb-text); +} +.cbi-dropdown > ul > li .hide-open { display: initial; } +.cbi-dropdown > ul > li .hide-close { display: none; } +.cbi-dropdown > ul > li[display]:not([display="0"]) { border-left: 1px solid var(--cb-sep); } +.cbi-dropdown[empty] > ul { max-width: 1px; } +.cbi-dropdown > ul > li > form { + display: none; + margin: 0; + padding: 0; + pointer-events: none; +} +.cbi-dropdown > ul > li img { vertical-align: middle; margin-right: .3em; } +.cbi-dropdown > ul > li > form > input[type="checkbox"] { margin: 0 .4em 0 0; } +.cbi-dropdown > ul > li input[type="text"] { height: 26px !important; min-height: 26px !important; } + +.cbi-dropdown[open] { position: relative; } +.cbi-dropdown[open] > ul.dropdown { + display: block; + position: absolute; + z-index: 1100; + max-width: none; + min-width: 100%; + width: auto; + padding: 6px !important; + border: 1px solid var(--cb-glass-edge); + border-radius: 14px; + /* opaque: the list is read item by item over busy pages */ + background: var(--cb-card-solid); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + transition: max-height .125s ease-in; + overflow-y: auto; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cbi-dropdown[open] > ul.dropdown { + -webkit-backdrop-filter: saturate(180%) blur(20px); + backdrop-filter: saturate(180%) blur(20px); + } +} + +.cbi-dropdown > ul > li[display], +.cbi-dropdown[open] > ul.preview, +.cbi-dropdown[open] > ul.dropdown > li, +.cbi-dropdown[multiple] > ul > li > label, +.cbi-dropdown[multiple][open] > ul.dropdown > li, +.cbi-dropdown[multiple][more] > .more, +.cbi-dropdown[multiple][empty] > .more { + flex-grow: 1; + display: flex !important; +} +.cbi-dropdown[empty] > ul > li, +.cbi-dropdown[optional][open] > ul.dropdown > li[placeholder] { + display: block !important; +} +.cbi-dropdown[multiple][open] > ul.dropdown > li > form { display: flex !important; } +.cbi-dropdown[open] > ul.dropdown > li .hide-open { display: none; } +.cbi-dropdown[open] > ul.dropdown > li .hide-close { display: initial; } + +/* items match the Carbon listbox (.cb-lb-list): soft hover tint, accent for the selection */ +.cbi-dropdown[open] > ul.dropdown > li { + min-height: 34px; + padding: 5px 12px; + border-radius: 9px; + border: 0 !important; + font-size: 13px; +} +.cbi-dropdown[open] > ul.dropdown > li[selected] { color: var(--cb-accent); font-weight: 600; } +.cbi-dropdown[open] > ul.dropdown > li.focus, +.cbi-dropdown[open] > ul.dropdown > li:hover { background: var(--cb-nav-hover); } +.cbi-dropdown[open] > ul.dropdown > li:last-child { margin-bottom: 0; } +.cbi-dropdown[open] > ul.dropdown > li[unselectable] { opacity: .6; } +.cbi-dropdown[open] > ul.dropdown > li > input.create-item-input:first-child:last-child { width: 100%; } +.cbi-dropdown[disabled] { pointer-events: none; opacity: .5; } +.cbi-dropdown .zonebadge { width: 100%; } +.cbi-dropdown[open] .zonebadge { width: auto; } + + +/* ---- Carbon listbox (C.listbox): a select in the sidebar's glass style ---- */ +.cb-lb { + display: inline-flex; + align-items: center; + gap: 6px; + height: 32px; + padding: 0 8px 0 11px; + border: 0; + border-radius: 11px; + background-color: var(--cb-seg-track); + color: var(--cb-text); + font: inherit; + font-size: 12.5px; + font-weight: 600; + text-align: start; + cursor: pointer; + transition: background-color .15s var(--cb-ease); +} +/* hover tint layered over the track colour */ +.cb-lb:hover, +.cb-lb[aria-expanded="true"] { background-image: linear-gradient(var(--cb-nav-hover), var(--cb-nav-hover)); } +.cb-lb:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--cb-focus); } +.cb-lb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.cb-lb-chev { display: inline-flex; flex: none; color: var(--cb-text-2); transition: transform .2s var(--cb-ease); } +.cb-lb-chev svg { width: 14px; height: 14px; } +.cb-lb[aria-expanded="true"] .cb-lb-chev { transform: rotate(180deg); } + +.cb-lb-list { + position: fixed; + z-index: 1000; + max-height: min(70vh, 440px); + min-width: 180px; + max-width: min(320px, calc(100vw - 16px)); + margin: 0; + padding: 6px; + overflow-y: auto; + overscroll-behavior: contain; + list-style: none; + border-radius: 14px; + border: 1px solid var(--cb-glass-edge); + /* opaque: the list is read item by item over busy pages */ + background: var(--cb-card-solid); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + outline: none; + opacity: 0; + transform: translateY(4px); + transition: opacity .14s var(--cb-ease), transform .14s var(--cb-ease); +} +.cb-lb-list.show { opacity: 1; transform: none; } +.cb-lb-list > li { + display: flex; + align-items: center; + gap: 8px; + min-height: 34px; + padding: 0 12px 0 8px; + border-radius: 9px; + font-size: 13px; + white-space: nowrap; + cursor: pointer; +} +.cb-lb-list > li > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; } +/* group heading (like ): not an option, not focusable */ +.cb-lb-list > li.cb-lb-group { + min-height: 0; + padding: 8px 10px 4px; + color: var(--cb-text-3); + font-size: 11.5px; + font-weight: 600; + letter-spacing: .02em; + cursor: default; +} +.cb-lb-list > li.cb-lb-group:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--cb-sep); padding-top: 10px; } +.cb-lb-list > li.active { background: var(--cb-nav-hover); } +.cb-lb-list > li[aria-selected="true"] { color: var(--cb-accent); font-weight: 600; } +.cb-lb-check { display: inline-flex; flex: none; width: 16px; height: 16px; visibility: hidden; } +.cb-lb-check svg { width: 16px; height: 16px; } +.cb-lb-list > li[aria-selected="true"] .cb-lb-check { visibility: visible; } +@media (prefers-reduced-motion: reduce) { + .cb-lb-list, .cb-lb-chev { transition: none; } +} +/* ========================================================================== + 9. Dynamic lists + ========================================================================== */ + +.cbi-dynlist { + display: inline-flex; + flex-direction: column; + gap: 6px; + min-width: 260px; + max-width: 100%; + height: auto; + min-height: 32px; +} +.cbi-dynlist > .item { + position: relative; + padding: 6px 36px 6px 10px; + border-radius: var(--cb-radius-sm); + background: var(--cb-fill-2); + color: var(--cb-text); + font-size: 13px; + line-height: 20px; + pointer-events: auto; + overflow: hidden; + word-break: break-all; + cursor: move; + user-select: text; +} +.cbi-dynlist > .item::after { + content: "×"; + position: absolute; + top: 0; + right: 0; + bottom: 0; + display: inline-flex; + align-items: center; + padding: 0 11px; + color: var(--cb-red); + font-size: 17px; + font-weight: 500; + pointer-events: auto; + cursor: pointer; +} +.cbi-dynlist > .item:hover::after { background: var(--cb-red-t); } +.cbi-dynlist > .item > span { pointer-events: none; } +.cbi-dynlist > .item.drag-over { box-shadow: inset 0 2px 0 var(--cb-accent); } +.cbi-dynlist > .item.dragging { opacity: .5; } +.cbi-dynlist > .add-item { display: flex; gap: 6px; } +.cbi-dynlist > .add-item > input, +.cbi-dynlist > .add-item > button { + flex: 1 1 auto; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.cbi-dynlist > .add-item > .cbi-button { flex: 0 0 auto; } +.cbi-dynlist > .add-item > .cbi-dropdown { flex: 1; min-width: 0; width: 100%; } +.cbi-dynlist > .add-item > .cbi-input-text.drag-over, +.cbi-dynlist > .add-item > .cbi-button-add.drag-over { box-shadow: inset 0 2px 0 var(--cb-accent); } + +/* ========================================================================== + 10. Tabs → Carbon pill tabs + ========================================================================== */ + +.tabs, +.cbi-tabmenu { + display: flex; + flex-wrap: wrap; + gap: 4px; + max-width: 100%; + margin: 0 0 18px; + padding: 0 0 10px; + list-style: none; + border-bottom: 1px solid var(--cb-sep); +} +#tabmenu { margin: 4px 0 8px; } +#tabmenu .tabs { margin-bottom: 10px; } + +.tabs > li, +.cbi-tabmenu > li { + position: relative; + display: flex; + align-items: center; + margin: 0; + border-radius: 9px; + color: var(--cb-text-2); + transition: background-color .18s var(--cb-ease), color .18s var(--cb-ease); +} +.tabs > li > a, +.cbi-tabmenu > li > a { + display: block; + padding: 6px 14px; + color: inherit; + font-size: 13px; + font-weight: 600; + line-height: 20px; + white-space: nowrap; + text-decoration: none; + border-radius: 9px; + outline: none; +} +.tabs > li > a:focus-visible, +.cbi-tabmenu > li > a:focus-visible { box-shadow: 0 0 0 3px var(--cb-focus); } +.tabs > li:not(.active):hover, +.cbi-tabmenu > .cbi-tab-disabled:hover { color: var(--cb-text); background: var(--cb-fill-2); } + +.tabs > li.active, +.cbi-tabmenu > .cbi-tab { + background: var(--cb-accent-t); + color: var(--cb-accent-strong); +} +/* active underline sitting on the divider */ +.tabs > li.active::after, +.cbi-tabmenu > .cbi-tab::after { + content: ""; + position: absolute; + left: 14px; + right: 14px; + bottom: -11px; + height: 2px; + border-radius: 2px; + background: var(--cb-accent); +} + +.cbi-tab-disabled[data-errors]::after { + content: attr(data-errors); + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 18px; + height: 18px; + margin-right: 10px; + padding: 0 5px; + border-radius: 6px; + background: var(--cb-red); + color: #fff; + font-size: 11px; + font-weight: 700; +} + +.cbi-tabmenu.map { margin: 0 0 14px; } +.cbi-tabmenu.map > li { font-size: 14px; } + +/* tab panes — keep LuCI's height-0 approach so hidden fields still validate */ +[data-tab-title] { + height: 0; + opacity: 0; + overflow: hidden; +} +[data-tab-active="true"] { + opacity: 1; + height: auto; + overflow: visible; + transition: opacity .25s ease-in; +} + +/* ========================================================================== + 11. Tables + ========================================================================== */ + +table { border-collapse: collapse; border-spacing: 0; } + +.table { + display: table; + width: 100%; + margin: 0 0 22px; + padding: 0; + font-size: 13.5px; + border-collapse: separate; + border-spacing: 0; + position: relative; + overflow: hidden; +} +.thead { display: table-header-group; } +.tbody { display: table-row-group; } +.tr { display: table-row; } +.table[width="33%"], .th[width="33%"], .td[width="33%"] { width: 33%; } +.table[width="100%"], .th[width="100%"], .td[width="100%"] { width: 100%; } + +.table .th, +.table .td, +.table th, +.table td { + display: table-cell; + padding: 11px 14px; + line-height: 20px; + text-align: left; + vertical-align: middle; + border-top: 1px solid var(--cb-sep); +} +.table .tr:first-child > .th, +.table .tr:first-child > .td, +.table > .tr:first-child > .td, +.table tr:first-child > th, +.table tr:first-child > td { border-top: 0; } + +.table .th, +.table th, +.tr.table-titles > .th, +.tr.cbi-section-table-titles > .th { + color: var(--cb-text-3); + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: .07em; + white-space: nowrap; +} +.tr.table-titles, +.tr.cbi-section-table-titles { background: transparent; } +.cbi-rowstyle-2 { background: transparent; } + +.table .tr:not(.table-titles):not(.cbi-section-table-titles):not(.placeholder):hover > .td { background: var(--cb-hover); } + +.tr.placeholder { height: calc(3em + 22px); } +.tr.placeholder > .td { + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 0; + display: flex; + align-items: center; + justify-content: center; + color: var(--cb-text-2); + border-top: 0; +} + +.table .td > .cbi-value-field, +.table .td.cbi-value-field { line-height: normal; } +.table .td.cbi-value-field { display: table-cell; } + +.cbi-section-table-titles.named::before, +.cbi-section-table-descr.named::before, +.cbi-section-table-row[data-title]::before { + content: attr(data-title) " "; + display: table-cell; + padding: 11px 14px; + line-height: 20px; + font-weight: 600; + vertical-align: middle; + border-top: .5px solid var(--cb-sep); +} +.cbi-section-table-titles.named::before { border-top: 0; } +.cbi-section-table .tr.cbi-section-table-descr .th { font-weight: 400; } + +.table.cbi-section-table input[type="password"], +.table.cbi-section-table input[type="text"], +.table.cbi-section-table textarea, +.table.cbi-section-table select, +.table.cbi-section-table .cbi-select { + width: 100%; + min-width: 6em; +} +.table.cbi-section-table .td.cbi-section-table-cell { white-space: nowrap; text-align: right; } +.table.cbi-section-table .td.cbi-section-table-cell select, +.table.cbi-section-table .td.cbi-section-table-cell .cbi-select { width: inherit; } + +.td > input[type=text], +.td > input[type=password], +.td > select, +.td > .cbi-dropdown:not(.btn):not(.cbi-button), +.cbi-dynlist > .add-item > .cbi-dropdown { width: 100%; } + +.td.cbi-section-actions { + text-align: right; + vertical-align: middle; + width: 1%; + white-space: nowrap; +} +.td.cbi-section-actions > * { display: flex; gap: 6px; justify-content: flex-end; } +.td.cbi-section-actions > :not(.cbi-dropdown) > *, +.td.cbi-section-actions > * > form > * { flex: 0 0 auto; margin: 0; } +.td.cbi-section-actions > * > form { display: inline-flex; margin: 0; } +.td.cbi-section-actions .cbi-button { min-height: 28px; padding: 3px 11px; font-size: 12.5px; } + +.table.valign-middle .td { vertical-align: middle; } + +th[data-sortable-row] { cursor: pointer; } +th[data-sort-direction="asc"]::after { content: "\a0\25b4"; } +th[data-sort-direction="desc"]::after { content: "\a0\25be"; } + +table table td, +.cbi-value-field table td { border: none; } + +/* status tables that sit directly in a section get a card */ +.cbi-section > .table, +.cbi-section > div > .table, +.cbi-tblsection > .table { margin-bottom: 0; } + +/* ========================================================================== + 12. Alerts, labels, badges, tooltips, progress + ========================================================================== */ + +.alert-message { + --al: var(--cb-accent); + --al-t: var(--cb-accent-t); + position: relative; + margin: 0 0 16px; + padding: 14px 18px 14px 22px; + border-radius: var(--cb-radius-md); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + color: var(--cb-text); + font-size: 13.5px; + overflow: hidden; +} +.alert-message::before { + content: ""; + position: absolute; + left: 8px; + top: 12px; + bottom: 12px; + width: 3px; + border-radius: 3px; + background: var(--al); +} +.alert-message::after { + content: ""; + position: absolute; + inset: 0; + pointer-events: none; + background: var(--al-t); + opacity: .55; +} +.alert-message > * { position: relative; z-index: 1; } +.alert-message.warning { --al: var(--cb-orange); --al-t: var(--cb-orange-t); } +.alert-message.error, +.alert-message.danger { --al: var(--cb-red); --al-t: var(--cb-red-t); } +.alert-message.success { --al: var(--cb-green); --al-t: var(--cb-green-t); } +.alert-message h4, +.alert-message h5 { margin: 0 0 4px; font-size: 14px; } +.alert-message p, +.alert-message ul, +.alert-message pre { margin: 0 0 6px; } +.alert-message > :last-child { margin-bottom: 0; } +.alert-message .right { margin-top: 8px; } +.alert-message button { margin-top: 6px; } +.alert-message.fade-out { opacity: 0; transition: opacity .4s ease-in; } +.alert-message.fade-in { animation: cb-fade-in .3s var(--cb-ease); } +@keyframes cb-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } } + +.label { + display: inline-flex; + align-items: center; + height: 20px; + padding: 0 8px; + border-radius: 6px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 11.5px; + font-weight: 600; + white-space: nowrap; + text-decoration: none; +} +.label.important { background: var(--cb-red-t); color: var(--cb-red); } +.label.warning { background: var(--cb-orange-t); color: var(--cb-orange); } +.label.success { background: var(--cb-green-t); color: var(--cb-green); } +.label.notice { background: var(--cb-accent-t); color: var(--cb-accent); } + +.cbi-tooltip-container { cursor: help; } +.cbi-tooltip { + position: absolute; + z-index: 1000; + left: -10000px; + max-width: 420px; + padding: 6px 10px; + border-radius: 8px; + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + font-size: 12.5px; + line-height: 1.45; + white-space: pre; + opacity: 0; + transition: opacity .2s ease-in; +} +.cbi-tooltip-container:hover .cbi-tooltip:not(:empty) { left: auto; opacity: 1; } +.cbi-tooltip.error { color: var(--cb-red); } +.cbi-tooltip.success { color: var(--cb-green); } +.cbi-tooltip.notice, +.cbi-tooltip.info { color: var(--cb-accent); } + +.cbi-progressbar { + position: relative; + min-width: 170px; + height: 6px; + margin: 1.6em 0 6px; + border-radius: 3px; + background: var(--cb-fill); +} +.cbi-progressbar > div { + height: 100%; + width: 0%; + border-radius: 3px; + background: var(--cb-accent); + transition: width .4s var(--cb-ease); +} +.cbi-progressbar::before { + content: attr(title); + position: absolute; + top: -1.6em; + left: 0; + right: 0; + color: var(--cb-text-2); + font-size: 12px; + line-height: 1.4; + white-space: pre; + overflow: hidden; + text-overflow: ellipsis; + font-variant-numeric: tabular-nums; +} + +/* interface & zone badges */ +.ifacebadge { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 3px 9px; + border-radius: 7px; + background: var(--cb-fill-2); + color: var(--cb-text); + font-size: 12.5px; + line-height: 1.4; + white-space: nowrap; +} +.ifacebadge img { width: 16px; height: 16px; vertical-align: middle; } +:root[data-darkmode="true"] .ifacebadge img, +:root[data-darkmode="true"] .ifacebox img { filter: invert(1) hue-rotate(180deg); } +.ifacebadge-active { background: var(--cb-accent-t); color: var(--cb-accent); font-weight: 600; } +.ifacebadge.large, +.network-status-table .ifacebox-body .ifacebadge { display: inline-flex; flex: 1; padding: 6px 10px; } +.ifacebadge > *, +.ifacebadge.large > * { margin: 0 .1em; } + +.ifacebox { + display: inline-flex; + flex-direction: column; + min-width: 120px; + margin: 0 6px; + border-radius: var(--cb-radius-md); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + text-align: center; + white-space: nowrap; + overflow: hidden; + line-height: 1.4; +} +.ifacebox .ifacebox-head { + padding: 6px 10px; + background: var(--cb-fill-2); + font-weight: 600; + font-size: 12.5px; +} +.ifacebox .ifacebox-head[style] { color: #1d1d1f; } +.ifacebox .ifacebox-head.active { background: var(--cb-accent); color: #fff; } +.ifacebox .ifacebox-body { padding: 8px 10px; font-size: 12.5px; } +:root[data-darkmode="true"] .zonebadge[style], +:root[data-darkmode="true"] .ifacebox-head[style] { background-blend-mode: multiply; filter: brightness(.85) saturate(1.1); } +#cbi-network-interface .ifacebox-body { justify-content: center; } + +.network-status-table { + display: flex; + flex-wrap: wrap; + gap: 12px; + margin-bottom: 18px; +} +.network-status-table .ifacebox { flex: 1 1 280px; margin: 0; text-align: left; } +.network-status-table .ifacebox-body { display: flex; flex-direction: column; gap: 4px; height: 100%; } +.network-status-table .ifacebox-body > * { margin: 0; } +.network-status-table .ifacebox-body > div { display: flex; flex-wrap: wrap; gap: 6px; } +.network-status-table .ifacebox-body > span { white-space: normal; } + +.zonebadge { + display: inline-flex; + align-items: center; + flex-wrap: wrap; + gap: 4px; + padding: 3px 8px; + border-radius: 7px; + color: #1d1d1f; + font-size: 12.5px; + white-space: nowrap; +} +.zonebadge > em, +.zonebadge > strong { margin: 0 2px; display: inline-block; color: inherit; } +.zonebadge input { width: 6em; } +.zonebadge > .ifacebadge { margin-left: 2px; background: rgba(255, 255, 255, .55); color: #1d1d1f; } +.zonebadge-empty { background: repeating-linear-gradient(45deg, var(--cb-fill-2), var(--cb-fill-2) 6px, transparent 6px, transparent 12px); color: var(--cb-text-2); } +.zonebadge .cbi-tooltip { padding: 2px; background: inherit; margin: -1.6em 0 0 -5px; border-radius: 8px; } +.zonebadge .cbi-tooltip > * { margin: 1px; } + +.td.cbi-value-field var, +.td.cbi-value-field var.cbi-tooltip-container { font-style: normal; font-family: inherit; } +.td.cbi-value-field var[data-tooltip], +div.cbi-value var.cbi-tooltip-container, +.td.cbi-value-field var.cbi-tooltip-container { cursor: help; border-bottom: 1px dotted currentColor; } +div.cbi-value var.cbi-tooltip-container .cbi-tooltip, +.td.cbi-value-field var.cbi-tooltip-container .cbi-tooltip { white-space: normal; } + +/* ========================================================================== + 13. Modal dialogs & change list + ========================================================================== */ + +#modal_overlay { + position: fixed; + z-index: 900; + top: 0; + bottom: 0; + left: 0; + right: 0; + overflow: auto; + background: rgba(0, 0, 0, .32); + opacity: 0; + visibility: hidden; + transition: opacity .2s var(--cb-ease), visibility .2s; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + #modal_overlay { + -webkit-backdrop-filter: blur(6px); + backdrop-filter: blur(6px); + } +} +body.modal-overlay-active { overflow: hidden; height: 100vh; } +body.modal-overlay-active #modal_overlay { opacity: 1; visibility: visible; } + +.modal { + width: 92%; + max-width: 600px; + min-width: 270px; + min-height: 32px; + margin: 9vh auto 5vh; + padding: 22px 24px 18px; + border-radius: 20px; + background: var(--cb-card); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + transform: translateY(8px) scale(.98); + transition: transform .25s var(--cb-ease); +} +.modal { background: var(--cb-card-solid); } +body.modal-overlay-active .modal { transform: none; } +.modal > * { line-height: 1.5; margin-bottom: .6em; max-width: 100%; } +.modal > h4 { font-size: 17px; margin-bottom: 10px; } +.modal > pre, +.modal > textarea { white-space: pre-wrap; overflow: auto; width: 100%; } +.modal > .right, +.modal > .button-row { + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + gap: 8px; + margin: 18px 0 0; +} +.modal > .right > *, +.modal > .button-row > * { margin: 0 !important; } +.modal > .button-row { justify-content: space-between; } +.modal > .button-row > button:first-of-type { margin-right: auto !important; } +.modal.alert-message { padding: 22px 24px 18px; } +.modal.alert-message::before { display: none; } +#modal_overlay > .modal.uci-dialog, +#modal_overlay > .modal.cbi-modal { max-width: 900px; } +#modal_overlay > .modal.login > button.important { width: 100%; font-size: 15px; margin-top: 8px; } +.modal .cbi-section-node { box-shadow: none; background: var(--cb-card-2); } +:root[data-darkmode="true"] .modal .cbi-section-node { background: #3a3a3c; } + +.uci-change-list { line-height: 1.7; white-space: pre; } +.uci-dialog div > del, +.uci-dialog div > ins, +.uci-dialog div > var { + display: block; + margin-bottom: 3px; + padding: 3px 8px; + border-radius: 6px; + background: var(--cb-fill-2); + color: var(--cb-text); + font-family: var(--cb-mono); + font-size: 12px; + font-style: normal; + text-decoration: none; + line-height: 1.5; + overflow: hidden; + text-overflow: ellipsis; + position: relative; +} +.uci-dialog div > ins { background: var(--cb-green-t); } +.uci-dialog div > del { background: var(--cb-red-t); } +.uci-dialog var > ins { background: var(--cb-green-t); text-decoration: none; } +.uci-dialog var > del { background: var(--cb-red-t); } +.uci-dialog del, .uci-dialog ins, .uci-dialog var { display: block; font-style: normal; text-decoration: none; } +.uci-change-list > var > * { overflow: hidden; text-overflow: ellipsis; } +.uci-change-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; } +.uci-change-legend-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; } +.uci-change-legend-label > ins, +.uci-change-legend-label > del, +.uci-change-legend-label > var { display: flex; width: 16px; height: 16px; margin: 0 !important; padding: 0 !important; border-radius: 4px; } +.uci-change-legend-label > * > * { flex-basis: 100%; padding: 1px; } + +#applyreboot-section { line-height: 2.4; } + +/* ========================================================================== + 14. Spinner, file browser, misc LuCI pieces + ========================================================================== */ + +#view > div.spinning:first-child, +#view > .spinning:only-child { + display: table; + margin: 18vh auto; + color: var(--cb-text-2); +} +.spinning { + position: relative; + padding-left: 30px !important; +} +.spinning::before { + content: ""; + position: absolute; + top: calc(50% - 9px); + left: 6px; + width: 18px; + height: 18px; + border-radius: 50%; + border: 2px solid currentColor; + border-right-color: transparent; + opacity: .7; + animation: cb-spin .8s linear infinite; +} +@keyframes cb-spin { to { transform: rotate(360deg); } } + +.flash { animation: cb-flash .35s; } +@keyframes cb-flash { 50% { opacity: .5; } } + +#syslog, +textarea#syslog { + width: 100%; + min-height: 60vh; + padding: 14px; + border-radius: var(--cb-radius); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + border: 0; + font-size: 12px; + line-height: 1.55; +} + +.cbi-filebrowser { + min-width: 260px; + max-width: 100%; + padding: 0; + border-radius: var(--cb-radius-md); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + display: none; + flex-direction: column; + overflow: hidden; +} +.cbi-filebrowser.open { display: flex; } +.cbi-filebrowser > * { padding: 6px 10px; border-bottom: .5px solid var(--cb-sep); } +.cbi-filebrowser > ul { margin: 0; list-style: none; max-height: 300px; overflow: auto; padding: 4px; } +.cbi-filebrowser > ul > li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; border-radius: 6px; } +.cbi-filebrowser > ul > li:hover { background: var(--cb-hover); } +.cbi-filebrowser > ul > li > div:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.cbi-filebrowser > ul > li > div:last-child { flex: none; } +.cbi-filebrowser > ul > li > div:last-child > button { min-height: 24px; padding: 0 8px; font-size: 12px; } +.cbi-filebrowser .upload { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } +.cbi-filebrowser .upload > div { display: flex; flex: 1; gap: 6px; } +.cbi-filebrowser .upload > div > input { flex: 1; } +.cbi-filebrowser > div:last-child { border-bottom: 0; display: flex; justify-content: flex-end; gap: 6px; } + +#cbi-network-switch_vlan .td { text-align: center; } + +/* overview page (LuCI status widgets) */ +[data-page="admin-status-overview"] .cbi-section > h3, +[data-page="admin-status"] .cbi-section > h3, +[data-page="admin"] .cbi-section > h3 { margin-top: 4px; } + +/* ========================================================================== + 15. Dashboard + ========================================================================== */ + +.cb-dash { + display: grid; + grid-template-columns: repeat(12, minmax(0, 1fr)); + gap: 16px; + margin: 6px 0 18px; + font-variant-numeric: tabular-nums; +} +.cb-dash .span-12 { grid-column: span 12; } +.cb-dash .span-8 { grid-column: span 8; } +.cb-dash .span-6 { grid-column: span 6; } +.cb-dash .span-4 { grid-column: span 4; } +.cb-dash .span-3 { grid-column: span 3; } + +.cb-card { + position: relative; + min-width: 0; + padding: 18px 20px; + border-radius: var(--cb-radius); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + animation: cb-rise .4s var(--cb-ease); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-card { -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); } +} +@keyframes cb-rise { from { transform: translateY(6px); } to { transform: none; } } + +.cb-card-head { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 12px; + margin: 0 0 14px; +} +.cb-card-head h3 { + margin: 0; + font-size: 15px; + font-weight: 600; +} +.cb-card-head h3 .cb-count { + margin-left: 6px; + color: var(--cb-text-2); + font-weight: 500; +} +.cb-card-note { color: var(--cb-text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +/* traffic source picker in the card head: a C.listbox, like the language switch */ +.cb-card-head .cb-traffic-select { + flex: 0 1 auto; + align-self: center; + min-width: 0; + max-width: 60%; +} +.cb-card-link { font-size: 13px; font-weight: 500; white-space: nowrap; } + +/* hero */ +.cb-hero { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 16px 28px; + padding: 20px 22px; +} +.cb-hero-id { display: flex; align-items: center; gap: 14px; min-width: 0; } +.cb-hero-icon { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 8px 16px rgba(79, 91, 234, .32)); } +.cb-hero-icon :is(svg, img) { width: 100%; height: 100%; display: block; } +.cb-hero-icon.custom { filter: none; } +.cb-hero-icon img { object-fit: contain; border-radius: 12px; } +.cb-hero-text { min-width: 0; } +.cb-hero-title { margin: 0 0 2px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; } +.cb-hero-sub { margin: 0; color: var(--cb-text-2); font-size: 13px; } +.cb-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; } +.cb-meta { display: flex; flex-direction: column; line-height: 1.3; } +.cb-meta-label { color: var(--cb-text-2); font-size: 11.5px; } +.cb-meta-val { font-size: 14px; font-weight: 600; } +.cb-meta-val.cb-ip6 { display: block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + +.cb-pill { + display: inline-flex; + align-items: center; + gap: 6px; + height: 26px; + padding: 0 11px; + border-radius: 13px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 12.5px; + font-weight: 600; + white-space: nowrap; +} +.cb-pill::before { + content: ""; + width: 7px; + height: 7px; + border-radius: 50%; + background: currentColor; +} +.cb-pill.ok { background: var(--cb-green-t); color: var(--cb-green); } +.cb-pill.ok::before { box-shadow: 0 0 0 0 currentColor; animation: cb-pulse 2s infinite; } +.cb-pill.bad { background: var(--cb-red-t); color: var(--cb-red); } +.cb-pill.off { background: var(--cb-fill); color: var(--cb-text-2); } +.cb-pill.sm { height: 22px; padding: 0 9px; font-size: 11.5px; } +@keyframes cb-pulse { + 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .55); } + 70% { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); } + 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } +} + +/* traffic */ +.cb-rates { + display: flex; + flex-wrap: wrap; + align-items: flex-end; + gap: 8px 36px; + margin: -4px 0 8px; +} +.cb-rate { display: flex; flex-direction: column; line-height: 1.15; } +.cb-rate-label { display: inline-flex; align-items: center; gap: 6px; color: var(--cb-text-2); font-size: 12.5px; font-weight: 500; } +.cb-rate-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); } +.cb-rate-val { font-size: 30px; font-weight: 700; letter-spacing: -.02em; } +.cb-rate-val small { margin-left: 4px; color: var(--cb-text-2); font-size: 14px; font-weight: 600; letter-spacing: 0; } +.cb-totals { margin-left: auto; text-align: right; color: var(--cb-text-2); font-size: 12px; line-height: 1.5; } +.cb-totals b { color: var(--cb-text); font-weight: 600; } + +.cb-chart { position: relative; height: 190px; margin: 0 -4px; touch-action: pan-y; } +.cb-area-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; } +.cb-grid-line { stroke: var(--cb-sep); stroke-width: 1; shape-rendering: crispEdges; } +.cb-grid-line.base { stroke: var(--cb-border); } +.cb-axis { fill: var(--cb-text-3); font-size: 10.5px; font-family: var(--cb-font); } +.cb-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } +.cb-dot { stroke: var(--cb-card); stroke-width: 2; } +.cb-cross { stroke: var(--cb-text-3); stroke-width: 1; stroke-dasharray: 3 3; } +.cb-chart-foot { display: flex; justify-content: space-between; margin-top: 6px; color: var(--cb-text-3); font-size: 11px; } + +.cb-tip { + position: absolute; + z-index: 5; + top: 8px; + min-width: 140px; + padding: 8px 10px; + border-radius: 10px; + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); + font-size: 12px; + line-height: 1.6; + pointer-events: none; + opacity: 0; + transition: opacity .12s; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-tip { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); } +} +.cb-tip.show { opacity: 1; } +.cb-tip-time { color: var(--cb-text-2); font-size: 11px; } +.cb-tip-row { display: flex; align-items: center; gap: 6px; } +.cb-tip-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); } +.cb-tip-row b { margin-left: auto; padding-left: 12px; font-weight: 600; } + +/* resources */ +.cb-rings { display: flex; justify-content: space-around; gap: 8px; margin: 2px 0 16px; } +.cb-ring { position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; min-width: 0; } +.cb-ring svg { width: 88px; height: 88px; transform: rotate(-90deg); } +.cb-ring-track { fill: none; stroke: var(--cb-fill); stroke-width: 10; } +.cb-ring-bar { + fill: none; + stroke-width: 10; + stroke-linecap: round; + transition: stroke-dashoffset .8s var(--cb-ease), stroke .3s; +} +.cb-ring-center { + position: absolute; + top: 0; + left: 0; + right: 0; + height: 88px; + display: flex; + align-items: center; + justify-content: center; +} +.cb-ring-center b { font-size: 19px; font-weight: 700; letter-spacing: -.02em; } +.cb-ring-center b small { font-size: 11px; font-weight: 600; color: var(--cb-text-2); margin-left: 1px; } +.cb-ring-label { margin-top: 6px; font-size: 12.5px; font-weight: 600; } +.cb-ring-sub { max-width: 100%; color: var(--cb-text-2); font-size: 11px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +.cb-membar-wrap { margin: 0 0 12px; } +.cb-membar-title { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; } +.cb-membar-title span { color: var(--cb-text-2); font-weight: 500; } +.cb-membar { + display: flex; + gap: 2px; + height: 10px; + border-radius: 5px; + overflow: hidden; + background: var(--cb-fill); +} +.cb-membar > i { display: block; height: 100%; background: var(--c); transition: flex-basis .8s var(--cb-ease); } +.cb-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; color: var(--cb-text-2); font-size: 11.5px; } +.cb-legend span { display: inline-flex; align-items: center; gap: 5px; } +.cb-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); } + +.cb-kv { margin: 0; padding: 0; list-style: none; } +.cb-kv li { + display: flex; + justify-content: space-between; + gap: 12px; + padding: 8px 0; + border-top: .5px solid var(--cb-sep); + font-size: 13px; +} +.cb-kv li span:first-child { color: var(--cb-text-2); } +.cb-kv li span:last-child { font-weight: 500; text-align: right; } + +/* stat tiles */ +.cb-tile { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; } +.cb-tile-head { display: flex; align-items: center; gap: 8px; color: var(--cb-text-2); font-size: 13px; font-weight: 500; } +.cb-ico { + --c: var(--cb-gray); + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 32px; + height: 32px; + border-radius: 10px; + color: var(--c); + background: var(--cb-fill); + background: color-mix(in srgb, var(--c) 13%, transparent); +} +.cb-ico svg { width: 17px; height: 17px; } +.cb-tile-head .cb-ico { width: 30px; height: 30px; } +.cb-tile-val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; } +.cb-tile-val small { margin-left: 3px; color: var(--cb-text-2); font-size: 13px; font-weight: 600; letter-spacing: 0; } +.cb-tile-sub { color: var(--cb-text-2); font-size: 12px; min-height: 18px; } +.cb-tile-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; } +.cb-spark { flex: 1; max-width: 120px; height: 34px; } +.cb-spark svg { display: block; width: 100%; height: 100%; overflow: visible; } +.cb-mini-bar { height: 5px; border-radius: 3px; background: var(--cb-fill); overflow: hidden; } +.cb-mini-bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--c, var(--cb-teal)); transition: width .8s var(--cb-ease); } + +/* lists */ +.cb-list { margin: 0 -8px; padding: 0; list-style: none; } +.cb-list > li { + display: flex; + align-items: center; + gap: 12px; + padding: 9px 8px; + border-radius: 10px; +} +.cb-list > li + li { box-shadow: 0 -.5px 0 var(--cb-sep); } +.cb-list > li:hover { background: var(--cb-hover); box-shadow: none; } +.cb-list > li:hover + li { box-shadow: none; } +.cb-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; } +.cb-list-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.cb-list-sub { color: var(--cb-text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.cb-list-aside { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; color: var(--cb-text-2); font-size: 12px; } +.cb-mono { font-family: var(--cb-mono); font-size: 12px; letter-spacing: -.01em; } +.cb-empty { padding: 26px 0 18px; text-align: center; color: var(--cb-text-2); font-size: 13px; } + +.cb-avatar { + --c: var(--cb-blue); + flex: none; + display: inline-flex; + align-items: center; + justify-content: center; + width: 34px; + height: 34px; + border-radius: 50%; + background: var(--c); + color: #fff; + font-size: 14px; + font-weight: 600; + text-transform: uppercase; +} +.cb-avatar svg { width: 18px; height: 18px; } + +/* brand avatars */ +.cb-avatar.cb-avatar-brand { color: var(--f, #fff); } +.cb-avatar.cb-avatar-brand.inv { background-color: var(--cb-text); color: var(--cb-card); } +.cb-avatar .cb-logo { width: 17px; height: 17px; fill: currentColor; } +.cb-avatar b { font-size: 15px; font-weight: 700; line-height: 1; text-transform: none; } +.cb-avatar.cb-type { + background: var(--cb-fill); + background-image: none; + color: var(--cb-text-2); +} +/* the same avatar, smaller, beside hostnames in LuCI's lease tables */ +.cb-host { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; vertical-align: middle; } +.cb-host-name { min-width: 0; overflow-wrap: anywhere; } +.cb-host > .cb-avatar { width: 26px; height: 26px; font-size: 12px; } +.cb-host > .cb-avatar svg { width: 15px; height: 15px; } +.cb-host > .cb-avatar .cb-logo { width: 14px; height: 14px; } +.cb-host > .cb-avatar b { font-size: 12px; } +.cb-kind { color: var(--cb-text-2); } +.cb-kind::after { content: " · "; } +.cb-tag { + display: inline-block; + margin-right: 6px; + padding: 0 6px; + border-radius: 5px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 10.5px; + font-weight: 600; + line-height: 17px; + vertical-align: 1px; + cursor: help; +} + +.cb-tag-wifi { background: var(--cb-fill); background: color-mix(in srgb, var(--cb-blue) 13%, transparent); color: var(--cb-blue); cursor: default; white-space: nowrap; } +.cb-tag-wifi svg { width: 11px; height: 11px; margin-right: 3px; vertical-align: -1px; } + +.cb-subhead { margin: 18px 0 6px; color: var(--cb-text-2); font-size: 12px; font-weight: 600; } +.cb-subhead:first-of-type { margin-top: 0; } + +.cb-more { + display: block; + width: 100%; + margin: 8px 0 0; + padding: 8px; + border: 0; + border-radius: 9px; + background: var(--cb-fill-2); + color: var(--cb-accent); + font: inherit; + font-size: 13px; + font-weight: 500; + cursor: pointer; +} +.cb-more:hover { background: var(--cb-fill); } + +/* details toggle below dashboard */ +.cb-details-bar { display: flex; justify-content: center; margin: 2px 0 18px; } +.cb-details-btn { + display: inline-flex; + align-items: center; + gap: 6px; + height: 32px; + padding: 0 14px; + border: 0; + border-radius: 16px; + background: var(--cb-fill); + color: var(--cb-text); + font: inherit; + font-size: 13px; + font-weight: 500; + cursor: pointer; +} +.cb-details-btn:hover { filter: brightness(.97); } +.cb-details-btn svg { width: 14px; height: 14px; transition: transform .2s var(--cb-ease); } +.cb-show-details .cb-details-btn svg { transform: rotate(180deg); } +body.cb-has-dash:not(.cb-show-details) #view, +body.cb-has-dash:not(.cb-show-details) #maincontent > .includes { display: none; } +/* newer LuCI renders the page

outside #view; the hero card replaces it */ +body.cb-has-dash #maincontent > h2 { display: none; } + +/* ========================================================================== + 16. Responsive + ========================================================================== */ + +/* wide screens: pages that profit from width (the dashboard grid, tables) + grow in steps; plain forms keep a readable 1240px */ +@media (min-width: 1800px) { :root { --cb-content-wide: 1480px; } } +@media (min-width: 2300px) { :root { --cb-content-wide: 1720px; } } +body.cb-has-dash, +body:has(#maincontent .table) { --cb-content-max: var(--cb-content-wide); } + +/* a wide devices card lays its list out in two columns */ +.cb-clients { container-type: inline-size; } +@container (min-width: 880px) { + .cb-clients .cb-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; } + .cb-clients .cb-list > li:nth-child(2) { box-shadow: none; } + .cb-clients .cb-list > li:hover + li { box-shadow: 0 -.5px 0 var(--cb-sep); } + .cb-clients .cb-list > li:hover + li:nth-child(2) { box-shadow: none; } +} +/* columns too narrow for the MAC next to the name: keep the name readable */ +@container (min-width: 880px) and (max-width: 1099px) { + .cb-clients .cb-list .cb-hide-sm { display: none; } + .cb-clients .cb-tag-wifi .cb-tag-text { display: none; } + .cb-clients .cb-device-source { display: block; } +} + +@media (max-width: 1180px) { + .cb-dash .span-8, + .cb-dash .span-4 { grid-column: span 12; } + .cb-dash .span-3 { grid-column: span 6; } + .cb-resources .cb-res-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; } + .cb-resources .cb-rings { margin-bottom: 0; } +} + +@media (max-width: 1023px) { + .cb-sidebar { transform: translateX(calc(-100% - var(--cb-gutter) * 2)); } + body.cb-nav-open .cb-sidebar { transform: none; } + .cb-collapse { display: none; } + .cb-scrim { + display: block; + position: fixed; + z-index: 250; + inset: 0; + background: rgba(0, 0, 0, .3); + opacity: 0; + visibility: hidden; + transition: opacity .25s var(--cb-ease), visibility .25s; + } + body.cb-nav-open .cb-scrim { opacity: 1; visibility: visible; } + .cb-main { margin-left: 0; } + .cb-burger { display: inline-block; } + .cb-toolbar { padding: 8px 16px; padding-left: max(16px, env(safe-area-inset-left)); } + .cb-content { padding: 10px 16px 24px; } + .cb-footer { padding: 8px 16px 24px; } +} + +@media (max-width: 760px) { + .cb-resources .cb-res-body { display: block; } + .cb-resources .cb-rings { margin-bottom: 16px; } + .cb-dash { gap: 12px; } + .cb-card { padding: 16px; } + .cb-hero { padding: 18px 16px; } + /* hero meta becomes a tidy list: status pill on its own row, then + label/value rows — no more crowding next to the badge */ + .cb-hero-meta { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; } + .cb-hero-meta > .cb-pill { justify-self: start; margin: 0 0 12px; } + .cb-hero-meta .cb-meta { + flex-direction: row; + align-items: baseline; + justify-content: space-between; + gap: 12px; + min-width: 0; + padding: 8px 0; + border-top: .5px solid var(--cb-sep); + } + .cb-hero-meta .cb-meta-label { flex: none; white-space: nowrap; } + .cb-hero-meta .cb-meta-val { text-align: right; } + .cb-rate-val { font-size: 24px; } + .cb-chart { height: 160px; } + .cb-totals { margin-left: 0; text-align: left; flex-basis: 100%; } + .cb-ring svg { width: 74px; height: 74px; } + .cb-ring-center { height: 74px; } + .cb-ring-center b { font-size: 16px; } + .cb-tile-val { font-size: 24px; } + .cb-list .cb-hide-sm { display: none; } + /* keep device names readable: Wi‑Fi tag shrinks to its icon (details stay in the tooltip) */ + .cb-tag-wifi .cb-tag-text { display: none; } + .cb-tag-wifi svg { margin-right: 0; } + /* source/lease text gets its own line so badges cannot crowd out the name */ + .cb-clients .cb-device-source { display: block; } + .cb-clients .cb-list-aside { max-width: 55%; } + + #view > h2, .cbi-map > h2, h2[name="content"] { font-size: 24px; } + + .cbi-section-node { padding: 2px 14px; } + .cbi-value { flex-direction: column; gap: 6px; padding: 12px 0; } + .cbi-value-title, + .cbi-value label.cbi-value-title { flex: none; padding-top: 0; } + .cbi-value-field { flex: none; width: 100%; } + + /* flag values (switches) stay on one row: title left, switch right; the + optional description (rendered inside the field) drops below the row */ + .cbi-value[data-widget="CBI.FlagValue"] { flex-direction: row; align-items: center; } + .cbi-value[data-widget="CBI.FlagValue"] > .cbi-value-title { flex: 1 1 0; min-width: 0; } + .cbi-value[data-widget="CBI.FlagValue"] > .cbi-value-field { display: contents; } + .cbi-value[data-widget="CBI.FlagValue"] .cbi-value-description { flex: 1 1 100%; margin-top: 0; } + + /* package manager (luci-app-package-manager): input + button on one line */ + .controls .control-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; } + .controls .control-group > input { flex: 1 1 12em; width: auto; min-width: 0; } + .controls .control-group > .btn { flex: 0 0 auto; } + + input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"])), + textarea, + select, + .cbi-select, + .cbi-dropdown:not(.btn):not(.cbi-button), + .cbi-dynlist { width: 100%; } + + .tabs, .cbi-tabmenu { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } + .tabs::-webkit-scrollbar, .cbi-tabmenu::-webkit-scrollbar { display: none; } + .tabs > li, .cbi-tabmenu > li { flex: none; } + + .cbi-page-actions { bottom: max(8px, env(safe-area-inset-bottom)); } + + /* tables become stacked cards (uses LuCI's data-title attributes) */ + .table { display: flex; flex-direction: column; overflow: visible; } + .table .tr { + display: flex; + flex-wrap: wrap; + align-items: flex-start; + padding: 8px 4px; + border-top: .5px solid var(--cb-sep); + } + .table .tr:first-child, + .table .tr.table-titles + .tr, + .table .tr.cbi-section-table-titles + .tr { border-top: 0; } + .table .th, + .table .td, + .table .tr::before { + display: block; + flex: 1 1 50%; + min-width: 0; + padding: 4px 10px; + border-top: 0 !important; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + } + .table .td.cbi-dropdown-open { overflow: visible; } + .table .tr:hover > .td { background: transparent !important; } + .tr.table-titles, + .cbi-section-table-titles, + .cbi-section-table-descr { display: none !important; } + .tr[data-title]::before { + flex: 1 1 100%; + font-size: 15px; + font-weight: 600; + padding-bottom: 6px; + } + .td[data-title]::before { + content: attr(data-title); + display: block; + margin-bottom: 2px; + color: var(--cb-text-2); + font-size: 11.5px; + font-weight: 600; + white-space: pre-line; + } + .td.cbi-value-field { flex-basis: 100%; } + .td.cbi-value-field[data-widget="CBI.DummyValue"], + .td.cbi-value-field[data-widget="CBI.Button"], + .td.cbi-value-field[data-widget="CBI.FlagValue"], + .td.cbi-value-field[data-widget="dvalue"], + .td.cbi-value-field[data-widget="button"], + .td.cbi-value-field[data-widget="fvalue"] { flex-basis: 50%; text-align: left; } + /* data cells never share a wrapped row with button cells (e.g. Nikki's + status table: the core state is a readout, not a button) */ + .tr:has(> .td[data-widget="CBI.ButtonValue"]) > .td.cbi-value-field:not([data-widget="CBI.ButtonValue"]) { flex-basis: 100%; } + /* button cells share one row when they fit (Nikki's four actions), + and wrap gracefully when the labels are too long for the screen; + margin-left matches the field inset above so the row aligns */ + .td.cbi-value-field[data-widget="CBI.ButtonValue"] { flex: 1 0 auto; width: auto; min-width: 0; padding-left: 0; padding-right: 0; margin-left: 10px; } + .td.cbi-section-actions { flex-basis: 100%; width: auto; padding-top: 8px; } + .td.cbi-section-actions > * { justify-content: flex-start; flex-wrap: wrap; gap: 4px; } + /* tighter action buttons so short button sets fit on one row */ + .td.cbi-section-actions .btn, + .td.cbi-section-actions .cbi-button { min-height: 28px; padding: 3px 9px; font-size: 12.5px; } + /* stacked-table button cells keep the regular button size; only the + horizontal padding is trimmed so four actions fit one row */ + .td.cbi-value-field[data-widget="CBI.ButtonValue"] .cbi-button { padding-left: 8px; padding-right: 8px; } + .tr.placeholder > .td { position: static; } + .col-1 { flex: 1 1 30px !important; } + .col-2 { flex: 2 2 60px !important; } + .col-3 { flex: 3 3 90px !important; } + .col-4 { flex: 4 4 120px !important; } + .col-5 { flex: 5 5 150px !important; } + .col-6 { flex: 6 6 180px !important; } + .col-7 { flex: 7 7 210px !important; } + .col-8 { flex: 8 8 240px !important; } + .col-9 { flex: 9 9 270px !important; } + .col-10 { flex: 10 10 300px !important; } + .hide-sm, .hide-xs { display: none !important; } + + .modal { width: 94%; margin-top: 6vh; padding: 18px; } +} + +@media (max-width: 480px) { + .cb-dash .span-3 { grid-column: span 6; } + .cb-tile { padding: 14px; } + .cb-tile-val { font-size: 22px; } + .cb-spark { display: none; } + .cb-hero-title { font-size: 19px; } + .hide-xs { display: none !important; } +} + +@media (prefers-reduced-motion: reduce) { + *, *::before, *::after { + animation-duration: .01ms !important; + animation-iteration-count: 1 !important; + transition-duration: .01ms !important; + } +} + +/* ========================================================================== + 17. Carbon theme settings page + ========================================================================== */ + +.cb-update [hidden] { display: none !important; } +.cb-update .cb-update-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; } +.cb-update .cb-update-versions { display: flex; gap: 3rem; flex-wrap: wrap; margin: 1rem 0; } +/* a form field with its button and status message on one centred line */ +.cb-update .cb-update-field { display: flex; align-items: center; gap: .5rem .75rem; flex-wrap: wrap; } +.cb-update .cb-update-field > input { flex: 0 1 22rem; min-width: 0; margin: 0; } +.cb-update .cb-update-note { color: var(--cb-text-2); font-size: 13px; overflow-wrap: anywhere; } + +/* Release notes: scoped Markdown typography, with local overflow on phones. */ +.cb-update .cb-release-notes { + max-height: 32rem; + min-width: 0; + overflow: auto; + overflow-wrap: anywhere; + line-height: 1.75; + padding: 2px 12px 2px 2px; + color: var(--cb-text); +} +.cb-release-notes > :first-child { margin-top: 0; } +.cb-release-notes > :last-child { margin-bottom: 0; } +.cb-release-notes :is(h1, h2, h3, h4, h5, h6) { line-height: 1.4; margin: 1.25em 0 .6em; font-weight: 650; } +.cb-release-notes h1 { font-size: 1.5rem; } +.cb-release-notes h2 { font-size: 1.3rem; } +.cb-release-notes h3 { font-size: 1.12rem; } +.cb-release-notes :is(h4, h5, h6) { font-size: 1rem; } +.cb-release-notes :is(p, ul, ol, blockquote, pre, table) { margin: .8em 0; } +.cb-release-notes :is(ul, ol) { padding-inline-start: 1.6em; } +.cb-release-notes ul { list-style: disc outside; } +.cb-release-notes ol { list-style: decimal outside; } +.cb-release-notes li { display: list-item; margin: .25em 0; } +.cb-release-notes li > :is(ul, ol) { margin: .25em 0; } +.cb-release-notes a { color: var(--cb-accent); text-decoration: underline; text-underline-offset: 3px; } +.cb-release-notes blockquote { border-inline-start: 3px solid var(--cb-accent); padding: .1em 1em; color: var(--cb-text-2); } +.cb-release-notes code { font-family: var(--cb-mono); font-size: .9em; background: var(--cb-fill); border-radius: 4px; padding: .15em .35em; } +.cb-release-notes pre { max-width: 100%; overflow: auto; white-space: pre; padding: 14px; background: var(--cb-fill-2); border: 1px solid var(--cb-border); border-radius: var(--cb-radius-sm); } +.cb-release-notes pre code { display: block; background: none; padding: 0; white-space: pre; overflow-wrap: normal; } +.cb-release-notes table { display: block; max-width: 100%; overflow: auto; border-collapse: collapse; } +.cb-release-notes :is(th, td) { border: 1px solid var(--cb-border-strong); padding: 8px 12px; text-align: start; } +.cb-release-notes th { background: var(--cb-fill-2); font-weight: 600; } +.cb-release-notes img { max-width: 100%; height: auto; border-radius: var(--cb-radius-sm); } +.cb-release-notes hr { border: 0; border-top: 1px solid var(--cb-border); margin: 1.25em 0; } + + +/* Logo */ +.cb-logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 12px 0 4px; } +.cb-logo-preview { + width: 72px; + height: 72px; + flex: none; + object-fit: contain; + padding: 6px; + border-radius: 18px; + background: var(--cb-fill); + border: 1px solid var(--cb-border); +} +.cb-logo-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; min-width: 0; } + +/* "?" toggletip next to a heading: hover / keyboard focus shows, click pins */ +.cb-update h3 .cb-hint { margin-inline-start: 6px; } +.cb-hint { position: relative; display: inline-flex; } +.cb-hint-btn { + display: inline-flex; + align-items: center; + justify-content: center; + width: 18px; + height: 18px; + padding: 0; + border: 0; + border-radius: 50%; + background: var(--cb-fill); + color: var(--cb-text-2); + font: inherit; + font-size: 11.5px; + font-weight: 700; + line-height: 1; + cursor: help; + transition: background-color .15s var(--cb-ease), color .15s var(--cb-ease); +} +.cb-hint-btn:hover, +.cb-hint.open .cb-hint-btn { background: var(--cb-accent-t); color: var(--cb-accent); } +.cb-hint-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--cb-focus); } +.cb-hint-bubble { + position: absolute; + z-index: 50; + top: calc(100% + 8px); + left: -12px; + width: max-content; + max-width: min(24rem, calc(100vw - 48px)); + padding: 10px 12px; + border-radius: var(--cb-radius-md); + border: 1px solid var(--cb-border); + background: var(--cb-card-solid); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + /* the heading is a small uppercase label: reset its text styles */ + font-size: 12.5px; + font-weight: 400; + line-height: 1.6; + letter-spacing: normal; + text-transform: none; + white-space: normal; + overflow-wrap: anywhere; + opacity: 0; + visibility: hidden; + transform: translateY(-4px); + pointer-events: none; + transition: opacity .14s var(--cb-ease), transform .14s var(--cb-ease), visibility .14s; +} +/* bridge the gap so the pointer can move from the icon into the bubble */ +.cb-hint-bubble::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; } +.cb-hint:hover .cb-hint-bubble, +.cb-hint:has(.cb-hint-btn:focus-visible) .cb-hint-bubble, +.cb-hint.open .cb-hint-bubble { opacity: 1; visibility: visible; transform: none; pointer-events: auto; } +/* narrow screens: anchor the bubble to the heading so it spans the section */ +.cb-update .cbi-section > h3 { position: relative; } +@media (max-width: 600px) { + .cb-update h3 .cb-hint { position: static; } + .cb-update h3 .cb-hint-bubble { left: 0; right: 0; width: auto; max-width: none; } +} +@media (prefers-reduced-motion: reduce) { .cb-hint-bubble { transition: none; } } +/* ========================================================================== + 18. Third-party plugin adapters + One section per plugin package, scoped by body[data-page] + (admin--…, set by the theme header) so nothing leaks into + other pages. Only for markup that the generic LuCI styles cannot reach, + typically inline styles; prefer fixing the generic rule when one exists. + Plugins that theme themselves for dark mode should key on + [data-darkmode="true"] on , which Carbon sets like Argon does. + ========================================================================== */ + +/* --- luci-app-diskman: partition bar under each disk --------------------- + A bare with one colspan cell of inline-styled, inline-block segments + (fixed % widths, white-space: nowrap, padding: 0). As a flex row the + widths fit the card, and long labels ellipsize. */ +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan]:has(> div[title]) { + display: flex !important; + width: auto !important; + max-width: 100%; + padding: 2px 14px 12px !important; + overflow: hidden; + box-sizing: border-box; +} +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan] > div[title] { + box-sizing: border-box; + flex: 0 1 auto; + height: 22px; + min-width: 6px; + padding: 0 6px; + overflow: hidden; + font-size: 11.5px; + line-height: 22px; + white-space: nowrap; + text-overflow: ellipsis; + /* the segments keep their light inline colours in dark mode too */ + color: #1a1f36 !important; + border-inline-end: 1px solid rgba(255, 255, 255, .6); +} +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan] > div[title]:first-child { border-radius: 7px 0 0 7px; } +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan] > div[title]:last-child { border-radius: 0 7px 7px 0; border-inline-end: 0; } +/* phones: tables become cards (16-responsive.css); the bare must follow */ +@media (max-width: 760px) { + [data-page^="admin-system-diskman"] .cbi-section-table tr:has(> td[colspan] > div[title]) { + display: block; + white-space: normal !important; + } + [data-page^="admin-system-diskman"] .cbi-section-table td[colspan]:has(> div[title]) { padding: 4px 10px 8px !important; } +} + +/* --- luci-app-ttyd: the terminal fills the window ------------------------ + The view sets an inline min-height of 500px and nothing else. */ +[data-page^="admin-services-ttyd"] #view iframe { + display: block; + height: calc(100vh - 210px); + height: calc(100dvh - 210px); + min-height: 420px; + border-radius: var(--cb-radius-md) !important; + background: #000; +} +/* ========================================================================== + 19. Print + ========================================================================== */ + +@media print { + .cb-sidebar, .cb-toolbar, .cb-scrim, .cbi-page-actions, .cb-footer { display: none !important; } + .cb-main { margin: 0; } + body { background: #fff; } +} diff --git a/luci-theme-carbon/htdocs/luci-static/carbon/carbon.js b/luci-theme-carbon/htdocs/luci-static/carbon/carbon.js new file mode 100644 index 000000000..688262ef3 --- /dev/null +++ b/luci-theme-carbon/htdocs/luci-static/carbon/carbon.js @@ -0,0 +1,2099 @@ +/*! + * Carbon — an Apple-style LuCI theme for everyday users + * UI runtime: appearance, navigation, charts and the dashboard. + * + * This file has no LuCI dependency. LuCI-specific glue (menu tree, + * ubus calls) lives in luci-static/resources/menu-carbon.js; the + * preview pages feed it mock data instead. + * + * Licensed under the Apache License 2.0. + */ +(function (window, document) { + 'use strict'; + + const C = window.Carbon = window.Carbon || {}; + + /* directory this script was loaded from (…/luci-static/carbon/). The theme + template appends ?v=, the single version source. */ + const SRC = (document.currentScript && document.currentScript.src) || ''; + const BASE = SRC.replace(/[?#].*$/, '').replace(/[^/]*$/, ''); + C.version = (/[?&]v=([0-9A-Za-z._-]+)/.exec(SRC) || [])[1] || C.version || 'dev'; + + /* ------------------------------------------------------------------ + * Storage (never throws) + * ------------------------------------------------------------------ */ + const store = C.store = { + get(key, def) { + try { const v = window.localStorage.getItem(key); return v == null ? def : v; } + catch (e) { return def; } + }, + set(key, val) { + try { window.localStorage.setItem(key, val); } catch (e) { /* ignore */ } + } + }; + + /* ------------------------------------------------------------------ + * i18n — theme strings come from po//carbon.po, compiled into + * i18n/.js (C.I18N) by scripts/gen-i18n.py and loaded before this + * file. Strings without a bundled translation fall back to LuCI's own + * catalogues (window._), then English. N_() only marks table strings + * for extraction. + * ------------------------------------------------------------------ */ + const langAttr = (document.documentElement.getAttribute('lang') || navigator.language || 'en').replace(/_/g, '-'); + /* LuCI language code → catalogue code (same table as the theme header and + scripts/gen-i18n.py) */ + const LANG_ALIAS = C.LANG_ALIAS = { 'zh-hans': 'zh-cn', 'zh-sg': 'zh-cn', 'zh-hant': 'zh-tw', 'zh-hk': 'zh-tw', 'zh-mo': 'zh-tw' }; + const LOCALE_ALIAS = { 'zh-cn': 'zh-CN', 'zh-tw': 'zh-TW' }; + C.locale = LOCALE_ALIAS[LANG_ALIAS[langAttr.toLowerCase()] || langAttr.toLowerCase()] || langAttr; + try { new Intl.NumberFormat(C.locale); } catch (e) { C.locale = 'en-US'; } + C.lang = C.locale.split('-')[0].toLowerCase(); + const N_ = (s) => s; + C.t = function (s) { + const dict = C.I18N || {}; + let out = Object.prototype.hasOwnProperty.call(dict, s) && dict[s] ? dict[s] : null; + if (out == null && C.lang !== 'en' && typeof window._ === 'function') { + try { out = window._(s); } catch (e) { out = null; } + } + if (typeof out !== 'string' || !out) out = s; + const args = Array.prototype.slice.call(arguments, 1); + let i = 0; + /* one pass, literal values: arguments may contain "%s" or "$&" */ + return args.length ? out.replace(/%[sd]/g, (m) => (i < args.length ? String(args[i++]) : m)) : out; + }; + const t = C.t; + + /* ------------------------------------------------------------------ + * Helpers + * ------------------------------------------------------------------ */ + const esc = C.esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => + ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]); + + const clamp = (v, a, b) => Math.min(b, Math.max(a, v)); + + function h(tag, attrs, children) { + const el = document.createElement(tag); + if (attrs) { + for (const k in attrs) { + const v = attrs[k]; + if (v == null || v === false) continue; + if (k === 'class') el.className = v; + else if (k === 'html') el.innerHTML = v; + else if (k === 'text') el.textContent = v; + else if (k.slice(0, 2) === 'on' && typeof v === 'function') el.addEventListener(k.slice(2), v); + else el.setAttribute(k, v === true ? '' : v); + } + } + append(el, children); + return el; + } + function append(el, children) { + if (children == null) return; + if (!Array.isArray(children)) children = [children]; + children.forEach((c) => { + if (c == null || c === false) return; + el.appendChild(typeof c === 'object' ? c : document.createTextNode(String(c))); + }); + } + C.h = h; + + /* ------------------------------------------------------------------ + * Formatting + * ------------------------------------------------------------------ */ + const fmt = C.fmt = { + bytes(n, perSec) { + if (n == null || isNaN(n)) return ['—', '']; + const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; + let i = 0; + n = Math.max(0, +n); + while (n >= 1024 && i < units.length - 1) { n /= 1024; i++; } + const s = (i === 0 || n >= 100) ? String(Math.round(n)) : n.toFixed(1).replace(/\.0$/, ''); + return [s, units[i] + (perSec ? '/s' : '')]; + }, + /* "used / total UNIT", both expressed in the total's unit: "149 / 428 MB", "0.99 / 177 MB" */ + pair(a, b) { + const y = fmt.bytes(b); + const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; + const v = Math.max(0, +a || 0) / Math.pow(1024, Math.max(0, units.indexOf(y[1]))); + const s = v >= 100 || v === 0 ? String(Math.round(v)) : v >= 10 ? v.toFixed(1).replace(/\.0$/, '') : v.toFixed(2).replace(/\.?0+$/, ''); + return s + ' / ' + y[0] + ' ' + y[1]; + }, + bytesStr(n, perSec) { + const r = fmt.bytes(n, perSec); + return r[1] ? r[0] + ' ' + r[1] : r[0]; + }, + num(n) { + if (n == null || isNaN(n)) return '—'; + try { return Number(n).toLocaleString(C.locale); } + catch (e) { return String(n); } + }, + duration(sec) { + if (sec == null || isNaN(sec)) return '—'; + sec = Math.max(0, Math.floor(sec)); + const d = Math.floor(sec / 86400), hr = Math.floor(sec % 86400 / 3600), m = Math.floor(sec % 3600 / 60); + if (d) return t('%dd %dh', d, hr); + if (hr) return t('%dh %dm', hr, m); + return m ? t('%d min', m) : t('<1 min'); + }, + since(sec) { + const dt = new Date(Date.now() - sec * 1000); + try { + return dt.toLocaleString(C.locale, + { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }); + } + catch (e) { return dt.toISOString().slice(5, 16).replace('T', ' '); } + } + }; + + /* ------------------------------------------------------------------ + * Icons (24×24, stroke = currentColor) + * ------------------------------------------------------------------ */ + const ICONS = { + carbon: '', + gauge: '', + globe: '', + sliders: '', + grid: '', + lock: '', + disk: '', + chart: '', + logout: '', + wifi: '', + box: '', + key: '', + download: '', + power: '', + square: '', + sun: '', + moon: '', + auto: '', + laptop: '', + link: '', + pulse: '', + clock: '', + chevron: '', + chevdown: '', + check: '', + shield: '', + phone: '', + tv: '', + tablet: '', + pc: '', + gamepad: '', + speaker: '', + printer: '', + camera: '', + nas: '', + iot: '' + }; + const icon = C.icon = (name) => + ''; + + const LOGO = ''; + + const COLORS = { + blue: 'var(--cb-blue)', green: 'var(--cb-green)', orange: 'var(--cb-orange)', red: 'var(--cb-red)', + purple: 'var(--cb-purple)', teal: 'var(--cb-teal)', indigo: 'var(--cb-indigo)', pink: 'var(--cb-pink)', + gray: 'var(--cb-gray)', yellow: 'var(--cb-yellow)' + }; + + /* Extra line icons used by the sidebar (24×24, stroke = currentColor) */ + Object.assign(ICONS, { + github: '', + route: '', + doc: '', + cpu: '', + gear: '', + user: '', + rocket: '', + bulb: '', + terminal: '', + folder: '', + server: '', + ports: '', + search: '', + refresh: '', + list: '', + tag: '', + filter: '', + users: '', + dot: '', + puzzle: '', + palette: '', + layers: '', + fiber: '', + send: '', + cloud: '', + zap: '', + play: '', + upload: '', + thermo: '', + bell: '', + eye: '', + chevleft: '', + /* whale carrying a stack of containers (Docker) */ + docker: '' + + '' + + '' + + '', + nodes: '', + sparkle: '' + }); + + /* Top-level LuCI menu categories → line icon */ + const CATEGORY_ICON = { + status: 'gauge', system: 'gear', services: 'grid', network: 'globe', vpn: 'lock', + nas: 'disk', statistics: 'chart', control: 'shield', docker: 'docker', logout: 'logout' + }; + + /* Second-level pages → icon (exact node name first, then keyword match). + Covers stock LuCI plus the plugins most often found on OpenWrt / ImmortalWrt. */ + const PAGE_ICON = { + /* status */ + overview: 'gauge', routes: 'route', routesj: 'route', syslog: 'doc', dmesg: 'doc', logs: 'doc', + processes: 'cpu', realtime: 'pulse', iptables: 'shield', nftables: 'shield', channel_analysis: 'wifi', + wireguard: 'lock', nlbw: 'chart', statistics: 'chart', netdata: 'chart', 'temperature': 'thermo', + /* system */ + system: 'gear', admin: 'user', 'package-manager': 'box', opkg: 'box', startup: 'rocket', + 'carbon-update': 'carbon', + crontab: 'clock', mounts: 'disk', leds: 'bulb', flash: 'download', reboot: 'power', plugins: 'puzzle', + ttyd: 'terminal', commands: 'terminal', filetransfer: 'upload', fileassistant: 'folder', + autoreboot: 'clock', 'argon-config': 'palette', 'design-config': 'palette', 'kucat-config': 'palette', + 'alpha-config': 'palette', 'material-config': 'palette', + /* network */ + network: 'ports', wireless: 'wifi', dhcp: 'list', dns: 'server', hosts: 'tag', diagnostics: 'search', + firewall: 'shield', switch: 'ports', 'switch-vlan': 'layers', vlan: 'layers', pon: 'fiber', + gpon: 'fiber', xpon: 'fiber', sqm: 'sliders', qos: 'sliders', eqos: 'sliders', mwan3: 'route', + turboacc: 'zap', flowoffload: 'zap', + /* services */ + ddns: 'refresh', upnp: 'link', wol: 'power', samba4: 'folder', samba: 'folder', ksmbd: 'folder', + nfs: 'folder', vsftpd: 'folder', adblock: 'shield', adguardhome: 'shield', smartdns: 'server', + mosdns: 'server', 'https-dns-proxy': 'server', acme: 'lock', users: 'users', openvpn: 'lock', + zerotier: 'lock', tailscale: 'lock', frpc: 'cloud', frps: 'cloud', nps: 'cloud', cloudflared: 'cloud', + openclash: 'send', passwall: 'send', passwall2: 'send', homeproxy: 'send', nikki: 'send', + 'ssr-plus': 'send', shadowsocksr: 'send', vssr: 'send', bypass: 'send', aria2: 'download', + transmission: 'download', qbittorrent: 'download', minidlna: 'play', jellyfin: 'play', + rtp2httpd: 'fiber', rtp2httpx: 'fiber', udpxy: 'fiber', iptv: 'fiber', + watchcat: 'eye', diskman: 'disk', 'hd-idle': 'disk', dockerman: 'docker', docker: 'docker', + vlmcsd: 'key', ua2f: 'shield', accesscontrol: 'filter', timecontrol: 'clock', p910nd: 'printer', + usb_printer: 'printer', alist: 'folder', 'ddns-go': 'refresh', wechatpush: 'bell', serverchan: 'bell', + pushbot: 'bell' + }; + const PAGE_KEYWORDS = [ + [/plugin|addon|extension/, 'puzzle'], [/theme|argon|design|kucat|skin/, 'palette'], + [/vlan/, 'layers'], [/(^|[-_])[xge]?pon($|[-_])|optical|fiber/, 'fiber'], [/route|routing|mwan/, 'route'], + [/clash|passwall|ssr|v2ray|xray|trojan|shadow|bypass|proxy|mihomo|sing-?box/, 'send'], + [/frp|nps|ngrok|cloud/, 'cloud'], [/accel|turbo|offload|speed/, 'zap'], + [/dlna|media|jellyfin|emby|music|video/, 'play'], [/^rtp|iptv|udpxy|multicast/, 'fiber'], [/aria|transmission|qbit|torrent/, 'download'], + [/upload|transfer/, 'upload'], [/temp|thermal/, 'thermo'], [/print/, 'printer'], [/qos|sqm|shap/, 'sliders'], + [/watch/, 'eye'], [/log/, 'doc'], [/wifi|wlan|wireless/, 'wifi'], + [/vpn|wireguard|tunnel|ipsec|pptp|l2tp|zerotier|tailscale/, 'lock'], [/push|notif|chan|bot/, 'bell'], [/dns/, 'server'], + [/firewall|guard|block|filter/, 'shield'], [/stat|graph|monitor|bandwidth/, 'chart'], + [/disk|storage|mount/, 'disk'], [/nas|share|smb|nfs|ftp|file/, 'folder'], [/docker/, 'docker'], [/container/, 'box'], + [/time|cron|schedule/, 'clock'], [/user|account|admin/, 'user'], [/terminal|shell|ssh/, 'terminal'], + [/update|upgrade|flash|backup/, 'download'] + ]; + /* Pages whose generic names only mean something inside their category + (Docker → config / images / networks / volumes / events …). Checked + before PAGE_ICON; add a category here rather than special cases below. */ + const CATEGORY_PAGE_ICON = { + docker: { + config: 'sliders', overview: 'gauge', containers: 'box', images: 'layers', + networks: 'nodes', volumes: 'disk', events: 'pulse' + } + }; + const pageIcon = (name, category) => { + const own = CATEGORY_PAGE_ICON[category]; + if (own && own[name]) return own[name]; + if (PAGE_ICON[name]) return PAGE_ICON[name]; + for (const k of PAGE_KEYWORDS) if (k[0].test(name)) return k[1]; + return 'dot'; + }; + C.pageIcon = pageIcon; + + /* Simple mode: hand-picked LuCI pages (first existing path wins) */ + C.SIMPLE_MENU = [ + { group: N_('Common'), items: [ + { title: N_('Overview'), icon: 'gauge', paths: ['status/overview'] }, + { title: N_('Internet & Network'), icon: 'globe', paths: ['network/network'] }, + { title: N_('Wi-Fi'), icon: 'wifi', paths: ['network/wireless'] } + ] }, + { group: N_('System'), items: [ + { title: N_('Software'), icon: 'box', paths: ['system/package-manager', 'system/opkg'] }, + { title: N_('Carbon Theme Settings'), icon: 'carbon', paths: ['system/carbon-update'] }, + { title: N_('Password'), icon: 'key', paths: ['system/admin'] }, + { title: N_('Backup & Upgrade'), icon: 'download', paths: ['system/flash'] }, + { title: N_('Reboot'), icon: 'power', paths: ['system/reboot'] } + ] } + ]; + + /* ------------------------------------------------------------------ + * Appearance (auto / light / dark) — applied immediately on load + * ------------------------------------------------------------------ */ + const rootEl = document.documentElement; + const mq = window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null; + + C.appearance = { + get() { + const v = store.get('carbon.appearance', 'auto'); + return (v === 'light' || v === 'dark') ? v : 'auto'; + }, + set(v) { + store.set('carbon.appearance', v); + C.appearance.apply(); + }, + apply() { + const v = C.appearance.get(); + const dark = v === 'dark' || (v === 'auto' && !!(mq && mq.matches)); + rootEl.setAttribute('data-appearance', v); + rootEl.setAttribute('data-darkmode', dark ? 'true' : 'false'); + const meta = document.querySelector('meta[name="theme-color"]'); + if (meta) meta.setAttribute('content', dark ? '#000000' : '#f2f2f7'); + } + }; + C.appearance.apply(); + + if (mq) { + const onChange = () => C.appearance.apply(); + if (mq.addEventListener) mq.addEventListener('change', onChange); + else if (mq.addListener) mq.addListener(onChange); + } + + /* Navigation mode (simple / pro) */ + C.mode = { + get() { return store.get('carbon.mode', 'simple') === 'pro' ? 'pro' : 'simple'; }, + set(v) { store.set('carbon.mode', v === 'pro' ? 'pro' : 'simple'); } + }; + + /* Collapsed sidebar (icon rail) — class on so it applies before first paint */ + C.sidebar = { + collapsed() { return rootEl.classList.contains('cb-collapsed'); }, + set(on) { + rootEl.classList.toggle('cb-collapsed', !!on); + store.set('carbon.collapsed', on ? '1' : '0'); + const btn = document.getElementById('cb-collapse'); + if (btn) btn.setAttribute('aria-label', on ? t('Expand sidebar') : t('Collapse sidebar')); + hideFlyout(true); + }, + toggle() { C.sidebar.set(!C.sidebar.collapsed()); } + }; + rootEl.classList.toggle('cb-collapsed', store.get('carbon.collapsed', '0') === '1'); + + const railActive = () => C.sidebar.collapsed() && !(window.matchMedia && window.matchMedia('(max-width: 1023px)').matches); + + /* ------------------------------------------------------------------ + * Segmented control + * ------------------------------------------------------------------ */ + /* Radio group: arrow keys move between options (and select them unless + `manual`, used where selecting is expensive, e.g. a page reload). */ + function segmented(options, value, onChange, label, manual) { + const seg = h('div', { class: 'cb-seg', role: 'radiogroup', 'aria-label': label || null }); + const buttons = []; + const select = (idx, fire) => { + seg.style.setProperty('--i', idx); + buttons.forEach((b, i) => { + b.setAttribute('aria-checked', i === idx ? 'true' : 'false'); + b.tabIndex = i === idx ? 0 : -1; + }); + if (fire) onChange(options[idx].value); + }; + seg.addEventListener('keydown', (e) => { + const cur = buttons.indexOf(document.activeElement); + if (cur < 0) return; + const n = buttons.length; + const next = { ArrowRight: cur + 1, ArrowDown: cur + 1, ArrowLeft: cur - 1, ArrowUp: cur - 1, Home: 0, End: n - 1 }[e.key]; + if (next == null) return; + e.preventDefault(); + const idx = (next + n) % n; + buttons[idx].focus(); + if (manual) buttons.forEach((b, i) => { b.tabIndex = i === idx ? 0 : -1; }); + else select(idx, true); + }); + seg.style.setProperty('--n', options.length); + options.forEach((o, i) => { + const b = h('button', { + type: 'button', class: 'cb-seg-btn', role: 'radio', title: o.title || null, + 'aria-label': o.title || null, html: o.html || null, text: o.html ? null : o.label + }); + b.addEventListener('click', () => select(i, true)); + buttons.push(b); + seg.appendChild(b); + }); + seg._select = (v) => select(Math.max(0, options.findIndex((o) => o.value === v)), false); + seg._select(value); + return seg; + } + C.segmented = segmented; + + /* ------------------------------------------------------------------ + * Listbox: a select in Carbon's glass style (instead of a native '; + const check = (id, on) => ''; + const select = (id, options, current) => ''; + const form = (id, content) => '
' + content + '
'; + const intro = (title, description) => '

' + esc(title) + '

' + esc(description) + '

'; + let toastTimer; + function toast(message) { + const el = document.getElementById('demo-toast'); + el.textContent = message; + clearTimeout(toastTimer); + toastTimer = setTimeout(() => { el.textContent = ''; }, 4500); + } + const saved = () => toast(T('Demo settings saved for this tab.', '演示设置已保存到当前标签页。')); + function download(name, content) { + const blob = new Blob([content], { type: 'application/json' }); + const url = URL.createObjectURL(blob), a = document.createElement('a'); + a.href = url; a.download = name; a.click(); + setTimeout(() => URL.revokeObjectURL(url), 1000); + } + function confirmDemo(title, description, callback) { + const dialog = document.createElement('dialog'); + dialog.className = 'demo-dialog'; + dialog.setAttribute('aria-labelledby', 'demo-dialog-title'); + dialog.innerHTML = '

' + esc(title) + '

' + esc(description) + '

' + button(T('Cancel', '取消'), 'cancel') + button(T('Confirm', '确认'), 'confirm', 'apply') + '
'; + document.body.appendChild(dialog); + dialog.addEventListener('close', () => dialog.remove()); + dialog.querySelector('[data-action="cancel"]').onclick = () => dialog.close(); + dialog.querySelector('[data-action="confirm"]').onclick = () => { dialog.close(); callback(); }; + dialog.showModal(); + } + + /* [LuCI code, native name, short label, ?lang= value] */ + const DEMO_LANGUAGES = [ + ['en', 'English', 'EN', 'en'], ['de', 'Deutsch', 'DE', 'de'], ['es', 'Español', 'ES', 'es'], + ['fr', 'Français', 'FR', 'fr'], ['it', 'Italiano', 'IT', 'it'], ['ja', '日本語', 'JA', 'ja'], + ['ko', '한국어', 'KO', 'ko'], ['pt_br', 'Português do Brasil', 'PT', 'pt-BR'], ['ru', 'Русский', 'RU', 'ru'], + ['tr', 'Türkçe', 'TR', 'tr'], ['vi', 'Tiếng Việt', 'VI', 'vi'], + ['zh_hans', '简体中文', '简', 'zh-Hans'], ['zh_hant', '繁體中文', '繁', 'zh-Hant'] + ]; + /* keep a requested catalogue language (?lang=de); demo-only text is English or Chinese */ + if (/^zh/i.test(document.documentElement.lang)) document.documentElement.lang = /hant|tw|hk|mo/i.test(document.documentElement.lang) ? 'zh-Hant' : 'zh-Hans'; + document.body.dataset.page = active.replaceAll('/', '-'); + document.body.className = T('lang_en', 'lang_zh_Hans'); + document.title = P.title(active).filter(Boolean).join(' · ') + ' — Carbon Demo'; + document.querySelector('.cb-brand').href = P.url(overview); + document.querySelector('.cb-brand-text strong').textContent = P.settings.hostname; + document.getElementById('demo-banner').innerHTML = 'CARBON DEMO' + T('Explore the theme with simulated data.', '使用模拟数据体验主题效果。') + ''; + document.getElementById('indicators').textContent = T('Demo', '演示模式'); + C.initShell({ + logoutUrl: 'login.html?lang=' + document.documentElement.lang, + language: { + current: document.documentElement.lang, + /* every bundled catalogue, as LuCI lists installed languages (code → ?lang=) */ + load: () => Promise.resolve({ + options: DEMO_LANGUAGES.map(([code, label, short]) => ({ code: code, label: label, short: short })), + selected: (DEMO_LANGUAGES.find(([, , , lang]) => lang.toLowerCase() === document.documentElement.lang.toLowerCase()) || DEMO_LANGUAGES[0])[0] + }), + set(code) { + const next = new URL(location.href); + next.searchParams.set('lang', code === 'auto' ? 'zh-Hans' : DEMO_LANGUAGES.find(([c]) => c === code)[3]); + next.searchParams.set('page', active); + location.assign(next.href); + return new Promise(() => {}); + } + } + }); + C.renderNav(P.model(active)); + C.setTitle(P.title(active)); + if (requested !== active) toast(T('Page not found. Showing the overview.', '未找到该演示页面,已显示概览。')); + + async function render() { + if (active === overview) { + const board = await P.provider.board(); + view.innerHTML = section(T('System details', '系统详情'), table([T('Property', '项目'), T('Value', '值')], [ + [T('Hostname', '主机名'), esc(board.hostname)], [T('Model', '型号'), esc(board.model)], + [T('Firmware', '固件'), esc(board.release.description)], [T('Kernel', '内核'), esc(board.kernel)] + ])); + const host = document.createElement('div'); host.id = 'cb-dashboard'; + view.before(host); + C.Dashboard.mount(host, P.provider, { urls: { network: P.url('admin/network/network'), wireless: P.url('admin/network/wireless'), devices: P.url('admin/network/dhcp') } }); + C.detailsToggle(host, C.mode.get() === 'pro'); + return; + } + if (active === 'admin/network/network') { + const interfaces = (await P.provider.interfaces()).filter((it) => it.interface !== 'loopback'); + view.innerHTML = intro(T('Internet & Network', '上网与网络'), T('A sample dual-stack network with LAN, WAN and a guest interface.', '预览 LAN、WAN、IPv6 与访客网络的接口状态。')) + section(T('Interfaces', '网络接口'), table(['', T('Protocol', '协议'), T('Address', '地址'), T('Device', '设备'), T('Status', '状态')], interfaces.map((it) => [ + '' + esc(it.interface.toUpperCase()) + '', esc(it.proto), esc((it['ipv4-address'] || it['ipv6-address'] || []).map((a) => a.address + '/' + a.mask).join(', ') || '—'), esc(it.device), badge(it.up) + ]))) + section(T('Quick links', '快速访问'), '
' + link('admin/network/wireless', T('Configure Wi-Fi →', '配置无线网络 →')) + link('admin/network/dhcp', T('Connected devices →', '已连接设备 →')) + link('admin/network/diagnostics', T('Diagnostics →', '网络诊断 →')) + '
'); + } + if (active === 'admin/network/wireless') { + const s = P.settings; + view.innerHTML = intro(T('Wireless', '无线网络'), T('Try editing the network name and channel. Changes only affect this demo tab.', '试着修改网络名称与信道,设置仅对当前演示标签页生效。')) + section(T('Wireless networks', '无线网络'), table([T('Network', '网络'), T('Band / Channel', '频段 / 信道'), T('Security', '加密方式'), T('Status', '状态')], [ + [esc(s.ssid), '2.4 GHz / ' + esc(s.channel), esc(s.encryption === 'psk2' ? 'WPA2-PSK' : 'WPA2/WPA3'), badge(s.enabled)], + ['Carbon-Home-5G', '5 GHz / 149', 'WPA2/WPA3', badge(true)], ['Carbon-Guest', '2.4 GHz / ' + esc(s.channel), 'WPA2-PSK', badge(s.guest)] + ])) + section(T('Interface configuration', '接口配置'), form('wireless-form', + field(T('Enable 2.4 GHz', '启用 2.4 GHz'), 'enabled', check('enabled', s.enabled)) + + field(T('Network name (SSID)', '网络名称 (SSID)'), 'ssid', input('ssid', s.ssid, 'required maxlength="32"')) + + field(T('Demo password', '演示密码'), 'key', input('key', 'carbon-demo', 'type="password" required minlength="8" maxlength="63" autocomplete="off"'), T('8–63 characters. Use a sample password; it is not stored.', '8–63 位字符,请使用示例密码,演示不会保存密码。')) + + field(T('Encryption', '加密方式'), 'encryption', select('encryption', [['psk2', 'WPA2-PSK'], ['sae-mixed', 'WPA2/WPA3']], s.encryption)) + + field(T('Channel', '信道'), 'channel', select('channel', [['auto', T('Auto', '自动')], ['1', '1 (2412 MHz)'], ['6', '6 (2437 MHz)'], ['11', '11 (2462 MHz)']], s.channel)) + + field(T('Guest network', '访客网络'), 'guest', check('guest', s.guest)) + )); + document.getElementById('wireless-form').onsubmit = (e) => { + e.preventDefault(); const f = new FormData(e.target); + const ssid = f.get('ssid').trim(); + if (!ssid || new TextEncoder().encode(ssid).length > 32) { toast(T('SSID must contain 1–32 UTF-8 bytes.', '网络名称需为 1–32 个 UTF-8 字节。')); return; } + P.save({ ssid, channel: f.get('channel'), encryption: f.get('encryption'), enabled: f.has('enabled'), guest: f.has('guest') }); + render(); saved(); + }; + } + if (active === 'admin/network/dhcp') { + /* same id as LuCI's active-leases table, so Carbon adds brand avatars */ + const leaseTable = (headers, rows) => table(headers, rows).replace('
' + input('device-search', '', 'type="search" placeholder="' + T('Name, IP or MAC', '名称、IP 或 MAC 地址') + '"') + '
'; + const filter = () => { + const term = document.getElementById('device-search').value.toLowerCase(); + const rows = leases.filter((l) => [l.hostname, l.ipaddr, l.macaddr].join(' ').toLowerCase().includes(term)); + document.getElementById('device-count').textContent = rows.length + T(' devices', ' 台设备'); + document.getElementById('device-table').innerHTML = section(T('DHCP leases', 'DHCP 租约'), rows.length ? leaseTable([T('Hostname', '主机名'), 'IPv4', 'MAC', T('Lease', '租期')], rows.map((l) => [esc(l.hostname || T('Unknown device', '未知设备')), esc(l.ipaddr), '' + esc(l.macaddr) + '', l.expires === false ? T('Static', '静态') : Math.round(l.expires / 3600) + T(' hours', ' 小时')])) : '

' + T('No matching devices.', '没有匹配的设备。') + '

'); + }; + document.getElementById('device-search').oninput = filter; filter(); + } + if (active === 'admin/system/system') { + view.innerHTML = intro(T('System', '系统设置'), T('Preview the system configuration form.', '体验系统设置表单的样式与保存反馈。')) + section(T('General settings', '常规设置'), form('system-form', + field(T('Hostname', '主机名'), 'hostname', input('hostname', P.settings.hostname, 'required maxlength="63" pattern="[A-Za-z0-9](?:[A-Za-z0-9\\-]{0,61}[A-Za-z0-9])?"')) + + field(T('Model', '型号'), 'model', input('model', 'Xiaomi Redmi Router AX6000', 'readonly')) + + field(T('Timezone', '时区'), 'timezone', input('timezone', 'Asia/Shanghai', 'readonly')) + )); + document.getElementById('system-form').onsubmit = (e) => { + e.preventDefault(); P.save({ hostname: new FormData(e.target).get('hostname') }); + document.querySelector('.cb-brand-text strong').textContent = P.settings.hostname; saved(); + }; + } + if (active === 'admin/system/admin') { + view.innerHTML = intro(T('Administration', '管理密码'), T('Try form validation using a sample password. Nothing is sent or stored.', '使用示例密码体验表单校验,内容不会发送或保存。')) + section(T('Router password', '路由器密码'), form('password-form', + field(T('New demo password', '新演示密码'), 'password', input('password', '', 'type="password" required minlength="8" autocomplete="new-password"')) + + field(T('Confirm password', '确认密码'), 'confirm-password', input('confirm-password', '', 'type="password" required minlength="8" autocomplete="new-password"')) + )); + const f = document.getElementById('password-form'), confirm = document.getElementById('confirm-password'); + f.oninput = () => confirm.setCustomValidity(confirm.value === document.getElementById('password').value ? '' : T('Passwords do not match.', '两次输入的密码不一致。')); + f.onreset = () => confirm.setCustomValidity(''); + f.onsubmit = (e) => { e.preventDefault(); f.reset(); toast(T('Validation passed. No password was changed.', '校验通过,演示未修改任何密码。')); }; + } + if (active === 'admin/system/package-manager') { + const packages = [ ['luci-theme-carbon', C.version, true], ['luci-base', '25.040.12345', true], ['dnsmasq', '2.90-r4', true], ['luci-app-ddns', '2.8.2-r1', false], ['luci-app-upnp', '1.0.0-r2', false] ]; + let installed = {}; + try { installed = JSON.parse(sessionStorage.getItem('carbon.demo.packages') || '{}'); } catch (e) { /* defaults */ } + view.innerHTML = intro(T('Software', '软件包'), T('Browse a small sample catalogue and simulate package installation.', '浏览示例软件包列表,体验模拟安装。')) + '
' + input('package-search', '', 'type="search" placeholder="luci"') + '
'; + const draw = () => { + const rows = packages.filter((p) => p[0].includes(document.getElementById('package-search').value.toLowerCase())); + document.getElementById('package-table').innerHTML = section(T('Packages', '软件包列表'), rows.length ? table([T('Name', '名称'), T('Version', '版本'), T('Status', '状态')], rows.map(([name, version, initial]) => [esc(name), esc(version), initial || installed[name] ? '' + T('Installed', '已安装') + '' : ''])) : '

' + T('No matching packages.', '没有匹配的软件包。') + '

'); + }; + document.getElementById('package-search').oninput = draw; + document.getElementById('package-table').onclick = (e) => { + const btn = e.target.closest('[data-package]'); if (!btn) return; + installed[btn.dataset.package] = true; + try { sessionStorage.setItem('carbon.demo.packages', JSON.stringify(installed)); } catch (err) { /* memory only */ } + draw(); toast(T('Simulated installation complete.', '模拟安装已完成。')); + }; draw(); + } + if (active === 'admin/system/flash') { + view.innerHTML = intro(T('Backup & Upgrade', '备份与升级'), T('Explore the backup controls with a sample configuration file.', '体验备份操作,下载当前演示配置的示例文件。')) + section(T('Backup configuration', '备份配置'), '

' + T('The JSON download contains only demo settings. It is not an OpenWrt backup.', '下载的 JSON 仅包含演示设置,不是 OpenWrt 系统备份。') + '

' + button(T('Download demo backup', '下载演示备份'), 'backup', 'apply') + button(T('Reset demo settings', '重置演示设置'), 'reset', 'reset') + '
') + section(T('Firmware', '固件升级'), '

OpenWrt 24.10.0 · ARMv8 · Xiaomi Redmi Router AX6000

' + T('Firmware upload is unavailable in this static demo.', '静态演示不提供固件上传功能。') + '

' + T('Download Carbon releases ↗', '下载 Carbon 发布版本 ↗') + '
'); + view.querySelector('[data-action="backup"]').onclick = () => { download('carbon-demo-backup.json', JSON.stringify({ demo: true, settings: P.settings }, null, 2)); toast(T('Demo backup downloaded.', '演示备份已下载。')); }; + view.querySelector('[data-action="reset"]').onclick = () => confirmDemo(T('Reset demo settings?', '重置演示设置?'), T('Restore the sample configuration and package list for this tab.', '恢复当前标签页的示例配置和软件包列表。'), () => { + try { sessionStorage.removeItem('carbon.demo.settings'); sessionStorage.removeItem('carbon.demo.packages'); } catch (e) { /* no persisted data */ } + location.assign(P.url(overview)); + }); + } + if (active === 'admin/system/reboot') { + view.innerHTML = intro(T('Reboot', '重启'), T('Preview a confirmation dialog and the simulated reboot state.', '体验操作确认弹窗和模拟重启状态。')) + section(T('Restart device', '重启设备'), '

' + T('This action only runs a short demo animation.', '此操作仅演示短暂的重启等待效果。') + '

' + button(T('Simulate reboot', '模拟重启'), 'reboot', 'negative') + '

'); + const btn = view.querySelector('[data-action="reboot"]'); + btn.onclick = () => confirmDemo(T('Simulate a reboot?', '模拟重启?'), T('The demo will be ready again in two seconds.', '演示将在两秒后恢复就绪。'), () => { + btn.disabled = true; + document.getElementById('reboot-status').textContent = T('Restarting the demo…', '正在模拟重启…'); + setTimeout(() => { btn.disabled = false; document.getElementById('reboot-status').textContent = T('Demo ready. All services are online.', '演示已就绪,所有模拟服务均在线。'); }, 2000); + }); + } + if (active === 'admin/status/syslog') { + view.innerHTML = intro(T('System Log', '系统日志'), T('A sample of typical network and system events.', '预览网络与系统事件的示例日志。')) + section(T('Recent events', '最近事件'), '
' + esc([
+				'09:41:00 daemon.notice netifd: Interface \'wan\' is now up',
+				'09:41:01 daemon.info dnsmasq[1]: using nameserver 1.1.1.1#53',
+				'09:41:02 daemon.notice hostapd: phy1-ap0: AP-ENABLED',
+				'09:42:16 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.1.23 iPhone-15-Pro',
+				'09:43:08 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.1.31 MacBook-Air',
+				'09:44:00 user.info carbon: Demo data loaded; no router connected'
+			].join('\n')) + '
'); + } + if (active === 'admin/network/diagnostics') { + view.innerHTML = intro(T('Diagnostics', '网络诊断'), T('Run a simulated ping. No network request is made.', '运行模拟 Ping,不发送实际网络请求。')) + section('Ping', '
' + input('ping-host', 'openwrt.org', 'required maxlength="253" pattern="[A-Za-z0-9.:\\-]+"') + '
' + T('Ready.', '就绪。') + '
'); + document.getElementById('ping-form').onsubmit = (e) => { + e.preventDefault(); const btn = e.target.querySelector('button'), out = document.getElementById('ping-output'); + const host = document.getElementById('ping-host').value; btn.disabled = true; out.textContent = T('Simulating ping…', '正在模拟 Ping…'); + setTimeout(() => { btn.disabled = false; out.textContent = 'PING ' + host + ' (192.0.2.1) — DEMO\n64 bytes: seq=0 ttl=56 time=12.4 ms\n64 bytes: seq=1 ttl=56 time=11.8 ms\n64 bytes: seq=2 ttl=56 time=12.1 ms\n\n3 packets transmitted, 3 received, 0% packet loss'; }, 900); + }; + } + } + render().catch((error) => { view.textContent = T('Unable to load the demo. Please reload.', '演示加载失败,请刷新页面。'); console.error(error); }).finally(() => view.setAttribute('aria-busy', 'false')); +})(); diff --git a/luci-theme-carbon/preview/form.html b/luci-theme-carbon/preview/form.html new file mode 100644 index 000000000..bf35b81fc --- /dev/null +++ b/luci-theme-carbon/preview/form.html @@ -0,0 +1,17 @@ + + + + + + Wireless — Carbon Demo + + +

打开无线演示 / Open the wireless demo

+ + + diff --git a/luci-theme-carbon/preview/index.html b/luci-theme-carbon/preview/index.html new file mode 100644 index 000000000..2ae48ced1 --- /dev/null +++ b/luci-theme-carbon/preview/index.html @@ -0,0 +1,61 @@ + + + + + + + + OpenWrt · 概览 — Carbon 预览 + + + + + + + + + Skip to content / 跳到内容 +
+ +
+ +
+
+ +
+
+
+ 自动刷新 +
+
+ +
+
+ + + +

正在加载演示 / Loading demo…

+
+ + +
+
+ +
+ + + diff --git a/luci-theme-carbon/preview/lang.js b/luci-theme-carbon/preview/lang.js new file mode 100644 index 000000000..3f0485ae3 --- /dev/null +++ b/luci-theme-carbon/preview/lang.js @@ -0,0 +1,18 @@ +/* + * Preview language: ?lang= (default: the page's ), then the + * bundled catalogue the theme header would load for it (zh-Hant → zh-tw, + * pt-BR → pt-br, de-AT → de). Loaded synchronously before carbon.js; the + * catalogue directory comes from data-i18n so build-demo.py can rewrite it. + * CATALOGUES lists htdocs/luci-static/carbon/i18n/*.js; the browser tests + * fail if a catalogue is missing here. + */ +(function () { + var CATALOGUES = ['de', 'es', 'fr', 'it', 'ja', 'ko', 'pt-br', 'ru', 'tr', 'vi', 'zh-cn', 'zh-tw']; + var ALIAS = { 'zh-hans': 'zh-cn', 'zh-sg': 'zh-cn', 'zh-hant': 'zh-tw', 'zh-hk': 'zh-tw', 'zh-mo': 'zh-tw' }; + var root = document.documentElement; + var m = /[?&]lang=([A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})?)(?:&|$)/.exec(location.search); + if (m) root.lang = m[1]; + var lang = root.lang.toLowerCase(), base = lang.split('-')[0]; + var code = [ALIAS[lang] || lang, base].filter(function (c) { return CATALOGUES.indexOf(c) >= 0; })[0]; + if (code) document.write(' + + + + + + + + + + diff --git a/luci-theme-carbon/preview/mock.js b/luci-theme-carbon/preview/mock.js new file mode 100644 index 000000000..2d2aa014d --- /dev/null +++ b/luci-theme-carbon/preview/mock.js @@ -0,0 +1,166 @@ +/* + * Carbon preview — mock LuCI menu + ubus data. + * Lets you iterate on the theme in any browser without a router. + */ +(function () { + 'use strict'; + + const ZH = /^zh/i.test(document.documentElement.lang); + const T = (en, zh) => ZH ? zh : en; + + /* ---------------- menu tree (shape mirrors ui.menu) ---------------- */ + const MENU = [ + ['status', T('Status', '状态'), [ + ['overview', T('Overview', '概览')], ['syslog', T('System Log', '系统日志')] + ]], + ['system', T('System', '系统'), [ + ['system', T('System', '系统')], ['admin', T('Administration', '管理权')], ['package-manager', T('Software', '软件包')], + ['flash', T('Backup / Flash Firmware', '备份与升级')], ['reboot', T('Reboot', '重启')] + ]], + ['network', T('Network', '网络'), [ + ['network', T('Interfaces', '接口')], ['wireless', T('Wireless', '无线')], + ['dhcp', T('Connected Devices', '已连接设备')], ['diagnostics', T('Diagnostics', '网络诊断')] + ]] + ]; + + const url = (path) => 'index.html?' + new URLSearchParams({ lang: ZH ? 'zh-Hans' : 'en', page: path }); + const defaults = { hostname: 'OpenWrt', ssid: 'Carbon-Home', channel: '6', encryption: 'psk2', enabled: true, guest: false }; + let settings = Object.assign({}, defaults); + try { Object.assign(settings, JSON.parse(sessionStorage.getItem('carbon.demo.settings') || '{}')); } catch (e) { /* storage may be blocked */ } + + window.CarbonPreview = { + T, url, settings, + paths: MENU.flatMap((c) => c[2].map((ch) => 'admin/' + c[0] + '/' + ch[0])), + save(values) { + Object.assign(settings, values); + try { sessionStorage.setItem('carbon.demo.settings', JSON.stringify(settings)); } catch (e) { /* in-memory demo still works */ } + }, + model(active) { + return { + root: 'admin', + activePath: active.split('/'), + url, + categories: MENU.map((c) => ({ + name: c[0], title: c[1], path: 'admin/' + c[0], url: url('admin/' + c[0] + '/' + c[2][0][0]), + children: c[2].map((ch) => ({ name: ch[0], title: ch[1], path: 'admin/' + c[0] + '/' + ch[0], url: url('admin/' + c[0] + '/' + ch[0]) })) + })) + }; + }, + title(active) { + const p = active.split('/'); + const c = MENU.find((m) => m[0] === p[1]); + const ch = c && c[2].find((x) => x[0] === p[2]); + return [c && c[1], ch && ch[1]]; + } + }; + + /* ---------------- ubus-shaped mock data ---------------- */ + const t0 = Date.now(); + const MB = 1024 * 1024; + const rnd = (a, b) => a + Math.random() * (b - a); + + let cpu = { user: 120000, nice: 0, system: 60000, idle: 2400000, iowait: 2000, irq: 0, softirq: 9000 }; + let busy = 0.18; + let rx = 18.6 * 1024 * MB, tx = 2.3 * 1024 * MB; + let burst = 0, load = 0.42; + + function tickCounters() { + const elapsed = 2; + busy = Math.min(0.85, Math.max(0.04, busy + rnd(-0.06, 0.06))); + const ticks = 100 * elapsed * 4; + cpu.user += ticks * busy * 0.65; + cpu.system += ticks * busy * 0.25; + cpu.softirq += ticks * busy * 0.1; + cpu.idle += ticks * (1 - busy); + + if (burst <= 0 && Math.random() < 0.12) burst = Math.round(rnd(4, 14)); + const down = burst > 0 ? rnd(4, 12.5) * MB : rnd(80, 900) * 1024; + const up = burst > 0 ? rnd(300, 1400) * 1024 : rnd(20, 220) * 1024; + burst--; + rx += down * elapsed; + tx += up * elapsed; + load = Math.max(0.05, load + rnd(-0.08, 0.08)); + } + // Only the overview needs live counters; other views use static fixtures. + const requestedPage = new URLSearchParams(location.search).get('page') || location.hash.slice(1); + if (!window.CarbonPreview.paths.includes(requestedPage) || requestedPage === 'admin/status/overview') + setInterval(tickCounters, 2000); + tickCounters(); + + const wait = (v) => new Promise((r) => setTimeout(() => r(v), rnd(40, 160))); + + /* covers: hostname match, OUI match, private (random) MAC, chip-vendor hint, unknown */ + const LEASES = [ + ['iPhone-15-Pro', '192.168.1.23', 'a6:83:e7:2c:91:0f', 38000], /* private MAC, hostname → Apple */ + ['MacBook-Air', '192.168.1.31', 'f0:ee:7a:91:aa:12', 40211], + ['', '192.168.1.42', 'f0:ee:7a:66:0b:3e', 21000], /* no hostname, Apple OUI */ + ['Mi-TV-4S', '192.168.1.105', '28:6c:07:1a:44:9d', false], + ['HUAWEI-P60', '192.168.1.57', '58:d7:59:0c:13:71', 3600], + ['DESKTOP-7Q2K1MB', '192.168.1.20', 'e4:c7:67:12:7d:c4', 41000], + ['zhimi-airpurifier-ma4', '192.168.1.110', '8c:d0:b2:8a:2f:01', 39000], + ['Galaxy-S24', '192.168.1.66', '64:1b:2f:77:31:aa', 12000], + ['PS5-327', '192.168.1.88', 'f4:64:12:3d:c2:19', 26000], + ['', '192.168.1.143', 'de:ad:be:ef:12:34', 7000], /* random MAC, nothing known */ + ['Echo-Dot', '192.168.1.121', '44:00:49:ab:cd:ef', 30500], + ['raspberrypi', '192.168.1.200', 'dc:a6:32:01:02:03', false], + ['', '192.168.1.150', 'd4:8a:fc:11:22:33', 30000], /* ESP32 by OUI */ + ['OPPO-Find-X7', '192.168.1.71', '6e:11:22:33:44:55', 18000], + ['HP-LaserJet-M1136', '192.168.1.30', '00:1b:78:44:55:66', false], + ['Living-Room-TV', '192.168.1.106', '00:11:22:33:44:56', 20000] + ].map((l) => ({ hostname: l[0], ipaddr: l[1], macaddr: l[2], expires: l[3] })); + + window.CarbonPreview.provider = { + board: () => wait({ + hostname: settings.hostname, + model: 'Xiaomi Redmi Router AX6000', + kernel: '6.6.73', + release: { distribution: 'OpenWrt', version: '24.10.0', description: 'OpenWrt 24.10.0 r28427-6df0e3d02a' } + }), + info: () => wait({ + uptime: 273600 + Math.round((Date.now() - t0) / 1000), + load: [load, load * 0.8, load * 0.6].map((x) => Math.round(x * 65536)), + memory: { total: 512 * MB, free: 181 * MB, shared: 2 * MB, buffered: 9 * MB, cached: 96 * MB, available: 286 * MB + rnd(-4, 4) * MB }, + root: { total: 114688, free: 76000, used: 38688, avail: 76000 } + }), + cpuStat: () => wait('cpu ' + [cpu.user, cpu.nice, cpu.system, cpu.idle, cpu.iowait, cpu.irq, cpu.softirq, 0].map(Math.round).join(' ') + + '\ncpu0 0\ncpu1 0\ncpu2 0\ncpu3 0\nintr 0\n'), + interfaces: () => wait([ + { interface: 'lan', up: true, proto: 'static', device: 'br-lan', l3_device: 'br-lan', 'ipv4-address': [{ address: '192.168.1.1', mask: 24 }], route: [] }, + { interface: 'loopback', up: true, proto: 'static', device: 'lo', l3_device: 'lo', 'ipv4-address': [{ address: '127.0.0.1', mask: 8 }], route: [] }, + { interface: 'wan', up: true, proto: 'pppoe', device: 'wan', l3_device: 'pppoe-wan', 'ipv4-address': [{ address: '100.64.23.18', mask: 32 }], route: [{ target: '0.0.0.0', mask: 0, nexthop: '100.64.0.1' }] }, + { interface: 'wan6', up: true, proto: 'dhcpv6', device: 'pppoe-wan', l3_device: 'pppoe-wan', 'ipv6-address': [{ address: '240e:3a1:4c2:8f0::1', mask: 64 }], route: [{ target: '::', mask: 0 }] }, + { interface: 'guest', up: false, proto: 'static', device: 'br-guest', 'ipv4-address': [], route: [] } + ]), + devStats: () => wait({ rx_bytes: Math.round(rx), tx_bytes: Math.round(tx) }), + /* kernel devices (luci-rpc getNetworkDevices): physical ports show up in the traffic picker */ + netDevices: () => wait([ + ['lo', true, { loopback: true }], ['eth0', true], ['wan', true], ['lan1', true], ['lan2', true], ['lan3', false], ['lan4', true], + ['br-lan', true], ['pppoe-wan', true], ['phy0-ap0', true], ['phy1-ap0', true], ['ifb0', false], ['sit0', false] + ].reduce((o, d) => (o[d[0]] = { name: d[0], up: d[1], flags: Object.assign({ up: d[1] }, d[2]), stats: { rx_bytes: 0, tx_bytes: 0 } }, o), {})), + leases: () => wait({ dhcp_leases: LEASES, dhcp6_leases: [] }), + wireless: () => wait({ + radio0: { up: settings.enabled, config: { band: '2g', channel: settings.channel }, interfaces: [ + { ifname: 'phy0-ap0', config: { mode: 'ap', ssid: settings.ssid, encryption: settings.encryption, disabled: !settings.enabled } }, + { ifname: 'phy0-ap1', config: { mode: 'ap', ssid: 'Carbon-Guest', encryption: 'psk2', disabled: !settings.guest } } + ] }, + radio1: { up: true, config: { band: '5g', channel: '149' }, interfaces: [ + { ifname: 'phy1-ap0', config: { mode: 'ap', ssid: 'Carbon-Home-5G', encryption: 'sae-mixed' } } + ] } + }), + /* Wi‑Fi clients, a static-IP NAS seen only in ARP, and host hints for names */ + stations: (ifnames) => wait([ + ['phy1-ap0', 'a6:83:e7:2c:91:0f', -48], ['phy1-ap0', 'f0:ee:7a:91:aa:12', -55], ['phy0-ap0', '28:6c:07:1a:44:9d', -63], + ['phy1-ap0', '58:d7:59:0c:13:71', -51], ['phy0-ap0', '8c:d0:b2:8a:2f:01', -71], ['phy1-ap0', '64:1b:2f:77:31:aa', -58], + ['phy0-ap0', 'd4:8a:fc:11:22:33', -67], ['phy1-ap0', '6e:11:22:33:44:55', -60] + ].filter((st) => ifnames.includes(st[0])).map((st) => ({ ifname: st[0], mac: st[1], signal: st[2] + Math.round(rnd(-2, 2)) }))), + neighbors: () => wait('IP address HW type Flags HW address Mask Device\n' + [ + ['192.168.1.20', 'e4:c7:67:12:7d:c4'], ['192.168.1.5', '00:11:32:aa:bb:cc'], ['100.64.0.1', '00:00:5e:00:01:01', 'pppoe-wan'] + ].map((n) => n[0].padEnd(17) + '0x1 0x2 ' + n[1] + ' * ' + (n[2] || 'br-lan')).join('\n') + '\n'), + hostHints: () => wait({ '00:11:32:AA:BB:CC': { name: 'DiskStation', ipaddrs: ['192.168.1.5'] } }), + conntrack: () => wait([String(Math.round(1284 + rnd(-60, 60))), '16384']), + temperatures: () => wait([ + { name: 'cpu-thermal', value: Math.round(52300 + rnd(-800, 800)) }, + { name: 'mt7986_phy1', value: Math.round(47800 + rnd(-500, 500)) } + ]) + }; +})(); diff --git a/luci-theme-carbon/root/etc/uci-defaults/30_luci-theme-carbon b/luci-theme-carbon/root/etc/uci-defaults/30_luci-theme-carbon new file mode 100755 index 000000000..3c6dba609 --- /dev/null +++ b/luci-theme-carbon/root/etc/uci-defaults/30_luci-theme-carbon @@ -0,0 +1,24 @@ +#!/bin/sh +# Register the Carbon theme and make it the default on first install. + +changed=0 + +if ! uci -q get luci.themes.Carbon >/dev/null 2>&1; then + uci set luci.themes.Carbon=/luci-static/carbon + changed=1 +fi + +if [ "$PKG_UPGRADE" != 1 ] && [ "$changed" = 1 ]; then + uci set luci.main.mediaurlbase=/luci-static/carbon +fi + +[ "$changed" = 1 ] && uci commit luci + +# Updater settings (download mirror); kept across upgrades. +[ -f /etc/config/carbon ] || touch /etc/config/carbon +if ! uci -q get carbon.update >/dev/null 2>&1; then + uci set carbon.update=update + uci commit carbon +fi + +exit 0 diff --git a/luci-theme-carbon/root/lib/upgrade/keep.d/luci-theme-carbon b/luci-theme-carbon/root/lib/upgrade/keep.d/luci-theme-carbon new file mode 100644 index 000000000..2f73239e6 --- /dev/null +++ b/luci-theme-carbon/root/lib/upgrade/keep.d/luci-theme-carbon @@ -0,0 +1,2 @@ +# Carbon theme: custom logo (System → Carbon Theme Settings) +/www/luci-static/carbon/custom/ diff --git a/luci-theme-carbon/root/usr/libexec/rpcd/luci.carbon_update b/luci-theme-carbon/root/usr/libexec/rpcd/luci.carbon_update new file mode 100755 index 000000000..e79d01077 --- /dev/null +++ b/luci-theme-carbon/root/usr/libexec/rpcd/luci.carbon_update @@ -0,0 +1,309 @@ +#!/bin/sh +# Carbon theme settings backend: verified theme updates and the custom logo. +# RPC callers can select a checked version, never a URL or command. +# An optional HTTPS download mirror (uci carbon.update.mirror) only carries the +# package bytes; release metadata, size and SHA-256 always come from GitHub. +# A custom logo is uploaded by LuCI's cgi-upload to $logo_upload (the only file +# the ACL lets it write), validated here and published under $logo_dir, which +# sysupgrade keeps (/lib/upgrade/keep.d/luci-theme-carbon). +. /usr/share/libubox/jshn.sh +umask 077 +state_dir=/tmp/carbon-update +key_dir=/usr/share/carbon/keys +repository=mrjoechen/luci-theme-carbon +package_name=luci-theme-carbon +logo_dir=/www/luci-static/carbon/custom +logo_upload=/tmp/carbon-logo.upload +logo_max=262144 +logo_exts='svg png webp jpg gif' + +valid_mirror() { + [ "${#1}" -le 200 ] && printf '%s\n' "$1" | grep -Eq '^https://[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?(:[0-9]{1,5})?(/[A-Za-z0-9._~%+-]+)*/$' +} +mirror_prefix() { + mirror=$(uci -q get carbon.update.mirror 2>/dev/null) || mirror='' + valid_mirror "$mirror" || mirror='' +} +valid_version() { [ "${#1}" -le 40 ] && printf '%s\n' "$1" | grep -Eq '^[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}-r[0-9]{1,6}$'; } +prepare() { + [ ! -L "$state_dir" ] && mkdir -p "$state_dir" && + [ "$(ls -nd "$state_dir" | awk '{print $3}')" = 0 ] && chmod 700 "$state_dir" +} +opkg_call() ( + # Even `opkg status` takes the native DB lock. Serialize our polls and worker + # so a page refresh cannot make installation or its version check fail. + exec 7>"$state_dir/opkg.lock" + flock -w 5 7 || exit 1 + opkg "$@" 7>&- +) +installed() { + manager=''; current=''; managed=0 + if command -v apk >/dev/null 2>&1 && [ -f /etc/apk/world ]; then + manager=apk + current=$(apk --repositories-file /dev/null --no-network list --installed "$package_name" 2>/dev/null | sed -n 's/^luci-theme-carbon-\([^ ]*\) .*/\1/p' | head -n 1) + elif command -v opkg >/dev/null 2>&1; then + manager=opkg + current=$(opkg_call status "$package_name" 2>/dev/null | awk '/^Version: / {v=$2} /^Status: .* installed$/ {ok=1} END {if(ok) print v}') + fi + if valid_version "$current"; then managed=1 + else current=$(cat /usr/share/carbon/version 2>/dev/null); fi +} +newer() { + valid_version "$target" && valid_version "$current" || return 1 + case "$manager" in + apk) [ "$(apk version -t "$target" "$current" 2>/dev/null)" = '>' ] ;; + opkg) opkg_call compare-versions "$target" '>>' "$current" ;; + *) return 1 ;; + esac +} +tools_ready() { + for tool in curl flock sha256sum setsid; do command -v "$tool" >/dev/null 2>&1 || return 1; done + [ "$manager" != apk ] || [ -s "$key_dir/carbon-apk.pem" ] +} +load_release() { + target=''; tag=''; filename=''; digest=''; size=0; checked=0; notes='' + [ -s "$state_dir/release.json" ] && json_load_file "$state_dir/release.json" || return 1 + json_get_vars target tag filename digest size checked notes +} +fresh() { now=$(date +%s); [ "$checked" -le "$now" ] && [ "$((now - checked))" -le 1800 ]; } +write_status() { + phase=$1; error=${2:-}; log='' + [ -z "${job:-}" ] || log=$(tail -c 4096 "$job/log" 2>/dev/null) + json_init + json_add_string state "$phase" + json_add_string error "$error" + json_add_string log "$log" + json_dump > "$state_dir/status.$$" + mv "$state_dir/status.$$" "$state_dir/status.json" +} +error_reply() { json_init; json_add_string error "$1"; json_dump; } +status_reply() { + phase=idle; error=''; log='' + if [ -s "$state_dir/status.json" ] && json_load_file "$state_dir/status.json"; then json_get_vars state error log; phase=$state; fi + busy=0 + if command -v flock >/dev/null 2>&1; then + exec 8>"$state_dir/lock" + if flock -n 8; then + case "$phase" in checking|downloading|verifying|installing) write_status failed interrupted ;; esac + else busy=1; fi + fi + installed + load_release || : + can_upgrade=0; reason='' + if ! tools_ready; then reason=dependencies + elif [ "$managed" != 1 ]; then reason=manual_install + elif [ "$busy" = 0 ] && [ -n "$target" ] && newer && fresh; then can_upgrade=1; fi + json_init + json_add_string state "$phase"; json_add_string error "$error"; json_add_string log "$log" + json_add_string current "$current"; json_add_string manager "$manager" + json_add_string latest "$target"; json_add_string tag "$tag"; json_add_string notes "$notes" + mirror_prefix; json_add_string mirror "$mirror" + json_add_string logo "$(logo_url)" + json_add_int checked_at "$checked"; json_add_boolean busy "$busy" + json_add_boolean can_upgrade "$can_upgrade"; json_add_string reason "$reason" + json_dump +} +download() { + # Bound disk use even on curl versions that only enforce Content-Length. + (ulimit -f 8192; curl --fail --silent --show-error --location --proto '=https' --proto-redir '=https' \ + --connect-timeout 5 --max-time "$3" --max-filesize 4194304 -o "$2" "$1") 9>&- +} +save_preferences() { + had_theme=1; saved_theme=$(uci -q get luci.main.mediaurlbase) || had_theme=0 + had_language=1; saved_language=$(uci -q get luci.main.lang) || had_language=0 + settings_saved=1 +} +restore_preferences() { + [ "${settings_saved:-0}" = 1 ] || return 0 + # Older package removal hooks can reset the active theme during an upgrade. + if [ "$had_theme" = 1 ]; then uci set "luci.main.mediaurlbase=$saved_theme" + else uci -q delete luci.main.mediaurlbase || :; fi + if [ "$had_language" = 1 ]; then uci set "luci.main.lang=$saved_language" + else uci -q delete luci.main.lang || :; fi + uci commit luci +} +check_release() { + rm -f "$state_dir/release.json" + download "https://api.github.com/repos/$repository/releases/latest" "$job/release.json" 15 || { failure=network; return 1; } + [ "$(wc -c < "$job/release.json")" -le 1048576 ] && json_load_file "$job/release.json" || { failure=metadata; return 1; } + json_get_vars tag_name draft prerelease body + [ "$draft" = 0 ] && [ "$prerelease" = 0 ] && printf '%s\n' "$tag_name" | grep -Eq '^v[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}$' || { failure=metadata; return 1; } + tag=$tag_name; version=${tag#v}; notes=$(printf '%s' "$body" | head -c 12000) + json_select assets || { failure=metadata; return 1; } + json_get_keys assets + found=0 + for asset in $assets; do + json_select "$asset" + json_get_vars name digest size + case "$manager" in + apk) pattern="^luci-theme-carbon-${version}-r[0-9]+\\.apk$" ;; + opkg) pattern="^luci-theme-carbon_${version}-r[0-9]+_all\\.ipk$" ;; + *) failure=manual_install; return 1 ;; + esac + if printf '%s\n' "$name" | grep -Eq "$pattern"; then + [ "$found" = 0 ] || { failure=metadata; return 1; } + found=1; filename=$name; hash=${digest#sha256:}; bytes=$size + fi + json_select .. + done + [ "$found" = 1 ] && printf '%s\n' "$hash" | grep -Eq '^[a-f0-9]{64}$' && + printf '%s\n' "$bytes" | grep -Eq '^[0-9]{1,7}$' && [ "$bytes" -gt 0 ] && [ "$bytes" -le 4194304 ] || { failure=metadata; return 1; } + target=$(printf '%s' "$filename" | sed -e 's/^luci-theme-carbon[-_]//' -e 's/_all\.ipk$//' -e 's/\.apk$//') + valid_version "$target" || { failure=metadata; return 1; } + json_init + json_add_string target "$target"; json_add_string tag "$tag"; json_add_string filename "$filename" + json_add_string digest "$hash"; json_add_int size "$bytes"; json_add_int checked "$(date +%s)"; json_add_string notes "$notes" + json_dump > "$job/checked.json" + mv "$job/checked.json" "$state_dir/release.json" +} +install_release() { + load_release && [ "$target" = "$requested" ] && fresh && newer && [ "$managed" = 1 ] || { failure=stale; return 1; } + free=$(df -Pk "$state_dir" | awk 'END {print $4}') + [ "$free" -ge "$((size / 1024 * 3 + 2048))" ] || { failure=space; return 1; } + package="$job/$filename" + url="https://github.com/$repository/releases/download/$tag/$filename" + mirror_prefix + # Mirror first when configured, then GitHub. Each copy must match GitHub's size and SHA-256. + failure=network + for source in ${mirror:+mirror} github; do + case "$source" in mirror) from="$mirror$url" ;; *) from=$url ;; esac + echo "Downloading from $source: $from" + write_status downloading + rm -f "$package" + download "$from" "$package" 90 || { echo "Download from $source failed"; failure=network; continue; } + write_status verifying + if [ "$(wc -c < "$package")" = "$size" ] && [ "$(sha256sum "$package" | awk '{print $1}')" = "$digest" ]; then + failure='' + break + fi + echo "Size or SHA-256 mismatch from $source" + failure=checksum + done + [ -z "$failure" ] || return 1 + case "$manager" in + apk) + apk --keys-dir "$key_dir" --repositories-file /dev/null --no-network verify "$package" 9>&- || { failure=signature; return 1; } + apk --keys-dir "$key_dir" --repositories-file /dev/null --no-network adbdump "$package" > "$job/info" 9>&- || { failure=metadata; return 1; } + actual=$(awk '/^info:/ {info=1;next} /^paths:/ {exit} info && /^ name:/ {n=$2} info && /^ version:/ {v=$2} END {print n " " v}' "$job/info") + ;; + opkg) + tar -xzOf "$package" ./control.tar.gz > "$job/control.tar.gz" && tar -xzOf "$job/control.tar.gz" ./control > "$job/control" || { failure=metadata; return 1; } + actual=$(awk '/^Package:/ {n=$2} /^Version:/ {v=$2} END {print n " " v}' "$job/control") + ;; + esac + [ "$actual" = "$package_name $target" ] || { failure=metadata; return 1; } + # Recheck immediately before mutation; the native manager also owns its DB lock. + installed; newer || { failure=stale; return 1; } + save_preferences + write_status installing + case "$manager" in + apk) apk --keys-dir "$key_dir" --repositories-file /dev/null --no-network add "$package" 9>&- || { failure=install; return 1; } ;; + opkg) opkg_call install "$package" 9>&- || { failure=install; return 1; } ;; + esac + restore_preferences || { failure=settings; return 1; } + settings_saved=0 + installed + [ "$managed" = 1 ] && [ "$current" = "$target" ] || { failure=version; return 1; } +} +start_job() { + installed + tools_ready || { error_reply dependencies; return; } + [ "$managed" = 1 ] || { error_reply manual_install; return; } + exec 9>"$state_dir/lock" + flock -n 9 || { error_reply busy; return; } + for old in "$state_dir"/job.*; do [ ! -d "$old" ] || rm -rf "$old"; done + if [ "$1" = upgrade ]; then + json_load "$input" && json_get_var requested version && valid_version "$requested" || { error_reply invalid; return; } + load_release && [ "$requested" = "$target" ] && newer && fresh || { error_reply stale; return; } + fi + job=$(mktemp -d "$state_dir/job.XXXXXX") || { error_reply space; return; } + cp "$0" "$job/worker" && chmod 700 "$job/worker" || { error_reply space; return; } + case "$1" in check) write_status checking ;; upgrade) write_status downloading ;; esac + # Keep the inherited flock until the worker exits, even across rpcd reloads. + setsid "$job/worker" worker "$1" "${requested:-}" "$job/log" 2>&1 & + json_init; json_add_boolean started 1; json_dump +} + +configure() { + json_load "$input" 2>/dev/null && json_get_var value mirror || { error_reply invalid_mirror; return; } + value=$(printf '%s' "$value" | tr -d ' \t\r\n') + [ -z "$value" ] || case "$value" in */) ;; *) value="$value/" ;; esac + [ -z "$value" ] || valid_mirror "$value" || { error_reply invalid_mirror; return; } + [ -f /etc/config/carbon ] || touch /etc/config/carbon + uci -q get carbon.update >/dev/null || uci set carbon.update=update + if [ -n "$value" ]; then uci set "carbon.update.mirror=$value"; else uci -q delete carbon.update.mirror || :; fi + uci commit carbon || { error_reply state; return; } + json_init; json_add_string mirror "$value"; json_dump +} + +# ---- custom logo ---------------------------------------------------------- +logo_url() { + for ext in $logo_exts; do + [ -f "$logo_dir/logo.$ext" ] && [ ! -L "$logo_dir/logo.$ext" ] || continue + stamp=$(date -r "$logo_dir/logo.$ext" +%s 2>/dev/null) || stamp='' + printf '/luci-static/carbon/custom/logo.%s%s' "$ext" "${stamp:+?v=$stamp}" + return 0 + done +} +# Image type from the file's magic bytes (never from its name). +# Plain head/printf comparisons: OpenWrt's default BusyBox has no od -t. +logo_type() { + case "$(head -c 6 "$1")" in GIF87a|GIF89a) echo gif; return 0 ;; esac + if [ "$(head -c 4 "$1")" = RIFF ] && [ "$(head -c 12 "$1" | tail -c 4)" = WEBP ]; then echo webp; return 0; fi + if [ "$(head -c 8 "$1")" = "$(printf '\211PNG\r\n\032\n')" ]; then echo png; return 0; fi + if [ "$(head -c 3 "$1")" = "$(printf '\377\330\377')" ]; then echo jpg; return 0; fi + head -c 4096 "$1" | tr 'A-Z' 'a-z' | grep -q ', where SVG scripts never run, but the file is +# also reachable by URL on the LuCI origin. Reject anything that could run there. +svg_safe() { + flat=$(tr 'A-Z\n\r\t' 'a-z ' < "$1") + printf '%s' "$flat" | grep -Eq ']|<(set|animate)[ />]|/dev/null || : + logo_reply +} +logo() { + json_load "$input" 2>/dev/null && json_get_var action action || { error_reply invalid; return; } + case "$action" in set) set_logo ;; reset) reset_logo ;; *) error_reply invalid ;; esac +} + +case "$1" in + list) printf '%s\n' '{"status":{},"check":{},"upgrade":{"version":""},"configure":{"mirror":""},"logo":{"action":""}}' ;; + call) + input=$(cat) + prepare || { error_reply state; exit 0; } + case "$2" in status) status_reply ;; check|upgrade) start_job "$2" ;; configure) configure ;; logo) logo ;; *) error_reply invalid ;; esac + ;; + worker) + job=${0%/*}; requested=${3:-}; failure=interrupted; complete=0 + trap 'restore_preferences; [ "$complete" = 1 ] || write_status failed "$failure"; rm -rf "$job"' EXIT + trap 'exit 1' HUP INT TERM + installed + case "$2" in check) check_release && write_status idle && complete=1 ;; upgrade) install_release && write_status success && complete=1 ;; esac + ;; + *) exit 1 ;; +esac diff --git a/luci-theme-carbon/root/usr/share/carbon/keys/carbon-apk.pem b/luci-theme-carbon/root/usr/share/carbon/keys/carbon-apk.pem new file mode 100644 index 000000000..bdcf40c3e --- /dev/null +++ b/luci-theme-carbon/root/usr/share/carbon/keys/carbon-apk.pem @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEk4IsOZJTOu1XrRx6Q0NtlsyU3M5h +WPbqs+/OYZTpcT1GP7MeGZI92LV0Z1YQjygAN8ikf/8ssfJMw8izfbgY0A== +-----END PUBLIC KEY----- diff --git a/luci-theme-carbon/root/usr/share/carbon/version b/luci-theme-carbon/root/usr/share/carbon/version new file mode 100644 index 000000000..c30b5cc22 --- /dev/null +++ b/luci-theme-carbon/root/usr/share/carbon/version @@ -0,0 +1 @@ +1.1.5-r1 diff --git a/luci-theme-carbon/root/usr/share/luci/menu.d/luci-theme-carbon.json b/luci-theme-carbon/root/usr/share/luci/menu.d/luci-theme-carbon.json new file mode 100644 index 000000000..1c379206e --- /dev/null +++ b/luci-theme-carbon/root/usr/share/luci/menu.d/luci-theme-carbon.json @@ -0,0 +1,8 @@ +{ + "admin/system/carbon-update": { + "title": "Carbon Theme Settings", + "order": 95, + "action": { "type": "view", "path": "system/carbon-update" }, + "depends": { "acl": [ "luci-theme-carbon-update" ] } + } +} diff --git a/luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon-update.json b/luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon-update.json new file mode 100644 index 000000000..38ef8087c --- /dev/null +++ b/luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon-update.json @@ -0,0 +1,10 @@ +{ + "luci-theme-carbon-update": { + "description": "Carbon theme settings: check releases, install verified theme updates, choose a download mirror and set a custom logo", + "read": { "ubus": { "luci.carbon_update": [ "status", "check" ] } }, + "write": { + "ubus": { "luci.carbon_update": [ "upgrade", "configure", "logo" ] }, + "file": { "/tmp/carbon-logo.upload": [ "write" ] } + } + } +} diff --git a/luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon.json b/luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon.json new file mode 100644 index 000000000..a4199e061 --- /dev/null +++ b/luci-theme-carbon/root/usr/share/rpcd/acl.d/luci-theme-carbon.json @@ -0,0 +1,43 @@ +{ + "luci-theme-carbon": { + "description": "Carbon theme: read-only dashboard data and the interface language switch", + "read": { + "ubus": { + "system": [ "board", "info" ], + "network.interface": [ "dump" ], + "network.device": [ "status" ], + "network.wireless": [ "status" ], + "iwinfo": [ "assoclist" ], + "luci-rpc": [ "getDHCPLeases", "getNetworkDevices", "getHostHints" ], + "file": [ "list", "read" ], + "uci": [ "get" ] + }, + "file": { + "/proc/stat": [ "read" ], + "/proc/net/arp": [ "read" ], + "/proc/[0-9]*/net/arp": [ "read" ], + "/proc/sys/net/netfilter/nf_conntrack_count": [ "read" ], + "/proc/sys/net/netfilter/nf_conntrack_max": [ "read" ], + "/sys/class/thermal": [ "list" ], + "/sys/class/thermal/thermal_zone*/temp": [ "read" ], + "/sys/class/thermal/thermal_zone*/type": [ "read" ], + "/sys/devices/*/thermal_zone*/temp": [ "read" ], + "/sys/devices/*/thermal_zone*/type": [ "read" ], + "/sys/class/hwmon": [ "list" ], + "/sys/class/hwmon/hwmon*": [ "list" ], + "/sys/class/hwmon/hwmon*/name": [ "read" ], + "/sys/class/hwmon/hwmon*/temp*_input": [ "read" ], + "/sys/devices/*/hwmon[0-9]*": [ "list" ], + "/sys/devices/*/hwmon[0-9]*/name": [ "read" ], + "/sys/devices/*/hwmon[0-9]*/temp*_input": [ "read" ] + }, + "uci": [ "luci" ] + }, + "write": { + "ubus": { + "uci": [ "set", "commit" ] + }, + "uci": [ "luci" ] + } + } +} diff --git a/luci-theme-carbon/scripts/build-css.py b/luci-theme-carbon/scripts/build-css.py new file mode 100644 index 000000000..a10dfc540 --- /dev/null +++ b/luci-theme-carbon/scripts/build-css.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +"""Concatenate styles/NN-*.css into htdocs/luci-static/carbon/carbon.css. + + python3 -I scripts/build-css.py write carbon.css + python3 -I scripts/build-css.py --check CI: fail if carbon.css is stale + +carbon.css is committed so every install path (SDK, installer, .ipk, demo) +ships one stylesheet request without a build step. Edit the files in styles/. +""" +from pathlib import Path +import sys + +ROOT = Path(__file__).resolve().parent.parent +SOURCES = ROOT / 'styles' +TARGET = ROOT / 'htdocs' / 'luci-static' / 'carbon' / 'carbon.css' +BANNER = '/* Generated by scripts/build-css.py from styles/*.css. Do not edit. */\n\n' + + +def build(): + files = sorted(SOURCES.glob('[0-9][0-9]-*.css')) + if not files or files[0].name != '00-header.css': + raise SystemExit('styles/00-header.css must exist and sort first') + parts = [f.read_text(encoding='utf-8') for f in files] + return parts[0] + BANNER + ''.join(parts[1:]) + + +def main(check): + text = build() + current = TARGET.read_text(encoding='utf-8') if TARGET.exists() else None + if check: + if current != text: + print('carbon.css is stale: run python3 -I scripts/build-css.py', file=sys.stderr) + return 1 + return 0 + if current != text: + TARGET.write_text(text, encoding='utf-8') + print('wrote', TARGET.relative_to(ROOT)) + return 0 + + +if __name__ == '__main__': + sys.exit(main('--check' in sys.argv)) diff --git a/luci-theme-carbon/scripts/build-demo.py b/luci-theme-carbon/scripts/build-demo.py new file mode 100644 index 000000000..b5b209714 --- /dev/null +++ b/luci-theme-carbon/scripts/build-demo.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +"""Package the static preview and the actual theme assets for GitHub Pages.""" +from pathlib import Path +import shutil + +ROOT = Path(__file__).resolve().parent.parent +OUTPUT = ROOT / "dist" / "demo" +THEME_PREFIX = "../htdocs/luci-static/carbon/" +VERSION = (ROOT / "root" / "usr" / "share" / "carbon" / "version").read_text(encoding="utf-8").strip() + + +def build(): + # Clean only the generated demo directory, never a symlink or an external path. + if OUTPUT.is_symlink() or OUTPUT.resolve() != ROOT.resolve() / "dist" / "demo": + raise RuntimeError(f"Unsafe demo output directory: {OUTPUT}") + if OUTPUT.exists(): + shutil.rmtree(OUTPUT) + OUTPUT.mkdir(parents=True) + for name in ("index.html", "login.html", "form.html", "lang.js", "mock.js", "demo.js", "demo.css"): + content = (ROOT / "preview" / name).read_text(encoding="utf-8") + if name.endswith(".html"): + content = content.replace(THEME_PREFIX, "assets/carbon/") + # Same cache-busting version parameter the theme header adds. + content = content.replace('assets/carbon/carbon.js"', f'assets/carbon/carbon.js?v={VERSION}"') + (OUTPUT / name).write_text(content, encoding="utf-8") + assets = OUTPUT / "assets" / "carbon" + assets.mkdir(parents=True) + for name in ("carbon.css", "carbon.js", "brands.js", "logo.svg"): + shutil.copyfile(ROOT / "htdocs" / "luci-static" / "carbon" / name, assets / name) + shutil.copytree(ROOT / "htdocs" / "luci-static" / "carbon" / "i18n", assets / "i18n") + shutil.copyfile(ROOT / "LICENSE", OUTPUT / "LICENSE") + (OUTPUT / ".nojekyll").touch() + print(f"Built Carbon demo: {OUTPUT}") + + +if __name__ == "__main__": + build() diff --git a/luci-theme-carbon/scripts/build-installer.sh b/luci-theme-carbon/scripts/build-installer.sh new file mode 100755 index 000000000..64ddbd2e9 --- /dev/null +++ b/luci-theme-carbon/scripts/build-installer.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# +# Build carbon-install.sh — a single self-extracting installer for opkg and +# apk based OpenWrt / ImmortalWrt (LuCI 23.05+). +# +# Usage: sh scripts/build-installer.sh [output-dir] [--ipk FILE] [--apk FILE] [--key FILE] +# --ipk .ipk to embed for opkg (default: built with scripts/build-ipk.sh) +# --apk signed .apk to embed for apk systems (release builds). Without it, +# apk systems fall back to copying files (no online updates). +# --key public key that verifies --apk (default: keys/carbon-apk.pem) +# +# The --files payload is taken from the .ipk, so both install modes ship +# exactly the same theme files. +# +set -eu + +ROOT=$(cd "$(dirname "$0")/.." && pwd) +OUT='' +IPK='' +APK='' +KEY="$ROOT/keys/carbon-apk.pem" +die() { echo "build-installer: $*" >&2; exit 1; } +while [ "$#" -gt 0 ]; do + case "$1" in + --ipk) [ "$#" -ge 2 ] || die "--ipk needs a file"; IPK=$2; shift 2 ;; + --apk) [ "$#" -ge 2 ] || die "--apk needs a file"; APK=$2; shift 2 ;; + --key) [ "$#" -ge 2 ] || die "--key needs a file"; KEY=$2; shift 2 ;; + -*) die "unknown option $1" ;; + *) OUT=$1; shift ;; + esac +done +OUT=${OUT:-"$ROOT/dist"} +VER=$(sed -n 's/^PKG_VERSION:=//p' "$ROOT/Makefile") +REL=$(sed -n 's/^PKG_RELEASE:=//p' "$ROOT/Makefile") +FULLVER="$VER-r$REL" +mkdir -p "$OUT" && OUT=$(cd "$OUT" && pwd) # absolute: later steps run from a temp dir +TARGET="$OUT/carbon-install.sh" + +WORK=$(mktemp -d "${TMPDIR:-/tmp}/carbon-inst.XXXXXX") +cleanup() { [ -n "$WORK" ] && [ -d "$WORK" ] && rm -r "$WORK"; } +trap cleanup EXIT INT TERM + +PAYLOAD="$WORK/payload" +mkdir -p "$PAYLOAD/pkg" "$PAYLOAD/files" + +if [ -z "$IPK" ]; then + sh "$ROOT/scripts/build-ipk.sh" "$WORK/ipk" >/dev/null + IPK=$(ls "$WORK"/ipk/*.ipk) +fi +[ -s "$IPK" ] || die "missing .ipk: $IPK" +[ -s "$KEY" ] || die "missing public key: $KEY" + +ipk_version=$(tar -xzOf "$IPK" ./control.tar.gz | tar -xzOf - ./control | sed -n 's/^Version: //p') +[ -n "$ipk_version" ] || die "cannot read the .ipk version" +[ "$ipk_version" = "$FULLVER" ] || echo "build-installer: note: .ipk is $ipk_version, Makefile is $FULLVER" >&2 +cp "$IPK" "$PAYLOAD/pkg/luci-theme-carbon.ipk" +printf '%s\n' "$ipk_version" > "$PAYLOAD/pkg/opkg.version" +tar -xzOf "$IPK" ./data.tar.gz | tar -xzf - -C "$PAYLOAD/files" ./www ./usr + +if [ -n "$APK" ]; then + [ -s "$APK" ] || die "missing .apk: $APK" + apk_version=$(basename "$APK" | sed -n 's/^luci-theme-carbon-\([0-9][^/]*-r[0-9]*\)\.apk$/\1/p') + [ -n "$apk_version" ] || die "expected luci-theme-carbon-VERSION-rN.apk, got $(basename "$APK")" + cp "$APK" "$PAYLOAD/pkg/luci-theme-carbon.apk" + printf '%s\n' "$apk_version" > "$PAYLOAD/pkg/apk.version" +else + echo "build-installer: no --apk given; apk systems will fall back to copying files" >&2 +fi +cp "$KEY" "$PAYLOAD/pkg/carbon-apk.pem" + +if tar --version 2>/dev/null | grep -q 'GNU tar'; then + TAROPTS="--format=ustar --owner=0 --group=0 --numeric-owner" +else + export COPYFILE_DISABLE=1 + TAROPTS="--format ustar --uid 0 --gid 0 --uname root --gname root --no-xattrs --no-mac-metadata" +fi + +# shellcheck disable=SC2086 +(cd "$PAYLOAD" && tar $TAROPTS -czf "$WORK/payload.tar.gz" ./pkg ./files) + +sed "s/@VERSION@/$FULLVER/" "$ROOT/scripts/installer-head.sh" > "$TARGET" +printf '__CARBON_PAYLOAD__\n' >> "$TARGET" +cat "$WORK/payload.tar.gz" >> "$TARGET" +chmod 0755 "$TARGET" + +echo "Built $TARGET ($(du -k "$TARGET" | cut -f1) KB; ipk $ipk_version${APK:+, apk $apk_version})" diff --git a/luci-theme-carbon/scripts/build-ipk.sh b/luci-theme-carbon/scripts/build-ipk.sh new file mode 100755 index 000000000..75ae109e9 --- /dev/null +++ b/luci-theme-carbon/scripts/build-ipk.sh @@ -0,0 +1,107 @@ +#!/bin/sh +# +# Build luci-theme-carbon__all.ipk without the OpenWrt SDK. +# +# The theme is architecture independent (CSS/JS/templates only), so a +# plain tar-based .ipk works on every OpenWrt 23.05 / 24.10 device that +# uses opkg. For OpenWrt 25.x (apk) build with the SDK and the Makefile. +# +# Usage: sh scripts/build-ipk.sh [output-dir] +# +set -eu + +ROOT=$(cd "$(dirname "$0")/.." && pwd) +OUT=${1:-"$ROOT/dist"} +PKG=luci-theme-carbon +VER=$(sed -n 's/^PKG_VERSION:=//p' "$ROOT/Makefile") +REL=$(sed -n 's/^PKG_RELEASE:=//p' "$ROOT/Makefile") +FULLVER="$VER-r$REL" +mkdir -p "$OUT" && OUT=$(cd "$OUT" && pwd) # absolute: later steps run from a temp dir +IPK="$OUT/${PKG}_${FULLVER}_all.ipk" + +WORK=$(mktemp -d "${TMPDIR:-/tmp}/carbon-ipk.XXXXXX") +cleanup() { [ -n "$WORK" ] && [ -d "$WORK" ] && rm -r "$WORK"; } +trap cleanup EXIT INT TERM + +DATA="$WORK/data" +CTRL="$WORK/control" +mkdir -p "$DATA/www" "$DATA/usr/share/ucode/luci" "$CTRL" "$OUT" + +# --- payload (same layout luci.mk produces) ------------------------------- +cp -R "$ROOT/htdocs/." "$DATA/www/" +cp -R "$ROOT/ucode/." "$DATA/usr/share/ucode/luci/" +cp -R "$ROOT/root/." "$DATA/" +chmod 0755 "$DATA/etc/uci-defaults/30_luci-theme-carbon" +chmod 0755 "$DATA/usr/libexec/rpcd/luci.carbon_update" +find "$DATA" -name '.DS_Store' -exec rm {} + + +SIZE=$(du -sk "$DATA" | cut -f1) + +# --- control files -------------------------------------------------------- +cat > "$CTRL/control" < "$CTRL/postinst" <<'EOF' +#!/bin/sh +[ -n "${IPKG_INSTROOT:-}" ] && exit 0 +if [ -f /etc/uci-defaults/30_luci-theme-carbon ]; then + ( . /etc/uci-defaults/30_luci-theme-carbon ) && rm -f /etc/uci-defaults/30_luci-theme-carbon +fi +rm -f /tmp/luci-indexcache* 2>/dev/null +rm -rf /tmp/luci-modulecache 2>/dev/null +/etc/init.d/rpcd reload 2>/dev/null +exit 0 +EOF + +cat > "$CTRL/postrm" <<'EOF' +#!/bin/sh +if [ "${PKG_UPGRADE:-}" = 1 ] || [ "${1:-}" = upgrade ]; then exit 0; fi +[ -n "${IPKG_INSTROOT:-}" ] && exit 0 +uci -q delete luci.themes.Carbon +if [ "$(uci -q get luci.main.mediaurlbase)" = "/luci-static/carbon" ]; then + if [ -d /www/luci-static/bootstrap ]; then + uci set luci.main.mediaurlbase=/luci-static/bootstrap + else + uci -q delete luci.main.mediaurlbase + fi +fi +uci commit luci +rm -f /etc/config/carbon +rm -rf /www/luci-static/carbon/custom +rmdir /www/luci-static/carbon 2>/dev/null +rm -f /tmp/luci-indexcache* 2>/dev/null +/etc/init.d/rpcd reload 2>/dev/null +exit 0 +EOF +chmod 0755 "$CTRL/postinst" "$CTRL/postrm" +echo "2.0" > "$WORK/debian-binary" + +# --- pack (gzip'd tar of tars, like OpenWrt's ipkg-build) ----------------- +if tar --version 2>/dev/null | grep -q 'GNU tar'; then + TAROPTS="--format=gnu --owner=0 --group=0 --numeric-owner --sort=name" +else + # bsdtar (macOS): strip resource forks / xattrs, force root ownership + export COPYFILE_DISABLE=1 + TAROPTS="--format ustar --uid 0 --gid 0 --uname root --gname root --no-xattrs --no-mac-metadata" +fi + +# shellcheck disable=SC2086 +(cd "$DATA" && tar $TAROPTS -czf "$WORK/data.tar.gz" .) +# shellcheck disable=SC2086 +(cd "$CTRL" && tar $TAROPTS -czf "$WORK/control.tar.gz" .) +# shellcheck disable=SC2086 +(cd "$WORK" && tar $TAROPTS -czf "$IPK" ./debian-binary ./data.tar.gz ./control.tar.gz) + +echo "Built $IPK ($(du -k "$IPK" | cut -f1) KB)" diff --git a/luci-theme-carbon/scripts/check-version.sh b/luci-theme-carbon/scripts/check-version.sh new file mode 100644 index 000000000..2c78b7ea2 --- /dev/null +++ b/luci-theme-carbon/scripts/check-version.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# The Makefile is the single version source. root/usr/share/carbon/version is +# its packaged copy; the theme header and carbon.js read it at runtime. +set -eu +cd "$(dirname "$0")/.." +ver="$(sed -n 's/^PKG_VERSION:=//p' Makefile)-r$(sed -n 's/^PKG_RELEASE:=//p' Makefile)" +if [ "$(cat root/usr/share/carbon/version)" != "$ver" ]; then + echo "root/usr/share/carbon/version must contain $ver" >&2 + exit 1 +fi +if grep -rnE '\?v=[0-9]|C\.version *= *.[0-9]' ucode htdocs; then + echo "Hard-coded theme version found; read it from /usr/share/carbon/version instead" >&2 + exit 1 +fi +echo "version $ver" diff --git a/luci-theme-carbon/scripts/gen-brands.py b/luci-theme-carbon/scripts/gen-brands.py new file mode 100755 index 000000000..24d9a4bfe --- /dev/null +++ b/luci-theme-carbon/scripts/gen-brands.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python3 +""" +Generate htdocs/luci-static/carbon/brands.js — brand icons + device +recognition data for the dashboard's "Connected Devices" list. + +Sources (downloaded into a cache dir, nothing is executed from them): + * Simple Icons (CC0 1.0) https://simpleicons.org — brand glyph paths + * IEEE MA-L OUI registry https://standards-oui.ieee.org/oui/oui.csv + +Usage: python3 -I scripts/gen-brands.py [cache-dir] +""" +import base64 +import csv +import json +import os +import re +import sys +import urllib.request + +SI_VERSION = "16.37.0" +SI_BASE = f"https://cdn.jsdelivr.net/npm/simple-icons@{SI_VERSION}" +OUI_URL = "https://standards-oui.ieee.org/oui/oui.csv" + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +OUT = os.path.join(ROOT, "htdocs", "luci-static", "carbon", "brands.js") +CACHE = sys.argv[1] if len(sys.argv) > 1 else os.path.join(ROOT, ".cache", "brands") + +# key: (display name, avatar style, OUI organisation regex or None) +# avatar style: ("icon", simple-icons slug, bg, fg) +# ("mono", letter, bg, fg) +# ("glyph", carbon icon name, bg) +# bg/fg may be CSS values; "INV" = inverted neutral (dark on light theme, +# light on dark theme) for brands whose colour is black or white. +BRANDS = { + "apple": ("Apple", ("icon", "apple", "INV"), r"^Apple, Inc"), + "xiaomi": ("Xiaomi", ("icon", "xiaomi", "#FF6900"), r"Xiaomi"), + "huawei": ("Huawei", ("icon", "huawei", "#FF0000"), r"Huawei|HUAWEI"), + "honor": ("Honor", ("mono", "H", "INV"), r"Honor Device"), + "samsung": ("Samsung", ("mono", "S", "#1428A0"), r"^Samsung Electronics"), + "oppo": ("OPPO", ("mono", "O", "#2D683D"), r"Oppo|OPPO"), + "vivo": ("vivo", ("mono", "v", "#415FFF"), r"vivo Mobile"), + "oneplus": ("OnePlus", ("icon", "oneplus", "#F5010C"), r"OnePlus"), + "realme": ("realme", ("mono", "r", "#FFC915", "#1d1d1f"), r"Realme"), + "meizu": ("Meizu", ("icon", "meizu", "#FF4132"), None), + "google": ("Google", ("icon", "google", "#4285F4"), r"^Google"), + "android": ("Android", ("icon", "android", "#3DDC84"), None), + "amazon": ("Amazon", ("glyph", "speaker", "#FF9900"), r"^Amazon"), + "nintendo": ("Nintendo", ("glyph", "gamepad", "#E60012"), r"Nintendo"), + "playstation": ("PlayStation", ("icon", "playstation", "#0070D1"), r"Sony Interactive"), + "sony": ("Sony", ("mono", "S", "INV"), r"^Sony"), + "microsoft": ("Microsoft", ("glyph", "pc", "#737373"), r"^Microsoft"), + "windows": ("Windows", ("glyph", "pc", "#0078D4"), None), + "lenovo": ("Lenovo", ("mono", "L", "#E2231A"), r"Lenovo"), + "dell": ("Dell", ("icon", "dell", "#007DB8"), r"^Dell"), + "hp": ("HP", ("icon", "hp", "#0096D6"), r"^HP |^Hewlett Packard|^HP Inc"), + "asus": ("ASUS", ("mono", "A", "INV"), r"ASUSTek"), + "tplink": ("TP-Link", ("icon", "tplink", "#4ACBD6"), r"TP-LINK|TP-Link"), + "raspberrypi": ("Raspberry Pi", ("icon", "raspberrypi", "#A22846"), r"Raspberry Pi"), + "synology": ("Synology", ("mono", "S", "#3A3A3C"), r"Synology"), + "espressif": ("Espressif", ("icon", "espressif", "#E7352C"), r"Espressif"), + "lg": ("LG", ("icon", "lg", "#A50034"), r"^LG Electronics"), + "roku": ("Roku", ("mono", "R", "#662D91"), r"^Roku"), + "dji": ("DJI", ("icon", "dji", "INV"), r"DJI"), + "ubiquiti": ("Ubiquiti", ("icon", "ubiquiti", "#0559C9"), r"Ubiquiti"), + "philipshue": ("Philips Hue", ("icon", "philipshue", "#0065D3"), r"Signify|Philips Lighting"), + "zte": ("ZTE", ("mono", "Z", "#0081CC"), r"^zte|ZTE Corporation"), + "tcl": ("TCL", ("mono", "T", "#E4002B"), r"^TCL"), + "hisense": ("Hisense", ("mono", "H", "#00A99D"), r"Hisense"), + "midea": ("Midea", ("mono", "M", "#03B0EF"), r"Midea (Group|Air|Electric)"), + "haier": ("Haier", ("mono", "H", "#005AAB"), r"Haier"), + # Wi-Fi chip vendors: no brand shown, only a "computer" hint + "_pc": (None, ("glyph", "pc", None), r"^Intel Corporate|^Liteon|^AzureWave|^Realtek"), +} + +# Hostname rules, first match wins: (regex, brand key or None, device type) +HOST_RULES = [ + (r"iphone", "apple", "phone"), + (r"ipad", "apple", "tablet"), + (r"macbook|imac|mac-?mini|mac-?pro|mac-?studio|^mac\b", "apple", "pc"), + (r"apple-?tv|appletv", "apple", "tv"), + (r"homepod", "apple", "speaker"), + (r"apple-?watch|ipod|airport|apple", "apple", None), + (r"redmi|xiaomi|^mi[-_ ]|^mi\d|poco|mijia|miwifi|xiaoai|zhimi|chuangmi|yeelink|lumi-|roborock|dreame|viomi|mibox|mitv", "xiaomi", None), + (r"honor", "honor", "phone"), + (r"huawei|matebook|matepad|harmony", "huawei", None), + (r"samsung|galaxy|^sm-[a-z]\d", "samsung", None), + (r"oneplus", "oneplus", "phone"), + (r"realme|^rmx\d", "realme", "phone"), + (r"oppo|^cph\d|^pd[a-z]m\d", "oppo", "phone"), + (r"vivo|iqoo", "vivo", "phone"), + (r"meizu", "meizu", "phone"), + (r"pixel|chromecast|google|nest-?(hub|mini|audio|wifi)", "google", None), + (r"echo|kindle|fire-?tv|amazon|alexa", "amazon", None), + (r"nintendo", "nintendo", "game"), + (r"playstation|^ps[345]\b|^ps[345]-", "playstation", "game"), + (r"xbox", "microsoft", "game"), + (r"^desktop-|^laptop-|^win-|windows|surface", "windows", "pc"), + (r"bravia", "sony", "tv"), + (r"lenovo|thinkpad|thinkbook|legion|yoga", "lenovo", "pc"), + (r"dell|xps|inspiron|latitude|optiplex", "dell", "pc"), + (r"^hp[-_]|hewlett|laserjet|deskjet|officejet|envy|pavilion|elitebook", "hp", None), + (r"asus|rog-|zenbook|vivobook", "asus", None), + (r"tp-?link|^tl-|deco", "tplink", None), + (r"raspberry|^rpi|raspi", "raspberrypi", "pc"), + (r"synology|diskstation|^ds\d{3}", "synology", "nas"), + (r"^esp[-_]|esp32|esp8266|tasmota|espressif", "espressif", "iot"), + (r"lgwebos|^lg[-_]", "lg", "tv"), + (r"roku", "roku", "tv"), + (r"dji", "dji", None), + (r"unifi|ubnt|ubiquiti", "ubiquiti", None), + (r"hue-?bridge|philips-?hue", "philipshue", "iot"), + (r"hisense|vidaa", "hisense", "tv"), + (r"tcl", "tcl", "tv"), + (r"midea", "midea", "iot"), + (r"haier", "haier", "iot"), + (r"zte", "zte", None), + (r"^android|android-", "android", "phone"), + # brandless device types + (r"printer|epson|canon|brother", None, "printer"), + (r"camera|ipcam|^ipc|ezviz|hikvision|imou|xiaovv", None, "camera"), + (r"tv\b|-tv|tv-|电视", None, "tv"), + (r"speaker|sonos", None, "speaker"), + (r"phone|手机", None, "phone"), + (r"pad\b|tablet|平板", None, "tablet"), + (r"nas\b", None, "nas"), + (r"pc\b|desktop|laptop|notebook|电脑", None, "pc"), +] + + +def fetch(url, dest): + if os.path.exists(dest): + return dest + req = urllib.request.Request(url, headers={"User-Agent": "carbon-theme-build"}) + with urllib.request.urlopen(req, timeout=120) as r, open(dest, "wb") as f: + f.write(r.read()) + return dest + + +def main(): + os.makedirs(CACHE, exist_ok=True) + + # --- icons ----------------------------------------------------------- + paths = {} + for key, (_, style, _) in BRANDS.items(): + if style[0] != "icon": + continue + slug = style[1] + svg = open(fetch(f"{SI_BASE}/icons/{slug}.svg", os.path.join(CACHE, slug + ".svg")), encoding="utf-8").read() + m = re.search(r' 2 else None + if bg == "INV": + b["inv"] = 1 + elif bg: + b["bg"] = bg + if kind == "icon": + b["p"] = paths[key] + elif kind == "mono": + b["m"] = style[1] + if len(style) > 3: + b["fg"] = style[3] + else: + b["g"] = style[1] + brands[key] = b + + host = [[rx, k, t] for rx, k, t in HOST_RULES] + + js = ( + "/*!\n" + " * Carbon — brand data for the connected-devices list (generated by scripts/gen-brands.py).\n" + f" * Brand glyphs: Simple Icons {SI_VERSION} (CC0 1.0). All trademarks belong to their owners.\n" + " * MAC prefixes: IEEE Registration Authority MA-L registry.\n" + " */\n" + "(function (C) {\n" + "\t'use strict';\n" + f"\tC.BRAND_DATA = {json.dumps({'brands': brands, 'host': host, 'oui': oui}, separators=(',', ':'), ensure_ascii=False)};\n" + "\tif (typeof C.onBrands === 'function') C.onBrands();\n" + "})(window.Carbon = window.Carbon || {});\n" + ) + with open(OUT, "w", encoding="utf-8") as f: + f.write(js) + + total = sum(len(s) for s in prefixes.values()) + print(f"wrote {OUT}: {len(js) // 1024} KB, {len(brands)} brands, {len(paths)} icons, {total} OUI prefixes") + + +if __name__ == "__main__": + main() diff --git a/luci-theme-carbon/scripts/gen-i18n.py b/luci-theme-carbon/scripts/gen-i18n.py new file mode 100644 index 000000000..f0eab5ec9 --- /dev/null +++ b/luci-theme-carbon/scripts/gen-i18n.py @@ -0,0 +1,158 @@ +#!/usr/bin/env python3 +"""Extract Carbon's theme strings and compile po//carbon.po catalogues. + + python3 -I scripts/gen-i18n.py regenerate pot, merge po files, write JS + python3 -I scripts/gen-i18n.py --check CI: fail if anything is stale or untranslated + +Sources use t('…') / tr('…') / N_('…') with single-quoted literals. The po files +are standard gettext, so the OpenWrt SDK (luci.mk) also builds them into +luci-i18n-carbon- packages. Release packages bundle the compiled +catalogues as htdocs/luci-static/carbon/i18n/.js, which the theme header +loads for the active LuCI language. +""" +from pathlib import Path +import json +import re +import sys + +ROOT = Path(__file__).resolve().parent.parent +PO_DIR = ROOT / 'po' +POT = PO_DIR / 'templates' / 'carbon.pot' +OUT_DIR = ROOT / 'htdocs' / 'luci-static' / 'carbon' / 'i18n' +SOURCES = [ + 'htdocs/luci-static/carbon/carbon.js', + 'htdocs/luci-static/resources/menu-carbon.js', + 'htdocs/luci-static/resources/view/system/carbon-update.js', +] +MENU_JSON = ['root/usr/share/luci/menu.d/luci-theme-carbon.json'] +# Same short names luci.mk uses for lmo files (LUCI_LC_ALIAS). +ALIAS = {'zh_Hans': 'zh-cn', 'zh_Hant': 'zh-tw', 'pt_BR': 'pt-br', 'nb_NO': 'no', 'sr_Latn': 'sr'} +CALL = re.compile(r"(? {value!r}') + outputs[po] = render_po(msgids, refs, translations, po_header(lang)) + outputs[OUT_DIR / (ALIAS.get(lang, lang.lower().replace('_', '-')) + '.js')] = render_js(lang, msgids, translations) + + stale = [p for p, text in outputs.items() if not p.exists() or p.read_text(encoding='utf-8') != text] + expected = {p for p in outputs if p.parent == OUT_DIR} + orphans = [p for p in OUT_DIR.glob('*.js') if p not in expected] if OUT_DIR.exists() else [] + if check: + for path in stale: + problems.append(f'stale: {path.relative_to(ROOT)} (run scripts/gen-i18n.py)') + for path in orphans: + problems.append(f'orphan catalogue: {path.relative_to(ROOT)}') + for line in problems: + print('::error::' + line if '--github' in sys.argv else line, file=sys.stderr) + return 1 if problems else 0 + for path in stale: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(outputs[path], encoding='utf-8') + print('wrote', path.relative_to(ROOT)) + for path in orphans: + path.unlink() + print('removed', path.relative_to(ROOT)) + for line in problems: + print('warning:', line, file=sys.stderr) + print(f'{len(msgids)} strings, languages: {", ".join(languages) or "none"}') + return 0 + + +if __name__ == '__main__': + sys.exit(main('--check' in sys.argv)) diff --git a/luci-theme-carbon/scripts/installer-head.sh b/luci-theme-carbon/scripts/installer-head.sh new file mode 100755 index 000000000..bcae39ad9 --- /dev/null +++ b/luci-theme-carbon/scripts/installer-head.sh @@ -0,0 +1,285 @@ +#!/bin/sh +# +# Carbon theme installer for OpenWrt / ImmortalWrt (LuCI 23.05 and later). +# +# sh carbon-install.sh install or upgrade +# sh carbon-install.sh --trust-key also trust Carbon's APK key for LuCI package uploads +# sh carbon-install.sh --files only copy files (no package record, no online updates) +# sh carbon-install.sh uninstall remove the theme +# +# The installer embeds the release's signed .apk, its .ipk and Carbon's public +# key, and installs through the system package manager (apk or opkg), so +# System → Carbon Theme Settings can update the theme later. The APK signature +# is verified with the embedded key in a private key directory: /etc/apk/keys +# and signature checks stay untouched unless --trust-key is given. Missing +# dependencies come from the firmware's own package feeds. If a native install +# is impossible (e.g. offline without dependencies), the theme files are copied +# instead and online updates stay disabled. +# +set -e + +VERSION="@VERSION@" +PKG=luci-theme-carbon +ROOT="${CARBON_ROOT:-}" # tests only: alternate root with stub tools on PATH +DEPS="${CARBON_DEPS-luci-base curl ca-bundle flock}" # tests only: override the dependency list +# Files written by the --files mode (and by installers before v1.1.3). +FILE_PATHS=" +/www/luci-static/carbon +/www/luci-static/resources/menu-carbon.js +/www/luci-static/resources/carbon +/www/luci-static/resources/view/system/carbon-update.js +/usr/share/ucode/luci/template/themes/carbon +/usr/share/rpcd/acl.d/luci-theme-carbon.json +/usr/share/rpcd/acl.d/luci-theme-carbon-update.json +/usr/share/luci/menu.d/luci-theme-carbon.json +/usr/share/carbon +/usr/libexec/rpcd/luci.carbon_update +/lib/upgrade/keep.d/luci-theme-carbon +" +# User data under the theme directory: the custom logo. Kept when a script-only +# install becomes a package; removed on uninstall. +CUSTOM_DIR=/www/luci-static/carbon/custom + +say() { printf '%s\n' "$*"; } +warn() { printf 'WARNING: %s\n' "$*" >&2; } +die() { printf 'ERROR: %s\n' "$*" >&2; exit 1; } + +usage() { + say "Usage: sh $0 [install|uninstall] [--trust-key] [--files]" + say " install install or upgrade Carbon $VERSION through apk/opkg (default)" + say " --trust-key also add Carbon's public key to /etc/apk/keys for LuCI uploads" + say " --files copy files only; online updates are not available" + say " uninstall remove the theme" +} + +WORK='' +cleanup() { [ -z "$WORK" ] || rm -rf "$WORK"; } +trap cleanup EXIT +trap 'exit 1' HUP INT TERM + +unpack() { + line=$(awk '/^__CARBON_PAYLOAD__$/ { print NR + 1; exit 0 }' "$0") + [ -n "$line" ] || die "embedded payload not found (file damaged? run it as: sh carbon-install.sh)" + WORK=$(mktemp -d "${TMPDIR:-/tmp}/carbon-install.XXXXXX") || die "cannot create a temporary directory" + tail -n +"$line" "$0" | tar -xzf - -C "$WORK" || die "failed to unpack the installer (file damaged?)" +} + +have_uci() { command -v uci >/dev/null 2>&1; } + +refresh_luci() { + [ -n "$ROOT" ] && return 0 + rm -f /tmp/luci-indexcache* 2>/dev/null || true + rm -rf /tmp/luci-modulecache 2>/dev/null || true + [ -x /etc/init.d/rpcd ] && /etc/init.d/rpcd reload >/dev/null 2>&1 || true +} + +manager() { + if command -v apk >/dev/null 2>&1 && [ -f "$ROOT/etc/apk/world" ]; then echo apk + elif command -v opkg >/dev/null 2>&1; then echo opkg + fi +} + +# Installed version of a package, empty when it is not registered. +pkg_version() { + case "$1" in + apk) apk list --installed "$2" 2>/dev/null | sed -n "s/^$2-\([0-9][^ ]*\) .*/\1/p" | head -n 1 ;; + opkg) opkg status "$2" 2>/dev/null | awk '/^Version: / {v=$2} /^Status: .* installed$/ {ok=1} END {if (ok) print v}' ;; + esac +} + +# Prints <, = or > comparing version $2 with $3. +version_cmp() { + case "$1" in + apk) apk version -t "$2" "$3" 2>/dev/null ;; + opkg) + if opkg compare-versions "$2" '<<' "$3"; then echo '<' + elif opkg compare-versions "$2" '=' "$3"; then echo '=' + else echo '>'; fi ;; + esac +} + +remove_files() { + for p in $FILE_PATHS; do + if [ "$p" = /www/luci-static/carbon ] && [ "${1:-}" != all ] && [ -d "${ROOT}${CUSTOM_DIR}" ]; then + find "${ROOT}${p}" -mindepth 1 -maxdepth 1 ! -name custom -exec rm -rf {} \; + else + rm -rf "${ROOT}${p}" + fi + done +} + +install_files() { + say "Copying theme files ..." + mkdir -p "$ROOT/" + cp -a "$WORK/files/." "$ROOT/" || die "failed to copy theme files" +} + +# Native install through apk/opkg. Returns non-zero when the caller should +# fall back to copying files; exits on a signature failure. +install_native() { + mgr=$1 + case "$mgr" in + apk) ext=apk ;; + opkg) ext=ipk ;; + *) warn "neither apk nor opkg was found"; return 1 ;; + esac + pkg="$WORK/pkg/$PKG.$ext" + [ -s "$pkg" ] || { warn "this installer contains no .$ext package for $mgr"; return 1; } + target=$(cat "$WORK/pkg/$mgr.version") + current=$(pkg_version "$mgr" "$PKG") + reinstall=0 + if [ -n "$current" ]; then + case "$(version_cmp "$mgr" "$target" "$current")" in + '<') say "Carbon $current is newer than this installer ($target); keeping it."; return 0 ;; + '=') reinstall=1 ;; + esac + fi + + if [ "$mgr" = apk ]; then + mkdir -p "$WORK/keys" + cp "$WORK/pkg/carbon-apk.pem" "$WORK/keys/carbon-apk.pem" + apk --keys-dir "$WORK/keys" --repositories-file /dev/null --no-network verify "$pkg" >/dev/null 2>&1 || + die "APK signature verification failed. Nothing was installed; download carbon-install.sh again." + fi + + missing='' + for dep in $DEPS; do + [ -n "$(pkg_version "$mgr" "$dep")" ] || missing="$missing $dep" + done + if [ -n "$missing" ]; then + say "Installing dependencies from the firmware feeds:$missing" + case "$mgr" in + apk) apk update >/dev/null 2>&1 || true; apk add $missing ;; + opkg) opkg update >/dev/null 2>&1 || true; opkg install $missing ;; + esac || { warn "could not install$missing (check internet access and the package feeds)"; return 1; } + fi + + # Files from a script-only install are owned by no package; let the package own them. + [ -n "$current" ] || remove_files + + say "Installing $PKG $target with $mgr ..." + case "$mgr" in + apk) apk --keys-dir "$WORK/keys" --repositories-file /dev/null --no-network add "$pkg" ;; + opkg) + if [ "$reinstall" = 1 ]; then opkg install --force-reinstall "$pkg" + else opkg install "$pkg"; fi ;; + esac || { warn "$mgr could not install $PKG"; return 1; } + + [ "$(pkg_version "$mgr" "$PKG")" = "$target" ] || { warn "$mgr does not report $PKG $target as installed"; return 1; } + return 0 +} + +trust_key() { + [ "$1" = apk ] || { warn "--trust-key only applies to apk based firmware"; return 0; } + mkdir -p "$ROOT/etc/apk/keys" + cp "$WORK/pkg/carbon-apk.pem" "$ROOT/etc/apk/keys/carbon-apk.pem" + chmod 644 "$ROOT/etc/apk/keys/carbon-apk.pem" + say "Trusted Carbon's APK key for LuCI package uploads: /etc/apk/keys/carbon-apk.pem" +} + +activate() { + have_uci || return 0 + { + uci set luci.themes.Carbon=/luci-static/carbon && + uci set luci.main.mediaurlbase=/luci-static/carbon && + uci commit luci + } || warn "could not select the Carbon theme; choose it in System → System → Language and Style" +} + +do_install() { + if [ -z "$ROOT" ]; then + [ "$(id -u)" = 0 ] || die "please run as root" + fi + [ -f "$ROOT/usr/share/ucode/luci/template/header.ut" ] || \ + die "LuCI with ucode templates (OpenWrt 23.05 or later) is required" + + unpack + say "Installing Carbon theme $VERSION ..." + mgr=$(manager) + native=0 + if [ "$FILES_ONLY" != 1 ]; then + if install_native "$mgr"; then + native=1 + elif [ -n "$mgr" ] && [ -n "$(pkg_version "$mgr" "$PKG")" ]; then + # Never copy files over a registered package; the installed version keeps working. + die "the upgrade failed; Carbon $(pkg_version "$mgr" "$PKG") remains installed. See the messages above." + else + warn "falling back to copying files. The theme works, but online updates stay" + warn "disabled until Carbon is installed with apk/opkg (run this installer again later)." + fi + elif [ -n "$mgr" ] && [ -n "$(pkg_version "$mgr" "$PKG")" ]; then + die "Carbon is installed with $mgr; upgrade it without --files" + fi + [ "$native" = 1 ] || install_files + [ "$TRUST_KEY" != 1 ] || [ -z "$mgr" ] || trust_key "$mgr" + activate + refresh_luci + + say "" + if [ "$native" = 1 ]; then + say "Done. Carbon is installed with $mgr and is now the active theme." + say "Online updates: System → Carbon Theme Settings." + else + say "Done. Carbon files were copied and Carbon is now the active theme." + fi + say "Refresh the LuCI page, then log out and back in once so the" + say "dashboard and updater permissions take effect." +} + +do_uninstall() { + say "Removing Carbon theme ..." + mgr=$(manager) + current='' + [ -z "$mgr" ] || current=$(pkg_version "$mgr" "$PKG") + if [ -n "$current" ]; then + say "Removing $PKG $current with $mgr ..." + case "$mgr" in + apk) apk del "$PKG" ;; + opkg) opkg remove "$PKG" ;; + esac || die "$mgr could not remove $PKG" + fi + remove_files all + rm -rf "${ROOT}${CUSTOM_DIR}" + rm -f "$ROOT/etc/config/carbon" + + if have_uci; then + uci -q delete luci.themes.Carbon || true + if [ "$(uci -q get luci.main.mediaurlbase)" = "/luci-static/carbon" ]; then + fallback="" + for t in bootstrap argon material openwrt-2020; do + if [ -d "$ROOT/www/luci-static/$t" ]; then fallback="/luci-static/$t"; break; fi + done + if [ -n "$fallback" ]; then + uci set luci.main.mediaurlbase="$fallback" + else + uci -q delete luci.main.mediaurlbase || true + fi + fi + uci commit luci || true + fi + + refresh_luci + [ ! -f "$ROOT/etc/apk/keys/carbon-apk.pem" ] || say "Carbon's APK key stays trusted; remove /etc/apk/keys/carbon-apk.pem to revoke it." + say "Done. Refresh the LuCI page." +} + +ACTION=install +FILES_ONLY=0 +TRUST_KEY=0 +for arg in "$@"; do + case "$arg" in + install|upgrade) ACTION=install ;; + uninstall|remove) ACTION=uninstall ;; + --files) FILES_ONLY=1 ;; + --trust-key) TRUST_KEY=1 ;; + -h|--help) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done + +case "$ACTION" in + install) do_install ;; + uninstall) do_uninstall ;; +esac + +exit 0 diff --git a/luci-theme-carbon/scripts/minify.mjs b/luci-theme-carbon/scripts/minify.mjs new file mode 100644 index 000000000..8bd1874a5 --- /dev/null +++ b/luci-theme-carbon/scripts/minify.mjs @@ -0,0 +1,42 @@ +#!/usr/bin/env node +/* + * Minify the theme's static assets in place, for release packaging only. + * + * node scripts/minify.mjs [package-root] (default: repository root) + * + * CI runs this on a disposable checkout before building packages. Sources in + * git stay readable. LuCI view modules ('require …' directives, top-level + * return) are not touched. + */ +import { readFileSync, writeFileSync, readdirSync, existsSync } from 'node:fs'; +import { join, resolve, relative } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { transform } from 'esbuild'; + +const root = resolve(process.argv[2] || fileURLToPath(new URL('..', import.meta.url))); +const media = join(root, 'htdocs/luci-static/carbon'); +const i18n = join(media, 'i18n'); +const files = [ + join(media, 'carbon.css'), + join(media, 'carbon.js'), + join(media, 'brands.js'), + ...(existsSync(i18n) ? readdirSync(i18n).filter((f) => f.endsWith('.js')).map((f) => join(i18n, f)) : []) +]; + +let before = 0, after = 0; +for (const file of files) { + const source = readFileSync(file, 'utf8'); + const { code, warnings } = await transform(source, { + loader: file.endsWith('.css') ? 'css' : 'js', + minify: true, + legalComments: 'inline', + charset: 'utf8' + }); + if (warnings.length) + throw new Error(relative(root, file) + ': ' + warnings.map((w) => w.text).join('; ')); + writeFileSync(file, code); + before += Buffer.byteLength(source); + after += Buffer.byteLength(code); + console.log(relative(root, file).padEnd(44), String(Buffer.byteLength(source)).padStart(7), '→', String(Buffer.byteLength(code)).padStart(7)); +} +console.log('total'.padEnd(44), String(before).padStart(7), '→', String(after).padStart(7), `(${Math.round((1 - after / before) * 100)}% smaller)`); diff --git a/luci-theme-carbon/scripts/release-notes.sh b/luci-theme-carbon/scripts/release-notes.sh new file mode 100644 index 000000000..d25012571 --- /dev/null +++ b/luci-theme-carbon/scripts/release-notes.sh @@ -0,0 +1,65 @@ +#!/bin/sh +# +# Assemble the GitHub release body. +# +# sh scripts/release-notes.sh TAG [owner/repo] > notes.md +# +# docs/releases/TAG.md and docs/releases/install.md are each written in two +# sections, "## English" and "## 简体中文". The body is every language once, +# start to finish: +# +# ## English (TAG.md English section, then install.md English section) +# --- +# ## 简体中文 (TAG.md 简体中文 section, then install.md 简体中文 section) +# +# Release notes from before v1.2 (no "## English" heading) are printed +# unchanged above both sections. RELEASE_NOTES_DIR overrides docs/releases. +# +set -eu + +TAG=${1:?usage: sh scripts/release-notes.sh TAG [owner/repo]} +REPO=${2:-mrjoechen/luci-theme-carbon} +DIR=${RELEASE_NOTES_DIR:-$(cd "$(dirname "$0")/.." && pwd)/docs/releases} +NOTES="$DIR/$TAG.md" +INSTALL="$DIR/install.md" +EN='English' +ZH='简体中文' + +printf '%s\n' "$REPO" | grep -Eq '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$' || { echo "invalid repository: $REPO" >&2; exit 1; } +printf '%s\n' "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$' || { echo "invalid tag: $TAG" >&2; exit 1; } + +has_section() { grep -qx "## $2" "$1"; } +# Body of "## NAME" up to the next "## " heading, without surrounding blank lines. +section() { + awk -v want="## $2" ' + /^## / { on = ($0 == want); next } + on { lines[++n] = $0 } + END { + first = 1; while (first <= n && lines[first] == "") first++ + last = n; while (last >= first && lines[last] == "") last-- + for (i = first; i <= last; i++) print lines[i] + }' "$1" +} + +for lang in "$EN" "$ZH"; do + has_section "$INSTALL" "$lang" || { echo "$INSTALL: missing section ## $lang" >&2; exit 1; } +done + +notes_lang=0 +if [ -f "$NOTES" ] && has_section "$NOTES" "$EN"; then + has_section "$NOTES" "$ZH" || { echo "$NOTES: missing section ## $ZH" >&2; exit 1; } + notes_lang=1 +elif [ -f "$NOTES" ]; then + cat "$NOTES" + printf '\n---\n\n' +fi + +for lang in "$EN" "$ZH"; do + [ "$lang" = "$EN" ] || printf '\n---\n\n' + printf '## %s\n\n' "$lang" + if [ "$notes_lang" = 1 ]; then + section "$NOTES" "$lang" + printf '\n' + fi + section "$INSTALL" "$lang" | sed "s#@REPOSITORY@#$REPO#g" +done diff --git a/luci-theme-carbon/scripts/sign-apk.sh b/luci-theme-carbon/scripts/sign-apk.sh new file mode 100644 index 000000000..07fa0c109 --- /dev/null +++ b/luci-theme-carbon/scripts/sign-apk.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Sign APK v3 files and require verification with the intended public key. +# Usage: sh scripts/sign-apk.sh PRIVATE_KEY PUBLIC_KEY PACKAGE.apk [...] +set -eu + +[ "$#" -ge 3 ] || { echo "Usage: $0 PRIVATE_KEY PUBLIC_KEY PACKAGE.apk [...]" >&2; exit 1; } +private_key=$1 +public_key=$2 +shift 2 +[ -s "$private_key" ] && [ -s "$public_key" ] || { echo "Signing key is missing" >&2; exit 1; } +command -v apk >/dev/null 2>&1 || { echo "apk-tools 3 is required" >&2; exit 1; } + +umask 077 +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT HUP INT TERM +mkdir "$work/keys" +cp "$public_key" "$work/keys/carbon-apk.pem" + +for package in "$@"; do + [ -s "$package" ] || { echo "APK file is missing: $package" >&2; exit 1; } + case "$package" in *.apk) ;; *) echo "Expected an .apk file: $package" >&2; exit 1 ;; esac + # Keep the input intact if signing fails. adbsign alone is not a verification. + cp "$package" "$work/package.apk" + # The SDK input is unsigned. This flag is only for reading it while signing; + # verification and router installation must never use it. + apk adbsign --allow-untrusted --reset-signatures --sign-key "$private_key" "$work/package.apk" + apk --keys-dir "$work/keys" --repositories-file /dev/null --no-network verify "$work/package.apk" + cat "$work/package.apk" > "$package" + printf 'Signed and verified: %s\n' "$package" +done diff --git a/luci-theme-carbon/styles/00-header.css b/luci-theme-carbon/styles/00-header.css new file mode 100644 index 000000000..2f865d25c --- /dev/null +++ b/luci-theme-carbon/styles/00-header.css @@ -0,0 +1,8 @@ +/*! + * Carbon — an Apple-style LuCI theme for everyday users + * Licensed under the Apache License 2.0. + * + * Widget behaviour rules (dropdowns, dynlists, tabs, modals, tooltips …) + * mirror luci-theme-bootstrap so all LuCI views keep working; only the + * visual layer is redesigned. + */ diff --git a/luci-theme-carbon/styles/01-tokens.css b/luci-theme-carbon/styles/01-tokens.css new file mode 100644 index 000000000..197c8c7fd --- /dev/null +++ b/luci-theme-carbon/styles/01-tokens.css @@ -0,0 +1,117 @@ +/* ========================================================================== + 1. Design tokens + ========================================================================== */ + +:root { + /* Carbon palette — status & data colours */ + --cb-blue: #3b82f6; + --cb-green: #16a34a; + --cb-orange: #e8870b; + --cb-red: #e5484d; + --cb-purple: #8b5cf6; + --cb-teal: #0d9f9b; + --cb-indigo: #4f5bea; + --cb-pink: #e2367f; + --cb-yellow: #eab308; + --cb-gray: #8b91a1; + + --cb-green-t: rgba(22, 163, 74, .12); + --cb-orange-t: rgba(232, 135, 11, .13); + --cb-red-t: rgba(229, 72, 77, .11); + + /* Carbon indigo — the one accent used for actions, focus and selection */ + --cb-accent: #4f5bea; + --cb-accent-strong: #3d49d6; + --cb-accent-t: rgba(79, 91, 234, .11); + --cb-focus: rgba(79, 91, 234, .26); + --cb-on-accent: #ffffff; + + /* surfaces */ + --cb-bg: #f3f4f8; + --cb-card: rgba(255, 255, 255, .84); + --cb-card-solid: #ffffff; + --cb-card-2: rgba(15, 23, 42, .025); + --cb-card-edge: rgba(15, 23, 42, .06); + --cb-field: #ffffff; + --cb-fill: rgba(15, 23, 42, .06); + --cb-fill-2: rgba(15, 23, 42, .035); + --cb-hover: rgba(79, 91, 234, .05); + + --cb-text: #1a1f36; + --cb-text-2: rgba(26, 31, 54, .62); + --cb-text-3: rgba(26, 31, 54, .36); + + --cb-sep: rgba(15, 23, 42, .07); + --cb-border: rgba(15, 23, 42, .08); + --cb-border-strong: rgba(15, 23, 42, .15); + + --cb-toolbar: rgba(243, 244, 248, .74); + --cb-popover: rgba(255, 255, 255, .88); + + --cb-shadow: 0 0 0 1px var(--cb-card-edge), 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -18px rgba(30, 41, 90, .22); + --cb-shadow-pop: 0 0 0 1px var(--cb-card-edge), 0 22px 50px -14px rgba(30, 41, 90, .3); + + --cb-radius: 18px; + --cb-radius-md: 12px; + --cb-radius-sm: 10px; + + --cb-font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif; + --cb-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace; + --cb-ease: cubic-bezier(.25, .1, .25, 1); + + --cb-content-max: 1240px; + /* dashboards and table pages grow with the screen (see 16-responsive) */ + --cb-content-wide: 1240px; + + color-scheme: light; +} + +:root[data-darkmode="true"] { + --cb-blue: #60a5fa; + --cb-green: #34d399; + --cb-orange: #fbb03b; + --cb-red: #f87171; + --cb-purple: #a78bfa; + --cb-teal: #2dd4bf; + --cb-indigo: #8b95ff; + --cb-pink: #f472b6; + --cb-yellow: #facc15; + --cb-gray: #9aa1b2; + + --cb-green-t: rgba(52, 211, 153, .14); + --cb-orange-t: rgba(251, 176, 59, .15); + --cb-red-t: rgba(248, 113, 113, .15); + + --cb-accent: #8b95ff; + --cb-accent-strong: #aab3ff; + --cb-accent-t: rgba(139, 149, 255, .16); + --cb-focus: rgba(139, 149, 255, .32); + --cb-on-accent: #0e1024; + + --cb-bg: #0c0d12; + --cb-card: rgba(24, 26, 34, .8); + --cb-card-solid: #181a22; + --cb-card-2: rgba(255, 255, 255, .03); + --cb-card-edge: rgba(255, 255, 255, .06); + --cb-field: rgba(255, 255, 255, .045); + --cb-fill: rgba(255, 255, 255, .08); + --cb-fill-2: rgba(255, 255, 255, .05); + --cb-hover: rgba(255, 255, 255, .04); + + --cb-text: #e9ebf5; + --cb-text-2: rgba(233, 235, 245, .6); + --cb-text-3: rgba(233, 235, 245, .32); + + --cb-sep: rgba(255, 255, 255, .07); + --cb-border: rgba(255, 255, 255, .08); + --cb-border-strong: rgba(255, 255, 255, .15); + + --cb-toolbar: rgba(12, 13, 18, .7); + --cb-popover: rgba(30, 32, 42, .9); + + --cb-shadow: 0 0 0 1px var(--cb-card-edge), 0 10px 30px -18px rgba(0, 0, 0, .7); + --cb-shadow-pop: 0 0 0 1px var(--cb-card-edge), 0 24px 56px -14px rgba(0, 0, 0, .75); + + color-scheme: dark; +} + diff --git a/luci-theme-carbon/styles/02-base.css b/luci-theme-carbon/styles/02-base.css new file mode 100644 index 000000000..90f698b7f --- /dev/null +++ b/luci-theme-carbon/styles/02-base.css @@ -0,0 +1,67 @@ +/* ========================================================================== + 2. Base + ========================================================================== */ + +*, *::before, *::after { box-sizing: border-box; } + +html { + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; +} + +body { + margin: 0; + min-height: 100vh; + background: var(--cb-bg); + color: var(--cb-text); + font: 14px/1.5 var(--cb-font); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-feature-settings: "kern"; +} + +a { color: var(--cb-accent); text-decoration: none; } +/* :where() keeps hover underline at class specificity, so button-like links + can opt out without !important */ +:where(a):hover { text-decoration: underline; text-underline-offset: 2px; } + +h1, h2, h3, h4, h5, h6 { margin: 0 0 .5em; font-weight: 600; line-height: 1.25; color: var(--cb-text); } +h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; } +h3 { font-size: 17px; } +h4 { font-size: 15px; } +h5 { font-size: 14px; } +p { margin: 0 0 .75em; } +hr { border: 0; border-top: 1px solid var(--cb-sep); margin: 16px 0; } +small { font-size: 12px; } +code, kbd, pre, samp, var, tt { font-family: var(--cb-mono); font-size: 12.5px; } +pre { + background: var(--cb-card-2); + border: 1px solid var(--cb-sep); + border-radius: var(--cb-radius-sm); + padding: 10px 12px; + overflow: auto; + white-space: pre-wrap; +} +img { max-width: 100%; } +ul, ol { padding-left: 1.4em; } +abbr[title] { text-decoration: underline dotted; cursor: help; } +strong, b { font-weight: 600; } +em { font-style: normal; color: var(--cb-text-2); } +fieldset { border: 0; margin: 0 0 16px; padding: 0; } +legend { font-size: 17px; font-weight: 600; padding: 0 0 8px; } + +::selection { background: var(--cb-accent-t); } +:focus-visible { outline: 3px solid var(--cb-focus); outline-offset: 1px; } + +.hidden { display: none !important; } +.left { text-align: left !important; } +.right { text-align: right !important; } +.center { text-align: center !important; } +.top { vertical-align: top !important; } +.middle { vertical-align: middle !important; } +.bottom { vertical-align: bottom !important; } +.pull-right { float: right; } +.pull-left { float: left; } +form.inline { display: inline; margin: 0; } +.nowrap { white-space: nowrap; } + diff --git a/luci-theme-carbon/styles/03-shell.css b/luci-theme-carbon/styles/03-shell.css new file mode 100644 index 000000000..b41de6994 --- /dev/null +++ b/luci-theme-carbon/styles/03-shell.css @@ -0,0 +1,656 @@ +/* ========================================================================== + 3. App shell — sidebar, toolbar, content + ========================================================================== */ + +.cb-app { + display: flex; + min-height: 100vh; +} + +/* ---- Carbon glass sidebar ------------------------------------------- + A floating frosted panel over a soft ambient backdrop. Monochrome line + icons sit in small glass chips; the active page gets a solid Carbon + indigo chip, a soft glow and an edge indicator. No gradients on controls. + ---------------------------------------------------------------------- */ +:root { + --cb-side-w: 264px; + --cb-side-w-mini: 76px; + --cb-gutter: 12px; + + + --cb-amb-1: rgba(79, 91, 234, .16); + --cb-amb-2: rgba(139, 92, 246, .13); + --cb-amb-3: rgba(45, 212, 191, .13); + + --cb-glass: rgba(255, 255, 255, .56); + --cb-glass-solid: #f6f7fb; + --cb-glass-edge: rgba(255, 255, 255, .8); + --cb-glass-line: rgba(15, 23, 42, .07); + --cb-glass-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 18px 50px -12px rgba(30, 41, 90, .22), 0 2px 8px rgba(30, 41, 90, .06); + --cb-chip: rgba(255, 255, 255, .7); + --cb-chip-edge: rgba(15, 23, 42, .07); + --cb-nav-fg: #27304a; + --cb-nav-fg-2: rgba(39, 48, 74, .62); + --cb-nav-hover: rgba(79, 91, 234, .06); + --cb-nav-active-fg: var(--cb-accent-strong); + --cb-seg-track: rgba(15, 23, 42, .06); + --cb-seg-thumb: #ffffff; +} +:root[data-darkmode="true"] { + --cb-amb-1: rgba(37, 99, 235, .26); + --cb-amb-2: rgba(124, 58, 237, .22); + --cb-amb-3: rgba(20, 184, 166, .12); + + --cb-glass: rgba(26, 28, 36, .58); + --cb-glass-solid: #16171d; + --cb-glass-edge: rgba(255, 255, 255, .08); + --cb-glass-line: rgba(255, 255, 255, .07); + --cb-glass-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 18px 50px -10px rgba(0, 0, 0, .6); + --cb-chip: rgba(255, 255, 255, .06); + --cb-chip-edge: rgba(255, 255, 255, .07); + --cb-nav-fg: #e7e9f3; + --cb-nav-fg-2: rgba(231, 233, 243, .58); + --cb-nav-hover: rgba(255, 255, 255, .06); + --cb-nav-active-fg: var(--cb-accent-strong); + --cb-seg-track: rgba(255, 255, 255, .07); + --cb-seg-thumb: rgba(255, 255, 255, .16); +} + +/* ambient backdrop — gives the glass something to refract */ +.cb-app::before { + content: ""; + position: fixed; + inset: 0; + z-index: -1; + pointer-events: none; + background: + radial-gradient(620px 520px at -4% -6%, var(--cb-amb-1), transparent 70%), + radial-gradient(560px 520px at -2% 104%, var(--cb-amb-2), transparent 70%), + radial-gradient(700px 560px at 104% 18%, var(--cb-amb-3), transparent 70%); +} + +.cb-sidebar { + position: fixed; + z-index: 300; + top: var(--cb-gutter); + bottom: var(--cb-gutter); + left: var(--cb-gutter); + width: var(--cb-side-w); + display: flex; + flex-direction: column; + padding: 14px 10px 10px; + border-radius: 22px; + border: 1px solid var(--cb-glass-edge); + background: var(--cb-glass-solid); + box-shadow: var(--cb-glass-shadow); + color: var(--cb-nav-fg); + transition: width .3s var(--cb-ease), transform .3s var(--cb-ease), padding .3s var(--cb-ease); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-sidebar { + background: var(--cb-glass); + -webkit-backdrop-filter: blur(28px) saturate(170%); + backdrop-filter: blur(28px) saturate(170%); + } +} +/* top sheen */ +.cb-sidebar::before { + content: ""; + position: absolute; + inset: 0; + border-radius: inherit; + pointer-events: none; + background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 120px); + opacity: .7; +} +:root[data-darkmode="true"] .cb-sidebar::before { background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 120px); opacity: 1; } +.cb-sidebar > * { position: relative; } + +/* brand */ +.cb-brand { + display: flex; + align-items: center; + gap: 11px; + min-height: 44px; + padding: 2px 6px 12px; + color: var(--cb-nav-fg); + text-decoration: none; +} +.cb-brand-logo { + width: 38px; + height: 38px; + flex: none; + border-radius: 12px; + box-shadow: 0 6px 16px -6px rgba(79, 91, 234, .6); +} +/* uploaded logo: any aspect ratio, no brand-coloured glow */ +.cb-brand-logo[data-custom] { object-fit: contain; border-radius: 10px; box-shadow: none; } +.cb-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; } +.cb-brand-text strong { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.cb-brand-text small { color: var(--cb-nav-fg-2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +/* collapse handle on the panel edge */ +.cb-collapse { + position: absolute !important; + z-index: 2; + top: 24px; + right: -13px; + display: inline-flex; + align-items: center; + justify-content: center; + width: 26px; + height: 26px; + padding: 0; + border: 1px solid var(--cb-glass-edge); + border-radius: 50%; + background: var(--cb-glass-solid); + color: var(--cb-nav-fg-2); + box-shadow: 0 4px 12px rgba(30, 41, 90, .16); + cursor: pointer; + opacity: 0; + transition: opacity .2s var(--cb-ease), color .2s, transform .3s var(--cb-ease); +} +.cb-collapse svg { width: 14px; height: 14px; } +.cb-sidebar:hover .cb-collapse, +.cb-collapse:focus-visible { opacity: 1; } +.cb-collapse:hover { color: var(--cb-nav-active-fg); } + +/* mode switch */ +.cb-mode { padding: 0 4px 6px; } +.cb-mode .cb-seg { width: 100%; } + +/* nav list */ +.cb-nav { + flex: 1; + overflow-y: auto; + overflow-x: hidden; + margin: 0 -10px; + padding: 2px 10px 12px; + scrollbar-width: none; +} +.cb-nav::-webkit-scrollbar { display: none; } + +.cb-nav-sect { + padding: 16px 12px 6px; + color: var(--cb-nav-fg-2); + font-size: 10.5px; + font-weight: 700; + letter-spacing: .1em; + text-transform: uppercase; + white-space: nowrap; + overflow: hidden; +} +.cb-nav-sect:first-child { padding-top: 8px; } + +.cb-nav-link, +.cb-nav-head { + position: relative; + display: flex; + align-items: center; + gap: 11px; + width: 100%; + height: 42px; + margin: 2px 0; + padding: 0 10px 0 6px; + border: 0; + border-radius: 13px; + background: transparent; + color: var(--cb-nav-fg); + font: inherit; + font-size: 13.5px; + font-weight: 500; + text-align: left; + text-decoration: none; + cursor: pointer; + transition: background-color .18s var(--cb-ease), color .18s var(--cb-ease); +} +.cb-nav-link:hover, +.cb-nav-head:hover { background: var(--cb-nav-hover); } + +/* plain line icon — no chip, no fill; state is shown by colour only */ +.cb-nav-ico { + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 24px; + height: 30px; + color: var(--cb-nav-fg-2); + transition: color .18s var(--cb-ease); +} +.cb-nav-ico svg { width: 18px; height: 18px; stroke-width: 1.8; } +.cb-nav-link:hover .cb-nav-ico, +.cb-nav-head:hover .cb-nav-ico { color: var(--cb-nav-fg); } + +.cb-nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +/* active page: colour only — no background, no edge indicator */ +.cb-nav-link.active { + color: var(--cb-nav-active-fg); + font-weight: 600; +} +.cb-nav-link.active .cb-nav-ico, +.cb-nav-group.active > .cb-nav-head .cb-nav-ico { color: var(--cb-accent); } +.cb-nav-group.active > .cb-nav-head { color: var(--cb-nav-fg); font-weight: 600; } + +.cb-chev { + flex: none; + width: 14px; + height: 14px; + color: var(--cb-nav-fg-2); + opacity: .7; + transition: transform .25s var(--cb-ease); +} +.cb-chev svg { width: 14px; height: 14px; display: block; } +.cb-nav-group.open > .cb-nav-head .cb-chev { transform: rotate(90deg); } + +/* sub pages */ +.cb-nav-items { + display: grid; + grid-template-rows: 0fr; + transition: grid-template-rows .26s var(--cb-ease); +} +.cb-nav-group.open > .cb-nav-items { grid-template-rows: 1fr; } +.cb-nav-items > .cb-nav-sub { + position: relative; + overflow: hidden; + min-height: 0; + padding-left: 24px; +} +/* guide line under the category icon */ +.cb-nav-items > .cb-nav-sub::before { + content: ""; + position: absolute; + left: 17.5px; + top: 0; + bottom: 14px; + width: 1px; + background: var(--cb-glass-line); +} + +.cb-nav-item { + position: relative; + display: flex; + align-items: center; + gap: 10px; + height: 34px; + margin: 1px 0; + padding: 0 10px; + border-radius: 10px; + color: var(--cb-nav-fg-2); + font-size: 13px; + font-weight: 500; + text-decoration: none; + white-space: nowrap; + transition: background-color .18s var(--cb-ease), color .18s var(--cb-ease); +} +.cb-nav-item:hover { background: var(--cb-nav-hover); color: var(--cb-nav-fg); } +.cb-nav-item.active { color: var(--cb-nav-active-fg); font-weight: 600; } +.cb-nav-item.active .cb-sub-ico { color: var(--cb-accent); } +/* sub pages keep a short highlight on the guide line */ +.cb-nav-sub > .cb-nav-item.active::before { + content: ""; + position: absolute; + left: -7.5px; + top: 50%; + width: 3px; + height: 16px; + margin-top: -8px; + border-radius: 2px; + background: var(--cb-accent); +} +.cb-sub-ico { display: inline-flex; flex: none; width: 16px; height: 16px; opacity: .85; } +.cb-sub-ico svg { width: 16px; height: 16px; stroke-width: 1.8; } +.cb-nav-item.active .cb-sub-ico { opacity: 1; } + +/* hint card in simple mode */ +.cb-nav-hint { + display: flex; + gap: 10px; + margin: 18px 2px 0; + padding: 12px; + border-radius: 14px; + border: 1px solid var(--cb-chip-edge); + background: var(--cb-chip); + color: var(--cb-nav-fg-2); + font-size: 12px; + line-height: 1.5; +} +.cb-nav-hint a { font-weight: 600; color: var(--cb-nav-active-fg); } +.cb-nav-hint-ico { + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 20px; + height: 20px; + color: var(--cb-accent); +} +.cb-nav-hint-ico svg { width: 18px; height: 18px; } + +/* footer */ +.cb-sidebar-foot { + display: flex; + align-items: center; + gap: 8px; + padding: 10px 4px 2px; + border-top: 1px solid var(--cb-glass-line); +} +.cb-sidebar-foot .cb-seg { flex: 1; } + +/* language switch in the sidebar footer (bottom-left) */ +.cb-lang { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; transition: opacity .2s; } +.cb-lang-ico { display: inline-flex; flex: none; width: 18px; height: 18px; color: var(--cb-nav-fg-2); } +.cb-lang-ico svg { width: 18px; height: 18px; } +.cb-lang .cb-seg-btn { font-size: 12px; font-weight: 600; } +.cb-lang.busy { opacity: .55; pointer-events: none; } +.cb-lang.err .cb-seg, +.cb-lang.err .cb-lb, +.cb-lang.err .cb-mini { box-shadow: 0 0 0 1.5px var(--cb-red); } +.cb-lang-mini { font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; } +.cb-lang .cb-lb { flex: 1; min-width: 0; } +.cb-logout { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 5px; + height: 30px; + padding: 0 10px; + border-radius: 9px; + color: var(--cb-red); + font-size: 12.5px; + font-weight: 600; + white-space: nowrap; + text-decoration: none; +} +.cb-logout:hover { background: var(--cb-red-t); } +.cb-logout svg { width: 16px; height: 16px; } + +/* icon-only buttons used on the rail */ +.cb-mini { + display: none; + align-items: center; + justify-content: center; + width: 40px; + height: 36px; + margin: 0 auto; + padding: 0; + border: 0; + border-radius: 11px; + background: transparent; + color: var(--cb-nav-fg-2); + cursor: pointer; +} +.cb-mini:hover { background: var(--cb-nav-hover); color: var(--cb-nav-fg); } +.cb-mini svg { width: 17px; height: 17px; } + +/* flyout next to the rail */ +.cb-fly { + position: fixed; + z-index: 1000; + min-width: 200px; + max-width: 280px; + padding: 6px; + border-radius: 16px; + border: 1px solid var(--cb-glass-edge); + background: var(--cb-glass-solid); + box-shadow: var(--cb-glass-shadow); + color: var(--cb-nav-fg); + opacity: 0; + visibility: hidden; + transform: translateX(-6px); + transition: opacity .16s var(--cb-ease), transform .16s var(--cb-ease), visibility .16s; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-fly { + background: var(--cb-glass); + -webkit-backdrop-filter: blur(28px) saturate(170%); + backdrop-filter: blur(28px) saturate(170%); + } +} +/* visible at once when opening, so keyboard focus can move into it */ +.cb-fly.show { opacity: 1; visibility: visible; transform: none; transition-property: opacity, transform; } +.cb-fly-title { padding: 6px 10px 6px; color: var(--cb-nav-fg-2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; } +.cb-fly.cb-fly-tip { min-width: 0; padding: 4px; border-radius: 10px; } +.cb-fly.cb-fly-tip .cb-fly-title { padding: 4px 8px; color: var(--cb-nav-fg); font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; } +.cb-fly .cb-nav-item.active::before { display: none; } + +/* ---- collapsed rail (desktop only) ---- */ +@media (min-width: 1024px) { + html.cb-collapsed .cb-sidebar { width: var(--cb-side-w-mini); padding-left: 8px; padding-right: 8px; } + html.cb-collapsed .cb-collapse { opacity: 1; transform: rotate(180deg); } + html.cb-collapsed .cb-brand { justify-content: center; padding-left: 0; padding-right: 0; } + html.cb-collapsed .cb-brand-text, + html.cb-collapsed .cb-sidebar .cb-nav-label, + html.cb-collapsed .cb-chev, + html.cb-collapsed .cb-nav-items, + html.cb-collapsed .cb-nav-hint, + html.cb-collapsed .cb-mode .cb-seg, + html.cb-collapsed .cb-sidebar-foot .cb-seg, + html.cb-collapsed .cb-lang .cb-lb, + html.cb-collapsed .cb-lang-ico, + html.cb-collapsed .cb-logout span { display: none; } + html.cb-collapsed .cb-mini { display: inline-flex; } + html.cb-collapsed .cb-mode { padding: 0 0 4px; display: flex; } + html.cb-collapsed .cb-nav { margin: 0 -8px; padding: 2px 8px 12px; } + html.cb-collapsed .cb-nav-sect { + height: 1px; + margin: 12px 14px; + padding: 0; + background: var(--cb-glass-line); + font-size: 0; + } + html.cb-collapsed .cb-nav-sect:first-child { margin-top: 6px; } + html.cb-collapsed .cb-nav-link, + html.cb-collapsed .cb-nav-head { justify-content: center; padding: 0; } + html.cb-collapsed .cb-nav-ico { width: 36px; height: 36px; } + html.cb-collapsed .cb-nav-ico svg { width: 20px; height: 20px; } + html.cb-collapsed .cb-sidebar-foot { flex-direction: column; gap: 6px; padding: 10px 0 2px; } + html.cb-collapsed .cb-lang { flex: none; justify-content: center; } + html.cb-collapsed .cb-logout { width: 40px; height: 36px; padding: 0; } + html.cb-collapsed .cb-main { margin-left: calc(var(--cb-side-w-mini) + var(--cb-gutter) * 2); } +} +.cb-main { transition: margin-left .3s var(--cb-ease); } + +/* ---- segmented control ---- */ +.cb-seg { + --n: 2; + --i: 0; + position: relative; + display: inline-flex; + padding: 2px; + border-radius: 11px; + background: var(--cb-seg-track); + isolation: isolate; +} +.cb-seg::before { + content: ""; + position: absolute; + z-index: -1; + top: 2px; + bottom: 2px; + left: 2px; + width: calc((100% - 4px) / var(--n)); + border-radius: 9px; + background: var(--cb-seg-thumb); + box-shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 0 0 .5px rgba(15, 23, 42, .04); + transform: translateX(calc(var(--i) * 100%)); + transition: transform .25s var(--cb-ease); +} +.cb-seg > .cb-seg-btn { + flex: 1 1 0; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 4px; + min-width: 0; + height: 28px; + padding: 0 10px; + border: 0; + border-radius: 9px; + background: transparent; + color: var(--cb-text); + font: inherit; + font-size: 12.5px; + font-weight: 500; + white-space: nowrap; + cursor: pointer; +} +.cb-seg > .cb-seg-btn[aria-checked="false"] { color: var(--cb-text-2); } +.cb-seg > .cb-seg-btn svg { width: 15px; height: 15px; } + +/* ---- main ---- */ +.cb-main { + flex: 1; + min-width: 0; + margin-left: calc(var(--cb-side-w) + var(--cb-gutter) * 2); + display: flex; + flex-direction: column; + min-height: 100vh; +} + +.cb-toolbar { + position: sticky; + z-index: 200; + top: 0; + display: flex; + align-items: center; + gap: 12px; + min-height: 52px; + padding: 8px 28px 8px 16px; + background: var(--cb-bg); + border-bottom: .5px solid transparent; + transition: border-color .2s var(--cb-ease); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-toolbar { + background: var(--cb-toolbar); + -webkit-backdrop-filter: saturate(180%) blur(20px); + backdrop-filter: saturate(180%) blur(20px); + } +} +.cb-scrolled .cb-toolbar { border-bottom-color: var(--cb-border); } + +.cb-title { + flex: 1; + min-width: 0; + display: flex; + align-items: center; + gap: 6px; + font-size: 15px; + font-weight: 600; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.cb-title .cb-crumb { color: var(--cb-text-2); font-weight: 500; } +.cb-title .cb-crumb-sep { width: 12px; height: 12px; color: var(--cb-text-3); flex: none; } + +.cb-burger { + display: none; + position: relative; + width: 34px; + height: 34px; + margin-left: -6px; + border: 0; + border-radius: 8px; + background: transparent; + cursor: pointer; +} +.cb-burger:hover { background: var(--cb-hover); } +.cb-burger span, +.cb-burger span::before, +.cb-burger span::after { + position: absolute; + left: 9px; + width: 16px; + height: 1.75px; + border-radius: 2px; + background: var(--cb-text); +} +.cb-burger span { top: 16px; } +.cb-burger span::before, +.cb-burger span::after { content: ""; left: 0; } +.cb-burger span::before { top: -5px; } +.cb-burger span::after { top: 5px; } + +/* theme switch in the toolbar (top-right) */ +.cb-appearance { flex: none; } +.cb-appearance:empty { display: none; } +.cb-appearance .cb-seg-btn { height: 26px; min-width: 32px; padding: 0 8px; } +.cb-appearance .cb-seg-btn svg { width: 15px; height: 15px; } + +.cb-github { + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 32px; + height: 32px; + border-radius: 8px; + color: var(--cb-text-2); + transition: color .2s var(--cb-ease), background .2s var(--cb-ease); +} +.cb-github svg { width: 19px; height: 19px; } +.cb-github:hover { color: var(--cb-accent); background: var(--cb-hover); } +.cb-github:focus-visible { outline: 2px solid var(--cb-accent); outline-offset: 2px; } + +.cb-indicators, +#indicators { + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + gap: 6px; +} + +[data-indicator] { + display: inline-flex; + align-items: center; + gap: 6px; + height: 26px; + padding: 0 10px; + border-radius: 8px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 12px; + font-weight: 600; + white-space: nowrap; +} +[data-indicator][data-clickable] { cursor: pointer; } +[data-indicator][data-clickable]:hover { filter: brightness(.96); } +[data-indicator][data-style="active"] { + background: var(--cb-orange-t); + color: var(--cb-orange); +} +[data-indicator][data-style="active"]::before { + content: ""; + width: 7px; + height: 7px; + border-radius: 50%; + background: currentColor; +} +[data-indicator="poll-status"][data-style="active"] { + background: var(--cb-green-t); + color: var(--cb-green); +} + +.cb-content { + flex: 1; + width: 100%; + max-width: var(--cb-content-max); + margin: 0 auto; + padding: 12px 28px 28px; +} + +.cb-footer { + width: 100%; + max-width: var(--cb-content-max); + margin: 0 auto; + padding: 8px 28px 28px; + color: var(--cb-text-3); + font-size: 12px; +} +.cb-footer a { color: var(--cb-text-2); } + +.cb-scrim { display: none; } + diff --git a/luci-theme-carbon/styles/04-login.css b/luci-theme-carbon/styles/04-login.css new file mode 100644 index 000000000..aa5de131b --- /dev/null +++ b/luci-theme-carbon/styles/04-login.css @@ -0,0 +1,95 @@ +/* ========================================================================== + 4. Login page + ========================================================================== */ + +body.cb-login { + display: flex; + align-items: center; + justify-content: center; + padding: 24px 16px; + background: + radial-gradient(900px 620px at 10% 0%, var(--cb-amb-1), transparent 65%), + radial-gradient(800px 640px at 95% 100%, var(--cb-amb-2), transparent 65%), + radial-gradient(700px 520px at 90% 10%, var(--cb-amb-3), transparent 65%), + var(--cb-bg); + background-attachment: fixed; +} +.cb-login-wrap { width: 100%; max-width: 380px; } +.cb-login-brand { text-align: center; margin-bottom: 22px; } +.cb-login-logo { + width: 72px; + height: 72px; + border-radius: 17px; + box-shadow: 0 12px 30px -8px rgba(79, 91, 234, .55); +} +.cb-login-logo[data-custom] { object-fit: contain; box-shadow: none; } +.cb-login-brand h1 { margin: 16px 0 0; font-size: 24px; font-weight: 700; } + +.cb-login-card { + padding: 22px 22px 18px; + border-radius: 22px; + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-login-card { + -webkit-backdrop-filter: saturate(180%) blur(30px); + backdrop-filter: saturate(180%) blur(30px); + } +} +.cb-login-card .cbi-map { margin: 0; } +.cb-login-card .cbi-map > h2 { display: none; } +.cb-login-card .cbi-map-descr { margin: 0 0 14px; text-align: center; color: var(--cb-text-2); font-size: 13px; } +.cb-login-card .cbi-section { margin: 0; padding: 0; background: none; box-shadow: none; border: 0; } +.cb-login-card .cbi-section-node { background: none; box-shadow: none; border: 0; border-radius: 0; padding: 0; } +.cb-login-card .cbi-value { + display: block; + padding: 0; + margin: 0 0 12px; + border: 0 !important; +} +.cb-login-card .cbi-value-title { + display: block; + width: auto !important; + padding: 0 0 5px 2px !important; + text-align: left !important; + font-size: 12.5px; + color: var(--cb-text-2); +} +.cb-login-card .cbi-value-field { margin: 0; } +.cb-login-card .cbi-value-field input:where(:not([type="checkbox"]):not([type="radio"])) { + width: 100%; + height: 42px; + font-size: 15px; + border-radius: 10px; +} +.cb-login-card .cbi-page-actions { + position: static; + display: flex; + flex-direction: column; + gap: 8px; + margin: 18px 0 0; + padding: 0; + background: none; + border: 0; + box-shadow: none; + -webkit-backdrop-filter: none; + backdrop-filter: none; +} +.cb-login-card .cbi-page-actions .cbi-button { + width: 100%; + height: 42px; + margin: 0; + font-size: 15px; + border-radius: 10px; +} +.cb-login-card .cbi-page-actions .cbi-button-reset { display: none; } +.cb-login-card .alert-message { margin-bottom: 14px; animation: cb-shake .4s var(--cb-ease); } +.cb-login-foot { margin: 18px 0 0; text-align: center; color: var(--cb-text-3); font-size: 12px; } + +@keyframes cb-shake { + 0%, 100% { transform: translateX(0); } + 20%, 60% { transform: translateX(-6px); } + 40%, 80% { transform: translateX(6px); } +} + diff --git a/luci-theme-carbon/styles/05-luci-structure.css b/luci-theme-carbon/styles/05-luci-structure.css new file mode 100644 index 000000000..4d00701a3 --- /dev/null +++ b/luci-theme-carbon/styles/05-luci-structure.css @@ -0,0 +1,191 @@ +/* ========================================================================== + 5. LuCI page structure — maps, sections, value rows + ========================================================================== */ + +#view > h2, +.cbi-map > h2, +#maincontent > h2, +#view > .cbi-map > h2, +h2[name="content"] { + margin: 8px 0 6px; + font-size: 26px; + font-weight: 750; + letter-spacing: -.022em; +} + +.cbi-map-descr, +.cbi-section-descr, +.cbi-tab-descr { + margin: 0 0 18px; + color: var(--cb-text-2); + font-size: 13.5px; + line-height: 1.55; + max-width: 760px; +} +.cbi-section-descr:empty, .cbi-map-descr:empty { display: none; } + +.cbi-map { margin-bottom: 20px; } +.cbi-map > .cbi-section:first-of-type { margin-top: 10px; } + +.cbi-section, +.cbi-tblsection { + margin: 0 0 22px; +} +.cbi-section > h3, +.cbi-section > legend, +.cbi-tblsection > h3 { + margin: 0 0 10px; + padding: 0 4px; + font-size: 11px; + font-weight: 700; + color: var(--cb-text-2); + text-transform: uppercase; + letter-spacing: .09em; +} +.cbi-section > h3:empty { display: none; } + +.cbi-section-node, +.cbi-section > .table, +.cbi-section > .cbi-section-table, +.cbi-tblsection > .table, +#view > .table, +#view > .cbi-section > div:not([class]) > .table { + background: var(--cb-card); + border-radius: var(--cb-radius); + box-shadow: var(--cb-shadow); +} +.cbi-section-node { + padding: 4px 20px; +} +.cbi-section-node-tabbed { padding-top: 14px; } +.cbi-section-node:empty { display: none; } + +.cbi-section > div:not([class]):not([id]) > .cbi-value:first-child { margin-top: 0; } + +/* value rows */ +.cbi-value { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 6px 20px; + padding: 14px 0; + border-top: 1px solid var(--cb-sep); +} +.cbi-section-node > .cbi-value:first-child, +.cbi-section-node > [data-tab] > .cbi-value:first-child, +.cbi-section-node > div > .cbi-value:first-child, +[data-tab-title] > .cbi-value:first-of-type { border-top: 0; } + +.cbi-value-title, +.cbi-value label.cbi-value-title { + flex: 0 0 210px; + padding: 0; + color: var(--cb-text); + font-size: 13.5px; + font-weight: 600; + line-height: 1.4; + text-align: left; + word-break: break-word; +} +.cbi-value-field { + flex: 1 1 280px; + min-width: 0; + line-height: 1.5; +} +.cbi-value > .cbi-section, +.cbi-value > .cbi-tblsection { width: 100%; } +.cbi-value-field > .cbi-checkbox, +.cbi-value-field > div > .cbi-radio { min-height: 32px; display: inline-flex; align-items: center; } +/* inline button groups inside a field (e.g. System → Local time) */ +.cbi-value-field .control-group { + display: inline-flex; + flex-wrap: wrap; + gap: 6px; + margin-top: 8px; +} +.cbi-value-field .control-group > * { margin: 0 !important; } + +/* multi-line fields: keep the label at the top of the box */ +.cbi-value[data-widget="CBI.TextValue"], +.cbi-value:has(> .cbi-value-field textarea) { align-items: flex-start; } +.cbi-value[data-widget="CBI.TextValue"] > .cbi-value-title, +.cbi-value:has(> .cbi-value-field textarea) > .cbi-value-title { padding-top: 7px; } + +/* firewall zone forwarding cell: src ⇒ dest side by side (mirrors bootstrap) */ +.zone-forwards { display: flex; align-items: center; gap: 8px; min-width: 10em; } +.zone-forwards > * { flex: 1 1 45%; padding: 1px; } +.zone-forwards > span { flex: 0 0 auto; color: var(--cb-text-3); text-align: center; } +.zone-forwards .zone-src, +.zone-forwards .zone-dest { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; } + +/* zero-width text gives the switch a centred baseline for row alignment */ +.cbi-checkbox::before { content: "\200b"; width: 0; line-height: 32px; overflow: hidden; } + +.cbi-value-description { + position: relative; + margin: 6px 0 0; + padding-left: 0; + color: var(--cb-text-2); + font-size: 12.5px; + line-height: 1.5; +} +.cbi-value-description:empty { display: none; } + +.cbi-value-helpicon img { display: none; } + +.cbi-section-error { + margin-bottom: 14px; + padding: 10px 14px; + border-radius: var(--cb-radius-md); + background: var(--cb-red-t); + color: var(--cb-red); +} +.cbi-section-error ul { margin: 0; padding-left: 1.2em; } + +.cbi-section-create { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; + margin: 12px 0 0; +} +.cbi-section-create > * { margin: 0 !important; } +.cbi-section-create > div > input { margin: 0; } + +.cbi-section-remove { text-align: right; padding: 10px 0 4px; } +.cbi-section-remove:empty { display: none; } + +.cbi-optionals { padding: 10px 0; } + +.cbi-title-ref { color: var(--cb-accent); } +.cbi-title-ref::after { content: " →"; } + +/* page actions bar (Save & Apply) */ +.cbi-page-actions { + position: sticky; + z-index: 100; + bottom: 12px; + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + align-items: center; + gap: 8px; + margin: 22px 0 0; + padding: 10px 12px; + border-radius: var(--cb-radius); + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cbi-page-actions { + -webkit-backdrop-filter: saturate(180%) blur(20px); + backdrop-filter: saturate(180%) blur(20px); + } +} +.cbi-page-actions:empty { display: none; } +.cbi-page-actions > * { margin: 0 !important; } +.cbi-page-actions > :not([method="post"]):not(.cbi-button-apply):not(.cbi-button-negative):not(.cbi-button-save):not(.cbi-button-reset) { + margin-right: auto !important; +} +.cbi-page-actions.control-group { justify-content: flex-start; } + diff --git a/luci-theme-carbon/styles/06-forms.css b/luci-theme-carbon/styles/06-forms.css new file mode 100644 index 000000000..534168fa2 --- /dev/null +++ b/luci-theme-carbon/styles/06-forms.css @@ -0,0 +1,187 @@ +/* ========================================================================== + 6. Form controls + ========================================================================== */ + +input, +textarea, +select, +button { + font-family: var(--cb-font); + font-size: 13.5px; +} + +input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"])), +textarea, +select, +.cbi-select, +.cbi-dropdown:not(.btn):not(.cbi-button) { + display: inline-block; + width: 260px; + max-width: 100%; + min-height: 34px; + padding: 6px 12px; + border: 1px solid var(--cb-border-strong); + border-radius: var(--cb-radius-sm); + background: var(--cb-field); + color: var(--cb-text); + line-height: 20px; + box-shadow: 0 1px 2px rgba(15, 23, 42, .04); + transition: border-color .15s var(--cb-ease), box-shadow .15s var(--cb-ease); +} +input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"])), +select, +.cbi-select { height: 34px; } + +textarea { width: 100%; min-height: 120px; font-family: var(--cb-mono); font-size: 12.5px; resize: vertical; } + +select { + -webkit-appearance: none; + appearance: none; + padding-right: 30px; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14' fill='none' stroke='%238b91a1' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: right 10px center; + background-size: 10px 14px; + cursor: pointer; +} +select[multiple] { height: auto; background-image: none; padding-right: 10px; } +select option { background: var(--cb-card-solid); color: var(--cb-text); } + +.cbi-select { position: relative; padding: 0; } +.cbi-select select { + width: 100%; + height: 100%; + border: 0; + box-shadow: none; + background-color: transparent; +} + +input:focus, +textarea:focus, +select:focus, +.cbi-select.focus, +.cbi-dropdown:not(.btn):not(.cbi-button):focus, +.cbi-dropdown:not(.btn):not(.cbi-button)[open] { + outline: 0; + border-color: var(--cb-accent) !important; + box-shadow: 0 0 0 4px var(--cb-focus); +} + +::placeholder { color: var(--cb-text-3); opacity: 1; } + +input[readonly], +textarea[readonly] { background: var(--cb-card-2); color: var(--cb-text-2); } + +input[disabled], +button[disabled], +select[disabled], +textarea[disabled], +.cbi-dropdown[disabled] { + opacity: .5; + pointer-events: none; + cursor: default; +} + +input[type="file"] { width: auto !important; max-width: 100%; font-size: 13px; color: var(--cb-text-2); } +input[type="file"]::file-selector-button { + margin-right: 10px; + height: 32px; + padding: 0 14px; + border: 0; + border-radius: 9px; + background: var(--cb-fill); + color: var(--cb-text); + font: inherit; + font-weight: 500; + cursor: pointer; +} + +.cbi-input-invalid, +.cbi-input-invalid:focus, +.cbi-value-error input, +.cbi-dropdown.cbi-input-invalid { + border-color: var(--cb-red) !important; + color: var(--cb-red) !important; +} +.cbi-input-invalid:focus { box-shadow: 0 0 0 3.5px var(--cb-red-t) !important; } + +/* checkboxes & radios */ +input[type="checkbox"], +input[type="radio"] { + -webkit-appearance: none; + appearance: none; + position: relative; + flex: none; + width: 18px; + height: 18px; + margin: 0 6px 0 0; + vertical-align: -4px; + border: 1.5px solid var(--cb-border-strong); + border-radius: 6px; + background: var(--cb-field); + cursor: pointer; + transition: background-color .15s var(--cb-ease), border-color .15s var(--cb-ease); +} +input[type="radio"] { border-radius: 50%; } +input[type="checkbox"]:checked, +input[type="radio"]:checked { + border-color: var(--cb-accent); + background: var(--cb-accent); +} +input[type="checkbox"]:checked::after { + content: ""; + position: absolute; + left: 4.5px; + top: 1px; + width: 5px; + height: 10px; + border: solid #fff; + border-width: 0 2px 2px 0; + transform: rotate(45deg); +} +input[type="radio"]:checked::after { + content: ""; + position: absolute; + inset: 4px; + border-radius: 50%; + background: #fff; +} +input[type="checkbox"]:focus-visible, +input[type="radio"]:focus-visible { outline: 0; box-shadow: 0 0 0 3.5px var(--cb-focus); } +input[type="checkbox"].cbi-input-invalid, +input[type="radio"].cbi-input-invalid { border-color: var(--cb-red); } + +/* LuCI flag fields → iOS switch */ +.cbi-checkbox { display: inline-flex; align-items: center; gap: 8px; } +.cbi-checkbox > label:empty { display: none; } +.cbi-checkbox > input[type="checkbox"] { + width: 42px; + height: 24px; + margin: 0; + border: 0; + border-radius: 8px; + background: var(--cb-border-strong); + box-shadow: none; + transition: background-color .22s var(--cb-ease); +} +/* Keep the dark off-state fill from overriding the checked accent. */ +:root[data-darkmode="true"] .cbi-checkbox > input[type="checkbox"]:not(:checked) { background: rgba(255, 255, 255, .16); } +.cbi-checkbox > input[type="checkbox"]::after { + content: ""; + position: absolute; + top: 2px; + left: 2px; + width: 20px; + height: 20px; + border: 0; + border-radius: 6px; + background: #fff; + box-shadow: 0 1px 3px rgba(15, 23, 42, .25); + transform: none; + transition: transform .22s var(--cb-ease); +} +.cbi-checkbox > input[type="checkbox"]:checked { background: var(--cb-accent); } +.cbi-checkbox > input[type="checkbox"]:checked::after { transform: translateX(18px); } + +.cbi-radio { display: inline-flex; align-items: center; margin-right: 14px; cursor: pointer; gap: 2px; } + diff --git a/luci-theme-carbon/styles/07-buttons.css b/luci-theme-carbon/styles/07-buttons.css new file mode 100644 index 000000000..2cbd275b8 --- /dev/null +++ b/luci-theme-carbon/styles/07-buttons.css @@ -0,0 +1,152 @@ +/* ========================================================================== + 7. Buttons — solid colours only (no gradients) + ========================================================================== */ + +/* secondary: glass chip */ +.btn, +.cbi-button, +button:where(:not([class*="cb-"])), +input[type="submit"], +input[type="button"], +input[type="reset"] { + --btn-bg: var(--cb-card-solid); + --btn-fg: var(--cb-text); + --btn-ring: var(--cb-border-strong); + display: inline-flex; + align-items: center; + justify-content: center; + gap: 6px; + width: auto; + min-height: 34px; + padding: 6px 15px; + border: 0; + border-radius: var(--cb-radius-sm); + background: var(--btn-bg); + color: var(--btn-fg); + box-shadow: inset 0 0 0 1px var(--btn-ring), 0 1px 2px rgba(15, 23, 42, .05); + font: inherit; + font-size: 13.5px; + font-weight: 600; + line-height: 20px; + letter-spacing: .005em; + white-space: nowrap; + text-decoration: none; + vertical-align: middle; + cursor: pointer; + transition: background-color .15s var(--cb-ease), box-shadow .15s var(--cb-ease), color .15s, transform .1s var(--cb-ease); + -webkit-user-select: none; + user-select: none; +} +:root[data-darkmode="true"] .btn, +:root[data-darkmode="true"] .cbi-button, +:root[data-darkmode="true"] input[type="submit"], +:root[data-darkmode="true"] input[type="button"], +:root[data-darkmode="true"] input[type="reset"], +:root[data-darkmode="true"] button:where(:not([class*="cb-"])) { --btn-bg: rgba(255, 255, 255, .06); } + +.btn:hover, +.cbi-button:hover, +input[type="submit"]:hover, +input[type="button"]:hover, +input[type="reset"]:hover, +button:where(:not([class*="cb-"])):hover { --btn-ring: var(--cb-accent); color: var(--cb-accent-strong); } +.btn:active, +.cbi-button:active, +button:where(:not([class*="cb-"])):active { transform: translateY(1px); } +.btn:focus-visible, +.cbi-button:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px var(--cb-accent), 0 0 0 4px var(--cb-focus); } + +/* primary: solid Carbon indigo */ +.btn.primary, +.btn.important, +.cbi-button-apply, +.cbi-button-save, +.cbi-button-positive.important, +.cbi-button-action.important, +.cbi-button.important, +.cbi-page-actions .cbi-button-apply, +.cbi-section-actions .cbi-button-edit, +input[type="submit"].cbi-button-apply { + --btn-bg: var(--cb-accent) !important; + --btn-fg: var(--cb-on-accent) !important; + --btn-ring: transparent !important; + color: var(--cb-on-accent) !important; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 6px 14px -6px rgba(79, 91, 234, .55); +} +.btn.primary:hover, +.btn.important:hover, +.cbi-button-apply:hover, +.cbi-button-save:hover, +.cbi-button.important:hover, +.cbi-section-actions .cbi-button-edit:hover { --btn-bg: var(--cb-accent-strong) !important; } + +/* tinted variants */ +.cbi-button-positive, +.cbi-button-add, +.btn.success { + --btn-bg: var(--cb-green-t); + --btn-fg: var(--cb-green); + --btn-ring: transparent; +} +.cbi-button-negative, +.cbi-button-remove, +.btn.danger, +.btn.error { + --btn-bg: var(--cb-red-t); + --btn-fg: var(--cb-red); + --btn-ring: transparent; +} +.cbi-button-action, +.cbi-button-edit, +.cbi-button-find, +.cbi-button-link, +.cbi-button-download { + --btn-bg: var(--cb-accent-t); + --btn-fg: var(--cb-accent-strong); + --btn-ring: transparent; +} +:root[data-darkmode="true"] .cbi-button-positive, +:root[data-darkmode="true"] .cbi-button-add { --btn-bg: var(--cb-green-t); } +:root[data-darkmode="true"] .cbi-button-negative, +:root[data-darkmode="true"] .cbi-button-remove { --btn-bg: var(--cb-red-t); } +:root[data-darkmode="true"] .cbi-button-action, +:root[data-darkmode="true"] .cbi-button-edit, +:root[data-darkmode="true"] .cbi-button-find, +:root[data-darkmode="true"] .cbi-button-link, +:root[data-darkmode="true"] .cbi-button-download { --btn-bg: var(--cb-accent-t); } +.cbi-button-positive:hover, +.cbi-button-add:hover { --btn-ring: var(--cb-green); color: var(--cb-green); } +.cbi-button-negative:hover, +.cbi-button-remove:hover { --btn-ring: var(--cb-red); color: var(--cb-red); } + +.cbi-button-negative.important { + --btn-bg: var(--cb-red) !important; + --btn-fg: #fff !important; + color: #fff !important; + box-shadow: 0 6px 14px -6px rgba(229, 72, 77, .55); +} + +.cbi-button-reset, +.cbi-button-neutral, +.cbi-button-up, +.cbi-button-down, +.cbi-button-fieldadd, +.cbi-button-reload { --btn-bg: var(--cb-fill); --btn-ring: transparent; } +:root[data-darkmode="true"] .cbi-button-reset, +:root[data-darkmode="true"] .cbi-button-neutral { --btn-bg: var(--cb-fill); } + +.cbi-page-actions .cbi-button-apply + .cbi-button-save, +.cbi-page-actions .cbi-button-negative + .cbi-button-save { + --btn-bg: var(--cb-card-solid) !important; + --btn-fg: var(--cb-text) !important; + --btn-ring: var(--cb-border-strong) !important; + color: var(--cb-text) !important; + box-shadow: inset 0 0 0 1px var(--btn-ring); +} +:root[data-darkmode="true"] .cbi-page-actions .cbi-button-apply + .cbi-button-save { --btn-bg: rgba(255, 255, 255, .06) !important; } + +.cbi-button-up, +.cbi-button-down { min-width: 34px; padding: 0 8px; } + +.btn .close, .alert-message .close { font-family: inherit; } + diff --git a/luci-theme-carbon/styles/08-dropdown.css b/luci-theme-carbon/styles/08-dropdown.css new file mode 100644 index 000000000..c7a0b884c --- /dev/null +++ b/luci-theme-carbon/styles/08-dropdown.css @@ -0,0 +1,234 @@ +/* ========================================================================== + 8. Dropdown (ui.Dropdown / ui.ComboButton) — behaviour mirrors bootstrap + ========================================================================== */ + +.cbi-dropdown { + display: inline-flex !important; + cursor: pointer; + height: auto; + position: relative; + padding: 0 !important; +} +.cbi-dropdown:not(.btn):not(.cbi-button) { + min-width: 260px; + max-width: 100%; + width: auto; + padding: 0 !important; +} +.cbi-dropdown img { max-height: 1.6em; width: auto; } + +.cbi-dropdown > ul { + margin: 0 !important; + padding: 0; + list-style: none; + overflow-x: hidden; + overflow-y: hidden; + display: flex; + width: 100%; +} +.cbi-dropdown.btn > ul:not(.dropdown), +.cbi-dropdown.cbi-button > ul:not(.dropdown) { margin: 0 0 0 14px !important; } +.cbi-dropdown.btn.spinning > ul:not(.dropdown), +.cbi-dropdown.cbi-button.spinning > ul:not(.dropdown) { margin: 0 !important; } +.cbi-dropdown > ul.preview { display: none; } + +.cbi-dropdown > .open, +.cbi-dropdown > .more { + flex-grow: 0; + flex-shrink: 0; + display: flex; + flex-direction: column; + justify-content: center; + text-align: center; + line-height: 2em; + padding: 0 .55em; + color: var(--cb-text-2); + font-size: 11px; +} +.cbi-dropdown.btn > .open, +.cbi-dropdown.cbi-button > .open { + padding: 0 .7em; + margin-left: .6em; + border-left: 1px solid rgba(255, 255, 255, .35); + color: inherit; +} +.cbi-dropdown > .more, +.cbi-dropdown:not(.btn):not(.cbi-button) > ul > li[placeholder] { + color: var(--cb-text-3); + display: none; +} + +.cbi-dropdown > ul > li { + display: none; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + flex-shrink: 1; + flex-grow: 1; + align-items: center; + align-self: center; + color: inherit; +} +.cbi-dropdown > ul.dropdown > li, +.cbi-dropdown:not(.btn):not(.cbi-button) > ul > li { + min-height: 30px; + padding: 5px 10px; + color: var(--cb-text); +} +.cbi-dropdown > ul > li .hide-open { display: initial; } +.cbi-dropdown > ul > li .hide-close { display: none; } +.cbi-dropdown > ul > li[display]:not([display="0"]) { border-left: 1px solid var(--cb-sep); } +.cbi-dropdown[empty] > ul { max-width: 1px; } +.cbi-dropdown > ul > li > form { + display: none; + margin: 0; + padding: 0; + pointer-events: none; +} +.cbi-dropdown > ul > li img { vertical-align: middle; margin-right: .3em; } +.cbi-dropdown > ul > li > form > input[type="checkbox"] { margin: 0 .4em 0 0; } +.cbi-dropdown > ul > li input[type="text"] { height: 26px !important; min-height: 26px !important; } + +.cbi-dropdown[open] { position: relative; } +.cbi-dropdown[open] > ul.dropdown { + display: block; + position: absolute; + z-index: 1100; + max-width: none; + min-width: 100%; + width: auto; + padding: 6px !important; + border: 1px solid var(--cb-glass-edge); + border-radius: 14px; + /* opaque: the list is read item by item over busy pages */ + background: var(--cb-card-solid); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + transition: max-height .125s ease-in; + overflow-y: auto; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cbi-dropdown[open] > ul.dropdown { + -webkit-backdrop-filter: saturate(180%) blur(20px); + backdrop-filter: saturate(180%) blur(20px); + } +} + +.cbi-dropdown > ul > li[display], +.cbi-dropdown[open] > ul.preview, +.cbi-dropdown[open] > ul.dropdown > li, +.cbi-dropdown[multiple] > ul > li > label, +.cbi-dropdown[multiple][open] > ul.dropdown > li, +.cbi-dropdown[multiple][more] > .more, +.cbi-dropdown[multiple][empty] > .more { + flex-grow: 1; + display: flex !important; +} +.cbi-dropdown[empty] > ul > li, +.cbi-dropdown[optional][open] > ul.dropdown > li[placeholder] { + display: block !important; +} +.cbi-dropdown[multiple][open] > ul.dropdown > li > form { display: flex !important; } +.cbi-dropdown[open] > ul.dropdown > li .hide-open { display: none; } +.cbi-dropdown[open] > ul.dropdown > li .hide-close { display: initial; } + +/* items match the Carbon listbox (.cb-lb-list): soft hover tint, accent for the selection */ +.cbi-dropdown[open] > ul.dropdown > li { + min-height: 34px; + padding: 5px 12px; + border-radius: 9px; + border: 0 !important; + font-size: 13px; +} +.cbi-dropdown[open] > ul.dropdown > li[selected] { color: var(--cb-accent); font-weight: 600; } +.cbi-dropdown[open] > ul.dropdown > li.focus, +.cbi-dropdown[open] > ul.dropdown > li:hover { background: var(--cb-nav-hover); } +.cbi-dropdown[open] > ul.dropdown > li:last-child { margin-bottom: 0; } +.cbi-dropdown[open] > ul.dropdown > li[unselectable] { opacity: .6; } +.cbi-dropdown[open] > ul.dropdown > li > input.create-item-input:first-child:last-child { width: 100%; } +.cbi-dropdown[disabled] { pointer-events: none; opacity: .5; } +.cbi-dropdown .zonebadge { width: 100%; } +.cbi-dropdown[open] .zonebadge { width: auto; } + + +/* ---- Carbon listbox (C.listbox): a select in the sidebar's glass style ---- */ +.cb-lb { + display: inline-flex; + align-items: center; + gap: 6px; + height: 32px; + padding: 0 8px 0 11px; + border: 0; + border-radius: 11px; + background-color: var(--cb-seg-track); + color: var(--cb-text); + font: inherit; + font-size: 12.5px; + font-weight: 600; + text-align: start; + cursor: pointer; + transition: background-color .15s var(--cb-ease); +} +/* hover tint layered over the track colour */ +.cb-lb:hover, +.cb-lb[aria-expanded="true"] { background-image: linear-gradient(var(--cb-nav-hover), var(--cb-nav-hover)); } +.cb-lb:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--cb-focus); } +.cb-lb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.cb-lb-chev { display: inline-flex; flex: none; color: var(--cb-text-2); transition: transform .2s var(--cb-ease); } +.cb-lb-chev svg { width: 14px; height: 14px; } +.cb-lb[aria-expanded="true"] .cb-lb-chev { transform: rotate(180deg); } + +.cb-lb-list { + position: fixed; + z-index: 1000; + max-height: min(70vh, 440px); + min-width: 180px; + max-width: min(320px, calc(100vw - 16px)); + margin: 0; + padding: 6px; + overflow-y: auto; + overscroll-behavior: contain; + list-style: none; + border-radius: 14px; + border: 1px solid var(--cb-glass-edge); + /* opaque: the list is read item by item over busy pages */ + background: var(--cb-card-solid); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + outline: none; + opacity: 0; + transform: translateY(4px); + transition: opacity .14s var(--cb-ease), transform .14s var(--cb-ease); +} +.cb-lb-list.show { opacity: 1; transform: none; } +.cb-lb-list > li { + display: flex; + align-items: center; + gap: 8px; + min-height: 34px; + padding: 0 12px 0 8px; + border-radius: 9px; + font-size: 13px; + white-space: nowrap; + cursor: pointer; +} +.cb-lb-list > li > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; } +/* group heading (like ): not an option, not focusable */ +.cb-lb-list > li.cb-lb-group { + min-height: 0; + padding: 8px 10px 4px; + color: var(--cb-text-3); + font-size: 11.5px; + font-weight: 600; + letter-spacing: .02em; + cursor: default; +} +.cb-lb-list > li.cb-lb-group:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--cb-sep); padding-top: 10px; } +.cb-lb-list > li.active { background: var(--cb-nav-hover); } +.cb-lb-list > li[aria-selected="true"] { color: var(--cb-accent); font-weight: 600; } +.cb-lb-check { display: inline-flex; flex: none; width: 16px; height: 16px; visibility: hidden; } +.cb-lb-check svg { width: 16px; height: 16px; } +.cb-lb-list > li[aria-selected="true"] .cb-lb-check { visibility: visible; } +@media (prefers-reduced-motion: reduce) { + .cb-lb-list, .cb-lb-chev { transition: none; } +} diff --git a/luci-theme-carbon/styles/09-dynlist.css b/luci-theme-carbon/styles/09-dynlist.css new file mode 100644 index 000000000..bc3e12d35 --- /dev/null +++ b/luci-theme-carbon/styles/09-dynlist.css @@ -0,0 +1,59 @@ +/* ========================================================================== + 9. Dynamic lists + ========================================================================== */ + +.cbi-dynlist { + display: inline-flex; + flex-direction: column; + gap: 6px; + min-width: 260px; + max-width: 100%; + height: auto; + min-height: 32px; +} +.cbi-dynlist > .item { + position: relative; + padding: 6px 36px 6px 10px; + border-radius: var(--cb-radius-sm); + background: var(--cb-fill-2); + color: var(--cb-text); + font-size: 13px; + line-height: 20px; + pointer-events: auto; + overflow: hidden; + word-break: break-all; + cursor: move; + user-select: text; +} +.cbi-dynlist > .item::after { + content: "×"; + position: absolute; + top: 0; + right: 0; + bottom: 0; + display: inline-flex; + align-items: center; + padding: 0 11px; + color: var(--cb-red); + font-size: 17px; + font-weight: 500; + pointer-events: auto; + cursor: pointer; +} +.cbi-dynlist > .item:hover::after { background: var(--cb-red-t); } +.cbi-dynlist > .item > span { pointer-events: none; } +.cbi-dynlist > .item.drag-over { box-shadow: inset 0 2px 0 var(--cb-accent); } +.cbi-dynlist > .item.dragging { opacity: .5; } +.cbi-dynlist > .add-item { display: flex; gap: 6px; } +.cbi-dynlist > .add-item > input, +.cbi-dynlist > .add-item > button { + flex: 1 1 auto; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.cbi-dynlist > .add-item > .cbi-button { flex: 0 0 auto; } +.cbi-dynlist > .add-item > .cbi-dropdown { flex: 1; min-width: 0; width: 100%; } +.cbi-dynlist > .add-item > .cbi-input-text.drag-over, +.cbi-dynlist > .add-item > .cbi-button-add.drag-over { box-shadow: inset 0 2px 0 var(--cb-accent); } + diff --git a/luci-theme-carbon/styles/10-tabs.css b/luci-theme-carbon/styles/10-tabs.css new file mode 100644 index 000000000..693048533 --- /dev/null +++ b/luci-theme-carbon/styles/10-tabs.css @@ -0,0 +1,96 @@ +/* ========================================================================== + 10. Tabs → Carbon pill tabs + ========================================================================== */ + +.tabs, +.cbi-tabmenu { + display: flex; + flex-wrap: wrap; + gap: 4px; + max-width: 100%; + margin: 0 0 18px; + padding: 0 0 10px; + list-style: none; + border-bottom: 1px solid var(--cb-sep); +} +#tabmenu { margin: 4px 0 8px; } +#tabmenu .tabs { margin-bottom: 10px; } + +.tabs > li, +.cbi-tabmenu > li { + position: relative; + display: flex; + align-items: center; + margin: 0; + border-radius: 9px; + color: var(--cb-text-2); + transition: background-color .18s var(--cb-ease), color .18s var(--cb-ease); +} +.tabs > li > a, +.cbi-tabmenu > li > a { + display: block; + padding: 6px 14px; + color: inherit; + font-size: 13px; + font-weight: 600; + line-height: 20px; + white-space: nowrap; + text-decoration: none; + border-radius: 9px; + outline: none; +} +.tabs > li > a:focus-visible, +.cbi-tabmenu > li > a:focus-visible { box-shadow: 0 0 0 3px var(--cb-focus); } +.tabs > li:not(.active):hover, +.cbi-tabmenu > .cbi-tab-disabled:hover { color: var(--cb-text); background: var(--cb-fill-2); } + +.tabs > li.active, +.cbi-tabmenu > .cbi-tab { + background: var(--cb-accent-t); + color: var(--cb-accent-strong); +} +/* active underline sitting on the divider */ +.tabs > li.active::after, +.cbi-tabmenu > .cbi-tab::after { + content: ""; + position: absolute; + left: 14px; + right: 14px; + bottom: -11px; + height: 2px; + border-radius: 2px; + background: var(--cb-accent); +} + +.cbi-tab-disabled[data-errors]::after { + content: attr(data-errors); + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 18px; + height: 18px; + margin-right: 10px; + padding: 0 5px; + border-radius: 6px; + background: var(--cb-red); + color: #fff; + font-size: 11px; + font-weight: 700; +} + +.cbi-tabmenu.map { margin: 0 0 14px; } +.cbi-tabmenu.map > li { font-size: 14px; } + +/* tab panes — keep LuCI's height-0 approach so hidden fields still validate */ +[data-tab-title] { + height: 0; + opacity: 0; + overflow: hidden; +} +[data-tab-active="true"] { + opacity: 1; + height: auto; + overflow: visible; + transition: opacity .25s ease-in; +} + diff --git a/luci-theme-carbon/styles/11-tables.css b/luci-theme-carbon/styles/11-tables.css new file mode 100644 index 000000000..9d63987f0 --- /dev/null +++ b/luci-theme-carbon/styles/11-tables.css @@ -0,0 +1,133 @@ +/* ========================================================================== + 11. Tables + ========================================================================== */ + +table { border-collapse: collapse; border-spacing: 0; } + +.table { + display: table; + width: 100%; + margin: 0 0 22px; + padding: 0; + font-size: 13.5px; + border-collapse: separate; + border-spacing: 0; + position: relative; + overflow: hidden; +} +.thead { display: table-header-group; } +.tbody { display: table-row-group; } +.tr { display: table-row; } +.table[width="33%"], .th[width="33%"], .td[width="33%"] { width: 33%; } +.table[width="100%"], .th[width="100%"], .td[width="100%"] { width: 100%; } + +.table .th, +.table .td, +.table th, +.table td { + display: table-cell; + padding: 11px 14px; + line-height: 20px; + text-align: left; + vertical-align: middle; + border-top: 1px solid var(--cb-sep); +} +.table .tr:first-child > .th, +.table .tr:first-child > .td, +.table > .tr:first-child > .td, +.table tr:first-child > th, +.table tr:first-child > td { border-top: 0; } + +.table .th, +.table th, +.tr.table-titles > .th, +.tr.cbi-section-table-titles > .th { + color: var(--cb-text-3); + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: .07em; + white-space: nowrap; +} +.tr.table-titles, +.tr.cbi-section-table-titles { background: transparent; } +.cbi-rowstyle-2 { background: transparent; } + +.table .tr:not(.table-titles):not(.cbi-section-table-titles):not(.placeholder):hover > .td { background: var(--cb-hover); } + +.tr.placeholder { height: calc(3em + 22px); } +.tr.placeholder > .td { + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 0; + display: flex; + align-items: center; + justify-content: center; + color: var(--cb-text-2); + border-top: 0; +} + +.table .td > .cbi-value-field, +.table .td.cbi-value-field { line-height: normal; } +.table .td.cbi-value-field { display: table-cell; } + +.cbi-section-table-titles.named::before, +.cbi-section-table-descr.named::before, +.cbi-section-table-row[data-title]::before { + content: attr(data-title) " "; + display: table-cell; + padding: 11px 14px; + line-height: 20px; + font-weight: 600; + vertical-align: middle; + border-top: .5px solid var(--cb-sep); +} +.cbi-section-table-titles.named::before { border-top: 0; } +.cbi-section-table .tr.cbi-section-table-descr .th { font-weight: 400; } + +.table.cbi-section-table input[type="password"], +.table.cbi-section-table input[type="text"], +.table.cbi-section-table textarea, +.table.cbi-section-table select, +.table.cbi-section-table .cbi-select { + width: 100%; + min-width: 6em; +} +.table.cbi-section-table .td.cbi-section-table-cell { white-space: nowrap; text-align: right; } +.table.cbi-section-table .td.cbi-section-table-cell select, +.table.cbi-section-table .td.cbi-section-table-cell .cbi-select { width: inherit; } + +.td > input[type=text], +.td > input[type=password], +.td > select, +.td > .cbi-dropdown:not(.btn):not(.cbi-button), +.cbi-dynlist > .add-item > .cbi-dropdown { width: 100%; } + +.td.cbi-section-actions { + text-align: right; + vertical-align: middle; + width: 1%; + white-space: nowrap; +} +.td.cbi-section-actions > * { display: flex; gap: 6px; justify-content: flex-end; } +.td.cbi-section-actions > :not(.cbi-dropdown) > *, +.td.cbi-section-actions > * > form > * { flex: 0 0 auto; margin: 0; } +.td.cbi-section-actions > * > form { display: inline-flex; margin: 0; } +.td.cbi-section-actions .cbi-button { min-height: 28px; padding: 3px 11px; font-size: 12.5px; } + +.table.valign-middle .td { vertical-align: middle; } + +th[data-sortable-row] { cursor: pointer; } +th[data-sort-direction="asc"]::after { content: "\a0\25b4"; } +th[data-sort-direction="desc"]::after { content: "\a0\25be"; } + +table table td, +.cbi-value-field table td { border: none; } + +/* status tables that sit directly in a section get a card */ +.cbi-section > .table, +.cbi-section > div > .table, +.cbi-tblsection > .table { margin-bottom: 0; } + diff --git a/luci-theme-carbon/styles/12-alerts.css b/luci-theme-carbon/styles/12-alerts.css new file mode 100644 index 000000000..9c6f6f225 --- /dev/null +++ b/luci-theme-carbon/styles/12-alerts.css @@ -0,0 +1,210 @@ +/* ========================================================================== + 12. Alerts, labels, badges, tooltips, progress + ========================================================================== */ + +.alert-message { + --al: var(--cb-accent); + --al-t: var(--cb-accent-t); + position: relative; + margin: 0 0 16px; + padding: 14px 18px 14px 22px; + border-radius: var(--cb-radius-md); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + color: var(--cb-text); + font-size: 13.5px; + overflow: hidden; +} +.alert-message::before { + content: ""; + position: absolute; + left: 8px; + top: 12px; + bottom: 12px; + width: 3px; + border-radius: 3px; + background: var(--al); +} +.alert-message::after { + content: ""; + position: absolute; + inset: 0; + pointer-events: none; + background: var(--al-t); + opacity: .55; +} +.alert-message > * { position: relative; z-index: 1; } +.alert-message.warning { --al: var(--cb-orange); --al-t: var(--cb-orange-t); } +.alert-message.error, +.alert-message.danger { --al: var(--cb-red); --al-t: var(--cb-red-t); } +.alert-message.success { --al: var(--cb-green); --al-t: var(--cb-green-t); } +.alert-message h4, +.alert-message h5 { margin: 0 0 4px; font-size: 14px; } +.alert-message p, +.alert-message ul, +.alert-message pre { margin: 0 0 6px; } +.alert-message > :last-child { margin-bottom: 0; } +.alert-message .right { margin-top: 8px; } +.alert-message button { margin-top: 6px; } +.alert-message.fade-out { opacity: 0; transition: opacity .4s ease-in; } +.alert-message.fade-in { animation: cb-fade-in .3s var(--cb-ease); } +@keyframes cb-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } } + +.label { + display: inline-flex; + align-items: center; + height: 20px; + padding: 0 8px; + border-radius: 6px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 11.5px; + font-weight: 600; + white-space: nowrap; + text-decoration: none; +} +.label.important { background: var(--cb-red-t); color: var(--cb-red); } +.label.warning { background: var(--cb-orange-t); color: var(--cb-orange); } +.label.success { background: var(--cb-green-t); color: var(--cb-green); } +.label.notice { background: var(--cb-accent-t); color: var(--cb-accent); } + +.cbi-tooltip-container { cursor: help; } +.cbi-tooltip { + position: absolute; + z-index: 1000; + left: -10000px; + max-width: 420px; + padding: 6px 10px; + border-radius: 8px; + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + font-size: 12.5px; + line-height: 1.45; + white-space: pre; + opacity: 0; + transition: opacity .2s ease-in; +} +.cbi-tooltip-container:hover .cbi-tooltip:not(:empty) { left: auto; opacity: 1; } +.cbi-tooltip.error { color: var(--cb-red); } +.cbi-tooltip.success { color: var(--cb-green); } +.cbi-tooltip.notice, +.cbi-tooltip.info { color: var(--cb-accent); } + +.cbi-progressbar { + position: relative; + min-width: 170px; + height: 6px; + margin: 1.6em 0 6px; + border-radius: 3px; + background: var(--cb-fill); +} +.cbi-progressbar > div { + height: 100%; + width: 0%; + border-radius: 3px; + background: var(--cb-accent); + transition: width .4s var(--cb-ease); +} +.cbi-progressbar::before { + content: attr(title); + position: absolute; + top: -1.6em; + left: 0; + right: 0; + color: var(--cb-text-2); + font-size: 12px; + line-height: 1.4; + white-space: pre; + overflow: hidden; + text-overflow: ellipsis; + font-variant-numeric: tabular-nums; +} + +/* interface & zone badges */ +.ifacebadge { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 3px 9px; + border-radius: 7px; + background: var(--cb-fill-2); + color: var(--cb-text); + font-size: 12.5px; + line-height: 1.4; + white-space: nowrap; +} +.ifacebadge img { width: 16px; height: 16px; vertical-align: middle; } +:root[data-darkmode="true"] .ifacebadge img, +:root[data-darkmode="true"] .ifacebox img { filter: invert(1) hue-rotate(180deg); } +.ifacebadge-active { background: var(--cb-accent-t); color: var(--cb-accent); font-weight: 600; } +.ifacebadge.large, +.network-status-table .ifacebox-body .ifacebadge { display: inline-flex; flex: 1; padding: 6px 10px; } +.ifacebadge > *, +.ifacebadge.large > * { margin: 0 .1em; } + +.ifacebox { + display: inline-flex; + flex-direction: column; + min-width: 120px; + margin: 0 6px; + border-radius: var(--cb-radius-md); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + text-align: center; + white-space: nowrap; + overflow: hidden; + line-height: 1.4; +} +.ifacebox .ifacebox-head { + padding: 6px 10px; + background: var(--cb-fill-2); + font-weight: 600; + font-size: 12.5px; +} +.ifacebox .ifacebox-head[style] { color: #1d1d1f; } +.ifacebox .ifacebox-head.active { background: var(--cb-accent); color: #fff; } +.ifacebox .ifacebox-body { padding: 8px 10px; font-size: 12.5px; } +:root[data-darkmode="true"] .zonebadge[style], +:root[data-darkmode="true"] .ifacebox-head[style] { background-blend-mode: multiply; filter: brightness(.85) saturate(1.1); } +#cbi-network-interface .ifacebox-body { justify-content: center; } + +.network-status-table { + display: flex; + flex-wrap: wrap; + gap: 12px; + margin-bottom: 18px; +} +.network-status-table .ifacebox { flex: 1 1 280px; margin: 0; text-align: left; } +.network-status-table .ifacebox-body { display: flex; flex-direction: column; gap: 4px; height: 100%; } +.network-status-table .ifacebox-body > * { margin: 0; } +.network-status-table .ifacebox-body > div { display: flex; flex-wrap: wrap; gap: 6px; } +.network-status-table .ifacebox-body > span { white-space: normal; } + +.zonebadge { + display: inline-flex; + align-items: center; + flex-wrap: wrap; + gap: 4px; + padding: 3px 8px; + border-radius: 7px; + color: #1d1d1f; + font-size: 12.5px; + white-space: nowrap; +} +.zonebadge > em, +.zonebadge > strong { margin: 0 2px; display: inline-block; color: inherit; } +.zonebadge input { width: 6em; } +.zonebadge > .ifacebadge { margin-left: 2px; background: rgba(255, 255, 255, .55); color: #1d1d1f; } +.zonebadge-empty { background: repeating-linear-gradient(45deg, var(--cb-fill-2), var(--cb-fill-2) 6px, transparent 6px, transparent 12px); color: var(--cb-text-2); } +.zonebadge .cbi-tooltip { padding: 2px; background: inherit; margin: -1.6em 0 0 -5px; border-radius: 8px; } +.zonebadge .cbi-tooltip > * { margin: 1px; } + +.td.cbi-value-field var, +.td.cbi-value-field var.cbi-tooltip-container { font-style: normal; font-family: inherit; } +.td.cbi-value-field var[data-tooltip], +div.cbi-value var.cbi-tooltip-container, +.td.cbi-value-field var.cbi-tooltip-container { cursor: help; border-bottom: 1px dotted currentColor; } +div.cbi-value var.cbi-tooltip-container .cbi-tooltip, +.td.cbi-value-field var.cbi-tooltip-container .cbi-tooltip { white-space: normal; } + diff --git a/luci-theme-carbon/styles/13-modals.css b/luci-theme-carbon/styles/13-modals.css new file mode 100644 index 000000000..38f1f81c7 --- /dev/null +++ b/luci-theme-carbon/styles/13-modals.css @@ -0,0 +1,100 @@ +/* ========================================================================== + 13. Modal dialogs & change list + ========================================================================== */ + +#modal_overlay { + position: fixed; + z-index: 900; + top: 0; + bottom: 0; + left: 0; + right: 0; + overflow: auto; + background: rgba(0, 0, 0, .32); + opacity: 0; + visibility: hidden; + transition: opacity .2s var(--cb-ease), visibility .2s; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + #modal_overlay { + -webkit-backdrop-filter: blur(6px); + backdrop-filter: blur(6px); + } +} +body.modal-overlay-active { overflow: hidden; height: 100vh; } +body.modal-overlay-active #modal_overlay { opacity: 1; visibility: visible; } + +.modal { + width: 92%; + max-width: 600px; + min-width: 270px; + min-height: 32px; + margin: 9vh auto 5vh; + padding: 22px 24px 18px; + border-radius: 20px; + background: var(--cb-card); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + transform: translateY(8px) scale(.98); + transition: transform .25s var(--cb-ease); +} +.modal { background: var(--cb-card-solid); } +body.modal-overlay-active .modal { transform: none; } +.modal > * { line-height: 1.5; margin-bottom: .6em; max-width: 100%; } +.modal > h4 { font-size: 17px; margin-bottom: 10px; } +.modal > pre, +.modal > textarea { white-space: pre-wrap; overflow: auto; width: 100%; } +.modal > .right, +.modal > .button-row { + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + gap: 8px; + margin: 18px 0 0; +} +.modal > .right > *, +.modal > .button-row > * { margin: 0 !important; } +.modal > .button-row { justify-content: space-between; } +.modal > .button-row > button:first-of-type { margin-right: auto !important; } +.modal.alert-message { padding: 22px 24px 18px; } +.modal.alert-message::before { display: none; } +#modal_overlay > .modal.uci-dialog, +#modal_overlay > .modal.cbi-modal { max-width: 900px; } +#modal_overlay > .modal.login > button.important { width: 100%; font-size: 15px; margin-top: 8px; } +.modal .cbi-section-node { box-shadow: none; background: var(--cb-card-2); } +:root[data-darkmode="true"] .modal .cbi-section-node { background: #3a3a3c; } + +.uci-change-list { line-height: 1.7; white-space: pre; } +.uci-dialog div > del, +.uci-dialog div > ins, +.uci-dialog div > var { + display: block; + margin-bottom: 3px; + padding: 3px 8px; + border-radius: 6px; + background: var(--cb-fill-2); + color: var(--cb-text); + font-family: var(--cb-mono); + font-size: 12px; + font-style: normal; + text-decoration: none; + line-height: 1.5; + overflow: hidden; + text-overflow: ellipsis; + position: relative; +} +.uci-dialog div > ins { background: var(--cb-green-t); } +.uci-dialog div > del { background: var(--cb-red-t); } +.uci-dialog var > ins { background: var(--cb-green-t); text-decoration: none; } +.uci-dialog var > del { background: var(--cb-red-t); } +.uci-dialog del, .uci-dialog ins, .uci-dialog var { display: block; font-style: normal; text-decoration: none; } +.uci-change-list > var > * { overflow: hidden; text-overflow: ellipsis; } +.uci-change-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; } +.uci-change-legend-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; } +.uci-change-legend-label > ins, +.uci-change-legend-label > del, +.uci-change-legend-label > var { display: flex; width: 16px; height: 16px; margin: 0 !important; padding: 0 !important; border-radius: 4px; } +.uci-change-legend-label > * > * { flex-basis: 100%; padding: 1px; } + +#applyreboot-section { line-height: 2.4; } + diff --git a/luci-theme-carbon/styles/14-misc.css b/luci-theme-carbon/styles/14-misc.css new file mode 100644 index 000000000..491556607 --- /dev/null +++ b/luci-theme-carbon/styles/14-misc.css @@ -0,0 +1,76 @@ +/* ========================================================================== + 14. Spinner, file browser, misc LuCI pieces + ========================================================================== */ + +#view > div.spinning:first-child, +#view > .spinning:only-child { + display: table; + margin: 18vh auto; + color: var(--cb-text-2); +} +.spinning { + position: relative; + padding-left: 30px !important; +} +.spinning::before { + content: ""; + position: absolute; + top: calc(50% - 9px); + left: 6px; + width: 18px; + height: 18px; + border-radius: 50%; + border: 2px solid currentColor; + border-right-color: transparent; + opacity: .7; + animation: cb-spin .8s linear infinite; +} +@keyframes cb-spin { to { transform: rotate(360deg); } } + +.flash { animation: cb-flash .35s; } +@keyframes cb-flash { 50% { opacity: .5; } } + +#syslog, +textarea#syslog { + width: 100%; + min-height: 60vh; + padding: 14px; + border-radius: var(--cb-radius); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + border: 0; + font-size: 12px; + line-height: 1.55; +} + +.cbi-filebrowser { + min-width: 260px; + max-width: 100%; + padding: 0; + border-radius: var(--cb-radius-md); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + display: none; + flex-direction: column; + overflow: hidden; +} +.cbi-filebrowser.open { display: flex; } +.cbi-filebrowser > * { padding: 6px 10px; border-bottom: .5px solid var(--cb-sep); } +.cbi-filebrowser > ul { margin: 0; list-style: none; max-height: 300px; overflow: auto; padding: 4px; } +.cbi-filebrowser > ul > li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; border-radius: 6px; } +.cbi-filebrowser > ul > li:hover { background: var(--cb-hover); } +.cbi-filebrowser > ul > li > div:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.cbi-filebrowser > ul > li > div:last-child { flex: none; } +.cbi-filebrowser > ul > li > div:last-child > button { min-height: 24px; padding: 0 8px; font-size: 12px; } +.cbi-filebrowser .upload { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } +.cbi-filebrowser .upload > div { display: flex; flex: 1; gap: 6px; } +.cbi-filebrowser .upload > div > input { flex: 1; } +.cbi-filebrowser > div:last-child { border-bottom: 0; display: flex; justify-content: flex-end; gap: 6px; } + +#cbi-network-switch_vlan .td { text-align: center; } + +/* overview page (LuCI status widgets) */ +[data-page="admin-status-overview"] .cbi-section > h3, +[data-page="admin-status"] .cbi-section > h3, +[data-page="admin"] .cbi-section > h3 { margin-top: 4px; } + diff --git a/luci-theme-carbon/styles/15-dashboard.css b/luci-theme-carbon/styles/15-dashboard.css new file mode 100644 index 000000000..594193490 --- /dev/null +++ b/luci-theme-carbon/styles/15-dashboard.css @@ -0,0 +1,359 @@ +/* ========================================================================== + 15. Dashboard + ========================================================================== */ + +.cb-dash { + display: grid; + grid-template-columns: repeat(12, minmax(0, 1fr)); + gap: 16px; + margin: 6px 0 18px; + font-variant-numeric: tabular-nums; +} +.cb-dash .span-12 { grid-column: span 12; } +.cb-dash .span-8 { grid-column: span 8; } +.cb-dash .span-6 { grid-column: span 6; } +.cb-dash .span-4 { grid-column: span 4; } +.cb-dash .span-3 { grid-column: span 3; } + +.cb-card { + position: relative; + min-width: 0; + padding: 18px 20px; + border-radius: var(--cb-radius); + background: var(--cb-card); + box-shadow: var(--cb-shadow); + animation: cb-rise .4s var(--cb-ease); +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-card { -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); } +} +@keyframes cb-rise { from { transform: translateY(6px); } to { transform: none; } } + +.cb-card-head { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 12px; + margin: 0 0 14px; +} +.cb-card-head h3 { + margin: 0; + font-size: 15px; + font-weight: 600; +} +.cb-card-head h3 .cb-count { + margin-left: 6px; + color: var(--cb-text-2); + font-weight: 500; +} +.cb-card-note { color: var(--cb-text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +/* traffic source picker in the card head: a C.listbox, like the language switch */ +.cb-card-head .cb-traffic-select { + flex: 0 1 auto; + align-self: center; + min-width: 0; + max-width: 60%; +} +.cb-card-link { font-size: 13px; font-weight: 500; white-space: nowrap; } + +/* hero */ +.cb-hero { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 16px 28px; + padding: 20px 22px; +} +.cb-hero-id { display: flex; align-items: center; gap: 14px; min-width: 0; } +.cb-hero-icon { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 8px 16px rgba(79, 91, 234, .32)); } +.cb-hero-icon :is(svg, img) { width: 100%; height: 100%; display: block; } +.cb-hero-icon.custom { filter: none; } +.cb-hero-icon img { object-fit: contain; border-radius: 12px; } +.cb-hero-text { min-width: 0; } +.cb-hero-title { margin: 0 0 2px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; } +.cb-hero-sub { margin: 0; color: var(--cb-text-2); font-size: 13px; } +.cb-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; } +.cb-meta { display: flex; flex-direction: column; line-height: 1.3; } +.cb-meta-label { color: var(--cb-text-2); font-size: 11.5px; } +.cb-meta-val { font-size: 14px; font-weight: 600; } +.cb-meta-val.cb-ip6 { display: block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + +.cb-pill { + display: inline-flex; + align-items: center; + gap: 6px; + height: 26px; + padding: 0 11px; + border-radius: 13px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 12.5px; + font-weight: 600; + white-space: nowrap; +} +.cb-pill::before { + content: ""; + width: 7px; + height: 7px; + border-radius: 50%; + background: currentColor; +} +.cb-pill.ok { background: var(--cb-green-t); color: var(--cb-green); } +.cb-pill.ok::before { box-shadow: 0 0 0 0 currentColor; animation: cb-pulse 2s infinite; } +.cb-pill.bad { background: var(--cb-red-t); color: var(--cb-red); } +.cb-pill.off { background: var(--cb-fill); color: var(--cb-text-2); } +.cb-pill.sm { height: 22px; padding: 0 9px; font-size: 11.5px; } +@keyframes cb-pulse { + 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .55); } + 70% { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); } + 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } +} + +/* traffic */ +.cb-rates { + display: flex; + flex-wrap: wrap; + align-items: flex-end; + gap: 8px 36px; + margin: -4px 0 8px; +} +.cb-rate { display: flex; flex-direction: column; line-height: 1.15; } +.cb-rate-label { display: inline-flex; align-items: center; gap: 6px; color: var(--cb-text-2); font-size: 12.5px; font-weight: 500; } +.cb-rate-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); } +.cb-rate-val { font-size: 30px; font-weight: 700; letter-spacing: -.02em; } +.cb-rate-val small { margin-left: 4px; color: var(--cb-text-2); font-size: 14px; font-weight: 600; letter-spacing: 0; } +.cb-totals { margin-left: auto; text-align: right; color: var(--cb-text-2); font-size: 12px; line-height: 1.5; } +.cb-totals b { color: var(--cb-text); font-weight: 600; } + +.cb-chart { position: relative; height: 190px; margin: 0 -4px; touch-action: pan-y; } +.cb-area-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; } +.cb-grid-line { stroke: var(--cb-sep); stroke-width: 1; shape-rendering: crispEdges; } +.cb-grid-line.base { stroke: var(--cb-border); } +.cb-axis { fill: var(--cb-text-3); font-size: 10.5px; font-family: var(--cb-font); } +.cb-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } +.cb-dot { stroke: var(--cb-card); stroke-width: 2; } +.cb-cross { stroke: var(--cb-text-3); stroke-width: 1; stroke-dasharray: 3 3; } +.cb-chart-foot { display: flex; justify-content: space-between; margin-top: 6px; color: var(--cb-text-3); font-size: 11px; } + +.cb-tip { + position: absolute; + z-index: 5; + top: 8px; + min-width: 140px; + padding: 8px 10px; + border-radius: 10px; + background: var(--cb-popover); + box-shadow: var(--cb-shadow-pop); + font-size: 12px; + line-height: 1.6; + pointer-events: none; + opacity: 0; + transition: opacity .12s; +} +@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { + .cb-tip { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); } +} +.cb-tip.show { opacity: 1; } +.cb-tip-time { color: var(--cb-text-2); font-size: 11px; } +.cb-tip-row { display: flex; align-items: center; gap: 6px; } +.cb-tip-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); } +.cb-tip-row b { margin-left: auto; padding-left: 12px; font-weight: 600; } + +/* resources */ +.cb-rings { display: flex; justify-content: space-around; gap: 8px; margin: 2px 0 16px; } +.cb-ring { position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; min-width: 0; } +.cb-ring svg { width: 88px; height: 88px; transform: rotate(-90deg); } +.cb-ring-track { fill: none; stroke: var(--cb-fill); stroke-width: 10; } +.cb-ring-bar { + fill: none; + stroke-width: 10; + stroke-linecap: round; + transition: stroke-dashoffset .8s var(--cb-ease), stroke .3s; +} +.cb-ring-center { + position: absolute; + top: 0; + left: 0; + right: 0; + height: 88px; + display: flex; + align-items: center; + justify-content: center; +} +.cb-ring-center b { font-size: 19px; font-weight: 700; letter-spacing: -.02em; } +.cb-ring-center b small { font-size: 11px; font-weight: 600; color: var(--cb-text-2); margin-left: 1px; } +.cb-ring-label { margin-top: 6px; font-size: 12.5px; font-weight: 600; } +.cb-ring-sub { max-width: 100%; color: var(--cb-text-2); font-size: 11px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +.cb-membar-wrap { margin: 0 0 12px; } +.cb-membar-title { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; } +.cb-membar-title span { color: var(--cb-text-2); font-weight: 500; } +.cb-membar { + display: flex; + gap: 2px; + height: 10px; + border-radius: 5px; + overflow: hidden; + background: var(--cb-fill); +} +.cb-membar > i { display: block; height: 100%; background: var(--c); transition: flex-basis .8s var(--cb-ease); } +.cb-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; color: var(--cb-text-2); font-size: 11.5px; } +.cb-legend span { display: inline-flex; align-items: center; gap: 5px; } +.cb-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); } + +.cb-kv { margin: 0; padding: 0; list-style: none; } +.cb-kv li { + display: flex; + justify-content: space-between; + gap: 12px; + padding: 8px 0; + border-top: .5px solid var(--cb-sep); + font-size: 13px; +} +.cb-kv li span:first-child { color: var(--cb-text-2); } +.cb-kv li span:last-child { font-weight: 500; text-align: right; } + +/* stat tiles */ +.cb-tile { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; } +.cb-tile-head { display: flex; align-items: center; gap: 8px; color: var(--cb-text-2); font-size: 13px; font-weight: 500; } +.cb-ico { + --c: var(--cb-gray); + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + width: 32px; + height: 32px; + border-radius: 10px; + color: var(--c); + background: var(--cb-fill); + background: color-mix(in srgb, var(--c) 13%, transparent); +} +.cb-ico svg { width: 17px; height: 17px; } +.cb-tile-head .cb-ico { width: 30px; height: 30px; } +.cb-tile-val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; } +.cb-tile-val small { margin-left: 3px; color: var(--cb-text-2); font-size: 13px; font-weight: 600; letter-spacing: 0; } +.cb-tile-sub { color: var(--cb-text-2); font-size: 12px; min-height: 18px; } +.cb-tile-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; } +.cb-spark { flex: 1; max-width: 120px; height: 34px; } +.cb-spark svg { display: block; width: 100%; height: 100%; overflow: visible; } +.cb-mini-bar { height: 5px; border-radius: 3px; background: var(--cb-fill); overflow: hidden; } +.cb-mini-bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--c, var(--cb-teal)); transition: width .8s var(--cb-ease); } + +/* lists */ +.cb-list { margin: 0 -8px; padding: 0; list-style: none; } +.cb-list > li { + display: flex; + align-items: center; + gap: 12px; + padding: 9px 8px; + border-radius: 10px; +} +.cb-list > li + li { box-shadow: 0 -.5px 0 var(--cb-sep); } +.cb-list > li:hover { background: var(--cb-hover); box-shadow: none; } +.cb-list > li:hover + li { box-shadow: none; } +.cb-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; } +.cb-list-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.cb-list-sub { color: var(--cb-text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.cb-list-aside { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; color: var(--cb-text-2); font-size: 12px; } +.cb-mono { font-family: var(--cb-mono); font-size: 12px; letter-spacing: -.01em; } +.cb-empty { padding: 26px 0 18px; text-align: center; color: var(--cb-text-2); font-size: 13px; } + +.cb-avatar { + --c: var(--cb-blue); + flex: none; + display: inline-flex; + align-items: center; + justify-content: center; + width: 34px; + height: 34px; + border-radius: 50%; + background: var(--c); + color: #fff; + font-size: 14px; + font-weight: 600; + text-transform: uppercase; +} +.cb-avatar svg { width: 18px; height: 18px; } + +/* brand avatars */ +.cb-avatar.cb-avatar-brand { color: var(--f, #fff); } +.cb-avatar.cb-avatar-brand.inv { background-color: var(--cb-text); color: var(--cb-card); } +.cb-avatar .cb-logo { width: 17px; height: 17px; fill: currentColor; } +.cb-avatar b { font-size: 15px; font-weight: 700; line-height: 1; text-transform: none; } +.cb-avatar.cb-type { + background: var(--cb-fill); + background-image: none; + color: var(--cb-text-2); +} +/* the same avatar, smaller, beside hostnames in LuCI's lease tables */ +.cb-host { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; vertical-align: middle; } +.cb-host-name { min-width: 0; overflow-wrap: anywhere; } +.cb-host > .cb-avatar { width: 26px; height: 26px; font-size: 12px; } +.cb-host > .cb-avatar svg { width: 15px; height: 15px; } +.cb-host > .cb-avatar .cb-logo { width: 14px; height: 14px; } +.cb-host > .cb-avatar b { font-size: 12px; } +.cb-kind { color: var(--cb-text-2); } +.cb-kind::after { content: " · "; } +.cb-tag { + display: inline-block; + margin-right: 6px; + padding: 0 6px; + border-radius: 5px; + background: var(--cb-fill); + color: var(--cb-text-2); + font-size: 10.5px; + font-weight: 600; + line-height: 17px; + vertical-align: 1px; + cursor: help; +} + +.cb-tag-wifi { background: var(--cb-fill); background: color-mix(in srgb, var(--cb-blue) 13%, transparent); color: var(--cb-blue); cursor: default; white-space: nowrap; } +.cb-tag-wifi svg { width: 11px; height: 11px; margin-right: 3px; vertical-align: -1px; } + +.cb-subhead { margin: 18px 0 6px; color: var(--cb-text-2); font-size: 12px; font-weight: 600; } +.cb-subhead:first-of-type { margin-top: 0; } + +.cb-more { + display: block; + width: 100%; + margin: 8px 0 0; + padding: 8px; + border: 0; + border-radius: 9px; + background: var(--cb-fill-2); + color: var(--cb-accent); + font: inherit; + font-size: 13px; + font-weight: 500; + cursor: pointer; +} +.cb-more:hover { background: var(--cb-fill); } + +/* details toggle below dashboard */ +.cb-details-bar { display: flex; justify-content: center; margin: 2px 0 18px; } +.cb-details-btn { + display: inline-flex; + align-items: center; + gap: 6px; + height: 32px; + padding: 0 14px; + border: 0; + border-radius: 16px; + background: var(--cb-fill); + color: var(--cb-text); + font: inherit; + font-size: 13px; + font-weight: 500; + cursor: pointer; +} +.cb-details-btn:hover { filter: brightness(.97); } +.cb-details-btn svg { width: 14px; height: 14px; transition: transform .2s var(--cb-ease); } +.cb-show-details .cb-details-btn svg { transform: rotate(180deg); } +body.cb-has-dash:not(.cb-show-details) #view, +body.cb-has-dash:not(.cb-show-details) #maincontent > .includes { display: none; } +/* newer LuCI renders the page

outside #view; the hero card replaces it */ +body.cb-has-dash #maincontent > h2 { display: none; } + diff --git a/luci-theme-carbon/styles/16-responsive.css b/luci-theme-carbon/styles/16-responsive.css new file mode 100644 index 000000000..fb19f094d --- /dev/null +++ b/luci-theme-carbon/styles/16-responsive.css @@ -0,0 +1,224 @@ +/* ========================================================================== + 16. Responsive + ========================================================================== */ + +/* wide screens: pages that profit from width (the dashboard grid, tables) + grow in steps; plain forms keep a readable 1240px */ +@media (min-width: 1800px) { :root { --cb-content-wide: 1480px; } } +@media (min-width: 2300px) { :root { --cb-content-wide: 1720px; } } +body.cb-has-dash, +body:has(#maincontent .table) { --cb-content-max: var(--cb-content-wide); } + +/* a wide devices card lays its list out in two columns */ +.cb-clients { container-type: inline-size; } +@container (min-width: 880px) { + .cb-clients .cb-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; } + .cb-clients .cb-list > li:nth-child(2) { box-shadow: none; } + .cb-clients .cb-list > li:hover + li { box-shadow: 0 -.5px 0 var(--cb-sep); } + .cb-clients .cb-list > li:hover + li:nth-child(2) { box-shadow: none; } +} +/* columns too narrow for the MAC next to the name: keep the name readable */ +@container (min-width: 880px) and (max-width: 1099px) { + .cb-clients .cb-list .cb-hide-sm { display: none; } + .cb-clients .cb-tag-wifi .cb-tag-text { display: none; } + .cb-clients .cb-device-source { display: block; } +} + +@media (max-width: 1180px) { + .cb-dash .span-8, + .cb-dash .span-4 { grid-column: span 12; } + .cb-dash .span-3 { grid-column: span 6; } + .cb-resources .cb-res-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; } + .cb-resources .cb-rings { margin-bottom: 0; } +} + +@media (max-width: 1023px) { + .cb-sidebar { transform: translateX(calc(-100% - var(--cb-gutter) * 2)); } + body.cb-nav-open .cb-sidebar { transform: none; } + .cb-collapse { display: none; } + .cb-scrim { + display: block; + position: fixed; + z-index: 250; + inset: 0; + background: rgba(0, 0, 0, .3); + opacity: 0; + visibility: hidden; + transition: opacity .25s var(--cb-ease), visibility .25s; + } + body.cb-nav-open .cb-scrim { opacity: 1; visibility: visible; } + .cb-main { margin-left: 0; } + .cb-burger { display: inline-block; } + .cb-toolbar { padding: 8px 16px; padding-left: max(16px, env(safe-area-inset-left)); } + .cb-content { padding: 10px 16px 24px; } + .cb-footer { padding: 8px 16px 24px; } +} + +@media (max-width: 760px) { + .cb-resources .cb-res-body { display: block; } + .cb-resources .cb-rings { margin-bottom: 16px; } + .cb-dash { gap: 12px; } + .cb-card { padding: 16px; } + .cb-hero { padding: 18px 16px; } + /* hero meta becomes a tidy list: status pill on its own row, then + label/value rows — no more crowding next to the badge */ + .cb-hero-meta { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; } + .cb-hero-meta > .cb-pill { justify-self: start; margin: 0 0 12px; } + .cb-hero-meta .cb-meta { + flex-direction: row; + align-items: baseline; + justify-content: space-between; + gap: 12px; + min-width: 0; + padding: 8px 0; + border-top: .5px solid var(--cb-sep); + } + .cb-hero-meta .cb-meta-label { flex: none; white-space: nowrap; } + .cb-hero-meta .cb-meta-val { text-align: right; } + .cb-rate-val { font-size: 24px; } + .cb-chart { height: 160px; } + .cb-totals { margin-left: 0; text-align: left; flex-basis: 100%; } + .cb-ring svg { width: 74px; height: 74px; } + .cb-ring-center { height: 74px; } + .cb-ring-center b { font-size: 16px; } + .cb-tile-val { font-size: 24px; } + .cb-list .cb-hide-sm { display: none; } + /* keep device names readable: Wi‑Fi tag shrinks to its icon (details stay in the tooltip) */ + .cb-tag-wifi .cb-tag-text { display: none; } + .cb-tag-wifi svg { margin-right: 0; } + /* source/lease text gets its own line so badges cannot crowd out the name */ + .cb-clients .cb-device-source { display: block; } + .cb-clients .cb-list-aside { max-width: 55%; } + + #view > h2, .cbi-map > h2, h2[name="content"] { font-size: 24px; } + + .cbi-section-node { padding: 2px 14px; } + .cbi-value { flex-direction: column; gap: 6px; padding: 12px 0; } + .cbi-value-title, + .cbi-value label.cbi-value-title { flex: none; padding-top: 0; } + .cbi-value-field { flex: none; width: 100%; } + + /* flag values (switches) stay on one row: title left, switch right; the + optional description (rendered inside the field) drops below the row */ + .cbi-value[data-widget="CBI.FlagValue"] { flex-direction: row; align-items: center; } + .cbi-value[data-widget="CBI.FlagValue"] > .cbi-value-title { flex: 1 1 0; min-width: 0; } + .cbi-value[data-widget="CBI.FlagValue"] > .cbi-value-field { display: contents; } + .cbi-value[data-widget="CBI.FlagValue"] .cbi-value-description { flex: 1 1 100%; margin-top: 0; } + + /* package manager (luci-app-package-manager): input + button on one line */ + .controls .control-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; } + .controls .control-group > input { flex: 1 1 12em; width: auto; min-width: 0; } + .controls .control-group > .btn { flex: 0 0 auto; } + + input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"])), + textarea, + select, + .cbi-select, + .cbi-dropdown:not(.btn):not(.cbi-button), + .cbi-dynlist { width: 100%; } + + .tabs, .cbi-tabmenu { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } + .tabs::-webkit-scrollbar, .cbi-tabmenu::-webkit-scrollbar { display: none; } + .tabs > li, .cbi-tabmenu > li { flex: none; } + + .cbi-page-actions { bottom: max(8px, env(safe-area-inset-bottom)); } + + /* tables become stacked cards (uses LuCI's data-title attributes) */ + .table { display: flex; flex-direction: column; overflow: visible; } + .table .tr { + display: flex; + flex-wrap: wrap; + align-items: flex-start; + padding: 8px 4px; + border-top: .5px solid var(--cb-sep); + } + .table .tr:first-child, + .table .tr.table-titles + .tr, + .table .tr.cbi-section-table-titles + .tr { border-top: 0; } + .table .th, + .table .td, + .table .tr::before { + display: block; + flex: 1 1 50%; + min-width: 0; + padding: 4px 10px; + border-top: 0 !important; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + } + .table .td.cbi-dropdown-open { overflow: visible; } + .table .tr:hover > .td { background: transparent !important; } + .tr.table-titles, + .cbi-section-table-titles, + .cbi-section-table-descr { display: none !important; } + .tr[data-title]::before { + flex: 1 1 100%; + font-size: 15px; + font-weight: 600; + padding-bottom: 6px; + } + .td[data-title]::before { + content: attr(data-title); + display: block; + margin-bottom: 2px; + color: var(--cb-text-2); + font-size: 11.5px; + font-weight: 600; + white-space: pre-line; + } + .td.cbi-value-field { flex-basis: 100%; } + .td.cbi-value-field[data-widget="CBI.DummyValue"], + .td.cbi-value-field[data-widget="CBI.Button"], + .td.cbi-value-field[data-widget="CBI.FlagValue"], + .td.cbi-value-field[data-widget="dvalue"], + .td.cbi-value-field[data-widget="button"], + .td.cbi-value-field[data-widget="fvalue"] { flex-basis: 50%; text-align: left; } + /* data cells never share a wrapped row with button cells (e.g. Nikki's + status table: the core state is a readout, not a button) */ + .tr:has(> .td[data-widget="CBI.ButtonValue"]) > .td.cbi-value-field:not([data-widget="CBI.ButtonValue"]) { flex-basis: 100%; } + /* button cells share one row when they fit (Nikki's four actions), + and wrap gracefully when the labels are too long for the screen; + margin-left matches the field inset above so the row aligns */ + .td.cbi-value-field[data-widget="CBI.ButtonValue"] { flex: 1 0 auto; width: auto; min-width: 0; padding-left: 0; padding-right: 0; margin-left: 10px; } + .td.cbi-section-actions { flex-basis: 100%; width: auto; padding-top: 8px; } + .td.cbi-section-actions > * { justify-content: flex-start; flex-wrap: wrap; gap: 4px; } + /* tighter action buttons so short button sets fit on one row */ + .td.cbi-section-actions .btn, + .td.cbi-section-actions .cbi-button { min-height: 28px; padding: 3px 9px; font-size: 12.5px; } + /* stacked-table button cells keep the regular button size; only the + horizontal padding is trimmed so four actions fit one row */ + .td.cbi-value-field[data-widget="CBI.ButtonValue"] .cbi-button { padding-left: 8px; padding-right: 8px; } + .tr.placeholder > .td { position: static; } + .col-1 { flex: 1 1 30px !important; } + .col-2 { flex: 2 2 60px !important; } + .col-3 { flex: 3 3 90px !important; } + .col-4 { flex: 4 4 120px !important; } + .col-5 { flex: 5 5 150px !important; } + .col-6 { flex: 6 6 180px !important; } + .col-7 { flex: 7 7 210px !important; } + .col-8 { flex: 8 8 240px !important; } + .col-9 { flex: 9 9 270px !important; } + .col-10 { flex: 10 10 300px !important; } + .hide-sm, .hide-xs { display: none !important; } + + .modal { width: 94%; margin-top: 6vh; padding: 18px; } +} + +@media (max-width: 480px) { + .cb-dash .span-3 { grid-column: span 6; } + .cb-tile { padding: 14px; } + .cb-tile-val { font-size: 22px; } + .cb-spark { display: none; } + .cb-hero-title { font-size: 19px; } + .hide-xs { display: none !important; } +} + +@media (prefers-reduced-motion: reduce) { + *, *::before, *::after { + animation-duration: .01ms !important; + animation-iteration-count: 1 !important; + transition-duration: .01ms !important; + } +} + diff --git a/luci-theme-carbon/styles/17-update-page.css b/luci-theme-carbon/styles/17-update-page.css new file mode 100644 index 000000000..c3986fce6 --- /dev/null +++ b/luci-theme-carbon/styles/17-update-page.css @@ -0,0 +1,124 @@ +/* ========================================================================== + 17. Carbon theme settings page + ========================================================================== */ + +.cb-update [hidden] { display: none !important; } +.cb-update .cb-update-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; } +.cb-update .cb-update-versions { display: flex; gap: 3rem; flex-wrap: wrap; margin: 1rem 0; } +/* a form field with its button and status message on one centred line */ +.cb-update .cb-update-field { display: flex; align-items: center; gap: .5rem .75rem; flex-wrap: wrap; } +.cb-update .cb-update-field > input { flex: 0 1 22rem; min-width: 0; margin: 0; } +.cb-update .cb-update-note { color: var(--cb-text-2); font-size: 13px; overflow-wrap: anywhere; } + +/* Release notes: scoped Markdown typography, with local overflow on phones. */ +.cb-update .cb-release-notes { + max-height: 32rem; + min-width: 0; + overflow: auto; + overflow-wrap: anywhere; + line-height: 1.75; + padding: 2px 12px 2px 2px; + color: var(--cb-text); +} +.cb-release-notes > :first-child { margin-top: 0; } +.cb-release-notes > :last-child { margin-bottom: 0; } +.cb-release-notes :is(h1, h2, h3, h4, h5, h6) { line-height: 1.4; margin: 1.25em 0 .6em; font-weight: 650; } +.cb-release-notes h1 { font-size: 1.5rem; } +.cb-release-notes h2 { font-size: 1.3rem; } +.cb-release-notes h3 { font-size: 1.12rem; } +.cb-release-notes :is(h4, h5, h6) { font-size: 1rem; } +.cb-release-notes :is(p, ul, ol, blockquote, pre, table) { margin: .8em 0; } +.cb-release-notes :is(ul, ol) { padding-inline-start: 1.6em; } +.cb-release-notes ul { list-style: disc outside; } +.cb-release-notes ol { list-style: decimal outside; } +.cb-release-notes li { display: list-item; margin: .25em 0; } +.cb-release-notes li > :is(ul, ol) { margin: .25em 0; } +.cb-release-notes a { color: var(--cb-accent); text-decoration: underline; text-underline-offset: 3px; } +.cb-release-notes blockquote { border-inline-start: 3px solid var(--cb-accent); padding: .1em 1em; color: var(--cb-text-2); } +.cb-release-notes code { font-family: var(--cb-mono); font-size: .9em; background: var(--cb-fill); border-radius: 4px; padding: .15em .35em; } +.cb-release-notes pre { max-width: 100%; overflow: auto; white-space: pre; padding: 14px; background: var(--cb-fill-2); border: 1px solid var(--cb-border); border-radius: var(--cb-radius-sm); } +.cb-release-notes pre code { display: block; background: none; padding: 0; white-space: pre; overflow-wrap: normal; } +.cb-release-notes table { display: block; max-width: 100%; overflow: auto; border-collapse: collapse; } +.cb-release-notes :is(th, td) { border: 1px solid var(--cb-border-strong); padding: 8px 12px; text-align: start; } +.cb-release-notes th { background: var(--cb-fill-2); font-weight: 600; } +.cb-release-notes img { max-width: 100%; height: auto; border-radius: var(--cb-radius-sm); } +.cb-release-notes hr { border: 0; border-top: 1px solid var(--cb-border); margin: 1.25em 0; } + + +/* Logo */ +.cb-logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 12px 0 4px; } +.cb-logo-preview { + width: 72px; + height: 72px; + flex: none; + object-fit: contain; + padding: 6px; + border-radius: 18px; + background: var(--cb-fill); + border: 1px solid var(--cb-border); +} +.cb-logo-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; min-width: 0; } + +/* "?" toggletip next to a heading: hover / keyboard focus shows, click pins */ +.cb-update h3 .cb-hint { margin-inline-start: 6px; } +.cb-hint { position: relative; display: inline-flex; } +.cb-hint-btn { + display: inline-flex; + align-items: center; + justify-content: center; + width: 18px; + height: 18px; + padding: 0; + border: 0; + border-radius: 50%; + background: var(--cb-fill); + color: var(--cb-text-2); + font: inherit; + font-size: 11.5px; + font-weight: 700; + line-height: 1; + cursor: help; + transition: background-color .15s var(--cb-ease), color .15s var(--cb-ease); +} +.cb-hint-btn:hover, +.cb-hint.open .cb-hint-btn { background: var(--cb-accent-t); color: var(--cb-accent); } +.cb-hint-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--cb-focus); } +.cb-hint-bubble { + position: absolute; + z-index: 50; + top: calc(100% + 8px); + left: -12px; + width: max-content; + max-width: min(24rem, calc(100vw - 48px)); + padding: 10px 12px; + border-radius: var(--cb-radius-md); + border: 1px solid var(--cb-border); + background: var(--cb-card-solid); + box-shadow: var(--cb-shadow-pop); + color: var(--cb-text); + /* the heading is a small uppercase label: reset its text styles */ + font-size: 12.5px; + font-weight: 400; + line-height: 1.6; + letter-spacing: normal; + text-transform: none; + white-space: normal; + overflow-wrap: anywhere; + opacity: 0; + visibility: hidden; + transform: translateY(-4px); + pointer-events: none; + transition: opacity .14s var(--cb-ease), transform .14s var(--cb-ease), visibility .14s; +} +/* bridge the gap so the pointer can move from the icon into the bubble */ +.cb-hint-bubble::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; } +.cb-hint:hover .cb-hint-bubble, +.cb-hint:has(.cb-hint-btn:focus-visible) .cb-hint-bubble, +.cb-hint.open .cb-hint-bubble { opacity: 1; visibility: visible; transform: none; pointer-events: auto; } +/* narrow screens: anchor the bubble to the heading so it spans the section */ +.cb-update .cbi-section > h3 { position: relative; } +@media (max-width: 600px) { + .cb-update h3 .cb-hint { position: static; } + .cb-update h3 .cb-hint-bubble { left: 0; right: 0; width: auto; max-width: none; } +} +@media (prefers-reduced-motion: reduce) { .cb-hint-bubble { transition: none; } } diff --git a/luci-theme-carbon/styles/18-plugins.css b/luci-theme-carbon/styles/18-plugins.css new file mode 100644 index 000000000..db160df32 --- /dev/null +++ b/luci-theme-carbon/styles/18-plugins.css @@ -0,0 +1,58 @@ +/* ========================================================================== + 18. Third-party plugin adapters + One section per plugin package, scoped by body[data-page] + (admin--…, set by the theme header) so nothing leaks into + other pages. Only for markup that the generic LuCI styles cannot reach, + typically inline styles; prefer fixing the generic rule when one exists. + Plugins that theme themselves for dark mode should key on + [data-darkmode="true"] on , which Carbon sets like Argon does. + ========================================================================== */ + +/* --- luci-app-diskman: partition bar under each disk --------------------- + A bare with one colspan cell of inline-styled, inline-block segments + (fixed % widths, white-space: nowrap, padding: 0). As a flex row the + widths fit the card, and long labels ellipsize. */ +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan]:has(> div[title]) { + display: flex !important; + width: auto !important; + max-width: 100%; + padding: 2px 14px 12px !important; + overflow: hidden; + box-sizing: border-box; +} +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan] > div[title] { + box-sizing: border-box; + flex: 0 1 auto; + height: 22px; + min-width: 6px; + padding: 0 6px; + overflow: hidden; + font-size: 11.5px; + line-height: 22px; + white-space: nowrap; + text-overflow: ellipsis; + /* the segments keep their light inline colours in dark mode too */ + color: #1a1f36 !important; + border-inline-end: 1px solid rgba(255, 255, 255, .6); +} +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan] > div[title]:first-child { border-radius: 7px 0 0 7px; } +[data-page^="admin-system-diskman"] .cbi-section-table td[colspan] > div[title]:last-child { border-radius: 0 7px 7px 0; border-inline-end: 0; } +/* phones: tables become cards (16-responsive.css); the bare must follow */ +@media (max-width: 760px) { + [data-page^="admin-system-diskman"] .cbi-section-table tr:has(> td[colspan] > div[title]) { + display: block; + white-space: normal !important; + } + [data-page^="admin-system-diskman"] .cbi-section-table td[colspan]:has(> div[title]) { padding: 4px 10px 8px !important; } +} + +/* --- luci-app-ttyd: the terminal fills the window ------------------------ + The view sets an inline min-height of 500px and nothing else. */ +[data-page^="admin-services-ttyd"] #view iframe { + display: block; + height: calc(100vh - 210px); + height: calc(100dvh - 210px); + min-height: 420px; + border-radius: var(--cb-radius-md) !important; + background: #000; +} diff --git a/luci-theme-carbon/styles/19-print.css b/luci-theme-carbon/styles/19-print.css new file mode 100644 index 000000000..eae23e993 --- /dev/null +++ b/luci-theme-carbon/styles/19-print.css @@ -0,0 +1,9 @@ +/* ========================================================================== + 19. Print + ========================================================================== */ + +@media print { + .cb-sidebar, .cb-toolbar, .cb-scrim, .cbi-page-actions, .cb-footer { display: none !important; } + .cb-main { margin: 0; } + body { background: #fff; } +} diff --git a/luci-theme-carbon/tests/README.md b/luci-theme-carbon/tests/README.md new file mode 100644 index 000000000..11640a6c3 --- /dev/null +++ b/luci-theme-carbon/tests/README.md @@ -0,0 +1,38 @@ +# Tests + +| Suite | Command | Needs | +|---|---|---| +| Unit: formatting, i18n, devices, ARP, IPv6, brands (`carbon.test.js`) | `npm test` | Node 18+ | +| Unit: LuCI glue — poll pause, language list/switch, menu cache | `npm test` | Node 18+ | +| Unit: release-notes Markdown | `npm test` | Node 18+ | +| Unit: settings backend — logo upload validation (types, size, unsafe SVG) (`settings-backend.test.js`; `CARBON_TEST_SH=/bin/dash` for a strict shell) | `npm test` | Node 18+, `sh` | +| Unit: release body — one bilingual file per release, each language read through once, legacy notes (`release-notes.test.js`) | `npm test` | Node 18+, `sh` | +| Browser: preview pages, accessibility, minified build parity | `npm run test:browser` | `npm ci`, `npx playwright install chromium` | +| Installer control flow (stub apk/opkg/uci) | `npm test` | Node 18+, `sh`, `tar` | +| Installer with real apk (25.12) and opkg (24.10) | `python3 tests/installer-integration.py` | Docker, network | +| Theme templates rendered by OpenWrt's ucode | see below | Docker | +| Updater (APK and IPK) | see [online-update.md](../docs/online-update.md#maintainers) | Docker | + +The browser suite also checks every bundled catalogue in the sidebar, the custom-logo hero, the settings page layout (`tests/fixtures/settings.html`), the language listbox, and the plugin adapters (DiskMan partition bar) against copied plugin markup. It serves the repository and a minified copy locally, runs `tests/navigation.html` at 390 × 844, loads the preview in Chinese/English × light/dark × desktop/phone (screenshots go to `.cache/screenshots/`), checks the dashboard data, the language switch, keyboard/touch behaviour of the rail and drawer, and compares computed styles of the minified release build with the sources. + +Device regressions cover DHCP-disabled side routers with static or DHCP-client LAN, failed DHCP RPC calls, retained leases, gateway labels, and separate static WAN neighbours. These use the production dashboard with simulated provider responses. `CARBON_TEST_BROWSER` can point to an installed Chromium executable instead of Playwright's bundled browser. On a real router, also verify ARP reads after logging out and back in following an upgrade; an older session may lack the dashboard permissions. An IPv6-only device without a lease or local Wi-Fi association is not discoverable: this provider reads IPv4 ARP, while IPv6 addresses come from leases and host hints. + +Render the templates with the real ucode runtime: + +```bash +docker run --rm --mount "type=bind,source=$PWD,target=/source,readonly" openwrt/rootfs:x86_64-24.10.8 sh /source/tests/template-render.sh +``` + +# Navigation and menu cache regressions + +Run `node --test tests/menu-cache.test.js` from the repository root. This executes the production LuCI menu module with both menu-cache layers and checks version invalidation, retained session data, unchanged-version reuse and retry after failure. CI runs this suite before packaging. + +Serve the repository locally (for example, `python -m http.server 8080 --bind 127.0.0.1`) and open `/tests/navigation.html` at a **390 × 844** viewport. All ten checks must show `PASS`. The page loads the production theme script and stylesheet and tests route tabs, nested tabs, asynchronously inserted form tabs, hidden panes, resizing, manual scrolling and focus/vertical-scroll preservation. A desktop viewport fails the viewport check because desktop tabs wrap instead of overflowing. + +Also verify in a disposable LuCI environment: open a multi-page app with an active tab beyond the initial visible area, then navigate between nested pages. When testing a real upgrade, keep the existing login session, install the native package and reload. LuCI uses the package database modification time to invalidate JavaScript module URLs; merely copying files into an already loaded development instance does not reproduce this part of installation. + +For signed APK and native IPK updater integration tests, see [online-update.md](../docs/online-update.md#maintainers). + +## Release notes + +Run `node --test tests/markdown.test.js` to check the built-in Markdown renderer (`htdocs/luci-static/resources/carbon/markdown.js`): release-note structures, unsafe HTML/URLs, pathological input and unchanged-content polling. In LuCI, check for updates and confirm the notes render as headings, lists, links, tables and code, in both appearance modes and at 390px width. Long code/table content must scroll inside the notes; status polling must retain the reading position and text selection. diff --git a/luci-theme-carbon/tests/apk-signing.sh b/luci-theme-carbon/tests/apk-signing.sh new file mode 100644 index 000000000..5b4bc52dc --- /dev/null +++ b/luci-theme-carbon/tests/apk-signing.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Integration test with a real SDK-produced APK. Needs apk-tools 3 + openssl. +# Usage: sh tests/apk-signing.sh path/to/unsigned.apk +set -eu +[ "$#" -eq 1 ] && [ -s "$1" ] || { echo 'Pass an unsigned SDK APK' >&2; exit 1; } +repo=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd) +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT HUP INT TERM +umask 077 +mkdir "$work/keys" "$work/empty" "$work/wrong" +openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out "$work/private.pem" +openssl pkey -in "$work/private.pem" -pubout -out "$work/keys/public.pem" +openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out "$work/other.pem" +openssl pkey -in "$work/other.pem" -pubout -out "$work/wrong/public.pem" +cp "$1" "$work/package.apk" + +reject() { + if "$@"; then echo 'FAIL: expected rejection' >&2; exit 1; fi +} +verify() { + apk --keys-dir "$1" --repositories-file /dev/null --no-network verify "$2" +} + +reject verify "$work/keys" "$work/package.apk" +before=$(sha256sum "$work/package.apk") +reject sh "$repo/scripts/sign-apk.sh" "$work/private.pem" "$work/wrong/public.pem" "$work/package.apk" +[ "$before" = "$(sha256sum "$work/package.apk")" ] +reject sh "$repo/scripts/sign-apk.sh" "$work/missing.pem" "$work/keys/public.pem" "$work/package.apk" +sh "$repo/scripts/sign-apk.sh" "$work/private.pem" "$work/keys/public.pem" "$work/package.apk" +verify "$work/keys" "$work/package.apk" +reject verify "$work/empty" "$work/package.apk" +reject verify "$work/wrong" "$work/package.apk" +# Truncating the compressed payload must also be rejected with the correct key. +size=$(wc -c < "$work/package.apk") +dd if="$work/package.apk" of="$work/damaged.apk" bs=1 count="$((size / 2))" 2>/dev/null +reject verify "$work/keys" "$work/damaged.apk" +echo 'PASS: unsigned, missing/mismatched key, untrusted key and damaged payload rejected; signed package verified' diff --git a/luci-theme-carbon/tests/browser/preview.test.js b/luci-theme-carbon/tests/browser/preview.test.js new file mode 100644 index 000000000..d2df7ee60 --- /dev/null +++ b/luci-theme-carbon/tests/browser/preview.test.js @@ -0,0 +1,545 @@ +'use strict'; + +/* + * Browser tests against the static preview (no router needed): + * npm install && npx playwright install chromium && npm run test:browser + * + * - tests/navigation.html regression page at phone width + * - preview pages in zh/en × light/dark × desktop/phone: no script errors, + * screenshots written to .cache/screenshots for review + * - dashboard data (devices, Wi‑Fi, IPv6, sensors, traffic picker) + * - keyboard / touch / drawer accessibility + * - the minified release build computes the same styles as the sources + */ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const http = require('node:http'); +const { execFileSync } = require('node:child_process'); +const { chromium } = require('playwright'); + +const ROOT = path.resolve(__dirname, '..', '..'); +const SHOTS = path.join(ROOT, '.cache', 'screenshots'); +const TYPES = { '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.svg': 'image/svg+xml', '.png': 'image/png', '.json': 'application/json' }; + +let server, base, browser, minRoot; + +function serve(roots) { + return http.createServer((req, res) => { + const url = new URL(req.url, 'http://x'); + const [, mount, ...rest] = url.pathname.split('/'); + const root = roots[mount]; + const file = root && path.resolve(root, decodeURIComponent(rest.join('/'))); + if (!file || !file.startsWith(root) || !fs.existsSync(file) || fs.statSync(file).isDirectory()) { + res.writeHead(404); res.end(); return; + } + res.writeHead(200, { 'content-type': (TYPES[path.extname(file)] || 'application/octet-stream') + '; charset=utf-8' }); + fs.createReadStream(file).pipe(res); + }); +} + +test.before(async () => { + minRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'carbon-min-')); + for (const dir of ['htdocs', 'preview']) + fs.cpSync(path.join(ROOT, dir), path.join(minRoot, dir), { recursive: true }); + execFileSync(process.execPath, [path.join(ROOT, 'scripts', 'minify.mjs'), minRoot], { stdio: 'pipe' }); + server = serve({ src: ROOT, min: minRoot }); + await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); + base = 'http://127.0.0.1:' + server.address().port; + browser = await chromium.launch({ executablePath: process.env.CARBON_TEST_BROWSER || undefined }); + fs.mkdirSync(SHOTS, { recursive: true }); +}); + +test.after(async () => { + if (browser) await browser.close(); + if (server) server.close(); + if (minRoot) fs.rmSync(minRoot, { recursive: true, force: true }); +}); + +async function open(url, { width = 1280, height = 900, appearance = 'light', storage = {}, touch = false } = {}) { + const context = await browser.newContext({ viewport: { width, height }, hasTouch: touch, colorScheme: appearance === 'dark' ? 'dark' : 'light' }); + await context.addInitScript((items) => { + for (const [k, v] of Object.entries(items)) localStorage.setItem(k, v); + }, Object.assign({ 'carbon.appearance': appearance }, storage)); + const page = await context.newPage(); + const errors = []; + page.on('pageerror', (e) => errors.push(e.message)); + page.on('console', (m) => { if (m.type() === 'error') errors.push(m.text()); }); + await page.goto(base + url); + return { page, context, errors }; +} + +/* every async source has rendered: leases, Wi‑Fi stations, sensors, languages */ +const dashboardReady = (page) => page.waitForFunction(() => + document.querySelectorAll('.cb-card.span-8 .cb-list li').length >= 8 && document.querySelector('.cb-tag-wifi') && + document.querySelectorAll('.cb-kv li').length >= 3 && document.querySelector('.cb-lang .cb-lb')); + +test('side-router discovery works without DHCP and distinguishes neighbours, gateways and lease records', async () => { + const mock = fs.readFileSync(path.join(ROOT, 'preview', 'mock.js'), 'utf8'); + for (const scenario of [ + { proto: 'static', leases: 'empty', lang: 'en' }, + { proto: 'dhcp', leases: 'empty', lang: 'en' }, + { proto: 'dhcp', leases: 'unavailable', lang: 'en' }, + { proto: 'static', leases: 'retained', lang: 'en' }, + { proto: 'dhcp', leases: 'empty', lang: 'zh-Hans' } + ]) { + const context = await browser.newContext(); + const page = await context.newPage(); + const errors = []; + page.on('pageerror', (e) => errors.push(e.message)); + try { + await page.route('**/preview/mock.js', (route) => route.fulfill({ + contentType: 'text/javascript', + body: mock + '\n(' + ((s) => { + Object.assign(window.CarbonPreview.provider, { + interfaces: async () => [ + { interface: 'lan', up: true, proto: s.proto, device: 'br-lan', route: [{ target: '0.0.0.0', mask: 0, nexthop: '192.168.1.1' }] }, + { interface: 'wan', up: true, proto: 'static', device: 'eth1', route: [{ target: '0.0.0.0', mask: 0, nexthop: '10.0.0.1' }] } + ], + leases: async () => { + if (s.leases === 'unavailable') throw new Error('DHCP RPC unavailable'); + return { dhcp_leases: s.leases === 'retained' ? [ + { hostname: 'lease-only', ipaddr: '192.168.1.30', macaddr: '00:11:32:aa:bb:30', expires: 3600 } + ] : [], dhcp6_leases: [] }; + }, + wireless: async () => ({}), + hostHints: async () => ({}), + neighbors: async () => [ + 'IP address HW type Flags HW address Mask Device', + '192.168.1.1 0x1 0x2 00:11:32:aa:bb:01 * br-lan', + '192.168.1.20 0x1 0x2 00:11:32:aa:bb:20 * br-lan', + '10.0.0.1 0x1 0x2 00:11:32:aa:bb:91 * eth1', + '10.0.0.20 0x1 0x2 00:11:32:aa:bb:92 * eth1' + ].join('\n') + }); + }).toString() + ')(' + JSON.stringify(scenario) + ');' + })); + await page.goto(base + '/src/preview/index.html?lang=' + scenario.lang); + const count = scenario.leases === 'retained' ? '3' : '2'; + await page.waitForFunction((n) => document.querySelector('.cb-count')?.textContent === n, count); + const zh = scenario.lang === 'zh-Hans'; + const clients = await page.textContent('.cb-clients'); + assert.match(clients, zh ? /已发现设备/ : /Discovered devices/); + assert.match(clients, zh ? /网关/ : /Gateway/); + assert.match(clients, zh ? /邻居记录/ : /Neighbor entry/); + assert.doesNotMatch(clients, /Fixed IP|固定 IP|10\.0\.0\./); + if (scenario.leases === 'retained') assert.match(clients, /DHCP lease · 1h 0m left/); + assert.equal(await page.textContent('.cb-tile-val'), count); + assert.equal(await page.textContent('.cb-tile-sub'), zh ? '本机已知设备' : 'Known to this router'); + assert.equal(await page.getAttribute('.cb-tile-head span[title]', 'title'), zh ? '可能包含离线设备。' : 'May include offline devices.'); + assert.deepEqual(errors, []); + } finally { await context.close(); } + } +}); + +test('navigation regression page passes at phone width', async () => { + const { page, context } = await open('/src/tests/navigation.html', { width: 390, height: 844 }); + await page.waitForFunction(() => /^(PASS|FAIL)/.test(document.title)); + const results = await page.textContent('#results'); + assert.match(await page.title(), /^PASS/, results); + await context.close(); +}); + +for (const lang of ['zh-Hans', 'en']) { + for (const appearance of ['light', 'dark']) { + for (const [device, width, height] of [['desktop', 1440, 1000], ['phone', 390, 844]]) { + test(`preview ${lang} ${appearance} ${device} renders without errors`, async () => { + const { page, context, errors } = await open(`/src/preview/index.html?lang=${lang}`, { width, height, appearance }); + await dashboardReady(page); + assert.equal(await page.getAttribute('html', 'data-darkmode'), appearance === 'dark' ? 'true' : 'false'); + if (device === 'phone') { + const widths = await page.$$eval('.cb-clients .cb-list-main', (els) => els.map((e) => e.getBoundingClientRect().width)); + assert.ok(widths.every((w) => w >= 90), 'lease labels and badges leave room for device names: ' + widths); + } + await page.screenshot({ path: path.join(SHOTS, `overview-${lang}-${appearance}-${device}.png`), fullPage: true }); + assert.deepEqual(errors, []); + await context.close(); + }); + } + } +} + +test('dashboard shows merged devices, Wi-Fi details, IPv6, sensors and a traffic picker', async () => { + const { page, context } = await open('/src/preview/index.html?lang=en'); + await dashboardReady(page); + const info = await page.evaluate(() => ({ + count: document.querySelector('.cb-count').textContent, + wifiTags: document.querySelectorAll('.cb-tag-wifi').length, + nas: [...document.querySelectorAll('.cb-list-title')].some((e) => e.textContent === 'DiskStation'), + gateway: document.body.textContent.includes('100.64.0.1') && [...document.querySelectorAll('.cb-list .cb-mono')].some((e) => e.textContent === '100.64.0.1'), + ipv6: !document.querySelector('.cb-ip6').closest('.cb-meta').classList.contains('hidden') && document.querySelector('.cb-ip6').textContent, + sensors: [...document.querySelectorAll('.cb-kv li')].map((li) => li.firstChild.textContent).filter((t) => t.startsWith('Temperature')), + tile: document.querySelector('.cb-tile .cb-tile-sub').textContent + })); + assert.equal(info.count, '17'); + assert.ok(info.wifiTags >= 3, 'Wi-Fi tags among the first eight devices'); + assert.ok(info.nas, 'static-IP device from ARP named by host hints'); + assert.equal(info.gateway, false, 'upstream gateway is not a LAN device'); + assert.equal(info.ipv6, '240e:3a1:4c2:8f0::1'); + assert.deepEqual(info.sensors, ['Temperature · cpu', 'Temperature · mt7986 phy1']); + assert.match(info.tile, /^\d+ on Wi-Fi$/); + + /* the traffic picker is a Carbon listbox (same control as the language switch), grouped like */ + const picker = '.cb-card.cb-traffic .cb-lb.cb-traffic-select'; + const listed = async () => { + await page.click(picker); + await page.waitForSelector('.cb-lb-list.show'); + return page.evaluate(() => { + const ul = document.querySelector('.cb-lb-list'); + return { + options: [...ul.querySelectorAll('[role="option"]')].map((li) => li.textContent), + groups: [...ul.querySelectorAll('.cb-lb-group')].map((li) => li.textContent) + }; + }); + }; + let list = await listed(); + assert.equal(list.options.length, 10); + assert.match(list.options[0], /^Auto/); + assert.deepEqual(list.groups, ['Interfaces', 'Network devices']); + assert.ok(list.options.includes('LAN (br-lan)') || list.options.some((o) => o.endsWith('(br-lan)'))); + await page.click('.cb-lb-list li[role="option"]:has-text("(br-lan)")'); + assert.equal(await page.evaluate(() => localStorage.getItem('carbon.traffic')), 'br-lan'); + assert.match(await page.textContent(picker), /\(br-lan\)$/); + /* a physical port (e.g. an xPON uplink) is selectable and survives the next refresh */ + list = await listed(); + await page.click('.cb-lb-list li[role="option"] >> text="wan"'); + assert.equal(await page.evaluate(() => localStorage.getItem('carbon.traffic')), 'wan'); + assert.equal(await page.textContent(picker), 'wan'); + /* keyboard: Escape closes and returns focus to the trigger */ + await page.focus(picker); + await page.keyboard.press('ArrowDown'); + await page.waitForSelector('.cb-lb-list.show'); + await page.keyboard.press('Escape'); + assert.equal(await page.$('.cb-lb-list'), null); + assert.equal(await page.evaluate(() => document.activeElement.classList.contains('cb-traffic-select')), true); + /* a scroll that leaves the trigger in place (scroll anchoring while cards refresh) keeps the list open; + scrolling the page closes it */ + await page.click(picker); + await page.waitForSelector('.cb-lb-list.show'); + await page.evaluate(() => document.dispatchEvent(new Event('scroll'))); + assert.notEqual(await page.$('.cb-lb-list'), null, 'a scroll that does not move the trigger keeps the list open'); + await page.evaluate(() => window.scrollBy(0, 120)); + await page.waitForFunction(() => !document.querySelector('.cb-lb-list')); + await context.close(); +}); + +/* every bundled catalogue loads, translates the shell and fits the sidebar */ +const CATALOGUES = fs.readdirSync(path.join(ROOT, 'htdocs/luci-static/carbon/i18n')).map((f) => f.replace(/\.js$/, '')); +test('bundled catalogues translate the shell and fit the sidebar', async () => { + assert.ok(CATALOGUES.length >= 12, CATALOGUES.join(',')); + for (const code of CATALOGUES) { + const lang = { 'zh-cn': 'zh-Hans', 'zh-tw': 'zh-Hant', 'pt-br': 'pt-BR' }[code] || code; + const { page, context, errors } = await open(`/src/preview/index.html?lang=${lang}`, { width: 1280 }); + await dashboardReady(page); + const r = await page.evaluate(() => ({ + loaded: Object.keys(window.Carbon.I18N || {}).length, + common: document.querySelector('.cb-nav-sect').textContent, + expected: window.Carbon.I18N.Common, + /* segmented labels must not overflow their buttons */ + clipped: [...document.querySelectorAll('.cb-mode .cb-seg-btn, .cb-lang .cb-seg-btn')].filter((b) => b.scrollWidth > b.clientWidth + 1).map((b) => b.textContent), + navClipped: [...document.querySelectorAll('.cb-nav-label')].filter((l) => l.scrollWidth > l.clientWidth + 1 && getComputedStyle(l).textOverflow !== 'ellipsis').map((l) => l.textContent) + })); + assert.ok(r.loaded > 150, `${code}: catalogue loaded`); + assert.equal(r.common, r.expected, `${code}: sidebar section translated`); + assert.deepEqual(r.clipped, [], `${code}: segmented labels fit`); + assert.deepEqual(r.navClipped, [], `${code}: menu labels fit or ellipsize`); + assert.deepEqual(errors, [], code); + if (code === 'de' || code === 'ja') + await page.screenshot({ path: path.join(SHOTS, `overview-${code}-light-desktop.png`), fullPage: true }); + await context.close(); + } +}); + +test('a custom logo replaces the sidebar logo and the dashboard hero icon', async () => { + /* the theme header marks an uploaded logo with data-custom */ + const ctx2 = await browser.newContext({ viewport: { width: 1280, height: 900 } }); + await ctx2.route('**/preview/index.html*', async (route) => { + const res = await route.fetch(); + const body = (await res.text()).replace('', + ''); + await route.fulfill({ response: res, body }); + }); + const p2 = await ctx2.newPage(); + await p2.goto(base + '/src/preview/index.html?lang=en'); + await dashboardReady(p2); + const hero = await p2.evaluate(() => { + const img = document.querySelector('.cb-hero-icon.custom img'); + const brand = document.querySelector('.cb-brand-logo'); + return { src: img && img.getAttribute('src'), fit: getComputedStyle(brand).objectFit, shadow: getComputedStyle(brand).boxShadow }; + }); + assert.equal(hero.src, '../htdocs/luci-static/carbon/logo.svg?v=1'); + assert.equal(hero.fit, 'contain'); + assert.equal(hero.shadow, 'none'); + await ctx2.close(); +}); + +/* plugin adapters (styles/18-plugins.css) against markup copied from luci-app-diskman */ +const DISKMAN_FIXTURE = ` + +
+ +
/dev/sda2.38 GB
+
sda1 fat16 128.00 MB
sda2 squashfs 256.00 MB
sda3 ext4 2.00 GB
+
`; + +test('DiskMan partition bar stays inside its card on desktop and phone', async () => { + for (const width of [1280, 390]) { + const context = await browser.newContext({ viewport: { width, height: 800 } }); + const page = await context.newPage(); + await page.goto(base + '/src/preview/form.html'); + await page.setContent(DISKMAN_FIXTURE, { waitUntil: 'load' }); + const r = await page.evaluate(() => { + const td = document.querySelector('td[colspan]'); + const segs = [...td.children].map((d) => d.getBoundingClientRect()); + return { + pageScroll: document.documentElement.scrollWidth - document.documentElement.clientWidth, + inside: segs.every((b) => b.right <= td.getBoundingClientRect().right + 1), + clipped: [...td.children].every((d) => getComputedStyle(d).textOverflow === 'ellipsis') + }; + }); + assert.equal(r.pageScroll, 0, `${width}px: no sideways scroll`); + assert.ok(r.inside, `${width}px: segments fit the row`); + assert.ok(r.clipped, `${width}px: long labels ellipsize`); + await context.close(); + } +}); + +test('settings page: buttons, links, fields and status text share one centre line', async () => { + for (const width of [1200, 390]) { + const { page, context, errors } = await open('/src/tests/fixtures/settings.html', { width }); + await page.waitForSelector('body[data-ready]'); + /* a status message next to the mirror field, as after saving */ + await page.evaluate(() => { document.querySelector('.cb-update-field .cb-update-note').textContent = '已保存。'; }); + const rows = await page.evaluate(() => [...document.querySelectorAll('.cb-update-actions, .cb-logo-actions, .cb-update-field')].map((row) => { + const kids = [...row.children].filter((c) => c.offsetParent && c.getBoundingClientRect().width); + /* compare items on the same line only (rows may wrap on phones) */ + const lines = {}; + kids.forEach((c) => { + const r = c.getBoundingClientRect(), mid = r.top + r.height / 2; + const key = Object.keys(lines).find((k) => Math.abs(k - mid) < 12) || mid; + (lines[key] = lines[key] || []).push(mid); + }); + return { row: row.className, spread: Math.max(...Object.values(lines).map((m) => Math.max(...m) - Math.min(...m))) }; + })); + assert.equal(rows.length, 3, JSON.stringify(rows)); + const stray = await page.evaluate(() => [...document.querySelectorAll('#view *')].flatMap((el) => [...el.childNodes]) + .filter((n) => n.nodeType === 3 && /^(null|undefined)$/.test(n.textContent.trim())).length); + assert.equal(stray, 0, 'no "null" / "undefined" text from absent children'); + /* release notes from the built-in renderer: structure, safe links, local scrolling */ + const notes = await page.evaluate(() => { + const box = document.querySelector('.cb-release-notes'); + return { + tags: ['h2', 'h3', 'ul', 'li', 'strong', 'table', 'pre', 'code'].filter((t) => box.querySelector(t)), + links: [...box.querySelectorAll('a')].every((a) => a.target === '_blank' && a.rel === 'noopener noreferrer'), + fits: box.scrollWidth <= box.clientWidth + 1 || getComputedStyle(box).overflowX !== 'visible' + }; + }); + assert.deepEqual(notes.tags, ['h2', 'h3', 'ul', 'li', 'strong', 'table', 'pre', 'code']); + assert.ok(notes.links && notes.fits); + if (width === 1200) await page.screenshot({ path: path.join(SHOTS, 'settings-release-notes.png'), fullPage: true }); + rows.forEach((r) => assert.ok(r.spread <= 0.5, `${width}px ${r.row}: ${r.spread}px off centre`)); + assert.deepEqual(errors, []); + await context.close(); + } +}); + +test('settings page: the mirror explanation lives in a ? toggletip', async () => { + for (const width of [1200, 390]) { + const { page, context, errors } = await open('/src/tests/fixtures/settings.html', { width, height: 900 }); + await page.waitForSelector('body[data-ready]'); + const section = page.locator('section.cbi-section', { has: page.locator('#carbon-mirror') }); + assert.equal(await section.locator('.cbi-section-descr').count(), 0, 'no long paragraph on the page'); + const btn = section.locator('h3 .cb-hint-btn'), bubble = section.locator('.cb-hint-bubble'); + const shown = () => bubble.evaluate((b) => getComputedStyle(b).visibility === 'visible'); + assert.equal(await btn.getAttribute('aria-describedby'), await bubble.getAttribute('id')); + assert.match(await bubble.textContent(), /HTTPS/); + assert.equal(await shown(), false, 'hidden by default'); + await btn.hover(); + await page.waitForTimeout(200); + assert.equal(await shown(), true, 'hover shows it'); + await page.mouse.move(5, 5); + await page.waitForTimeout(200); + assert.equal(await shown(), false, 'leaving hides it'); + await btn.click(); + await page.mouse.move(5, 5); + await page.waitForTimeout(200); + assert.equal(await shown(), true, 'a click pins it'); + assert.equal(await btn.getAttribute('aria-expanded'), 'true'); + const box = await bubble.boundingBox(); + assert.ok(box.x >= 0 && box.x + box.width <= width, `${width}px: bubble inside the window`); + await page.mouse.click(5, 5); + await page.waitForTimeout(200); + assert.equal(await shown(), false, 'a click elsewhere closes it'); + await btn.click(); + await page.keyboard.press('Escape'); + await page.waitForTimeout(200); + assert.equal(await btn.getAttribute('aria-expanded'), 'false', 'Esc closes it'); + await page.keyboard.press('Tab'); + await page.keyboard.press('Shift+Tab'); + await page.waitForTimeout(200); + assert.equal(await shown(), true, 'keyboard focus shows it'); + if (width === 1200) { + await page.mouse.move(5, 5); + await btn.hover(); + await page.waitForTimeout(200); + await section.screenshot({ path: path.join(SHOTS, 'settings-mirror-hint.png') }); + } + assert.deepEqual(errors, []); + await context.close(); + } +}); + +test('language switch is a Carbon listbox with every bundled language', async () => { + const { page, context } = await open('/src/preview/index.html?lang=en'); + await page.waitForSelector('.cb-lang .cb-lb'); + assert.equal(await page.$('.cb-lang select'), null, 'no native select'); + assert.equal(await page.textContent('.cb-lang .cb-lb'), 'English'); + await page.click('.cb-lang .cb-lb'); + const list = await page.evaluate(() => { + const ul = document.querySelector('.cb-lb-list'); + const r = ul.getBoundingClientRect(), t = document.querySelector('.cb-lang .cb-lb').getBoundingClientRect(); + return { + labels: [...ul.children].map((li) => li.textContent), + selected: [...ul.querySelectorAll('[aria-selected="true"]')].map((li) => li.textContent), + expanded: document.querySelector('.cb-lang .cb-lb').getAttribute('aria-expanded'), + focus: document.activeElement === ul, + opensUp: r.bottom <= t.top, inView: r.top >= 0 && r.bottom <= innerHeight, + bg: getComputedStyle(ul).backgroundColor + }; + }); + assert.deepEqual(list.labels, ['Auto', 'English', 'Deutsch', 'Español', 'Français', 'Italiano', '日本語', '한국어', + 'Português do Brasil', 'Русский', 'Türkçe', 'Tiếng Việt', '简体中文', '繁體中文']); + assert.deepEqual(list.selected, ['English']); + assert.equal(list.expanded, 'true'); + assert.ok(list.focus, 'the list takes focus'); + assert.ok(list.opensUp && list.inView, 'opens above the footer trigger, inside the window'); + await Promise.all([page.waitForURL(/lang=zh-Hant/), page.click('.cb-lb-list li:has-text("繁體中文")')]); + await page.waitForSelector('.cb-dash'); + assert.equal(await page.textContent('.cb-card.cb-traffic h3'), await page.evaluate(() => window.Carbon.I18N['Live Traffic'])); + assert.equal(await page.textContent('.cb-lang .cb-lb'), '繁體中文'); + await context.close(); +}); + +test('language listbox: keyboard, type-ahead and dismissal', async () => { + const { page, context } = await open('/src/preview/index.html?lang=en'); + await page.waitForSelector('.cb-lang .cb-lb'); + await page.focus('.cb-lang .cb-lb'); + await page.keyboard.press('ArrowDown'); + const activeText = () => page.evaluate(() => document.querySelector('.cb-lb-list li.active').textContent); + assert.equal(await activeText(), 'English', 'opens on the current language'); + assert.equal(await page.evaluate(() => document.querySelector('.cb-lb-list').getAttribute('aria-activedescendant') === document.querySelector('.cb-lb-list li.active').id), true); + await page.keyboard.press('End'); + assert.equal(await activeText(), '繁體中文'); + await page.waitForTimeout(150); + assert.notEqual(await page.$('.cb-lb-list'), null, 'scrolling inside the list keeps it open'); + await page.keyboard.press('Home'); + assert.equal(await activeText(), 'Auto'); + await page.keyboard.type('fr'); + assert.equal(await activeText(), 'Français', 'type-ahead'); + await page.keyboard.press('Escape'); + assert.equal(await page.$('.cb-lb-list'), null, 'Escape closes'); + assert.equal(await page.evaluate(() => document.activeElement.classList.contains('cb-lb')), true, 'focus returns to the trigger'); + assert.equal(new URL(page.url()).searchParams.get('lang'), 'en', 'nothing chosen yet'); + await page.click('.cb-lang .cb-lb'); + await page.mouse.click(700, 400); + assert.equal(await page.$('.cb-lb-list'), null, 'an outside click closes'); + await page.focus('.cb-lang .cb-lb'); + await page.keyboard.press('Enter'); + await page.keyboard.press('ArrowDown'); + await Promise.all([page.waitForURL(/lang=de/), page.keyboard.press('Enter')]); + await context.close(); +}); + +test('language listbox opens beside the collapsed rail and returns focus to it', async () => { + const { page, context } = await open('/src/preview/index.html?lang=en', { storage: { 'carbon.collapsed': '1' } }); + await page.waitForSelector('.cb-lang-mini'); + await page.click('.cb-lang-mini'); + const r = await page.evaluate(() => { + const ul = document.querySelector('.cb-lb-list').getBoundingClientRect(); + return { left: ul.left, rail: document.getElementById('cb-sidebar').getBoundingClientRect().right, bottom: ul.bottom, h: innerHeight }; + }); + assert.ok(r.left >= r.rail, 'beside the rail'); + assert.ok(r.bottom <= r.h, 'inside the window'); + await page.keyboard.press('Escape'); + assert.equal(await page.evaluate(() => document.activeElement.classList.contains('cb-lang-mini')), true); + await page.click('.cb-lang-mini'); + await page.click('.cb-lang-mini'); + assert.equal(await page.$('.cb-lb-list'), null, 'the rail button toggles'); + await context.close(); +}); + +test('segmented controls follow the radio pattern', async () => { + const { page, context } = await open('/src/preview/index.html?lang=en'); + await page.waitForSelector('#cb-appearance .cb-seg-btn'); + await page.focus('#cb-appearance .cb-seg-btn[aria-checked="true"]'); + await page.keyboard.press('ArrowRight'); // auto | light | dark: light → dark + assert.equal(await page.getAttribute('html', 'data-appearance'), 'dark'); + assert.deepEqual(await page.$$eval('#cb-appearance .cb-seg-btn', (b) => b.map((x) => x.tabIndex)), [-1, -1, 0]); + assert.equal(await page.evaluate(() => document.activeElement.getAttribute('aria-checked')), 'true'); + await context.close(); +}); + +test('collapsed rail: keyboard opens and leaves the sub-menu, touch taps toggle it', async () => { + const storage = { 'carbon.collapsed': '1', 'carbon.mode': 'pro' }; + let { page, context } = await open('/src/preview/index.html?lang=en', { storage }); + await page.waitForSelector('.cb-nav-head'); + await page.focus('.cb-nav-head'); + await page.keyboard.press('Enter'); + assert.equal(await page.evaluate(() => document.activeElement.closest('.cb-fly') !== null), true, 'focus moved into the flyout'); + await page.keyboard.press('Escape'); + assert.equal(await page.evaluate(() => document.activeElement.classList.contains('cb-nav-head')), true); + assert.equal(await page.$eval('.cb-fly', (f) => f.classList.contains('show')), false); + await context.close(); + + ({ page, context } = await open('/src/preview/index.html?lang=en', { storage, touch: true })); + await page.waitForSelector('.cb-nav-head'); + const before = page.url(); + await page.tap('.cb-nav-head'); + assert.equal(await page.$eval('.cb-fly', (f) => f.classList.contains('show')), true, 'tap shows the sub-menu'); + assert.equal(page.url(), before, 'tap does not navigate'); + await page.tap('.cb-hero'); + assert.equal(await page.$eval('.cb-fly', (f) => f.classList.contains('show')), false, 'tapping elsewhere closes it'); + await context.close(); +}); + +test('phone drawer traps the page behind it and restores focus', async () => { + const { page, context } = await open('/src/preview/index.html?lang=en', { width: 390, height: 844 }); + await page.waitForSelector('.cb-nav a'); + assert.equal(await page.$eval('#cb-sidebar', (e) => e.hasAttribute('inert')), true); + await page.click('#cb-burger'); + assert.equal(await page.getAttribute('#cb-burger', 'aria-expanded'), 'true'); + assert.equal(await page.$eval('.cb-main', (e) => e.hasAttribute('inert')), true); + assert.equal(await page.evaluate(() => document.activeElement.closest('#cb-sidebar') !== null), true); + await page.keyboard.press('Escape'); + assert.equal(await page.evaluate(() => document.activeElement.id), 'cb-burger'); + assert.equal(await page.$eval('.cb-main', (e) => e.hasAttribute('inert')), false); + await context.close(); +}); + +async function styleSnapshot(url, width) { + const { page, context, errors } = await open(url, { width, height: 900 }); + if (url.includes('index.html')) await dashboardReady(page); + else await page.waitForSelector('.cb-login-card'); + await page.waitForTimeout(300); + const props = ['display', 'position', 'color', 'background-color', 'background-image', 'font-size', 'font-weight', 'line-height', + 'padding-top', 'padding-left', 'margin-top', 'margin-left', 'border-top-width', 'border-top-color', 'border-top-left-radius', + 'gap', 'opacity', 'visibility', 'box-shadow', 'backdrop-filter', 'grid-template-columns', 'flex-direction', 'transform', 'text-decoration-line']; + const snapshot = await page.evaluate((list) => [...document.querySelectorAll('body *:not(svg *)')] + .filter((el) => !el.closest('.cb-chart, .cb-spark, .cb-ring')) + .map((el) => { const cs = getComputedStyle(el); return el.tagName + '.' + el.className + ' ' + list.map((p) => cs.getPropertyValue(p)).join('|'); }), props); + await context.close(); + return { snapshot, errors }; +} + +for (const [name, url, width] of [['overview', 'preview/index.html?lang=en', 1440], ['overview phone', 'preview/index.html?lang=en', 390], ['login', 'preview/login.html?lang=en', 1280]]) { + test(`minified build computes the same styles: ${name}`, async () => { + const src = await styleSnapshot('/src/' + url, width); + const min = await styleSnapshot('/min/' + url, width); + assert.deepEqual(min.errors, []); + assert.equal(min.snapshot.length, src.snapshot.length); + const diff = src.snapshot.map((line, i) => line === min.snapshot[i] ? null : line + '\n ≠ ' + min.snapshot[i]).filter(Boolean); + assert.deepEqual(diff.slice(0, 5), []); + }); +} diff --git a/luci-theme-carbon/tests/carbon.test.js b/luci-theme-carbon/tests/carbon.test.js new file mode 100644 index 000000000..5553b32c5 --- /dev/null +++ b/luci-theme-carbon/tests/carbon.test.js @@ -0,0 +1,285 @@ +'use strict'; + +// Unit tests for the DOM-independent parts of carbon.js: formatting, i18n, +// version detection, device merging, ARP parsing and IPv6 uplink detection. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const vm = require('node:vm'); + +const source = fs.readFileSync('htdocs/luci-static/carbon/carbon.js', 'utf8'); +const brands = fs.readFileSync('htdocs/luci-static/carbon/brands.js', 'utf8'); + +function load({ lang = 'en', src = '/luci-static/carbon/carbon.js?v=1.2.3-r4', catalogue = null, luciTr = null } = {}) { + const classes = new Set(); + const element = () => ({ + setAttribute() {}, getAttribute: () => null, classList: { toggle() {}, contains: () => false, add() {}, remove() {} }, + addEventListener() {}, appendChild() {}, style: { setProperty() {} } + }); + const window = { + localStorage: { getItem: () => null, setItem() {} }, + matchMedia: () => ({ matches: false, addEventListener() {} }), + addEventListener() {}, + atob: (b64) => Buffer.from(b64, 'base64').toString('latin1'), + Carbon: catalogue ? { I18N: catalogue } : undefined + }; + if (luciTr) window._ = luciTr; + const document = { + currentScript: { src }, + documentElement: { + getAttribute: (name) => name === 'lang' ? lang : null, + setAttribute() {}, + classList: { toggle: (c, on) => (on ? classes.add(c) : classes.delete(c)), contains: (c) => classes.has(c) } + }, + querySelector: () => null, + getElementById: () => null, + createElement: element, + addEventListener() {} + }; + const context = { window, document, navigator: { language: lang }, Intl, Map, WeakSet, setTimeout, clearTimeout, console }; + vm.runInNewContext(source, context); + return window.Carbon; +} + +test('version comes from the ?v= parameter the theme header adds', () => { + assert.equal(load().version, '1.2.3-r4'); + assert.equal(load({ src: '/luci-static/carbon/carbon.js' }).version, 'dev'); + assert.equal(load({ src: '/x/carbon.js?v= + + + + +
+ + + diff --git a/luci-theme-carbon/tests/installer-integration.py b/luci-theme-carbon/tests/installer-integration.py new file mode 100644 index 000000000..06dc7801f --- /dev/null +++ b/luci-theme-carbon/tests/installer-integration.py @@ -0,0 +1,153 @@ +"""carbon-install.sh against the real apk (OpenWrt 25.12) and opkg (24.10) managers. + +Usage: python3 tests/installer-integration.py (requires Docker and network access) +Fixture packages are disposable: the APK is signed with a throwaway test key, the +IPK only carries marker files. Dependencies come from the official feeds. +""" +import io +from pathlib import Path +import shutil +import subprocess +import tarfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] +FIXTURES = ROOT / '.cache' / 'update-tests' +OUT = ROOT / '.cache' / 'installer-tests' +ALPINE = 'alpine:3.23@sha256:469c9ea410b9215eaee7976ba6c0639039b444be8e5d638f7abbada189971eb2' +APK_IMAGE = 'openwrt/rootfs:x86_64-25.12.6@sha256:14401c04218c2e0da0448f099710ada2460636a92395f353351cc616cf3f67af' +OPKG_IMAGE = 'openwrt/rootfs:x86_64-24.10.8@sha256:9972a4b4747cd136abd597475d7b88c51a49fd849d0d53f069a2f4bf446061b9' +DEPS = "CARBON_DEPS='curl ca-bundle flock'" # luci-base is not needed by the fixtures +PREPARE = ('mkdir -p /usr/share/ucode/luci/template /var/lock && touch /usr/share/ucode/luci/template/header.ut /etc/config/luci && ' + 'uci set luci.main=core && uci set luci.themes=internal && uci commit luci') + + +def docker(*args, check=True): + r = subprocess.run(['docker', *args], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=300) + out = r.stdout.decode() + if check and r.returncode: + raise AssertionError(f'docker {" ".join(args[:3])}… exited {r.returncode}:\n{out}') + return r.returncode, out + + +def archive(files): + # Like ipkg-build: parent directory entries first, then the files. + out = io.BytesIO() + with tarfile.open(fileobj=out, mode='w:gz') as tar: + dirs = sorted({'/'.join(name.split('/')[:i]) for name in files for i in range(1, name.count('/') + 1)}) + for d in dirs: + entry = tarfile.TarInfo('./' + d) + entry.type, entry.mode = tarfile.DIRTYPE, 0o755 + tar.addfile(entry) + for name, content in files.items(): + content = content.encode() if isinstance(content, str) else content + entry = tarfile.TarInfo('./' + name) + entry.size, entry.mode = len(content), 0o644 + tar.addfile(entry, io.BytesIO(content)) + return out.getvalue() + + +def fixture_ipk(path): + control = archive({'control': 'Package: luci-theme-carbon\nVersion: 1.1.0-r1\nDepends: curl, ca-bundle, flock\n' + 'Architecture: all\nDescription: installer test fixture\n'}) + data = archive({'www/luci-static/carbon/marker': 'ipk\n', 'usr/share/carbon/version': '1.1.0-r1\n'}) + path.write_bytes(archive({'debian-binary': '2.0\n', 'control.tar.gz': control, 'data.tar.gz': data})) + + +def build(name, *args): + subprocess.run(['sh', str(ROOT / 'scripts' / 'build-installer.sh'), str(OUT / name), *map(str, args)], + check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + return f'/source/.cache/installer-tests/{name}/carbon-install.sh' + + +class Router: + def __init__(self, image): + self.id = docker('run', '-d', '--mount', f'type=bind,source={ROOT},target=/source,readonly', image, 'sleep', '900')[1].strip() + self.sh(PREPARE) + + def sh(self, command, check=True): + return docker('exec', self.id, 'sh', '-c', command, check=check) + + def close(self): + docker('rm', '-f', self.id, check=False) + + +class InstallerTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + FIXTURES.mkdir(parents=True, exist_ok=True) + docker('run', '--rm', '--mount', f'type=bind,source={ROOT},target=/source,readonly', + '--mount', f'type=bind,source={FIXTURES},target=/fixtures', ALPINE, + 'sh', '-c', 'apk add --no-cache openssl >/dev/null && sh /source/tests/make-update-fixtures.sh') + shutil.rmtree(OUT, ignore_errors=True) + OUT.mkdir(parents=True) + fixture_ipk(OUT / 'fixture.ipk') + key = FIXTURES / 'keys' / 'carbon-apk.pem' + cls.good = build('good', '--ipk', OUT / 'fixture.ipk', '--apk', FIXTURES / 'luci-theme-carbon-1.1.0-r1.apk', '--key', key) + (OUT / 'bad').mkdir() + shutil.copy(FIXTURES / 'wrong.apk', OUT / 'bad' / 'luci-theme-carbon-1.1.0-r1.apk') + cls.wrong = build('wrong', '--ipk', OUT / 'fixture.ipk', '--apk', OUT / 'bad' / 'luci-theme-carbon-1.1.0-r1.apk', '--key', key) + cls.key = key.read_text() + + def router(self, image): + r = Router(image) + self.addCleanup(r.close) + return r + + def test_apk_native_install_trust_key_and_uninstall(self): + r = self.router(APK_IMAGE) + code, out = r.sh(f'{DEPS} sh {self.good}', check=False) + self.assertEqual(code, 0, out) + self.assertIn('installed with apk', out) + self.assertIn('luci-theme-carbon-1.1.0-r1', r.sh('apk list --installed luci-theme-carbon')[1]) + self.assertEqual(r.sh('test -e /etc/apk/keys/carbon-apk.pem', check=False)[0], 1, 'system trust unchanged') + self.assertEqual(r.sh('uci get luci.main.mediaurlbase')[1].strip(), '/luci-static/carbon') + # signature checks stay enabled for everything else + self.assertEqual(r.sh('apk verify /source/.cache/update-tests/luci-theme-carbon-1.1.0-r1.apk', check=False)[0] != 0, True) + + code, out = r.sh(f'{DEPS} sh {self.good} --trust-key', check=False) + self.assertEqual(code, 0, out) + self.assertEqual(r.sh('cat /etc/apk/keys/carbon-apk.pem')[1], self.key) + + code, out = r.sh(f'sh {self.good} uninstall', check=False) + self.assertEqual(code, 0, out) + self.assertEqual(r.sh('apk list --installed luci-theme-carbon')[1].strip(), '') + + def test_apk_wrong_signature_installs_nothing(self): + r = self.router(APK_IMAGE) + code, out = r.sh(f'{DEPS} sh {self.wrong}', check=False) + self.assertNotEqual(code, 0, out) + self.assertIn('signature verification failed', out) + self.assertEqual(r.sh('apk list --installed luci-theme-carbon')[1].strip(), '') + self.assertEqual(r.sh('test -e /www/luci-static/carbon', check=False)[0], 1) + + def test_apk_script_only_install_is_migrated(self): + r = self.router(APK_IMAGE) + self.assertEqual(r.sh(f'sh {self.good} --files', check=False)[0], 0) + self.assertEqual(r.sh('cat /www/luci-static/carbon/marker')[1], 'ipk\n') + self.assertEqual(r.sh('apk list --installed luci-theme-carbon')[1].strip(), '') + code, out = r.sh(f'{DEPS} sh {self.good}', check=False) + self.assertEqual(code, 0, out) + self.assertIn('luci-theme-carbon-1.1.0-r1', r.sh('apk list --installed luci-theme-carbon')[1]) + + def test_opkg_native_install_and_uninstall(self): + r = self.router(OPKG_IMAGE) + self.assertEqual(r.sh(f'sh {self.good} --files', check=False)[0], 0) + code, out = r.sh(f'{DEPS} sh {self.good}', check=False) + self.assertEqual(code, 0, out) + self.assertIn('installed with opkg', out) + status = r.sh('opkg status luci-theme-carbon')[1] + self.assertIn('Version: 1.1.0-r1', status) + self.assertRegex(status, r'Status: .* installed') + owned = r.sh('opkg files luci-theme-carbon')[1] + self.assertIn('/www/luci-static/carbon/marker', owned) + self.assertEqual(r.sh('cat /www/luci-static/carbon/marker', check=False)[1], 'ipk\n', owned) + + code, out = r.sh(f'sh {self.good} uninstall', check=False) + self.assertEqual(code, 0, out) + self.assertNotIn('Version:', r.sh('opkg status luci-theme-carbon', check=False)[1]) + self.assertEqual(r.sh('test -e /www/luci-static/carbon/marker', check=False)[0], 1) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/luci-theme-carbon/tests/installer-stubs/apk b/luci-theme-carbon/tests/installer-stubs/apk new file mode 100755 index 000000000..6e3ee4e0d --- /dev/null +++ b/luci-theme-carbon/tests/installer-stubs/apk @@ -0,0 +1,23 @@ +#!/bin/sh +echo "apk $*" >> "$STATE/log" +args=''; skip=0 +for a in "$@"; do + if [ "$skip" = 1 ]; then skip=0; continue; fi + case "$a" in --keys-dir|--repositories-file) skip=1 ;; -*) ;; *) args="$args $a" ;; esac +done +set -- $args +cmd=$1; shift +case "$cmd" in + verify) exit "${APK_VERIFY_RC:-0}" ;; + list) [ -f "$STATE/pkgs/$1" ] && echo "$1-$(cat "$STATE/pkgs/$1") noarch {$1} (MIT) [installed]"; exit 0 ;; + version) if [ "$1" = "$2" ]; then echo '='; elif [ "$(printf '%s\n%s\n' "$1" "$2" | sort -V | head -n 1)" = "$1" ]; then echo '<'; else echo '>'; fi ;; + update) exit 0 ;; + add) + for a in "$@"; do + case "$a" in + *.apk) [ "${APK_ADD_RC:-0}" = 0 ] || exit 1; cat "$(dirname "$a")/apk.version" > "$STATE/pkgs/luci-theme-carbon" ;; + *) [ -z "$DEPS_FAIL" ] || exit 1; echo 1.0-r1 > "$STATE/pkgs/$a" ;; + esac + done ;; + del) rm -f "$STATE/pkgs/$1" ;; +esac diff --git a/luci-theme-carbon/tests/installer-stubs/opkg b/luci-theme-carbon/tests/installer-stubs/opkg new file mode 100755 index 000000000..970c5042f --- /dev/null +++ b/luci-theme-carbon/tests/installer-stubs/opkg @@ -0,0 +1,19 @@ +#!/bin/sh +echo "opkg $*" >> "$STATE/log" +cmd=$1; shift +case "$cmd" in + status) [ -f "$STATE/pkgs/$1" ] && printf 'Package: %s\nVersion: %s\nStatus: install user installed\n' "$1" "$(cat "$STATE/pkgs/$1")"; exit 0 ;; + compare-versions) + if [ "$1" = "$3" ]; then r='='; elif [ "$(printf '%s\n%s\n' "$1" "$3" | sort -V | head -n 1)" = "$1" ]; then r='<'; else r='>'; fi + case "$2" in '<<') [ "$r" = '<' ] ;; '=') [ "$r" = '=' ] ;; *) exit 2 ;; esac ;; + update) exit 0 ;; + install) + for a in "$@"; do + case "$a" in + --*) ;; + *.ipk) cat "$(dirname "$a")/opkg.version" > "$STATE/pkgs/luci-theme-carbon" ;; + *) [ -z "$DEPS_FAIL" ] || exit 1; echo 1.0-1 > "$STATE/pkgs/$a" ;; + esac + done ;; + remove) rm -f "$STATE/pkgs/$1" ;; +esac diff --git a/luci-theme-carbon/tests/installer-stubs/uci b/luci-theme-carbon/tests/installer-stubs/uci new file mode 100755 index 000000000..e4b0d1313 --- /dev/null +++ b/luci-theme-carbon/tests/installer-stubs/uci @@ -0,0 +1,8 @@ +#!/bin/sh +echo "uci $*" >> "$STATE/log" +[ "$1" = -q ] && shift +case "$1" in + get) [ "$2" = luci.main.mediaurlbase ] && cat "$STATE/theme" 2>/dev/null ;; + set) case "$2" in luci.main.mediaurlbase=*) echo "${2#*=}" > "$STATE/theme" ;; esac ;; +esac +exit 0 diff --git a/luci-theme-carbon/tests/installer.test.js b/luci-theme-carbon/tests/installer.test.js new file mode 100644 index 000000000..f79b7df4f --- /dev/null +++ b/luci-theme-carbon/tests/installer.test.js @@ -0,0 +1,179 @@ +'use strict'; + +// carbon-install.sh control flow against a fake root with stub apk/opkg/uci. +// Real package managers are exercised in tests/installer-integration.py (Docker). +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const { execFileSync, spawnSync } = require('node:child_process'); + +const REPO = path.resolve(__dirname, '..'); +const VERSION = fs.readFileSync(path.join(REPO, 'root/usr/share/carbon/version'), 'utf8').trim(); +let tmp, installer, plainInstaller; + +const STUBS = path.join(__dirname, 'installer-stubs'); // stub apk / opkg / uci + +test.before(() => { + tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'carbon-installer-')); + const fakeApk = path.join(tmp, 'luci-theme-carbon-9.9.9-r1.apk'); + fs.writeFileSync(fakeApk, 'signed apk stand-in'); + execFileSync('sh', [path.join(REPO, 'scripts/build-installer.sh'), path.join(tmp, 'full'), '--apk', fakeApk], { stdio: 'pipe' }); + execFileSync('sh', [path.join(REPO, 'scripts/build-installer.sh'), path.join(tmp, 'plain')], { stdio: 'pipe' }); + installer = path.join(tmp, 'full', 'carbon-install.sh'); + plainInstaller = path.join(tmp, 'plain', 'carbon-install.sh'); + for (const [name, tools] of Object.entries({ apk: ['apk', 'uci'], opkg: ['opkg', 'uci'], none: ['uci'] })) { + const dir = path.join(tmp, 'bin-' + name); + fs.mkdirSync(dir); + for (const tool of tools) fs.copyFileSync(path.join(STUBS, tool), path.join(dir, tool)); + for (const tool of tools) fs.chmodSync(path.join(dir, tool), 0o755); + } +}); + +test.after(() => fs.rmSync(tmp, { recursive: true, force: true })); + +let n = 0; +function router(manager, { installed = {} } = {}) { + const dir = path.join(tmp, 'router' + (++n)); + const root = path.join(dir, 'root'), state = path.join(dir, 'state'); + fs.mkdirSync(path.join(root, 'usr/share/ucode/luci/template'), { recursive: true }); + fs.writeFileSync(path.join(root, 'usr/share/ucode/luci/template/header.ut'), ''); + if (manager === 'apk') { fs.mkdirSync(path.join(root, 'etc/apk'), { recursive: true }); fs.writeFileSync(path.join(root, 'etc/apk/world'), ''); } + fs.mkdirSync(path.join(state, 'pkgs'), { recursive: true }); + fs.writeFileSync(path.join(state, 'log'), ''); + for (const [name, version] of Object.entries(installed)) fs.writeFileSync(path.join(state, 'pkgs', name), version); + const run = (args = [], env = {}, file = installer) => { + const r = spawnSync('sh', [file, ...args], { + encoding: 'utf8', + env: { PATH: path.join(tmp, 'bin-' + manager) + ':/usr/bin:/bin', CARBON_ROOT: root, STATE: state, ...env } + }); + return { code: r.status, out: r.stdout + r.stderr }; + }; + return { + root, run, + log: () => fs.readFileSync(path.join(state, 'log'), 'utf8'), + version: (name = 'luci-theme-carbon') => { try { return fs.readFileSync(path.join(state, 'pkgs', name), 'utf8').trim(); } catch (e) { return null; } }, + theme: () => { try { return fs.readFileSync(path.join(state, 'theme'), 'utf8').trim(); } catch (e) { return null; } }, + exists: (p) => fs.existsSync(path.join(root, p)) + }; +} + +test('apk: installs the embedded signed package through apk with a private key directory', () => { + const r = router('apk'); + const { code, out } = r.run(); + assert.equal(code, 0, out); + assert.equal(r.version(), '9.9.9-r1'); + assert.match(r.log(), /apk --keys-dir \S+ --repositories-file \/dev\/null --no-network verify \S+luci-theme-carbon\.apk/); + assert.match(r.log(), /apk add luci-base curl ca-bundle flock/, 'missing dependencies come from the feeds'); + assert.match(r.log(), /apk --keys-dir \S+ --repositories-file \/dev\/null --no-network add \S+luci-theme-carbon\.apk/); + assert.equal(r.exists('etc/apk/keys/carbon-apk.pem'), false, 'system trust unchanged'); + assert.equal(r.exists('www/luci-static/carbon'), false, 'no loose files copied'); + assert.equal(r.theme(), '/luci-static/carbon'); + assert.match(out, /installed with apk/); +}); + +test('apk: --trust-key also adds the embedded key to /etc/apk/keys', () => { + const r = router('apk'); + assert.equal(r.run(['--trust-key']).code, 0); + assert.equal(fs.readFileSync(path.join(r.root, 'etc/apk/keys/carbon-apk.pem'), 'utf8'), + fs.readFileSync(path.join(REPO, 'keys/carbon-apk.pem'), 'utf8')); +}); + +test('apk: a bad signature aborts without installing or copying anything', () => { + const r = router('apk'); + const { code, out } = r.run([], { APK_VERIFY_RC: '1' }); + assert.notEqual(code, 0); + assert.match(out, /signature verification failed/); + assert.equal(r.version(), null); + assert.equal(r.exists('www/luci-static/carbon'), false); + assert.equal(r.theme(), null); +}); + +test('offline without dependencies: falls back to copying files, with a warning', () => { + const r = router('apk'); + const { code, out } = r.run([], { DEPS_FAIL: '1' }); + assert.equal(code, 0, out); + assert.equal(r.version(), null); + assert.ok(r.exists('www/luci-static/carbon/carbon.css')); + assert.ok(r.exists('usr/libexec/rpcd/luci.carbon_update')); + assert.match(out, /online updates stay\s+WARNING: disabled|online updates stay/); +}); + +test('script-only install migrates to a registered package', () => { + const r = router('opkg'); + assert.equal(r.run(['--files']).code, 0); + assert.ok(r.exists('www/luci-static/carbon/carbon.css')); + assert.equal(r.version(), null); + const { code, out } = r.run(); + assert.equal(code, 0, out); + assert.equal(r.version(), VERSION); + // unowned files were removed so the package owns them (the stub installs no files) + assert.equal(r.exists('www/luci-static/carbon'), false); +}); + +test('opkg: installs the embedded ipk; same version reinstalls; newer installed is kept', () => { + let r = router('opkg', { installed: { 'luci-base': '1', curl: '1', 'ca-bundle': '1', flock: '1' } }); + assert.equal(r.run().code, 0); + assert.equal(r.version(), VERSION); + assert.doesNotMatch(r.log(), /opkg update/, 'no feed access when dependencies are present'); + assert.equal(r.run().code, 0); + assert.match(r.log(), /opkg install --force-reinstall \S+\.ipk/); + + r = router('opkg', { installed: { 'luci-theme-carbon': '9.0.0-r1' } }); + const { code, out } = r.run(); + assert.equal(code, 0); + assert.match(out, /newer than this installer/); + assert.equal(r.version(), '9.0.0-r1'); +}); + +test('a failed upgrade of a registered package stops instead of copying files', () => { + const r = router('apk', { installed: { 'luci-theme-carbon': '1.0.0-r1', 'luci-base': '1', curl: '1', 'ca-bundle': '1', flock: '1' } }); + const { code, out } = r.run([], { APK_ADD_RC: '1' }); + assert.notEqual(code, 0); + assert.match(out, /remains installed/); + assert.equal(r.version(), '1.0.0-r1'); + assert.equal(r.exists('www/luci-static/carbon'), false); +}); + +test('apk system with an installer that has no .apk falls back to files', () => { + const r = router('apk'); + const { code, out } = r.run([], {}, plainInstaller); + assert.equal(code, 0, out); + assert.match(out, /no \.apk package/); + assert.ok(r.exists('www/luci-static/carbon/carbon.css')); +}); + +test('no package manager: copies files', () => { + const r = router('none'); + assert.equal(r.run().code, 0); + assert.ok(r.exists('www/luci-static/carbon/carbon.css')); +}); + +test('--files refuses to overwrite a registered package', () => { + const r = router('opkg', { installed: { 'luci-theme-carbon': '1.0.0-r1' } }); + const { code, out } = r.run(['--files']); + assert.notEqual(code, 0); + assert.match(out, /upgrade it without --files/); +}); + +test('uninstall removes the package, leftover files and settings, and restores a theme', () => { + const r = router('apk'); + assert.equal(r.run().code, 0); + fs.mkdirSync(path.join(r.root, 'www/luci-static/bootstrap'), { recursive: true }); + fs.mkdirSync(path.join(r.root, 'etc/config'), { recursive: true }); + fs.writeFileSync(path.join(r.root, 'etc/config/carbon'), ''); + const { code, out } = r.run(['uninstall']); + assert.equal(code, 0, out); + assert.match(r.log(), /apk del luci-theme-carbon/); + assert.equal(r.version(), null); + assert.equal(r.exists('etc/config/carbon'), false); + assert.equal(r.theme(), '/luci-static/bootstrap'); +}); + +test('unknown arguments print usage', () => { + const r = router('none'); + const { code, out } = r.run(['--bogus']); + assert.equal(code, 1); + assert.match(out, /Usage:/); +}); diff --git a/luci-theme-carbon/tests/make-update-fixtures.sh b/luci-theme-carbon/tests/make-update-fixtures.sh new file mode 100644 index 000000000..be47ef944 --- /dev/null +++ b/luci-theme-carbon/tests/make-update-fixtures.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Run in Alpine with apk-tools 3 and OpenSSL; all keys are disposable test keys. +set -eu +cd /fixtures +mkdir -p keys wrong data/usr/share +openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out private.pem +openssl pkey -in private.pem -pubout -out keys/carbon-apk.pem +openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out wrong/private.pem +printf '#!/bin/sh\necho installed >> /tmp/carbon-install-count\n' > post-install +for version in 1.0.0-r1 1.1.0-r1 1.2.0-r1; do + printf '%s\n' "$version" > data/usr/share/carbon-test-marker + apk mkpkg --info "name:luci-theme-carbon" --info "version:$version" --info 'arch:noarch' \ + --files data --script post-install:post-install --script post-upgrade:post-install \ + --output "luci-theme-carbon-$version.apk" +done +cp luci-theme-carbon-1.1.0-r1.apk unsigned.apk +cp unsigned.apk wrong.apk +apk adbsign --allow-untrusted --sign-key wrong/private.pem wrong.apk +sh /source/scripts/sign-apk.sh private.pem keys/carbon-apk.pem luci-theme-carbon-*.apk +rm private.pem wrong/private.pem diff --git a/luci-theme-carbon/tests/markdown.test.js b/luci-theme-carbon/tests/markdown.test.js new file mode 100644 index 000000000..a653ce31f --- /dev/null +++ b/luci-theme-carbon/tests/markdown.test.js @@ -0,0 +1,105 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const baseclass = { extend: value => value }; +const markdown = new Function('baseclass', fs.readFileSync('htdocs/luci-static/resources/carbon/markdown.js', 'utf8'))(baseclass); + +test('formats real release notes including headings, lists, tables and fenced commands', () => { + const notes = fs.readFileSync('docs/releases/v1.1.2.md', 'utf8') + '\n\n| Firmware | File |\n|---|---|\n| APK | `carbon.apk` |\n\n```sh\nopkg install carbon.ipk\n```'; + const html = markdown.render(notes); + for (const pattern of [/

v1\.1\.2<\/h3>/, /
    /, /
  • /, /升级:<\/strong>/, //, /carbon\.apk<\/code>/, /
    opkg install carbon\.ipk/])
    +		assert.match(html, pattern);
    +});
    +
    +test('supports nested lists, quotations, emphasis, references and automatic links', () => {
    +	const html = markdown.render('1. **First**\n   - *Nested* and ~~old~~\n\n> Quote\n\n[Manual][docs]\n\n[docs]: https://example.com/guide\n\nhttps://example.com/update');
    +	for (const pattern of [/
      /, /
        /, /Nested<\/em>/, /old<\/s>/, /
        /, /href="https:\/\/example.com\/guide"/, /href="https:\/\/example.com\/update"/]) + assert.match(html, pattern); +}); + +test('raw HTML, SVG, event handlers and code examples remain inert text', () => { + const html = markdown.render('\n\n\n\n\n\n\n\n```html\n\n```'); + assert.doesNotMatch(html, /<(?:script|img|svg|iframe)\b/i); + assert.match(html, /<script>/); + assert.match(html, /<img src=x onerror=alert\(1\)>/); +}); + +test('rejects script, data, file and encoded unsafe URLs in links and images', () => { + for (const url of ['javascript:alert(1)', 'JaVaScRiPt:alert(1)', 'javascript:alert(1)', 'java script:alert(1)', 'data:text/html;base64,PHNjcmlwdD4=', 'vbscript:msgbox(1)', 'file:///etc/passwd', 'data:image/svg+xml;base64,PHN2Zz4=']) { + const html = markdown.render(`[unsafe](${url})\n\n![unsafe](${url})`); + assert.doesNotMatch(html, /<(?:a|img)\b/i, url); + } +}); + +test('opens safe links separately and resolves relative paths away from the router', () => { + const html = markdown.render('[Docs](docs/apk-install.md) [Web](https://example.com/?a=1&b=2) [Mail](mailto:test@example.com)'); + assert.match(html, /href="https:\/\/github.com\/mrjoechen\/luci-theme-carbon\/blob\/main\/docs\/apk-install.md"/); + assert.equal((html.match(/target="_blank" rel="noopener noreferrer"/g) || []).length, 3); + assert.match(html, /a=1&b=2/); +}); + +test('safe images are lazy loaded without a router referrer', () => { + const html = markdown.render('![Preview](https://example.com/preview.png "Carbon")'); + assert.match(html, /Preview { + assert.equal(markdown.render(null), ''); + assert.equal(markdown.render(''), ''); + assert.match(markdown.render('**unfinished [link](\n\nA & B < C'), /A & B < C/); +}); + +test('setext headings, rules, table alignment and ordered list start', () => { + const html = markdown.render('Title\n=====\n\nSub\n---\n\n***\n\n| L | C | R |\n|:--|:-:|--:|\n| a \\| b | c | d |\n\n3. three\n4. four'); + for (const pattern of [/

        Title<\/h1>/, /

        Sub<\/h2>/, /
        /, /

    L<\/th>/, /C<\/th>/, + /d<\/td>/, /a \| b<\/td>/, /
      /]) + assert.match(html, pattern); +}); + +test('tight lists stay inline, loose lists get paragraphs', () => { + assert.match(markdown.render('- a\n- b'), /
    1. a<\/li>\n
    2. b<\/li>/); + assert.match(markdown.render('- a\n\n- b'), /
    3. a<\/p><\/li>\n

    4. b<\/p><\/li>/); + assert.match(markdown.render('- a\ncontinued\n- b'), /

    5. a\ncontinued<\/li>/); +}); + +test('escapes, code spans and URL punctuation', () => { + assert.equal(markdown.render('\\*not em\\* `**not strong**` **strong** _em_ snake_case_name'), + '

      *not em* **not strong** strong em snake_case_name

      \n'); + assert.match(markdown.render('See https://example.com/a.'), /href="https:\/\/example.com\/a"[^>]*>https:\/\/example.com\/a<\/a>\.<\/p>/); + assert.match(markdown.render('line one \nline two'), /line one
      \nline two/); +}); + +test('deep nesting and pathological input stay bounded', () => { + const t = Date.now(); + assert.match(markdown.render('>'.repeat(500) + ' deep'), /deep/); + for (const s of ['['.repeat(12000), '**'.repeat(6000), '_a '.repeat(4000), '[a]('.repeat(3000), '`'.repeat(12000)]) markdown.render(s); + assert.ok(Date.now() - t < 2000, 'renders in under 2 s'); +}); + +test('status polling keeps the notes DOM, selection and scroll when content is unchanged', async () => { + let writes = 0; + function E(tag, attrs = {}, children) { + let html = '', text = ''; + return { tag, attrs, children, hidden: false, + set innerHTML(value) { html = value; if (attrs.class === 'cb-release-notes') writes++; }, + get innerHTML() { return html; }, + set textContent(value) { text = value; }, get textContent() { return text; } + }; + } + let current = { current: '1.1.2-r1', notes: '# First', manager: 'apk' }; + const subject = new Function('view', 'rpc', 'poll', 'ui', 'markdown', 'document', 'E', 'L', 'window', '_', fs.readFileSync('htdocs/luci-static/resources/view/system/carbon-update.js', 'utf8'))( + baseclass, { declare: () => async () => current }, { add() {} }, {}, markdown, + { documentElement: { lang: 'zh' }, querySelectorAll: () => [] }, E, { hasViewPermission: () => true }, {}, s => s); + subject.render(current); + assert.equal(writes, 1); + await subject.pollStatus(); + assert.equal(writes, 1); + current = { ...current, notes: '# Second' }; + await subject.pollStatus(); + assert.equal(writes, 2); +}); diff --git a/luci-theme-carbon/tests/menu-cache.test.js b/luci-theme-carbon/tests/menu-cache.test.js new file mode 100644 index 000000000..2fd7193f0 --- /dev/null +++ b/luci-theme-carbon/tests/menu-cache.test.js @@ -0,0 +1,71 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const vm = require('node:vm'); + +const source = fs.readFileSync('htdocs/luci-static/resources/menu-carbon.js', 'utf8'); + +function fixture({ stamp, memory = false, fail = false } = {}) { + const oldMenu = { title: 'Carbon Update' }; + const newMenu = { title: 'Carbon Theme Settings' }; + const data = { menu: oldMenu, 'carbon-menu-version': stamp, tab: { selected: 3 }, auth: 'unchanged' }; + let requests = 0, rendered; + const session = { + getLocalData: key => data[key], + setLocalData: (key, value) => { data[key] = value; } + }; + // Same two cache layers as LuCI ui.menu: an instance value and session data. + const menu = { + menu: memory ? oldMenu : null, + flushCache() { session.setLocalData('menu', null); }, + load() { + if (this.menu == null) this.menu = session.getLocalData('menu'); + if (!this.menu) { + requests++; + if (fail) return Promise.reject(new Error('offline')); + this.menu = newMenu; + session.setLocalData('menu', newMenu); + } + return Promise.resolve(this.menu); + } + }; + const subject = vm.runInNewContext('(function() {\n' + source + '\n})()', { + baseclass: { extend: value => value }, ui: { menu }, session, + rpc: { declare: () => () => {} }, fs: {}, + window: { Carbon: { version: '1.1.2' } }, + document: { documentElement: { getAttribute: () => 'zh' } } + }); + subject.render = tree => { rendered = tree; }; + return { subject, data, oldMenu, newMenu, get rendered() { return rendered; }, get requests() { return requests; } }; +} + +test('old session menu refreshes without clearing login or selected tabs', async () => { + const f = fixture(); + await f.subject.__init__(); + assert.equal(f.rendered, f.newMenu); + assert.equal(f.data.auth, 'unchanged'); + assert.deepEqual(f.data.tab, { selected: 3 }); + assert.equal(f.requests, 1); +}); + +test('theme upgrade also invalidates a menu already loaded in memory', async () => { + const f = fixture({ stamp: '1.1.1', memory: true }); + await f.subject.__init__(); + assert.equal(f.rendered, f.newMenu); + assert.equal(f.data['carbon-menu-version'], '1.1.2'); +}); + +test('normal navigation in the same version keeps the menu cache', async () => { + const f = fixture({ stamp: '1.1.2', memory: true }); + await f.subject.__init__(); + assert.equal(f.rendered, f.oldMenu); + assert.equal(f.requests, 0); +}); + +test('failed menu refresh does not mark the new version as loaded', async () => { + const f = fixture({ stamp: '1.1.1', fail: true }); + await assert.rejects(() => f.subject.__init__(), /offline/); + assert.equal(f.data['carbon-menu-version'], '1.1.1'); +}); diff --git a/luci-theme-carbon/tests/menu-carbon.test.js b/luci-theme-carbon/tests/menu-carbon.test.js new file mode 100644 index 000000000..948b24c17 --- /dev/null +++ b/luci-theme-carbon/tests/menu-carbon.test.js @@ -0,0 +1,99 @@ +'use strict'; + +// LuCI glue: poll gating under the dashboard and the language list/switch. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const vm = require('node:vm'); + +const source = fs.readFileSync('htdocs/luci-static/resources/menu-carbon.js', 'utf8'); + +function load({ uci = {}, lang = 'en' } = {}) { + const calls = [], indicators = []; + const poll = { + running: true, + active() { return this.running; }, + start() { calls.push('start'); this.running = true; }, + stop() { calls.push('stop'); this.running = false; } + }; + const writes = []; + const declare = ({ object, method }) => (...args) => { + if (object === 'uci' && method === 'get') return Promise.resolve((uci[args[0]] || {})[args[1]] || {}); + if (object === 'uci' && method === 'set') { writes.push(['set', ...args]); return Promise.resolve(0); } + if (object === 'uci' && method === 'commit') { writes.push(['commit', ...args]); return Promise.resolve(0); } + return Promise.resolve({}); + }; + const listeners = {}; + const context = { + baseclass: { extend: (v) => v }, session: {}, fs: {}, poll, + ui: { menu: {}, hideIndicator: (id) => indicators.push(id) }, + rpc: { declare }, + L: { resolveDefault: (p, d) => Promise.resolve(p).catch(() => d) }, + window: { Carbon: { version: 'test' }, setTimeout: (fn) => fn() }, + E: () => ({}), + document: { + getElementById: (id) => id === 'maincontent' ? { insertBefore() {} } : null, + documentElement: { getAttribute: () => lang }, + addEventListener: (name, fn) => { listeners[name] = fn; } + } + }; + const subject = vm.runInNewContext('(function() {\n' + source + '\n})()', context); + return { subject, poll, calls, indicators, writes, listeners, context }; +} + +test('collapsed details pause LuCI polling and hide the paused badge; expanding resumes', () => { + const f = load(); + f.subject.gatePoll(false); + assert.deepEqual(f.calls, ['stop']); + assert.deepEqual(f.indicators, ['poll-status']); + f.subject.gatePoll(false); + assert.deepEqual(f.calls, ['stop'], 'no repeated stop'); + f.subject.gatePoll(true); + assert.deepEqual(f.calls, ['stop', 'start']); +}); + +test('a poll started later by the status view is stopped again while collapsed', () => { + const f = load(); + let toggle; + f.context.window.Carbon = { + Dashboard: { mount() {} }, + mode: { get: () => 'simple' }, + detailsToggle: (host, open, onToggle) => { toggle = onToggle; onToggle(false); } + }; + f.subject.mountDashboard('admin', {}); + assert.deepEqual(f.calls, ['stop']); + f.poll.running = true; // status/index.js calls poll.add() after our mount + f.listeners['poll-start'](); + assert.deepEqual(f.calls, ['stop', 'stop']); + toggle(true); + f.listeners['poll-start'](); + assert.deepEqual(f.calls, ['stop', 'stop', 'start'], 'expanded details keep LuCI polling'); +}); + +test('language list offers English plus installed catalogues with native names', async () => { + const f = load({ uci: { luci: { + languages: { '.name': 'languages', '.type': 'internal', zh_cn: '简体中文 (Chinese Simplified)', zh_tw: '繁體中文 (Chinese Traditional)', de: 'Deutsch (German)', 'bad key': 'x' }, + main: { lang: 'auto' } + } } }); + const info = await f.subject.language.load(); + assert.deepEqual(JSON.parse(JSON.stringify(info.options.map((o) => [o.code, o.label, o.short]))), [ + ['en', 'English', 'EN'], ['de', 'Deutsch', 'DE'], ['zh_cn', '简体中文', '简'], ['zh_tw', '繁體中文', '繁'] + ]); + assert.equal(info.selected, 'auto'); +}); + +test('a single Chinese catalogue is labelled 中; unknown saved languages fall back to auto', async () => { + const f = load({ uci: { luci: { languages: { zh_cn: '中文 (Chinese)' }, main: { lang: 'fr' } } } }); + const info = await f.subject.language.load(); + assert.equal(info.options[1].short, '中'); + assert.equal(info.selected, 'auto'); +}); + +test('switching language writes luci.main.lang only for installed languages', async () => { + const f = load({ uci: { luci: { languages: { zh_cn: '简体中文 (Chinese Simplified)' }, main: { lang: 'en' } } } }); + await f.subject.language.set('zh_cn'); + assert.deepEqual(JSON.parse(JSON.stringify(f.writes)), [['set', 'luci', 'main', { lang: 'zh_cn' }], ['commit', 'luci']]); + await assert.rejects(() => f.subject.language.set('ru'), /not installed/); + await f.subject.language.set('auto'); + assert.equal(f.writes.length, 4); +}); diff --git a/luci-theme-carbon/tests/navigation.html b/luci-theme-carbon/tests/navigation.html new file mode 100644 index 000000000..045ef8ea8 --- /dev/null +++ b/luci-theme-carbon/tests/navigation.html @@ -0,0 +1,81 @@ + + + + +Carbon navigation regressions + + + +

      Carbon navigation regressions

      +
      Running…
      +
      + + diff --git a/luci-theme-carbon/tests/opkg-update.py b/luci-theme-carbon/tests/opkg-update.py new file mode 100644 index 000000000..d927f0266 --- /dev/null +++ b/luci-theme-carbon/tests/opkg-update.py @@ -0,0 +1,90 @@ +"""Upgrade a legacy IPK using the real OpenWrt 24.10 opkg manager.""" +import hashlib +import io +import json +from pathlib import Path +import subprocess +import tarfile +import time +import unittest + +ROOT = Path(__file__).resolve().parents[1] +OUT = ROOT / '.cache' / 'opkg-update' +IMAGE = 'openwrt/rootfs:x86_64-24.10.8@sha256:9972a4b4747cd136abd597475d7b88c51a49fd849d0d53f069a2f4bf446061b9' + + +def docker(*args, input=None): + r = subprocess.run(['docker', *args], input=input.encode() if input is not None else None, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=180, check=True) + return r.stdout.decode() + + +def archive(files): + out = io.BytesIO() + with tarfile.open(fileobj=out, mode='w:gz') as tar: + for name, content in files.items(): + content = content.encode() if isinstance(content, str) else content + entry = tarfile.TarInfo('./' + name) + entry.size = len(content) + entry.mode = 0o755 if name == 'postrm' else 0o644 + tar.addfile(entry, io.BytesIO(content)) + return out.getvalue() + + +class OpkgUpgrade(unittest.TestCase): + def test_legacy_hook_does_not_reset_preferences(self): + OUT.mkdir(parents=True, exist_ok=True) + control = archive({'control': 'Package: luci-theme-carbon\nVersion: 1.0.0-r1\nArchitecture: all\nDescription: Upgrade regression fixture\n', + 'postrm': '#!/bin/sh\nuci set luci.main.mediaurlbase=/luci-static/bootstrap\nuci commit luci\n'}) + (OUT / 'legacy.ipk').write_bytes(archive({'control.tar.gz': control, 'data.tar.gz': archive({'usr/share/carbon-test-marker': 'old'}), 'debian-binary': '2.0\n'})) + docker('run', '--rm', '--mount', f'type=bind,source={ROOT},target=/source,readonly', + '--mount', f'type=bind,source={OUT},target=/out', + 'alpine:3.23@sha256:469c9ea410b9215eaee7976ba6c0639039b444be8e5d638f7abbada189971eb2', + 'sh', '-c', 'apk add --no-cache tar && sh /source/scripts/build-ipk.sh /out') + c = docker('run', '-d', '--mount', f'type=bind,source={ROOT},target=/source,readonly', IMAGE, 'sleep', '600').strip() + def shell(command): return docker('exec', c, 'sh', '-c', command) + def put(path, text): docker('exec', '-i', c, 'sh', '-c', 'cat > "$1"', 'sh', path, input=text) + def rpc(method, payload=None): + return json.loads(docker('exec', '-i', c, '/usr/libexec/rpcd/luci.carbon_update', 'call', method, input=json.dumps(payload or {}))) + def wait(): + for _ in range(100): + result = rpc('status') + if not result.get('busy'): return result + time.sleep(.1) + self.fail('Worker did not finish') + try: + shell('mkdir -p /var/lock; opkg update >/tmp/feeds.log 2>&1; opkg install curl ca-bundle flock >/tmp/tools.log 2>&1') + shell('opkg install /source/.cache/opkg-update/legacy.ipk; cp -r /source/root/usr/. /usr/; chmod 755 /usr/libexec/rpcd/luci.carbon_update') + fullversion = (ROOT / 'root/usr/share/carbon/version').read_text().strip() + name = f'luci-theme-carbon_{fullversion}_all.ipk' + content = (OUT / name).read_bytes() + put('/tmp/release.json', json.dumps(dict(tag_name='v' + fullversion.split('-r')[0], draft=False, prerelease=False, body='IPK test', + assets=[dict(name=name, size=len(content), digest='sha256:' + hashlib.sha256(content).hexdigest())]))) + shell('mv /usr/bin/curl /usr/bin/test-real-curl') + put('/usr/bin/curl', '''#!/bin/sh +while [ "$#" -gt 0 ]; do + case "$1" in -o) out=$2; shift ;; https://*) url=$1 ;; esac + shift +done +case "$url" in + */releases/latest) cp /tmp/release.json "$out" ;; + *.ipk) cp /source/.cache/opkg-update/''' + name + ''' "$out" ;; + *) exit 22 ;; +esac +''') + shell('chmod 755 /usr/bin/curl; uci set luci.main.lang=zh_cn; uci set luci.main.mediaurlbase=/luci-static/carbon; uci commit luci') + before = shell('uci show luci.main') + self.assertTrue(rpc('check')['started']) + self.assertTrue(wait()['can_upgrade']) + self.assertTrue(rpc('upgrade', dict(version=fullversion))['started']) + result = wait() + self.assertEqual((result['state'], result['current']), ('success', fullversion), result) + self.assertEqual(shell('uci show luci.main'), before) + self.assertNotIn('syntax error', result['log']) + self.assertFalse(result['can_upgrade']) + finally: + docker('rm', '-f', c) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/luci-theme-carbon/tests/release-notes.test.js b/luci-theme-carbon/tests/release-notes.test.js new file mode 100644 index 000000000..0e6ef8457 --- /dev/null +++ b/luci-theme-carbon/tests/release-notes.test.js @@ -0,0 +1,52 @@ +'use strict'; +/* Release body assembly (scripts/release-notes.sh): bilingual files, each language read through once. */ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const { spawnSync } = require('node:child_process'); + +const ROOT = path.join(__dirname, '..'); +const RELEASES = path.join(ROOT, 'docs/releases'); + +function notes(tag, files, repo) { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'carbon-notes-')); + fs.copyFileSync(path.join(RELEASES, 'install.md'), path.join(dir, 'install.md')); + for (const [name, text] of Object.entries(files)) fs.writeFileSync(path.join(dir, name), text); + const args = [path.join(ROOT, 'scripts/release-notes.sh'), tag].concat(repo ? [repo] : []); + return spawnSync('sh', args, { encoding: 'utf8', env: Object.assign({}, process.env, { RELEASE_NOTES_DIR: dir }) }); +} +const headings = (md) => md.split('\n').filter((l) => /^(##+ |---$)/.test(l)); + +test('a bilingual release reads English start to finish, then Simplified Chinese', () => { + const r = notes('v9.9.9', { 'v9.9.9.md': fs.readFileSync(path.join(RELEASES, 'v1.1.4.md'), 'utf8') }, 'someone/fork'); + assert.equal(r.status, 0, r.stderr); + assert.deepEqual(headings(r.stdout), [ + '## English', "### What's new", '### Upgrade notes', '### Install', '---', + '## 简体中文', '### 更新内容', '### 升级须知', '### 安装' + ]); + const [en, zh] = r.stdout.split('\n---\n'); + assert.doesNotMatch(en, /[一-鿿]/, 'no Chinese in the English section'); + assert.match(zh, /[一-鿿]/); + assert.match(r.stdout, /github\.com\/someone\/fork\/releases\/latest\/download\/carbon-install\.sh/); + assert.doesNotMatch(r.stdout, /@REPOSITORY@/); +}); + +test('a release file must have both language sections', () => { + const r = notes('v9.9.9', { 'v9.9.9.md': '## English\n\n### What\'s new\n\n- Only English\n' }); + assert.notEqual(r.status, 0); + assert.match(r.stderr, /missing section ## 简体中文/); +}); + +test('older single-language notes are kept above both sections', () => { + const r = notes('v1.0.9', { 'v1.0.9.md': '### v1.0.9\n\n- 旧格式\n' }); + assert.equal(r.status, 0, r.stderr); + assert.match(r.stdout, /^### v1\.0\.9\n\n- 旧格式\n\n---\n\n## English\n\n### Install/); + assert.match(r.stdout, /\n---\n\n## 简体中文\n\n### 安装/); +}); + +test('tag and repository are validated', () => { + assert.notEqual(notes('latest', {}).status, 0); + assert.notEqual(notes('v1.2.3', {}, 'bad repo').status, 0); +}); diff --git a/luci-theme-carbon/tests/render-template.uc b/luci-theme-carbon/tests/render-template.uc new file mode 100644 index 000000000..e7a696b28 --- /dev/null +++ b/luci-theme-carbon/tests/render-template.uc @@ -0,0 +1,25 @@ +// Render a Carbon theme template the way LuCI's runtime does (template mode) +// with stubbed LuCI globals. Usage: ucode render-template.uc [login] +const path = ARGV[0], lang = ARGV[1] ?? 'en', login = ARGV[2] == 'login'; +const scope = { + ubus: { call: (obj, method) => ({ hostname: 'OpenWrt', model: 'Test Router', rootfs_type: 'squashfs' }) }, + http: { prepare_content: (type) => null }, + dispatcher: { + lang: lang, + build_url: (...parts) => '/cgi-bin/luci/' + join('/', parts), + lookup: (path) => true + }, + ctx: { request_path: [ 'admin', 'status', 'overview' ], path: [ 'admin', 'status', 'overview' ] }, + node: { title: 'Overview' }, dispatched: null, duser: login ? 'root' : null, + blank_page: false, css: null, + media: '/luci-static/carbon', resource: '/luci-static/resources', + version: { distname: 'OpenWrt', distversion: '24.10', disturl: 'https://openwrt.org', luciname: 'LuCI', luciversion: 'test' }, + _: (s) => s, + striptags: (s) => replace(s, /<[^>]*>/g, ''), + entityencode: (s) => replace(s, /[<>&"]/g, (c) => ({ '<': '<', '>': '>', '&': '&', '"': '"' })[c]) +}; +const fn = loadfile(path, { + raw_mode: false, + module_search_path: [ '/source/tests/ucode-stubs/*.uc', '/usr/lib/ucode/*.so', '/usr/share/ucode/*.uc' ] +}); +call(fn, null, scope); diff --git a/luci-theme-carbon/tests/settings-backend.test.js b/luci-theme-carbon/tests/settings-backend.test.js new file mode 100644 index 000000000..9dc52053e --- /dev/null +++ b/luci-theme-carbon/tests/settings-backend.test.js @@ -0,0 +1,120 @@ +'use strict'; +/* + * Theme settings backend (root/usr/libexec/rpcd/luci.carbon_update): custom + * logo. The real shell functions run with a minimal jshn stand-in and + * temporary paths. + */ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const { execFileSync } = require('node:child_process'); + +const SCRIPT = fs.readFileSync(path.join(__dirname, '..', 'root/usr/libexec/rpcd/luci.carbon_update'), 'utf8'); + +const JSHN = path.join(__dirname, 'shell-stubs', 'jshn.sh'); + +function backend() { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'carbon-logo-')); + const body = SCRIPT + .replace('. /usr/share/libubox/jshn.sh', `. "${JSHN}"`) + .replace(/\ncase "\$1" in\n\tlist\)[\s\S]*$/, '\n'); + assert.notEqual(body, SCRIPT, 'dispatch block stripped'); + const lib = path.join(dir, 'backend.sh'); + fs.writeFileSync(lib, body + `\nlogo_dir="${dir}/www/custom"\nlogo_upload="${dir}/upload"\n`); + const call = (action) => JSON.parse(execFileSync(process.env.CARBON_TEST_SH || 'sh', ['-c', `. "${lib}"; input='{"action":"${action}"}'; logo`], { encoding: 'utf8' })); + const upload = (data) => fs.writeFileSync(path.join(dir, 'upload'), data); + const files = () => fs.existsSync(path.join(dir, 'www/custom')) ? fs.readdirSync(path.join(dir, 'www/custom')).sort() : []; + return { dir, call, upload, files, uploaded: () => fs.existsSync(path.join(dir, 'upload')) }; +} + +const PNG = Buffer.concat([Buffer.from('89504e470d0a1a0a0000000d49484452', 'hex'), Buffer.alloc(64)]); +const JPEG = Buffer.concat([Buffer.from('ffd8ffe000104a464946', 'hex'), Buffer.alloc(64)]); +const WEBP = Buffer.concat([Buffer.from('RIFF'), Buffer.from('24000000', 'hex'), Buffer.from('WEBPVP8 '), Buffer.alloc(32)]); +const SVG = '\n\n' + + '' + + 'Carbon one'; + +test('a PNG upload becomes the logo; a later JPEG replaces it', () => { + const b = backend(); + b.upload(PNG); + const r = b.call('set'); + assert.match(r.logo, /^\/luci-static\/carbon\/custom\/logo\.png(\?v=\d+)?$/); + assert.deepEqual(b.files(), ['logo.png']); + assert.equal(b.uploaded(), false, 'upload is consumed'); + b.upload(JPEG); + assert.match(b.call('set').logo, /logo\.jpg/); + assert.deepEqual(b.files(), ['logo.jpg']); + assert.equal(fs.statSync(path.join(b.dir, 'www/custom/logo.jpg')).mode & 0o777, 0o644); + b.upload(WEBP); + assert.match(b.call('set').logo, /logo\.webp/); +}); + +test('the image type comes from the content, never the file name', () => { + const b = backend(); + b.upload('GIF89a' + '\0'.repeat(40)); + assert.match(b.call('set').logo, /logo\.gif/); + b.upload('not an image'); + assert.deepEqual(b.call('set'), { error: 'logo_type' }); + assert.deepEqual(b.files(), ['logo.gif'], 'a rejected upload keeps the current logo'); + assert.equal(b.uploaded(), false); +}); + +test('size limits: empty and over 256 KB are rejected', () => { + const b = backend(); + b.upload(''); + assert.deepEqual(b.call('set'), { error: 'logo_size' }); + b.upload(Buffer.concat([PNG, Buffer.alloc(262144)])); + assert.deepEqual(b.call('set'), { error: 'logo_size' }); + assert.deepEqual(b.call('set'), { error: 'logo_missing' }, 'nothing left to apply'); +}); + +test('plain SVG logos are accepted, including DOCTYPE and raster data: images', () => { + const b = backend(); + b.upload(SVG); + assert.match(b.call('set').logo, /logo\.svg/); + b.upload(''); + assert.match(b.call('set').logo, /logo\.svg/); +}); + +test('SVG that could run script on the LuCI origin is rejected', () => { + const unsafe = [ + '', + '', + '\n', + '