const minisrv_service_file = true; let BoxId = request_headers.query.BoxId; if (Array.isArray(BoxId)) BoxId = BoxId[0]; let clientIp = socket.remoteAddress; let banned = false; if (!BoxId || BoxId.length != 20 || !/^\d+$/.test(BoxId)) { console.warn("Invalid BoxId format "+BoxId+" from "+clientIp); banned = true; } // Current UTC time const now = new Date(); // Time data object const timeData = { hh: now.getUTCHours(), mm: now.getUTCMinutes(), ss: now.getUTCSeconds(), mo: now.getUTCMonth() + 1, // JS months are 0-based dd: now.getUTCDate(), yyyy: now.getUTCFullYear() }; // Timezone mapping (C# tuple → JS array or object) const timezoneMap = { "UTC": { standardName: "UTC", standardOffset: 0, daylightName: "UTC", daylightOffset: 0 } }; // Destructure like the C# tuple deconstruction const { standardName, standardOffset, daylightName, daylightOffset } = timezoneMap["UTC"]; const sessionId = crypto.randomUUID(); ssid_sessions[socket.ssid] = new WTVClientSessionData(minisrv_config, socket.ssid); ssid_sessions[socket.ssid].set('SessionID', sessionId); // Set session cookie on the client setCookie('SessionID', sessionId, { path: '/' }); headers = `200 OK Content-type: text/html` data = `