fun with alpha

This commit is contained in:
zefie
2022-10-23 00:36:07 -04:00
parent 315e973e1f
commit c20824d36d
5 changed files with 19 additions and 10 deletions

View File

@@ -2,7 +2,8 @@ var minisrv_service_file = true;
var gourl = "wtv-head-waiter:/login?"; var gourl = "wtv-head-waiter:/login?";
if (socket.ssid) {
if (session_data) {
if (session_data.loadSessionData() == true) { if (session_data.loadSessionData() == true) {
console.log(" * Loaded session data from disk for", wtvshared.filterSSID(socket.ssid)) console.log(" * Loaded session data from disk for", wtvshared.filterSSID(socket.ssid))
session_data.setSessionData("registered", (session_data.getSessionData("registered") == true) ? true : false); session_data.setSessionData("registered", (session_data.getSessionData("registered") == true) ? true : false);
@@ -58,9 +59,9 @@ if (session_data.data_store.wtvsec_login) {
var file_path = null; var file_path = null;
var bf0app_update = false; var bf0app_update = false;
var romtype = session_data.get("wtv-client-rom-type"); var romtype = session_data.get("wtv-client-rom-type");
var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !request_headers.query.guest_login); 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 wtv_script_id = parseInt(session_data.get("wtv-script-id")); var wtv_script_id = parseInt(session_data.get("wtv-script-id"));
var bootrom = session_data.get("wtv-client-bootrom-version");
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 (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) {

View File

@@ -86,7 +86,7 @@ minisrv-no-mail-count: true
Content-Type: text/html`; Content-Type: text/html`;
if (client_challenge_response) { if (client_challenge_response) {
headers += ` headers += `
wtv-encrypted: true`; wtv-encrypted: ${(request_headers['wtv-encrypted']) ? wtvshared.parseBool(request_headers['wtv-encrypted']) : true}`;
if (wtvsec_login) session_data.data_store.wtvsec_login.update_ticket = true; if (wtvsec_login) session_data.data_store.wtvsec_login.update_ticket = true;
} }
if (limitedLoginRegistered && session_data.getUserPasswordEnabled()) gourl = "wtv-head-waiter:/password?"; if (limitedLoginRegistered && session_data.getUserPasswordEnabled()) gourl = "wtv-head-waiter:/password?";

View File

@@ -1,17 +1,19 @@
var minisrv_service_file = true; var minisrv_service_file = true;
var gourl = null; var gourl = null;
var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
if (!session_data.isRegistered() && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) gourl = "wtv-register:/splash?"; if (!session_data.isRegistered() && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) gourl = "wtv-register:/splash?";
var home_url = "wtv-home:/home?"; var home_url = "wtv-home:/home?";
if (gourl) { if (gourl) {
headers = `200 OK headers = "200 OK\n";
wtv-open-isp-disabled: false if (bootrom !== 0) headers += "wtv-open-isp-disabled: false\n";
`;
if (!session_data.isRegistered() && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) { if (!session_data.isRegistered() && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) {
// fake logged in for reg // fake logged in for reg
session_data.setUserLoggedIn(true); session_data.setUserLoggedIn(true);
headers += `wtv-encrypted: true headers += `wtv-encrypted: ${(request_headers['wtv-encrypted']) ? wtvshared.parseBool(request_headers['wtv-encrypted']) : true}
${getServiceString('wtv-register')} ${getServiceString('wtv-register')}
${getServiceString('wtv-head-waiter')} ${getServiceString('wtv-head-waiter')}
${getServiceString('wtv-star')} ${getServiceString('wtv-star')}
@@ -175,11 +177,11 @@ wtv-inactive-timeout: 1440
wtv-show-time-enabled: true wtv-show-time-enabled: true
wtv-allow-dsc: true wtv-allow-dsc: true
wtv-tourist-enabled: true wtv-tourist-enabled: true
wtv-open-isp-disabled: false
wtv-offline-mail-enable: false wtv-offline-mail-enable: false
wtv-demo-mode: 0 wtv-demo-mode: 0
wtv-wink-deferrer-retries: 3 wtv-wink-deferrer-retries: 3
wtv-name-server: 8.8.8.8`; wtv-name-server: 8.8.8.8`;
if (bootrom !== 0) { headers += "\nwtv-open-isp-disabled: false" }
} }
} }
if (!request_headers.query.reconnect) headers += "\nwtv-visit: " + gourl; if (!request_headers.query.reconnect) headers += "\nwtv-visit: " + gourl;

View File

@@ -9,7 +9,8 @@ if (request_headers.query.relogin) gourl += "relogin=true";
else if (request_headers.query.reconnect) gourl += "reconnect=true"; else if (request_headers.query.reconnect) gourl += "reconnect=true";
else gourl += "initial_login=true" else gourl += "initial_login=true"
if (request_headers.query.guest_login) { var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
if (request_headers.query.guest_login || bootrom === 0) {
if (gourl.substr(-1) != "?") gourl += "&"; if (gourl.substr(-1) != "?") gourl += "&";
gourl += "guest_login=true"; gourl += "guest_login=true";
if (request_headers.query.skip_splash) gourl += "&skip_splash=true"; if (request_headers.query.skip_splash) gourl += "&skip_splash=true";

View File

@@ -818,6 +818,11 @@ minisrv-no-mail-count: true`;
processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services); processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services);
} else if ((shortURL.indexOf('http://') >= 0 || shortURL.indexOf('https://') >= 0) && !pc_services) { } else if ((shortURL.indexOf('http://') >= 0 || shortURL.indexOf('https://') >= 0) && !pc_services) {
doHTTPProxy(socket, request_headers); doHTTPProxy(socket, request_headers);
} else if (shortURL.indexOf('file://') >= 0) {
shortURL = shortURL.replace("file://",'').replace("romcache", "ROMCache");
service_name = "wtv-star";
var urlToPath = wtvshared.fixPathSlashes(service_name + path.sep + shortURL);
processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services);
} else if (pc_services) { } else if (pc_services) {
// if a directory, request index // if a directory, request index
if (shortURL.substring(shortURL.length - 1) == "/") shortURL += "index"; if (shortURL.substring(shortURL.length - 1) == "/") shortURL += "index";