Saving
This commit is contained in:
1 parent
9719a0c0fd
commit
1e66851113
146 files changed
+738
-382
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels
|
namespace PrivaPub.ClientModels
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||||
public class AtLeastOnePropertyAttribute : ValidationAttribute
|
public class AtLeastOnePropertyAttribute : ValidationAttribute
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
namespace SocialPub.ClientModels
|
namespace PrivaPub.ClientModels
|
||||||
{
|
{
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
|
public const int MaxAvatarNameLength = 32;
|
||||||
|
public const int MaxAvatarBiographyLength = 5_000;
|
||||||
public const int MinPasswordLength = 7;
|
public const int MinPasswordLength = 7;
|
||||||
public const int MaxPasswordLength = 1025;
|
public const int MaxPasswordLength = 1025;
|
||||||
public const int GroupInvitationLength = 64;
|
public const int GroupInvitationLength = 64;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace SocialPub.ClientModels.Data
|
namespace PrivaPub.ClientModels.Data
|
||||||
{
|
{
|
||||||
public class ViewLanguage
|
public class ViewLanguage
|
||||||
{
|
{
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
using SocialPub.ClientModels.ValidatorAttributes;
|
using PrivaPub.ClientModels.ValidatorAttributes;
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels
|
namespace PrivaPub.ClientModels
|
||||||
{
|
{
|
||||||
public class LoginForm
|
public class LoginForm
|
||||||
{
|
{
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels
|
namespace PrivaPub.ClientModels
|
||||||
{
|
{
|
||||||
public class NewPasswordForm
|
public class NewPasswordForm
|
||||||
{
|
{
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels
|
namespace PrivaPub.ClientModels
|
||||||
{
|
{
|
||||||
[AtLeastOneProperty(nameof(UserName), nameof(Email),
|
[AtLeastOneProperty(nameof(UserName), nameof(Email),
|
||||||
ErrorMessageResourceName = "AtLeastOneProperty",
|
ErrorMessageResourceName = "AtLeastOneProperty",
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SocialPub.ClientModels
|
namespace PrivaPub.ClientModels
|
||||||
{
|
{
|
||||||
public static class Policies
|
public static class Policies
|
||||||
{
|
{
|
||||||
File renamed without changes.
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace SocialPub.ClientModels.Resources {
|
namespace PrivaPub.ClientModels.Resources {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace SocialPub.ClientModels.Resources {
|
|||||||
public static global::System.Resources.ResourceManager ResourceManager {
|
public static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SocialPub.ClientModels.Resources.ErrorsResource", typeof(ErrorsResource).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrivaPub.ClientModels.Resources.ErrorsResource", typeof(ErrorsResource).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace SocialPub.ClientModels.Resources {
|
namespace PrivaPub.ClientModels.Resources {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace SocialPub.ClientModels.Resources {
|
|||||||
public static global::System.Resources.ResourceManager ResourceManager {
|
public static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SocialPub.ClientModels.Resources.FieldsNameResource", typeof(FieldsNameResource).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrivaPub.ClientModels.Resources.FieldsNameResource", typeof(FieldsNameResource).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,35 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Security.AccessControl;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.User.Avatar
|
||||||
|
{
|
||||||
|
[JsonSerializable(typeof(InsertAvatarForm))]
|
||||||
|
public class InsertAvatarForm
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public string RootId { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(Constants.MaxAvatarNameLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = nameof(Name), ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Name { get; set; }//name
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(Constants.MaxAvatarNameLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = nameof(UserName), ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string UserName { get; set; }//preferredUsername
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(Constants.MaxAvatarBiographyLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = nameof(Biography), ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Biography { get; set; }//summary
|
||||||
|
|
||||||
|
public ViewAvatarSettings Settings { get; set; } = new();
|
||||||
|
public Dictionary<string, string> Fields { get; set; } = new();
|
||||||
|
public string PersonalNote { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.User.Avatar
|
||||||
|
{
|
||||||
|
[JsonSerializable(typeof(UpdateAvatarForm))]
|
||||||
|
public class UpdateAvatarForm
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public string RootId { get; set; }
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = nameof(AvatarId), ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string AvatarId { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(Constants.MaxAvatarNameLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = nameof(Name), ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Name { get; set; }//name
|
||||||
|
|
||||||
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
StringLength(Constants.MaxAvatarBiographyLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
|
Display(Name = nameof(Biography), ResourceType = typeof(FieldsNameResource))]
|
||||||
|
public string Biography { get; set; }//summary
|
||||||
|
|
||||||
|
public ViewAvatarSettings Settings { get; set; } = new();
|
||||||
|
public Dictionary<string, string> Fields { get; set; } = new();
|
||||||
|
public string PersonalNote { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace PrivaPub.ClientModels.User.Avatar
|
||||||
|
{
|
||||||
|
[JsonSerializable(typeof(ViewAvatar))]
|
||||||
|
public class ViewAvatar
|
||||||
|
{
|
||||||
|
public string Url { get; set; }//url
|
||||||
|
public string Name { get; set; }//name
|
||||||
|
public string UserName { get; set; }//preferredUsername
|
||||||
|
public string Biography { get; set; }//summary
|
||||||
|
public Dictionary<string, string> Fields { get; set; } = new();
|
||||||
|
|
||||||
|
public string PictureURL { get; set; }//icon
|
||||||
|
public string ThumbnailURL { get; set; }//image
|
||||||
|
public Dictionary<string, string> SharedPersonalContacts { get; set; } = new();
|
||||||
|
|
||||||
|
public ViewAvatarState AccountState { get; set; } = ViewAvatarState.Normal;
|
||||||
|
public ViewAvatarServer ServerType { get; set; } = ViewAvatarServer.Unknown;
|
||||||
|
|
||||||
|
public ViewAvatarSettings Settings { get; set; } = new();
|
||||||
|
|
||||||
|
public DateTime UpdatedAt { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
-9
@@ -1,25 +1,29 @@
|
|||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels.User
|
namespace PrivaPub.ClientModels.User.Avatar
|
||||||
{
|
{
|
||||||
public class ViewUserSettings
|
[JsonSerializable(typeof(ViewAvatarSettings))]
|
||||||
|
public class ViewAvatarSettings
|
||||||
{
|
{
|
||||||
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||||||
Display(Name = nameof(LanguageCode), ResourceType = typeof(FieldsNameResource))]
|
Display(Name = nameof(LanguageCode), ResourceType = typeof(FieldsNameResource))]
|
||||||
public string LanguageCode { get; set; } = "en";
|
public string LanguageCode { get; set; } = "en-GB";
|
||||||
|
|
||||||
|
public bool IsDefault { get; set; } = true;
|
||||||
|
|
||||||
|
[Range(-2, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
|
public short IconsThemeIndexColour { get; set; } = 25;
|
||||||
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
|
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
public short LightThemeIndexColour { get; set; } = 25;
|
public short LightThemeIndexColour { get; set; } = 25;
|
||||||
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
|
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
|
||||||
public short DarkThemeIndexColour { get; set; } = 215;
|
public short DarkThemeIndexColour { get; set; } = 215;
|
||||||
[Range(-2, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
|
|
||||||
public short IconsThemeIndexColour { get; set; } = 25;
|
|
||||||
|
|
||||||
public bool PreferSystemTheming { get; set; } = false;
|
public bool PreferSystemTheming { get; set; } = true;
|
||||||
public bool ThemeIsDarkMode { get; set; } = false;
|
public bool ThemeIsDarkMode { get; set; } = false;
|
||||||
public bool ThemeIsLightGray { get; set; } = false;
|
public bool ThemeIsLightGray { get; set; } = true;
|
||||||
public bool ThemeIsDarkGray { get; set; } = false;
|
public bool ThemeIsDarkGray { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SocialPub.ClientModels.User
|
namespace PrivaPub.ClientModels.User
|
||||||
{
|
{
|
||||||
public class JwtUser
|
public class JwtUser
|
||||||
{
|
{
|
||||||
@@ -8,6 +8,6 @@
|
|||||||
public List<string> Policies { get; set; } = new();
|
public List<string> Policies { get; set; } = new();
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
public long Expiration { get; set; }
|
public long Expiration { get; set; }
|
||||||
public ViewUserSettings UserSettings { get; set; } = new();
|
public ViewAvatarServer UserSettings { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels.User
|
namespace PrivaPub.ClientModels.User
|
||||||
{
|
{
|
||||||
public class UserForm
|
public class UserForm
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SocialPub.ClientModels.User
|
namespace PrivaPub.ClientModels.User
|
||||||
{
|
{
|
||||||
public class UsersIds
|
public class UsersIds
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace PrivaPub.ClientModels.User
|
||||||
|
{
|
||||||
|
public enum ViewAvatarServer
|
||||||
|
{
|
||||||
|
Unknown,
|
||||||
|
Pleroma,
|
||||||
|
Mastodon,
|
||||||
|
Akkoma,
|
||||||
|
Misskey,
|
||||||
|
PrivaPub
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PrivaPub.ClientModels.User
|
||||||
|
{
|
||||||
|
public enum ViewAvatarState
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
Silenced,
|
||||||
|
Suspended,
|
||||||
|
Banned,
|
||||||
|
Deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels.ValidatorAttributes
|
namespace PrivaPub.ClientModels.ValidatorAttributes
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
public class NoWhiteSpacesAttribute : ValidationAttribute
|
public class NoWhiteSpacesAttribute : ValidationAttribute
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.ClientModels
|
namespace PrivaPub.ClientModels
|
||||||
{
|
{
|
||||||
public class WebResult
|
public class WebResult
|
||||||
{
|
{
|
||||||
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.4.33122.133
|
VisualStudioVersion = 17.4.33122.133
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocialPub", "SocialPub\SocialPub.csproj", "{EB2A0BD2-0150-405A-939E-5B0F6F642539}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrivaPub", "PrivaPub\PrivaPub.csproj", "{EB2A0BD2-0150-405A-939E-5B0F6F642539}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocialPub.ClientModels", "SocialPub.ClientModels\SocialPub.ClientModels.csproj", "{5E63C68C-0E60-4418-A53A-FF4EF0007080}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrivaPub.ClientModels", "PrivaPub.ClientModels\PrivaPub.ClientModels.csproj", "{5E63C68C-0E60-4418-A53A-FF4EF0007080}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
+8
-8
@@ -2,25 +2,25 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
|
||||||
using SocialPub.ClientModels;
|
using PrivaPub.ClientModels;
|
||||||
using SocialPub.ClientModels.User;
|
using PrivaPub.ClientModels.User;
|
||||||
using SocialPub.Extensions;
|
using PrivaPub.Extensions;
|
||||||
using SocialPub.Resources;
|
using PrivaPub.Resources;
|
||||||
using SocialPub.Services;
|
using PrivaPub.Services;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.Controllers.ClientToServer
|
namespace PrivaPub.Controllers.ClientToServer
|
||||||
{
|
{
|
||||||
[ApiController,
|
[ApiController,
|
||||||
Route("clientapi/admin")]
|
Route("clientapi/admin")]
|
||||||
public class AdminController : ControllerBase
|
public class AdminController : ControllerBase
|
||||||
{
|
{
|
||||||
readonly IRootUsersService RootUsersService;
|
readonly IRootUsersService RootUsersService;
|
||||||
readonly ILogger<UserController> Logger;
|
readonly ILogger<RootUserController> Logger;
|
||||||
readonly IStringLocalizer Localizer;
|
readonly IStringLocalizer Localizer;
|
||||||
|
|
||||||
public AdminController(ILogger<UserController> logger,
|
public AdminController(ILogger<RootUserController> logger,
|
||||||
IStringLocalizer<GenericRes> localizer,
|
IStringLocalizer<GenericRes> localizer,
|
||||||
IRootUsersService rootUsersService)
|
IRootUsersService rootUsersService)
|
||||||
{
|
{
|
||||||
+5
-5
@@ -1,11 +1,11 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
using SocialPub.ClientModels;
|
using PrivaPub.ClientModels;
|
||||||
using SocialPub.ClientModels.Data;
|
using PrivaPub.ClientModels.Data;
|
||||||
using SocialPub.Services.ClientToServer.Public;
|
using PrivaPub.Services.ClientToServer.Public;
|
||||||
|
|
||||||
namespace SocialPub.Controllers.ClientToServer
|
namespace PrivaPub.Controllers.ClientToServer
|
||||||
{
|
{
|
||||||
[ApiController,
|
[ApiController,
|
||||||
Route("clientapi/data")]
|
Route("clientapi/data")]
|
||||||
@@ -41,7 +41,7 @@ namespace SocialPub.Controllers.ClientToServer
|
|||||||
{
|
{
|
||||||
Name = l.NativeName,
|
Name = l.NativeName,
|
||||||
International2Code = l.International2Code
|
International2Code = l.International2Code
|
||||||
}).ToList());
|
}).ToArray());
|
||||||
|
|
||||||
return Ok(viewLanguages);
|
return Ok(viewLanguages);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace SocialPub.Controllers.ClientToServer
|
namespace PrivaPub.Controllers.ClientToServer
|
||||||
{
|
{
|
||||||
[ApiController,
|
[ApiController,
|
||||||
Route("clientapi/moderator")]
|
Route("clientapi/moderator")]
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using PrivaPub.ClientModels;
|
||||||
|
using PrivaPub.Extensions;
|
||||||
|
using PrivaPub.Resources;
|
||||||
|
using PrivaPub.Services.ClientToServer.Private;
|
||||||
|
using PrivaPub.ClientModels.User.Avatar;
|
||||||
|
|
||||||
|
namespace PrivaPub.Controllers.ClientToServer
|
||||||
|
{
|
||||||
|
[ApiController,
|
||||||
|
Route("clientapi/avatar/private"),
|
||||||
|
Authorize(Policy = Policies.IsUser)]
|
||||||
|
public class PrivateAvatarController : ControllerBase
|
||||||
|
{
|
||||||
|
readonly ILogger<PrivateAvatarController> _logger;
|
||||||
|
readonly IPrivateAvatarUsersService _privateAvatarUsersService;
|
||||||
|
readonly IStringLocalizer _localizer;
|
||||||
|
|
||||||
|
public PrivateAvatarController(IPrivateAvatarUsersService privateAvatarUsersService,
|
||||||
|
IStringLocalizer<GenericRes> localizer,
|
||||||
|
ILogger<PrivateAvatarController> logger)
|
||||||
|
{
|
||||||
|
_privateAvatarUsersService = privateAvatarUsersService;
|
||||||
|
_localizer = localizer;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, Route("/clientapi/avatar/private/insert")]
|
||||||
|
public async Task<IActionResult> InsertAvatar(InsertAvatarForm model)
|
||||||
|
{
|
||||||
|
var result = new WebResult();
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
return BadRequest(result.Invalidate(_localizer["Invalid model."]));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
model.RootId = User.GetUserId();
|
||||||
|
result = await _privateAvatarUsersService.InsertAvatar(model);
|
||||||
|
if (!result.IsValid)
|
||||||
|
return StatusCode(result.StatusCode, result);
|
||||||
|
|
||||||
|
return Ok(result.Data);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"{nameof(PrivateAvatarController)}.{nameof(InsertAvatar)}()");
|
||||||
|
return BadRequest(result.Invalidate(ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, Route("/clientapi/avatar/private/update")]
|
||||||
|
public async Task<IActionResult> UpdateAvatar(UpdateAvatarForm model)
|
||||||
|
{
|
||||||
|
var result = new WebResult();
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
return BadRequest(result.Invalidate(_localizer["Invalid model."]));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
model.RootId = User.GetUserId();
|
||||||
|
result = await _privateAvatarUsersService.UpdateAvatar(model);
|
||||||
|
if (!result.IsValid)
|
||||||
|
return StatusCode(result.StatusCode, result);
|
||||||
|
|
||||||
|
return Ok(result.Data);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"{nameof(PrivateAvatarController)}.{nameof(UpdateAvatar)}()");
|
||||||
|
return BadRequest(result.Invalidate(ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-16
@@ -3,32 +3,32 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
|
||||||
using SocialPub.ClientModels;
|
using PrivaPub.ClientModels;
|
||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
using SocialPub.ClientModels.User;
|
using PrivaPub.ClientModels.User;
|
||||||
using SocialPub.Extensions;
|
using PrivaPub.Extensions;
|
||||||
using SocialPub.Models.User;
|
using PrivaPub.Models.User;
|
||||||
using SocialPub.Resources;
|
using PrivaPub.Resources;
|
||||||
using SocialPub.Services;
|
using PrivaPub.Services;
|
||||||
using SocialPub.StaticServices;
|
using PrivaPub.StaticServices;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.Controllers.ClientToServer
|
namespace PrivaPub.Controllers.ClientToServer
|
||||||
{
|
{
|
||||||
[ApiController,
|
[ApiController,
|
||||||
Route("clientapi/user")]
|
Route("clientapi/user")]
|
||||||
public class UserController : ControllerBase
|
public class RootUserController : ControllerBase
|
||||||
{
|
{
|
||||||
readonly IRootUsersService UsersService;
|
readonly IRootUsersService UsersService;
|
||||||
readonly AuthTokenManager AuthTokenManager;
|
readonly AuthTokenManager AuthTokenManager;
|
||||||
readonly ILogger<UserController> Logger;
|
readonly ILogger<RootUserController> Logger;
|
||||||
readonly IStringLocalizer Localizer;
|
readonly IStringLocalizer Localizer;
|
||||||
|
|
||||||
public UserController(IRootUsersService usersService,
|
public RootUserController(IRootUsersService usersService,
|
||||||
AuthTokenManager authTokenManager,
|
AuthTokenManager authTokenManager,
|
||||||
IStringLocalizer<GenericRes> localizer,
|
IStringLocalizer<GenericRes> localizer,
|
||||||
ILogger<UserController> logger)
|
ILogger<RootUserController> logger)
|
||||||
{
|
{
|
||||||
UsersService = usersService;
|
UsersService = usersService;
|
||||||
AuthTokenManager = authTokenManager;
|
AuthTokenManager = authTokenManager;
|
||||||
@@ -51,7 +51,7 @@ namespace SocialPub.Controllers.ClientToServer
|
|||||||
if (!result.IsValid)
|
if (!result.IsValid)
|
||||||
return StatusCode(result.StatusCode, result);
|
return StatusCode(result.StatusCode, result);
|
||||||
|
|
||||||
(var user, var userSettings) = ((RootUser, ViewUserSettings))result.Data;
|
(var user, var userSettings) = ((RootUser, ViewAvatarServer))result.Data;
|
||||||
var jwtUser = AuthTokenManager.GenerateToken(user, userSettings);
|
var jwtUser = AuthTokenManager.GenerateToken(user, userSettings);
|
||||||
Logger.LogInformation(
|
Logger.LogInformation(
|
||||||
$"{nameof(SignUp)}();IP:[{HttpContext.Connection?.RemoteIpAddress}];\nUser-Agent:[{Request.Headers["User-Agent"]}];\nUserId:[{user.ID}]");
|
$"{nameof(SignUp)}();IP:[{HttpContext.Connection?.RemoteIpAddress}];\nUser-Agent:[{Request.Headers["User-Agent"]}];\nUserId:[{user.ID}]");
|
||||||
@@ -78,7 +78,7 @@ namespace SocialPub.Controllers.ClientToServer
|
|||||||
return StatusCode(result.StatusCode, result);
|
return StatusCode(result.StatusCode, result);
|
||||||
|
|
||||||
var (user, userSettings) =
|
var (user, userSettings) =
|
||||||
((RootUser, ViewUserSettings))result.Data;
|
((RootUser, ViewAvatarServer))result.Data;
|
||||||
var jwtUser = AuthTokenManager.GenerateToken(user, userSettings);
|
var jwtUser = AuthTokenManager.GenerateToken(user, userSettings);
|
||||||
Logger.LogInformation(
|
Logger.LogInformation(
|
||||||
$"{nameof(Login)}();IP:[{HttpContext.Connection?.RemoteIpAddress}];\nUser-Agent:[{Request.Headers["User-Agent"]}];\nUserId:[{user.ID}]");
|
$"{nameof(Login)}();IP:[{HttpContext.Connection?.RemoteIpAddress}];\nUser-Agent:[{Request.Headers["User-Agent"]}];\nUserId:[{user.ID}]");
|
||||||
@@ -223,7 +223,7 @@ namespace SocialPub.Controllers.ClientToServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost, Route("/clientapi/user/update/settings"), Authorize(Policy = Policies.IsUser)]
|
[HttpPost, Route("/clientapi/user/update/settings"), Authorize(Policy = Policies.IsUser)]
|
||||||
public async Task<IActionResult> UpdateUserSettings(ViewUserSettings userSettings)
|
public async Task<IActionResult> UpdateUserSettings(ViewAvatarServer userSettings)
|
||||||
{
|
{
|
||||||
var result = new WebResult();
|
var result = new WebResult();
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
+6
-6
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
using SocialPub.Extensions;
|
using PrivaPub.Extensions;
|
||||||
using SocialPub.Models.ActivityPub;
|
using PrivaPub.Models.ActivityPub;
|
||||||
using SocialPub.Models.Group;
|
using PrivaPub.Models.Group;
|
||||||
using SocialPub.Services;
|
using PrivaPub.Services;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace SocialPub.Controllers.ServerToServer
|
namespace PrivaPub.Controllers.ServerToServer
|
||||||
{
|
{
|
||||||
[ApiController,
|
[ApiController,
|
||||||
Route("peasants"), Produces("application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"; charset=utf-8")]
|
Route("peasants"), Produces("application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"; charset=utf-8")]
|
||||||
+6
-6
@@ -1,15 +1,15 @@
|
|||||||
using Markdig;
|
using Markdig;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SocialPub.ClientModels.Resources;
|
using PrivaPub.ClientModels.Resources;
|
||||||
using SocialPub.Extensions;
|
using PrivaPub.Extensions;
|
||||||
using SocialPub.Models.ActivityPub;
|
using PrivaPub.Models.ActivityPub;
|
||||||
using SocialPub.Models.Group;
|
using PrivaPub.Models.Group;
|
||||||
using SocialPub.Services;
|
using PrivaPub.Services;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace SocialPub.Controllers.ServerToServer
|
namespace PrivaPub.Controllers.ServerToServer
|
||||||
{
|
{
|
||||||
[ApiController,
|
[ApiController,
|
||||||
Route("users"), Produces("application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"; charset=utf-8")]
|
Route("users"), Produces("application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"; charset=utf-8")]
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
using MongoDB.Entities;
|
using MongoDB.Entities;
|
||||||
|
|
||||||
using SocialPub.Models.Data;
|
using PrivaPub.Models.Data;
|
||||||
using SocialPub.StaticServices;
|
using PrivaPub.StaticServices;
|
||||||
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace SocialPub.Data
|
namespace PrivaPub.Data
|
||||||
{
|
{
|
||||||
public static class InitDb
|
public static class InitDb
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SocialPub.Data
|
namespace PrivaPub.Data
|
||||||
{
|
{
|
||||||
public class LanguagesRow
|
public class LanguagesRow
|
||||||
{
|
{
|
||||||
File renamed without changes.
@@ -1,15 +1,15 @@
|
|||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
using SocialPub.Services;
|
using PrivaPub.Services;
|
||||||
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace SocialPub.Extensions
|
namespace PrivaPub.Extensions
|
||||||
{
|
{
|
||||||
public static class AddAuthExtension
|
public static class AddAuthExtension
|
||||||
{
|
{
|
||||||
public static AuthenticationBuilder AddSocialPubAuth(this AuthenticationBuilder builder, IConfiguration configuration)
|
public static AuthenticationBuilder AddPrivaPubAuth(this AuthenticationBuilder builder, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
builder.AddJwtBearer(options => {
|
builder.AddJwtBearer(options => {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@@ -7,14 +7,14 @@ using Org.BouncyCastle.Crypto;
|
|||||||
using Org.BouncyCastle.Security;
|
using Org.BouncyCastle.Security;
|
||||||
using Org.BouncyCastle.X509;
|
using Org.BouncyCastle.X509;
|
||||||
|
|
||||||
using SocialPub.ClientModels;
|
using PrivaPub.ClientModels;
|
||||||
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using Org.BouncyCastle.Math;
|
using Org.BouncyCastle.Math;
|
||||||
using SocialPub.Models.User;
|
using PrivaPub.Models.User;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace SocialPub.Extensions
|
namespace PrivaPub.Extensions
|
||||||
{
|
{
|
||||||
public static class Extensions
|
public static class Extensions
|
||||||
{
|
{
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace SocialPub.Extensions
|
namespace PrivaPub.Extensions
|
||||||
{
|
{
|
||||||
public class OperationCancelledExceptionFilter : ExceptionFilterAttribute
|
public class OperationCancelledExceptionFilter : ExceptionFilterAttribute
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using SocialPub.ClientModels;
|
using PrivaPub.ClientModels;
|
||||||
|
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace SocialPub.Extensions
|
namespace PrivaPub.Extensions
|
||||||
{
|
{
|
||||||
public static class StringExtensions
|
public static class StringExtensions
|
||||||
{
|
{
|
||||||
+22
-29
@@ -1,52 +1,45 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.AspNetCore.ResponseCompression;
|
using Microsoft.AspNetCore.ResponseCompression;
|
||||||
|
|
||||||
using SocialPub.ClientModels;
|
using PrivaPub.ClientModels;
|
||||||
using SocialPub.Extensions;
|
using PrivaPub.Extensions;
|
||||||
using SocialPub.Models;
|
using PrivaPub.Models;
|
||||||
using SocialPub.Services;
|
using PrivaPub.Services;
|
||||||
using SocialPub.StaticServices;
|
using PrivaPub.StaticServices;
|
||||||
using NSign.AspNetCore;
|
|
||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using NSign.Providers;
|
using NSign.Providers;
|
||||||
using NSign;
|
using NSign;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using NSign.Signatures;
|
using NSign.Signatures;
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
|
||||||
using NSign.Client;
|
using NSign.Client;
|
||||||
using static NSign.Constants;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using SocialPub.Services.ClientToServer.Public;
|
using PrivaPub.Services.ClientToServer.Public;
|
||||||
|
|
||||||
namespace SocialPub.Middleware
|
namespace PrivaPub.Middleware
|
||||||
{
|
{
|
||||||
public static class SocialPubConfigurations
|
public static class PrivaPubConfigurations
|
||||||
{
|
{
|
||||||
public static IServiceCollection socialPubAppSettingsConfiguration(this IServiceCollection service, IConfiguration configuration)
|
public static IServiceCollection PrivaPubAppSettingsConfiguration(this IServiceCollection service, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
return service
|
return service
|
||||||
.Configure<MongoSettings>(configuration.GetSection(nameof(MongoSettings)))
|
.Configure<MongoSettings>(configuration.GetSection(nameof(MongoSettings)))
|
||||||
.Configure<AppConfiguration>(configuration.GetSection(nameof(AppConfiguration)));
|
.Configure<AppConfiguration>(configuration.GetSection(nameof(AppConfiguration)));
|
||||||
}
|
}
|
||||||
public static IServiceCollection socialPubWorkersConfiguration(this IServiceCollection service)
|
public static IServiceCollection PrivaPubWorkersConfiguration(this IServiceCollection service)
|
||||||
{
|
{
|
||||||
return service;
|
return service;
|
||||||
//.AddHostedService<DiscussionsWorker>()
|
//.AddHostedService<DiscussionsWorker>()
|
||||||
//.AddHostedService<GroupsCleanerWorker>()
|
//.AddHostedService<GroupsCleanerWorker>()
|
||||||
//.AddHostedService<PoliciesCleanerWorker>();
|
//.AddHostedService<PoliciesCleanerWorker>();
|
||||||
}
|
}
|
||||||
public static IServiceCollection socialPubHTTPSignature(this IServiceCollection service, IConfiguration configuration)
|
public static IServiceCollection PrivaPubHTTPSignature(this IServiceCollection service, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
//HTTP CLIENT
|
//HTTP CLIENT
|
||||||
service.Configure<AddDigestOptions>(options => options.WithHash(AddDigestOptions.Hash.Sha256))
|
service.Configure<AddDigestOptions>(options => options.WithHash(AddDigestOptions.Hash.Sha256))
|
||||||
.ConfigureMessageSigningOptions(options =>
|
.ConfigureMessageSigningOptions(options =>
|
||||||
{
|
{
|
||||||
options.SignatureName = "SocialPub";
|
options.SignatureName = "PrivaPub";
|
||||||
options
|
options
|
||||||
.WithMandatoryComponent(SignatureComponent.Path)
|
.WithMandatoryComponent(SignatureComponent.Path)
|
||||||
.WithMandatoryComponent(SignatureComponent.RequestTarget)
|
.WithMandatoryComponent(SignatureComponent.RequestTarget)
|
||||||
@@ -84,7 +77,7 @@ namespace SocialPub.Middleware
|
|||||||
|
|
||||||
// //httpContextAccessor.HttpContext.Request.
|
// //httpContextAccessor.HttpContext.Request.
|
||||||
|
|
||||||
// var cert = memoryCache.GetOrCreate("SocialPub", (cacheEntry) => Extensions.Extensions.GetX509Certificate2("socialPubCert"));
|
// var cert = memoryCache.GetOrCreate("PrivaPub", (cacheEntry) => Extensions.Extensions.GetX509Certificate2("PrivaPubCert"));
|
||||||
// return new RsaPkcs15Sha256SignatureProvider(cert, "anon");
|
// return new RsaPkcs15Sha256SignatureProvider(cert, "anon");
|
||||||
//})
|
//})
|
||||||
//.ConfigureMessageSigningOptions(options =>
|
//.ConfigureMessageSigningOptions(options =>
|
||||||
@@ -109,7 +102,7 @@ namespace SocialPub.Middleware
|
|||||||
// new X509Certificate2(@"path\to\certificate.pfx", "PasswordForPfx"),
|
// new X509Certificate2(@"path\to\certificate.pfx", "PasswordForPfx"),
|
||||||
// "my-cert"));
|
// "my-cert"));
|
||||||
}
|
}
|
||||||
public static IServiceCollection socialPubAuthServicesConfiguration(this IServiceCollection service, IConfiguration configuration)
|
public static IServiceCollection PrivaPubAuthServicesConfiguration(this IServiceCollection service, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
return service
|
return service
|
||||||
.AddAuthorization(options =>
|
.AddAuthorization(options =>
|
||||||
@@ -124,19 +117,19 @@ namespace SocialPub.Middleware
|
|||||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
|
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
})
|
})
|
||||||
.AddSocialPubAuth(configuration)
|
.AddPrivaPubAuth(configuration)
|
||||||
.Services
|
.Services
|
||||||
.AddSingleton<AuthTokenManager>()
|
.AddSingleton<AuthTokenManager>()
|
||||||
.AddSingleton<IPasswordHasher, PasswordHasher>();
|
.AddSingleton<IPasswordHasher, PasswordHasher>();
|
||||||
}
|
}
|
||||||
public static IServiceCollection socialPubInternalizationConfiguration(this IServiceCollection service, IConfiguration configuration)
|
public static IServiceCollection PrivaPubInternalizationConfiguration(this IServiceCollection service, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
return service
|
return service
|
||||||
.AddLocalization()
|
.AddLocalization()
|
||||||
.AddSingleton<RequestLocalizationOptionsService>();
|
.AddSingleton<RequestLocalizationOptionsService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection socialPubOptimizationConfiguration(this IServiceCollection service)
|
public static IServiceCollection PrivaPubOptimizationConfiguration(this IServiceCollection service)
|
||||||
{
|
{
|
||||||
return service.AddResponseCompression(opts =>
|
return service.AddResponseCompression(opts =>
|
||||||
{
|
{
|
||||||
@@ -145,24 +138,24 @@ namespace SocialPub.Middleware
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection socialPubDataBaseConfiguration(this IServiceCollection service)
|
public static IServiceCollection PrivaPubDataBaseConfiguration(this IServiceCollection service)
|
||||||
{
|
{
|
||||||
return service.AddSingleton<DbEntities>();
|
return service.AddSingleton<DbEntities>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection socialPubServicesConfiguration(this IServiceCollection service)
|
public static IServiceCollection PrivaPubServicesConfiguration(this IServiceCollection service)
|
||||||
{
|
{
|
||||||
return service
|
return service
|
||||||
.AddTransient<IDataService, DataService>()
|
.AddTransient<IDataService, DataService>()
|
||||||
.AddTransient<IRootUsersService, RootUsersService>()
|
.AddTransient<IRootUsersService, RootUsersService>()
|
||||||
.AddTransient<IGroupUsersService, GroupUsersService>()
|
.AddTransient<IPublicAvatarUsersService, PublicAvatarUsersService>()
|
||||||
.AddSingleton<AppConfigurationService>()
|
.AddSingleton<AppConfigurationService>()
|
||||||
.AddHttpContextAccessor()
|
.AddHttpContextAccessor()
|
||||||
.AddMemoryCache()
|
.AddMemoryCache()
|
||||||
.AddSingleton<IPasswordHasher, PasswordHasher>();
|
.AddSingleton<IPasswordHasher, PasswordHasher>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection socialPubMiddlewareConfiguration(this IServiceCollection service)
|
public static IServiceCollection PrivaPubMiddlewareConfiguration(this IServiceCollection service)
|
||||||
{
|
{
|
||||||
return service
|
return service
|
||||||
.AddEndpointsApiExplorer()
|
.AddEndpointsApiExplorer()
|
||||||
@@ -203,7 +196,7 @@ namespace SocialPub.Middleware
|
|||||||
}).Services;
|
}).Services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection socialPubCORSConfiguration(this IServiceCollection service)
|
public static IServiceCollection PrivaPubCORSConfiguration(this IServiceCollection service)
|
||||||
{
|
{
|
||||||
return service.AddCors(options =>
|
return service.AddCors(options =>
|
||||||
{
|
{
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
using SocialPub.Models.ActivityPub.Extra;
|
using PrivaPub.Models.ActivityPub.Extra;
|
||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubActivity))]
|
[JsonSerializable(typeof(ActivityPubActivity))]
|
||||||
public class ActivityPubActivity : ActivityPubObject
|
public class ActivityPubActivity : ActivityPubObject
|
||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
using SocialPub.Models.ActivityPub.Extra;
|
using PrivaPub.Models.ActivityPub.Extra;
|
||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubActor))]
|
[JsonSerializable(typeof(ActivityPubActor))]
|
||||||
public class ActivityPubActor : ActivityPubObject
|
public class ActivityPubActor : ActivityPubObject
|
||||||
@@ -34,10 +34,10 @@ namespace SocialPub.Models.ActivityPub
|
|||||||
public bool Discoverable { get; set; } = true;
|
public bool Discoverable { get; set; } = true;
|
||||||
|
|
||||||
[JsonPropertyName("publicKey")]
|
[JsonPropertyName("publicKey")]
|
||||||
public ActivityPubPublicKey PublicKey { get; set; }
|
public ActivityPubPublicKey PublicKey { get; set; } = new();
|
||||||
|
|
||||||
[JsonPropertyName("endpoints")]
|
[JsonPropertyName("endpoints")]
|
||||||
public ActivityPubActorEndpoints Endpoints { get; set; }
|
public ActivityPubActorEndpoints Endpoints { get; set; } = new();
|
||||||
|
|
||||||
[JsonPropertyName("attachment")]
|
[JsonPropertyName("attachment")]
|
||||||
public IEnumerable<ActivityPubAttachment> Attachment { get; set; } = Enumerable.Empty<ActivityPubAttachment>();
|
public IEnumerable<ActivityPubAttachment> Attachment { get; set; } = Enumerable.Empty<ActivityPubAttachment>();
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubCollection))]
|
[JsonSerializable(typeof(ActivityPubCollection))]
|
||||||
public class ActivityPubCollection : ActivityPubObject
|
public class ActivityPubCollection : ActivityPubObject
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubCollectionPage))]
|
[JsonSerializable(typeof(ActivityPubCollectionPage))]
|
||||||
public class ActivityPubCollectionPage : ActivityPubCollection
|
public class ActivityPubCollectionPage : ActivityPubCollection
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubLink))]
|
[JsonSerializable(typeof(ActivityPubLink))]
|
||||||
public class ActivityPubLink : ActivityPubObject
|
public class ActivityPubLink : ActivityPubObject
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
using SocialPub.Models.ActivityPub.Extra;
|
using PrivaPub.Models.ActivityPub.Extra;
|
||||||
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubObject))]
|
[JsonSerializable(typeof(ActivityPubObject))]
|
||||||
public partial class ActivityPubObject
|
public partial class ActivityPubObject
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubOrderedCollection))]
|
[JsonSerializable(typeof(ActivityPubOrderedCollection))]
|
||||||
public class ActivityPubOrderedCollection : ActivityPubCollection
|
public class ActivityPubOrderedCollection : ActivityPubCollection
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubOrderedCollectionPage))]
|
[JsonSerializable(typeof(ActivityPubOrderedCollectionPage))]
|
||||||
public class ActivityPubOrderedCollectionPage : ActivityPubCollection
|
public class ActivityPubOrderedCollectionPage : ActivityPubCollection
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubTombstone))]
|
[JsonSerializable(typeof(ActivityPubTombstone))]
|
||||||
public class ActivityPubTombstone : ActivityPubObject
|
public class ActivityPubTombstone : ActivityPubObject
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub.Extra
|
namespace PrivaPub.Models.ActivityPub.Extra
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
||||||
public class ActivityPubAudience
|
public class ActivityPubAudience
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub.Extra
|
namespace PrivaPub.Models.ActivityPub.Extra
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
||||||
public class ActivityPubIcon
|
public class ActivityPubIcon
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub.Extra
|
namespace PrivaPub.Models.ActivityPub.Extra
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
||||||
public class ActivityPubInstrument
|
public class ActivityPubInstrument
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub.Extra
|
namespace PrivaPub.Models.ActivityPub.Extra
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
||||||
public class ActivityPubOrigin
|
public class ActivityPubOrigin
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SocialPub.Models.ActivityPub.Extra
|
namespace PrivaPub.Models.ActivityPub.Extra
|
||||||
{
|
{
|
||||||
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
[JsonSerializable(typeof(ActivityPubPublicKey))]
|
||||||
public class ActivityPubResult
|
public class ActivityPubResult
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace SocialPub.Models.ActivityPub
|
namespace PrivaPub.Models.ActivityPub
|
||||||
{
|
{
|
||||||
public enum MacroType
|
public enum MacroType
|
||||||
{
|
{
|
||||||
Loaded 100 of 146 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user