2026-09-26 22:45:38 +03:00
|
|
|
// Deploy-time configuration, empty by default (mirrors gsmol's config.js).
|
|
|
|
|
// A release may bake in a server key with:
|
|
|
|
|
// flutter build apk --dart-define=SMOL_PRESET_SERVER=example.org \
|
|
|
|
|
// --dart-define=SMOL_PRESET_SERVER_KEY=base32key
|
|
|
|
|
// It only makes sense when whoever ships this app and whoever runs that
|
|
|
|
|
// smolmaild are the same trusted party: the value arrives with the app
|
|
|
|
|
// itself, which is the trusted channel SPEC.md §4 asks a pin to come from.
|
|
|
|
|
// This only seeds the first run — once written it is an ordinary pin,
|
|
|
|
|
// removable in settings like any other, and never overwrites a host the user
|
|
|
|
|
// (or a previous install) already pinned.
|
2026-09-28 23:49:39 +03:00
|
|
|
|
|
|
|
|
import "package:smol_mail/smol/store.dart";
|
|
|
|
|
|
2026-09-26 22:45:38 +03:00
|
|
|
const _presetHost = String.fromEnvironment("SMOL_PRESET_SERVER");
|
|
|
|
|
const _presetKey = String.fromEnvironment("SMOL_PRESET_SERVER_KEY");
|
|
|
|
|
|
|
|
|
|
void applyPresetServer(SmolStore store) {
|
|
|
|
|
if (_presetHost.isEmpty || _presetKey.isEmpty) return;
|
|
|
|
|
if (store.serverPin(_presetHost) != null) return;
|
2026-09-28 23:49:39 +03:00
|
|
|
// A malformed preset leaves the host unpinned rather than blocking boot.
|
|
|
|
|
store.pinServer(_presetHost, _presetKey);
|
2026-09-26 22:45:38 +03:00
|
|
|
}
|