Remove version check
Is unnecessary
This commit is contained in:
@@ -13,59 +13,6 @@ void function pulsePrintt(string content) //Prints whatever we want printed with
|
||||
printt(format("%s " + content, pulsePrefix))
|
||||
}
|
||||
|
||||
table function pulseGetCurrentVersionAsTable() //Gets our version numbers from mod.json and puts them in a table for use with pulseFormatAsVersion().
|
||||
{
|
||||
table result = ["MajorVersion" = GetConVarString("MajorVersion"), "MinorVersion" = GetConVarString("MinorVersion"), "PatchVersion" = GetConVarString("PatchVersion")]
|
||||
return result
|
||||
}
|
||||
|
||||
string function pulseFormatAsVersion(table Version) //Formats given version numbers into one neat string (example: v2.0.0).
|
||||
{
|
||||
return format("v%s.%s.%s", Version["MajorVersion"], Version["MinorVersion"], Version["PatchVersion"])
|
||||
}
|
||||
|
||||
string function pulseGetCurrentVersionAsString()
|
||||
{
|
||||
return pulseFormatAsVersion(pulseGetCurrentVersionAsTable())
|
||||
}
|
||||
|
||||
string function pulseGetLatestVersionAsString()
|
||||
{
|
||||
string result = ""
|
||||
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response)
|
||||
{
|
||||
table DecodedJSON = DecodeJSON(response.body)
|
||||
result = pulseFormatAsVersion(DecodedJSON)
|
||||
}
|
||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure)
|
||||
{
|
||||
pulsePrintt("Something went wrong while getting latest version.")
|
||||
}
|
||||
NSHttpGet(givenURL, onSuccess, onFailure)
|
||||
return result
|
||||
}
|
||||
|
||||
bool function pulseIsUpToDate(string givenURL) //Compares version contained in our mod.json with a version.json contained on a remote GitHub repo (see VersionURL within mod.json).
|
||||
{
|
||||
bool result = false
|
||||
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response)
|
||||
{
|
||||
table DecodedJSON = DecodeJSON(response.body)
|
||||
if (pulseFormatAsVersion(DecodedJSON) == pulseFormatAsVersion(pulseGetCurrentVersionAsTable()))
|
||||
{
|
||||
result = true
|
||||
} else {
|
||||
result = false
|
||||
}
|
||||
}
|
||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure)
|
||||
{
|
||||
pulsePrintt("Something went wrong while getting latest version.")
|
||||
}
|
||||
NSHttpGet(givenURL, onSuccess, onFailure)
|
||||
return result
|
||||
}
|
||||
|
||||
bool function pulseRequestData(string givenURL, table parameterTable) //Gets data from API (see ToneURL within mod.json) and puts it into one table for processing.
|
||||
{
|
||||
table<string, array<string> > params
|
||||
|
||||
Reference in New Issue
Block a user