mirror of
https://github.com/bitwarden/server.git
synced 2025-01-11 20:10:38 +01:00
Push service fixes. Specific pushes for cipher type deletes.
This commit is contained in:
parent
b16c0ca087
commit
00d79d0fff
@ -4,7 +4,8 @@
|
|||||||
{
|
{
|
||||||
SyncCipherUpdate = 0,
|
SyncCipherUpdate = 0,
|
||||||
SyncCipherCreate = 1,
|
SyncCipherCreate = 1,
|
||||||
SyncCipherDelete = 2,
|
SyncSiteDelete = 2,
|
||||||
SyncCiphers = 3
|
SyncFolderDelete = 3,
|
||||||
|
SyncCiphers = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using PushSharp.Core;
|
|||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using Bit.Core.Domains;
|
using Bit.Core.Domains;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Bit.Core.Services
|
namespace Bit.Core.Services
|
||||||
{
|
{
|
||||||
@ -43,7 +44,17 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
public async Task PushSyncCipherDeleteAsync(Cipher cipher)
|
public async Task PushSyncCipherDeleteAsync(Cipher cipher)
|
||||||
{
|
{
|
||||||
await PushCipherAsync(cipher, PushType.SyncCipherDelete);
|
switch(cipher.Type)
|
||||||
|
{
|
||||||
|
case CipherType.Folder:
|
||||||
|
await PushCipherAsync(cipher, PushType.SyncFolderDelete);
|
||||||
|
break;
|
||||||
|
case CipherType.Site:
|
||||||
|
await PushCipherAsync(cipher, PushType.SyncSiteDelete);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task PushCipherAsync(Cipher cipher, PushType type)
|
private async Task PushCipherAsync(Cipher cipher, PushType type)
|
||||||
@ -55,7 +66,7 @@ namespace Bit.Core.Services
|
|||||||
UserId = cipher.UserId
|
UserId = cipher.UserId
|
||||||
};
|
};
|
||||||
|
|
||||||
await PushToAllUserDevicesAsync(cipher.UserId, new JObject(message));
|
await PushToAllUserDevicesAsync(cipher.UserId, JObject.FromObject(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PushSyncCiphersAsync(Guid userId)
|
public async Task PushSyncCiphersAsync(Guid userId)
|
||||||
@ -212,6 +223,10 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
private X509Certificate2 GetCertificate(string thumbprint)
|
private X509Certificate2 GetCertificate(string thumbprint)
|
||||||
{
|
{
|
||||||
|
// Clean possible garbage characters from thumbprint copy/paste
|
||||||
|
// ref http://stackoverflow.com/questions/8448147/problems-with-x509store-certificates-find-findbythumbprint
|
||||||
|
thumbprint = Regex.Replace(thumbprint, @"[^\da-zA-z]", string.Empty).ToUpper();
|
||||||
|
|
||||||
X509Certificate2 cert = null;
|
X509Certificate2 cert = null;
|
||||||
var certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
|
var certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
|
||||||
certStore.Open(OpenFlags.ReadOnly);
|
certStore.Open(OpenFlags.ReadOnly);
|
||||||
|
Loading…
Reference in New Issue
Block a user