feat(api): bind encrypted workspaces to accounts and devices
This commit is contained in:
1 parent
019b15041a
commit
c7d8ef15bc
49 files changed
+1904
-278
No files matched your search
@@ -25,7 +25,7 @@ public static class LogStreamer
|
||||
/// </summary>
|
||||
public static async Task RunAsync(
|
||||
ChannelService svc, ChannelHub hub, Id16 id, Credentials creds, long from,
|
||||
Func<Task<ILogSink>> open, CancellationToken ct)
|
||||
Func<Task<ILogSink>> open, CancellationToken ct, Func<bool>? validateAccount = null)
|
||||
{
|
||||
using var sub = hub.Subscribe(id);
|
||||
ILogSink? sink = null;
|
||||
@@ -36,6 +36,7 @@ public static class LogStreamer
|
||||
{
|
||||
while (!ct.IsCancellationRequested)
|
||||
{
|
||||
if (validateAccount is not null && !validateAccount()) throw new WebDropException(ErrorCode.AccountRequired);
|
||||
var changed = sub.Changed; // 先取任务再读状态:读取期间的发布不会丢
|
||||
var page = await svc.ReadLogAsync(id, creds, cursor, PageSize, ct).ConfigureAwait(false);
|
||||
sink ??= await open().ConfigureAwait(false);
|
||||
|
||||
Reference in new issue
Block a user