- numerous bug fixes
 - wtv-mail system
 - user account updates
 - viewergen alpha (experimental webtv viewer patcher on pc_service)
 - implement wtv-favorites with huge help from @JarHead4
 - add wtv-ticket store api
 - Bump vm2 from 3.9.5 to 3.9.7 in /zefie_wtvp_minisrv
 - fix bf0app default rom
 - Add wtv-1800 service to wtv-1800:/noflash
 - handle webtvism:
   - allow get/post variables to be the same name multiple times
   - rather than overwrite, the server will now change the variable from a string to an array.
 - Rewrite script processing a bit
   - Instead of using eval() we now use a proper VM Context
   - As a result, any scripting errors will now give a more useful filename and line number.
   - However, some things may break, if they are dependant on variables we are not allowing in the context.
 - BREAKING CHANGES:
   - `ssid_sessions[socket.ssid]` is now `session_data`
   - `require` is no longer allowed in user scripts
 - add star service
 - change how we handle modules for services in the VM
 - fixed wtv-disk:/sync always failed the first time
 - implement production-like wtv-star handling (when a service port becomes unavailable, it requests the url over the wtv-star port to show an error page)
 - renamed WTVDownloadList.js to WTVDisk.js
 - a bit more work on WTVNews (created class)
 - probably more stuff I can't remember
This commit is contained in:
zefie
2021-11-10 23:38:15 -05:00
parent 4544e815cb
commit 1165b245ce
1411 changed files with 31570 additions and 2198 deletions

View File

@@ -1,8 +1,10 @@
var minisrv_service_file = true;
session_data.setUserLoggedIn(false);
var challenge_response, challenge_header = "";
if (socket.ssid !== null) session_data.switchUserID(0);
var gourl = "wtv-head-waiter:/login-stage-two?";
var gourl = "wtv-head-waiter:/ValidateLogin?initial_login=true&";
if (request_headers.query.relogin) gourl += "relogin=true";
else if (request_headers.query.reconnect) gourl += "reconnect=true";
@@ -15,29 +17,29 @@ if (request_headers.query.guest_login) {
var send_to_relogin = true;
if (socket.ssid) {
if (ssid_sessions[socket.ssid]) {
if (session_data) {
if (request_headers["wtv-ticket"]) {
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 == null) {
if (session_data.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"];
session_data.data_store.wtvsec_login.DecodeTicket(request_headers["wtv-ticket"]);
session_data.data_store.wtvsec_login.ticket_b64 = request_headers["wtv-ticket"];
send_to_relogin = false;
}
}
} else {
if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
if (session_data.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();
session_data.data_store.wtvsec_login.PrepareTicket();
send_to_relogin = false;
} else {
challenge_header = "wtv-challenge: " + ssid_sessions[socket.ssid].data_store.wtvsec_login.IssueChallenge();
challenge_header = "wtv-challenge: " + session_data.data_store.wtvsec_login.IssueChallenge();
send_to_relogin = false;
}
} else {
challenge_header = "wtv-challenge: " + ssid_sessions[socket.ssid].data_store.wtvsec_login.IssueChallenge();
challenge_header = "wtv-challenge: " + session_data.data_store.wtvsec_login.IssueChallenge();
send_to_relogin = false;
}
}
@@ -55,6 +57,8 @@ wtv-expire-all: wtv-head-waiter:
wtv-log-url: wtv-log:/log`;
if (challenge_header != "") headers += "\n" + challenge_header;
headers += `
wtv-country: US
wtv-language-header: en-US,en
wtv-relogin-url: wtv-head-waiter:/relogin?relogin=true
wtv-reconnect-url: wtv-head-waiter:/relogin?reconnect=true
wtv-visit: ${gourl}