Commit Graph

293 Commits

Author SHA1 Message Date
MayaTheShy
96afe8dcb7 Fix silent Docker crash: recursive chown, db error handling
- Entrypoint: chown -R /data (not just the directory) so existing
  volume files owned by root become writable by node user
- Entrypoint: add echo logging so startup progress is visible
- db.js: verify /data is writable before opening SQLite
- db.js: wrap Database() constructor in try-catch with clear error
  message instead of crashing silently at ESM import time
2026-03-22 21:22:30 -04:00
MayaTheShy
1b0b1c570d Fix health check: use wget -qO instead of --spider, increase start_period to 30s 2026-03-22 21:15:43 -04:00
MayaTheShy
73e157cc13 fix: remove healthcheck configuration from server service 2026-03-22 21:08:46 -04:00
MayaTheShy
18bdac03b1 Fix config.lua crash: move _configPath before first use
_configPath was called at lines 26/28 (CACHE_FILE, DISABLED_RECIPES_FILE)
but only defined at line 79. Moved the definition to the top of the
function body so it exists before the first call.
2026-03-22 20:55:33 -04:00
MayaTheShy
173a0a9f95 Persist config files across Opus package updates
The Opus package manager deletes the entire package directory on
update (fs.delete(packageDir)) before re-downloading files. This
wiped all config files (.manager_config, .client_config, etc.) that
were stored inside packages/inventory-manager/.

Fix: add _configPath() helper to every program that resolves config
file paths to usr/config/inventory-manager/ when running under Opus,
which lives outside the package directory and survives updates.
Falls back to the local _path() for standalone (non-Opus) use.

Updated files:
- inventoryManager.lua, manager/config.lua, inventoryClient.lua,
  inventoryWebBridge.lua, dropperController.lua, craftingTurtle.lua
- .package install script: saves configs to usr/config/inventory-manager/
- autorun/startup.lua: checks both persistent and package dirs
- startup/client.lua: uses persistent dir for .client_setup/.dropper_config
- web/server/Dockerfile: switch health check to wget (from prior fix)
2026-03-22 20:51:31 -04:00
MayaTheShy
01eef4eead fix: correct typo in HEALTHCHECK start-period option 2026-03-22 20:44:57 -04:00
MayaTheShy
a499446366 fix: use wget for Docker health check instead of node
Spawning a full Node process for health checks is slow on Alpine and
can exceed the 3s timeout, causing the container to be marked unhealthy.
Use wget (built into Alpine) instead, and increase start_period to 15s.
2026-03-22 20:42:37 -04:00
MayaTheShy
a6bf84d6b8 fix: update order popup background color to gray 2026-03-22 20:42:08 -04:00
MayaTheShy
aaaf25350c fix: correct item drawing in main page refresh 2026-03-22 20:29:51 -04:00
MayaTheShy
432a9feff9 Implemented the usage of the standarised ui library. 2026-03-22 20:23:06 -04:00
MayaTheShy
ee76a61240 Refactor turtle status check in smelter page
- Updated the turtle status check logic to use ctx.craftTurtleOk for determining if the crafting turtle is available.
- Adjusted the logic to fall back on checking ctx.craftTurtleName and its peripheral presence if ctx.craftTurtleOk is not set.
2026-03-22 20:20:07 -04:00
MayaTheShy
85228b134b feat: add order quantity popup for item ordering in dashboard 2026-03-22 20:16:01 -04:00
MayaTheShy
d97167b21c Add client_display.lua for network client dashboard using Opus UI
- Implemented a client dashboard mirroring manager/display.lua
- Integrated state management via master broadcasts (ctx.cache, ctx.activity)
- Enabled action commands to master through ctx.sendToMaster()
- Established UI components for inventory management and smelting operations
- Included item filtering, stock tracking, and crafting capabilities
- Designed responsive layouts for main and smelter dashboards
2026-03-22 20:15:53 -04:00
MayaTheShy
69e24e7d79 fix: update comments for clarity and organization in inventoryClient.lua 2026-03-22 20:10:41 -04:00
MayaTheShy
02248ccc38 fix: keyboard overlay hidden behind bottom bars due to z-order
Opus initChildren uses pairs() which has non-deterministic ordering.
The keyboard overlay occupies the same screen space as alertBar,
footerBar, and bottomBar. If those bars end up later in the children
array, they render on top and hide the keyboard.

Added raise() after enabling the keyboard to move it to the end
of the children array, ensuring it renders on top.
2026-03-22 20:04:51 -04:00
MayaTheShy
e67fded321 fix: client crash from barrel task early return in waitForAny
Same bug as the manager: CLIENT_BARREL_NAME == '' caused return
inside parallel.waitForAny, killing all tasks instantly.
Replace with infinite sleep when barrel is unconfigured.
2026-03-22 19:51:51 -04:00
MayaTheShy
621902b3e8 fix: correct reference to parent page in keyboard toggle event 2026-03-22 19:47:18 -04:00
MayaTheShy
380289d484 fix: improve error handling in crafting turtle script 2026-03-22 19:41:49 -04:00
MayaTheShy
d67a2fde88 feat: first-run setup wizard for client dropper config
- startup/client.lua now prompts on first run: asks if a dropper
  is next to the computer, and if so, which side it's on
- Saves config to .dropper_config (JSON with dropperSide,
  redstoneSide, enabled)
- Only launches dropperController if dropper is enabled
- dropperController.lua reads .dropper_config for its sides
  instead of hardcoding 'back'
- Delete .client_setup to re-run the setup wizard
2026-03-22 19:31:08 -04:00
MayaTheShy
215652d47c feat: reimplement on-screen keyboard for monitor search
UI.TextEntry requires keyboard input which monitors don't have.
Replaced it with the original touch-friendly approach:
- Search bar shows query text with toggle button (? / X)
- Tapping the search row opens an on-screen keyboard overlay
- 3-row QWERTY layout with Bksp, Done, Space, Clr keys
- Keyboard overlays the bottom status bars when active
- All key zones use touch hit-testing for monitor_touch events
2026-03-22 19:22:03 -04:00
MayaTheShy
b49574f39b fix: SQLite readonly error in Docker container
- Add entrypoint script that ensures /data is owned by node user
  before dropping privileges with su-exec
- Remove USER node from Dockerfile (entrypoint handles it)
- Change client depends_on to service_healthy so nginx waits for
  the server to pass its healthcheck before starting
2026-03-22 19:15:04 -04:00
MayaTheShy
d4a9441b54 fix: resize pages after re-parenting to monitor device
Page:postInit defaults parent to UI.term (small computer terminal).
Window:postInit then calls setParent() which computes all child
dimensions from that small terminal. When we later re-parent to
the monitor device, the children retain their small dimensions.
Adding resize() before setParent() forces all children to
recompute dimensions from the correct monitor size.
2026-03-22 19:09:49 -04:00
MayaTheShy
5518161adf fix: call enable() on pages after attaching to device
Opus Canvas only renders children with enabled=true. Without
calling page:enable(), all widgets were skipped during render,
resulting in a blank black monitor.
2026-03-22 19:04:20 -04:00
MayaTheShy
4c329bbfb3 debug: add raw monitor write test after sync + fix boot window visible 2026-03-22 19:01:10 -04:00
MayaTheShy
381951bd91 fix: clear boot window to prevent future monitor write interference 2026-03-22 19:00:39 -04:00
MayaTheShy
fdc3c36cd7 debug: add diagnostic logging to drawDashboard to trace rendering 2026-03-22 18:58:04 -04:00
MayaTheShy
64b3e4b069 debug: log draw errors instead of silent pcall swallowing 2026-03-22 18:52:23 -04:00
MayaTheShy
c4acc2159e fix: prevent early return in parallel tasks from killing waitForAny
Task 12 (supply chest) and Task 13 (network) returned immediately
when not configured, which caused parallel.waitForAny to exit and
the entire program to silently stop after cache build.
2026-03-22 18:49:43 -04:00
MayaTheShy
a0740b81f5 debug: xpcall entire program body, write crash log to .crash.log
Error is now saved to disk even if the window closes instantly.
Uses xpcall with debug.traceback for full stack trace.
2026-03-22 18:47:15 -04:00
MayaTheShy
82d74a01b5 debug: wrap main() in pcall to show crash error before window closes 2026-03-22 18:44:46 -04:00
MayaTheShy
bb139b4afd fix: override dofile to preserve Opus env (require was nil in sub-modules)
CC:Tweaked dofile loads files with _G as environment, but Opus
injects require into the program's sandbox _ENV. All dofile'd
modules (especially display.lua) could not see require.

Also add dropperController to apps.db.
2026-03-22 18:40:03 -04:00
MayaTheShy
40e6eab42d feat: shorten application titles in apps database and remove unused entries 2026-03-22 18:35:41 -04:00
MayaTheShy
d9b7bd32b7 feat: add exclusion for backup files and specific Lua script in package configuration 2026-03-22 18:35:33 -04:00
MayaTheShy
76772140aa feat: implement parallel inventory scanning and supply chest functionality 2026-03-22 18:15:50 -04:00
MayaTheShy
314fec5c47 feat: add parallel scanning and supply management configuration options 2026-03-22 18:15:43 -04:00
MayaTheShy
e261113134 feat: implement unified recipe database with learning support 2026-03-22 18:15:40 -04:00
MayaTheShy
7693265b62 feat: add item display name database with persistence and query functions 2026-03-22 18:15:36 -04:00
MayaTheShy
2d8d2b360f feat: implement recursive crafting engine with multi-step chain support 2026-03-22 18:15:31 -04:00
MayaTheShy
37e9b89057 feat: enhance inventory management with recursive crafting and supply chest functionality 2026-03-22 18:15:25 -04:00
MayaTheShy
467be0493c chore: add *.bak to gitignore 2026-03-22 17:18:33 -04:00
MayaTheShy
6f3a650e69 feat: add Opus autorun script and grid single-click for touch
- Add autorun/startup.lua for Opus package integration:
  - Detects role from config files (.manager_config, .client_config, etc.)
  - Registers reboot listener as kernel hook
  - Launches program via shell.openForegroundTab()
  - Client role also opens dropperController in separate tab

- Override grid eventHandler on actionable grids (itemGrid, smeltTab,
  craftTab) to emit grid_select on single mouse_click, enabling
  monitor touch to trigger actions immediately instead of requiring
  double-click
2026-03-22 17:17:56 -04:00
MayaTheShy
38727c5eeb fix: update selected amount assignment in main page event handling 2026-03-22 17:04:20 -04:00
MayaTheShy
d4a3b1cce9 Add dashboard rendering and touch handlers for inventory management
- Implemented main dashboard UI with item display, status bar, and pagination.
- Added touch zones for item ordering, quantity selection, and search functionality.
- Created smelter dashboard with tabs for status, smelting, crafting, and missing recipes.
- Integrated keyboard input for search queries and item management.
- Enhanced drawing functions for better UI representation and interaction.
2026-03-22 16:56:50 -04:00
MayaTheShy
356e84b262 feat: add interactive setup for Inventory Manager roles and configurations 2026-03-22 16:11:28 -04:00
MayaTheShy
57fd3e88bc fix: resolve all paths relative to script directory for Opus package compatibility
- Add _baseDir/_path() resolution using shell.getRunningProgram() in all
  entry-point scripts (inventoryManager, inventoryClient, craftingTurtle,
  inventoryWebBridge)
- Pass _path function through to manager/config.lua for data/ and config files
- Config files (.manager_config, .inventory_cache, etc.) now resolve relative
  to the package directory rather than CWD
- Exclude startup/ auto-updater scripts from Opus .package manifest
- All dofile() calls now use _path() for portable path resolution
2026-03-22 16:07:43 -04:00
MayaTheShy
4d8229ab46 Refactor config file path to use dynamic base directory 2026-03-22 16:07:39 -04:00
MayaTheShy
d43662b2dc Refactor module loading to use dynamic base directory path 2026-03-22 16:07:33 -04:00
MayaTheShy
3095fc7387 Refactor configuration loading to use dynamic base directory path 2026-03-22 16:07:25 -04:00
MayaTheShy
63e28d9126 Refactor turtle configuration loading to use dynamic base directory path 2026-03-22 16:07:20 -04:00
MayaTheShy
761127650f Update exclude patterns in package configuration for improved clarity 2026-03-22 16:07:15 -04:00