Skip to content

Commit a1a08be

Browse files
authored
Merge pull request LykosAI#1004 from ionite34/backport/main/pr-1003
[dev to main] backport: Fix borked autoupdate (1003)
2 parents 3fe3df8 + 3b4264d commit a1a08be

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

StabilityMatrix.Core/Api/LykosAuthApi/.refitter

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"openApiPath": "https://stableauthentication-dev.azurewebsites.net/swagger/v2/swagger.json",
2+
"openApiPath": "https://auth.lykos.ai/swagger/v2/swagger.json",
33
"outputFolder": "./StabilityMatrix.Core/Api/LykosAuthApi/Generated",
44
"outputFilename": "Refitter.g.cs",
55
"namespace": "StabilityMatrix.Core.Api.LykosAuthApi",
@@ -9,7 +9,8 @@
99
},
1010
"includePathMatches": [
1111
"^/api/v2/Accounts/me$",
12-
"^/api/v2/oauth/patreon"
12+
"^/api/v2/oauth/patreon",
13+
"^/api/v2/files/download"
1314
],
1415
"trimUnusedSchema": true,
1516
"operationNameGenerator": "SingleClientFromPathSegments"

StabilityMatrix.Core/Api/LykosAuthApi/Generated/Refitter.g.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,32 @@ public partial interface ILykosAuthApiV2
3737
[Get("/api/v2/Accounts/me")]
3838
Task<AccountResponse> ApiV2AccountsMe();
3939

40+
/// <returns>OK</returns>
41+
/// <exception cref="ApiException">
42+
/// Thrown when the request returns a non-success status code:
43+
/// <list type="table">
44+
/// <listheader>
45+
/// <term>Status</term>
46+
/// <description>Description</description>
47+
/// </listheader>
48+
/// <item>
49+
/// <term>400</term>
50+
/// <description>Bad Request</description>
51+
/// </item>
52+
/// <item>
53+
/// <term>401</term>
54+
/// <description>Unauthorized</description>
55+
/// </item>
56+
/// <item>
57+
/// <term>403</term>
58+
/// <description>Forbidden</description>
59+
/// </item>
60+
/// </list>
61+
/// </exception>
62+
[Headers("Accept: text/plain, application/json, text/json")]
63+
[Get("/api/v2/files/download")]
64+
Task<FilesDownloadResponse> ApiV2FilesDownload([Query] string path);
65+
4066
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
4167
/// <exception cref="ApiException">
4268
/// Thrown when the request returns a non-success status code:
@@ -174,6 +200,18 @@ public partial class AccountResponse
174200

175201
}
176202

203+
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")]
204+
public partial class FilesDownloadResponse
205+
{
206+
207+
[JsonPropertyName("downloadUrl")]
208+
public System.Uri DownloadUrl { get; set; }
209+
210+
[JsonPropertyName("expiresAt")]
211+
public System.DateTimeOffset? ExpiresAt { get; set; }
212+
213+
}
214+
177215
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")]
178216
public partial class ProblemDetails
179217
{

StabilityMatrix.Core/Updater/UpdateHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Injectio.Attributes;
44
using Microsoft.Extensions.Logging;
55
using Microsoft.Extensions.Options;
6-
using StabilityMatrix.Core.Api;
6+
using StabilityMatrix.Core.Api.LykosAuthApi;
77
using StabilityMatrix.Core.Extensions;
88
using StabilityMatrix.Core.Helper;
99
using StabilityMatrix.Core.Models.Configs;
@@ -21,7 +21,7 @@ public class UpdateHelper : IUpdateHelper
2121
private readonly IHttpClientFactory httpClientFactory;
2222
private readonly IDownloadService downloadService;
2323
private readonly ISettingsManager settingsManager;
24-
private readonly ILykosAuthApiV1 lykosAuthApi;
24+
private readonly ILykosAuthApiV2 lykosAuthApi;
2525
private readonly DebugOptions debugOptions;
2626
private readonly System.Timers.Timer timer = new(TimeSpan.FromMinutes(60));
2727

@@ -45,7 +45,7 @@ public UpdateHelper(
4545
IDownloadService downloadService,
4646
IOptions<DebugOptions> debugOptions,
4747
ISettingsManager settingsManager,
48-
ILykosAuthApiV1 lykosAuthApi
48+
ILykosAuthApiV2 lykosAuthApi
4949
)
5050
{
5151
this.logger = logger;
@@ -101,7 +101,7 @@ public async Task DownloadUpdate(UpdateInfo updateInfo, IProgress<ProgressReport
101101
var path = updateInfo.Url.PathAndQuery.StripStart(authedPathPrefix);
102102
path = HttpUtility.UrlDecode(path);
103103
url = (
104-
await lykosAuthApi.GetFilesDownload(path).ConfigureAwait(false)
104+
await lykosAuthApi.ApiV2FilesDownload(path).ConfigureAwait(false)
105105
).DownloadUrl.ToString();
106106
}
107107

0 commit comments

Comments
 (0)