diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/passport/RST.srf.js b/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/passport/RST.srf.js index 9febec9c..eaef85e6 100644 --- a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/passport/RST.srf.js +++ b/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/passport/RST.srf.js @@ -142,7 +142,7 @@ function generateErrorResponse(errorCode, errorText) { 0x80048800 ${errorCode} - NOBELLIUM 16.0.30846.6 + ${minisrv_config.config.service_name} [minisrv ${minisrv_config.config.hide_minisrv_version ? "beta" : minisrv_version_string.replace("zefie's wtv minisrv ","")}] diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/Home.razor b/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/Home.razor deleted file mode 100644 index 267b04ae..00000000 --- a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/Home.razor +++ /dev/null @@ -1,629 +0,0 @@ -@page "/Pages/Home/Home.aspx" -@using MSNTV2MainServer.Components.Layout -@using Microsoft.AspNetCore.Http -@using Microsoft.AspNetCore.Components -@using MSNTV2MainServer.Components.APIs -@inject IHttpContextAccessor httpContextAccessor - -@layout EmptyLayout - -@if (IsTV2) -{ - - MarkupString htmlContent = new MarkupString($@" - - - -Home - - - - - - - - - - - - - -
- -
- - - -
- - -
- - -
- - - - -
-
-
- -
- - - - - -
- - -
- - - -
- -
- -
- - -
- -
- -
- -
- - -
- -
- - - Using MSN TV - - Sign Out - - Account - - Settings - - - - - - - -
Help - -
- -
-
-
-
- - -
- - -
-
- -
-
-
-
-
- - - -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
- {@Weather.City} -
- - - - - - - -
- {@Weather.Temp}°F -
- {Weather?.Description} -
-
- -
- Open-Meteo -
-
- -
-
- - - -
-
- - - -
-
Today on TV2
{NewsTitle1}
{NewsTitle2}
{NewsTitle3}
More MSN news
-
- -
-
- - - - -
Using MSN TV
Tip: Turn on audible dialing
Get better printing results
-
- -
- -
-Go to Using MSN TV -
-
- -
-
- - -
- -
- - -
- - - - -
-
-
- - - - -
- -Search or type www -
-
-
- - -
- - - - -
- - - - -
- - - - - -
- -
-
-
-
- - - -
- - - - "); - - @((MarkupString)htmlContent) -} -else -{ - Home -

Hello, world!

- -} - -@code { - string userAgent { get; set; } - bool IsTV2 = false; - - // News - string NewsLink1 = "http://sg1.trusted.msntv.msn.com/Pages/Tricks/he.mp3"; - string NewsLink2 = "http://sg1.trusted.msntv.msn.com/Pages/Tricks/pokemon-black-2.mp3"; - string NewsLink3 = "http://sg1.trusted.msntv.msn.com/Pages/Tricks/he.mp3"; - string NewsTitle1 = "Ryder Smells"; - string NewsTitle2 = "Ryder Smells"; - string NewsTitle3 = "Ryder Smells"; - - // Weather mock - WeatherData Weather = new WeatherData - { - City = "San Jose", - Temp = "72", - Description = "Sunny", - Icon = "/Pages/Home/Weather/26.gif" - }; - - // Date data - DateData date = new DateData(); - - protected override void OnInitialized() - { - var request = httpContextAccessor.HttpContext?.Request; - IsTV2 = request != null && SecurityHandler.IsMsnTvClient(request) && SecurityHandler.IsTrustedDomain(request); - } - - - class WeatherData - { - public string City { get; set; } - public string Temp { get; set; } - public string Description { get; set; } - public string Icon { get; set; } - } - - class DateData - { - public string date { get; } - - public DateData() - { - date = DateTime.Now.ToString("dddd, MMMM d"); - } - } -} diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/MoneyModule.razor b/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/MoneyModule.razor deleted file mode 100644 index a33809d7..00000000 --- a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/MoneyModule.razor +++ /dev/null @@ -1,164 +0,0 @@ -@page "/Pages/Home/MoneyModule.aspx" -@using MSNTV2MainServer.Components.Layout -@using Microsoft.AspNetCore.Http -@using Microsoft.AspNetCore.Components; -@inject IHttpContextAccessor httpContextAccessor - - -@layout EmptyLayout - - -@if (IsTV2) -{ - MarkupString htmlContent = new MarkupString($@" - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dow -
-
+54.11
Nasdaq -
-
+6.31
S&P -
-
+3.19
Source: MSN Money
- - - - - -"); - - @((MarkupString)htmlContent) -} - -else -{ - Home -} - -@code -{ - string userAgent { get; set; } - bool IsTV2 = false; - - - - protected override void OnInitialized() - { - userAgent = httpContextAccessor.HttpContext.Request.Headers["User-Agent"]; - - //Check if the client is an MSNTV2 box. If it is, we should return the TV2 page and not the Blazor based Page. - if(userAgent.Contains("MSNTV")) - { - IsTV2 = true; - StateHasChanged(); - } - } -} diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/WeatherModule.razor b/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/WeatherModule.razor deleted file mode 100644 index 348c1aa8..00000000 --- a/zefie_wtvp_minisrv/includes/ServiceVault/msntv2/sg1/Home/WeatherModule.razor +++ /dev/null @@ -1,166 +0,0 @@ -@page "/Pages/Home/WeatherModule.aspx" -@using MSNTV2MainServer.Components.Layout -@using Microsoft.AspNetCore.Http -@using Microsoft.AspNetCore.Components; -@inject IHttpContextAccessor httpContextAccessor - - -@layout EmptyLayout - - -@if (IsTV2) -{ - - MarkupString htmlContent = new MarkupString($@" - - - - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - -
Your City
- - - - - - - - - -
63°/50
Mostly
Cloudy
-
The Weather Channel ®
-
- - - - - -"); - - @((MarkupString)htmlContent) -} - -else -{ - Home - -

Hello, world!

- -} - -@code -{ - string userAgent { get; set; } - bool IsTV2 = false; - - string NewsLink1 = "https://google.com"; - string NewsLink2 = "https://yahoo.com"; - string NewsLink3 = "https://bing.com"; - string NewsTitle1 = "Google reigns superior over the universe"; - string NewsTitle2 = "Who even uses Yahoo anymore?"; - string NewsTitle3 = "Oh god, it's Bing! (Now with extra piss)"; - - - protected override void OnInitialized() - { - userAgent = httpContextAccessor.HttpContext.Request.Headers["User-Agent"]; - - //Check if the client is an MSNTV2 box. If it is, we should return the TV2 page and not the Blazor based Page. - @if(userAgent.Contains("MSNTV")) - { - IsTV2 = true; - StateHasChanged(); - } - } -} diff --git a/zefie_wtvp_minisrv/includes/classes/WTVShared.js b/zefie_wtvp_minisrv/includes/classes/WTVShared.js index 14684866..950ddc65 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVShared.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVShared.js @@ -644,6 +644,24 @@ class WTVShared { return null; } + /** + * Checks if a token is valid (exists and not expired) + * @param {string} token The token to check + * @returns {boolean} true if valid, false if not + */ + isTokenValid(token) { + const session = this.tokens[token]; + if (session && session.expires > Date.now()) { + return true; + } + this.deleteToken(token); + return false; + } + + /** + * Deletes a token from the token store. + * @param {string} token The token to delete + */ deleteToken(token) { delete this.tokens[token]; this.saveTokens();