actually create tv2 account

This commit is contained in:
zefie
2026-05-01 19:07:47 -04:00
parent ddbcb4be5e
commit 9400c1f917
3 changed files with 6 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ if (request_headers.cookie) {
if (pm) register_password = decodeURIComponent(pm[1]); if (pm) register_password = decodeURIComponent(pm[1]);
} }
if (session_data && !session_data.isRegistered) { if (session_data && !session_data.isRegistered()) {
const user_name = register_email ? register_email.split('@')[0] : username; const user_name = register_email ? register_email.split('@')[0] : username;
const user_password = register_password; const user_password = register_password;
@@ -43,7 +43,7 @@ if (session_data && !session_data.isRegistered) {
data = errpage[1]; data = errpage[1];
console.error("Failed to save session data for user %s", username); console.error("Failed to save session data for user %s", username);
} }
} else if (session_data && session_data.isRegistered) { } else if (session_data && session_data.isRegistered()) {
console.warn("Session for BoxID %s is already registered", BoxId); console.warn("Session for BoxID %s is already registered", BoxId);
} else if (!session_data) { } else if (!session_data) {
console.warn("No session_data for BoxID %s — skipping registration", BoxId); console.warn("No session_data for BoxID %s — skipping registration", BoxId);

View File

@@ -11,7 +11,7 @@ const { http, https } = require('follow-redirects');
const { raw } = require('express'); const { raw } = require('express');
class WTVMSNTV2 { class WTVMSNTV2 {
constructor(minisrv_config, service_name, wtvshared, sendToClient, net, runScriptInVM, handlePHP, handleCGI, ssid_sessions, WTVClientSessionData) { constructor(minisrv_config, service_name, wtvshared, sendToClient, net, runScriptInVM, handlePHP, handleCGI, ssid_sessions, WTVClientSessionData, socket_sessions) {
this.minisrv_config = minisrv_config; this.minisrv_config = minisrv_config;
this.service_name = service_name; this.service_name = service_name;
this.service_config = minisrv_config.services[service_name] || {}; this.service_config = minisrv_config.services[service_name] || {};
@@ -22,6 +22,7 @@ class WTVMSNTV2 {
this.handlePHP = handlePHP || null; this.handlePHP = handlePHP || null;
this.handleCGI = handleCGI || null; this.handleCGI = handleCGI || null;
this.ssid_sessions = ssid_sessions || []; this.ssid_sessions = ssid_sessions || [];
this.socket_sessions = socket_sessions || [];
this.WTVClientSessionData = WTVClientSessionData || null; this.WTVClientSessionData = WTVClientSessionData || null;
this.tlsContext = this.loadTlsContext(); this.tlsContext = this.loadTlsContext();
this.forgeTlsCredentials = this.loadForgeTlsCredentials(); this.forgeTlsCredentials = this.loadForgeTlsCredentials();
@@ -132,7 +133,6 @@ class WTVMSNTV2 {
const verbose = this.service_config.show_verbose_errors || this.minisrv_config.config.verbosity >= 3; const verbose = this.service_config.show_verbose_errors || this.minisrv_config.config.verbosity >= 3;
if (verbose) { if (verbose) {
console.log('[WTV-MSNTV2] incoming request:', requestLine); console.log('[WTV-MSNTV2] incoming request:', requestLine);
console.log('[WTV-MSNTV2] request headers:\n' + rawHeaders.join('\r\n'));
if (body.length) { if (body.length) {
console.log('[WTV-MSNTV2] request body length:', body.length); console.log('[WTV-MSNTV2] request body length:', body.length);
console.log('[WTV-MSNTV2] request body (first 1024 bytes):', body.slice(0, 1024).toString('utf8')); console.log('[WTV-MSNTV2] request body (first 1024 bytes):', body.slice(0, 1024).toString('utf8'));
@@ -1499,7 +1499,7 @@ class WTVMSNTV2 {
// Convenience UUID generator (replaces uuidv4() from C# artifacts) // Convenience UUID generator (replaces uuidv4() from C# artifacts)
uuidv4() { return crypto.randomUUID(); } uuidv4() { return crypto.randomUUID(); }
}; };
const vmResult = this.runScriptInVM(scriptData, contextObj, false, filepath); const vmResult = this.runScriptInVM(scriptData, contextObj, true, filepath);
// Write session_data back to ssid_sessions (mirrors app.js updateFromVM for non-privileged scripts; // Write session_data back to ssid_sessions (mirrors app.js updateFromVM for non-privileged scripts;
// use socket.ssid as set by the script itself via BoxID or header). // use socket.ssid as set by the script itself via BoxID or header).
if (socket.ssid && this.ssid_sessions && vmResult.session_data !== undefined) { if (socket.ssid && this.ssid_sessions && vmResult.session_data !== undefined) {

View File

@@ -515,7 +515,7 @@
"local_dir": "sg1" "local_dir": "sg1"
} }
], ],
"handler_extra_vars": ["runScriptInVM", "handlePHP", "handleCGI", "ssid_sessions", "WTVClientSessionData"], "handler_extra_vars": ["runScriptInVM", "handlePHP", "handleCGI", "ssid_sessions", "WTVClientSessionData", "socket_sessions"],
"show_verbose_errors": false, "show_verbose_errors": false,
"modules": [ "modules": [
"WTVRegister" "WTVRegister"