more fixes
This commit is contained in:
@@ -1130,7 +1130,7 @@ class WebTVClientSimulator {
|
||||
// Use the appropriate key for challenge processing
|
||||
// For subsequent challenges (like during user login), use the current shared key
|
||||
// For the first challenge, use the initial key if provided
|
||||
let keyToUse = this.wtvsec.current_shared_key || this.initial_key
|
||||
const keyToUse = this.wtvsec.current_shared_key || this.initial_key
|
||||
this.debugLog(`Using key for challenge: ${keyToUse.toString(CryptoJS.enc.Base64)}`);
|
||||
this.wtvsec.set_incarnation(this.incarnation);
|
||||
this.debugLog(`Using incarnation for challenge: ${this.wtvsec.incarnation}`);
|
||||
@@ -1270,8 +1270,8 @@ class WebTVClientSimulator {
|
||||
const match = this.url.match(/^([\w-]+):\/?(.*)/);
|
||||
if (match) {
|
||||
const serviceName = match[1];
|
||||
let path = '/' + (match[2] || '');
|
||||
|
||||
const path = '/' + (match[2] || '');
|
||||
|
||||
this.debugLog(`Parsed target service: ${serviceName}, path: ${path}`);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const process = require('process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
var classPath = path.resolve(__dirname + path.sep + "includes" + path.sep + "classes" + path.sep) + path.sep;
|
||||
var { WTVShared, clientShowAlert } = require(classPath + "/WTVShared.js");
|
||||
const classPath = path.resolve(__dirname + path.sep + "includes" + path.sep + "classes" + path.sep) + path.sep;
|
||||
const { WTVShared, clientShowAlert } = require(classPath + "/WTVShared.js");
|
||||
|
||||
const wtvshared = new WTVShared(); // creates minisrv_config
|
||||
var minisrv_config = wtvshared.getMiniSrvConfig(); // snatches minisrv_config
|
||||
const minisrv_config = wtvshared.getMiniSrvConfig(); // snatches minisrv_config
|
||||
|
||||
// primitive recursive diskmap generator, usage:
|
||||
// node diskmap_gen.js path_in_servicevault diskmap_name wtvdest [service_name]
|
||||
@@ -19,11 +19,12 @@ if (process.argv.length < 6) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var service_vault_subdir = process.argv[2];
|
||||
var out_file = process.argv[3];
|
||||
var group_name = process.argv[4];
|
||||
var client_dest = process.argv[5];
|
||||
if (process.argv.length >= 7) var service_name = process.argv[6];
|
||||
const service_vault_subdir = process.argv[2];
|
||||
const out_file = process.argv[3];
|
||||
const group_name = process.argv[4];
|
||||
let client_dest = process.argv[5];
|
||||
let service_name;
|
||||
if (process.argv.length >= 7) service_name = process.argv[6];
|
||||
else service_name = "wtv-disk";
|
||||
|
||||
// find which service_vault the files are in
|
||||
@@ -32,12 +33,12 @@ else service_name = "wtv-disk";
|
||||
// Can be any vault, and after the scan you could technically move files across vaults
|
||||
// so long as they are on the same service still
|
||||
|
||||
var service_vault = null;
|
||||
var service_vault_dir = null;
|
||||
let service_vault = null;
|
||||
let service_vault_dir = null;
|
||||
if (minisrv_config.config.ServiceVaults) {
|
||||
Object.keys(minisrv_config.config.ServiceVaults).forEach(function (k) {
|
||||
if (service_vault_dir) return;
|
||||
var test = wtvshared.makeSafePath(wtvshared.returnAbsolutePath(minisrv_config.config.ServiceVaults[k]), service_name + path.sep + service_vault_subdir);
|
||||
const test = wtvshared.makeSafePath(wtvshared.returnAbsolutePath(minisrv_config.config.ServiceVaults[k]), service_name + path.sep + service_vault_subdir);
|
||||
console.log(" * Looking for", test);
|
||||
if (fs.existsSync(test)) {
|
||||
console.log(" * Found", test);
|
||||
@@ -53,7 +54,7 @@ if (!service_vault) {
|
||||
}
|
||||
|
||||
const recursiveDirList = function (dirPath, arrayOfFiles = null) {
|
||||
files = fs.readdirSync(dirPath)
|
||||
const files = fs.readdirSync(dirPath)
|
||||
|
||||
arrayOfFiles = arrayOfFiles || []
|
||||
|
||||
@@ -67,10 +68,10 @@ const recursiveDirList = function (dirPath, arrayOfFiles = null) {
|
||||
return arrayOfFiles
|
||||
}
|
||||
|
||||
var fileList = recursiveDirList(service_vault_dir);
|
||||
const fileList = recursiveDirList(service_vault_dir);
|
||||
|
||||
if (fileList.length > 0) {
|
||||
var diskmap = {};
|
||||
const diskmap = {};
|
||||
diskmap[group_name] = {};
|
||||
if (client_dest.substring(client_dest.length - 1, 1) != '/') client_dest += '/';
|
||||
diskmap[group_name].base = client_dest;
|
||||
|
||||
@@ -103,14 +103,11 @@ function checkScopeErrors(file) {
|
||||
// Try both with and without wtv- prefix
|
||||
const serviceNameWithPrefix = serviceName.startsWith('wtv-') ? serviceName : `wtv-${serviceName}`;
|
||||
const serviceNameWithoutPrefix = serviceName.startsWith('wtv-') ? serviceName.replace('wtv-', '') : serviceName;
|
||||
|
||||
console.log(`Detected service: ${serviceNameWithPrefix} or ${serviceNameWithoutPrefix}`);
|
||||
|
||||
// Check if either service name exists and is privileged
|
||||
const service = config.services[serviceNameWithPrefix] || config.services[serviceNameWithoutPrefix];
|
||||
|
||||
if (service && service.privileged === true) {
|
||||
console.log(`Service ${serviceNameWithPrefix || serviceNameWithoutPrefix} is privileged - adding extra globals`);
|
||||
// Add additional globals for privileged services
|
||||
eslintConfig.globals = {
|
||||
...eslintConfig.globals,
|
||||
@@ -121,6 +118,11 @@ function checkScopeErrors(file) {
|
||||
"classPath": "readonly",
|
||||
"session_data": "readonly",
|
||||
};
|
||||
if (service.modules) {
|
||||
for (const moduleName of service.modules) {
|
||||
eslintConfig.globals[moduleName] = "readonly";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user