Skip to content

Fix/use dynamix ace#70

Merged
mstrhakr merged 9 commits intodevfrom
fix/use-dynamix-ace
Mar 29, 2026
Merged

Fix/use dynamix ace#70
mstrhakr merged 9 commits intodevfrom
fix/use-dynamix-ace

Conversation

@mstrhakr
Copy link
Copy Markdown
Owner

Use Dynamix Ace Editor, Stop Bundling

Problem

Users reported stacks not rendering and "Add Stack" breaking the page. Root cause: the Slackware package naming transition (compose.manager-package-*compose.manager-*-noarch-*) could leave upgradepkg with a partial install, resulting in missing Ace module files (e.g. mode-sh.js). Ace's async module loader throws uncaught errors on 404, which poison the page's JS context and break all downstream functionality.

Solution

Stop bundling Ace editor entirely. Unraid 7.0.0+ already ships Ace v1.15.2 via Dynamix at /webGui/javascript/ace/. For pre-7.0.0 Unraid, the PLG post-install script downloads the required Ace files from GitHub on install.

Changes

Build pipeline — Remove Ace from the build entirely:

  • source/pkg_build.sh — Remove Ace download/unzip/copy block and ACE_VERSION validation
  • versions.env — Remove ACE_VERSION=1.43.5
  • build.ps1 — Remove AceVersion parameter, docs, and print statement
  • build_in_docker.sh — Remove ACE_VERSION default and Docker arg
  • .github/workflows/build.yml — Remove -e ACE_VERSION Docker arg

Runtime Ace resolution — Detect and use whichever Ace is available:

  • compose.manager.plg — Add aceVER/aceURL entities; add post-install script that checks for Dynamix Ace and downloads v1.43.5 only if missing (6.x)
  • compose_manager_main.php — PHP file_exists() selects Dynamix or plugin-local Ace path; emit aceBasePath JS var; call ace.config.set('basePath', ...) so mode/theme files resolve correctly; guard initEditorModal() when Ace is unavailable

Editor robustness — Prevent crashes when Ace is missing:

  • compose_manager_main.php — Guard all editorModal.editors[type] accesses in loadEditorFiles(), saveTab(), and the post-save validation callback

Settings page — Fix version detection on all Unraid versions:

  • compose.manager.settings.page — Add PHP $acePath detection so the credits version-check fetches from the correct path on both 6.x and 7.0.0+

Testing

  • Verified download URL https://github.com/ajaxorg/ace-builds/archive/refs/tags/v1.43.5.zip returns 200 with all 5 required files at expected paths
  • Built and deployed to test server via deploy.ps1 -Dev -RemoteHost saturn

Commits

Commit Description
99f2b09 Remove ACE_VERSION from build pipeline, add PLG fallback download, PHP/JS dynamic path detection
cd55a89 Guard editorModal.editors accesses when Ace is missing
6ac2f7d Remove leftover Ace references in build.ps1
49934ed Use PHP $acePath on settings page for version detection fallback

… Ace is missing

When Ace fails to load, initEditorModal() returns early leaving
editorModal.editors[type] undefined. loadEditorFiles(), saveTab(),
and the post-save validation callback all accessed these without
guards, causing TypeError crashes.

Add null checks on every unguarded editorModal.editors[type] access
in loadEditorFiles, saveTab, and the save-success validation callback.
Remove stale AceVersion parameter declaration, documentation, and
print statement that were missed during the Ace removal.
The settings page doesn't include compose_manager_main.php, so the
JS aceBasePath variable was undefined. The typeof fallback defaulted
to /webGui/javascript/ace which is correct on 7.0.0+ but wrong on
6.x where ace lives in the plugin directory.

Use the same PHP file_exists() detection to resolve the correct
path server-side and emit it directly into the JS.
Copilot AI review requested due to automatic review settings March 28, 2026 23:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR stops bundling the Ace editor in the package build and instead uses Unraid’s Dynamix-provided Ace (Unraid 7.0.0+) with a plugin-side install-time download fallback for older Unraid versions, plus runtime path detection in PHP/JS to ensure Ace modules resolve correctly.

Changes:

  • Remove ACE_VERSION and all Ace download/bundling steps from the build pipeline (scripts, env, CI workflow).
  • Add plugin install-time logic to download Ace files only when Dynamix Ace is unavailable (pre-7.0.0).
  • Add runtime Ace path detection and configure ace.config.basePath, plus guards to avoid JS crashes when Ace is missing.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
versions.env Removes ACE_VERSION from version inputs.
source/pkg_build.sh Removes Ace download/unpack/copy steps from package build output.
source/compose.manager/php/compose_manager_main.php Dynamically selects Ace base URL, sets Ace basePath, and adds guards when editors may be absent.
source/compose.manager/compose.manager.settings.page Detects Ace path for version detection fallback.
compose.manager.plg Adds install-time Ace download fallback for older Unraid versions.
build_in_docker.sh Stops passing ACE_VERSION into the container build.
build.ps1 Removes AceVersion parameter/env wiring and updates build output messaging.
.github/workflows/build.yml Stops passing ACE_VERSION in CI Docker build step.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Ace modes try to load worker scripts (worker-yaml.js, worker-sh.js)
via the module loader. Since we only bundle a minimal subset of Ace
files, these would 404 and throw loader errors. Disable workers via
session.setUseWorker(false) — we already validate YAML client-side
via js-yaml so workers are redundant.
Only disable certificate checking when no system CA bundle exists.
Previously wget --no-check-certificate was used unconditionally,
which could allow MITM substitution of the downloaded JS assets.
Check unzip and cp exit codes and verify ace.js exists after install.
Previously a failed extraction would silently print success, leaving
users with missing editor files and no diagnostic output.
Help text said Default: 2.40.3 but actual default is 5.0.2.
When Ace fails to load, opening the editor modal would show an empty
non-functional UI. Instead, prevent the modal from opening entirely
and show a swal error prompting the user to reload or check the
plugin installation.
@mstrhakr mstrhakr merged commit 534b923 into dev Mar 29, 2026
5 checks passed
@mstrhakr mstrhakr deleted the fix/use-dynamix-ace branch April 11, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants