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,74 @@
// Weather ▸ Current location when the phone can't tell where it is: the error banner on top, home (the first place) shown;
// no place at all: the banner, no crash.
import 'dart:io';
import 'package:dash_app/app/sync_service.dart';
import 'package:dash_app/sync/client.dart';
import 'package:dash_app/sync/store.dart';
import 'package:dash_app/weather/weather_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('no location → the banner, home shown', (tester) async {
tester.view.physicalSize = const Size(1200, 2700);
tester.view.devicePixelRatio = 3;
addTearDown(tester.view.reset);
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(const MethodChannel('dash/location'), (c) async =>
{'status': {'allowed': false, 'enabled': true}, 'ask': false}[c.method]);
final store = SyncStore('${Directory.systemTemp.createTempSync('wx').path}/d.db', 'test00000000');
store.setMeta('wx_here', 1); // Current location picked
store.setMetaText('wx_places', '[{"name": "Hometown, XX", "lat": 47.1, "lon": 24.0}]');
final sync = SyncService(SyncSettings(server: 'http://x.invalid', token: 't', account: 'a', name: 'n', device: 'test00000000',
key: Uint8List(32)), store);
await tester.pumpWidget(MaterialApp(home: WeatherPage(sync: sync)));
for (var i = 0; i < 10; i++) {
await tester.pump(const Duration(milliseconds: 100));
}
expect(find.text('Location isn\'t allowed for this app'), findsOneWidget);
expect(find.text('Showing Hometown (home) instead.'), findsOneWidget);
expect(find.text('Hometown'), findsOneWidget); // the title: home, not "Hometown (location not allowed)"
sync.dispose();
});
testWidgets('no location and no place → the banner, no crash', (tester) async {
tester.view.physicalSize = const Size(1200, 2700);
tester.view.devicePixelRatio = 3;
addTearDown(tester.view.reset);
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(const MethodChannel('dash/location'), (c) async =>
{'status': {'allowed': false, 'enabled': true}, 'ask': false}[c.method]);
final store = SyncStore('${Directory.systemTemp.createTempSync('wx').path}/d.db', 'test00000000');
final sync = SyncService(SyncSettings(server: 'http://x.invalid', token: 't', account: 'a', name: 'n', device: 'test00000000',
key: Uint8List(32)), store);
await tester.pumpWidget(MaterialApp(home: WeatherPage(sync: sync)));
for (var i = 0; i < 10; i++) {
await tester.pump(const Duration(milliseconds: 100));
}
expect(find.text('Location isn\'t allowed for this app'), findsOneWidget);
expect(tester.takeException(), isNull);
sync.dispose();
});
testWidgets("the dashboard's places (synced weather.place) come first: home from there", (tester) async {
tester.view.physicalSize = const Size(1200, 2700);
tester.view.devicePixelRatio = 3;
addTearDown(tester.view.reset);
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(const MethodChannel('dash/location'), (c) async =>
{'status': {'allowed': false, 'enabled': true}, 'ask': false}[c.method]);
final store = SyncStore('${Directory.systemTemp.createTempSync('wx').path}/d.db', 'test00000000');
store.apply([
{'t': 'weather.place', 'u': 'place:Townsville, XX', 'h': 5, 'd': 'pi0000000000',
'row': {'k': 'Townsville, XX', 'name': 'Townsville, XX', 'lat': 45.0, 'lon': 10.0, 'ord': 0}},
]);
store.setMeta('wx_here', 1);
final sync = SyncService(SyncSettings(server: 'http://x.invalid', token: 't', account: 'a', name: 'n', device: 'test00000000',
key: Uint8List(32)), store);
await tester.pumpWidget(MaterialApp(home: WeatherPage(sync: sync)));
for (var i = 0; i < 10; i++) {
await tester.pump(const Duration(milliseconds: 100));
}
expect(find.text('Showing Townsville (home) instead.'), findsOneWidget);
sync.dispose();
});
}