Skip to content

Conversation

@elibosley
Copy link
Member

@elibosley elibosley commented Dec 29, 2025

Summary by CodeRabbit

  • New Features

    • Added a dedicated Boot Mode configuration page for managing UEFI/Legacy boot settings.
  • Refactor

    • Removed boot-mode controls from the Syslinux settings page and moved them to the new standalone Boot Mode interface.

✏️ Tip: You can customize this high-level summary in your review settings.

@elibosley elibosley added the 7.3 label Dec 29, 2025
@elibosley elibosley marked this pull request as draft December 29, 2025 16:13
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Walkthrough

Adds a new Boot Mode configuration page that manages UEFI/Legacy selection and removes the boot-mode UI and hidden form args from the Syslinux configuration page. The new page uses a client-side prepare function and posts to /update.php.

Changes

Cohort / File(s) Summary
New Boot Mode page
emhttp/plugins/dynamix/BootMode.page
New page rendering a form that posts to /update.php. Server-side detection of current boot mode (presence of /sys/firmware/efi) and default checkbox state (presence of /boot/EFI). Includes client-side prepareBootMode(form) to set #arg[1] (1 = permit UEFI, 0 = disallow) before submission.
Syslinux page cleanup
emhttp/plugins/dynamix/Syslinux.page
Removed boot-mode UI block, removed hidden inputs (#command, #arg[1]) and removed boot-related setup from prepareMenu() so Syslinux no longer presents or submits boot-mode settings.

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant Server
  participant Filesystem

  rect rgb(240,248,255)
    note over Server,Filesystem: Page render phase
    Server->>Filesystem: check `/sys/firmware/efi` and `/boot/EFI`
    Filesystem-->>Server: report presence/absence
    Server-->>Browser: render `BootMode.page` (current mode + checkbox default)
  end

  rect rgb(245,255,240)
    note over Browser,Server: User action and submission
    Browser->>Browser: user toggles "Permit UEFI" checkbox
    Browser->>Browser: onsubmit → prepareBootMode(form) sets `#arg[1]` (0/1)
    Browser->>Server: POST `/update.php` with command and `#arg[1]`
    Server->>Server: apply boot-mode update based on `#arg[1]`
    Server-->>Browser: response (success/failure)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped a page from Syslinux glade,

A checkbox garden where choices are made,
I set the arg, then sent it on its way,
UEFI or Legacy — decide by day,
A tiny hare cheers every boot display 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: moving boot mode settings (UEFI) from Syslinux.page to a new BootMode.page file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/move-boot-mode-to-new-tab

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5406caf and 4b6ea61.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/BootMode.page
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/BootMode.page
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Dec 29, 2025

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2025.12.29.1615
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2498/webgui-pr-2498.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix/BootMode.page
emhttp/plugins/dynamix/Syslinux.page

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2498, or run:

plugin remove webgui-pr-2498

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@elibosley elibosley changed the title feat(bootmode): add new BootMode.page for UEFI configuration and remo… feat(bootmode): move boot mode settings (UEFI) to new page in Flash Dec 29, 2025
@elibosley elibosley marked this pull request as ready for review December 29, 2025 16:16
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
emhttp/plugins/dynamix/BootMode.page (1)

28-36: Consider clarifying the relationship between current boot mode and the checkbox.

The page displays two related but distinct concepts:

  • Current boot mode (line 29): How the system currently booted (read-only)
  • Permit UEFI checkbox (line 33): Whether UEFI boot capability should be enabled

This distinction might confuse users who could expect that unchecking the box immediately switches to Legacy mode, when in fact it requires a reboot and may need BIOS/UEFI firmware changes.

Consider adding clearer help text explaining:

  • What happens when the checkbox is unchecked (EFI boot files are removed/disabled)
  • That a system reboot is required for changes to take effect
  • That BIOS/UEFI firmware settings may also need adjustment
🔎 Suggested clarification
 _(Boot system in UEFI mode)_:
 : <label>
     <input type="checkbox" name="boot" <?=is_dir('/boot/EFI')?'checked':''?>>
     _(Permit UEFI boot mode)_
   </label>
-  *_(Please check your system settings to support UEFI boot mode)_.*
+  *_(Enabling UEFI boot mode requires BIOS/UEFI firmware support. Disabling will remove EFI boot files and requires system reboot. Check your motherboard settings to configure the boot mode)_.*
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 987fa42 and 5406caf.

📒 Files selected for processing (2)
  • emhttp/plugins/dynamix/BootMode.page
  • emhttp/plugins/dynamix/Syslinux.page
💤 Files with no reviewable changes (1)
  • emhttp/plugins/dynamix/Syslinux.page
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
emhttp/plugins/dynamix/BootMode.page (1)

23-26: The bootmode script exists at emhttp/plugins/dynamix/scripts/bootmode and correctly handles the #arg[1] argument. The script properly processes values 0 and 1 to toggle between legacy mode (EFI-) and UEFI mode (EFI), as expected.

Comment on lines +18 to +22
<script>
function prepareBootMode(form) {
form['#arg[1]'].value = form.boot.checked ? 1 : 0;
}
</script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add defensive null checks in JavaScript function.

The function accesses form.boot and form['#arg[1]'] without verifying they exist, which could cause runtime errors if the form structure changes.

🔎 Proposed fix with defensive checks
 function prepareBootMode(form) {
+  if (!form.boot || !form['#arg[1]']) {
+    console.error('Required form elements not found');
+    return false;
+  }
   form['#arg[1]'].value = form.boot.checked ? 1 : 0;
+  return true;
 }

Also update the form's onsubmit to return the validation result:

-<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareBootMode(this)">
+<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="return prepareBootMode(this)">

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In emhttp/plugins/dynamix/BootMode.page around lines 18 to 22, the
prepareBootMode(form) function assumes form.boot and form['#arg[1]'] exist which
can throw if the form structure changes; add defensive checks that verify both
elements exist (and are of expected types) before reading or setting values, and
ensure the function returns a boolean indicating success so the caller can
decide to submit; also update the form's onsubmit to return the result of
prepareBootMode(this) so submission is prevented when validation fails.

@elibosley
Copy link
Member Author

@limetech - I made this change to facilitate Ed's upcoming PR for config changes. It seems to work, let me know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants