update: change config variable name, allow user override (user_config.json)

This commit is contained in:
zefie
2021-07-19 04:26:32 -04:00
parent ea3235957b
commit 8b5a390773
11 changed files with 103 additions and 35 deletions

View File

@@ -16,7 +16,7 @@ if (request_headers.query.relogin) { // skip tellyscript
// if relogin, skip tellyscript
var romtype, file_path = null;
if (!request_headers.query.relogin && services_configured.config.send_tellyscripts) {
if (!request_headers.query.relogin && minisrv_config.config.send_tellyscripts) {
var romtype = getSessionData(socket_session_data[socket.id].ssid, 'wtv-client-rom-type');
}

View File

@@ -6,7 +6,7 @@ headers = "200 OK\n"
if (request_headers.query.raw) {
if ((/\.brom$/).test(request_path)) headers += "Content-Type: binary/x-wtv-bootrom"; // maybe?
else headers += "Content-Type: binary/x-wtv-flashblock";
if (services_configured.services[service_name].use_zefie_server) {
if (minisrv_config.services[service_name].use_zefie_server) {
// get flashrom files from archive.midnightchannel.net
var options = {
host: "archive.midnightchannel.net",

View File

@@ -10,7 +10,7 @@ if (!request_headers.query.path) {
data = errpage[1];
} else {
var request_path = unescape(request_headers.query.path);
if (services_configured.services[service_name].use_zefie_server) {
if (minisrv_config.services[service_name].use_zefie_server) {
// read first 256 bytes of flashrom file from archive.midnightchannel.net
// to get `flashrom_message` and `numparts` if missing
var options = {

View File

@@ -58,7 +58,7 @@ Updating complete
<td colspan=9 width=100 height=258 valign=top align=left>
<font size=+1>
The update is complete.<br>
<p><font size=+1>Choose <b>Connect Now</b> if you<br>want to connect to ${services_configured.config.service_name}.
<p><font size=+1>Choose <b>Connect Now</b> if you<br>want to connect to ${minisrv_config.config.service_name}.
<p><font size=+1>Press the <b>power</b> button to switch<br>off your unit.
</font>
<tr>

View File

@@ -12,7 +12,7 @@ for (const [key, value] of Object.entries(request_headers.query)) {
proxy_query += "&" + key + "=" + value;
}
if (!services_configured.services[service_name].use_zefie_server) {
if (!minisrv_config.services[service_name].use_zefie_server) {
proxy_query += "&minisrv_local_mode=true";
}

View File

@@ -21,7 +21,7 @@ Content-length: 0`;
logdata_outstring += "\r\n";
var logdata_outstring_hex = Buffer.from(logdata_outstring, 'utf8').toString('hex');
logdata_outstring_hex += request_headers.post_data.toString(CryptoJS.enc.Hex);
if (services_configured.services[service_name].write_logs_to_disk) {
if (minisrv_config.services[service_name].write_logs_to_disk) {
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
if (!zquiet) console.log(" * Wrote POST log data from", processSSID(socket_session_data[socket.id].ssid), "for", socket.id);
sendToClient(socket, headers, data);
@@ -41,7 +41,7 @@ Content-length: 0`;
logdata_outstring += k + "=" + unescape(request_headers.query[k].toString()) + "\r\n";
});
var logdata_outstring_hex = Buffer.from(logdata_outstring, 'utf8').toString('hex');
if (services_configured.services[service_name].write_logs_to_disk) {
if (minisrv_config.services[service_name].write_logs_to_disk) {
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
if (!zquiet) console.log(" * Wrote GET log data from", processSSID(socket_session_data[socket.id].ssid), "for", socket.id);
sendToClient(socket, headers, data);