This commit is contained in:
2022-12-15 20:03:40 +01:00
parent f622fbcf0a
commit 9ef06db411
69 changed files with 5421 additions and 6426 deletions

View File

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.Extensions.Options;
namespace decePubClient.Services
{
public class ApiAuthorizationOptionsConfiguration : IPostConfigureOptions<RemoteAuthenticationOptions<ApiAuthorizationProviderOptions>>
{
public void Configure(RemoteAuthenticationOptions<ApiAuthorizationProviderOptions> options)
{
options.UserOptions.RoleClaim ??= "role";
}
public void PostConfigure(string name, RemoteAuthenticationOptions<ApiAuthorizationProviderOptions> options)
{
if (string.Equals(name, Options.DefaultName))
Configure(options);
}
}
}

View File

@ -0,0 +1,56 @@
using decePubClient.Resources;
using Microsoft.Extensions.Localization;
using SocialPub.ClientModels.Resources;
namespace collAnon.Client.Services
{
public sealed class CoalescingStringLocalizer
{
public readonly IStringLocalizer<AllStrings> _pLocalizer;
readonly IStringLocalizer<FieldsNameResource> _fLocalizer;
readonly IStringLocalizer<ErrorsResource> _eLocalizer;
public CoalescingStringLocalizer(
IStringLocalizer<AllStrings> pLocalizer,
IStringLocalizer<FieldsNameResource> fLocalizer,
IStringLocalizer<ErrorsResource> eLocalizer) =>
(_pLocalizer, _fLocalizer, _eLocalizer) =
(pLocalizer, fLocalizer, eLocalizer);
internal LocalizedString this[string name]
{
get
{
if (_pLocalizer[name].ResourceNotFound)
if (_fLocalizer[name].ResourceNotFound)
if (_eLocalizer[name].ResourceNotFound)
return new(name, name, false);
else
return _eLocalizer[name];
else
return _fLocalizer[name];
else
return _pLocalizer[name];
}
}
internal LocalizedString this[string name, params object[] arguments]
{
get
{
if (_pLocalizer[name].ResourceNotFound)
if (_fLocalizer[name].ResourceNotFound)
if (_eLocalizer[name].ResourceNotFound)
return new(name, name, false);
else
return _eLocalizer[name, arguments];
else
return _fLocalizer[name, arguments];
else
return _pLocalizer[name, arguments];
}
}
}
}

View File

@ -1,18 +1,15 @@
using Blazored.Modal.Services;
using decePubClient.Models;
using decePubClient.Models;
using decePubClient.Models.Types;
namespace decePubClient.Services
{
public class MessagesService
{
readonly IModalService modalService;
readonly IStorage storage;
readonly HttpClient http;
public MessagesService(IHttpClientFactory clientFactory, IModalService modalService, IStorage storage)
public MessagesService(IHttpClientFactory clientFactory, IStorage storage)
{
this.modalService = modalService;
this.storage = storage;
http = clientFactory.CreateClient("default");
}