feat: replace mail protocol with smolmail and rebuild the UI
This commit is contained in:
parent
cb24b68069
commit
e94e4158cc
93 changed files with 6387 additions and 3479 deletions
26
lib/smol/config.dart
Normal file
26
lib/smol/config.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import "package:smol_mail/smol/proto.dart";
|
||||
import "package:smol_mail/smol/errors.dart";
|
||||
import "package:smol_mail/smol/store.dart";
|
||||
|
||||
// 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.
|
||||
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;
|
||||
try {
|
||||
store.pinServer(_presetHost, b32decode(_presetKey));
|
||||
} on SmolError {
|
||||
// malformed preset: leave unpinned rather than block boot
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue