fix: scope server pins by port (fumi-core rev 1468f3c)

This commit is contained in:
randogoth 2026-09-30 08:52:57 +03:00
parent 996e879509
commit 7d2a147fec
16 changed files with 109 additions and 79 deletions

View file

@ -9,6 +9,7 @@
// removable in settings like any other, and never overwrites a host the user
// (or a previous install) already pinned.
import "package:smol_mail/smol/address.dart";
import "package:smol_mail/smol/store.dart";
const _presetHost = String.fromEnvironment("SMOL_PRESET_SERVER");
@ -16,7 +17,7 @@ const _presetKey = String.fromEnvironment("SMOL_PRESET_SERVER_KEY");
void applyPresetServer(SmolStore store) {
if (_presetHost.isEmpty || _presetKey.isEmpty) return;
if (store.serverPin(_presetHost) != null) return;
if (store.serverPin(_presetHost, defaultPort) != null) return;
// A malformed preset leaves the host unpinned rather than blocking boot.
store.pinServer(_presetHost, _presetKey);
store.pinServer(_presetHost, _presetKey, defaultPort);
}