From 2592c824ff902ed5a382a7a82707d08eae1056dd Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 6 Jul 2023 11:00:16 +0100 Subject: [PATCH] Fix tags --- NostrStreamer/Services/NostrListener.cs | 2 +- NostrStreamer/Services/StreamManager.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NostrStreamer/Services/NostrListener.cs b/NostrStreamer/Services/NostrListener.cs index ff3501c..26cb0a0 100644 --- a/NostrStreamer/Services/NostrListener.cs +++ b/NostrStreamer/Services/NostrListener.cs @@ -79,7 +79,7 @@ public class NostrListener : IDisposable comm.Name = uri.Host; comm.ReconnectTimeout = null; //TimeSpan.FromSeconds(30); - comm.ErrorReconnectTimeout = TimeSpan.FromSeconds(60); + comm.ErrorReconnectTimeout = TimeSpan.FromSeconds(2); comm.ReconnectionHappened.Subscribe(info => OnCommunicatorReconnection(info, comm.Name)); comm.DisconnectionHappened.Subscribe(info => diff --git a/NostrStreamer/Services/StreamManager.cs b/NostrStreamer/Services/StreamManager.cs index 5348029..5aecafc 100644 --- a/NostrStreamer/Services/StreamManager.cs +++ b/NostrStreamer/Services/StreamManager.cs @@ -90,7 +90,7 @@ public class StreamManager user.Title = title; user.Summary = summary; user.Image = image; - user.Tags = string.Join(",", tags ?? Array.Empty()); + user.Tags = tags != null ? string.Join(",", tags) : null; var existingEvent = user.Event != default ? JsonConvert.DeserializeObject(user.Event, NostrSerializer.Settings) : null; var ev = CreateStreamEvent(user, existingEvent?.Tags?.FindFirstTagValue("status") ?? "ended"); @@ -139,9 +139,10 @@ public class StreamManager new("p", user.PubKey, "", "host") }; - foreach (var tag in user.Tags?.Split(",") ?? Array.Empty()) + foreach (var tag in !string.IsNullOrEmpty(user.Tags) ? + user.Tags.Split(",", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) : Array.Empty()) { - tags.Add(new("t", tag.Trim())); + tags.Add(new("t", tag)); } var ev = new NostrEvent