dashPi: a self-hosted home dashboard, its sync server and phone app

The dashboard (Raspberry Pi 3.5" screen + web pages), the end-to-end
encrypted sync mailbox (PHP + SQLite) and the Android companion app
(Flutter), with docs, clean-install checks and screenshots made from
demo data.

Built mostly with an AI coding assistant; not yet reviewed line by line
by a human (see README and SECURITY.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-10-24 09:35:12 +02:00
commit fb3c01cdd7
333 changed files with 45151 additions and 0 deletions

View file

@ -0,0 +1,16 @@
# Copy to tool/publish.env (not in git) and fill in. Read by tool/publish.sh.
# where the APK goes: the sync server's app/ folder, over SSH
DASH_PUBLISH_HOST=you@your-server.example.com
DASH_PUBLISH_DIR=/srv/dash-sync/app
# optional: the Flutter to build with (default: flutter on the PATH)
#FLUTTER=$HOME/flutter/bin/flutter
# optional, built into the app (each can also be set in the app itself):
# the server the connect screen starts with
#DEV_SERVER=https://sync.example.com
# the dashboard on your home network, for "sync now"
#PI_URL=http://192.168.1.50:8080
# weather places, home first: "Name|lat|lon;Name|lat|lon"
#HOME_PLACES=Hometown, XX|47.17|24.06;Big city, XX|46.77|23.60

59
app/tool/publish.sh Executable file
View file

@ -0,0 +1,59 @@
#!/usr/bin/env bash
# Publish the app: the next build number (pubspec.yaml), a signed release APK, then app.json + the APK to the
# sync server's app/ folder over SSH — every phone sees it at its next check (lib/app/updater.dart) and the
# primary dashboard mirrors it for the home network (http://<dashboard>:8080/app).
# tool/publish.sh [-m "what changed"] [--no-build]
# The update notes: -m, else this version's entry in CHANGELOG.md (its "## x.y.z" section) — refused without one.
# Your settings: tool/publish.env (not in git; copy tool/publish.env.example).
set -euo pipefail
cd "$(dirname "$0")/.."
[ -f tool/publish.env ] && . tool/publish.env
HOST="${DASH_PUBLISH_HOST:?set DASH_PUBLISH_HOST (user@server) in tool/publish.env}"
DIR="${DASH_PUBLISH_DIR:?set DASH_PUBLISH_DIR (the server's app/ folder) in tool/publish.env}"
FLUTTER="${FLUTTER:-flutter}"
DEFINES=()
for v in DEV_SERVER PI_URL HOME_PLACES; do # built into the app: see docs/app.md
[ -n "${!v:-}" ] && DEFINES+=("--dart-define=$v=${!v}")
done
NOTES=""; BUILD=1
while [ $# -gt 0 ]; do
case "$1" in
-m) NOTES="$2"; shift 2 ;;
--no-build) BUILD=0; shift ;;
*) echo "usage: tool/publish.sh [-m notes] [--no-build]"; exit 2 ;;
esac
done
[ -f android/key.properties ] || { echo "android/key.properties is missing: a debug-signed APK can't update the installed app."; exit 1; }
# the next build number: above both this checkout's and the server's
ver=$(sed -n 's/^version: *//p' pubspec.yaml); name=${ver%%+*}; mine=${ver##*+}
# the notes: this version's CHANGELOG.md entry (checked before the build, so a missing one costs nothing)
[ -n "$NOTES" ] || NOTES=$(awk -v v="$name" '/^## /{on = ($2 == v); next} on' CHANGELOG.md | sed -e '/./,$!d' | sed -e ':a' -e '/^\n*$/{$d;N;ba' -e '}')
[ -n "$NOTES" ] || { echo "no \"## $name\" entry in CHANGELOG.md — write one (or pass -m)"; exit 1; }
theirs=$(ssh -o BatchMode=yes "$HOST" "cat $DIR/app.json 2>/dev/null || true" | python3 -c "import json,sys
try: print(json.load(sys.stdin)['build'])
except Exception: print(0)")
if [ "$BUILD" = 1 ]; then
next=$(( (mine > theirs ? mine : theirs) + 1 ))
sed -i "s/^version: .*/version: $name+$next/" pubspec.yaml
echo "── building $name ($next) ──"
"$FLUTTER" build apk --release "${DEFINES[@]}"
else
next=$mine
[ "$next" -gt "$theirs" ] || { echo "build $next isn't newer than the server's $theirs"; exit 1; }
fi
APK=build/app/outputs/flutter-apk/app-release.apk
[ -f "$APK" ] || { echo "no $APK"; exit 1; }
size=$(stat -c %s "$APK"); sha=$(sha256sum "$APK" | cut -d' ' -f1)
tmp=$(mktemp); trap 'rm -f "$tmp"' EXIT
NAME="$name" NEXT="$next" SIZE="$size" SHA="$sha" NOTES="$NOTES" python3 -c "import json,os,datetime
print(json.dumps({'version': os.environ['NAME'], 'build': int(os.environ['NEXT']), 'size': int(os.environ['SIZE']),
'sha256': os.environ['SHA'], 'published': datetime.datetime.now(datetime.timezone.utc).isoformat(timespec='seconds'),
'notes': os.environ['NOTES']}))" > "$tmp"
echo "── uploading $name ($next), $((size / 1000000)) MB ──"
ssh -o BatchMode=yes "$HOST" "mkdir -p $DIR && chmod 755 $DIR"
# the APK first, under a temporary name; then both renamed in one go (a phone never sees a half-written pair)
rsync -t --chmod=F644 "$APK" "$HOST:$DIR/dash-app.apk.new"
rsync -t --chmod=F644 "$tmp" "$HOST:$DIR/app.json.new"
ssh -o BatchMode=yes "$HOST" "cd $DIR && mv dash-app.apk.new dash-app.apk && mv app.json.new app.json"
echo "published $name ($next) — phones pick it up at their next check (Sync page ▸ App)"