some updates

This commit is contained in:
zefie
2026-05-05 07:43:40 -04:00
parent 2d64acaab6
commit e1d2c59ed5
11 changed files with 166 additions and 119 deletions

View File

@@ -1522,6 +1522,16 @@ class WTVMSNTV2 {
const self = this;
const responseCookies = [];
// try to make the debug name
let debug_name = (filepath) ? filepath.split(path.sep) : null;
if (debug_name) {
if (this.wtvshared.isConfiguredService(debug_name[debug_name.length - 2]))
// service:/filename
debug_name = debug_name[debug_name.length - 2] + ":/" + debug_name[debug_name.length - 1];
else
// filename
debug_name = debug_name[debug_name.length - 1];
}
const contextObj = {
socket,
request_headers,
@@ -1545,6 +1555,7 @@ class WTVMSNTV2 {
cwd: path.dirname(filepath),
// Cookie helpers available to scripts
response_cookies: responseCookies,
debug: require('debug')((debug_name) ? debug_name : 'service_script'),
setCookie(name, value, opts) {
opts = opts || {};
let s = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
@@ -1593,6 +1604,9 @@ class WTVMSNTV2 {
if (socket.ssid && this.ssid_sessions && vmResult.session_data !== undefined) {
this.ssid_sessions[socket.ssid] = vmResult.session_data;
}
if (vmResult.socket !== socket) {
socket = vmResult.socket;
}
if (!vmResult.request_is_async) {
this._sendScriptResult(socket, request_headers, vmResult.headers, vmResult.data, responseCookies);
}

View File

@@ -282,7 +282,7 @@ class WTVClientSessionData {
/**
* Finds an account's SSID and User ID from just the username
* @param {string} username The username to search for
* @returns {Array} [found {boolean}, account_dir {string|null}, user_id {number|null}]
* @returns {Array} [found {boolean}, ssid {string|null}, user_id {number|null}]
*/
findAccountByUsername(username) {
const accounts_dir = this.getAccountStoreDirectory();