somewhat guest login
This commit is contained in:
@@ -11,13 +11,43 @@ headers = `Status: 200 OK
|
||||
Content-type: text/html`;
|
||||
|
||||
data = `<HTML xmlns:msntv>
|
||||
<?import namespace="msntv" implementation="https://sg1.trusted.msntv.msn.com/HTC/CustomButton.htc">
|
||||
<?import namespace="msntv" implementation="https://sg1.trusted.msntv.msn.com/Include/HTC/Shared/CustomButton.htc">
|
||||
<HEAD>
|
||||
<title id="title">Login to Passport</title>
|
||||
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
|
||||
<link rel="stylesheet" type="text/css" href="msntv:/Registration/css/Registration.css">
|
||||
<script src="/Include/2.0.261.778/localhost-1700/Shared/BaseClient/JsTransforms/en-us/PaneHelp.js" language="javascript" defer="true"></script>
|
||||
<script src="/Include/2.0.261.778/localhost-1700/Shared/Anduril/JsTransforms/en-us/Scripts.js" language="javascript"></script>
|
||||
<script src="msntv:/Javascript/TVShell.js" language="javascript"></script>
|
||||
<script src="msntv:/Javascript/GuestUser.js" language="javascript"></script>
|
||||
<script src="msntv:/Javascript/ServiceList.js" language="javascript"></script>
|
||||
<script language="javascript">
|
||||
function handleGuest() {
|
||||
if (!GuestUserExists()) {
|
||||
InitializeGuestMode();
|
||||
var PersistentProperties = TVShell.Property("Persistent/");
|
||||
|
||||
if (!PersistentProperties) {
|
||||
return;
|
||||
}
|
||||
|
||||
PersistentProperties.Add("GuestMode", "Guest");
|
||||
PersistentProperties.Save();
|
||||
|
||||
AddGuestUser();
|
||||
var signon = TVShell.BuiltinServiceList.Item("SignOn");
|
||||
var panel = TVShell.PanelManager.FocusedPanel;
|
||||
var atLogin = false;
|
||||
if ( signon && panel && panel.Name == "main" )
|
||||
{
|
||||
if ( IsMainPanelOnPage( signon.URL ) ) atLogin = true;
|
||||
}
|
||||
}
|
||||
if (!atLogin) {
|
||||
GotoSignOn();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<STYLE>
|
||||
body {
|
||||
background-image: url(msntv:/Registration/images/bgimage.jpg);
|
||||
@@ -46,8 +76,13 @@ data = `<HTML xmlns:msntv>
|
||||
<tr style="margin: 0; padding: 0; top: 2px; position: relative;">
|
||||
<td style="margin: 0; padding: 0; vertical-align: middle; top: 2px; position: relative;"><img src="msntv:/Shared/Images/BulletCustom.gif" height="14" width="7" alt="Bullet"></td>
|
||||
<td style="margin: 0; padding: 0; width: 4px;"></td>
|
||||
<td style="margin: 0; padding: 0; font:bold 18; line-height: 20px;"><a class="shrLnk2" href="/Register/minisrv-import.asx" style="display: inline-block; line-height: 20px;">I want to use my existing minisrv account</a> (TODO)</td>
|
||||
<td style="margin: 0; padding: 0; font:bold 18; line-height: 20px;"><a class="shrLnk2" href="/Register/Login-to-WebTV.aspx" style="display: inline-block; line-height: 20px;">I want to use my existing minisrv account</a> (TODO)</td>
|
||||
</tr>
|
||||
<tr style="margin: 0; padding: 0; top: 2px; position: relative;">
|
||||
<td style="margin: 0; padding: 0; vertical-align: middle; top: 2px; position: relative;"><img src="msntv:/Shared/Images/BulletCustom.gif" height="14" width="7" alt="Bullet"></td>
|
||||
<td style="margin: 0; padding: 0; width: 4px;"></td>
|
||||
<td style="margin: 0; padding: 0; font:bold 18; line-height: 20px;"><a class="shrLnk2" onclick="handleGuest()" style="display: inline-block; line-height: 20px;">I want to sign in as a guest</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</DIV>
|
||||
|
||||
@@ -76,17 +76,16 @@ data = `<html xmlns:msntv>
|
||||
|
||||
<script>
|
||||
var tvShell = new ActiveXObject("MSNTV.TVShell");
|
||||
tvShell.UserManager.SetCurrentUserIsAuthorized(true);
|
||||
tvShell.ConnectionManager.ServiceState = 'Authorized';
|
||||
tvShell.UserManager.SetCurrentUserIsAuthorized(false);
|
||||
|
||||
function AddUser() {
|
||||
var user = tvShell.UserManager.AddNew("${username}");
|
||||
|
||||
if (user) {
|
||||
user.IsPersistent = false;
|
||||
user.IsPersistent = true;
|
||||
} else {
|
||||
user = tvShell.UserManager.Item("${username}");
|
||||
if (user && user.IsPersistent) {
|
||||
if (user && !user.IsPersistent) {
|
||||
user.IsPersistent = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,17 +32,20 @@ data = `<HTML xmlns:msntv>
|
||||
<BODY width="520" height="388">
|
||||
<DIV id="title">Logging into your account</DIV>
|
||||
<DIV id="main">
|
||||
<p>When using MSN TV, you will be using your webtv.net account
|
||||
to sign in. If you already have a email to WebTV, you can
|
||||
use it with MSN TV. If not, you will have to use a Hotmail or MSN address.</p>
|
||||
<p>When using MSNTV2, you can access the same minisrv account as your WebTV.</p>
|
||||
<br>
|
||||
<p>Type your WebTV e-mail in the box below:</p>
|
||||
<p>Type your existing primary username in the box below:</p>
|
||||
<div class="input-container">
|
||||
<textarea name="textarea1" id="textarea1" rows="1" cols="15"></textarea>
|
||||
<p style="display: inline;">@webtv.net</p>
|
||||
<textarea name="username" id="username" rows="1" cols="15"></textarea>
|
||||
<p style="display: inline;">@${minisrv_config.config.service_name}</p>
|
||||
</div>
|
||||
<br>
|
||||
<a>If you don't have a WebTV account, select the <EM>Back</EM> Button.</a>
|
||||
<div class="input-container">
|
||||
<textarea name="password" id="password" rows="1" cols="15"></textarea>
|
||||
</div>
|
||||
<br>
|
||||
If you don't have an existing minisrv account, select the <EM>Back</EM> Button.
|
||||
If you do not have a password set on your primary user account, you will need to set one up on your WebTV before you can log in here. After entering your username and password, select the <EM>Continue</EM> Button.
|
||||
</DIV>
|
||||
<div id="footer">
|
||||
<msntv:CustomButton id="continue" label="Continue" href="/Register/ConnectionType.aspx"/>
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
const minisrv_service_file = true;
|
||||
|
||||
let BoxId = request_headers.query.BoxId;
|
||||
if (Array.isArray(BoxId)) BoxId = BoxId[0];
|
||||
let clientIp = socket.remoteAddress;
|
||||
let banned = false;
|
||||
let sessionId = null;
|
||||
|
||||
// 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.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;
|
||||
}
|
||||
|
||||
// Current UTC time
|
||||
const now = new Date();
|
||||
|
||||
// Time data object
|
||||
const timeData = {
|
||||
hh: now.getUTCHours(),
|
||||
mm: now.getUTCMinutes(),
|
||||
ss: now.getUTCSeconds(),
|
||||
mo: now.getUTCMonth() + 1, // JS months are 0-based
|
||||
dd: now.getUTCDate(),
|
||||
yyyy: now.getUTCFullYear()
|
||||
};
|
||||
|
||||
// Timezone mapping (C# tuple → JS array or object)
|
||||
const timezoneMap = {
|
||||
"UTC": {
|
||||
standardName: "UTC",
|
||||
standardOffset: 0,
|
||||
daylightName: "UTC",
|
||||
daylightOffset: 0
|
||||
}
|
||||
};
|
||||
|
||||
// Destructure like the C# tuple deconstruction
|
||||
const {
|
||||
standardName,
|
||||
standardOffset,
|
||||
daylightName,
|
||||
daylightOffset
|
||||
} = timezoneMap["UTC"];
|
||||
|
||||
ssid_sessions[socket.ssid] = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
ssid_sessions[socket.ssid].set('SessionID', sessionId);
|
||||
|
||||
// Set session cookie on the client
|
||||
setCookie('SessionID', sessionId, { path: '/' });
|
||||
|
||||
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">
|
||||
try {
|
||||
var tvShell = new ActiveXObject("MSNTV.TVShell");
|
||||
var sink = new ActiveXObject("MSNTV.MultipleEventSink");
|
||||
function getIDCRLCode(value) {
|
||||
return value & 0xFFFF;
|
||||
}
|
||||
|
||||
function isIDCRLErrorCode(value) {
|
||||
return (value >>> 16) != 0;
|
||||
}
|
||||
var email = tvShell.UserManager.EMail;
|
||||
var wanProvider = tvShell.ConnectionManager.WANProvider;
|
||||
|
||||
var banned = ${banned}; // JavaScript boolean value
|
||||
|
||||
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 {
|
||||
SetProgress('Welcome, New User!', 100);
|
||||
tvShell.AddSecretCode(10000);
|
||||
tvShell.AddSecretCode(10001);
|
||||
tvShell.AddSecretCode(10002);
|
||||
tvShell.AddSecretCode(93288);
|
||||
tvShell.AddSecretCode(77437);
|
||||
tvShell.AddSecretCode(6145539);
|
||||
var myPanel = tvShell.PanelManager.Item('main');
|
||||
if (myPanel) myPanel.GotoURL('https://sg1.trusted.msntv.msn.com/register/Establish-your-MSN-TV-Account.html');
|
||||
tvShell.PanelManager.Item('main').ClearTravelLog();
|
||||
tvShell.PanelManager.Item('main').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) {
|
||||
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
|
||||
);
|
||||
var PPEArgs = new Array();
|
||||
var INTArgs = new Array();
|
||||
serviceArgs[0] = ProductionArgs;
|
||||
serviceArgs[1] = PPEArgs;
|
||||
serviceArgs[2] = INTArgs;
|
||||
tvShell.AddSecretCode(10000);
|
||||
tvShell.AddSecretCode(10001);
|
||||
tvShell.AddSecretCode(10002);
|
||||
tvShell.AddSecretCode(93288);
|
||||
tvShell.AddSecretCode(6145539);
|
||||
try {
|
||||
tvShell.LoginManager.IDCRLInitialize(0);
|
||||
tvShell.LoginManager.IDCRLLogonAndAuthToServices(serviceArgs[0]);
|
||||
} catch (e) {
|
||||
if (window.console) console.log("IDCRL error: " + e.message);
|
||||
}
|
||||
|
||||
GoToUserCheck();
|
||||
}
|
||||
}
|
||||
|
||||
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 CheckBoxID() {
|
||||
SetProgress('minisrv/sg1 [0.0.0.1] Welcome, Guest!', 20);
|
||||
}
|
||||
|
||||
function GoToUserCheck() {
|
||||
var url = banned ? 'https://sg1.trusted.msntv.msn.com/connection/banned.html' : 'https://sg1.trusted.msntv.msn.com/connection/usercheck.aspx';
|
||||
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 {
|
||||
CheckBoxID();
|
||||
DoPoptimization();
|
||||
DoLogin();
|
||||
|
||||
try {
|
||||
tvShell.DeviceControl.SetTimeZone(${standardOffset}, "${standardName}", 0, "");
|
||||
} catch (e) {
|
||||
if (window.console) console.log("SetTimeZone error: " + e.message);
|
||||
}
|
||||
|
||||
try {
|
||||
tvShell.DeviceControl.SetClock(${timeData.hh}, ${timeData.mm}, ${timeData.ss}, ${timeData.mo}, ${timeData.dd}, ${timeData.yyyy});
|
||||
tvShell.DeviceControl.ClockSet = true;
|
||||
} catch (e) {
|
||||
if (window.console) console.log("SetClock error: " + e.message);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
if (window.console) console.log("Error in boxcheck: " + e.message);
|
||||
|
||||
var myPanel = tvShell ? tvShell.PanelManager.Item('main') : null;
|
||||
if (myPanel) myPanel.GotoURL('https://sg1.trusted.msntv.msn.com/connection/error.html');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
Reference in New Issue
Block a user