You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
hotfix for logging / banlist
This commit is contained in:
@@ -38,7 +38,10 @@ const logMessage = (type, messages, verbose = false) => {
|
|||||||
if (logs.length > maxConsoleLogLines) logs.shift();
|
if (logs.length > maxConsoleLogLines) logs.shift();
|
||||||
console.log(logMessage);
|
console.log(logMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(type !== 'FFMPEG') {
|
||||||
appendLogToBuffer(logMessage);
|
appendLogToBuffer(logMessage);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const logDebug = (...messages) => logMessage('DEBUG', messages, verboseMode);
|
const logDebug = (...messages) => logMessage('DEBUG', messages, verboseMode);
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ function fetchConfig() {
|
|||||||
|
|
||||||
function populateFields(data, prefix = "") {
|
function populateFields(data, prefix = "") {
|
||||||
$.each(data, (key, value) => {
|
$.each(data, (key, value) => {
|
||||||
|
|
||||||
if (key === "presets" && Array.isArray(value)) {
|
if (key === "presets" && Array.isArray(value)) {
|
||||||
value.forEach((item, index) => {
|
value.forEach((item, index) => {
|
||||||
const presetId = `${prefix}${prefix ? "-" : ""}${key}-${index + 1}`;
|
const presetId = `${prefix}${prefix ? "-" : ""}${key}-${index + 1}`;
|
||||||
@@ -81,6 +80,16 @@ function populateFields(data, prefix = "") {
|
|||||||
} else {
|
} else {
|
||||||
$element.val(value);
|
$element.val(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key === "plugins" && Array.isArray(value)) {
|
||||||
|
const $options = $element.find('option');
|
||||||
|
$options.each(function() {
|
||||||
|
const dataName = $(this).data('name');
|
||||||
|
if (value.includes(dataName)) {
|
||||||
|
$(this).prop('selected', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,11 +116,23 @@ function updateConfigData(data, prefix = "") {
|
|||||||
if (key === "banlist") {
|
if (key === "banlist") {
|
||||||
const $textarea = $(`#${prefix}${prefix ? "-" : ""}${key}`);
|
const $textarea = $(`#${prefix}${prefix ? "-" : ""}${key}`);
|
||||||
if ($textarea.length && $textarea.is("textarea")) {
|
if ($textarea.length && $textarea.is("textarea")) {
|
||||||
data[key] = $textarea.val().split("\n").filter(line => line.trim() !== ""); // Split lines into an array and filter out empty lines
|
data[key] = $textarea.val().split("\n").filter(line => line.trim() !== "");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key === "plugins") {
|
||||||
|
data[key] = [];
|
||||||
|
const $selectedOptions = $element.find('option:selected');
|
||||||
|
$selectedOptions.each(function() {
|
||||||
|
const dataName = $(this).data('name');
|
||||||
|
if (dataName) {
|
||||||
|
data[key].push(dataName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof value === "object" && !Array.isArray(value)) {
|
if (typeof value === "object" && !Array.isArray(value)) {
|
||||||
return updateConfigData(value, id);
|
return updateConfigData(value, id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user