{# luci-theme-shadcn: header template Copyright 2025 eamonxg Licensed to the public under the Apache License 2.0. -#} {% import { getuid, getspnam } from 'luci.core'; import { lsdir } from 'fs'; const boardinfo = ubus.call('system', 'board') ?? {}; const rootsp = getspnam('root'); const root_pw_unset = (rootsp && rootsp.pwdp == ''); const page_segs = length(ctx?.request_path) ? ctx.request_path : (ctx?.path || []); const page = join('-', page_segs); // On-demand patches — see "On-demand patches" in CLAUDE.md. let patch_files = [], patch_scripts = [], patch_all = []; if (!blank_page) { let seg_prefixes = {}, acc = null; for (let seg in page_segs) seg_prefixes[acc = (acc == null ? seg : `${acc}-${seg}`)] = true; for (let f in lsdir(`/www${media}/patches`) ?? []) { if (substr(f, -4) == '.css') { push(patch_all, f); if (exists(seg_prefixes, substr(f, 0, -4))) push(patch_files, substr(f, 0, -4)); } else if (substr(f, -3) == '.js') { push(patch_all, f); if (exists(seg_prefixes, substr(f, 0, -3))) push(patch_scripts, substr(f, 0, -3)); } } sort(patch_files); sort(patch_scripts); sort(patch_all); } http.prepare_content('text/html; charset=UTF-8'); -%} {{ striptags(((boardinfo && boardinfo.hostname) ? boardinfo.hostname : '?') + ((dispatched && dispatched.title) ? (' | ' + _(dispatched.title)) : '')) }} {% if (blank_page): %} {% else %} {% for (let patch in patch_files): %} {% endfor %} {% for (let patch in patch_scripts): %} {% endfor %} {% endif %} {% if (dispatched && dispatched.css): %} {% endif %} {% if (css): %} {% endif %} {% if (!blank_page): %}
{#- Command palette (⌘K): trigger only — the panel is built lazily by menu-shadcn.js. The button wears the same msgid as the panel's input placeholder, so the trigger reads as a preview of what it opens. Not 'Search': that msgid is defined in exactly one LuCI pot (luci-app-adblock) and would read English wherever adblock is absent, whereas 'Type to filter…' comes from luci-app-package-manager, a dependency of the default luci collection. aria-label repeats the visible text (it hides below the md breakpoint, and a mismatch would break Label in Name). -#}
{% if (getuid() == 0 && root_pw_unset && ctx && ctx.authsession): %}

{{ _('No password set!') }}

{{ _('There is no password set on this router. Please configure a root password to protect the web interface.') }}

{% if (dispatcher.lookup("admin/system/admin")): %} {% endif %}
{% endif %} {% if (boardinfo && boardinfo.rootfs_type == "initramfs"): %}

{{ _('System running in recovery (initramfs) mode.') }}

{{ _('No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade') }}

{% if (dispatcher.lookup("admin/system/flash")): %} {% endif %}
{% endif %} {% endif %}