fix server switching

This commit is contained in:
zefie
2022-11-28 11:47:48 -05:00
parent 260407ebad
commit 6fa4a0c368
2 changed files with 52 additions and 20 deletions

View File

@@ -62,7 +62,9 @@ if (session_data.data_store.wtvsec_login) {
var bootrom = parseInt(session_data.get("wtv-client-bootrom-version")); var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !request_headers.query.guest_login && !bootrom !== 0); var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !request_headers.query.guest_login && !bootrom !== 0);
var wtv_script_id = parseInt(session_data.get("wtv-script-id")); var wtv_script_id = parseInt(session_data.get("wtv-script-id"));
var wtv_script_mod = parseInt(session_data.get("wtv-script-mod"));
if ((request_headers.query.reconnect || request_headers.query.relogin) && wtv_script_id != 0) send_tellyscript = false; if ((request_headers.query.reconnect || request_headers.query.relogin) && wtv_script_id != 0) send_tellyscript = false;
if (wtv_script_id !== 0 && wtv_script_mod !== 0) send_tellyscript = false;
if (send_tellyscript) { if (send_tellyscript) {
if (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist) { if (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist) {
var send_telly_to_ssid = (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist.findIndex(element => element == socket.ssid) != -1) var send_telly_to_ssid = (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist.findIndex(element => element == socket.ssid) != -1)

View File

@@ -1,15 +1,49 @@
var minisrv_service_file = true; var minisrv_service_file = true;
if (request_headers.query.machine && request_headers.query.port) {
headers = `200 OK
Content-Type: text/html
Connection: close
wtv-connection-close: true
wtv-service: reset
wtv-service: name=wtv-1800 host=${request_headers.query.machine} port=${request_headers.query.port} flags=0x00000004 connections=1
wtv-boot-url: wtv-1800:/preregister
`
data = `<html>
<head>
<title>Connect Setup v2.2-minisrv</title>
<DISPLAY noscroll allowoffline notvaudio nooptions switchtowebmode noreconnectalert>
</head>
<body bgcolor="#3C2F47" text="#cbcbcb" link="#aaaaaa"
hspace="0" vspace="0" fontsize="large" noscroll hideoptions onload="load()">
<h2>Connecting...</h2>
Please wait while we connect you to ${request_headers.query.machine}:${request_headers.query.port} ...
<script>
function activ() {
location.href = "client:activ";
}
function load() {
location.href = "client:hangup";
setTimeout(activ, 1000);
}
</script>
</body>
</html>
`;
} else {
headers = `200 OK headers = `200 OK
Content-Type: text/html` Content-Type: text/html`
data = `<html> data = `<html>
<head> <head>
<title>Connect Setup v2.2-minisrv</title> <title>Connect Setup v2.2-minisrv</title>
<DISPLAY noscroll allowoffline notvaudio switchtowebmode noreconnectalert> <DISPLAY noscroll notvaudio switchtowebmode>
</head> </head>
<body bgcolor="#3C2F47" text="#cbcbcb" link="#aaaaaa" <body bgcolor="#3C2F47" text="#cbcbcb" link="#aaaaaa"
hspace="0" vspace="0" fontsize="large" noscroll hideoptions> hspace="0" vspace="0" fontsize="large" noscroll>
<table cellspacing="0" cellpadding="0" cellborder="0"> <table cellspacing="0" cellpadding="0" cellborder="0">
<tr> <tr>
@@ -31,18 +65,13 @@ hspace="0" vspace="0" fontsize="large" noscroll hideoptions>
<script> <script>
function doConnect2() {
document.connect.submit();
location.href = "client:activ";
}
function doConnect() { function doConnect() {
if (document.connect.machine.value == "${minisrv_config.services['wtv-1800'].host}" && document.connect.port.value == "${minisrv_config.services['wtv-1800'].port}") { // if (document.connect.machine.value == "${minisrv_config.services['wtv-1800'].host}" && document.connect.port.value == "${minisrv_config.services['wtv-1800'].port}") {
alert("You are already here!"); // alert("You are already here!");
} else { // } else {
location.href = "client:hangup"; document.connect.submit();
setTimeout(doConnect2, 500); // }
}
} }
@@ -70,7 +99,7 @@ hspace="0" vspace="0" fontsize="large" noscroll hideoptions>
document.message.msg.value='Default WebTV Production IP/Port. Can be used to check your routing setup.' document.message.msg.value='Default WebTV Production IP/Port. Can be used to check your routing setup.'
break; break;
case "wni-int": case "wni-int":
document.connect.machine.value="10.0.128.1" document.connect.machine.value="192.168.11.8"
document.connect.port.value="1615" document.connect.port.value="1615"
document.message.msg.value='Default WebTV Internal IP/Port. Can be used to check your routing setup.' document.message.msg.value='Default WebTV Internal IP/Port. Can be used to check your routing setup.'
break; break;
@@ -83,7 +112,7 @@ hspace="0" vspace="0" fontsize="large" noscroll hideoptions>
} }
} }
</script> </script>
<form name="connect" action="client:ConfirmConnectSetup"> <form name="connect" action="wtv-tricks:/cSetup">
<table width=100% cellspacing=1 cellpadding=0> <table width=100% cellspacing=1 cellpadding=0>
<tr> <tr>
<td colspan=3> <td colspan=3>
@@ -172,3 +201,4 @@ hspace="0" vspace="0" fontsize="large" noscroll hideoptions>
</body> </body>
</html>`; </html>`;
}