diff --git a/ShockOsc/Config/OpenShockConf.cs b/ShockOsc/Config/OpenShockConf.cs index 74670d2..2226326 100644 --- a/ShockOsc/Config/OpenShockConf.cs +++ b/ShockOsc/Config/OpenShockConf.cs @@ -2,7 +2,7 @@ public sealed class OpenShockConf { - public Uri Backend { get; set; } = new("https://api.shocklink.net"); + public Uri Backend { get; set; } = new("https://api.openshock.app"); public string Token { get; set; } = ""; public IReadOnlyDictionary Shockers { get; set; } = new Dictionary(); diff --git a/ShockOsc/ShockOsc.csproj b/ShockOsc/ShockOsc.csproj index 92e82ef..e3323e9 100644 --- a/ShockOsc/ShockOsc.csproj +++ b/ShockOsc/ShockOsc.csproj @@ -11,8 +11,8 @@ OpenShock.ShockOsc OpenShock.ShockOsc OpenShock - 2.0.1 - 2.0.1 + 2.1.0 + 2.1.0-rc.1 Resources\openshock-icon.ico true ShockOsc diff --git a/ShockOsc/Ui/Pages/Authentication/Authenticate.razor b/ShockOsc/Ui/Pages/Authentication/Authenticate.razor index 5958704..daf5ac5 100644 --- a/ShockOsc/Ui/Pages/Authentication/Authenticate.razor +++ b/ShockOsc/Ui/Pages/Authentication/Authenticate.razor @@ -13,20 +13,19 @@ @page "/" - - - - - ShockOSC - - - + - - Login -
+ + + + + ShockOSC + + +
+ @switch (_currentState) { case State.Login: @@ -43,6 +42,7 @@ Successful, redirecting... break; } +
diff --git a/ShockOsc/Ui/Pages/Authentication/LoginPart.razor b/ShockOsc/Ui/Pages/Authentication/LoginPart.razor index 17405a5..100b3c2 100644 --- a/ShockOsc/Ui/Pages/Authentication/LoginPart.razor +++ b/ShockOsc/Ui/Pages/Authentication/LoginPart.razor @@ -1,7 +1,10 @@ @using System.Net.Http.Json +@using System.Reflection +@using System.Runtime.InteropServices @using Microsoft.Extensions.Logging @using OneOf.Types @using OpenShock.SDK.CSharp.Models +@using OpenShock.SDK.CSharp.Utils @using OpenShock.ShockOsc.Backend @using OpenShock.ShockOsc.Config @using OpenShock.ShockOsc.Utils @@ -12,13 +15,9 @@ @inject ILogger Logger
-Get Token - +Login with OpenShock

-Continue -
-

@@ -36,14 +35,14 @@ @if (!_useCustomServerDialog) { - https://api.shocklink.net/ (Production) - https://api-staging.shocklink.net/ (Staging) + https://api.openshock.app/ (Production) + https://api-staging.openshock.app/ (Staging) @if (_customServerUri != null) { @_customServerUri (Custom) } - +
Use custom server } @@ -51,10 +50,15 @@ {
- + Back Save } + +
+ +
+ Continue with Token @@ -150,8 +154,8 @@ private struct UriIsNotValid; - private const string ProductionServerString = "https://api.shocklink.net/"; - private const string StagingServerString = "https://staging-api.shocklink.net/"; + private const string ProductionServerString = "https://api.openshock.app/"; + private const string StagingServerString = "https://staging-api.openshock.app/"; private static Uri _productionServer = new(ProductionServerString); private static Uri _stagingServer = new(StagingServerString); @@ -165,10 +169,12 @@ { Logger.LogTrace("Get API info"); var httpClient = new HttpClient(); + httpClient.DefaultRequestHeaders.Add("User-Agent", "ShockOSC-Internal/1.0"); httpClient.BaseAddress = ConfigManager.Config.OpenShock.Backend; var response = await httpClient.GetAsync("1"); if (!response.IsSuccessStatusCode) { + Logger.LogError("Failed to reach API, status code: {StatusCode}", response.StatusCode); Snackbar.Add("Failed to reach API", Severity.Error); return; } @@ -186,6 +192,19 @@ var requestUri = new Uri(root.Data!.ShortLinkUrl, "/t/?name=ShockOSC&redirect_uri=shockosc:token/%&permissions=shockers.use"); UiUtils.OpenUrl(requestUri.ToString()); } + + private string GetUserAgent() + { + var shockOscVersion = GetType().Assembly.GetName().Version!; + + + var runtimeVersion = RuntimeInformation.FrameworkDescription; + if (string.IsNullOrEmpty(runtimeVersion)) runtimeVersion = "Unknown Runtime"; + + return + $"OpenShock.ShockOsc/{shockOscVersion.Major}.{shockOscVersion.Minor}.{shockOscVersion.Build} " + + $"({runtimeVersion}; {UserAgentUtils.GetOs()}; ShockOscInternals)"; + } public sealed class RootResponse {