This commit is contained in:
Mateusz Gruszczyński
2026-08-23 23:32:26 +02:00
parent b23578a0c8
commit f569b7db14
42 changed files with 597 additions and 4104 deletions
+1 -2
View File
@@ -6,7 +6,6 @@ All operator-facing scripts live in this directory.
- `update.sh` — safe in-place update with SQLite/config/binary backup and automatic rollback on failed health check.
- `service.sh` — start, stop, restart, status, logs and health helper.
- `dev.sh` — development build/run/check workflow.
- `build-web.sh` — local/offline Tailwind CSS build; use `--install` once to install the development dependency.
- `smoke.sh` — HTTP/API smoke test used by `dev.sh --check`.
- `generate_ha_migration.py` — legacy/manual Home Assistant entity mapping helper.
- `install-lxc.sh` — compatibility alias for `install.sh`.
@@ -17,4 +16,4 @@ All operator-facing scripts live in this directory.
- `configure-gree-network.sh <interface>` — configures a dedicated GREE NIC, automatic subnet broadcast, disables the simulator, and restarts the service.
- `network-debug.sh <interface> [broadcast-ip]` — prints interface/routing diagnostics and a tcpdump command.
The running controller never uses a CDN. `web/styles.css` is embedded into the Rust binary. Tailwind is only a local development/build tool.
The running controller never uses a CDN or Node.js. `web/styles.css` is a normal static CSS file embedded into the Rust binary; there is no CSS build step.
-52
View File
@@ -1,52 +0,0 @@
#!/usr/bin/env bash
set -Eeuo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=common.sh
source "$SCRIPT_DIR/common.sh"
cd "$PROJECT_ROOT"
INSTALL=0
WATCH=0
usage() {
cat <<'TXT'
Build the embedded Web UI CSS with the local Tailwind CLI.
Usage:
./scripts/build-web.sh
./scripts/build-web.sh --install install npm dev dependencies first
./scripts/build-web.sh --watch rebuild CSS while editing web files
The controller never loads Tailwind or any CSS from a CDN. web/styles.css is
committed and embedded into the Rust binary, so Node.js is not required at runtime.
TXT
}
while [[ $# -gt 0 ]]; do
case "$1" in
--install) INSTALL=1; shift ;;
--watch) WATCH=1; shift ;;
-h|--help) usage; exit 0 ;;
*) echo "Unknown argument: $1" >&2; usage; exit 2 ;;
esac
done
if [[ "$INSTALL" -eq 1 ]]; then
command -v npm >/dev/null 2>&1 || fail "npm is required for --install. Install Node.js/npm first."
say "Installing local Tailwind build dependency"
npm install --no-audit --no-fund
fi
TAILWIND="$PROJECT_ROOT/node_modules/.bin/tailwindcss"
if [[ ! -x "$TAILWIND" ]]; then
fail "Local Tailwind CLI is missing. Run: ./scripts/build-web.sh --install"
fi
if [[ "$WATCH" -eq 1 ]]; then
say "Watching the Web UI with local Tailwind"
exec "$TAILWIND" -c ./tailwind.config.js -i ./web/tailwind.input.css -o ./web/styles.css --watch
fi
say "Building the Web UI with local Tailwind"
"$TAILWIND" -c ./tailwind.config.js -i ./web/tailwind.input.css -o ./web/styles.css --minify
say "Generated web/styles.css"
-8
View File
@@ -60,14 +60,6 @@ install_build_dependencies() {
fi
}
build_web_assets_if_available() {
local tailwind="$PROJECT_ROOT/node_modules/.bin/tailwindcss"
if [[ -x "$tailwind" ]]; then
"$PROJECT_ROOT/scripts/build-web.sh"
else
say "Using committed offline Web UI CSS (web/styles.css)"
fi
}
ensure_rust() {
if command -v cargo >/dev/null 2>&1; then
-1
View File
@@ -46,7 +46,6 @@ else
command -v cargo >/dev/null 2>&1 || fail "Cargo is not installed and --no-install was requested."
fi
build_web_assets_if_available
if [[ ! -f .env ]]; then
cp .env.example .env
-1
View File
@@ -38,7 +38,6 @@ if [[ -x "$INSTALL_BINARY" && -f "$SERVICE_FILE" ]]; then
fi
install_build_dependencies
ensure_rust
build_web_assets_if_available
if command -v systemd-detect-virt >/dev/null 2>&1; then
virt="$(systemd-detect-virt --container 2>/dev/null || true)"
+5
View File
@@ -45,6 +45,11 @@ curl -fsS -X POST -H 'Content-Type: application/json' \
-d '{"name":"Test","device_id":"sim-salon","enabled":true,"mode":"cool","setpoint":23,"hysteresis":0.6,"min_on_seconds":0,"min_off_seconds":0,"sensor_source":"device"}' \
"http://127.0.0.1:$PORT/api/zones" >"$TMP/zone.json"
grep -q '"name":"Test"' "$TMP/zone.json"
ZONE_ID="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["id"])' "$TMP/zone.json")"
sleep 3
curl -fsS "http://127.0.0.1:$PORT/api/history?zone_id=$ZONE_ID&hours=1" >"$TMP/history.json"
grep -q '"readings"' "$TMP/history.json"
grep -q '"control_temperature"' "$TMP/history.json"
curl -fsS "http://127.0.0.1:$PORT/api/readings?device_id=sim-salon&hours=1" >"$TMP/readings.json"
grep -q '"readings"' "$TMP/readings.json"
-1
View File
@@ -40,7 +40,6 @@ require_systemd
install_build_dependencies
ensure_rust
build_web_assets_if_available
version="$(project_version)"
say "Preparing update to GREE Controller ${version:-unknown}"