new setup page (need to implement zipcode), better client_emu.js

This commit is contained in:
zefie
2025-08-09 20:14:08 -04:00
parent 709a282abd
commit f89dd38b13
6 changed files with 373 additions and 537 deletions

View File

@@ -0,0 +1,136 @@
var minisrv_service_file = true;
var timezone = "-0000";
if (session_data.isRegistered()) {
timezone = session_data.getSessionData("timezone") || timezone;
if (request_headers.query.timezone) {
timezone = request_headers.query.timezone;
session_data.setSessionData("timezone", timezone);
}
}
strf = strftime.timezone(timezone)
headers = `200 OK
Connection: Keep-Alive
wtv-expire-all: wtv-
wtv-expire-all: http
wtv-client-time-zone: GMT -0000
wtv-client-time-dst-rule: false
wtv-client-date: ${strf("%a, %d %b %Y %H:%M:%S", new Date(new Date().setUTCSeconds(new Date().getUTCSeconds())))}
Content-Type: text/html`
html = `<HTML>
<HEAD>
<TITLE>
Region Settings
</TITLE>
<DISPLAY nosave skipback noscroll>
</HEAD>
<sidebar width=110> <table cellspacing=0 cellpadding=0 BGCOLOR=452a36>
<tr>
<td colspan=3 abswidth=104 absheight=4>
<td rowspan=99 width=6 absheight=420 valign=top align=left>
<img src="file://ROM/Cache/Shadow.gif" width=6 height=420>
<tr>
<td abswidth=6>
<td abswidth=92 absheight=76>
<table absheight=76 cellspacing=0 cellpadding=0>
<tr>
<td align=right>
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
</table>
<td abswidth=6>
<tr><td absheight=5 colspan=3>
<table cellspacing=0 cellpadding=0>
<tr><td abswidth=104 absheight=2 valign=middle align=center bgcolor=2e1e26>
<spacer>
<tr><td abswidth=104 absheight=1 valign=top align=left>
<tr><td abswidth=104 absheight=2 valign=top align=left bgcolor=6b4657>
<spacer>
</table>
<tr><td absheight=132>
<tr><td absheight=166 align=right colspan=3>
<img src="ROMCache/SettingsBanner.gif" width=54 height=166>
<tr><td absheight=41>
</table>
</sidebar>
<BODY BGCOLOR="#191919" TEXT="#44cc55" LINK="189CD6" VLINK="189CD6" HSPACE=0 VSPACE=0 FONTSIZE="large">
<table cellspacing=0 cellpadding=0>
<tr>
<td abswidth=14>
<td abswidth=416 absheight=80 valign=center>
<font size="+2" color="E7CE4A"><blackface><shadow>
Region Settings
<td abswidth=20>
<tr>
<td>
<td absheight=244 valign=top align=left>
Current system time: <clock></clock><br><br>
<form action="wtv-setup:/region" method="post">
Your current timezone is set to: <b>${timezone}</b><br><br>`;
const timezones = [
["UTC-12:00", "-1200"], ["UTC-11:00", "-1100"], ["UTC-10:00", "-1000"], ["UTC-09:00", "-0900"], ["UTC-08:00", "-0800"],
["UTC-07:00", "-0700"], ["UTC-06:00", "-0600"], ["UTC-05:00", "-0500"], ["UTC-04:00", "-0400"], ["UTC-03:00", "-0300"],
["UTC-02:00", "-0200"], ["UTC-01:00", "-0100"], ["UTC&#177;00:00", "-0000"], ["UTC+01:00", "+0100"], ["UTC+02:00", "+0200"],
["UTC+03:00", "+0300"], ["UTC+04:00", "+0400"], ["UTC+05:00", "+0500"], ["UTC+06:00", "+0600"], ["UTC+07:00", "+0700"],
["UTC+08:00", "+0800"], ["UTC+09:00", "+0900"], ["UTC+10:00", "+1000"], ["UTC+11:00", "+1100"], ["UTC+12:00", "+1200"]
];
html += `<select name="timezone" onchange="this.form.submit()">\n`;
for (const tz of timezones) {
html += ` <option value="${tz[1]}" ${tz[1] === timezone ? 'selected' : ''}>${tz[0]}</option>\n`;
}
html += `</select>`;
html += `</form>
<p>
<hr>
<p>
<form action="submit" method="post">
<b>Zip Code Entry</b>
<p>
Zip Code:
<input type="text" name="zip" size="10" maxlength="5">
<input type="submit" value="Submit">
</form>
<TR>
<TD>
<TD COLSPAN=4 HEIGHT=0 VALIGN=top ALIGN=left>
<tr>
<TD>
<td colspan=3 height=2 valign=middle align=center bgcolor="2B2B2B">
<spacer type=block width=436 height=1>
<tr>
<TD>
<td colspan=4 height=1 valign=top align=left>
<tr>
<TD>
<td colspan=3 height=2 valign=top align=left bgcolor="0D0D0D">
<spacer type=block width=436 height=1>
<TR>
<TD>
<TD COLSPAN=4 HEIGHT=4 VALIGN=top ALIGN=left>
<TR>
<TD>
<TD COLSPAN=2 VALIGN=top ALIGN=left>
<tr>
<TD COLSPAN=2 VALIGN=top ALIGN=right>
<FORM action="wtv-setup:/setup">
<FONT COLOR="#E7CE4A" SIZE=-1><SHADOW>
<INPUT TYPE=SUBMIT BORDERIMAGE="file://ROM/Borders/ButtonBorder2.bif" Value=Done NAME="Done" USESTYLE WIDTH=103>
</SHADOW></FONT></FORM>
<TD>
</TABLE>
</BODY>
</HTML>
`;
data = html;

View File

@@ -50,9 +50,8 @@ Settings
<tr><td absheight=41>
</table>
</sidebar>
<BODY BGCOLOR="#191919" TEXT="#42CC55" LINK="36d5ff" VLINK="36d5ff" FONTSIZE="large"
hspace=0 vspace=0
>
<BODY BGCOLOR="#191919" TEXT="#42CC55" LINK="36d5ff" VLINK="36d5ff" FONTSIZE="small" hspace=0 vspace=0>
<table cellspacing=0 cellpadding=0>
<tr>
<td abswidth=14>
@@ -60,7 +59,7 @@ hspace=0 vspace=0
<table cellspacing=0 cellpadding=0>
<tr>
<td valign=center absheight=80>
<shadow><blackface><font color="e7ce4a" font size="+1">
<shadow><blackface><font color="e7ce4a" font size="5">
Settings
for ${session_data.getSessionData("subscriber_username") || "You"}
</font><blackface><shadow>
@@ -77,118 +76,95 @@ for ${session_data.getSessionData("subscriber_username") || "You"}
<td colspan=4 height=2 valign=top align=left bgcolor="0D0D0D">
<spacer type=block width=436 height=1>
<td abswidth=20>
<TR>
<td>
<font size="-1">
<td WIDTH=150 HEIGHT=244 VALIGN=top ALIGN=left>
<br><font size="-1"><blackface>
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/mail">Mail</a><BR>
<spacer type=block width=1 height=5><BR>`;
if (minisrv_config.config.passwords) {
if (minisrv_config.config.passwords.enabled) {
data += `<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/edit-password">Password</a><BR>
<spacer type=block width=1 height=5><BR>`;
}
}
data += `
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/screen">Television</a><BR>
<spacer type=block width=1 height=5><BR>
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/text">Text size</a><BR>
<spacer type=block width=1 height=5><BR>
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/sound">Music</a><BR>
<spacer type=block width=1 height=5><BR>`;
//printing
if (!minisrv_config.config.hide_incomplete_features) {
data += `<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="${notImplementedAlert}"><strike>Printing</strike></a><BR>
<spacer type=block width=1 height=5><BR>`;
}
data += `
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/keyboard">Keyboard</a><BR>
<spacer type=block width=1 height=5><BR>`;
if (session_data.user_id == 0) {
data += `<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/accounts">Extra Users</a><BR>
<spacer type=block width=1 height=5><BR>`;
}
data += `
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/messenger">Messenger</a><BR>
<spacer type=block width=1 height=5><BR>
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/phone">Dialing</a><BR>
<spacer type=block width=1 height=5><BR>
<img src="ROMCache/BulletArrow.gif" width=6 height=13 valign=absmiddle><spacer type=block width=6 height=1>
<a href="wtv-setup:/tweaks">Tweaks</a><BR>
<TD WIDTH=20>
<TD WIDTH=300 VALIGN=top ALIGN=left>
<spacer type=block width=6 height=14><font size="2"><br>
Signature <strike>and more</strike><BR>
<spacer type=block width=6 height=5><font size="2"><br>
Change your password<BR>
<spacer type=block width=6 height=5><font size="2"><br>
Options for your TV<BR>
<spacer type=block width=6 height=5><font size="2"><br>
Make text bigger or smaller<BR>
<spacer type=block width=6 height=5><font size="2"><br>
Play background songs<BR>
<spacer type=block width=6 height=5><font size="2"><br>`;
// printing
if (!minisrv_config.config.hide_incomplete_features) {
data += `<strike>Change how you print</strike><BR>
<spacer type=block width=6 height=5><font size="2"><br>`;
}
data += `Choose an on-screen keyboard<BR>`;
if (session_data.user_id == 0) {
data += `<spacer type=block width=6 height=5><font size="2"><br>
Add, change, or remove users<BR>`;
}
data += `<spacer type=block width=6 height=5><font size="2"><br>
Configure Messenger<BR>`;
data += `<spacer type=block width=6 height=6><font size="2"><br>
Connecting to WebTV<BR>
<spacer type=block width=6 height=6><font size="2"><br>
minisrv specific settings<BR>
<tr>
<td colspan=4 height=2>
<tr>
<TD>
<td colspan=4 height=2 valign=middle align=center bgcolor="2B2B2B">
<spacer type=block width=436 height=1>
<tr>
<TD>
<td colspan=4 height=1 valign=top align=left>
<tr>
<TD>
<td colspan=4 height=2 valign=top align=left bgcolor="0D0D0D">
<spacer type=block width=436 height=1>
<TR>
<TD>
<TD COLSPAN=4 HEIGHT=4 VALIGN=top ALIGN=left>
<TR>
<TD>
<TD COLSPAN=3 VALIGN=top ALIGN=right>
<FORM
action="wtv-home:/home" selected>
<table cellspacing=0 cellpadding=2>
<br><br>
<tr>
<td width=20>&nbsp;</td>
<td width=160><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/mail"><font size=2>Mail</a></td>
<td width=220><font size=2>Signature <strike>and more</strike></td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/edit-password"><font size=2>Password</a></td>
<td><font size=2>Change your password</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/screen"><font size=2>Television</a></td>
<td><font size=2>Options for your TV</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/text"><font size=2>Text size</a></td>
<td><font size=2>Make text bigger or smaller</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/sound"><font size=2>Music</a></td>
<td><font size=2>Play background songs</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="${notImplementedAlert}"><font size=2><strike>Printing</strike></a></td>
<td><strike><font size=2>Change how you print</strike></td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/keyboard"><font size=2>Keyboard</a></td>
<td><font size=2>Choose an on-screen keyboard</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/accounts"><font size=2>Extra Users</a></td>
<td><font size=2>Add, change, or remove users</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/messenger"><font size=2>Messenger</a></td>
<td><font size=2>Configure Messenger</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/phone"><font size=2>Dialing</a></td>
<td><font size=2>Connecting to WebTV</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/region"><font size=2>Region Settings</a></td>
<td><font size=2>Change timezone and zip code</td>
</tr>
<tr>
<td width=20>&nbsp;</td>
<td><img src="ROMCache/BulletArrow.gif" width=6 height=6 valign=absmiddle>
<a href="wtv-setup:/tweaks"><font size=2>Tweaks</a></td>
<td><font size=2>minisrv specific settings</td>
</tr>
</table>
<table width=100%>
<tr><td align=right>
<spacer type=block width=436 height=4>
<FORM action="wtv-home:/home" selected>
<FONT COLOR="#E7CE4A" SIZE=-1><SHADOW>
<INPUT TYPE=SUBMIT BORDERIMAGE="file://ROM/Borders/ButtonBorder2.bif" Value=Done NAME="Done" USESTYLE WIDTH=103>
<INPUT TYPE=SUBMIT BORDERIMAGE="file://ROM/Borders/ButtonBorder2.bif" Value=Done NAME="Done" USESTYLE WIDTH=103>&nbsp;&nbsp;&nbsp;
</SHADOW></FONT></FORM>
<TD>
</TABLE>
</BODY>
</HTML>
`;

View File

@@ -314,12 +314,12 @@ class WTVSec {
* @param {CryptoJS.lib.WordArray|ArrayBuffer|Buffer} data Data to encrypt
* @returns {ArrayBuffer} Encrypted data
*/
Encrypt(keynum, data) {
Encrypt(keynum, data, reverse = false) {
let session_id;
if (keynum === 0) {
session_id = 0;
session_id = (reverse) ? 1 : 0;
} else if (keynum === 1) {
session_id = 2;
session_id = (reverse) ? 3 : 2;
} else {
throw new Error("Invalid key option (0 or 1 only)");
}
@@ -345,8 +345,8 @@ class WTVSec {
* @returns {ArrayBuffer} Decrypted data
* @notice This function is an alias for Encrypt, as WTVSec uses the same method for both encryption and decryption.
*/
Decrypt(keynum, data) {
return this.Encrypt(keynum, data)
Decrypt(keynum, data, reverse = false) {
return this.Encrypt(keynum, data, reverse)
}
}