This commit is contained in:
Ryder
2026-05-05 01:08:26 +01:00
parent 778c0a2827
commit 02a3eef5e7
31 changed files with 2540 additions and 97 deletions

View File

@@ -27,7 +27,7 @@ data = `<HTML>
}
}
function GotoBoxCheck() {
var url = 'https://headwaiter.trusted.msntv.msn.com/connection/boxcheck.html';
var url = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=BoxCheck&purpose=Authorize';
var parms='';
parms += 'BoxId=' + tvShell.SystemInfo.BoxIDService + '&';
parms += 'WANProvider=' + tvShell.ConnectionManager.WANProvider + '&';

View File

@@ -1,32 +0,0 @@
const minisrv_service_file = true;
// Todo: auth if not guest
headers = `Content-type: text/html`;
data = `<html>
<head>
<title id="title"></title>
</head>
<body>
<iframe id="checkmail" style="display:none"></iframe>
<script language="javascript">
var tvShell = new ActiveXObject("MSNTV.TVShell");
var UserManager = tvShell.UserManager;
var home = "https://sg1.trusted.msntv.msn.com/Home/Home.aspx";
tvShell.ConnectionManager.ServiceState = 'Authorized';
UserManager.SetCurrentUserIsAuthorized(true);
var currentUser = UserManager.CurrentUser;
if (currentUser != null) {
currentUser.IsAuthorized = true;
}
var myPanel = tvShell.PanelManager.Item('main');
if (myPanel) {
myPanel.ClearTravelLog();
myPanel.NoBackToMe = true;
myPanel.GotoURL(home);
}
</script>
</body>
</html>`;

View File

@@ -0,0 +1,444 @@
const minisrv_service_file = true;
const crypto = require('crypto');
// Sorry Zef :kek
// https://git.computernewb.com/yellows111/msnp-wiki/src/branch/master/docs/services/rst.md
// the RST_ cookie stuff was code that was temp until we had proper token authentication
const NS = {
SOAP: "http://schemas.xmlsoap.org/soap/envelope/",
WSSE: "http://schemas.xmlsoap.org/ws/2003/06/secext",
WSP: "http://schemas.xmlsoap.org/ws/2002/12/policy",
WSU: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd",
WSA: "http://schemas.xmlsoap.org/ws/2004/03/addressing",
WST: "http://schemas.xmlsoap.org/ws/2004/04/trust",
PSF: "http://schemas.microsoft.com/Passport/SoapServices/SOAPFault",
ENC: "http://www.w3.org/2001/04/xmlenc#",
DS: "http://www.w3.org/2000/09/xmldsig#"
};
function getCookie(cookieString, name) {
if (!cookieString) return null;
const match = cookieString.match(new RegExp(`(?:^|;\\s*)${name}=([^;]*)`));
return match ? decodeURIComponent(match[1]) : null;
}
function setCookie(name, value, options = {}) {
const cookie = `${name}=${encodeURIComponent(value)}`;
const path = options.path || '/';
const expires = options.expires || '';
return `${cookie}; path=${path}${expires ? `; expires=${expires}` : ''}`;
}
function formatDateTime(dt) {
return dt.toISOString().replace(/\.\d{3}Z$/, 'Z');
}
function getClientIP() {
const forwarded = request_headers['x-forwarded-for'];
if (forwarded) {
const ips = forwarded.split(',');
return ips[0].trim();
}
return request_headers['x-real-ip'] || '127.0.0.1';
}
function generateRandomToken(userId, appliesTo, isLegacy = false) {
const timestamp = Date.now();
const randomPart = crypto.randomBytes(32).toString('hex');
if (isLegacy) {
const tokenData = `${userId}|${appliesTo}|${timestamp}|${randomPart}`;
return crypto.createHash('sha256').update(tokenData).digest('hex');
} else {
const tokenData = {
uid: userId,
app: appliesTo,
ts: timestamp,
rand: randomPart,
ver: '1.0'
};
return Buffer.from(JSON.stringify(tokenData)).toString('base64');
}
}
function extractXmlValue(xml, elementName) {
if (!xml) return null;
const patterns = [
new RegExp(`<${elementName}>([\\s\\S]*?)</${elementName}>`, 'i'),
new RegExp(`<wsse:${elementName}>([\\s\\S]*?)</wsse:${elementName}>`, 'i'),
new RegExp(`<wst:${elementName}>([\\s\\S]*?)</wst:${elementName}>`, 'i'),
new RegExp(`<ps:${elementName}>([\\s\\S]*?)</ps:${elementName}>`, 'i')
];
for (const regex of patterns) {
const match = xml.match(regex);
if (match && match[1]) {
let value = match[1].trim();
value = value.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
return value;
}
}
return null;
}
function extractTokenFromCipherValue(xml) {
if (!xml) return null;
const cipherRegex = /<CipherValue>([\s\S]*?)<\/CipherValue>/gi;
let match;
let token = null;
while ((match = cipherRegex.exec(xml)) !== null) {
let cipherValue = match[1].trim();
if (cipherValue && cipherValue.length > 0) {
token = cipherValue;
console.log("Found CipherValue token:", token.substring(0, 50) + "...");
break;
}
}
return token;
}
function validateTokenAndGetUser(token) {
try {
let userId = null;
let email = null;
if (request_headers.cookie) {
userId = getCookie(request_headers.cookie, 'RST_Auth');
email = getCookie(request_headers.cookie, 'RST_Email');
if (!email) email = getCookie(request_headers.cookie, 'rst_email');
if (!email) email = getCookie(request_headers.cookie, 'rst_username');
}
if (!userId) {
userId = crypto.createHash('md5').update(token).digest('hex');
email = `user_${userId.substring(0, 8)}@example.com`;
}
console.log(`Token validated - UserId: ${userId}, Email: ${email}`);
return { success: true, userId, email };
} catch (error) {
console.error("Token validation error:", error);
return { success: false, userId: null, email: null };
}
}
function generateErrorResponse(errorCode, errorText) {
const now = formatDateTime(new Date());
headers = `Status: 200 OK
Content-type: text/xml; charset=utf-8`;
return `<?xml version="1.0" encoding="utf-8"?>
<S:Envelope xmlns:S="${NS.SOAP}" xmlns:psf="${NS.PSF}">
<S:Header>
<psf:pp>
<psf:serverVersion>1</psf:serverVersion>
<psf:authstate>0x80048800</psf:authstate>
<psf:reqstatus>${errorCode}</psf:reqstatus>
<psf:serverInfo Path="Live1" RollingUpgradeState="ExclusiveNew" LocVersion="0" ServerTime="${now}">
NOBELLIUM 16.0.30846.6
</psf:serverInfo>
<psf:cookies></psf:cookies>
<psf:response></psf:response>
</psf:pp>
</S:Header>
<S:Body>
<S:Fault>
<S:Code>
<S:Value>S:Sender</S:Value>
<S:Subcode>
<S:Value>wst:FailedAuthentication</S:Value>
</S:Subcode>
</S:Code>
<S:Reason>
<S:Text xml:lang="en-US">Authentication Failure</S:Text>
</S:Reason>
<S:Detail>
<psf:error>
<psf:value>${errorCode}</psf:value>
<psf:internalerror>
<psf:code>0x80041012</psf:code>
<psf:text>${errorText}</psf:text>
</psf:internalerror>
</psf:error>
</S:Detail>
</S:Fault>
</S:Body>
</S:Envelope>`;
}
function generateSuccessResponse(requestBody, userId, email, firstName, lastName) {
const now = new Date();
const tomorrow = new Date(now.getTime() + 24 * 60 * 60 * 1000);
const createdTime = formatDateTime(now);
const expiresTime = formatDateTime(tomorrow);
const puid = crypto.randomBytes(16).toString('hex').toUpperCase();
const cid = crypto.randomBytes(8).toString('hex').toUpperCase();
const safeFirstName = firstName || email.split('@')[0] || "User";
const safeLastName = lastName || "User";
const clientIp = getClientIP();
const rstRegex = /<wst:RequestSecurityToken[\s\S]*?<\/wst:RequestSecurityToken>/gi;
const responses = [];
let match;
let foundRst = false;
let rstIndex = 0;
while ((match = rstRegex.exec(requestBody)) !== null) {
foundRst = true;
const rstBlock = match[0];
const addressMatch = rstBlock.match(/<wsa:Address>(.*?)<\/wsa:Address>/i);
let appliesTo = addressMatch ? addressMatch[1] : "urn:passport:compact";
const policyMatch = rstBlock.match(/<wsse:PolicyReference\s+URI="([^"]+)"/i);
const policy = policyMatch ? policyMatch[1] : null;
const isLegacy = appliesTo.includes("Passport.NET");
const tokenType = isLegacy ? "urn:passport:legacy" : "urn:passport:compact";
const needsProofToken = policy === "MBI_KEY_OLD";
const token = generateRandomToken(userId, appliesTo, isLegacy);
const tokenId = isLegacy ? `BinaryDAToken${rstIndex}` : `Compact${rstIndex}`;
const binarySecret = crypto.randomBytes(32).toString('base64');
let requestedSecurityToken;
if (isLegacy) {
requestedSecurityToken = `
<wst:RequestedSecurityToken>
<EncryptedData xmlns="${NS.ENC}" Id="${tokenId}" Type="http://www.w3.org/2001/04/xmlenc#Element">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<ds:KeyInfo xmlns:ds="${NS.DS}">
<ds:KeyName>http://Passport.NET/STS</ds:KeyName>
</ds:KeyInfo>
<CipherData>
<CipherValue>${token}</CipherValue>
</CipherData>
</EncryptedData>
</wst:RequestedSecurityToken>`;
} else {
let tokenValue = `t=${token}`;
if (needsProofToken) {
tokenValue += `&p=profile`;
}
requestedSecurityToken = `
<wst:RequestedSecurityToken>
<wsse:BinarySecurityToken Id="${tokenId}">${tokenValue}</wsse:BinarySecurityToken>
</wst:RequestedSecurityToken>`;
}
let responseXml = `
<wst:RequestSecurityTokenResponse>
<wst:TokenType>${tokenType}</wst:TokenType>
<wsp:AppliesTo xmlns:wsa="${NS.WSA}">
<wsa:EndpointReference>
<wsa:Address>${appliesTo}</wsa:Address>
</wsa:EndpointReference>
</wsp:AppliesTo>
<wst:LifeTime>
<wsu:Created>${createdTime}</wsu:Created>
<wsu:Expires>${expiresTime}</wsu:Expires>
</wst:LifeTime>
${requestedSecurityToken}
<wst:RequestedTokenReference>
<wsse:KeyIdentifier ValueType="${tokenType}"/>
<wsse:Reference URI="#${tokenId}"/>
</wst:RequestedTokenReference>`;
if (needsProofToken || isLegacy) {
responseXml += `
<wst:RequestedProofToken>
<wst:BinarySecret>${binarySecret}</wst:BinarySecret>
</wst:RequestedProofToken>`;
}
responseXml += `
</wst:RequestSecurityTokenResponse>`;
responses.push(responseXml);
rstIndex++;
}
if (!foundRst) {
const defaultToken = generateRandomToken(userId, "urn:passport:compact", false);
responses.push(`
<wst:RequestSecurityTokenResponse>
<wst:TokenType>urn:passport:compact</wst:TokenType>
<wst:RequestedSecurityToken>
<wsse:BinarySecurityToken Id="Compact0">t=${defaultToken}</wsse:BinarySecurityToken>
</wst:RequestedSecurityToken>
<wst:LifeTime>
<wsu:Created>${createdTime}</wsu:Created>
<wsu:Expires>${expiresTime}</wsu:Expires>
</wst:LifeTime>
</wst:RequestSecurityTokenResponse>`);
}
headers = `Status: 200 OK
Content-type: text/xml; charset=utf-8
Set-Cookie: RST_Auth=${userId}; path=/; HttpOnly
Set-Cookie: RST_Email=${email}; path=/`;
return `<?xml version="1.0" encoding="utf-8"?>
<S:Envelope xmlns:S="${NS.SOAP}">
<S:Header>
<psf:pp xmlns:psf="${NS.PSF}">
<psf:serverVersion>1</psf:serverVersion>
<psf:PUID>${puid}</psf:PUID>
<psf:configVersion>16.000.26889.00</psf:configVersion>
<psf:uiVersion>3.100.2179.0</psf:uiVersion>
<psf:mobileConfigVersion>16.000.26208.0</psf:mobileConfigVersion>
<psf:authstate>0x48803</psf:authstate>
<psf:reqstatus>0x0</psf:reqstatus>
<psf:serverInfo Path="Live1" RollingUpgradeState="ExclusiveNew" LocVersion="0" ServerTime="${now.toISOString()}">
NOBELLIUM 16.0.30846.6
</psf:serverInfo>
<psf:cookies></psf:cookies>
<psf:browserCookies>
<psf:browserCookie Name="MH" URL="http://www.msn.com">MSFT; path=/; domain=.msn.com; expires=Wed, 30-Dec-2037 16:00:00 GMT</psf:browserCookie>
<psf:browserCookie Name="MH" URL="http://www.live.com">MSFT; path=/; domain=.live.com; expires=Wed, 30-Dec-2037 16:00:00 GMT</psf:browserCookie>
</psf:browserCookies>
<psf:credProperties>
<psf:credProperty Name="MainBrandID">MSFT</psf:credProperty>
<psf:credProperty Name="IsWinLiveUser">true</psf:credProperty>
<psf:credProperty Name="CID">${cid}</psf:credProperty>
<psf:credProperty Name="AuthMembername">${email}</psf:credProperty>
<psf:credProperty Name="Country">US</psf:credProperty>
<psf:credProperty Name="Language">1033</psf:credProperty>
<psf:credProperty Name="FirstName">${safeFirstName}</psf:credProperty>
<psf:credProperty Name="LastName">${safeLastName}</psf:credProperty>
<psf:credProperty Name="Flags">40100643</psf:credProperty>
<psf:credProperty Name="IP">${clientIp}</psf:credProperty>
</psf:credProperties>
<psf:extProperties>
<psf:extProperty Name="CID">${cid}</psf:extProperty>
</psf:extProperties>
<psf:response></psf:response>
</psf:pp>
</S:Header>
<S:Body>
<wst:RequestSecurityTokenResponseCollection
xmlns:wst="${NS.WST}"
xmlns:wsse="${NS.WSSE}"
xmlns:wsu="${NS.WSU}"
xmlns:wsp="${NS.WSP}"
xmlns:psf="${NS.PSF}">
${responses.join('\n ')}
</wst:RequestSecurityTokenResponseCollection>
</S:Body>
</S:Envelope>`;
}
function rstHandler() {
try {
// Get POST data
let requestBody = '';
if (request_headers.post_data) {
if (Buffer.isBuffer(request_headers.post_data)) {
requestBody = request_headers.post_data.toString('utf8');
} else if (typeof request_headers.post_data === 'string') {
requestBody = request_headers.post_data;
} else if (typeof request_headers.post_data === 'object') {
requestBody = JSON.stringify(request_headers.post_data);
}
} else {
console.log("No post_data found. Available keys:", Object.keys(request_headers));
return generateErrorResponse("0x80048820", "No POST data received");
}
if (!requestBody || requestBody.trim() === '') {
console.log("Empty request body");
return generateErrorResponse("0x80048820", "Empty request body");
}
// Authentication
let email = extractXmlValue(requestBody, 'Username');
let password = extractXmlValue(requestBody, 'Password');
let userId = null;
let userEmail = null;
let firstName = "User";
let lastName = "User";
if ((!email || !password) && requestBody.includes('CipherValue')) {
console.log("No username/password found, trying token authentication...");
const token = extractTokenFromCipherValue(requestBody);
if (token) {
const tokenValidation = validateTokenAndGetUser(token);
if (tokenValidation.success) {
userId = tokenValidation.userId;
userEmail = tokenValidation.email;
console.log(`Token authentication successful for: ${userEmail} (${userId})`);
if (request_headers.cookie) {
const cookieEmail = getCookie(request_headers.cookie, 'RST_Email');
const cookieUsername = getCookie(request_headers.cookie, 'rst_username');
if (cookieEmail) userEmail = cookieEmail;
if (cookieUsername) firstName = cookieUsername;
}
} else {
console.log("Token validation failed");
return generateErrorResponse("0x80048821", "Invalid token");
}
} else {
console.log("No token found in CipherValue");
return generateErrorResponse("0x80048820", "Missing credentials/token");
}
}
else if (email && password) {
console.log(`Extracted - Email: ${email}, Password: ${password ? '***' : 'empty'}`);
if (email && email.indexOf('@') < 0) {
const domain = (minisrv_config && minisrv_config.config && minisrv_config.config.domain_name) || 'wtv.zefie.com';
email = `${email}@${domain}`;
}
userEmail = email;
firstName = email.split('@')[0];
userId = crypto.createHash('md5').update(email).digest('hex');
console.log(`Authentication successful for: ${userEmail} (${userId})`);
}
else {
console.log("Missing both credentials and token");
return generateErrorResponse("0x80048820", "Missing credentials/token");
}
if (!userId || !userEmail) {
console.log("Failed to get user identity");
return generateErrorResponse("0x80048821", "User identity not found");
}
const cookieHeaders = [
setCookie('rst_email', userEmail, { path: '/' }),
setCookie('rst_username', firstName, { path: '/' }),
setCookie('rst_authenticated', 'true', { path: '/', expires: 'Wed, 30-Dec-2037 16:00:00 GMT' })
];
const response = generateSuccessResponse(requestBody, userId, userEmail, firstName, lastName);
for (const cookie of cookieHeaders) {
headers += `\nSet-Cookie: ${cookie}`;
}
return response;
} catch (error) {
console.error("RST Handler Error:", error);
console.error("Error stack:", error.stack);
return generateErrorResponse("0x80048820", `Internal error: ${error.message}`);
}
}
let result = rstHandler();
if (result) {
data = result;
}

View File

@@ -0,0 +1,13 @@
const minisrv_service_file = true;
// Wrong email return: <LoginResponse Success="false"><Error Code="e5b"/></LoginResponse>
// Wrong Password return: <LoginResponse Success="false"><Error Code="e5a"/></LoginResponse>
// Example Client request: <LoginRequest><ClientInfo name="MSNTV" version="1.35"/><User><SignInName>example@example.com</SignInName><Password>example</Password><SavePassword>false</SavePassword></User><DAOption>1</DAOption><TargetOption>1</TargetOption></LoginRequest>
data = `<LoginResponse Success="true"><TnP>t=Disabled&amp;p=Disabled</TnP></LoginResponse>`; // T and P cant be nulled they have to have some content in it
headers = `200 OK
Content-Type: text/xml`;
console.log(request_headers.query);

View File

@@ -4,15 +4,15 @@ const minisrv_service_file = true;
const WeatherCity = 'Your City';
const WeatherTemp = '72';
const WeatherDescription = 'Sunny';
const WeatherIcon = '/Pages/Home/Weather/26.gif';
const WeatherIcon = '/Home/Weather/26.gif';
// News headlines
const NewsLink1 = 'http://sg1.trusted.msntv.msn.com/Pages/Tricks/he.mp3';
const NewsLink2 = 'http://sg1.trusted.msntv.msn.com/Pages/Tricks/pokemon-black-2.mp3';
const NewsLink3 = 'http://sg1.trusted.msntv.msn.com/Pages/Tricks/he.mp3';
const NewsTitle1 = 'Ryder Smells';
const NewsTitle2 = 'Ryder Smells';
const NewsTitle3 = 'Ryder Smells';
const NewsLink1 = '';
const NewsLink2 = '';
const NewsLink3 = '';
const NewsTitle1 = '...';
const NewsTitle2 = '...';
const NewsTitle3 = '...';
headers = `200 OK
Content-type: text/html`;
@@ -22,7 +22,7 @@ data = `<html xmlns:msntv>
<head><title>Home</title>
<?import namespace="msntv" implementation="HTC/Shared/CustomButton.htc"?>
<?import namespace="msntv" implementation="/Pages/Home/Shared/BaseClient/HTCTransforms/en-us/LoopingDIV.htc"?>
<?import namespace="msntv" implementation="/Home/Shared/BaseClient/HTCTransforms/en-us/LoopingDIV.htc"?>
<script src="/Include/2.0.261.900/localhost-1700/Shared/BaseClient/JsTransforms/en-us/PaneHelp.js" language="javascript" defer="true"></script>
<link href="/Include/2.0.261.778/localhost-1700/Home/Anduril/CssTransforms/en-us/Home.css" type="text/css" rel="StyleSheet">
@@ -187,7 +187,7 @@ data = `<html xmlns:msntv>
<div class="promoImgDiv">
<div style="position:absolute; left:0px; top:0px">
<img id="PromoImageID" width="178" height="135" border="0" hspace="0" alt="Promotional Image" src="/Pages/Home/ads/webtv3.gif">
<img id="PromoImageID" width="178" height="135" border="0" hspace="0" alt="Promotional Image" src="/Home/ads/webtv3.gif">
</div>
<div style="position:absolute; left:5px; top:0px"><a id="PromoImageLinkID" href="">
<table width="173" height="135"><tr><td></td></tr></table></a>

File diff suppressed because one or more lines are too long

View File

@@ -75,29 +75,42 @@ data = `<html xmlns:msntv>
</STYLE>
<script>
var tvShell = new ActiveXObject("MSNTV.TVShell");
tvShell.UserManager.SetCurrentUserIsAuthorized(false);
var TVShell = new ActiveXObject("MSNTV.TVShell");
TVShell.UserManager.SetCurrentUserIsAuthorized(false);
function AddUser() {
var user = tvShell.UserManager.AddNew("${username}");
var user = TVShell.UserManager.AddNew("${username}");
if (user) {
user.IsPersistent = true;
user.setAttribute("GuestUser", false);
var dt = new Date();
TVShell.UserManager.LastLoginTime = dt.getTime() / 1000 + dt.getTimezoneOffset() * 60;
TVShell.UserManager.OfflineAppMaxAccessDays = 20;
TVShell.UserManager.OfflineAppMaxAccessTimes = 20;
TVShell.UserManager.CurrentUser = user;
user.LargeIcon = "msntv:/SignInPics/big/${picture}.png";
user.SmallIcon = "msntv:/SignInPics/small/${picture}.gif";
TVShell.UserManager.Save();
} else {
user = tvShell.UserManager.Item("${username}");
user = TVShell.UserManager.Item("${username}");
if (user && !user.IsPersistent) {
user.IsPersistent = true;
}
}
if (user) {
user.LargeIcon = "msntv:/tvshell/images/${picture}.png";
user.SmallIcon = "msntv:/tvshell/images/${picture}.gif";
}
function GobacktoSignon() {
entry = TVShell.ServiceList.Add('connection::login');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Authorize';
entry.Description = '${minisrv_config.config.service_name}/sg1 [${minisrv_config.config.hide_minisrv_version ? "beta" : minisrv_version_string.replace("zefie's wtv minisrv ","")}]';
TVShell.ServiceList.Save();
TVShell.ConnectionManager.ServiceState = 'ReSignIn';
}
AddUser();
tvShell.UserManager.Save();
</script>
</head>
@@ -116,7 +129,7 @@ data = `<html xmlns:msntv>
<table class="ApolloIcons" tabindex="-1">
<tr height="70">
<td tabindex="-1">
<span style='display:inline-block; width:142px; height:158px; behavior:url(#default#alphaImageLoader); src:url(msntv:/SignInPics/Big/${picture}.png);'></span>
<span style='display:inline-block; width:142px; height:158px; behavior:url(#default#alphaImageLoader); src:url(msntv:/SignInPics/big/${picture}.png);'></span>
</td>
</tr>
</table>
@@ -139,7 +152,7 @@ data = `<html xmlns:msntv>
</p>
<div id="footer">
<msntv:CustomButton id="continue" label="Continue" href="/Home/Home.aspx" />
<msntv:CustomButton id="continue" label="Continue" onclick="GobacktoSignon()" />
</div>
</div>
</body>

View File

@@ -15,7 +15,7 @@ if (!password && request_headers.cookie) {
if (pm) password = decodeURIComponent(pm[1]);
}
if (email && email.indexOf('@') < 0) email += "@"+minisrv_config.config.service_name;
if (email && email.indexOf('@') < 0) email += "@"+minisrv_config.config.domain_name;
let userAvail = false;
if (email) {

View File

@@ -51,7 +51,7 @@ data = `<HTML xmlns:msntv>
<p>Type your minisrv username:</p>
<div class="input-container">
<td><input type="text" id="email" class="inputText" name="email" maxlength="32" size="25"> </td>
<p style="display: inline; bottom: 4px; position: relative;">@${minisrv_config.config.service_name}</p>
<p style="display: inline; bottom: 4px; position: relative;">@${minisrv_config.config.domain_name}</p>
</div>
<br>
<p>Next, enter a password:</p>

View File

@@ -0,0 +1,706 @@
const minisrv_service_file = true;
// Get the phase parameter from the query string
let phase = request_headers.query.phase;
if (Array.isArray(phase)) phase = phase[0];
let BoxId = request_headers.query.BoxId;
if (Array.isArray(BoxId)) BoxId = BoxId[0];
let clientIp = socket.remoteAddress;
let banned = false;
let sessionId = null;
ServiceDomain = minisrv_config.config.domain_name;
// Use the shared MSNTV2 helper injected by WTV-MSNTV2 VM context.
if (BoxId) {
if (!BoxId || BoxId.length != 20 || !/^\d+$/.test(BoxId))
{
console.warn("Invalid BoxId format "+BoxId+" from "+clientIp);
banned = true;
} else {
sessionId = encodeSessionID(BoxId);
}
} else if (request_headers.cookie && request_headers.cookie.SessionID) {
BoxID = decodeSessionID(request_headers.cookie.SessionID);
sessionId = request_headers.cookie.SessionID;
} else {
console.warn("No BoxId provided by client "+clientIp);
banned = true;
}
if (!sessionId && !banned) {
banned = true;
}
if (!session_data && BoxId) {
console.log("Missing session_data for BoxId %s", BoxId);
}
let registered = false;
let username = '';
let Profile_Picture
if (session_data) {
registered = session_data.isRegistered();
if (registered) {
username = session_data.getSessionData("subscriber_username") || '';
Profile_Picture = session_data.getSessionData('ProfilePicture') || '';
}
}
// Current UTC time
const now = new Date();
const timeData = {
hh: now.getUTCHours(),
mm: now.getUTCMinutes(),
ss: now.getUTCSeconds(),
mo: now.getUTCMonth() + 1,
dd: now.getUTCDate(),
yyyy: now.getUTCFullYear()
};
const timezoneMap = {
"UTC": {
standardName: "UTC",
standardOffset: 0,
daylightName: "UTC",
daylightOffset: 0
}
};
const {
standardName,
standardOffset,
daylightName,
daylightOffset
} = timezoneMap["UTC"];
// Set session cookie on the client
if (sessionId) {
setCookie('SessionID', sessionId, { path: '/' });
}
// Handle different phases
switch (phase) {
case "Bootstrap":
headers = `200 OK
Content-type: text/html`;
data = `<HTML>
<HEAD>
<title id="title"></title>
</HEAD>
<body>
<iframe id=checkmail style="display:none"></iframe>
<script language="javascript">
var TVShell = new ActiveXObject("MSNTV.TVShell");
function IsNightlyEnabled() {
var taskScheduler = TVShell.TaskScheduler;
var updateTask = null;
for (var i = 0; ((i < taskScheduler.Count) && (updateTask == null)); i++) {
if (taskScheduler.Item(i).Caller == 'NightlyUpdate') {
updateTask = taskScheduler.Item(i);
}
}
if (updateTask != null) {
return(true);
}
else {
return(false);
}
}
function GotoBoxCheck() {
var url = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=BoxCheck&purpose=Authorize';
var parms='';
parms += 'BoxId=' + TVShell.SystemInfo.BoxIDService + '&';
parms += 'WANProvider=' + TVShell.ConnectionManager.WANProvider + '&';
parms += 'version=' + encodeURIComponent(TVShell.SystemInfo.LastVersion) + '&';
if ((TVShell.ConnectionManager.MSNIAManager != null) && (TVShell.ConnectionManager.MSNIAManager.CurrentConnector != null)) parms += 'ConnectorName=' + encodeURIComponent(TVShell.ConnectionManager.MSNIAManager.CurrentConnector.Name) + '&';
if (TVShell.UserManager.CurrentUser != null) parms += 'domain=' + encodeURIComponent(TVShell.UserManager.CurrentUser.Domain) + '&';
parms += 'NumRedirects=0&';
parms += 'NightlyEnabled=' + IsNightlyEnabled() + '&';
parms += 'x=y';
var myPanel = TVShell.PanelManager.Item('service');
if (myPanel) myPanel.PostToURL(url, parms);
}
var progressPanel = TVShell.PanelManager.Item('progress');
function SetProgress(text, percent) {
if (progressPanel) {
progressPanel.Document.SetProgressText(text);
progressPanel.Document.SetProgressPercent(percent);
}
}
function IsServicePanel() {
if ((window.name == null) || ((window.name != null) && (window.name.toLowerCase() != 'service'))) {
return(false);
}
return(true);
}
function DontContinue() {
var currentUser = TVShell.UserManager.CurrentUser;
if (currentUser != null && currentUser.IsAuthorized) {
window.location.replace(TVShell.UserManager.CurrentUser.ServiceList.Item('home::home').URL);
}
else {
TVShell.ConnectionManager.ServiceState = 'ReSignIn';
}
}
if (!IsServicePanel()) {
DontContinue();
}
else {
TVShell.MeteringManager.Stop();
SetProgress('Please wait while we sign you into MSN TV.', 10);
GotoBoxCheck();
}
</script>
</body>
</HTML>`;
break;
case "BoxCheck":
headers = `200 OK
Content-type: text/html`;
data = `<html>
<head>
<title id="title"></title>
</head>
<body>
<iframe id="checkmail" style="display:none"></iframe>
<script src="msntv:/Javascript/TVShell.js" language="javascript"></script>
<script src="msntv:/Javascript/ServiceList.js" language="javascript"></script>
<script src="msntv:/Javascript/GuestUser.js" language="javascript"></script>
<script language="javascript">
try {
var TVShell = new ActiveXObject("MSNTV.TVShell");
var Sink = new ActiveXObject("MSNTV.MultipleEventSink");
var email = TVShell.UserManager.EMail;
var wanProvider = TVShell.ConnectionManager.WANProvider;
var banned = ${banned};
var registered = ${registered};
var username = "${username}";
var picture = "${Profile_Picture}";
var ServiceDomain = "${ServiceDomain}";
var MSNTVToken = "";
var serviceArgs = new Array();
var ProductionArgs = new Array("msntv.msn.com", "MBI", 0, 0,
"mail.services.live.com", "MBI", 0, 0,
"livefilestore.com", "MBI", 0, 0,
"messenger.msn.com", "?id=507", 0, 0,
"spaces.live.com", "MBI", 0, 0
);
serviceArgs[0] = ProductionArgs;
if (!banned) {
// DEBUG ONLY! USE WITH CAUTION!
TVShell.AddSecretCode(10000); // Power-on for nightly update
TVShell.AddSecretCode(10001); // Power-on for nightly email check at anchor time
TVShell.AddSecretCode(10002); // Power-on for nightly email check at non-anchor time
TVShell.AddSecretCode(77437); // spooky dialing options
TVShell.AddSecretCode(93288); // Service Selection Page
TVShell.AddSecretCode(6145539); // crash the system
TVShell.AddSecretCode(3932397); // update loop test
}
function isIDCRLErrorCode( theCode )
{
// when high bit is set, it is an error
if ( theCode & 0x80000000 )
return true;
return false;
}
function getIDCRLCode( theCode )
{
return (theCode & 0xFF);
}
/*
function CheckForUser(usernameToCheck) {
var UserManager = TVShell.UserManager;
for (var i=0; i<UserManager.Count; i++) {
var user = UserManager.Item(i);
if (user == usernameToCheck) {
return true;
}
}
return false;
}*/
function DoLogin() {
var currentUser = TVShell.UserManager.CurrentUser;
if (currentUser == null) {
if (banned === true) {
var url = 'https://sg1.trusted.msntv.msn.com/connection/banned.html';
var myPanel = TVShell.PanelManager.Item('main');
if (myPanel) myPanel.GotoURL(url);
} else {
if (registered === true) {
var user = TVShell.UserManager.AddNew(username + '@' + ServiceDomain);
if (user) {
var useroptions = UserManager.Item(username + '@' + ServiceDomain);
useroptions.IsPersistent = true;
//user.setAttribute("GuestUser", false);
useroptions.LargeIcon = "msntv:/SignInPics/big/"+ picture + ".png";
useroptions.SmallIcon = "msntv:/SignInPics/small/"+ picture + ".gif";
TVShell.UserManager.Save();
}
}
var myPanel = TVShell.PanelManager.Item('main')
if (registered === true) {
entry = TVShell.ServiceList.Add('connection::login');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Authorize';
entry.Description = '${minisrv_config.config.service_name}/sg1 [${minisrv_config.config.hide_minisrv_version ? "beta" : minisrv_version_string.replace("zefie's wtv minisrv ","")}]';
TVShell.ServiceList.Save();
var signon = TVShell.BuiltinServiceList.Item("SignOn");
var panel = TVShell.PanelManager.FocusedPanel;
var atLogin = false;
TVShell.ConnectionManager.ServiceState = 'ReSignIn';
if ( signon && panel && panel.Name == "main" )
{
if ( IsMainPanelOnPage( signon.URL ) ) atLogin = true;
}
if (!atLogin) {
myPanel.ClearTravelLog();
myPanel.NoBackToMe = true;
GotoSignOn();
}
} else {
if (myPanel) myPanel.GotoURL('https://sg1.trusted.msntv.msn.com/Register/Establish-your-MSN-TV-Account.html');
}
if (myPanel) {
myPanel.ClearTravelLog();
myPanel.NoBackToMe = true;
}
}
} else {
if (banned === true) {
var url = 'https://sg1.trusted.msntv.msn.com/connection/banned.html';
var myPanel = TVShell.PanelManager.Item('service');
if (myPanel) myPanel.GotoURL(url);
}
}
if (currentUser != null) {
// Check if We can do IDCRL if not fall back to Legacy XMLlogin
if (TVShell.LoginManager.IDCRLInitialize) {
DoIDCRLLogin();
} else {
// Non IDCRL Auth Code (Pre 5.x)
Sink.AttachEvent(TVShell.LoginManager, 'OnLoginResult', OnLoginResult);
TVShell.LoginManager.PassportSiteIDs = '507';
TVShell.LoginManager.LoginURL = "https://login.live.com/ppsecure/clientpost.srf";
TVShell.LoginManager.LogoutURL = "https://login.live.com/ppsecure/logoutxml.srf";
TVShell.LoginManager.ResetPasswordURL = "https://login.live.com/ppsecure/MSRV_ResetPW_ClientPost.srf";
TVShell.LoginManager.ChangePasswordURL = "https://login.live.com/ppsecure/MSRV_ChangePW_ClientPost.srf";
TVShell.LoginManager.RequestProfileURL = "https://login.live.com/ppsecure/ClientProfileRequest.srf";
TVShell.LoginManager.UpdateProfileURL = "https://login.live.com/ClientEditProf.srf";
TVShell.LoginManager.Authenticate(email, "", "https://login.live.com/ppsecure/clientpost.srf");
}
}
}
function OnLoginResult(hr,t,p)
{
MSNTVToken = t;
GoToUserCheck();
}
function DoIDCRLLogin()
{
try {
TVShell.LoginManager.IDCRLInitialize(0);
Sink.AttachEvent(TVShell.LoginManager, "IDCRLOnAuthStateChanged",IDCRLOnAuthStateChanged);
TVShell.LoginManager.IDCRLLogonAndAuthToServices(serviceArgs[0]);
} catch (e) {
TVShell.EventLog.Important("IDCRL error: " + e.message);
}
}
function IDCRLOnAuthStateChanged(result, authState, requestStatus, user, serviceTarget, servicePolicy, token, webFlowUrl)
{
// Find the matching policy in ProductionArgs for this serviceTarget
var expectedPolicy = "";
for(var i = 0; i < ProductionArgs.length; i++) {
if(ProductionArgs[i] == serviceTarget && i+1 < ProductionArgs.length) {
expectedPolicy = ProductionArgs[i+1];
break;
}
}
// Now check with the correctly matched policy
if(TVShell.UserManager.CurrentUser.EMail != user ||
ProductionArgs[0] != serviceTarget ||
expectedPolicy != servicePolicy ||
(isIDCRLErrorCode(authState) || getIDCRLCode(authState) != 0x03) ||
(isIDCRLErrorCode(requestStatus) || getIDCRLCode(requestStatus) != 0x00)) {
return;
}
if (token != ""){
var tIndex = token.indexOf("t=");
var pIndex = token.indexOf("&p=");
// make sure there is only the "t" token exists, this is for RPS compact ticket
// it is possible that compact ticket contains empty p parameter.
MSNTVToken = token;
GoToUserCheck();
}
else
TVShell.EventLog.Important("No token");
}
function DoPoptimization() {
if (wanProvider === "MSNIANB") {
var connector = GetConnectorByName("LocalPOP");
if (connector == null) {
connector = TVShell.ConnectionManager.MSNIAManager.Connectors.Add("modem");
connector.AreaCode = "";
connector.Exchange = "";
connector.DialingFlags = 0x00001000;
connector.Name = "LocalPOP";
connector.LocationName = "LocalPOP";
TVShell.ConnectionManager.Save();
connector.Poptimize("0", connector.AreaCode, connector.Exchange);
}
if (connector.Phonebook == null || connector.Phonebook.length === 0) {
if (connector.AreaCode && connector.Exchange) {
connector.Poptimize(connector.AreaCode, connector.Exchange);
}
}
}
}
function GetConnectorByName(name) {
var connectors = TVShell.ConnectionManager.MSNIAManager.Connectors;
for (var i = 0; i < connectors.length; i++) {
if (connectors[i].Name === name) {
return connectors[i];
}
}
return null;
}
function GoToUserCheck() {
if (banned === true) {
var url = 'https://sg1.trusted.msntv.msn.com/connection/banned.html';
var myPanel = TVShell.PanelManager.Item('service');
if (myPanel) myPanel.GotoURL(url);
} else if (registered) {
var url = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=UserCheck&purpose=Authorize&t=' + MSNTVToken ;
var myPanel = TVShell.PanelManager.Item('service');
if (myPanel) myPanel.GotoURL(url);
}
}
function SetProgress(text, percent) {
if (progressPanel) {
progressPanel.Document.SetProgressText(text);
progressPanel.Document.SetProgressPercent(percent);
}
}
var progressPanel = TVShell.PanelManager.Item('progress');
function IsServicePanel() {
if ((window.name == null) || ((window.name != null) && (window.name.toLowerCase() != 'service'))) {
return false;
}
return true;
}
function DontContinue() {
var currentUser = TVShell.UserManager.CurrentUser;
if (currentUser != null && currentUser.IsAuthorized) {
window.location.replace(TVShell.UserManager.CurrentUser.ServiceList.Item('home::home').URL);
} else {
TVShell.ConnectionManager.ServiceState = 'ReSignIn';
}
}
if (!IsServicePanel()) {
DontContinue();
} else {
DoPoptimization();
DoLogin();
try {
TVShell.DeviceControl.SetTimeZone(${standardOffset}, "${standardName}", 0, "");
} catch (e) {
TVShell.EventLog.Important("SetTimeZone error: " + e.message);
}
try {
TVShell.DeviceControl.SetClock(${timeData.hh}, ${timeData.mm}, ${timeData.ss}, ${timeData.mo}, ${timeData.dd}, ${timeData.yyyy});
} catch (e) {
TVShell.EventLog.Important("SetClock error: " + e.message);
}
}
} catch (e) {
TVShell.EventLog.Important("Error in boxcheck: " + e.message);
}
</script>
</body>
</html>`;
break;
case "UserCheck":
headers = `Content-type: text/html`;
// Check if the msntv.msn.com token is correct TODO
data = `<html>
<head>
<title id="title"></title>
</head>
<body>
<iframe id="checkmail" style="display:none"></iframe>
<script language="javascript">
var TVShell = new ActiveXObject("MSNTV.TVShell");
var wanProvider = TVShell.ConnectionManager.WANProvider;
function SetServiceList() {
var entry;
// BuiltinServiceList - for main MSN TV services
TVShell.UserManager.CurrentUser.ServiceList.Clear(); //Always clear the list first to avoid dupes.
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('help::help');
entry.URL = 'http://sg1.msntv.msn.com/health/Help.aspx';
entry.KeyCode = 0xAC; // VK_BROWSER_HOME
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('home::home');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Home/Home.aspx?WANProvider=' + wanProvider;
entry.KeyCode = 0xAC; // VK_BROWSER_HOME
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('home::bgmusic');
entry.URL = '';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('home::backendproxy');
entry.URL = 'https://sg1.trusted.msntv.msn.com/BackendProxy';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('home::radioplus');
entry.URL = 'https://sg1.trusted.msntv.msn.com/Stations.xml';
entry.Safe = true;
entry = TVShell.ServiceList.Add('music::radiohome');
entry.URL = 'http://msntv.msn.com/pages/radio/home.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Livefilestore::AuthServer');
entry.URL = 'livefilestore.com';
entry.Description = 'MBI'
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Skydrive::AuthServer');
entry.URL = 'favorites.live.com';
entry.Description = 'MBI'
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Skydrive::Browse');
// entry.URL = 'users.storage.live.com';
entry.URL = 'favorites.msn.com';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Skydrive::AppId');
entry.Description = '1'
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Skydrive::ApiServer');
entry.URL = 'api.live.net';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('onlinestorage::root');
entry.URL = 'https://livefilestore/onlinestorage/';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Favorites::RoamingServer');
entry.URL = 'https://livefilestore.com/onlinestorage/';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Favorites::Migration');
entry.URL = 'https://livefilestore.com/onlinestorage/';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Favorites::SyncServer');
entry.URL = 'https://livefilestore.com/onlinestorage/';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('onlinestorage::authServer');
entry.URL = 'http://77.68.90.130/';
entry.Description = 'MBI'
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('mail::listmail');
entry.URL = 'http://mail-sgN.msntv.msn.com/apps/mail/listmail.aspx';
entry.KeyCode = 0xB4; // VK_LAUNCH_MAIL
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('mail::writemail');
entry.URL = 'http://mail-sg1.trusted.msntv.msn.com/apps/mail/writemail.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('chat::home');
entry.URL = 'https://sg1.trusted.msntv.msn.com/Pages/Chat/Chat.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('chat::ServiceTarget');
entry.URL = 'chat.msn.com';
entry.Description = '?id=2260'
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('messenger::root');
entry.URL = 'http://ms.msgrsvcs.ctsrv.gay:1863';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('messenger::passport');
entry.URL = 'https://login.live.com/messenger';
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('messenger::ServiceTarget');
entry.URL = 'messenger.msn.com';
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('search::search');
entry.URL = 'https://sg1.trusted.msntv.msn.com/Pages/Search/search.html';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('search::main');
entry.URL = 'https://sg1.msntv.msn.com/search/Search.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('discuss::home');
entry.URL = 'http://sg1.msntv.msn.com/apps/discuss/DiscussLobby.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('maps::main');
entry.URL = 'https://sg1.msntv.msn.com/apps/maps/GetMap.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Settings::HomeNetwork');
entry.URL = 'msntv:/Settings/Network/HomeNetworking.html';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('settings::mainindex');
entry.URL = 'https://sg1.trusted.msntv.msn.com/apps/settings/MainIndex.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('UAM::UAMbase');
entry.URL = 'https://sg1.trusted.msntv.msn.com/apps/uam/pages/settings.aspx';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Photo::Home');
entry.URL = 'msntv:/Photo/PhotoHome.html';
entry.Safe = true;
entry = TVShell.UserManager.CurrentUser.ServiceList.Add('Photos');
entry.URL = 'msntv:/Photo/PhotoHome.html';
entry.Safe = true;
// Add services to ServiceList
TVShell.ServiceList.Clear();
entry = TVShell.ServiceList.Add('home::cinemanow');
entry.URL = 'http://g.msn.com/5TVANDURIL/4000';
entry = TVShell.ServiceList.Add('msn::radioplus');
entry.URL = 'http://radio.msn.com/asx/generate';
entry = TVShell.ServiceList.Add('msn::musicnews');
entry.URL = 'http://www.msnbc.msn.com/id/3032433/';
entry = TVShell.ServiceList.Add('connection::popupcontrol');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/PopupControlWhiteList.ashx';
entry = TVShell.ServiceList.Add('connection::reconnect');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=ReAuthorize';
entry = TVShell.ServiceList.Add('connection::nightly_login');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Nightly';
entry = TVShell.ServiceList.Add('mail::check');
entry.URL = 'https://sg1.trusted.msntv.msn.com/apps/connection/CheckMail.aspx?phase=CheckMail&purpose=CheckMail';
entry.Safe = true;
if (wanProvider === "BYOA") {
entry = TVShell.ServiceList.Add('home::videoplus');
entry.URL = 'http://msntv.msn.com/pages/msnvideo/main.aspx';
entry.Safe = true;
}
if (wanProvider === "BYOA") {
entry = TVShell.ServiceList.Add('home::musicvideo');
entry.URL = 'http://msntv.msn.com/pages/msnvideo/main.aspx?p=music';
entry.Safe = true;
}
entry = TVShell.ServiceList.Add('connection::resetpassword');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=ResetPassword';
entry = TVShell.ServiceList.Add('connection::pagepatch');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/PagePatch.ashx';
entry = TVShell.ServiceList.Add('connection::login');
entry.URL = 'https://sg1.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Authorize';
entry.Description = '${minisrv_config.config.service_name}/sg1 [${minisrv_config.config.hide_minisrv_version ? "beta" : minisrv_version_string.replace("zefie's wtv minisrv ","")}]';
entry = TVShell.ServiceList.Add('ctags::main');
entry.URL = 'http://c.msn.com/c.gif?di=1455&pi=68206&tp=http%3a%2f%2fmsntv.msn.com%2fclient%2f';
TVShell.ServiceList.Save();
}
function IsServicePanel() {
if ((window.name == null) || ((window.name != null) && (window.name.toLowerCase() != 'service'))) {
return false;
}
return true;
}
function DontContinue() {
var currentUser = TVShell.UserManager.CurrentUser;
if (currentUser != null && currentUser.IsAuthorized) {
TVShell.PanelManager.Item('main').GotoURL(TVShell.UserManager.CurrentUser.ServiceList.Item('home::home').URL);
TVShell.PanelManager.Item('main').ClearTravelLog();
TVShell.PanelManager.Item('main').NoBackToMe = true;
} else {
TVShell.ConnectionManager.ServiceState = 'ReSignIn';
}
}
if (!IsServicePanel()) {
DontContinue();
} else {
SetServiceList();
TVShell.UserManager.SetCurrentUserIsAuthorized(true);
TVShell.ConnectionManager.ServiceState = 'Authorized';
var dt = new Date();
TVShell.UserManager.LastLoginTime = dt.getTime() / 1000 + dt.getTimezoneOffset() * 60;
TVShell.UserManager.OfflineAppMaxAccessDays = 20;
TVShell.UserManager.OfflineAppMaxAccessTimes = 20;
TVShell.UserManager.Save();
TVShell.PanelManager.Item('main').GotoURL(TVShell.UserManager.CurrentUser.ServiceList.Item('home::home').URL);
TVShell.PanelManager.Item('main').ClearTravelLog();
TVShell.PanelManager.Item('main').NoBackToMe = true;
}
</script>
</body>
</html>`;
break;
default:
headers = `200 OK
Content-type: text/html`;
data = `<HTML>
<HEAD>
<title id="title"></title>
</HEAD>
</HTML>`;
break;
}

View File

@@ -37,6 +37,8 @@ if (session_data) {
registered = session_data.isRegistered();
if (registered) {
username = session_data.getSessionData("subscriber_username") || '';
Profile_Picture = session_data.getSessionData('ProfilePicture') || '';
}
}
@@ -103,23 +105,23 @@ data = `<html>
var email = TVShell.UserManager.EMail;
var wanProvider = TVShell.ConnectionManager.WANProvider;
var banned = ${banned}; // JavaScript boolean value
var registered = ${registered}; // JavaScript boolean value
var username = "${username}"; // JavaScript string value
var banned = ${banned};
var registered = ${registered};
var username = "${username}";
var picture = "${Profile_Picture}";
InitializeGuestMode();
RemoveGuestUsers();
if (!banned) {
TVShell.AddSecretCode(10000); // sync shit
TVShell.AddSecretCode(10001); // sync shit
TVShell.AddSecretCode(10002); // sync shit
TVShell.AddSecretCode(93288); // Service Select
TVShell.AddSecretCode(77437); // Spooky Options
TVShell.AddSecretCode(6145539); // Force Crash
var entry = TVShell.ServiceList.Add("connection::login");
entry.URL = "https://headwaiter.trusted.msntv.msn.com/connection/login.aspx?BoxId=${BoxId}";
TVShell.ServiceList.Save();
// DEBUG ONLY! USE WITH CAUTION!
TVShell.AddSecretCode(10000); // Power-on for nightly update
TVShell.AddSecretCode(10001); // Power-on for nightly email check at anchor time
TVShell.AddSecretCode(10002); // Power-on for nightly email check at non-anchor time
TVShell.AddSecretCode(77437); // spooky dialing options
TVShell.AddSecretCode(93288); // Service Selection Page
TVShell.AddSecretCode(6145539); // crash the system
TVShell.AddSecretCode(3932397); // update loop test
}
function CheckForUser(usernameToCheck) {
@@ -146,15 +148,30 @@ data = `<html>
var user = TVShell.UserManager.AddNew(username);
if (user) {
user.IsPersistent = true;
user.setAttribute("GuestUser", false);
var dt = new Date();
TVShell.UserManager.LastLoginTime = dt.getTime() / 1000 + dt.getTimezoneOffset() * 60;
TVShell.UserManager.OfflineAppMaxAccessDays = 20;
TVShell.UserManager.OfflineAppMaxAccessTimes = 20;
TVShell.UserManager.CurrentUser = user;
user.LargeIcon = "msntv:/SignInPics/big/"+ picture + ".png";
user.SmallIcon = "msntv:/SignInPics/small/"+ picture + ".gif";
TVShell.UserManager.Save();
entry = TVShell.ServiceList.Add('connection::login');
entry.URL = 'https://headwaiter.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Authorize';
entry.Description = '${minisrv_config.config.service_name}/sg1 [${minisrv_config.config.hide_minisrv_version ? "beta" : minisrv_version_string.replace("zefie's wtv minisrv ","")}]';
TVShell.ServiceList.Save();
}
}
}
SetProgress('Welcome, New User!', 100);
var myPanel = TVShell.PanelManager.Item('main')
if (registered === true) {
var signon = TVShell.BuiltinServiceList.Item("SignOn");
var panel = TVShell.PanelManager.FocusedPanel;
var atLogin = false;
TVShell.ConnectionManager.ServiceState = 'ReSignIn';
if ( signon && panel && panel.Name == "main" )
{
if ( IsMainPanelOnPage( signon.URL ) ) atLogin = true;
@@ -165,7 +182,7 @@ data = `<html>
GotoSignOn();
}
} else {
if (myPanel) myPanel.GotoURL('https://sg1.trusted.msntv.msn.com/register/Establish-your-MSN-TV-Account.html');
if (myPanel) myPanel.GotoURL('https://sg1.trusted.msntv.msn.com/Register/Establish-your-MSN-TV-Account.html');
}
if (myPanel) {
myPanel.ClearTravelLog();
@@ -188,11 +205,7 @@ data = `<html>
"messenger.msn.com", "?id=507", 0, 0,
"spaces.live.com", "MBI", 0, 0
);
var PPEArgs = new Array();
var INTArgs = new Array();
serviceArgs[0] = ProductionArgs;
serviceArgs[1] = PPEArgs;
serviceArgs[2] = INTArgs;
try {
TVShell.LoginManager.IDCRLInitialize(0);
TVShell.LoginManager.IDCRLLogonAndAuthToServices(serviceArgs[0]);
@@ -236,17 +249,15 @@ data = `<html>
return null;
}
function CheckBoxID() {
SetProgress("${minisrv_config.config.service_name} [${minisrv_config.config.hide_minisrv_version ? "beta" : minisrv_version_string.replace("zefie's wtv minisrv ","")}] Welcome, ${username != '' ? username : 'Guest'}!", 20);
}
function GoToUserCheck() {
if (banned === true) {
var url = 'https://headwaiter.trusted.msntv.msn.com/connection/banned.html';
var url = 'https://sg1.trusted.msntv.msn.com/connection/banned.html';
var myPanel = TVShell.PanelManager.Item('service');
if (myPanel) myPanel.GotoURL(url);
} else if (registered) {
GotoSignOn();
var url = 'https://sg1.trusted.msntv.msn.com/connection/usercheck.html';
var myPanel = tvShell.PanelManager.Item('service');
if (myPanel) myPanel.GotoURL(url);
}
}
@@ -278,7 +289,6 @@ data = `<html>
if (!IsServicePanel()) {
DontContinue();
} else {
CheckBoxID();
DoPoptimization();
DoLogin();
@@ -300,7 +310,7 @@ data = `<html>
if (window.console) console.log("Error in boxcheck: " + e.message);
var myPanel = TVShell ? TVShell.PanelManager.Item('main') : null;
if (myPanel) myPanel.GotoURL('https://headwaiter.trusted.msntv.msn.com/connection/error.html');
if (myPanel) myPanel.GotoURL('https://sg1.trusted.msntv.msn.com/connection/error.html');
}
</script>
</body>

View File

@@ -0,0 +1,193 @@
const minisrv_service_file = true;
headers = `Content-type: text/html`;
data = `<html>
<head>
<title id="title"></title>
</head>
<body>
<iframe id="checkmail" style="display:none"></iframe>
<script language="javascript">
var tvShell = new ActiveXObject("MSNTV.TVShell");
var wanProvider = tvShell.ConnectionManager.WANProvider;
function SetServiceList() {
var entry;
// BuiltinServiceList - for main MSN TV services
tvShell.UserManager.CurrentUser.ServiceList.Clear(); //Always clear the list first to avoid dupes.
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('home::home');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Pages/Home/Home.aspx';
entry.KeyCode = 0xAC; // VK_BROWSER_HOME
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('home::bgmusic');
entry.URL = '}';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('home::backendproxy');
entry.URL = 'http://sg1.trusted.msntv.msn.com/BackendProxy';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('home::radioplus');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Stations.xml';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('mail::listmail');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Pages/Mail/listmail.aspx';
entry.KeyCode = 0xB4; // VK_LAUNCH_MAIL
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('mail::writemail');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Pages/Mail/writemail.aspx';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('chat::home');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Pages/Chat/Chat.html';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('messenger::root');
entry.URL = 'http://login.live.com:1863';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('messenger::passport');
entry.URL = 'https://login.live.com';
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('search::search');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Pages/Search/search.html';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('search::main');
entry.URL = 'http://sg1.trusted.msntv.msn.com/Pages/Search/categories.html';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('discuss::home');
entry.URL = 'http://sg1.trusted.msntv.msn.com/';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('maps::main');
entry.URL = 'http://sg1.trusted.msntv.msn.com/';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('Settings::HomeNetwork');
entry.URL = 'msntv:/Settings/Network/HomeNetworking.html';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('settings::mainindex');
entry.URL = 'http://sg1.trusted.msntv.msn.com/settings/main.aspx';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('UAM::UAMbase');
entry.URL = 'http://sg1.trusted.msntv.msn.com/';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('Photo::Home');
entry.URL = 'msntv:/Photo/PhotoHome.html';
entry.Safe = true;
entry = tvShell.UserManager.CurrentUser.ServiceList.Add('Photos');
entry.URL = 'msntv:/Photo/PhotoHome.html';
entry.Safe = true;
// Add services to ServiceList
tvShell.ServiceList.Clear();
entry = tvShell.ServiceList.Add('home::cinemanow');
entry.URL = 'http://g.msn.com/5TVANDURIL/4000';
entry = tvShell.ServiceList.Add('msn::radioplus');
entry.URL = 'http://radio.msn.com/asx/generate';
entry = tvShell.ServiceList.Add('music::radiohome');
entry.URL = 'http://radio.msn.com/asx/generate';
entry = tvShell.ServiceList.Add('msn::musicnews');
entry.URL = 'http://www.msnbc.msn.com/id/3032433/';
entry = tvShell.ServiceList.Add('connection::popupcontrol');
entry.URL = 'http://sg1.trusted.msntv.msn.com/connection/PopupControlWhiteList.ashx';
entry = tvShell.ServiceList.Add('connection::reconnect');
entry.URL = 'http://headwaiter.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Authorize';
entry = tvShell.ServiceList.Add('connection::nightly_login');
entry.URL = 'http://headwaiter.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Nightly';
entry = tvShell.ServiceList.Add('mail::check');
entry.URL = 'http://sg1.trusted.msntv.msn.com/apps/connection/CheckMail.aspx?phase=CheckMail&purpose=CheckMail';
entry.Safe = true;
if (wanProvider === "MSNIANB") {
entry = tvShell.ServiceList.Add('home::videoplus');
entry.URL = 'msntv:/Video/VideoHome.html';
entry.Safe = true;
} else {
entry = tvShell.ServiceList.Add('home::videoplus');
entry.URL = 'http://sg1.trusted.msntv.msn.com/pages/msnvideo/main';
entry.Safe = true;
}
if (wanProvider === "MSNIANB") {
entry = tvShell.ServiceList.Add('home::musicvideo');
entry.URL = 'msntv:/Music/MusicHome.html';
entry.Safe = true;
} else {
entry = tvShell.ServiceList.Add('home::musicvideo');
entry.URL = 'http://sg1.trusted.msntv.msn.com/pages/msnvideo/main?p=music';
entry.Safe = true;
}
entry = tvShell.ServiceList.Add('connection::resetpassword');
entry.URL = 'http://sg1.trusted.msntv.msn.com/connection/GatePage?phase=Bootstrap&purpose=ResetPassword';
entry = tvShell.ServiceList.Add('connection::pagepatch');
entry.URL = 'http://sg1.trusted.msntv.msn.com/connection/PagePatch.ashx';
entry = tvShell.ServiceList.Add('connection::login');
entry.URL = 'http://headwaiter.trusted.msntv.msn.com/connection/GatePage.aspx?phase=Bootstrap&purpose=Authorize';
entry.Description = '${minisrv_config.config.service_name}/sg1 [${minisrv_config.config.hide_minisrv_version ? "beta" : minisrv_version_string.replace("zefie's wtv minisrv ","")}]';
entry = tvShell.ServiceList.Add('ctags::main');
entry.URL = 'http://c.msn.com/c.gif?di=1455&pi=68206&tp=http%3a%2f%2fmsntv.msn.com%2fclient%2f';
tvShell.ServiceList.Save();
}
function IsServicePanel() {
if ((window.name == null) || ((window.name != null) && (window.name.toLowerCase() != 'service'))) {
return false;
}
return true;
}
function DontContinue() {
var currentUser = tvShell.UserManager.CurrentUser;
if (currentUser != null && currentUser.IsAuthorized) {
tvShell.PanelManager.Item('main').GotoURL(tvShell.UserManager.CurrentUser.ServiceList.Item('home::home').URL);
tvShell.PanelManager.Item('main').ClearTravelLog();
tvShell.PanelManager.Item('main').NoBackToMe = true;
} else {
tvShell.ConnectionManager.ServiceState = 'ReSignIn';
}
}
if (!IsServicePanel()) {
DontContinue();
} else {
SetServiceList();
tvShell.UserManager.SetCurrentUserIsAuthorized(true);
tvShell.ConnectionManager.ServiceState = 'Authorized';
var dt = new Date();
tvShell.UserManager.LastLoginTime = dt.getTime() / 1000 + dt.getTimezoneOffset() * 60;
tvShell.UserManager.OfflineAppMaxAccessDays = 20;
tvShell.UserManager.OfflineAppMaxAccessTimes = 20;
tvShell.UserManager.Save();
tvShell.PanelManager.Item('main').GotoURL(tvShell.UserManager.CurrentUser.ServiceList.Item('home::home').URL);
tvShell.PanelManager.Item('main').ClearTravelLog();
tvShell.PanelManager.Item('main').NoBackToMe = true;
}
</script>
</body>
</html>`;