v0.9.12 - WILL REBASE - BE WARNED
- convert post_data to query if valid query data - wtv-register system - Store Session data as JSON flat file - wtv-cookie support - spent way too much time on a page no one will read - move filterSSID to WTVClientSessionData - disable compression until fixed - do not delete WTVSec on last socket, instead recreate on prereg - set 'wtv-bypass-proxy' to false - rework header whitelist system for HTTP(s) proxy - clean up SSID session data only if client is not seen for 3 minutes - add shouldWeCompress() function - add additional headers to wtv-setup:/get - add initial blank wtv-music:/get-playlist
This commit is contained in:
@@ -24,6 +24,8 @@ if (socket.ssid !== null) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64) == client_challenge_response) {
|
||||
console.log(" * wtv-challenge-response success for " + filterSSID(socket.ssid));
|
||||
wtvsec_login.PrepareTicket();
|
||||
if (!ssid_sessions[socket.ssid].getSessionData("registered")) gourl = "wtv-register:/splash";
|
||||
|
||||
} else {
|
||||
console.log(" * wtv-challenge-response FAILED for " + filterSSID(socket.ssid));
|
||||
if (zdebug) console.log("Response Expected:", challenge_response.toString(CryptoJS.enc.Base64));
|
||||
@@ -39,66 +41,97 @@ if (socket.ssid !== null) {
|
||||
|
||||
if (gourl) {
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
Connection: Close
|
||||
wtv-open-isp-disabled: false
|
||||
wtv-visit: ${gourl}
|
||||
`;
|
||||
if (!ssid_sessions[socket.ssid].session_data.registered && !request_headers.query.guest_mode) {
|
||||
headers += `wtv-encrypted: true
|
||||
wtv-ticket: ${wtvsec_login.ticket_b64}
|
||||
${getServiceString('wtv-register')}
|
||||
${getServiceString('wtv-head-waiter')}
|
||||
${getServiceString('wtv-star')}
|
||||
wtv-boot-url: wtv-register:/splash
|
||||
`
|
||||
}
|
||||
headers += `wtv-visit: ${gourl}
|
||||
Content-type: text/html`;
|
||||
data = '';
|
||||
}
|
||||
else {
|
||||
var namerand = Math.floor(Math.random() * 100000);
|
||||
var nickname = (minisrv_config.config.service_name + '_' + namerand)
|
||||
var userid = '1' + Math.floor(Math.random() * 1000000000000000000);
|
||||
if (request_headers.query.guest_mode) {
|
||||
var namerand = Math.floor(Math.random() * 100000);
|
||||
var nickname = (minisrv_config.config.service_name + '_' + namerand)
|
||||
var human_name = nickname;
|
||||
var userid = '1' + Math.floor(Math.random() * 1000000000000000000);
|
||||
var messenger_enabled = 0;
|
||||
var messenger_authorized = 0;
|
||||
var home_url = "wtv-home:/home?";
|
||||
} else if (!ssid_sessions[socket.ssid].getSessionData("registered")) {
|
||||
var errpage = doErrorPage(400);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else {
|
||||
var userid = ssid_sessions[socket.ssid].getSessionData("subscriber_userid")
|
||||
var nickname = ssid_sessions[socket.ssid].getSessionData("subscriber_username");
|
||||
var human_name = ssid_sessions[socket.ssid].getSessionData("subscriber_name");
|
||||
var messenger_enabled = ssid_sessions[socket.ssid].getSessionData("messenger_enabled") || 0;
|
||||
var messenger_authorized = ssid_sessions[socket.ssid].getSessionData("messenger_authorized") || 0;
|
||||
var home_url = "wtv-home:/splash?";
|
||||
}
|
||||
var offline_user_list = CryptoJS.enc.Latin1.parse("<user-list>\n\t<user userid=\"" + userid + " user-name=\"" + nickname + "\" first-name=\"" + minisrv_config.config.service_name + "User \" last-name=\\" + namerand + "\" password=\"\" mail-enabled=\"true\" />\n</user-list>").toString(CryptoJS.enc.Base64);
|
||||
data = '';
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
wtv-encrypted: true
|
||||
wtv-client-time-zone: GMT -0000
|
||||
wtv-client-time-dst-rule: GMT
|
||||
wtv-client-date: `+ strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + ` GMT
|
||||
wtv-country: US
|
||||
wtv-language-header: en-US,en
|
||||
wtv-visit: client:closeallpanels
|
||||
wtv-expire-all: client:closeallpanels
|
||||
wtv-transition-override: off
|
||||
wtv-force-lightweight-targets: webtv.net:/
|
||||
wtv-smartcard-inserted-message: Contacting service
|
||||
wtv-bypass-proxy: false
|
||||
wtv-offline-user-list: ${offline_user_list}
|
||||
wtv-bypass-proxy: true
|
||||
wtv-messenger-authorized: ${messenger_authorized}
|
||||
wtv-messenger-enable: ${messenger_enabled}
|
||||
wtv-noback-all: wtv-
|
||||
wtv-service: reset
|
||||
`+ getServiceString('all', { "exceptions": ["wtv-register"] } ) + `
|
||||
user-id: ${userid}
|
||||
wtv-human-name: ${human_name}
|
||||
${ssid_sessions[socket.ssid].setIRCNick(nickname)}
|
||||
wtv-domain: wtv.zefie.com
|
||||
wtv-input-timeout: 14400
|
||||
wtv-ticket: ${wtvsec_login.ticket_b64}
|
||||
wtv-messagewatch-checktimeoffset: off
|
||||
wtv-input-timeout: 14400
|
||||
wtv-connection-timeout: 90
|
||||
wtv-fader-timeout: 900
|
||||
wtv-ssl-log-url: wtv-log:/log
|
||||
wtv-smartcard-inserted-message: Contacting service
|
||||
user-id: ${userid}
|
||||
wtv-transition-override: off
|
||||
wtv-allow-dsc: true
|
||||
wtv-messenger-enable: 0
|
||||
wtv-noback-all: wtv-
|
||||
wtv-service: reset
|
||||
`+ getServiceString('all') + `
|
||||
wtv-boot-url: wtv-1800:/preregister?relogin=true
|
||||
wtv-human-name: ${nickname}
|
||||
${ssid_sessions[socket.ssid].setIRCNick(nickname)}
|
||||
wtv-home-url: wtv-home:/home?
|
||||
wtv-domain: wtv.zefie.com
|
||||
wtv-inactive-timeout: 0
|
||||
wtv-connection-timeout: 90
|
||||
wtv-show-time-enabled: true
|
||||
wtv-fader-timeout: 900
|
||||
wtv-tourist-enabled: true
|
||||
wtv-connection-timeout: 180
|
||||
wtv-boot-url: wtv-1800:/preregister?relogin=true
|
||||
wtv-allow-dsc: true
|
||||
wtv-home-url: wtv-home:/home?
|
||||
`
|
||||
if (ssid_sessions[socket.ssid].get('wtv-need-upgrade') != 'true' && !request_headers.query.reconnect) {
|
||||
headers += "\nwtv-settings-url: wtv-setup:/get";
|
||||
}
|
||||
headers += `
|
||||
wtv-log-url: wtv-log:/log
|
||||
wtv-ssl-log-url: wtv-log:/log
|
||||
wtv-ssl-timeout: 240
|
||||
wtv-login-timeout: 7200
|
||||
wtv-open-isp-disabled: false
|
||||
wtv-log-url: wtv-log:/log
|
||||
wtv-offline-mail-enable: false
|
||||
wtv-demo-mode: 0
|
||||
wtv-wink-deferrer-retries: 3
|
||||
wtv-offline-mail-enable: false
|
||||
wtv-name-server: 8.8.8.8
|
||||
`;
|
||||
if (ssid_sessions[socket.ssid].get('wtv-need-upgrade') != 'true' && !request_headers.query.reconnect) {
|
||||
headers += "wtv-settings-url: wtv-setup:/get\n";
|
||||
}
|
||||
headers += `wtv-visit: wtv-home:/splash?
|
||||
wtv-visit: ${home_url}
|
||||
Content-Type: text/html`;
|
||||
}
|
||||
@@ -1,72 +1,59 @@
|
||||
var challenge_response, challenge_header = '';
|
||||
var challenge_response, challenge_header = "";
|
||||
|
||||
var gourl = "wtv-head-waiter:/login-stage-two?";
|
||||
if (request_headers.query.relogin) gourl += "relogin=true";
|
||||
if (request_headers.query.reconnect) gourl += "reconnect=true";
|
||||
var send_to_relogin = true;
|
||||
|
||||
if (socket.ssid !== null) {
|
||||
var wtvsec_login = ssid_sessions[socket.ssid].get("wtvsec_login");
|
||||
if (request_headers["wtv-ticket"]) {
|
||||
if (wtvsec_login.ticket_b64 == null) {
|
||||
if (request_headers["wtv-ticket"].length > 8) {
|
||||
wtvsec_login.DecodeTicket(request_headers["wtv-ticket"]);
|
||||
wtvsec_login.ticket_b64 = request_headers["wtv-ticket"];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wtvsec_login) {
|
||||
challenge_response = wtvsec_login.challenge_response;
|
||||
var client_challenge_response = request_headers["wtv-challenge-response"] || null;
|
||||
if (challenge_response && client_challenge_response) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64).substring(0, 85) == client_challenge_response.substring(0, 85)) {
|
||||
console.log(" * wtv-challenge-response success for " + socket.ssid);
|
||||
wtvsec_login.PrepareTicket();
|
||||
} else {
|
||||
challenge_header = "wtv-challenge: " + wtvsec_login.IssueChallenge();
|
||||
if (socket.ssid) {
|
||||
if (ssid_sessions[socket.ssid]) {
|
||||
if (request_headers["wtv-ticket"]) {
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 == null) {
|
||||
if (request_headers["wtv-ticket"].length > 8) {
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.DecodeTicket(request_headers["wtv-ticket"]);
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 = request_headers["wtv-ticket"];
|
||||
send_to_relogin = false;
|
||||
}
|
||||
} else {
|
||||
challenge_header = "wtv-challenge: " + wtvsec_login.IssueChallenge();
|
||||
}
|
||||
} else {
|
||||
wtvsec_login = new WTVSec();
|
||||
|
||||
}
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
var client_challenge_response = request_headers["wtv-challenge-response"] || null;
|
||||
if (challenge_response && client_challenge_response) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64).substring(0, 85) == client_challenge_response.substring(0, 85)) {
|
||||
console.log(" * wtv-challenge-response success for " + socket.ssid);
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.PrepareTicket();
|
||||
send_to_relogin = false;
|
||||
} else {
|
||||
challenge_header = "wtv-challenge: " + ssid_sessions[socket.ssid].data_store.wtvsec_login.IssueChallenge();
|
||||
send_to_relogin = false;
|
||||
}
|
||||
} else {
|
||||
challenge_header = "wtv-challenge: " + ssid_sessions[socket.ssid].data_store.wtvsec_login.IssueChallenge();
|
||||
send_to_relogin = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (request_headers) {
|
||||
var cookiedata = {};
|
||||
Object.keys(request_headers).forEach(function (k) {
|
||||
switch (k) {
|
||||
case "wtv-capability-flags":
|
||||
case "wtv-system-version":
|
||||
case "wtv-client-rom-type":
|
||||
case "wtv-client-bootrom-version":
|
||||
case "wtv-system-chipversion":
|
||||
case "wtv-system-sysconfig":
|
||||
case "wtv-system-cpuspeed":
|
||||
cookiedata[k] = request_headers[k];
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
if (!send_to_relogin) {
|
||||
|
||||
if (challenge_header != '') {
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
Expires: Wed, 09 Oct 1991 22:00:00 GMT
|
||||
wtv-expire-all: wtv-head-waiter:
|
||||
`+ getServiceString('wtv-log') + `
|
||||
wtv-log-url: wtv-log:/log
|
||||
${challenge_header}
|
||||
wtv-log-url: wtv-log:/log`;
|
||||
if (challenge_header != "") headers += "\n" + challenge_header;
|
||||
headers += `
|
||||
wtv-relogin-url: wtv-1800:/preregister?relogin=true
|
||||
wtv-reconnect-url: wtv-1800:/preregister?reconnect=true
|
||||
wtv-visit: ${gourl}
|
||||
Content-type: text/html`;
|
||||
data = '';
|
||||
|
||||
} else {
|
||||
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
Expires: Wed, 09 Oct 1991 22:00:00 GMT
|
||||
@@ -74,5 +61,5 @@ wtv-expire-all: wtv-head-waiter:
|
||||
wtv-expire-all: wtv-1800:
|
||||
wtv-visit: wtv-1800:/preregister?relogin=true
|
||||
Content-type: text/html`;
|
||||
|
||||
data = '';
|
||||
}
|
||||
Reference in New Issue
Block a user