-
Notifications
You must be signed in to change notification settings - Fork 21
Hub login revert 939 #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Hub login revert 939 #246
Changes from all commits
69e6d07
0aecf48
29ff617
8ff9524
81c0081
252c388
b9e608c
887d549
5e8c918
9dc6a8a
5c7dd9d
c8657b5
1f14b6c
9252851
1c24c07
4412242
7220488
d70bae7
70266b3
e8bb901
f9b7663
fea6147
266f406
776c464
f00d61a
00ca55c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| namespace UnitystationLauncher.Models.Api; | ||
|
|
||
| public class CharacterTokenResponse : JsonObject | ||
| { | ||
| public string token { get; set; } | ||
|
Check warning on line 5 in UnitystationLauncher/Models/Api/CharacterTokenResponse.cs
|
||
Bod9001 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| namespace UnitystationLauncher.Models.Api; | ||
|
|
||
| public class ServerConnectionAuthenticationRequest | ||
| { | ||
| public string? ClientFork { get; set; } | ||
|
|
||
| public string? ClientVersion { get; set; } | ||
|
|
||
| public string? GoodFileVersion { get; set; } | ||
| public string? EncryptedSharedSecret { get; set; } | ||
| public string? EncryptedAccountID { get; set; } | ||
|
|
||
| public string? ConnectionPublicServerKey { get; set; } | ||
| } |
Bod9001 marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,190 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Net; | ||
| using System.Net.Http; | ||
| using System.Text; | ||
| using System.Text.Json.Nodes; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace UnitystationLauncher.Models; | ||
|
|
||
| public abstract class JsonObject | ||
| { | ||
| public virtual string ToJson() | ||
| { | ||
| return JsonConvert.SerializeObject(this); | ||
| } | ||
|
|
||
| public virtual StringContent ToStringContent() | ||
| { | ||
| return new StringContent(ToJson(), Encoding.UTF8, "application/json"); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| [Serializable] | ||
| public class AccountRegister : JsonObject | ||
| { | ||
| [JsonProperty("unique_identifier")] | ||
| public string? UniqueIdentifier { get; set; } | ||
|
|
||
| [JsonProperty("email")] | ||
| public string? Email { get; set; } | ||
|
|
||
| [JsonProperty("username")] | ||
| public string? Username { get; set; } | ||
|
|
||
| [JsonProperty("password")] | ||
| public string? Password { get; set; } | ||
| } | ||
|
|
||
|
|
||
| [Serializable] | ||
| public class ForgotPasswordModel : JsonObject | ||
| { | ||
| [JsonProperty("email")] | ||
| public string? Email { get; set; } | ||
| } | ||
|
|
||
| [Serializable] | ||
| public class Registersha512token : JsonObject | ||
|
Check notice on line 50 in UnitystationLauncher/Models/AuthenticationStuff.cs
|
||
| { | ||
| [JsonProperty("sha512_token")] | ||
| public string? sha512_token { get; set; } | ||
| } | ||
|
|
||
|
|
||
| [Serializable] | ||
| public class GetCharacterForkToken : JsonObject | ||
| { | ||
| [JsonProperty("fork_compatibility")] | ||
| public string? fork_compatibility { get; set; } | ||
| } | ||
|
|
||
|
|
||
| [Serializable] | ||
| public class AccountRegisterResponse : JsonObject | ||
| { | ||
| [JsonProperty("account")] | ||
| public AccountRegisterDetails Account { get; set; } | ||
|
Check warning on line 69 in UnitystationLauncher/Models/AuthenticationStuff.cs
|
||
| } | ||
|
|
||
| [Serializable] | ||
| public class AccountRegisterDetails : JsonObject | ||
| { | ||
| [JsonProperty("unique_identifier")] | ||
| public string UniqueIdentifier { get; set; } | ||
|
Check warning on line 76 in UnitystationLauncher/Models/AuthenticationStuff.cs
|
||
|
|
||
| [JsonProperty("email")] | ||
| public string Email { get; set; } | ||
|
Check warning on line 79 in UnitystationLauncher/Models/AuthenticationStuff.cs
|
||
|
|
||
| [JsonProperty("username")] | ||
| public string Username { get; set; } | ||
|
Check warning on line 82 in UnitystationLauncher/Models/AuthenticationStuff.cs
|
||
| } | ||
|
|
||
| [Serializable] | ||
| public class AccountLoginResponse : JsonObject | ||
| { | ||
| [JsonProperty("token")] public string Token { get; set; } = ""; | ||
|
|
||
| [JsonProperty("account")] | ||
| public AccountGetResponse Account { get; set; } | ||
|
Check warning on line 91 in UnitystationLauncher/Models/AuthenticationStuff.cs
|
||
| } | ||
|
|
||
| [Serializable] | ||
| public class AccountGetResponse : JsonObject | ||
| { | ||
| [JsonProperty("unique_identifier")] | ||
| public string UniqueIdentifier { get; set; } = ""; | ||
|
|
||
| [JsonProperty("username")] | ||
| public string Username { get; set; } = ""; | ||
|
|
||
| [JsonProperty("is_verified")] | ||
| public bool IsVerified { get; set; } | ||
| } | ||
|
|
||
| [Serializable] | ||
| public class AccountLoginToken : JsonObject, ITokenAuthable | ||
| { | ||
| public string Token { get; set; } = ""; | ||
| } | ||
|
|
||
| [Serializable] | ||
| public class AccountLogout : JsonObject, ITokenAuthable | ||
| { | ||
| public string Token { get; set; } = ""; | ||
| } | ||
|
|
||
| [Serializable] | ||
| public class AccountResendEmailConfirmationRequest : JsonObject | ||
| { | ||
| [JsonProperty("email")] | ||
| public string Email { get; set; } = ""; | ||
| } | ||
|
|
||
| [Serializable] | ||
| public class AccountLoginCredentials : JsonObject | ||
| { | ||
| [JsonProperty("email")] | ||
| public string Email { get; set; } = ""; | ||
|
|
||
| [JsonProperty("password")] public string Password { get; set; } = ""; | ||
| } | ||
|
|
||
| public class ApiResult<T> : JsonObject where T : JsonObject | ||
|
|
||
| { | ||
| public HttpStatusCode StatusCode { get; set; } | ||
| public T Data { get; set; } | ||
| public ApiHttpException? Exception { get; set; } | ||
|
|
||
| public bool IsSuccess => Exception == null; | ||
|
|
||
| private ApiResult(HttpStatusCode statusCode, T data, ApiHttpException? exception = null) | ||
| { | ||
| StatusCode = statusCode; | ||
| Data = data; | ||
| Exception = exception; | ||
| } | ||
|
|
||
| public static ApiResult<T> Success(HttpStatusCode statusCode, T data) => new(statusCode, data); | ||
| public static ApiResult<T> Failure(HttpStatusCode statusCode, T data, ApiHttpException exception) => new(statusCode, data, exception); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Error class for any HTTP-related errors as returned by the API server. | ||
| /// </summary> | ||
| public class ApiHttpException : Exception | ||
| { | ||
| public HttpStatusCode StatusCode { get; private set; } | ||
|
|
||
| public ApiHttpException(string message, HttpStatusCode code) : base(message) | ||
| { | ||
| StatusCode = code; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Marks an API request as having or requiring an authentication token. | ||
| /// </summary> | ||
| public interface ITokenAuthable | ||
| { | ||
| string Token { get; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Error class for any usage-specific API errors as returned by the API server. | ||
| /// </summary> | ||
| public class ApiRequestException : ApiHttpException | ||
| { | ||
| /// <summary>A list of all error messages returned by the API server.</summary> | ||
| /// <remarks>You can use <c>Message</c> to get the first one.</remarks> | ||
| public List<string> Messages { get; set; } | ||
|
|
||
| public ApiRequestException(string message, HttpStatusCode statusCode) : base(message, statusCode) | ||
| { | ||
| Messages = new List<string>(); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.