minimal prealpha support (may remove later)

This commit is contained in:
zefie
2025-08-14 20:22:18 -04:00
parent e7d16387da
commit 35a9ae2c8f
5 changed files with 89 additions and 81 deletions

View File

@@ -587,6 +587,10 @@ async function processPath(socket, service_vault_file_path, request_headers = []
updateFromVM.push(["socket_sessions", "socket_sessions"]); // global socket_sessions object for privileged service scripts, such as wtv-1800, etc
}
if (request_headers['User-Agent'] === "Artemis/0.0") {
socket_sessions[socket.id].prealpha = true;
}
try {
vaults_to_scan.forEach(function (service_vault_dir) {
if (service_vault_found) return;
@@ -1631,7 +1635,7 @@ async function sendToClient(socket, headers_obj, data = null) {
if (!socket.res) {
// encrypt if needed
if (socket_sessions[socket.id].secure === true && !socket_sessions[socket.id].do_not_encrypt) {
if (socket_sessions[socket.id].secure === true && !socket_sessions[socket.id].do_not_encrypt && !socket_sessions[socket.id].prealpha) {
headers_obj["wtv-encrypted"] = 'true';
headers_obj = wtvshared.moveObjectKey('wtv-encrypted', 'Connection', headers_obj);
if (content_length > 0 && socket_sessions[socket.id].wtvsec) {
@@ -1646,6 +1650,9 @@ async function sendToClient(socket, headers_obj, data = null) {
}
}
if (socket_sessions[socket.id].prealpha === true && !socket_sessions[socket.id].secure) {
if (headers_obj["wtv-encrypted"]) delete headers_obj["wtv-encrypted"];
}
// calculate content length
// make sure we are using our Content-length and not one set in a script.

View File

@@ -69,15 +69,19 @@ wtv-visit: client:hangupphone`
} else {
console.log(" * wtv-challenge-response FAILED for " + wtvshared.filterSSID(socket.ssid));
if (minisrv_config.config.debug_flags.debug) console.log("Response Expected:", challenge_response.toString(CryptoJS.enc.Base64));
if (minisrv_config.config.debug_flags.debug) console.log("Response Received:", client_challenge_response)
if (minisrv_config.config.debug_flags.debug) console.log("Response Received:", client_challenge_response);
errpage = wtvshared.doErrorPage(500, "Invalid challenge response received");
headers = errpage[0];
data = errpage[1];
}
} else {
if (!socket_sessions[socket.id].prealpha) {
errpage = wtvshared.doErrorPage(500, "No challenge response received");
headers = errpage[0];
data = errpage[1];
} else {
gourl = "wtv-head-waiter:/login-stage-two?";
}
}
} else {
gourl = "wtv-head-waiter:/login-stage-two?";
@@ -110,10 +114,9 @@ minisrv-no-mail-count: true`;
limitedLoginRegistered = (limitedLogin && session_data.isRegistered());
}
headers = `200 OK
wtv-connection-close: true
Connection: close
minisrv-no-mail-count: true
Content-Type: text/html`;
if (client_challenge_response) {
headers += `
wtv-encrypted: ${(request_headers['wtv-encrypted']) ? wtvshared.parseBool(request_headers['wtv-encrypted']) : true}`;

View File

@@ -40,11 +40,11 @@ AutoCaps selected value="${request_headers.query.subscriber_contact || ""}">
<font size="-2"><b>CONTACT INFO TYPE:</b></font><img src="ROMCache/spacer.gif" width="7">
<img src="ROMCache/spacer.gif" width="3"><select usestyle id="subscriber_contact_method" name="subscriber_contact_method">
<option value="">Type</option>
<option${(request_headers.query.subscriber_contact_method === "E-Mail") ? " selected" : ""}>E-Mail</option>
<option${(request_headers.query.subscriber_contact_method === "Discord") ? " selected" : ""}>Discord</option>
<option${(request_headers.query.subscriber_contact_method === "Twitter") ? " selected" : ""}>Twitter</option>
<option${(request_headers.query.subscriber_contact_method === "Telegram") ? " selected" : ""}>Telegram</option>
<option${(request_headers.query.subscriber_contact_method === "Instagram") ? " selected" : ""}>Instagram</option>
<option value="E-Mail"${(request_headers.query.subscriber_contact_method === "E-Mail") ? " selected" : ""}>E-Mail</option>
<option value="Discord"${(request_headers.query.subscriber_contact_method === "Discord") ? " selected" : ""}>Discord</option>
<option value="Twitter"${(request_headers.query.subscriber_contact_method === "Twitter") ? " selected" : ""}>Twitter</option>
<option value="Telegram"${(request_headers.query.subscriber_contact_method === "Telegram") ? " selected" : ""}>Telegram</option>
<option value="Instagram"${(request_headers.query.subscriber_contact_method === "Instagram") ? " selected" : ""}>Instagram</option>
</select>
`;
const form_data = `<shadow>

View File

@@ -72,8 +72,7 @@ if (!request_headers.query.registering ||
</head>
<body noscroll
bgcolor="#171726" text="#D1D3D3" link=#FFEA9C vlink=#FFEA9C
hspace=0 vspace=0 fontsize="large"
>
hspace=0 vspace=0 fontsize="large">
<table cellspacing=0 cellpadding=0 border=0 width=560 bgcolor=#171726>
<tr>
<td align=middle bgcolor="#5b6c81" border=0 colspan= 3 width="100" height="80">
@@ -98,8 +97,7 @@ if (!request_headers.query.registering ||
<tr>
<td bgcolor= "#5b6c81" border=0 rowspan=6 abswidth=21 height= 220></td>
<td border=0 abswidth=40 bgcolor="#171726" rowspan="6" >
<form action="FinishRegistration"
>
<form action="FinishRegistration">
<td height=230 width= 300 bgcolor="#171726" colspan=5 valign=top align=left>
Thank you for signing up for ${minisrv_config.config.service_name}.
<p>

View File

@@ -135,7 +135,7 @@ class WTVClientCapabilities {
}
get(key = null) {
if (typeof (this.capabilities) === 'undefined') return null;
if (typeof (this.capabilities) === 'undefined' || !this.capabilities) return null;
else if (key === null) return this.capabilities;
else if (this.capabilities[key]) return this.capabilities[key];
else return null;