You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 14:11:59 +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();
|
||||
console.log(logMessage);
|
||||
}
|
||||
appendLogToBuffer(logMessage);
|
||||
|
||||
if(type !== 'FFMPEG') {
|
||||
appendLogToBuffer(logMessage);
|
||||
}
|
||||
};
|
||||
|
||||
const logDebug = (...messages) => logMessage('DEBUG', messages, verboseMode);
|
||||
|
||||
@@ -38,7 +38,6 @@ function fetchConfig() {
|
||||
|
||||
function populateFields(data, prefix = "") {
|
||||
$.each(data, (key, value) => {
|
||||
|
||||
if (key === "presets" && Array.isArray(value)) {
|
||||
value.forEach((item, index) => {
|
||||
const presetId = `${prefix}${prefix ? "-" : ""}${key}-${index + 1}`;
|
||||
@@ -81,6 +80,16 @@ function populateFields(data, prefix = "") {
|
||||
} else {
|
||||
$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") {
|
||||
const $textarea = $(`#${prefix}${prefix ? "-" : ""}${key}`);
|
||||
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;
|
||||
}
|
||||
|
||||
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)) {
|
||||
return updateConfigData(value, id);
|
||||
}
|
||||
@@ -120,4 +141,4 @@ function updateConfigData(data, prefix = "") {
|
||||
data[key] = typeof value === "boolean" ? $element.is(":checked") : $element.attr("data-value") ?? $element.val();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user