Send a webhook alert when restart is required for mod list changes
This commit is contained in:
parent
5be57fbca5
commit
d64a34605c
6 changed files with 25 additions and 4 deletions
|
@ -1,3 +1,3 @@
|
|||
class Consts {
|
||||
static const VERSION = "1.1.112324.1308";
|
||||
static const VERSION = "1.1.112324.1559";
|
||||
}
|
||||
|
|
|
@ -353,6 +353,16 @@ class C2SUploadSettingsPacket implements IPacket {
|
|||
|
||||
if (!performRestart) {
|
||||
return PacketResponse.nil;
|
||||
} else {
|
||||
// Send a webhook with all the mods listed
|
||||
String modListText = "";
|
||||
for (var entry in settings.inst!.mods) {
|
||||
modListText += "${entry.mod_name}\n";
|
||||
}
|
||||
|
||||
modListText = modListText.trim();
|
||||
DiscordHookHelper.sendWebHook(settings.inst!.discord,
|
||||
DiscordHookProps.INACTIVE, "Mod List Updated", modListText);
|
||||
}
|
||||
|
||||
// Check if server is running, if not, stop immediately
|
||||
|
|
|
@ -55,6 +55,8 @@ class ModManagerState extends State<ModManager> {
|
|||
i++;
|
||||
} while (i < end - oldIndex);
|
||||
settings.inst!.mods[end] = item;
|
||||
|
||||
settings.restartRequired = true;
|
||||
} else if (oldIndex > newIndex) {
|
||||
//From bottom to top
|
||||
Mod item = settings.inst!.mods[oldIndex];
|
||||
|
@ -62,6 +64,8 @@ class ModManagerState extends State<ModManager> {
|
|||
settings.inst!.mods[i] = settings.inst!.mods[i - 1];
|
||||
}
|
||||
settings.inst!.mods[newIndex] = item;
|
||||
|
||||
settings.restartRequired = true;
|
||||
}
|
||||
setState(() {
|
||||
settings.Write();
|
||||
|
@ -92,11 +96,14 @@ class ModManagerState extends State<ModManager> {
|
|||
if (MERA.delete) {
|
||||
setState(() {
|
||||
settings.inst!.mods.removeAt(idx);
|
||||
settings.restartRequired = true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
settings.inst!.mods[idx] = MERA.mod!;
|
||||
|
||||
settings.restartRequired = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -117,6 +124,8 @@ class ModManagerState extends State<ModManager> {
|
|||
|
||||
setState(() {
|
||||
settings.inst!.mods.add(MERA.mod!);
|
||||
|
||||
settings.restartRequired = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -141,7 +141,7 @@ class HomePageState extends State<HomePage> {
|
|||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
value: requireRestart,
|
||||
value: requireRestart || settings.restartRequired,
|
||||
onChanged: (V) {
|
||||
setState(() {
|
||||
requireRestart = V;
|
||||
|
@ -149,7 +149,7 @@ class HomePageState extends State<HomePage> {
|
|||
},
|
||||
title: Text("Perform Restart"),
|
||||
subtitle: Text(
|
||||
"Whether a immediate server restart should be performed in combination with this wrapper settings update"),
|
||||
"Whether a immediate server restart should be performed in combination with this wrapper settings update${settings.restartRequired ? "\n** A RESTART IS REQUIRED DUE TO MOD LIST CHANGES" : ""}"),
|
||||
)
|
||||
],
|
||||
)),
|
||||
|
|
|
@ -45,6 +45,8 @@ class Settings {
|
|||
|
||||
StateMachine subsys = StateMachine();
|
||||
|
||||
bool restartRequired = false;
|
||||
|
||||
factory Settings() {
|
||||
return Instance;
|
||||
}
|
||||
|
|
|
@ -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.1.112324+1308
|
||||
version: 1.1.112324+1559
|
||||
|
||||
environment:
|
||||
sdk: ">=3.1.4 <4.0.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue