Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Work on update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
frothy-wifi committed Apr 17, 2024
1 parent a31acab commit 67b0ee4
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,26 @@ void function CynHud_CheckForUpdates() {
}
FlagWait("CynHudUpdateCheckP1Success");

onSuccess = void function(HttpRequestResponse response) {
CynHud_WriteChatMessage("\x1b[113mChanges/fixes:\x1b[0m " + response.body);
FlagSet("CynHudUpdateCheckP2Done");
}
if (Flag("CynHudUpdateCheckP1Success")) {
onSuccess = void function(HttpRequestResponse response) {
CynHud_WriteChatMessage("\x1b[113mChanges/fixes:\x1b[0m " + response.body);
FlagSet("CynHudUpdateCheckP2Done");
}

onFailure = void function(HttpRequestFailure failure) {
CynHud_WriteChatMessage("Can't fetch update changes/fixes right now: " + failure.errorMessage);
FlagSet("CynHudUpdateCheckP2Done");
}
onFailure = void function(HttpRequestFailure failure) {
CynHud_WriteChatMessage("Can't fetch update changes/fixes right now: " + failure.errorMessage);
FlagSet("CynHudUpdateCheckP2Done");
}

if (!(NSHttpGet("https://cynhud.api.frothywifi.cc/changes", {}, onSuccess, onFailure))) {
CynHud_WriteChatMessage("Can't fetch update changes/fixes right now: Couldn't launch the HTTP request.");
if (!(NSHttpGet("https://cynhud.api.frothywifi.cc/changes", {}, onSuccess, onFailure))) {
CynHud_WriteChatMessage("Can't fetch update changes/fixes right now: Couldn't launch the HTTP request.");
FlagSet("CynHudUpdateCheckP2Done");
}
} else {
FlagSet("CynHudUpdateCheckP2Done");
}


FlagWait("CynHudUpdateCheckP2Done");

if (shouldShowWelcomeText) {
Expand Down

0 comments on commit 67b0ee4

Please sign in to comment.