diff --git a/NostrStreamer/Services/StreamManager/NostrStreamManager.cs b/NostrStreamer/Services/StreamManager/NostrStreamManager.cs index 4060380..1695ee2 100644 --- a/NostrStreamer/Services/StreamManager/NostrStreamManager.cs +++ b/NostrStreamer/Services/StreamManager/NostrStreamManager.cs @@ -41,7 +41,7 @@ public class NostrStreamManager : IStreamManager public void TestCanStream() { - if (_context.User.Balance <= 0) + if (_context.User.Balance < 0) { throw new LowBalanceException("User balance empty"); } @@ -56,7 +56,7 @@ public class NostrStreamManager : IStreamManager { TestCanStream(); var fwds = new List(); - if (_context.UserStream.Endpoint != default) + if (_context.UserStream.Endpoint != null) { fwds.Add( $"rtmp://127.0.0.1:1935/{_context.UserStream.Endpoint.App}/{_context.StreamKey}?vhost={_context.UserStream.Endpoint.Forward}"); @@ -88,7 +88,7 @@ public class NostrStreamManager : IStreamManager _ = Task.Factory.StartNew(async () => { - if (_config.DiscordLiveWebhook != default) + if (_config.DiscordLiveWebhook != null) { try { @@ -128,7 +128,7 @@ public class NostrStreamManager : IStreamManager { const long balanceAlertThreshold = 500_000; - if (_context.UserStream.Endpoint == default) return; + if (_context.UserStream.Endpoint == null) return; var cost = (long)Math.Ceiling(_context.UserStream.Endpoint.Cost * (duration / 60d)); if (cost > 0) { @@ -166,7 +166,7 @@ public class NostrStreamManager : IStreamManager _eventBuilder.BroadcastEvent(chat); } - if (_context.User.Balance <= 0 || _context.User.IsBlocked) + if (_context.User.Balance < 0 || _context.User.IsBlocked) { _logger.LogInformation("Kicking stream due to low balance"); if (!string.IsNullOrEmpty(_context.UserStream.ForwardClientId)) diff --git a/NostrStreamer/Services/StreamManager/StreamManagerFactory.cs b/NostrStreamer/Services/StreamManager/StreamManagerFactory.cs index e3e621c..b7b2964 100644 --- a/NostrStreamer/Services/StreamManager/StreamManagerFactory.cs +++ b/NostrStreamer/Services/StreamManager/StreamManagerFactory.cs @@ -40,7 +40,7 @@ public class StreamManagerFactory if (ep == default) throw new Exception("No endpoint found"); - if (user.Balance <= 0 && ep.Cost > 0) + if (user.Balance < 0) { throw new LowBalanceException("Cannot start stream with empty balance"); }