fix registration and guest mode for unregistered clients

This commit is contained in:
zefie
2022-10-16 12:24:12 -04:00
parent f42837b8bb
commit 8488b6ec6f
3 changed files with 6 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ if (request_headers.query.reconnect && session_data.getSessionData("registered")
if (session_data.data_store.wtvsec_login) {
var prereg_contype = "text/html";
if (request_headers.query.relogin) { // relogin
if (request_headers.query.relogin || request_headers.query.guest_login) { // relogin
session_data.data_store.wtvsec_login.ticket_b64 = null; // clear old ticket
}
@@ -58,7 +58,7 @@ if (session_data.data_store.wtvsec_login) {
var file_path = null;
var bf0app_update = false;
var romtype = session_data.get("wtv-client-rom-type");
var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin);
var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !request_headers.query.guest_login);
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;
@@ -165,7 +165,7 @@ if (session_data.data_store.wtvsec_login) {
if (bf0app_update) headers += getServiceString('wtv-star', { "no_star_word": true }) + "\n";
else headers += getServiceString('wtv-star') + "\n";
if (request_headers.query.reconnect && !session_data.getSessionData("registered") && !session_data.lockdown) headers += getServiceString('wtv-register') + "\n";
if (request_headers.query.reconnect && !session_data.isRegistered() && !session_data.lockdown) headers += getServiceString('wtv-register') + "\n";
if (!session_data.lockdown) headers += getServiceString('wtv-flashrom') + "\n";
if (bf0app_update) headers += "wtv-boot-url: " + gourl + "\n";
else {

View File

@@ -9,6 +9,8 @@ if (gourl) {
wtv-open-isp-disabled: false
`;
if (!session_data.isRegistered() && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) {
// fake logged in for reg
session_data.setUserLoggedIn(true);
headers += `wtv-encrypted: true
${getServiceString('wtv-register')}
${getServiceString('wtv-head-waiter')}

View File

@@ -10,7 +10,7 @@ else if (request_headers.query.reconnect) gourl += "reconnect=true";
else gourl += "initial_login=true"
if (request_headers.query.guest_login) {
if (request_headers.query.relogin || request_headers.query.reconnect) gourl += "&";
if (gourl.substr(-1) != "?") gourl += "&";
gourl += "guest_login=true";
if (request_headers.query.skip_splash) gourl += "&skip_splash=true";
}