Mare 0.9 (#17)
* add jwt expiry * bump api version * start rework permissions * ok so in theory this compiles * update api * update api * update api * update api once more * oh apiii I hate submodules * blabla * we only live to suffer * stop reading my commit messages * nothing to see here move along * update nuget * some rework --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
public class GroupDataComparer : IEqualityComparer<GroupData>
|
||||
{
|
||||
public static GroupDataComparer Instance => _instance;
|
||||
private static GroupDataComparer _instance = new GroupDataComparer();
|
||||
|
||||
private GroupDataComparer() { }
|
||||
private GroupDataComparer()
|
||||
{ }
|
||||
|
||||
public static GroupDataComparer Instance => _instance;
|
||||
|
||||
public bool Equals(GroupData? x, GroupData? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
@@ -16,4 +19,4 @@ public class GroupDataComparer : IEqualityComparer<GroupData>
|
||||
{
|
||||
return obj.GID.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
|
||||
public class GroupDtoComparer : IEqualityComparer<GroupDto>
|
||||
{
|
||||
public static GroupDtoComparer Instance => _instance;
|
||||
private static GroupDtoComparer _instance = new GroupDtoComparer();
|
||||
|
||||
private GroupDtoComparer() { }
|
||||
private GroupDtoComparer()
|
||||
{ }
|
||||
|
||||
public static GroupDtoComparer Instance => _instance;
|
||||
|
||||
public bool Equals(GroupDto? x, GroupDto? y)
|
||||
{
|
||||
|
||||
@@ -4,9 +4,13 @@ namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
public class GroupPairDtoComparer : IEqualityComparer<GroupPairDto>
|
||||
{
|
||||
public static GroupPairDtoComparer Instance => _instance;
|
||||
private static GroupPairDtoComparer _instance = new();
|
||||
private GroupPairDtoComparer() { }
|
||||
|
||||
private GroupPairDtoComparer()
|
||||
{ }
|
||||
|
||||
public static GroupPairDtoComparer Instance => _instance;
|
||||
|
||||
public bool Equals(GroupPairDto? x, GroupPairDto? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
public class UserDataComparer : IEqualityComparer<UserData>
|
||||
{
|
||||
public static UserDataComparer Instance => _instance;
|
||||
private static UserDataComparer _instance = new();
|
||||
|
||||
private UserDataComparer() { }
|
||||
private UserDataComparer()
|
||||
{ }
|
||||
|
||||
public static UserDataComparer Instance => _instance;
|
||||
|
||||
public bool Equals(UserData? x, UserData? y)
|
||||
{
|
||||
@@ -17,4 +19,4 @@ public class UserDataComparer : IEqualityComparer<UserData>
|
||||
{
|
||||
return obj.UID.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,13 @@ namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
public class UserDtoComparer : IEqualityComparer<UserDto>
|
||||
{
|
||||
public static UserDtoComparer Instance => _instance;
|
||||
private static UserDtoComparer _instance = new();
|
||||
private UserDtoComparer() { }
|
||||
|
||||
private UserDtoComparer()
|
||||
{ }
|
||||
|
||||
public static UserDtoComparer Instance => _instance;
|
||||
|
||||
public bool Equals(UserDto? x, UserDto? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
|
||||
6
MareSynchronosAPI/Data/Constants.cs
Normal file
6
MareSynchronosAPI/Data/Constants.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
public class Constants
|
||||
{
|
||||
public const string IndividualKeyword = "//MARE//DIRECT";
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
[Flags]
|
||||
public enum GroupUserInfo
|
||||
public enum GroupPairUserInfo
|
||||
{
|
||||
None = 0x0,
|
||||
IsModerator = 0x2,
|
||||
@@ -4,8 +4,8 @@
|
||||
public enum GroupPermissions
|
||||
{
|
||||
NoneSet = 0x0,
|
||||
DisableAnimations = 0x1,
|
||||
DisableSounds = 0x2,
|
||||
PreferDisableAnimations = 0x1,
|
||||
PreferDisableSounds = 0x2,
|
||||
DisableInvites = 0x4,
|
||||
DisableVFX = 0x8,
|
||||
PreferDisableVFX = 0x8,
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
[Flags]
|
||||
public enum GroupUserPermissions
|
||||
public enum GroupUserPreferredPermissions
|
||||
{
|
||||
NoneSet = 0x0,
|
||||
Paused = 0x1,
|
||||
8
MareSynchronosAPI/Data/Enum/IndividualPairStatus.cs
Normal file
8
MareSynchronosAPI/Data/Enum/IndividualPairStatus.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
public enum IndividualPairStatus
|
||||
{
|
||||
None,
|
||||
OneSided,
|
||||
Bidirectional
|
||||
}
|
||||
@@ -4,9 +4,9 @@
|
||||
public enum UserPermissions
|
||||
{
|
||||
NoneSet = 0,
|
||||
Paired = 1,
|
||||
Paused = 2,
|
||||
DisableAnimations = 4,
|
||||
DisableSounds = 8,
|
||||
DisableVFX = 16,
|
||||
Paused = 1,
|
||||
DisableAnimations = 2,
|
||||
DisableSounds = 4,
|
||||
DisableVFX = 8,
|
||||
Sticky = 16,
|
||||
}
|
||||
@@ -4,36 +4,24 @@ namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class GroupPermissionsExtensions
|
||||
{
|
||||
public static bool IsDisableAnimations(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableAnimations);
|
||||
}
|
||||
|
||||
public static bool IsDisableSounds(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableSounds);
|
||||
}
|
||||
|
||||
public static bool IsDisableInvites(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableInvites);
|
||||
}
|
||||
|
||||
public static bool IsDisableVFX(this GroupPermissions perm)
|
||||
public static bool IsPreferDisableAnimations(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableVFX);
|
||||
return perm.HasFlag(GroupPermissions.PreferDisableAnimations);
|
||||
}
|
||||
|
||||
public static void SetDisableAnimations(this ref GroupPermissions perm, bool set)
|
||||
public static bool IsPreferDisableSounds(this GroupPermissions perm)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.DisableAnimations;
|
||||
else perm &= ~GroupPermissions.DisableAnimations;
|
||||
return perm.HasFlag(GroupPermissions.PreferDisableSounds);
|
||||
}
|
||||
|
||||
public static void SetDisableSounds(this ref GroupPermissions perm, bool set)
|
||||
public static bool IsPreferDisableVFX(this GroupPermissions perm)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.DisableSounds;
|
||||
else perm &= ~GroupPermissions.DisableSounds;
|
||||
return perm.HasFlag(GroupPermissions.PreferDisableVFX);
|
||||
}
|
||||
|
||||
public static void SetDisableInvites(this ref GroupPermissions perm, bool set)
|
||||
@@ -42,9 +30,21 @@ public static class GroupPermissionsExtensions
|
||||
else perm &= ~GroupPermissions.DisableInvites;
|
||||
}
|
||||
|
||||
public static void SetDisableVFX(this ref GroupPermissions perm, bool set)
|
||||
public static void SetPreferDisableAnimations(this ref GroupPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.DisableVFX;
|
||||
else perm &= ~GroupPermissions.DisableVFX;
|
||||
if (set) perm |= GroupPermissions.PreferDisableAnimations;
|
||||
else perm &= ~GroupPermissions.PreferDisableAnimations;
|
||||
}
|
||||
|
||||
public static void SetPreferDisableSounds(this ref GroupPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.PreferDisableSounds;
|
||||
else perm &= ~GroupPermissions.PreferDisableSounds;
|
||||
}
|
||||
|
||||
public static void SetPreferDisableVFX(this ref GroupPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.PreferDisableVFX;
|
||||
else perm &= ~GroupPermissions.PreferDisableVFX;
|
||||
}
|
||||
}
|
||||
@@ -4,25 +4,25 @@ namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class GroupUserInfoExtensions
|
||||
{
|
||||
public static bool IsModerator(this GroupUserInfo info)
|
||||
public static bool IsModerator(this GroupPairUserInfo info)
|
||||
{
|
||||
return info.HasFlag(GroupUserInfo.IsModerator);
|
||||
return info.HasFlag(GroupPairUserInfo.IsModerator);
|
||||
}
|
||||
|
||||
public static bool IsPinned(this GroupUserInfo info)
|
||||
public static bool IsPinned(this GroupPairUserInfo info)
|
||||
{
|
||||
return info.HasFlag(GroupUserInfo.IsPinned);
|
||||
return info.HasFlag(GroupPairUserInfo.IsPinned);
|
||||
}
|
||||
|
||||
public static void SetModerator(this ref GroupUserInfo info, bool isModerator)
|
||||
public static void SetModerator(this ref GroupPairUserInfo info, bool isModerator)
|
||||
{
|
||||
if (isModerator) info |= GroupUserInfo.IsModerator;
|
||||
else info &= ~GroupUserInfo.IsModerator;
|
||||
if (isModerator) info |= GroupPairUserInfo.IsModerator;
|
||||
else info &= ~GroupPairUserInfo.IsModerator;
|
||||
}
|
||||
|
||||
public static void SetPinned(this ref GroupUserInfo info, bool isPinned)
|
||||
public static void SetPinned(this ref GroupPairUserInfo info, bool isPinned)
|
||||
{
|
||||
if (isPinned) info |= GroupUserInfo.IsPinned;
|
||||
else info &= ~GroupUserInfo.IsPinned;
|
||||
if (isPinned) info |= GroupPairUserInfo.IsPinned;
|
||||
else info &= ~GroupPairUserInfo.IsPinned;
|
||||
}
|
||||
}
|
||||
@@ -4,47 +4,47 @@ namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class GroupUserPermissionsExtensions
|
||||
{
|
||||
public static bool IsDisableAnimations(this GroupUserPermissions perm)
|
||||
public static bool IsDisableAnimations(this GroupUserPreferredPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.DisableAnimations);
|
||||
return perm.HasFlag(GroupUserPreferredPermissions.DisableAnimations);
|
||||
}
|
||||
|
||||
public static bool IsDisableSounds(this GroupUserPermissions perm)
|
||||
public static bool IsDisableSounds(this GroupUserPreferredPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.DisableSounds);
|
||||
return perm.HasFlag(GroupUserPreferredPermissions.DisableSounds);
|
||||
}
|
||||
|
||||
public static bool IsPaused(this GroupUserPermissions perm)
|
||||
public static bool IsDisableVFX(this GroupUserPreferredPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.Paused);
|
||||
return perm.HasFlag(GroupUserPreferredPermissions.DisableVFX);
|
||||
}
|
||||
|
||||
public static bool IsDisableVFX(this GroupUserPermissions perm)
|
||||
public static bool IsPaused(this GroupUserPreferredPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.DisableVFX);
|
||||
return perm.HasFlag(GroupUserPreferredPermissions.Paused);
|
||||
}
|
||||
|
||||
public static void SetDisableAnimations(this ref GroupUserPermissions perm, bool set)
|
||||
public static void SetDisableAnimations(this ref GroupUserPreferredPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.DisableAnimations;
|
||||
else perm &= ~GroupUserPermissions.DisableAnimations;
|
||||
if (set) perm |= GroupUserPreferredPermissions.DisableAnimations;
|
||||
else perm &= ~GroupUserPreferredPermissions.DisableAnimations;
|
||||
}
|
||||
|
||||
public static void SetDisableSounds(this ref GroupUserPermissions perm, bool set)
|
||||
public static void SetDisableSounds(this ref GroupUserPreferredPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.DisableSounds;
|
||||
else perm &= ~GroupUserPermissions.DisableSounds;
|
||||
if (set) perm |= GroupUserPreferredPermissions.DisableSounds;
|
||||
else perm &= ~GroupUserPreferredPermissions.DisableSounds;
|
||||
}
|
||||
|
||||
public static void SetPaused(this ref GroupUserPermissions perm, bool set)
|
||||
public static void SetDisableVFX(this ref GroupUserPreferredPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.Paused;
|
||||
else perm &= ~GroupUserPermissions.Paused;
|
||||
if (set) perm |= GroupUserPreferredPermissions.DisableVFX;
|
||||
else perm &= ~GroupUserPreferredPermissions.DisableVFX;
|
||||
}
|
||||
|
||||
public static void SetDisableVFX(this ref GroupUserPermissions perm, bool set)
|
||||
public static void SetPaused(this ref GroupUserPreferredPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.DisableVFX;
|
||||
else perm &= ~GroupUserPermissions.DisableVFX;
|
||||
if (set) perm |= GroupUserPreferredPermissions.Paused;
|
||||
else perm &= ~GroupUserPreferredPermissions.Paused;
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,6 @@ namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class UserPermissionsExtensions
|
||||
{
|
||||
public static bool IsPaired(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.Paired);
|
||||
}
|
||||
|
||||
public static bool IsPaused(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.Paused);
|
||||
}
|
||||
|
||||
public static bool IsDisableAnimations(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.DisableAnimations);
|
||||
@@ -29,16 +19,14 @@ public static class UserPermissionsExtensions
|
||||
return perm.HasFlag(UserPermissions.DisableVFX);
|
||||
}
|
||||
|
||||
public static void SetPaired(this ref UserPermissions perm, bool paired)
|
||||
public static bool IsPaused(this UserPermissions perm)
|
||||
{
|
||||
if (paired) perm |= UserPermissions.Paired;
|
||||
else perm &= ~UserPermissions.Paired;
|
||||
return perm.HasFlag(UserPermissions.Paused);
|
||||
}
|
||||
|
||||
public static void SetPaused(this ref UserPermissions perm, bool paused)
|
||||
public static bool IsSticky(this UserPermissions perm)
|
||||
{
|
||||
if (paused) perm |= UserPermissions.Paused;
|
||||
else perm &= ~UserPermissions.Paused;
|
||||
return perm.HasFlag(UserPermissions.Sticky);
|
||||
}
|
||||
|
||||
public static void SetDisableAnimations(this ref UserPermissions perm, bool set)
|
||||
@@ -58,4 +46,16 @@ public static class UserPermissionsExtensions
|
||||
if (set) perm |= UserPermissions.DisableVFX;
|
||||
else perm &= ~UserPermissions.DisableVFX;
|
||||
}
|
||||
|
||||
public static void SetPaused(this ref UserPermissions perm, bool paused)
|
||||
{
|
||||
if (paused) perm |= UserPermissions.Paused;
|
||||
else perm &= ~UserPermissions.Paused;
|
||||
}
|
||||
|
||||
public static void SetSticky(this ref UserPermissions perm, bool sticky)
|
||||
{
|
||||
if (sticky) perm |= UserPermissions.Sticky;
|
||||
else perm &= ~UserPermissions.Sticky;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using MessagePack;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
@@ -24,7 +23,7 @@ public class FileReplacementData
|
||||
|
||||
[JsonIgnore]
|
||||
public Lazy<string> DataHash { get; }
|
||||
public string FileSwapPath { get; set; } = string.Empty;
|
||||
public string[] GamePaths { get; set; } = Array.Empty<string>();
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
public string FileSwapPath { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -7,4 +7,4 @@ public record GroupData(string GID, string? Alias = null)
|
||||
{
|
||||
[IgnoreMember]
|
||||
public string AliasOrGID => string.IsNullOrWhiteSpace(Alias) ? GID : Alias;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ public record ConnectionDto(UserData User)
|
||||
public bool IsAdmin { get; set; }
|
||||
public bool IsModerator { get; set; }
|
||||
public ServerInfo ServerInfo { get; set; } = new();
|
||||
public DefaultPermissionsDto DefaultPreferredPermissions { get; set; } = new();
|
||||
}
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
@@ -21,4 +22,4 @@ public record ServerInfo
|
||||
public int MaxGroupsCreatedByUser { get; set; }
|
||||
public int MaxGroupsJoinedByUser { get; set; }
|
||||
public Uri FileServerAddress { get; set; } = new Uri("http://nonemptyuri");
|
||||
}
|
||||
}
|
||||
|
||||
15
MareSynchronosAPI/Dto/DefaultPermissionsDto.cs
Normal file
15
MareSynchronosAPI/Dto/DefaultPermissionsDto.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record DefaultPermissionsDto
|
||||
{
|
||||
public bool DisableIndividualAnimations { get; set; } = false;
|
||||
public bool DisableIndividualSounds { get; set; } = false;
|
||||
public bool DisableIndividualVFX { get; set; } = false;
|
||||
public bool DisableGroupAnimations { get; set; } = false;
|
||||
public bool DisableGroupSounds { get; set; } = false;
|
||||
public bool DisableGroupVFX { get; set; } = false;
|
||||
public bool IndividualIsSticky { get; set; } = true;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public interface ITransferFileDto
|
||||
{
|
||||
string ForbiddenBy { get; set; }
|
||||
string Hash { get; set; }
|
||||
bool IsForbidden { get; set; }
|
||||
string ForbiddenBy { get; set; }
|
||||
}
|
||||
@@ -5,8 +5,10 @@ using MessagePack;
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupFullInfoDto(GroupData Group, UserData Owner, GroupPermissions GroupPermissions, GroupUserPermissions GroupUserPermissions, GroupUserInfo GroupUserInfo) : GroupInfoDto(Group, Owner, GroupPermissions)
|
||||
public record GroupFullInfoDto(GroupData Group, UserData Owner, GroupPermissions GroupPermissions,
|
||||
GroupUserPreferredPermissions GroupUserPermissions, GroupPairUserInfo GroupUserInfo,
|
||||
Dictionary<string, GroupPairUserInfo> GroupPairUserInfos) : GroupInfoDto(Group, Owner, GroupPermissions)
|
||||
{
|
||||
public GroupUserPermissions GroupUserPermissions { get; set; } = GroupUserPermissions;
|
||||
public GroupUserInfo GroupUserInfo { get; set; } = GroupUserInfo;
|
||||
public GroupUserPreferredPermissions GroupUserPermissions { get; set; } = GroupUserPermissions;
|
||||
public GroupPairUserInfo GroupUserInfo { get; set; } = GroupUserInfo;
|
||||
}
|
||||
@@ -14,3 +14,5 @@ public record GroupInfoDto(GroupData Group, UserData Owner, GroupPermissions Gro
|
||||
public string? OwnerAlias => Owner.Alias;
|
||||
public string OwnerAliasOrUID => Owner.AliasOrUID;
|
||||
}
|
||||
|
||||
public record GroupJoinInfoDto(GroupData Group, UserData Owner, GroupPermissions GroupPermissions, bool Success) : GroupInfoDto(Group, Owner, GroupPermissions);
|
||||
11
MareSynchronosAPI/Dto/Group/GroupJoinDto.cs
Normal file
11
MareSynchronosAPI/Dto/Group/GroupJoinDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPasswordDto(GroupData Group, string Password) : GroupDto(Group);
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupJoinDto(GroupData Group, string Password, GroupUserPreferredPermissions GroupUserPreferredPermissions) : GroupPasswordDto(Group, Password);
|
||||
@@ -9,4 +9,4 @@ public record GroupPairDto(GroupData Group, UserData User) : GroupDto(Group)
|
||||
public string UID => User.UID;
|
||||
public string? UserAlias => User.Alias;
|
||||
public string UserAliasOrUID => User.AliasOrUID;
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,4 @@ using MessagePack;
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPairFullInfoDto(GroupData Group, UserData User, GroupUserInfo GroupPairStatusInfo, GroupUserPermissions GroupUserPermissions) : GroupPairDto(Group, User)
|
||||
{
|
||||
public GroupUserInfo GroupPairStatusInfo { get; set; } = GroupPairStatusInfo;
|
||||
public GroupUserPermissions GroupUserPermissions { get; set; } = GroupUserPermissions;
|
||||
}
|
||||
public record GroupPairFullInfoDto(GroupData Group, UserData User, UserPermissions SelfToOtherPermissions, UserPermissions OtherToSelfPermissions) : GroupPairDto(Group, User);
|
||||
@@ -5,4 +5,4 @@ using MessagePack;
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPairUserInfoDto(GroupData Group, UserData User, GroupUserInfo GroupUserInfo) : GroupPairDto(Group, User);
|
||||
public record GroupPairUserInfoDto(GroupData Group, UserData User, GroupPairUserInfo GroupUserInfo) : GroupPairDto(Group, User);
|
||||
@@ -5,4 +5,4 @@ using MessagePack;
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPairUserPermissionDto(GroupData Group, UserData User, GroupUserPermissions GroupPairPermissions) : GroupPairDto(Group, User);
|
||||
public record GroupPairUserPermissionDto(GroupData Group, UserData User, GroupUserPreferredPermissions GroupPairPermissions) : GroupPairDto(Group, User);
|
||||
@@ -1,7 +0,0 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPasswordDto(GroupData Group, string Password) : GroupDto(Group);
|
||||
@@ -5,4 +5,4 @@ using MessagePack;
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPermissionDto(GroupData Group, GroupPermissions Permissions) : GroupDto(Group);
|
||||
public record GroupPermissionDto(GroupData Group, GroupPermissions Permissions) : GroupDto(Group);
|
||||
@@ -5,8 +5,17 @@ using MessagePack;
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserPairDto(UserData User, UserPermissions OwnPermissions, UserPermissions OtherPermissions) : UserDto(User)
|
||||
public record UserFullPairDto(UserData User, IndividualPairStatus IndividualPairStatus, List<string> Groups, UserPermissions OwnPermissions, UserPermissions OtherPermissions) : UserDto(User)
|
||||
{
|
||||
public UserPermissions OwnPermissions { get; set; } = OwnPermissions;
|
||||
public UserPermissions OtherPermissions { get; set; } = OtherPermissions;
|
||||
public IndividualPairStatus IndividualPairStatus { get; set; } = IndividualPairStatus;
|
||||
}
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserPairDto(UserData User, IndividualPairStatus IndividualPairStatus, UserPermissions OwnPermissions, UserPermissions OtherPermissions) : UserDto(User)
|
||||
{
|
||||
public UserPermissions OwnPermissions { get; set; } = OwnPermissions;
|
||||
public UserPermissions OtherPermissions { get; set; } = OtherPermissions;
|
||||
public IndividualPairStatus IndividualPairStatus { get; set; } = IndividualPairStatus;
|
||||
}
|
||||
@@ -5,4 +5,7 @@ using MessagePack;
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserPermissionsDto(UserData User, UserPermissions Permissions) : UserDto(User);
|
||||
public record UserPermissionsDto(UserData User, UserPermissions Permissions) : UserDto(User);
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserIndividualPairStatusDto(UserData User, IndividualPairStatus IndividualPairStatus) : UserDto(User);
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MessagePack.Annotations" Version="2.5.108" />
|
||||
<PackageReference Include="MessagePack.Annotations" Version="2.5.129" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -5,5 +5,7 @@ public class MareAuth
|
||||
|
||||
public const string Auth = "/auth";
|
||||
public const string Auth_CreateIdent = "createWithIdent";
|
||||
public const string Auth_RenewToken = "renewToken";
|
||||
public static Uri AuthFullPath(Uri baseUri) => new Uri(baseUri, Auth + "/" + Auth_CreateIdent);
|
||||
public static Uri RenewTokenFullPath(Uri baseUri) => new Uri(baseUri, Auth + "/" + Auth_RenewToken);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace MareSynchronos.API.SignalR;
|
||||
|
||||
public interface IMareHub
|
||||
{
|
||||
const int ApiVersion = 26;
|
||||
const int ApiVersion = 27;
|
||||
const string Path = "/mare";
|
||||
|
||||
Task<bool> CheckClientHealth();
|
||||
@@ -18,8 +18,6 @@ public interface IMareHub
|
||||
|
||||
Task Client_GroupDelete(GroupDto groupDto);
|
||||
|
||||
Task Client_GroupPairChangePermissions(GroupPairUserPermissionDto permissionDto);
|
||||
|
||||
Task Client_GroupPairChangeUserInfo(GroupPairUserInfoDto userInfo);
|
||||
|
||||
Task Client_GroupPairJoined(GroupPairFullInfoDto groupPairInfoDto);
|
||||
@@ -48,10 +46,15 @@ public interface IMareHub
|
||||
|
||||
Task Client_UserUpdateOtherPairPermissions(UserPermissionsDto dto);
|
||||
|
||||
Task Client_UpdateUserIndividualPairStatusDto(UserIndividualPairStatusDto dto);
|
||||
|
||||
Task Client_UserUpdateProfile(UserDto dto);
|
||||
|
||||
Task Client_UserUpdateSelfPairPermissions(UserPermissionsDto dto);
|
||||
|
||||
Task Client_UserUpdateDefaultPermissions(DefaultPermissionsDto dto);
|
||||
Task Client_GroupChangeUserPairPermissions(GroupPairUserPermissionDto dto);
|
||||
|
||||
Task<ConnectionDto> GetConnectionDto();
|
||||
|
||||
Task GroupBanUser(GroupPairDto dto, string reason);
|
||||
@@ -66,7 +69,7 @@ public interface IMareHub
|
||||
|
||||
Task GroupClear(GroupDto group);
|
||||
|
||||
Task<GroupPasswordDto> GroupCreate();
|
||||
Task<GroupJoinDto> GroupCreate();
|
||||
|
||||
Task<List<string>> GroupCreateTempInvite(GroupDto group, int amount);
|
||||
|
||||
@@ -74,7 +77,8 @@ public interface IMareHub
|
||||
|
||||
Task<List<BannedGroupUserDto>> GroupGetBannedUsers(GroupDto group);
|
||||
|
||||
Task<bool> GroupJoin(GroupPasswordDto passwordedGroup);
|
||||
Task<GroupJoinInfoDto> GroupJoin(GroupPasswordDto passwordedGroup);
|
||||
Task<bool> GroupJoinFinalize(GroupJoinDto passwordedGroup);
|
||||
|
||||
Task GroupLeave(GroupDto group);
|
||||
|
||||
@@ -84,8 +88,6 @@ public interface IMareHub
|
||||
|
||||
Task<List<GroupFullInfoDto>> GroupsGetAll();
|
||||
|
||||
Task<List<GroupPairFullInfoDto>> GroupsGetUsersInGroup(GroupDto group);
|
||||
|
||||
Task GroupUnbanUser(GroupPairDto groupPair);
|
||||
|
||||
Task UserAddPair(UserDto user);
|
||||
@@ -94,7 +96,7 @@ public interface IMareHub
|
||||
|
||||
Task<List<OnlineUserIdentDto>> UserGetOnlinePairs();
|
||||
|
||||
Task<List<UserPairDto>> UserGetPairedClients();
|
||||
Task<List<UserFullPairDto>> UserGetPairedClients();
|
||||
|
||||
Task<UserProfileDto> UserGetProfile(UserDto dto);
|
||||
|
||||
@@ -107,4 +109,5 @@ public interface IMareHub
|
||||
Task UserSetPairPermissions(UserPermissionsDto userPermissions);
|
||||
|
||||
Task UserSetProfile(UserProfileDto userDescription);
|
||||
Task UserUpdateDefaultPermissions(DefaultPermissionsDto defaultPermissionsDto);
|
||||
}
|
||||
@@ -13,8 +13,6 @@ public interface IMareHubClient : IMareHub
|
||||
|
||||
void OnGroupDelete(Action<GroupDto> act);
|
||||
|
||||
void OnGroupPairChangePermissions(Action<GroupPairUserPermissionDto> act);
|
||||
|
||||
void OnGroupPairChangeUserInfo(Action<GroupPairUserInfoDto> act);
|
||||
|
||||
void OnGroupPairJoined(Action<GroupPairFullInfoDto> act);
|
||||
@@ -46,4 +44,10 @@ public interface IMareHubClient : IMareHub
|
||||
void OnUserUpdateProfile(Action<UserDto> act);
|
||||
|
||||
void OnUserUpdateSelfPairPermissions(Action<UserPermissionsDto> act);
|
||||
|
||||
void OnUserDefaultPermissionUpdate(Action<DefaultPermissionsDto> act);
|
||||
|
||||
void OnUpdateUserIndividualPairStatusDto(Action<UserIndividualPairStatusDto> act);
|
||||
|
||||
void OnGroupChangeUserPairPermissions(Action<GroupPairUserPermissionDto> act);
|
||||
}
|
||||
Reference in New Issue
Block a user