diff --git a/bin/server.dart b/bin/server.dart index 3fca9a9..783142f 100644 --- a/bin/server.dart +++ b/bin/server.dart @@ -48,6 +48,15 @@ void main() async { settings.Write(); } + print("Checking ACL.."); + if (settings.inst!.admins.isNotEmpty) { + print("Disabling super user..."); + settings.superuser = + User.make("_disabled", "%%%disabled%%%", UserLevel.None); + } + + print("Super User is disabled because there are users registered."); + print("Finished installing needed DLLs"); print("Checking for game server updates..."); @@ -63,8 +72,11 @@ void main() async { print( "Aborting server startup procedure, initial server setup is not yet complete\n\n[ You must log in with the ServerManager to continue ]"); - DiscordHookHelper.sendWebHook(settings.inst!.discord, 0xFFD700, - "FTS Enabled", "First Time Setup Mode enabled. Startup Aborted"); + DiscordHookHelper.sendWebHook( + settings.inst!.discord, + DiscordHookProps.INACTIVE, + "FTS Enabled", + "First Time Setup Mode enabled. Startup Aborted"); } else { try { print("Downloading mods..."); diff --git a/lib/packets/ClientPackets.dart b/lib/packets/ClientPackets.dart index 97f7748..29e55b2 100644 --- a/lib/packets/ClientPackets.dart +++ b/lib/packets/ClientPackets.dart @@ -118,6 +118,9 @@ class C2SLoginPacket implements IPacket { loginReply.valid = false; } + // Properly handle the disabled account + if (loginReply.valid && username == "_disabled") loginReply.valid = false; + if (!loginReply.valid && settings.superuser!.name != username) { // Check for a lower level user if (settings.inst!.admins.any((T) => T.name == username)) { diff --git a/lib/structs/discordHookHelper.dart b/lib/structs/discordHookHelper.dart index 7c8cd9f..1766983 100644 --- a/lib/structs/discordHookHelper.dart +++ b/lib/structs/discordHookHelper.dart @@ -60,4 +60,5 @@ class DiscordHookProps { static const int OFFLINE_ALERT = 8716288; static const int ALERT = 21893; // non-intrusive static const int ALERT_INTRUSIVE = 6291589; + static const int INACTIVE = 0xFFD700; } diff --git a/pubspec.yaml b/pubspec.yaml index 3d3d587..5bc25e5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: servermanager description: A server management program for Conan # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -16,10 +16,10 @@ 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.1.0+47 +version: 1.1.0+48 environment: - sdk: '>=3.1.4 <4.0.0' + sdk: ">=3.1.4 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -31,7 +31,6 @@ dependencies: flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 @@ -40,7 +39,7 @@ dependencies: crypto: libac_dart: hosted: https://git.zontreck.com/api/packages/AriasCreations/pub/ - version: ^1.2.082924+1846 + version: ^1.2.090324+0325 dev_dependencies: flutter_test: @@ -60,7 +59,6 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. @@ -101,4 +99,4 @@ msix_config: publisher_display_name: ByteWave Labs identify_name: dev.zontreck.servermanager msix_version: 1.0.0.0 - capabilities: internetClient \ No newline at end of file + capabilities: internetClient