refacto API prefix + nav.back
This commit is contained in:
parent
91f613ac4d
commit
ec901e1f10
78 changed files with 770 additions and 222 deletions
|
|
@ -61,7 +61,7 @@ namespace Yavsc.Services
|
|||
// TODO: Handle the socket here.
|
||||
// Find receivers: others in the chat room
|
||||
// send them the flow
|
||||
var buffer = new byte[YavscConstants.WebSocketsMaxBufLen];
|
||||
var buffer = new byte[Constants.WebSocketsMaxBufLen];
|
||||
var sBuffer = new ArraySegment<byte>(buffer);
|
||||
_logger.LogInformation("Receiving bytes...");
|
||||
|
||||
|
|
@ -69,16 +69,16 @@ namespace Yavsc.Services
|
|||
|
||||
_logger.LogInformation($"Received bytes : {received.Count}");
|
||||
_logger.LogInformation($"Is the end : {received.EndOfMessage}");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var fsInputQueue = new Queue<ArraySegment<byte>>();
|
||||
|
||||
bool endOfInput = false;
|
||||
sBuffer = new ArraySegment<byte>(buffer,0,received.Count);
|
||||
fsInputQueue.Enqueue(sBuffer);
|
||||
var taskWritingToFs = liveHandler.ReceiveUserFile(user, _logger, destDir, fsInputQueue, fileName, () => endOfInput);
|
||||
|
||||
|
||||
|
||||
Stack<string> ToClose = new Stack<string>();
|
||||
|
||||
|
|
@ -105,19 +105,19 @@ namespace Yavsc.Services
|
|||
}
|
||||
}
|
||||
|
||||
if (!received.CloseStatus.HasValue)
|
||||
if (!received.CloseStatus.HasValue)
|
||||
{
|
||||
_logger.LogInformation("try and receive new bytes");
|
||||
|
||||
buffer = new byte[YavscConstants.WebSocketsMaxBufLen];
|
||||
buffer = new byte[Constants.WebSocketsMaxBufLen];
|
||||
received = await liveHandler.Socket.ReceiveAsync(sBuffer, liveHandler.TokenSource.Token);
|
||||
|
||||
|
||||
_logger.LogInformation($"Received bytes : {received.Count}");
|
||||
|
||||
sBuffer = new ArraySegment<byte>(buffer,0,received.Count);
|
||||
_logger.LogInformation($"segment : offset: {sBuffer.Offset} count: {sBuffer.Count}");
|
||||
_logger.LogInformation($"Is the end : {received.EndOfMessage}");
|
||||
|
||||
|
||||
if (received.CloseStatus.HasValue)
|
||||
{
|
||||
endOfInput=true;
|
||||
|
|
@ -140,7 +140,7 @@ namespace Yavsc.Services
|
|||
}
|
||||
}
|
||||
while (liveHandler.Socket.State == WebSocketState.Open);
|
||||
|
||||
|
||||
_logger.LogInformation("Closing connection");
|
||||
taskWritingToFs.Wait();
|
||||
await liveHandler.Socket.CloseAsync(WebSocketCloseStatus.NormalClosure, received.CloseStatusDescription, liveHandler.TokenSource.Token);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ namespace Yavsc.Services
|
|||
{
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
public ProfileService(
|
||||
UserManager<ApplicationUser> userManager,
|
||||
ILogger<DefaultProfileService> logger)
|
||||
UserManager<ApplicationUser> userManager,
|
||||
ILogger<DefaultProfileService> logger)
|
||||
{
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ namespace Yavsc.Services
|
|||
ProfileDataRequestContext context,
|
||||
ApplicationUser user)
|
||||
{
|
||||
|
||||
|
||||
var claims = new List<Claim> {
|
||||
new Claim(JwtClaimTypes.Subject,user.Id.ToString()),
|
||||
};
|
||||
|
|
@ -43,7 +43,7 @@ namespace Yavsc.Services
|
|||
claimAdds.Remove("profile");
|
||||
claimAdds.Add(JwtClaimTypes.Name);
|
||||
claimAdds.Add(JwtClaimTypes.Email);
|
||||
claimAdds.Add(YavscConstants.RoleClaimType);
|
||||
claimAdds.Add(Constants.RoleClaimType);
|
||||
}
|
||||
|
||||
if (claimAdds.Contains(JwtClaimTypes.Name))
|
||||
|
|
@ -51,13 +51,13 @@ namespace Yavsc.Services
|
|||
|
||||
if (claimAdds.Contains(JwtClaimTypes.Email))
|
||||
claims.Add(new Claim(JwtClaimTypes.Email, user.Email));
|
||||
|
||||
if (claimAdds.Contains(YavscConstants.RoleClaimType))
|
||||
|
||||
if (claimAdds.Contains(Constants.RoleClaimType))
|
||||
{
|
||||
var roles = await this._userManager.GetRolesAsync(user);
|
||||
if (roles.Count()>0)
|
||||
{
|
||||
claims.AddRange(roles.Select(r => new Claim(YavscConstants.RoleClaimType, r)));
|
||||
claims.AddRange(roles.Select(r => new Claim(Constants.RoleClaimType, r)));
|
||||
}
|
||||
}
|
||||
return claims;
|
||||
|
|
|
|||
Loading…
Reference in a new issue