From b56e9ca2db44ff72da5b9c2cbcefc31c3650e373 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 15 Mar 2025 02:28:29 -0700 Subject: [PATCH] Update bundled LibAC-flutter --- lib/Constants.dart | 2 +- lib/flutter/BugVaultMain.dart | 80 ++++++++++++++++------------------- lib/server/main.dart | 3 +- lib/users/User.dart | 7 +-- pubspec.yaml | 4 +- 5 files changed, 46 insertions(+), 50 deletions(-) diff --git a/lib/Constants.dart b/lib/Constants.dart index 01f15f3..5d69932 100644 --- a/lib/Constants.dart +++ b/lib/Constants.dart @@ -1,4 +1,4 @@ class Constants { - static const VERSION = "1.0.031525+0137"; + static const VERSION = "1.0.031525+0227"; static const APP_NAME = "BugVault"; } diff --git a/lib/flutter/BugVaultMain.dart b/lib/flutter/BugVaultMain.dart index fa382f8..02c67e1 100644 --- a/lib/flutter/BugVaultMain.dart +++ b/lib/flutter/BugVaultMain.dart @@ -1,18 +1,16 @@ import 'dart:async'; import 'dart:io'; -import 'package:bugvault/Constants.dart'; import 'package:bugvault/FlutterConstants.dart'; import 'package:bugvault/SessionData.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'package:libac_dart/nbt/NbtIo.dart'; import 'package:libac_dart/nbt/impl/CompoundTag.dart'; import 'package:libacflutter/Constants.dart'; +import 'package:libacflutter/TextFields.dart'; class BugVault extends StatefulWidget { - BugVault({super.key}); + const BugVault({super.key}); @override State createState() { @@ -31,7 +29,7 @@ class BugVaultLoader extends State { } class BugVaultLoadPage extends StatefulWidget { - BugVaultLoadPage({super.key}); + const BugVaultLoadPage({super.key}); @override State createState() { @@ -96,8 +94,9 @@ class BugVaultLoadPageState extends State { g_ixState |= LoadStates.CONFIG_LOADED; SessionData.g_nbtConfiguration = await NbtIo.read("settings.dat") as CompoundTag; - } else + } else { g_ixState |= LoadStates.NO_CONFIG; + } } if (g_dLoadProgress > 0.15 && @@ -134,7 +133,12 @@ class BugVaultLoadPageState extends State { "Your username on the server. Leave blank for anonymous access (if the server allows it)", ), ), - highlightTextField(USERNAME_CONTROLLER), + HighlightTextfield( + controller: USERNAME_CONTROLLER, + inputStyle: InputType.Text, + selected: FlutterConstants.INPUT_TEXTFIELD_SELECTED, + inactive: FlutterConstants.INPUT_TEXTFIELD_NOT_SELECTED, + ), ListTile( title: Text("URL"), subtitle: Text( @@ -147,16 +151,25 @@ class BugVaultLoadPageState extends State { Row( children: [ Text("HOST / FQDN :"), - Expanded(child: highlightTextField(URL_CONTROLLER)), + Expanded( + child: HighlightTextfield( + controller: URL_CONTROLLER, + inputStyle: InputType.Text, + selected: FlutterConstants.INPUT_TEXTFIELD_SELECTED, + inactive: FlutterConstants.INPUT_TEXTFIELD_NOT_SELECTED, + ), + ), ], ), Row( children: [ Text("PORT :"), Expanded( - child: highlightTextField( - PORT_CONTROLLER, - keyboardType: TextInputType.number, + child: HighlightTextfield( + controller: PORT_CONTROLLER, + inputStyle: InputType.Number, + selected: FlutterConstants.INPUT_TEXTFIELD_SELECTED, + inactive: FlutterConstants.INPUT_TEXTFIELD_NOT_SELECTED, ), ), ], @@ -167,12 +180,21 @@ class BugVaultLoadPageState extends State { Row( children: [ Text("HOST / FQDN :"), - Expanded(child: highlightTextField(URL_CONTROLLER)), + Expanded( + child: HighlightTextfield( + controller: URL_CONTROLLER, + inputStyle: InputType.Text, + selected: FlutterConstants.INPUT_TEXTFIELD_SELECTED, + inactive: FlutterConstants.INPUT_TEXTFIELD_NOT_SELECTED, + ), + ), Text("PORT :"), Expanded( - child: highlightTextField( - PORT_CONTROLLER, - keyboardType: TextInputType.number, + child: HighlightTextfield( + controller: PORT_CONTROLLER, + inputStyle: InputType.Number, + selected: FlutterConstants.INPUT_TEXTFIELD_SELECTED, + inactive: FlutterConstants.INPUT_TEXTFIELD_NOT_SELECTED, ), ), ], @@ -187,34 +209,6 @@ class BugVaultLoadPageState extends State { ); } - Widget highlightTextField( - TextEditingController controller, { - TextInputType keyboardType = TextInputType.text, - }) { - return TextField( - controller: controller, - keyboardType: keyboardType, - inputFormatters: [ - keyboardType == TextInputType.text - ? FilteringTextInputFormatter.deny("") - : FilteringTextInputFormatter.digitsOnly, - ], - - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterConstants.INPUT_TEXTFIELD_SELECTED, - ), - ), - border: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterConstants.INPUT_TEXTFIELD_NOT_SELECTED, - ), - ), - ), - ); - } - @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/server/main.dart b/lib/server/main.dart index d02637c..684e51e 100644 --- a/lib/server/main.dart +++ b/lib/server/main.dart @@ -15,8 +15,9 @@ class BugVaultServer { static Future InstantiateSettings(CompoundTag ct) async { g_iPortNumber = ct.get("port")?.asInt() ?? 8372; - if (ct.containsKey("anonymous")) + if (ct.containsKey("anonymous")) { g_bAllowAnonymousLogin = NbtUtils.readBoolean(ct, "anonymous"); + } await _loadUserDB(); } diff --git a/lib/users/User.dart b/lib/users/User.dart index e06b0b8..5d07161 100644 --- a/lib/users/User.dart +++ b/lib/users/User.dart @@ -29,10 +29,11 @@ class DBUser { late String TOTPSecret; DBUser({required this.sName, required this.ID, String? totp}) { - if (totp == null) + if (totp == null) { TOTPSecret = generateTOTPSecret(); - else - TOTPSecret = totp!; + } else { + TOTPSecret = totp; + } } factory DBUser.load({required CompoundTag serialized}) { diff --git a/pubspec.yaml b/pubspec.yaml index 5e392f4..3b87209 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.031525+0137 +version: 1.0.031525+0227 environment: sdk: ^3.7.0 @@ -36,7 +36,7 @@ dependencies: cupertino_icons: ^1.0.8 libacflutter: hosted: https://git.zontreck.com/api/packages/Packages/pub/ - version: 1.0.20325+1224 + version: 1.0.031525+0222 libac_dart: hosted: https://git.zontreck.com/api/packages/Packages/pub/ version: 1.4.20325+1215