Commit Graph
32 Commits
Author SHA1 Message Date
yubiuser f832210c2c Remove unnecessary code and make it more human readable
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-08-07 09:04:21 +02:00
yubiuser 9f978eb36d Replace bootstrap-notify.js by bootstrapv5-toast
Signed-off-by: yubiuser <github@yubiuser.dev>
2026-08-06 20:13:15 +02:00
RD WebDesignandAdam Warner 61f6c982b7 Use the new AdminLTE header structure
- remove old `.page-title` from all pages;
- add the the new header structure and place the title inside the new
  `.app-content-header` element;

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-07-17 22:43:25 +01:00
RD WebDesignandAdam Warner 37701121e2 Fix a few visual issues on the top bar and sidebar
- add `data-bs-theme` to the body, accordingly to the current theme;
- add `data-bs-theme=dark` the the top bar, because we always use some
  background color with white text, on this element;
- change the default theme font-size to 15px. The previous theme used 14px
  (too small) and the original AdminLTE uses 16px (maybe too big);
- use `bg-body-secondary` class on the body to match the previous gray
  background color on the content area;
- use `bg-body-tertiary` class on the sidebar. It is still a dark color,
  but it will be changed according to the selected themes (when all themes
  are implemented);
- adjust the top bar text color and border color to match the previous
  theme look;
- adjust (or remove) the height on some elements on the top bar, to avoid
  breaking the layout;
- move the old "logo" element to the sidebar (`.sidebar-brand` element);
- use CSS to show a smaller "Pi-hole" text logo in the collapse sidebar;
- adjust the collapsed sidebar layout, adding `.nav-badge` class to the
  every badge on the sidebar;
- remove the outdated `pull-left` class;
- remove other outdated CSS rules;

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-07-17 22:40:00 +01:00
646a3ef6ab Fix theme/layout regressions and CSP-blocked icons found in manual testing
Reviewed and built on top of a round of fixes already applied to the
working tree (boxed layout, badge alignment, sidebar treeview links,
bootstrap5-toggle's on/off->onlabel/offlabel rename, and forcing
data-bs-theme explicitly instead of leaving Bootstrap 5 to fall back to
the OS's prefers-color-scheme, plus the new scripts/js/theme.js that
locks the resolved theme so AdminLTE's own color-mode logic can't
silently override Pi-hole's own theme selection). On top of that:

- Fixed the "day theme still shows dark" gap: the anti-FOUC inline
  background style in header.lp only covered the case where the theme
  is unconditionally dark, never the "auto" theme (whose Lua-side flag
  is literally the string "auto", not "dark") - added a
  prefers-color-scheme media query fallback so the auto theme also
  avoids a white flash without needing to wait for theme.js/CSS to load.
- Fixed a strict Content-Security-Policy (img-src 'self', set by FTL's
  webserver) blocking every checkbox/radio checkmark, the modal close
  button, and the select2 dropdown arrow/clear icon: Bootstrap 5 and its
  plugins ship these as inline data: URI SVGs, which the CSP rejects
  outright. Re-hosted the exact same icons as local files under
  style/icons/ and pointed the same CSS custom properties at them.
  Learned the hard way that a url() stored in a custom property
  resolves relative to the stylesheet that *consumes* it via var(), not
  the one that declares it - the consumer here is always
  vendor/adminLTE/adminlte.min.css, so the override paths needed to
  account for that rather than being relative to pi-hole.css itself.
- Found and fixed three more leftover .box-* selectors in pi-hole.css
  that never got updated to .card-* during the earlier card-conversion
  phase: the query-types/forward-destinations pie chart flex layout,
  the domains-list filter row header, and the dynamically-generated
  settings cards' sizing/hidden-state selectors - all on pages that
  render in normal use, unlike the handful of genuinely-unreachable
  .box-solid/.box-comment selectors left alone in the theme files
  (those modifier classes are never applied by any current markup).

Verified against a live container: boxed layout now visibly constrains
and centers the page, day theme renders light content with checkmarks/
close icons/dropdown arrows all visible with zero console errors,
clicking Settings/Tools now expands the submenu instead of navigating
to the dashboard, and sidebar badges are aligned to a consistent right
edge.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-17 22:39:57 +01:00
0153772cf5 Swap remaining jQuery plugins for Bootstrap 5-compatible versions
- DataTables: replace the combined BS3 download-builder bundles with
  the official core + Bootstrap 5 styling-adapter package pairs
  (datatables.net(-buttons/-select) + datatables.net-bs5/-buttons-bs5/
  -select-bs5), loaded core-then-adapter.
- bootstrap-select -> Tom Select: bootstrap-select has no Bootstrap 5
  build. Add utils.createGroupSelect(), a small wrapper around Tom
  Select that recreates bootstrap-select's actionsBox (Select all/
  Select none) via a couple of buttons injected into the dropdown, and
  use it for all four "assign to group(s)" multi-selects (groups,
  groups/clients, groups/domains, groups/lists). Two behavioral fixes
  were needed to match the old widget: `hideSelected: false` (Tom
  Select refuses to open its dropdown once every option is already
  selected, which made the actions box unreachable) and
  `dropdownParent: "body"` (otherwise the dropdown is clipped by the
  surrounding .table-responsive/.card ancestors' overflow, same reason
  bootstrap-select was configured with container: "body").
- bootstrap-toggle -> bootstrap5-toggle: drop-in replacement, same
  $.fn.bootstrapToggle() API and onstyle/offstyle option names (all
  call sites already used Bootstrap 5-valid color names).
- select2: bump to 4.1.0 and add the select2-bootstrap-5-theme package
  for correct Bootstrap 5 styling; wire theme: "bootstrap-5" into both
  call sites.
- Remove now-dead bootstrap-select cleanup code (the
  "$('body > .bootstrap-select.dropdown').remove()" DataTables
  drawCallback lines across 8 files) and dead icheck/bootstrap-select
  CSS in pi-hole.css.

Also fixed a Phase 1 regression surfaced by this pass: utils.js's
loadingOverlay() still targeted the old ".wrapper" class instead of
".app-wrapper", throwing whenever a settings page triggered the
Save & Apply overlay.

Verified against a live container: groups/clients' per-row Tom Select
multiselect (open dropdown, Select all/none, Apply, restore-on-cancel),
bootstrap5-toggle switches on groups, select2 filters on the query log,
and DataTables' select/export button row on groups/lists all work with
zero console errors. Settings pages' Save & Apply overlay confirmed
fixed and no longer throwing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-17 22:39:57 +01:00
89e65d8d08 Migrate layout shell to AdminLTE 4 / Bootstrap 5
Swap vendored AdminLTE 2.4.18 + Bootstrap 3.4.1 for AdminLTE 4.1.0 +
Bootstrap 5.3.8 (AdminLTE's dist CSS now bundles Bootstrap, so the
separate Bootstrap stylesheet is dropped; only its JS bundle remains).

Rewrite the page shell (header, header_authenticated, sidebar, footer)
to AdminLTE 4's app-wrapper/app-header/app-sidebar/app-main/app-content
structure and nav-sidebar/nav-treeview markup, and convert the dashboard
(index.lp) box/small-box markup to Bootstrap 5 cards as the first fully
migrated page.

Verified against a live container: fixed a chart.js tooltip lookup that
still targeted the old .box selector, restored the header logo mini/full
swap and sidebar user-panel collapse behavior that AdminLTE 2 used to
provide for free, and resolved a duplicate id="navigation" collision
with AdminLTE 4's own accessibility skip-link script.

Every other page still uses the old box/Bootstrap-3-grid/BS3-plugin
markup and will render incorrectly until the remaining migration phases
land.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-17 22:38:11 +01:00
RD WebDesign 8c0f785351 Replace mg.request_info.request_uri with the variable scriptname
The information from `mg.request_info.request_uri` depends on the URL typed
by the user. This information was used without any sanitization, allowing
an attacker to send crafted links containing anything, including javascript
code, which could be loaded and executed in a few pages.

Replacing this value with `scriptname` variable fixes the issue, since this
variable contains the name of the file currently being executed. This
information cannot be externally manipulated and it is safe to be used on
the page.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-10-19 18:44:52 -03:00
XhmikosR 4aaf7fe0e6 header: move unneeded unauthenticated assets to authenticated
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-06-27 16:43:32 +03:00
DominikandGitHub a07dacab77 header_authenticated.lp: add the hostname li only if it's greater t… (#3501) 2025-06-20 20:38:59 +02:00
64b4756640 Update chart.js to v4.5.0 (#3516)
* Update chart.js to v4.5.0

Also, switch to the minified file

Signed-off-by: XhmikosR <xhmikosr@gmail.com>

* Update scripts/lua/header_authenticated.lp

Co-authored-by: yubiuser <github@yubiuser.dev>
Signed-off-by: XhmikosR <xhmikosr@gmail.com>

---------

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: yubiuser <github@yubiuser.dev>
2025-06-16 15:50:47 +02:00
XhmikosR 293a84439d header: don't hide advanced info since it's always shown
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-06-15 08:13:20 +03:00
XhmikosRandGitHub f78257bd8e header_authenticated.lp: add the hostname li only if it's greater than zero
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-06-02 17:10:47 +03:00
casperklein f3fd182d00 Add rel="noreferrer" to external hyperlinks
Signed-off-by: casperklein <casperklein@users.noreply.github.com>
2025-05-29 22:57:36 +02:00
yubiuser 24fdb48d3f Remove horizontal line in hamburger menu
Signed-off-by: yubiuser <github@yubiuser.dev>
2025-05-26 21:17:57 +02:00
XhmikosRandGitHub 89f4d0af4e header_authenticated: change documentation icon to solid
It's now consistent with the rest of the icons

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-05-26 09:03:39 +03:00
XhmikosR 66f9c38d03 Make use of the new format_path function to add the current page in body
This will allow us to target specific pages more easily

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-05-04 09:56:56 +03:00
XhmikosR 2dd128fbfb Revert the defer addition for now
There are still cases we are getting TypeErrors. We should try again after grouping our assets together in all pages.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-04-03 07:52:28 +03:00
DL6ER 58616bc8af Remove remaining hard-coded /admin/ paths in the webinterface
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-03-31 21:43:57 +02:00
DominikandGitHub 071e5edb4a sidebar: switch to a real button (#3342) 2025-03-27 13:19:36 +01:00
XhmikosR 6c29d5dab8 Logout: fix redirect
Without this, we were getting into a loop with keep alive enabled
when using Firefox.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-03-24 08:29:40 +02:00
XhmikosR 5036b1df13 Navigation: switch to a real button
Better for accessibility

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-03-23 19:19:57 +02:00
XhmikosR 1acb80536b Refactor assets loading
* move fonts first
* move CSS and JS along with the rest
* move default auto theme media checks to the HEAD instead of imports

Also, use `script defer`. This makes the JS files non-blocking.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-03-23 07:08:37 +02:00
DL6ER 6a6a3911f0 Merge branch 'development' into new/web_prefix
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-03-18 06:58:10 +01:00
XhmikosRandGitHub bbcda8ae28 Fix stray -
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-03-12 08:13:20 +02:00
DL6ER 5f3bcdac3c Merge branch 'development' into new/web_prefix
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-03-09 20:15:59 +01:00
DL6ER e873dfed2b Use document.body.dataset instead of defining a hidden <div>
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-03-09 20:13:33 +01:00
XhmikosR 01a8b8d505 Move image to an external file
It's the original Pi-hole logo, with the following modifications:

* removed colors
* added the classes we need
* added `currentcolor`

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-03-09 20:01:41 +02:00
DL6ER f8ef22572a Store value of pihole.webhome() in a globally available variable instead of calling pihole.webhome() multiple times
Signed-off-by: DL6ER <dl6er@dl6er.de>
2025-03-08 21:37:21 +01:00
XhmikosR 3602a43842 Add missing img dimensions
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2025-03-08 15:51:01 +02:00
Toni Förster fa77236432 consistent naming for forum
Signed-off-by: Toni Förster <toni.foerster@icloud.com>
2024-12-16 20:38:56 +01:00
yubiuser 1e922a8b29 Move all files from /scripts/pi-hole/ to /scripts/
Signed-off-by: yubiuser <github@yubiuser.dev>
2024-10-28 20:22:09 +01:00