tabs->spaces etc
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"Author": "darkarchon",
|
|
||||||
"Name": "Mare Synchronos",
|
|
||||||
"Punchline": "Let others see you as you see yourself.",
|
|
||||||
"Description": "This plugin will synchronize your Penumbra mods and current Glamourer state with other paired clients automatically.",
|
|
||||||
"InternalName": "mareSynchronos",
|
|
||||||
"ApplicableVersion": "any",
|
|
||||||
"Tags": [
|
|
||||||
"customization"
|
|
||||||
],
|
|
||||||
"IconUrl": "https://raw.githubusercontent.com/Penumbra-Sync/client/main/MareSynchronos/images/logo.png",
|
|
||||||
"RepoUrl": "https://github.com/Penumbra-Sync/client",
|
|
||||||
"CanUnloadAsync": true
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace MareSynchronosStaticFilesServer.Utils;
|
namespace MareSynchronos.Utils;
|
||||||
|
|
||||||
// Calculates the hash of content read or written to a stream
|
// Calculates the hash of content read or written to a stream
|
||||||
public class HashingStream : Stream
|
public class HashingStream : Stream
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using MareSynchronos.PlayerData.Handlers;
|
|||||||
using MareSynchronos.Services.Mediator;
|
using MareSynchronos.Services.Mediator;
|
||||||
using MareSynchronos.Utils;
|
using MareSynchronos.Utils;
|
||||||
using MareSynchronos.WebAPI.Files.Models;
|
using MareSynchronos.WebAPI.Files.Models;
|
||||||
using MareSynchronosStaticFilesServer.Utils;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
@@ -189,7 +188,7 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ public class HubFactory : MediatorSubscriberBase
|
|||||||
var ver = Assembly.GetExecutingAssembly().GetName().Version;
|
var ver = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("MareSynchronos", ver!.Major + "." + ver!.Minor + "." + ver!.Build));
|
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("MareSynchronos", ver!.Major + "." + ver!.Minor + "." + ver!.Build));
|
||||||
|
|
||||||
// Make a GET request to the loporrit endpoint
|
|
||||||
var response = await httpClient.GetAsync(wellKnownUrl).ConfigureAwait(false);
|
var response = await httpClient.GetAsync(wellKnownUrl).ConfigureAwait(false);
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using MareSynchronos.Utils;
|
|||||||
using MareSynchronos.API.Dto;
|
using MareSynchronos.API.Dto;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.Net;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -76,7 +76,7 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
|
|||||||
new KeyValuePair<string, string>("charaIdent", await _dalamudUtil.GetPlayerNameHashedAsync().ConfigureAwait(false)),
|
new KeyValuePair<string, string>("charaIdent", await _dalamudUtil.GetPlayerNameHashedAsync().ConfigureAwait(false)),
|
||||||
}), token).ConfigureAwait(false);
|
}), token).ConfigureAwait(false);
|
||||||
|
|
||||||
if (!result.IsSuccessStatusCode)
|
if (result.StatusCode == HttpStatusCode.NotFound)
|
||||||
{
|
{
|
||||||
tokenUri = MareAuth.AuthFullPath(new Uri(_serverManager.CurrentApiUrl
|
tokenUri = MareAuth.AuthFullPath(new Uri(_serverManager.CurrentApiUrl
|
||||||
.Replace("wss://", "https://", StringComparison.OrdinalIgnoreCase)
|
.Replace("wss://", "https://", StringComparison.OrdinalIgnoreCase)
|
||||||
@@ -87,14 +87,14 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
|
|||||||
new KeyValuePair<string, string>("charaIdent", await _dalamudUtil.GetPlayerNameHashedAsync().ConfigureAwait(false)),
|
new KeyValuePair<string, string>("charaIdent", await _dalamudUtil.GetPlayerNameHashedAsync().ConfigureAwait(false)),
|
||||||
}), token).ConfigureAwait(false);
|
}), token).ConfigureAwait(false);
|
||||||
|
|
||||||
var textResponse = await result.Content.ReadAsStringAsync().ConfigureAwait(false) ?? string.Empty;
|
var textResponse = await result.Content.ReadAsStringAsync(token).ConfigureAwait(false) ?? string.Empty;
|
||||||
result.EnsureSuccessStatusCode();
|
result.EnsureSuccessStatusCode();
|
||||||
_tokenCache[identifier] = textResponse;
|
_tokenCache[identifier] = textResponse;
|
||||||
_wellKnownCache[_serverManager.CurrentApiUrl] = null;
|
_wellKnownCache[_serverManager.CurrentApiUrl] = null;
|
||||||
return textResponse;
|
return textResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = await result.Content.ReadFromJsonAsync<AuthReplyDto>().ConfigureAwait(false) ?? new();
|
var response = await result.Content.ReadFromJsonAsync<AuthReplyDto>(token).ConfigureAwait(false) ?? new();
|
||||||
result.EnsureSuccessStatusCode();
|
result.EnsureSuccessStatusCode();
|
||||||
_tokenCache[identifier] = response.Token;
|
_tokenCache[identifier] = response.Token;
|
||||||
_wellKnownCache[_serverManager.CurrentApiUrl] = response.WellKnown;
|
_wellKnownCache[_serverManager.CurrentApiUrl] = response.WellKnown;
|
||||||
@@ -107,7 +107,7 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
|
|||||||
|
|
||||||
_logger.LogError(ex, "GetNewToken: Failure to get token");
|
_logger.LogError(ex, "GetNewToken: Failure to get token");
|
||||||
|
|
||||||
if (ex.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
if (ex.StatusCode == HttpStatusCode.Unauthorized)
|
||||||
{
|
{
|
||||||
Mediator.Publish(new NotificationMessage("Error refreshing token", "Your authentication token could not be renewed. Try reconnecting manually.", NotificationType.Error));
|
Mediator.Publish(new NotificationMessage("Error refreshing token", "Your authentication token could not be renewed. Try reconnecting manually.", NotificationType.Error));
|
||||||
Mediator.Publish(new DisconnectedMessage());
|
Mediator.Publish(new DisconnectedMessage());
|
||||||
|
|||||||
Reference in New Issue
Block a user