From fcfb2a17733a38b690f4e034c78bc414be5527ef Mon Sep 17 00:00:00 2001 From: xengineering Date: Mon, 6 Apr 2026 16:57:58 +0200 Subject: Implement setting server_fqdn This persists the used server_fqdn on connection. This makes sure the user does not need to specify the FQDN every time. --- lib/db.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/db.dart') diff --git a/lib/db.dart b/lib/db.dart index a39db1d..0b2cf7a 100644 --- a/lib/db.dart +++ b/lib/db.dart @@ -69,4 +69,22 @@ CREATE TABLE "key_value" ( return result[0]['value']; } + + Future setServerFqdn(String value) async { + Database? db = await _dbCompleter.future; + if (db == null) return; + + String? current = await getServerFqdn(); + if (current == null) { + db.execute( + 'INSERT INTO key_value (key, value) VALUES (\'server_fqdn\', ?);', + [value], + ); + } else { + db.execute( + 'UPDATE key_value SET value = ? WHERE key = \'server_fqdn\';', + [value], + ); + } + } } -- cgit v1.3