diff --git a/Backend/Migrations.cs b/Backend/Migrations.cs index e2974f6..e8e86c2 100644 --- a/Backend/Migrations.cs +++ b/Backend/Migrations.cs @@ -11,6 +11,7 @@ namespace RTMPDash.Backend; public static class Migrations { private const int DbVer = 2; + // ReSharper disable once InconsistentNaming private static readonly List _migrations = new() { new Migration(1, "ALTER TABLE Users ADD IsPrivate INTEGER DEFAULT 0 NOT NULL"), new Migration(1, "ALTER TABLE Users ADD PrivateAccessKey TEXT"), diff --git a/Backend/StreamUtils.cs b/Backend/StreamUtils.cs index 7299543..7e791ea 100644 --- a/Backend/StreamUtils.cs +++ b/Backend/StreamUtils.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; -using System.Net; +using System.Net.Http; using System.Xml.Serialization; namespace RTMPDash.Backend; @@ -22,7 +22,7 @@ public static class StreamUtils { var dbUser = db.Users.First(p => p.Username == user); return dbUser.RestreamTargets.Split(",") .Count(target => stats.Server.Applications.First(p => p.Name == "ingress") - .MethodLive.Streams.Any(p => p.Name == user && p.Clients.Any(c => c.Address == target.Replace("rtmp://", "")))); + .MethodLive.Streams.Any(p => p.Name == user && p.Clients.Any(c => c.Address == target.Replace("rtmp://", "")))); } public static int CountLiveRestreams(string user, string privateAccesskey, StatsObject stats) { @@ -30,13 +30,13 @@ public static class StreamUtils { var dbUser = db.Users.First(p => p.Username == user); return dbUser.RestreamTargets.Split(",") .Count(target => stats.Server.Applications.First(p => p.Name == "ingress") - .MethodLive.Streams.Any(p => p.Name == privateAccesskey && p.Clients.Any(c => c.Address == target.Replace("rtmp://", "")))); + .MethodLive.Streams.Any(p => p.Name == privateAccesskey && p.Clients.Any(c => c.Address == target.Replace("rtmp://", "")))); } public static List ListLiveUsers() => GetStatsObject().Server.Applications.First(p => p.Name == "ingress").MethodLive.Streams.Select(p => p.Name).ToList(); public static StatsObject GetStatsObject() { - var obj = (StatsObject)Serializer.Deserialize(new WebClient().OpenRead(Program.RtmpStatsUrl)!); + var obj = (StatsObject)Serializer.Deserialize(new HttpClient().GetStreamAsync(Program.RtmpStatsUrl).Result); return obj; } } diff --git a/Pages/Dashboard.cshtml b/Pages/Dashboard.cshtml index e60ab58..5de6cf1 100644 --- a/Pages/Dashboard.cshtml +++ b/Pages/Dashboard.cshtml @@ -1,5 +1,5 @@ @page -@inject IAntiforgery _antiforgery +@inject IAntiforgery Antiforgery @using Microsoft.AspNetCore.Antiforgery @using Microsoft.AspNetCore.Http @using RTMPDash.Backend @@ -7,7 +7,7 @@ @model DashboardModel @{ ViewData["Title"] = "Dashboard"; - var tokenSet = _antiforgery.GetAndStoreTokens(HttpContext); + var tokenSet = Antiforgery.GetAndStoreTokens(HttpContext); } @if (string.IsNullOrWhiteSpace(HttpContext.Session.GetString("authenticatedUser"))) { diff --git a/Pages/Shared/_Layout.cshtml b/Pages/Shared/_Layout.cshtml index c4712a6..c2e67c3 100644 --- a/Pages/Shared/_Layout.cshtml +++ b/Pages/Shared/_Layout.cshtml @@ -7,9 +7,9 @@ @ViewData["Title"] - @Program.SiteName - - - + + + - - - - + + + + @await RenderSectionAsync("Scripts", false) - \ No newline at end of file + diff --git a/Pages/Shared/_ValidationScriptsPartial.cshtml b/Pages/Shared/_ValidationScriptsPartial.cshtml index 660f00c..b1320d8 100644 --- a/Pages/Shared/_ValidationScriptsPartial.cshtml +++ b/Pages/Shared/_ValidationScriptsPartial.cshtml @@ -1,2 +1,2 @@ - - \ No newline at end of file + +