mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-05 00:20:08 +00:00
Misc
This commit is contained in:
@@ -333,14 +333,18 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal bool SwitchLootingAllowed() => LootingAllowed = !LootingAllowed;
|
||||
|
||||
internal static async Task<(bool Success, Version Version)> Update() {
|
||||
internal static async Task<(bool Success, string Message)> Update() {
|
||||
Version version = await ASF.Update(true).ConfigureAwait(false);
|
||||
if ((version == null) || (version <= SharedInfo.Version)) {
|
||||
return (false, version);
|
||||
if (version == null) {
|
||||
return (false, null);
|
||||
}
|
||||
|
||||
if (SharedInfo.Version >= version) {
|
||||
return (false, "V" + SharedInfo.Version + " ≥ V" + version);
|
||||
}
|
||||
|
||||
Utilities.InBackground(ASF.RestartOrExit);
|
||||
return (true, version);
|
||||
return (true, version.ToString());
|
||||
}
|
||||
|
||||
private ulong GetFirstSteamMasterID() => Bot.BotConfig.SteamUserPermissions.Where(kv => (kv.Key != 0) && (kv.Value == BotConfig.EPermission.Master)).Select(kv => kv.Key).OrderByDescending(steamID => steamID != Bot.SteamID).ThenBy(steamID => steamID).FirstOrDefault();
|
||||
|
||||
@@ -2316,8 +2316,8 @@ namespace ArchiSteamFarm {
|
||||
return null;
|
||||
}
|
||||
|
||||
(bool success, Version version) = await Actions.Update().ConfigureAwait(false);
|
||||
return FormatStaticResponse((success ? Strings.Success : Strings.WarningFailed) + " " + (version != null ? SharedInfo.Version >= version ? "V" + SharedInfo.Version + " ≥ V" + version : "V" + version : ""));
|
||||
(bool success, string message) = await Actions.Update().ConfigureAwait(false);
|
||||
return FormatStaticResponse((success ? Strings.Success : Strings.WarningFailed) + (!string.IsNullOrEmpty(message) ? " " + message : ""));
|
||||
}
|
||||
|
||||
private string ResponseVersion(ulong steamID) {
|
||||
|
||||
@@ -103,19 +103,15 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
||||
/// Makes ASF update itself.
|
||||
/// </summary>
|
||||
[HttpPost("Update")]
|
||||
[ProducesResponseType(typeof(GenericResponse<Version>), 200)]
|
||||
public async Task<ActionResult<GenericResponse<Version>>> UpdatePost() {
|
||||
(bool success, Version version) = await Actions.Update().ConfigureAwait(false);
|
||||
[ProducesResponseType(typeof(GenericResponse), 200)]
|
||||
public async Task<ActionResult<GenericResponse>> UpdatePost() {
|
||||
(bool success, string message) = await Actions.Update().ConfigureAwait(false);
|
||||
|
||||
GenericResponse<Version> response;
|
||||
|
||||
if (!success && (version != null) && (SharedInfo.Version >= version)) {
|
||||
response = new GenericResponse<Version>(false, "V" + SharedInfo.Version + " ≥ V" + version, version);
|
||||
} else {
|
||||
response = new GenericResponse<Version>(success, version);
|
||||
if (string.IsNullOrEmpty(message)) {
|
||||
message = success ? Strings.Success : Strings.WarningFailed;
|
||||
}
|
||||
|
||||
return Ok(response);
|
||||
return Ok(new GenericResponse(success, message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user