Attempt to fix the mod update checker

This commit is contained in:
zontreck 2024-11-26 14:10:24 -07:00
parent 5d5d43ed06
commit 82c3a8cbcb
5 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,3 @@
class Consts { class Consts {
static const VERSION = "1.1.112624.0154"; static const VERSION = "1.1.112624.1409";
} }

View file

@ -7,6 +7,9 @@ import 'package:servermanager/structs/settings.dart';
Future<void> doDownloadMods(bool jail) async { Future<void> doDownloadMods(bool jail) async {
Settings settings = Settings(); Settings settings = Settings();
if (settings.isDownloadingMods) return;
settings.isDownloadingMods = true;
// Build download command // Build download command
List<String> manifest = [ List<String> manifest = [
@ -35,6 +38,8 @@ Future<void> doDownloadMods(bool jail) async {
var result = await Process.run(settings.getSteamCmd(), manifest); var result = await Process.run(settings.getSteamCmd(), manifest);
print(result.stdout); print(result.stdout);
settings.isDownloadingMods = false;
} }
Future<List<Mod>> doScanMods(bool jail) async { Future<List<Mod>> doScanMods(bool jail) async {
@ -68,8 +73,8 @@ Future<List<Mod>> doScanMods(bool jail) async {
var data = md5.convert(content); var data = md5.convert(content);
var hash = data.toString(); var hash = data.toString();
M.mod_pak = name; //M.mod_pak = name;
M.mod_hash = hash; //M.mod_hash = hash;
print("Discovered mod file: $name"); print("Discovered mod file: $name");
print("Hash: $hash"); print("Hash: $hash");
@ -83,5 +88,6 @@ Future<List<Mod>> doScanMods(bool jail) async {
} }
} }
} }
return ret; return ret;
} }

View file

@ -377,7 +377,7 @@ class StateMachine {
settings.inst!.discord, settings.inst!.discord,
DiscordHookProps.ALERT_INTRUSIVE, DiscordHookProps.ALERT_INTRUSIVE,
"Mods have been updated", "Mods have been updated",
"The server is going to restart because the following mods have been updated: \n${updatedMods.join(', ')}"); "The server is going to restart because the following mods have been updated: \n\n${updatedMods.join('\n')}");
DiscordHookHelper.sendWebHook( DiscordHookHelper.sendWebHook(
settings.inst!.discord, settings.inst!.discord,
DiscordHookProps.ALERT, DiscordHookProps.ALERT,

View file

@ -38,6 +38,8 @@ class Settings {
bool FTS = true; bool FTS = true;
UUID remoteLoginToken = UUID.ZERO; UUID remoteLoginToken = UUID.ZERO;
bool isDownloadingMods = false;
PacketClient? client; PacketClient? client;
User superuser = User.make("admin", "changeMe123", UserLevel.Super_User); User superuser = User.make("admin", "changeMe123", UserLevel.Super_User);

View file

@ -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 # 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 # 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. # of the product and file versions while build-number is used as the build suffix.
version: 1.1.112624+0154 version: 1.1.112624+1409
environment: environment:
sdk: ">=3.1.4 <4.0.0" sdk: ">=3.1.4 <4.0.0"