minor stylefixes
This commit is contained in:
@@ -64,7 +64,7 @@ public partial class MareHub
|
||||
return await _dbContext.BannedUsers.AsNoTracking().Select(b => new BannedUserDto()
|
||||
{
|
||||
CharacterHash = b.CharacterIdentification,
|
||||
Reason = b.Reason
|
||||
Reason = b.Reason,
|
||||
}).ToListAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public partial class MareHub
|
||||
return await _dbContext.ForbiddenUploadEntries.AsNoTracking().Select(b => new ForbiddenFileDto()
|
||||
{
|
||||
Hash = b.Hash,
|
||||
ForbiddenBy = b.ForbiddenBy
|
||||
ForbiddenBy = b.ForbiddenBy,
|
||||
}).ToListAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public partial class MareHub
|
||||
CharacterNameHash = b.Ident,
|
||||
UID = b.User.UID,
|
||||
IsModerator = b.User.IsModerator,
|
||||
IsAdmin = b.User.IsAdmin
|
||||
IsAdmin = b.User.IsAdmin,
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public partial class MareHub
|
||||
await _dbContext.BannedUsers.AddAsync(new Banned
|
||||
{
|
||||
CharacterIdentification = dto.CharacterHash,
|
||||
Reason = dto.Reason
|
||||
Reason = dto.Reason,
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public partial class MareHub
|
||||
await _dbContext.ForbiddenUploadEntries.AddAsync(new ForbiddenUploadEntry
|
||||
{
|
||||
Hash = dto.Hash,
|
||||
ForbiddenBy = dto.ForbiddenBy
|
||||
ForbiddenBy = dto.ForbiddenBy,
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public partial class MareHub
|
||||
request.Hash.AddRange(ownFiles.Select(f => f.Hash));
|
||||
Metadata headers = new Metadata()
|
||||
{
|
||||
{ "Authorization", "Bearer " + _generator.Token }
|
||||
{ "Authorization", "Bearer " + _generator.Token },
|
||||
};
|
||||
_ = await _fileServiceClient.DeleteFilesAsync(request, headers).ConfigureAwait(false);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public partial class MareHub
|
||||
IsForbidden = forbiddenFile != null,
|
||||
Hash = file.Hash,
|
||||
Size = file.Size,
|
||||
Url = baseUrl.ToString()
|
||||
Url = baseUrl.ToString(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public partial class MareHub
|
||||
{
|
||||
ForbiddenBy = forbiddenFiles[file].ForbiddenBy,
|
||||
Hash = file,
|
||||
IsForbidden = true
|
||||
IsForbidden = true,
|
||||
};
|
||||
|
||||
continue;
|
||||
@@ -119,7 +119,7 @@ public partial class MareHub
|
||||
{
|
||||
Hash = file,
|
||||
Uploaded = false,
|
||||
Uploader = uploader
|
||||
Uploader = uploader,
|
||||
});
|
||||
|
||||
notCoveredFiles[file] = new UploadFileDto()
|
||||
@@ -210,7 +210,7 @@ public partial class MareHub
|
||||
|
||||
Metadata headers = new Metadata()
|
||||
{
|
||||
{ "Authorization", "Bearer " + _generator.Token }
|
||||
{ "Authorization", "Bearer " + _generator.Token },
|
||||
};
|
||||
var streamingCall = _fileServiceClient.UploadFile(headers);
|
||||
using var tempFileStream = new FileStream(tempFileName, FileMode.Open, FileAccess.Read);
|
||||
@@ -223,7 +223,7 @@ public partial class MareHub
|
||||
{
|
||||
FileData = ByteString.CopyFrom(data, 0, readBytes),
|
||||
Hash = computedHashString,
|
||||
Uploader = UserUID
|
||||
Uploader = UserUID,
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
await streamingCall.RequestStream.CompleteAsync().ConfigureAwait(false);
|
||||
|
||||
@@ -47,7 +47,7 @@ public partial class MareHub
|
||||
UID = Convert.ToString(userPair.OtherUserUID),
|
||||
GID = "DIRECT",
|
||||
PauseStateSelf = userPair.IsPaused,
|
||||
PauseStateOther = otherUserPair.IsPaused
|
||||
PauseStateOther = otherUserPair.IsPaused,
|
||||
})
|
||||
.Union(
|
||||
(from userGroupPair in _dbContext.GroupPairs
|
||||
@@ -69,7 +69,7 @@ public partial class MareHub
|
||||
{
|
||||
UID = key,
|
||||
PauseStates = g.Select(p => new PauseState() { GID = string.Equals(p.GID, "DIRECT", StringComparison.Ordinal) ? null : p.GID, IsSelfPaused = p.PauseStateSelf, IsOtherPaused = p.PauseStateOther })
|
||||
.ToList()
|
||||
.ToList(),
|
||||
}, StringComparer.Ordinal).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public partial class MareHub
|
||||
GID = gid,
|
||||
HashedPassword = hashedPw,
|
||||
InvitesEnabled = true,
|
||||
OwnerUID = UserUID
|
||||
OwnerUID = UserUID,
|
||||
};
|
||||
|
||||
GroupPair initialPair = new()
|
||||
@@ -46,7 +46,7 @@ public partial class MareHub
|
||||
GroupGID = newGroup.GID,
|
||||
GroupUserUID = UserUID,
|
||||
IsPaused = false,
|
||||
IsPinned = true
|
||||
IsPinned = true,
|
||||
};
|
||||
|
||||
await _dbContext.Groups.AddAsync(newGroup).ConfigureAwait(false);
|
||||
@@ -61,7 +61,7 @@ public partial class MareHub
|
||||
OwnedBy = string.IsNullOrEmpty(self.Alias) ? self.UID : self.Alias,
|
||||
IsDeleted = false,
|
||||
IsPaused = false,
|
||||
InvitesEnabled = true
|
||||
InvitesEnabled = true,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
_logger.LogCallInfo(MareHubLogger.Args(gid));
|
||||
@@ -69,7 +69,7 @@ public partial class MareHub
|
||||
return new GroupCreatedDto()
|
||||
{
|
||||
GID = newGroup.GID,
|
||||
Password = passwd
|
||||
Password = passwd,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public partial class MareHub
|
||||
GroupPair newPair = new()
|
||||
{
|
||||
GroupGID = group.GID,
|
||||
GroupUserUID = UserUID
|
||||
GroupUserUID = UserUID,
|
||||
};
|
||||
|
||||
await _dbContext.GroupPairs.AddAsync(newPair).ConfigureAwait(false);
|
||||
@@ -206,7 +206,7 @@ public partial class MareHub
|
||||
IsDeleted = false,
|
||||
IsPaused = false,
|
||||
Alias = group.Alias,
|
||||
InvitesEnabled = true
|
||||
InvitesEnabled = true,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
var self = _dbContext.Users.Single(u => u.UID == UserUID);
|
||||
@@ -272,7 +272,7 @@ public partial class MareHub
|
||||
{
|
||||
ExpirationDate = DateTime.UtcNow.AddDays(1),
|
||||
GroupGID = group.GID,
|
||||
Invite = hashedInvite
|
||||
Invite = hashedInvite,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ public partial class MareHub
|
||||
await Clients.User(UserUID).Client_GroupChange(new GroupDto()
|
||||
{
|
||||
GID = group.GID,
|
||||
IsDeleted = true
|
||||
IsDeleted = true,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
bool ownerHasLeft = string.Equals(group.OwnerUID, UserUID, StringComparison.Ordinal);
|
||||
@@ -325,7 +325,7 @@ public partial class MareHub
|
||||
{
|
||||
GID = group.GID,
|
||||
OwnedBy = groupHasMigrated.Item2,
|
||||
Alias = null
|
||||
Alias = null,
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
@@ -335,7 +335,7 @@ public partial class MareHub
|
||||
await Clients.Users(groupPairsWithoutSelf.Select(p => p.GroupUserUID)).Client_GroupChange(new GroupDto()
|
||||
{
|
||||
GID = group.GID,
|
||||
IsDeleted = true
|
||||
IsDeleted = true,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
await SendGroupDeletedToAll(groupPairs).ConfigureAwait(false);
|
||||
@@ -388,7 +388,7 @@ public partial class MareHub
|
||||
await Clients.User(UserUID).Client_GroupChange(new GroupDto
|
||||
{
|
||||
GID = gid,
|
||||
IsPaused = isPaused
|
||||
IsPaused = isPaused,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
var allUserPairs = await GetAllPairedClientsWithPauseState().ConfigureAwait(false);
|
||||
@@ -545,7 +545,7 @@ public partial class MareHub
|
||||
await Clients.User(uid).Client_GroupChange(new GroupDto()
|
||||
{
|
||||
GID = gid,
|
||||
IsModerator = isGroupModerator
|
||||
IsModerator = isGroupModerator,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
await Clients.Users(groupPairs.Where(p => !string.Equals(p.GroupUserUID, uid, StringComparison.Ordinal))
|
||||
@@ -553,7 +553,7 @@ public partial class MareHub
|
||||
{
|
||||
GroupGID = gid,
|
||||
IsModerator = isGroupModerator,
|
||||
UserUID = uid
|
||||
UserUID = uid,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
_logger.LogCallInfo(MareHubLogger.Args(gid, uid, isGroupModerator, "Success"));
|
||||
@@ -590,14 +590,14 @@ public partial class MareHub
|
||||
GID = gid,
|
||||
OwnedBy = string.IsNullOrEmpty(group.Owner.Alias) ? group.Owner.UID : group.Owner.Alias,
|
||||
IsModerator = false,
|
||||
Alias = null
|
||||
Alias = null,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
await Clients.Users(groupPairs).Client_GroupChange(new GroupDto()
|
||||
{
|
||||
GID = gid,
|
||||
OwnedBy = string.IsNullOrEmpty(group.Owner.Alias) ? group.Owner.UID : group.Owner.Alias,
|
||||
Alias = null
|
||||
Alias = null,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
await Clients.Users(groupPairs.Where(p => !string.Equals(p, uid, StringComparison.Ordinal))).Client_GroupUserChange(new GroupPairDto()
|
||||
@@ -605,7 +605,7 @@ public partial class MareHub
|
||||
GroupGID = gid,
|
||||
UserUID = uid,
|
||||
IsPinned = true,
|
||||
IsModerator = false
|
||||
IsModerator = false,
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -647,7 +647,7 @@ public partial class MareHub
|
||||
{
|
||||
GroupGID = gid,
|
||||
UserUID = uid,
|
||||
IsPinned = isPinned
|
||||
IsPinned = isPinned,
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ public partial class MareHub
|
||||
{
|
||||
GroupGID = pair.GroupGID,
|
||||
IsRemoved = true,
|
||||
UserUID = pair.GroupUserUID
|
||||
UserUID = pair.GroupUserUID,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
var pairIdent = await GetIdentFromUidFromRedis(pair.GroupUserUID).ConfigureAwait(false);
|
||||
|
||||
@@ -41,7 +41,7 @@ public partial class MareHub
|
||||
await Clients.User(pair.User.UID).Client_UserUpdateClientPairs(new ClientPairDto()
|
||||
{
|
||||
OtherUID = UserUID,
|
||||
IsRemoved = true
|
||||
IsRemoved = true,
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ public partial class MareHub
|
||||
on new
|
||||
{
|
||||
user = userToOther.UserUID,
|
||||
other = userToOther.OtherUserUID
|
||||
other = userToOther.OtherUserUID,
|
||||
|
||||
} equals new
|
||||
{
|
||||
user = otherToUser.OtherUserUID,
|
||||
other = otherToUser.UserUID
|
||||
other = otherToUser.UserUID,
|
||||
} into leftJoin
|
||||
from otherEntry in leftJoin.DefaultIfEmpty()
|
||||
where
|
||||
@@ -95,7 +95,7 @@ public partial class MareHub
|
||||
userToOther.IsPaused,
|
||||
OtherIsPaused = otherEntry != null && otherEntry.IsPaused,
|
||||
userToOther.OtherUserUID,
|
||||
IsSynced = otherEntry != null
|
||||
IsSynced = otherEntry != null,
|
||||
};
|
||||
|
||||
return (await query.AsNoTracking().ToListAsync().ConfigureAwait(false)).Select(f => new ClientPairDto()
|
||||
@@ -104,7 +104,7 @@ public partial class MareHub
|
||||
IsPaused = f.IsPaused,
|
||||
OtherUID = f.OtherUserUID,
|
||||
IsSynced = f.IsSynced,
|
||||
IsPausedFromOthers = f.OtherIsPaused
|
||||
IsPausedFromOthers = f.OtherIsPaused,
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public partial class MareHub
|
||||
{
|
||||
IsPaused = false,
|
||||
OtherUser = otherUser,
|
||||
User = user
|
||||
User = user,
|
||||
};
|
||||
await _dbContext.ClientPairs.AddAsync(wl).ConfigureAwait(false);
|
||||
await _dbContext.SaveChangesAsync().ConfigureAwait(false);
|
||||
@@ -204,7 +204,7 @@ public partial class MareHub
|
||||
OtherUID = otherUser.UID,
|
||||
IsPaused = false,
|
||||
IsPausedFromOthers = otherEntry?.IsPaused ?? false,
|
||||
IsSynced = otherEntry != null
|
||||
IsSynced = otherEntry != null,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
// if there's no opposite entry do nothing
|
||||
@@ -222,7 +222,7 @@ public partial class MareHub
|
||||
OtherUID = user.UID,
|
||||
IsPaused = otherEntry.IsPaused,
|
||||
IsPausedFromOthers = false,
|
||||
IsSynced = true
|
||||
IsSynced = true,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
// get own ident and all pairs
|
||||
@@ -260,7 +260,7 @@ public partial class MareHub
|
||||
OtherUID = otherUserUid,
|
||||
IsPaused = isPaused,
|
||||
IsPausedFromOthers = otherEntry?.IsPaused ?? false,
|
||||
IsSynced = otherEntry != null
|
||||
IsSynced = otherEntry != null,
|
||||
}).ConfigureAwait(false);
|
||||
if (otherEntry != null)
|
||||
{
|
||||
@@ -269,7 +269,7 @@ public partial class MareHub
|
||||
OtherUID = UserUID,
|
||||
IsPaused = otherEntry.IsPaused,
|
||||
IsPausedFromOthers = isPaused,
|
||||
IsSynced = true
|
||||
IsSynced = true,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
var otherCharaIdent = await GetIdentFromUidFromRedis(pair.OtherUserUID).ConfigureAwait(false);
|
||||
@@ -304,7 +304,7 @@ public partial class MareHub
|
||||
.Client_UserUpdateClientPairs(new ClientPairDto()
|
||||
{
|
||||
OtherUID = otherUserUid,
|
||||
IsRemoved = true
|
||||
IsRemoved = true,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
// check if opposite entry exists
|
||||
@@ -321,7 +321,7 @@ public partial class MareHub
|
||||
{
|
||||
OtherUID = UserUID,
|
||||
IsPausedFromOthers = false,
|
||||
IsSynced = false
|
||||
IsSynced = false,
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
// if the other user had paused the user the state will be offline for either, do nothing
|
||||
|
||||
@@ -78,8 +78,8 @@ public partial class MareHub : Hub<IMareHub>, IMareHub
|
||||
MaxGroupsCreatedByUser = _maxExistingGroupsByUser,
|
||||
ShardName = _shardName,
|
||||
MaxGroupsJoinedByUser = _maxJoinedGroupsByUser,
|
||||
MaxGroupUserCount = _maxGroupUserCount
|
||||
}
|
||||
MaxGroupUserCount = _maxGroupUserCount,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public partial class MareHub : Hub<IMareHub>, IMareHub
|
||||
{
|
||||
return new ConnectionDto()
|
||||
{
|
||||
ServerVersion = IMareHub.ApiVersion
|
||||
ServerVersion = IMareHub.ApiVersion,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SignalRLimitFilter : IHubFilter
|
||||
ClientIp = ip,
|
||||
Path = invocationContext.HubMethodName,
|
||||
HttpVerb = "ws",
|
||||
ClientId = invocationContext.Context.UserIdentifier
|
||||
ClientId = invocationContext.Context.UserIdentifier,
|
||||
};
|
||||
foreach (var rule in await _processor.GetMatchingRulesAsync(client).ConfigureAwait(false))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user