mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge remote-tracking branch 'upstream/master' into temperture
This commit is contained in:
@@ -58,7 +58,8 @@ $(document).ready(function () {
|
||||
if (components[idx].name != "ALL") {
|
||||
if ((components[idx].name === "FORWARDER" && window.currentHyperionInstance != 0) ||
|
||||
(components[idx].name === "GRABBER" && !window.serverConfig.framegrabber.enable) ||
|
||||
(components[idx].name === "V4L" && !window.serverConfig.grabberV4L2.enable))
|
||||
(components[idx].name === "V4L" && !window.serverConfig.grabberV4L2.enable) ||
|
||||
(components[idx].name === "AUDIO" && !window.serverConfig.grabberAudio.enable))
|
||||
continue;
|
||||
|
||||
var comp_enabled = components[idx].enabled ? "checked" : "";
|
||||
@@ -104,8 +105,9 @@ $(document).ready(function () {
|
||||
|
||||
var screenGrabberAvailable = (window.serverInfo.grabbers.screen.available.length !== 0);
|
||||
var videoGrabberAvailable = (window.serverInfo.grabbers.video.available.length !== 0);
|
||||
const audioGrabberAvailable = (window.serverInfo.grabbers.audio.available.length !== 0);
|
||||
|
||||
if (screenGrabberAvailable || videoGrabberAvailable) {
|
||||
if (screenGrabberAvailable || videoGrabberAvailable || audioGrabberAvailable) {
|
||||
|
||||
if (screenGrabberAvailable) {
|
||||
var screenGrabber = window.serverConfig.framegrabber.enable ? $.i18n('general_enabled') : $.i18n('general_disabled');
|
||||
@@ -120,6 +122,13 @@ $(document).ready(function () {
|
||||
} else {
|
||||
$("#dash_video_grabber_row").hide();
|
||||
}
|
||||
|
||||
if (audioGrabberAvailable) {
|
||||
const audioGrabber = window.serverConfig.grabberAudio.enable ? $.i18n('general_enabled') : $.i18n('general_disabled');
|
||||
$('#dash_audio_grabber').html(audioGrabber);
|
||||
} else {
|
||||
$("#dash_audio_grabber_row").hide();
|
||||
}
|
||||
} else {
|
||||
$("#dash_capture_hw").hide();
|
||||
}
|
||||
|
@@ -4,9 +4,11 @@ $(document).ready(function () {
|
||||
|
||||
var screenGrabberAvailable = (window.serverInfo.grabbers.screen.available.length !== 0);
|
||||
var videoGrabberAvailable = (window.serverInfo.grabbers.video.available.length !== 0);
|
||||
const audioGrabberAvailable = (window.serverInfo.grabbers.audio.available.length !== 0);
|
||||
var CEC_ENABLED = (jQuery.inArray("cec", window.serverInfo.services) !== -1);
|
||||
|
||||
var conf_editor_video = null;
|
||||
var conf_editor_audio = null;
|
||||
var conf_editor_screen = null;
|
||||
|
||||
var configuredDevice = "";
|
||||
@@ -38,6 +40,22 @@ $(document).ready(function () {
|
||||
}
|
||||
}
|
||||
|
||||
// Audio-Grabber
|
||||
if (audioGrabberAvailable) {
|
||||
$('#conf_cont').append(createRow('conf_cont_audio'));
|
||||
$('#conf_cont_audio').append(createOptPanel('fa-volume', $.i18n("edt_conf_audio_heading_title"), 'editor_container_audiograbber', 'btn_submit_audiograbber', 'panel-system', 'audiograbberPanelId'));
|
||||
|
||||
if (storedAccess === 'expert') {
|
||||
const conf_cont_audio_footer = document.getElementById("editor_container_audiograbber").nextElementSibling;
|
||||
$(conf_cont_audio_footer).prepend('<button class="btn btn-primary mdi-24px" id="btn_audiograbber_set_effect_defaults" disabled data-toggle="tooltip" data-placement="top" title="' + $.i18n("edt_conf_audio_hardware_set_defaults_tip") + '">'
|
||||
+ '<i class= "fa fa-fw fa-undo" ></i >' + $.i18n("edt_conf_audio_effect_set_defaults") + '</button > ');
|
||||
}
|
||||
|
||||
if (window.showOptHelp) {
|
||||
$('#conf_cont_audio').append(createHelpTable(window.schema.grabberAudio.properties, $.i18n("edt_conf_audio_heading_title"), "audiograbberHelpPanelId"));
|
||||
}
|
||||
}
|
||||
|
||||
JSONEditor.defaults.custom_validators.push(function (schema, value, path) {
|
||||
var errors = [];
|
||||
|
||||
@@ -694,6 +712,121 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
|
||||
// External Input Sources (Audio-Grabbers)
|
||||
if (audioGrabberAvailable) {
|
||||
|
||||
conf_editor_audio = createJsonEditor('editor_container_audiograbber', {
|
||||
grabberAudio: window.schema.grabberAudio
|
||||
}, true, true);
|
||||
|
||||
conf_editor_audio.on('ready', () => {
|
||||
// Trigger conf_editor_audio.watch - 'root.grabberAudio.enable'
|
||||
const audioEnable = window.serverConfig.grabberAudio.enable;
|
||||
conf_editor_audio.getEditor("root.grabberAudio.enable").setValue(audioEnable);
|
||||
});
|
||||
|
||||
conf_editor_audio.on('change', () => {
|
||||
|
||||
// Validate the current editor's content
|
||||
if (!conf_editor_audio.validate().length) {
|
||||
const deviceSelected = conf_editor_audio.getEditor("root.grabberAudio.available_devices").getValue();
|
||||
switch (deviceSelected) {
|
||||
case "SELECT":
|
||||
showInputOptionsForKey(conf_editor_audio, "grabberAudio", ["enable", "available_devices"], false);
|
||||
break;
|
||||
case "NONE":
|
||||
showInputOptionsForKey(conf_editor_audio, "grabberAudio", ["enable", "available_devices"], false);
|
||||
break;
|
||||
default:
|
||||
window.readOnlyMode ? $('#btn_submit_audiograbber').prop('disabled', true) : $('#btn_submit_audiograbber').prop('disabled', false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#btn_submit_audiograbber').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
// Enable
|
||||
conf_editor_audio.watch('root.grabberAudio.enable', () => {
|
||||
|
||||
const audioEnable = conf_editor_audio.getEditor("root.grabberAudio.enable").getValue();
|
||||
if (audioEnable)
|
||||
{
|
||||
showInputOptionsForKey(conf_editor_audio, "grabberAudio", "enable", true);
|
||||
|
||||
$('#btn_audiograbber_set_effect_defaults').show();
|
||||
|
||||
if (window.showOptHelp) {
|
||||
$('#audiograbberHelpPanelId').show();
|
||||
}
|
||||
|
||||
discoverInputSources("audio");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#btn_submit_audiograbber').prop('disabled', false);
|
||||
$('#btn_audiograbber_set_effect_defaults').hide();
|
||||
showInputOptionsForKey(conf_editor_audio, "grabberAudio", "enable", false);
|
||||
$('#audiograbberHelpPanelId').hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Available Devices
|
||||
conf_editor_audio.watch('root.grabberAudio.available_devices', () => {
|
||||
const deviceSelected = conf_editor_audio.getEditor("root.grabberAudio.available_devices").getValue();
|
||||
|
||||
if (deviceSelected === "SELECT" || deviceSelected === "NONE" || deviceSelected === "") {
|
||||
$('#btn_submit_audiograbber').prop('disabled', true);
|
||||
showInputOptionsForKey(conf_editor_audio, "grabberAudio", ["enable", "available_devices"], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
showInputOptionsForKey(conf_editor_audio, "grabberAudio", ["enable", "available_devices"], true);
|
||||
|
||||
const deviceProperties = getPropertiesOfDevice("audio", deviceSelected);
|
||||
|
||||
//Update hidden input element
|
||||
conf_editor_audio.getEditor("root.grabberAudio.device").setValue(deviceProperties.device);
|
||||
|
||||
//Enfore configured JSON-editor dependencies
|
||||
conf_editor_audio.notifyWatchers("root.grabberAudio.audioEffect");
|
||||
|
||||
//Enable set defaults button
|
||||
$('#btn_audiograbber_set_effect_defaults').prop('disabled', false);
|
||||
|
||||
if (conf_editor_audio.validate().length && !window.readOnlyMode) {
|
||||
$('#btn_submit_audiograbber').prop('disabled', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#btn_submit_audiograbber').off().on('click', function () {
|
||||
const saveOptions = conf_editor_audio.getValue();
|
||||
|
||||
const instCaptOptions = window.serverConfig.instCapture;
|
||||
instCaptOptions.audioEnable = true;
|
||||
saveOptions.instCapture = instCaptOptions;
|
||||
|
||||
requestWriteConfig(saveOptions);
|
||||
});
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
$('#btn_audiograbber_set_effect_defaults').off().on('click', function () {
|
||||
const currentEffect = conf_editor_audio.getEditor("root.grabberAudio.audioEffect").getValue();
|
||||
var effectEditor = conf_editor_audio.getEditor("root.grabberAudio." + currentEffect);
|
||||
var defaultProperties = effectEditor.schema.defaultProperties;
|
||||
|
||||
var default_values = {};
|
||||
for (const item of defaultProperties) {
|
||||
|
||||
default_values[item] = effectEditor.schema.properties[item].default;
|
||||
}
|
||||
effectEditor.setValue(default_values);
|
||||
});
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
@@ -706,6 +839,9 @@ $(document).ready(function () {
|
||||
if (videoGrabberAvailable) {
|
||||
createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_videograbber");
|
||||
}
|
||||
if (audioGrabberAvailable) {
|
||||
createHint("intro", $.i18n('conf_grabber_audio_intro'), "editor_container_audiograbber");
|
||||
}
|
||||
}
|
||||
|
||||
removeOverlay();
|
||||
@@ -773,6 +909,38 @@ $(document).ready(function () {
|
||||
}
|
||||
};
|
||||
|
||||
// build dynamic audio input enum
|
||||
const updateAudioSourcesList = function (type, discoveryInfo) {
|
||||
const enumVals = [];
|
||||
const enumTitelVals = [];
|
||||
let enumDefaultVal = "";
|
||||
let addSelect = false;
|
||||
|
||||
if (jQuery.isEmptyObject(discoveryInfo)) {
|
||||
enumVals.push("NONE");
|
||||
enumTitelVals.push($.i18n('edt_conf_grabber_discovered_none'));
|
||||
}
|
||||
else {
|
||||
for (const device of discoveryInfo) {
|
||||
enumVals.push(device.device_name);
|
||||
}
|
||||
conf_editor_audio.getEditor('root.grabberAudio').enable();
|
||||
configuredDevice = window.serverConfig.grabberAudio.available_devices;
|
||||
|
||||
if ($.inArray(configuredDevice, enumVals) != -1) {
|
||||
enumDefaultVal = configuredDevice;
|
||||
}
|
||||
else {
|
||||
addSelect = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (enumVals.length > 0) {
|
||||
updateJsonEditorSelection(conf_editor_audio, 'root.grabberAudio',
|
||||
'available_devices', {}, enumVals, enumTitelVals, enumDefaultVal, addSelect, false);
|
||||
}
|
||||
};
|
||||
|
||||
async function discoverInputSources(type, params) {
|
||||
const result = await requestInputSourcesDiscovery(type, params);
|
||||
|
||||
@@ -782,7 +950,8 @@ $(document).ready(function () {
|
||||
}
|
||||
else {
|
||||
discoveryResult = {
|
||||
"video_sources": []
|
||||
"video_sources": [],
|
||||
"audio_soruces": []
|
||||
};
|
||||
}
|
||||
|
||||
@@ -799,6 +968,12 @@ $(document).ready(function () {
|
||||
updateVideoSourcesList(type, discoveredInputSources.video);
|
||||
}
|
||||
break;
|
||||
case "audio":
|
||||
discoveredInputSources.audio = discoveryResult.audio_sources;
|
||||
if (audioGrabberAvailable) {
|
||||
updateAudioSourcesList(type, discoveredInputSources.audio);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -278,8 +278,9 @@ $(document).ready(function () {
|
||||
if (getStorage('lastSelectedInstance'))
|
||||
removeStorage('lastSelectedInstance')
|
||||
|
||||
currentHyperionInstance = 0;
|
||||
currentHyperionInstanceName = getInstanceNameByIndex(0);
|
||||
window.currentHyperionInstance = 0;
|
||||
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
|
||||
|
||||
requestServerConfig();
|
||||
setTimeout(requestServerInfo, 100)
|
||||
setTimeout(requestTokenInfo, 200)
|
||||
@@ -293,7 +294,7 @@ $(document).ready(function () {
|
||||
$('#btn_hypinstanceswitch').toggle(false)
|
||||
|
||||
// update listing for button
|
||||
updateUiOnInstance(currentHyperionInstance);
|
||||
updateUiOnInstance(window.currentHyperionInstance);
|
||||
updateHyperionInstanceListing();
|
||||
});
|
||||
|
||||
|
@@ -3,6 +3,7 @@ $(document).ready(function () {
|
||||
|
||||
var screenGrabberAvailable = (window.serverInfo.grabbers.screen.available.length !== 0);
|
||||
var videoGrabberAvailable = (window.serverInfo.grabbers.video.available.length !== 0);
|
||||
const audioGrabberAvailable = (window.serverInfo.grabbers.audio.available.length !== 0);
|
||||
|
||||
var BOBLIGHT_ENABLED = (jQuery.inArray("boblight", window.serverInfo.services) !== -1);
|
||||
|
||||
@@ -15,7 +16,7 @@ $(document).ready(function () {
|
||||
// Instance Capture
|
||||
|
||||
if (window.showOptHelp) {
|
||||
if (screenGrabberAvailable || videoGrabberAvailable) {
|
||||
if (screenGrabberAvailable || videoGrabberAvailable || audioGrabberAvailable) {
|
||||
$('#conf_cont').append(createRow('conf_cont_instCapt'));
|
||||
$('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt', ''));
|
||||
$('#conf_cont_instCapt').append(createHelpTable(window.schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title")));
|
||||
@@ -29,7 +30,7 @@ $(document).ready(function () {
|
||||
}
|
||||
else {
|
||||
$('#conf_cont').addClass('row');
|
||||
if (screenGrabberAvailable || videoGrabberAvailable) {
|
||||
if (screenGrabberAvailable || videoGrabberAvailable || audioGrabberAvailable) {
|
||||
$('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt', ''));
|
||||
}
|
||||
if (BOBLIGHT_ENABLED) {
|
||||
@@ -37,7 +38,7 @@ $(document).ready(function () {
|
||||
}
|
||||
}
|
||||
|
||||
if (screenGrabberAvailable || videoGrabberAvailable) {
|
||||
if (screenGrabberAvailable || videoGrabberAvailable || audioGrabberAvailable) {
|
||||
|
||||
// Instance Capture
|
||||
conf_editor_instCapt = createJsonEditor('editor_container_instCapt', {
|
||||
@@ -81,12 +82,29 @@ $(document).ready(function () {
|
||||
showInputOptionForItem(conf_editor_instCapt, "instCapture", "v4lPriority", false);
|
||||
}
|
||||
|
||||
if (audioGrabberAvailable) {
|
||||
if (!window.serverConfig.grabberAudio.enable) {
|
||||
conf_editor_instCapt.getEditor("root.instCapture.audioEnable").setValue(false);
|
||||
conf_editor_instCapt.getEditor("root.instCapture.audioEnable").disable();
|
||||
}
|
||||
else {
|
||||
conf_editor_instCapt.getEditor("root.instCapture.audioEnable").setValue(window.serverConfig.instCapture.audioEnable);
|
||||
|
||||
}
|
||||
} else {
|
||||
showInputOptionForItem(conf_editor_instCapt, "instCapture", "audioGrabberDevice", false);
|
||||
showInputOptionForItem(conf_editor_instCapt, "instCapture", "audioEnable", false);
|
||||
showInputOptionForItem(conf_editor_instCapt, "instCapture", "audioPriority", false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
conf_editor_instCapt.on('change', function () {
|
||||
|
||||
if (!conf_editor_instCapt.validate().length) {
|
||||
if (!window.serverConfig.framegrabber.enable && !window.serverConfig.grabberV4L2.enable) {
|
||||
if (!window.serverConfig.framegrabber.enable &&
|
||||
!window.serverConfig.grabberV4L2.enable &&
|
||||
!window.serverConfig.grabberAudio.enable) {
|
||||
$('#btn_submit_instCapt').prop('disabled', true);
|
||||
} else {
|
||||
window.readOnlyMode ? $('#btn_submit_instCapt').prop('disabled', true) : $('#btn_submit_instCapt').prop('disabled', false);
|
||||
@@ -130,6 +148,23 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
conf_editor_instCapt.watch('root.instCapture.audioEnable', () => {
|
||||
const audioEnable = conf_editor_instCapt.getEditor("root.instCapture.audioEnable").getValue();
|
||||
if (audioEnable) {
|
||||
conf_editor_instCapt.getEditor("root.instCapture.audioGrabberDevice").setValue(window.serverConfig.grabberAudio.available_devices);
|
||||
conf_editor_instCapt.getEditor("root.instCapture.audioGrabberDevice").disable();
|
||||
showInputOptions("instCapture", ["audioGrabberDevice"], true);
|
||||
showInputOptions("instCapture", ["audioPriority"], true);
|
||||
}
|
||||
else {
|
||||
if (!window.serverConfig.grabberAudio.enable) {
|
||||
conf_editor_instCapt.getEditor("root.instCapture.audioEnable").disable();
|
||||
}
|
||||
showInputOptions("instCapture", ["audioGrabberDevice"], false);
|
||||
showInputOptions("instCapture", ["audioPriority"], false);
|
||||
}
|
||||
});
|
||||
|
||||
$('#btn_submit_instCapt').off().on('click', function () {
|
||||
requestWriteConfig(conf_editor_instCapt.getValue());
|
||||
});
|
||||
|
@@ -1002,6 +1002,21 @@ $(document).ready(function () {
|
||||
|
||||
addJsonEditorHostValidation();
|
||||
|
||||
JSONEditor.defaults.custom_validators.push(function (schema, value, path) {
|
||||
var errors = [];
|
||||
|
||||
if (path === "root.specificOptions.segments.segmentList") {
|
||||
var overlapSegNames = validateWledSegmentConfig(value);
|
||||
if (overlapSegNames.length > 0) {
|
||||
errors.push({
|
||||
path: "root.specificOptions.segments",
|
||||
message: $.i18n('edt_dev_spec_segmentsOverlapValidation_error', overlapSegNames.length, overlapSegNames.join(', '))
|
||||
});
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
});
|
||||
|
||||
$("#leddevices").off().on("change", function () {
|
||||
var generalOptions = window.serverSchema.properties.device;
|
||||
|
||||
@@ -1080,8 +1095,8 @@ $(document).ready(function () {
|
||||
$('#btn_test_controller').hide();
|
||||
|
||||
switch (ledType) {
|
||||
case "cololight":
|
||||
case "wled":
|
||||
case "cololight":
|
||||
case "nanoleaf":
|
||||
showAllDeviceInputOptions("hostList", false);
|
||||
case "apa102":
|
||||
@@ -1107,7 +1122,22 @@ $(document).ready(function () {
|
||||
if (storedAccess === 'expert') {
|
||||
filter.discoverAll = true;
|
||||
}
|
||||
discover_device(ledType, filter);
|
||||
|
||||
$('#btn_submit_controller').prop('disabled', true);
|
||||
|
||||
discover_device(ledType, filter)
|
||||
.then(discoveryResult => {
|
||||
updateOutputSelectList(ledType, discoveryResult);
|
||||
})
|
||||
.then(discoveryResult => {
|
||||
if (ledType === "wled") {
|
||||
updateElementsWled(ledType);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
showNotification('danger', "Device discovery for " + ledType + " failed with error:" + error);
|
||||
});
|
||||
|
||||
hwLedCountDefault = 1;
|
||||
colorOrderDefault = "rgb";
|
||||
break;
|
||||
@@ -1211,8 +1241,8 @@ $(document).ready(function () {
|
||||
}
|
||||
break;
|
||||
|
||||
case "cololight":
|
||||
case "wled":
|
||||
case "cololight":
|
||||
var hostList = conf_editor.getEditor("root.specificOptions.hostList").getValue();
|
||||
if (hostList !== "SELECT") {
|
||||
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||
@@ -1339,7 +1369,9 @@ $(document).ready(function () {
|
||||
break;
|
||||
|
||||
case "wled":
|
||||
params = { host: host, filter: "info" };
|
||||
//Ensure that elements are defaulted for new host
|
||||
updateElementsWled(ledType, host);
|
||||
params = { host: host };
|
||||
getProperties_device(ledType, host, params);
|
||||
break;
|
||||
|
||||
@@ -1452,6 +1484,10 @@ $(document).ready(function () {
|
||||
}
|
||||
conf_editor.getEditor("root.specificOptions.rateList").setValue(rate);
|
||||
break;
|
||||
case "wled":
|
||||
var hardwareLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount").getValue();
|
||||
validateWledLedCount(hardwareLedCount);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
});
|
||||
@@ -1547,12 +1583,54 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
//WLED
|
||||
conf_editor.watch('root.specificOptions.segments.segmentList', () => {
|
||||
|
||||
//Update hidden streamSegmentId element
|
||||
var selectedSegment = conf_editor.getEditor("root.specificOptions.segments.segmentList").getValue();
|
||||
var streamSegmentId = parseInt(selectedSegment);
|
||||
conf_editor.getEditor("root.specificOptions.segments.streamSegmentId").setValue(streamSegmentId);
|
||||
|
||||
if (devicesProperties[ledType]) {
|
||||
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||
var ledDeviceProperties = devicesProperties[ledType][host];
|
||||
|
||||
if (ledDeviceProperties) {
|
||||
var hardwareLedCount = 1;
|
||||
if (streamSegmentId > -1) {
|
||||
// Set hardware LED count to segment length
|
||||
if (ledDeviceProperties.state) {
|
||||
var segments = ledDeviceProperties.state.seg;
|
||||
var segmentConfig = segments.filter(seg => seg.id == streamSegmentId)[0];
|
||||
hardwareLedCount = segmentConfig.len;
|
||||
}
|
||||
} else {
|
||||
//"Use main segment only" is disabled, i.e. stream to all LEDs
|
||||
if (ledDeviceProperties.info) {
|
||||
hardwareLedCount = ledDeviceProperties.info.leds.count;
|
||||
}
|
||||
}
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(hardwareLedCount);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Handle Hardware Led Count constraint list
|
||||
conf_editor.watch('root.generalOptions.hardwareLedCountList', () => {
|
||||
var hwLedCountSelected = conf_editor.getEditor("root.generalOptions.hardwareLedCountList").getValue();
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(Number(hwLedCountSelected));
|
||||
});
|
||||
|
||||
//Handle Hardware Led update and constraints
|
||||
conf_editor.watch('root.generalOptions.hardwareLedCount', () => {
|
||||
var hardwareLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount").getValue();
|
||||
switch (ledType) {
|
||||
case "wled":
|
||||
validateWledLedCount(hardwareLedCount);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//philipshueentertainment backward fix
|
||||
@@ -1798,8 +1876,8 @@ function saveLedConfig(genDefLayout = false) {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
// build dynamic enum
|
||||
var updateSelectList = function (ledType, discoveryInfo) {
|
||||
// build dynamic enum for hosts or output paths
|
||||
var updateOutputSelectList = function (ledType, discoveryInfo) {
|
||||
// Only update, if ledType is equal of selected controller type and discovery info exists
|
||||
if (ledType !== $("#leddevices").val() || !discoveryInfo.devices) {
|
||||
return;
|
||||
@@ -1810,7 +1888,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
|
||||
var key;
|
||||
var enumVals = [];
|
||||
var enumTitelVals = [];
|
||||
var enumTitleVals = [];
|
||||
var enumDefaultVal = "";
|
||||
var addSelect = false;
|
||||
var addCustom = false;
|
||||
@@ -1835,7 +1913,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
|
||||
if (discoveryInfo.devices.length === 0) {
|
||||
enumVals.push("NONE");
|
||||
enumTitelVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
enumTitleVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
}
|
||||
else {
|
||||
var name;
|
||||
@@ -1876,7 +1954,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
}
|
||||
|
||||
enumVals.push(host);
|
||||
enumTitelVals.push(name);
|
||||
enumTitleVals.push(name);
|
||||
}
|
||||
|
||||
//Always allow to add custom configuration
|
||||
@@ -1904,7 +1982,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
|
||||
if (discoveryInfo.devices.length == 0) {
|
||||
enumVals.push("NONE");
|
||||
enumTitelVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
enumTitleVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
$('#btn_submit_controller').prop('disabled', true);
|
||||
showAllDeviceInputOptions(key, false);
|
||||
}
|
||||
@@ -1922,7 +2000,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
} else {
|
||||
enumVals.push(device.portName);
|
||||
}
|
||||
enumTitelVals.push(device.portName + " (" + device.vendorIdentifier + "|" + device.productIdentifier + ") - " + device.manufacturer);
|
||||
enumTitleVals.push(device.portName + " (" + device.vendorIdentifier + "|" + device.productIdentifier + ") - " + device.manufacturer);
|
||||
}
|
||||
|
||||
// Select configured device
|
||||
@@ -1951,7 +2029,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
|
||||
if (discoveryInfo.devices.length == 0) {
|
||||
enumVals.push("NONE");
|
||||
enumTitelVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
enumTitleVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
$('#btn_submit_controller').prop('disabled', true);
|
||||
showAllDeviceInputOptions(key, false);
|
||||
}
|
||||
@@ -1970,7 +2048,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
case "piblaster":
|
||||
for (const device of discoveryInfo.devices) {
|
||||
enumVals.push(device.systemLocation);
|
||||
enumTitelVals.push(device.deviceName + " (" + device.systemLocation + ")");
|
||||
enumTitleVals.push(device.deviceName + " (" + device.systemLocation + ")");
|
||||
}
|
||||
|
||||
// Select configured device
|
||||
@@ -1993,7 +2071,7 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
|
||||
if (discoveryInfo.devices.length == 0) {
|
||||
enumVals.push("NONE");
|
||||
enumTitelVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
enumTitleVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
|
||||
$('#btn_submit_controller').prop('disabled', true);
|
||||
showAllDeviceInputOptions(key, false);
|
||||
|
||||
@@ -2004,18 +2082,19 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
}
|
||||
|
||||
if (enumVals.length > 0) {
|
||||
updateJsonEditorSelection(conf_editor, 'root.specificOptions', key, addSchemaElements, enumVals, enumTitelVals, enumDefaultVal, addSelect, addCustom);
|
||||
updateJsonEditorSelection(conf_editor, 'root.specificOptions', key, addSchemaElements, enumVals, enumTitleVals, enumDefaultVal, addSelect, addCustom);
|
||||
}
|
||||
};
|
||||
|
||||
async function discover_device(ledType, params) {
|
||||
|
||||
$('#btn_submit_controller').prop('disabled', true);
|
||||
|
||||
const result = await requestLedDeviceDiscovery(ledType, params);
|
||||
|
||||
var discoveryResult;
|
||||
if (result && !result.error) {
|
||||
var discoveryResult = {};
|
||||
if (result) {
|
||||
if (result.error) {
|
||||
throw (result.error);
|
||||
}
|
||||
discoveryResult = result.info;
|
||||
}
|
||||
else {
|
||||
@@ -2024,8 +2103,7 @@ async function discover_device(ledType, params) {
|
||||
ledDevicetype: ledType
|
||||
}
|
||||
}
|
||||
|
||||
updateSelectList(ledType, discoveryResult);
|
||||
return discoveryResult;
|
||||
}
|
||||
|
||||
async function getProperties_device(ledType, key, params) {
|
||||
@@ -2089,23 +2167,7 @@ function updateElements(ledType, key) {
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(hardwareLedCount);
|
||||
break;
|
||||
case "wled":
|
||||
var ledProperties = devicesProperties[ledType][key];
|
||||
|
||||
if (ledProperties && ledProperties.leds) {
|
||||
hardwareLedCount = ledProperties.leds.count;
|
||||
if (ledProperties.maxLedCount) {
|
||||
var maxLedCount = ledProperties.maxLedCount;
|
||||
if (hardwareLedCount > maxLedCount) {
|
||||
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_hwled_gt_maxled', hardwareLedCount, maxLedCount, maxLedCount));
|
||||
hardwareLedCount = maxLedCount;
|
||||
conf_editor.getEditor("root.specificOptions.streamProtocol").setValue("RAW");
|
||||
//Workaround, as value seems to getting updated property when a 'getEditor("root.specificOptions").getValue()' is done during save
|
||||
var editor = conf_editor.getEditor("root.specificOptions");
|
||||
editor.value["streamProtocol"] = "RAW";
|
||||
}
|
||||
}
|
||||
}
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(hardwareLedCount);
|
||||
updateElementsWled(ledType, key);
|
||||
break;
|
||||
|
||||
case "nanoleaf":
|
||||
@@ -2190,3 +2252,168 @@ function disableAutoResolvedGeneralOptions() {
|
||||
conf_editor.getEditor("root.generalOptions.colorOrder").disable();
|
||||
}
|
||||
|
||||
function validateWledSegmentConfig(streamSegmentId) {
|
||||
var overlapSegNames = [];
|
||||
if (streamSegmentId > -1) {
|
||||
if (!jQuery.isEmptyObject(devicesProperties)) {
|
||||
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||
var ledProperties = devicesProperties['wled'][host];
|
||||
if (ledProperties && ledProperties.state) {
|
||||
var segments = ledProperties.state.seg;
|
||||
var segmentConfig = segments.filter(seg => seg.id == streamSegmentId)[0];
|
||||
|
||||
var overlappingSegments = segments.filter((seg) => {
|
||||
if (seg.id != streamSegmentId) {
|
||||
if ((segmentConfig.start >= seg.stop) || (segmentConfig.start < seg.start && segmentConfig.stop <= seg.start)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (overlappingSegments.length > 0) {
|
||||
var overlapSegNames = [];
|
||||
for (const segment of overlappingSegments) {
|
||||
if (segment.n) {
|
||||
overlapSegNames.push(segment.n);
|
||||
} else {
|
||||
overlapSegNames.push("Segment " + segment.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return overlapSegNames;
|
||||
}
|
||||
|
||||
function validateWledLedCount(hardwareLedCount) {
|
||||
|
||||
if (!jQuery.isEmptyObject(devicesProperties)) {
|
||||
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||
var ledDeviceProperties = devicesProperties["wled"][host];
|
||||
|
||||
if (ledDeviceProperties) {
|
||||
|
||||
var streamProtocol = conf_editor.getEditor("root.specificOptions.streamProtocol").getValue();
|
||||
if (streamProtocol === "RAW") {
|
||||
var maxLedCount = 490;
|
||||
if (ledDeviceProperties.maxLedCount) {
|
||||
//WLED not DDP ready
|
||||
maxLedCount = ledDeviceProperties.maxLedCount;
|
||||
if (hardwareLedCount > maxLedCount) {
|
||||
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_hwled_gt_maxled', hardwareLedCount, maxLedCount, maxLedCount));
|
||||
hardwareLedCount = maxLedCount;
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(hardwareLedCount);
|
||||
conf_editor.getEditor("root.specificOptions.streamProtocol").setValue("RAW");
|
||||
}
|
||||
} else {
|
||||
//WLED is DDP ready
|
||||
if (hardwareLedCount > maxLedCount) {
|
||||
var newStreamingProtocol = "DDP";
|
||||
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_hwled_gt_maxled_protocol', hardwareLedCount, maxLedCount, newStreamingProtocol));
|
||||
conf_editor.getEditor("root.specificOptions.streamProtocol").setValue(newStreamingProtocol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateElementsWled(ledType, key) {
|
||||
|
||||
// Get configured device's details
|
||||
var configuredDeviceType = window.serverConfig.device.type;
|
||||
var configuredHost = window.serverConfig.device.host;
|
||||
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||
|
||||
//New segment selection list values
|
||||
var enumSegSelectVals = [];
|
||||
var enumSegSelectTitleVals = [];
|
||||
var enumSegSelectDefaultVal = "";
|
||||
|
||||
if (devicesProperties[ledType] && devicesProperties[ledType][key]) {
|
||||
var ledDeviceProperties = devicesProperties[ledType][key];
|
||||
|
||||
if (!jQuery.isEmptyObject(ledDeviceProperties)) {
|
||||
|
||||
if (ledDeviceProperties.info) {
|
||||
if (ledDeviceProperties.info.liveseg && ledDeviceProperties.info.liveseg < 0) {
|
||||
// "Use main segment only" is disabled
|
||||
var defaultSegmentId = "-1";
|
||||
enumSegSelectVals.push(defaultSegmentId);
|
||||
enumSegSelectTitleVals.push($.i18n('edt_dev_spec_segments_disabled_title'));
|
||||
enumSegSelectDefaultVal = defaultSegmentId;
|
||||
|
||||
} else {
|
||||
if (ledDeviceProperties.state) {
|
||||
//Prepare new segment selection list
|
||||
var segments = ledDeviceProperties.state.seg;
|
||||
for (const segment of segments) {
|
||||
enumSegSelectVals.push(segment.id.toString());
|
||||
if (segment.n) {
|
||||
enumSegSelectTitleVals.push(segment.n);
|
||||
} else {
|
||||
enumSegSelectTitleVals.push("Segment " + segment.id);
|
||||
}
|
||||
}
|
||||
var currentSegmentId = conf_editor.getEditor("root.specificOptions.segments.streamSegmentId").getValue().toString();
|
||||
enumSegSelectDefaultVal = currentSegmentId;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if currently configured segment is available at WLED
|
||||
var configuredDeviceType = window.serverConfig.device.type;
|
||||
var configuredHost = window.serverConfig.device.host;
|
||||
|
||||
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||
if (configuredDeviceType == ledType && configuredHost == host) {
|
||||
var configuredStreamSegmentId = window.serverConfig.device.segments.streamSegmentId.toString();
|
||||
var segmentIdFound = enumSegSelectVals.filter(segId => segId == configuredStreamSegmentId).length;
|
||||
if (!segmentIdFound) {
|
||||
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_wled_segment_missing', configuredStreamSegmentId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//If failed to get properties
|
||||
var hardwareLedCount;
|
||||
var segmentConfig = false;
|
||||
|
||||
if (configuredDeviceType == ledType && configuredHost == host) {
|
||||
// Populate elements from existing configuration
|
||||
if (window.serverConfig.device.segments) {
|
||||
segmentConfig = true;
|
||||
}
|
||||
hardwareLedCount = window.serverConfig.device.hardwareLedCount;
|
||||
} else {
|
||||
// Populate elements with default values
|
||||
hardwareLedCount = 1;
|
||||
}
|
||||
|
||||
if (segmentConfig) {
|
||||
var configuredstreamSegmentId = window.serverConfig.device.segments.streamSegmentId.toString();
|
||||
enumSegSelectVals = [configuredstreamSegmentId];
|
||||
enumSegSelectTitleVals = ["Segment " + configuredstreamSegmentId];
|
||||
enumSegSelectDefaultVal = configuredstreamSegmentId;
|
||||
} else {
|
||||
defaultSegmentId = "-1";
|
||||
enumSegSelectVals.push(defaultSegmentId);
|
||||
enumSegSelectTitleVals.push($.i18n('edt_dev_spec_segments_disabled_title'));
|
||||
enumSegSelectDefaultVal = defaultSegmentId;
|
||||
}
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(hardwareLedCount);
|
||||
}
|
||||
|
||||
updateJsonEditorSelection(conf_editor, 'root.specificOptions.segments',
|
||||
'segmentList', {}, enumSegSelectVals, enumSegSelectTitleVals, enumSegSelectDefaultVal, false, false);
|
||||
|
||||
//Show additional configuration options, if more than one segment is available
|
||||
var showAdditionalOptions = false;
|
||||
if (enumSegSelectVals.length > 1) {
|
||||
showAdditionalOptions = true;
|
||||
}
|
||||
showInputOptionForItem(conf_editor, "root.specificOptions.segments", "switchOffOtherSegments", showAdditionalOptions);
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,8 @@ $(document).ready(function () {
|
||||
function infoSummary() {
|
||||
var info = "";
|
||||
|
||||
info += 'Hyperion System Summary Report (' + window.serverConfig.general.name + '), Reported instance: ' + window.currentHyperionInstanceName + '\n';
|
||||
info += 'Hyperion System Summary Report (' + window.serverConfig.general.name + ')\n';
|
||||
info += 'Reported instance: [' + window.currentHyperionInstance + '] - ' + window.currentHyperionInstanceName + '\n';
|
||||
|
||||
info += "\n< ----- System information -------------------- >\n";
|
||||
info += getSystemInfo() + '\n';
|
||||
@@ -43,22 +44,36 @@ $(document).ready(function () {
|
||||
info += "\n< ----- Configured Instances ------------------ >\n";
|
||||
var instances = window.serverInfo.instance;
|
||||
for (var i = 0; i < instances.length; i++) {
|
||||
info += instances[i].instance + ': ' + instances[i].friendly_name + ' Running: ' + instances[i].running + '\n';
|
||||
info += instances[i].instance + ': ' + instances[i].friendly_name + ', Running: ' + instances[i].running + '\n';
|
||||
}
|
||||
|
||||
info += "\n< ----- This instance's priorities ------------ >\n";
|
||||
var prios = window.serverInfo.priorities;
|
||||
for (var i = 0; i < prios.length; i++) {
|
||||
info += prios[i].priority + ': ';
|
||||
if (prios[i].visible) {
|
||||
info += ' VISIBLE!';
|
||||
|
||||
if (prios.length > 0) {
|
||||
|
||||
for (var i = 0; i < prios.length; i++) {
|
||||
|
||||
var prio = prios[i].priority.toString().padStart(3, '0');
|
||||
|
||||
info += prio + ': ';
|
||||
if (prios[i].visible) {
|
||||
info += ' VISIBLE -';
|
||||
}
|
||||
else {
|
||||
info += ' INVISIBLE -';
|
||||
}
|
||||
info += ' (' + prios[i].componentId + ')';
|
||||
if (prios[i].owner) {
|
||||
info += ' (Owner: ' + prios[i].owner + ')';
|
||||
}
|
||||
info += '\n';
|
||||
|
||||
}
|
||||
else {
|
||||
info += ' ';
|
||||
}
|
||||
info += ' (' + prios[i].componentId + ') Owner: ' + prios[i].owner + '\n';
|
||||
} else {
|
||||
info += 'The current priority list is empty!\n';
|
||||
}
|
||||
info += 'priorities_autoselect: ' + window.serverInfo.priorities_autoselect + '\n';
|
||||
info += 'Autoselect: ' + window.serverInfo.priorities_autoselect + '\n';
|
||||
|
||||
info += "\n< ----- This instance components' status ------->\n";
|
||||
var comps = window.serverInfo.components;
|
||||
@@ -67,7 +82,7 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
info += "\n< ----- This instance's configuration --------- >\n";
|
||||
info += JSON.stringify(window.serverConfig) + '\n';
|
||||
info += JSON.stringify(window.serverConfig, null, 2) + '\n';
|
||||
|
||||
info += "\n< ----- Current Log --------------------------- >\n";
|
||||
var logMsgs = document.getElementById("logmessages").textContent;
|
||||
@@ -193,18 +208,19 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
// toggle fullscreen button in log output
|
||||
$(".fullscreen-btn").mousedown(function(e) {
|
||||
$(".fullscreen-btn").mousedown(function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(".fullscreen-btn").click(function(e) {
|
||||
$(".fullscreen-btn").click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).children('i')
|
||||
.toggleClass('fa-expand')
|
||||
.toggleClass('fa-compress');
|
||||
$('#conf_cont').toggle();
|
||||
$('#logmessages').css('max-height', $('#logmessages').css('max-height') !== 'none' ? 'none' : '400px' );
|
||||
$('#logmessages').css('max-height', $('#logmessages').css('max-height') !== 'none' ? 'none' : '400px');
|
||||
});
|
||||
|
||||
removeOverlay();
|
||||
});
|
||||
|
||||
|
@@ -98,7 +98,7 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
function updateInputSelect() {
|
||||
$('.sstbody').html("");
|
||||
$('.sstbody').empty();
|
||||
var prios = window.serverInfo.priorities;
|
||||
var clearAll = false;
|
||||
|
||||
@@ -155,6 +155,9 @@ $(document).ready(function () {
|
||||
case "V4L":
|
||||
owner = $.i18n('general_comp_V4L') + ': (' + owner + ')';
|
||||
break;
|
||||
case "AUDIO":
|
||||
owner = $.i18n('general_comp_AUDIO') + ': (' + owner + ')';
|
||||
break;
|
||||
case "BOBLIGHTSERVER":
|
||||
owner = $.i18n('general_comp_BOBLIGHTSERVER');
|
||||
break;
|
||||
@@ -220,7 +223,8 @@ $(document).ready(function () {
|
||||
for (const comp of components) {
|
||||
if (comp.name === "ALL" || (comp.name === "FORWARDER" && window.currentHyperionInstance != 0) ||
|
||||
(comp.name === "GRABBER" && !window.serverConfig.framegrabber.enable) ||
|
||||
(comp.name === "V4L" && !window.serverConfig.grabberV4L2.enable))
|
||||
(comp.name === "V4L" && !window.serverConfig.grabberV4L2.enable) ||
|
||||
(comp.name === "AUDIO" && !window.serverConfig.grabberAudio.enable))
|
||||
continue;
|
||||
|
||||
const enable_style = (comp.enabled ? "checked" : "");
|
||||
|
@@ -171,6 +171,10 @@ function initLanguageSelection() {
|
||||
}
|
||||
|
||||
function updateUiOnInstance(inst) {
|
||||
|
||||
window.currentHyperionInstance = inst;
|
||||
window.currentHyperionInstanceName = getInstanceNameByIndex(inst);
|
||||
|
||||
$("#active_instance_friendly_name").text(getInstanceNameByIndex(inst));
|
||||
if (window.serverInfo.instance.filter(entry => entry.running).length > 1) {
|
||||
$('#btn_hypinstanceswitch').toggle(true);
|
||||
@@ -316,7 +320,7 @@ function showInfoDialog(type, header, message) {
|
||||
|
||||
$(document).on('click', '[data-dismiss-modal]', function () {
|
||||
var target = $(this).attr('data-dismiss-modal');
|
||||
$(target).modal('hide'); // lgtm [js/xss-through-dom]
|
||||
$.find(target).modal('hide');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -407,6 +411,32 @@ function isJsonString(str) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const getObjectProperty = (obj, path) => path.split(".").reduce((o, key) => o && typeof o[key] !== 'undefined' ? o[key] : undefined, obj);
|
||||
|
||||
const setObjectProperty = (object, path, value) => {
|
||||
const parts = path.split('.');
|
||||
const limit = parts.length - 1;
|
||||
for (let i = 0; i < limit; ++i) {
|
||||
const key = parts[i];
|
||||
if (key === "__proto__" || key === "constructor") continue;
|
||||
object = object[key] ?? (object[key] = {});
|
||||
}
|
||||
const key = parts[limit];
|
||||
object[key] = value;
|
||||
};
|
||||
|
||||
function getLongPropertiesPath(path) {
|
||||
if (path) {
|
||||
var path = path.replace('root.', '');
|
||||
const parts = path.split('.');
|
||||
parts.forEach(function (part, index) {
|
||||
this[index] += ".properties";
|
||||
}, parts);
|
||||
path = parts.join('.') + '.';
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
function createJsonEditor(container, schema, setconfig, usePanel, arrayre) {
|
||||
$('#' + container).off();
|
||||
$('#' + container).html("");
|
||||
@@ -527,7 +557,8 @@ function updateJsonEditorSelection(rootEditor, path, key, addElements, newEnumVa
|
||||
|
||||
editor.original_schema.properties[key] = orginalProperties;
|
||||
editor.schema.properties[key] = newSchema[key];
|
||||
rootEditor.validator.schema.properties[editor.key].properties[key] = newSchema[key];
|
||||
//Update schema properties for validator
|
||||
setObjectProperty(rootEditor.validator.schema.properties, getLongPropertiesPath(path) + key, newSchema[key]);
|
||||
|
||||
editor.removeObjectProperty(key);
|
||||
delete editor.cached_editors[key];
|
||||
@@ -596,7 +627,8 @@ function updateJsonEditorMultiSelection(rootEditor, path, key, addElements, newE
|
||||
|
||||
editor.original_schema.properties[key] = orginalProperties;
|
||||
editor.schema.properties[key] = newSchema[key];
|
||||
rootEditor.validator.schema.properties[editor.key].properties[key] = newSchema[key];
|
||||
//Update schema properties for validator
|
||||
setObjectProperty(rootEditor.validator.schema.properties, getLongPropertiesPath(path) + key, newSchema[key]);
|
||||
|
||||
editor.removeObjectProperty(key);
|
||||
delete editor.cached_editors[key];
|
||||
@@ -644,7 +676,8 @@ function updateJsonEditorRange(rootEditor, path, key, minimum, maximum, defaultV
|
||||
|
||||
editor.original_schema.properties[key] = orginalProperties;
|
||||
editor.schema.properties[key] = newSchema[key];
|
||||
rootEditor.validator.schema.properties[editor.key].properties[key] = newSchema[key];
|
||||
//Update schema properties for validator
|
||||
setObjectProperty(rootEditor.validator.schema.properties, getLongPropertiesPath(path) + key, newSchema[key]);
|
||||
|
||||
editor.removeObjectProperty(key);
|
||||
delete editor.cached_editors[key];
|
||||
@@ -1187,6 +1220,7 @@ function getSystemInfo() {
|
||||
//info += '- Log lvl: ' + window.serverConfig.logger.level + '\n';
|
||||
info += '- Avail Screen Cap.: ' + window.serverInfo.grabbers.screen.available + '\n';
|
||||
info += '- Avail Video Cap.: ' + window.serverInfo.grabbers.video.available + '\n';
|
||||
info += '- Avail Audio Cap.: ' + window.serverInfo.grabbers.audio.available + '\n';
|
||||
info += '- Avail Services: ' + window.serverInfo.services + '\n';
|
||||
info += '- Config path: ' + shy.rootPath + '\n';
|
||||
info += '- Database: ' + (shy.readOnlyMode ? "ready-only" : "read/write") + '\n';
|
||||
@@ -1246,15 +1280,26 @@ function isAccessLevelCompliant(accessLevel) {
|
||||
}
|
||||
|
||||
function showInputOptions(path, elements, state) {
|
||||
|
||||
if (!path.startsWith("root.")) {
|
||||
path = ["root", path].join('.');
|
||||
}
|
||||
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
$('[data-schemapath="root.' + path + '.' + elements[i] + '"]').toggle(state);
|
||||
$('[data-schemapath="' + path + '.' + elements[i] + '"]').toggle(state);
|
||||
}
|
||||
}
|
||||
|
||||
function showInputOptionForItem(editor, path, item, state) {
|
||||
var accessLevel = editor.schema.properties[path].properties[item].access;
|
||||
//Get access level for full path and item
|
||||
var accessLevel = getObjectProperty(editor.schema.properties, getLongPropertiesPath(path) + item + ".access");
|
||||
// Enable element only, if access level compliant
|
||||
if (!state || isAccessLevelCompliant(accessLevel)) {
|
||||
|
||||
if (!path) {
|
||||
debugger;
|
||||
path = editor.path;
|
||||
}
|
||||
showInputOptions(path, [item], state);
|
||||
}
|
||||
}
|
||||
@@ -1269,17 +1314,26 @@ function showInputOptionsForKey(editor, item, showForKeys, state) {
|
||||
if (typeof showForKeys === 'string') {
|
||||
keysToshow.push(showForKeys);
|
||||
} else {
|
||||
return
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (var key in editor.schema.properties[item].properties) {
|
||||
for (let key in editor.schema.properties[item].properties) {
|
||||
if ($.inArray(key, keysToshow) === -1) {
|
||||
var accessLevel = editor.schema.properties[item].properties[key].access;
|
||||
const accessLevel = editor.schema.properties[item].properties[key].access;
|
||||
|
||||
var hidden = false;
|
||||
if (editor.schema.properties[item].properties[key].options) {
|
||||
hidden = editor.schema.properties[item].properties[key].options.hidden;
|
||||
if (typeof hidden === 'undefined') {
|
||||
hidden = false;
|
||||
}
|
||||
}
|
||||
//Always disable all elements, but only enable elements, if access level compliant
|
||||
if (!state || isAccessLevelCompliant(accessLevel)) {
|
||||
elements.push(key);
|
||||
if (!hidden) {
|
||||
elements.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1314,7 +1368,7 @@ function isValidIPv6(value) {
|
||||
|
||||
function isValidHostname(value) {
|
||||
if (value.match(
|
||||
'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])(.([a-zA-Z0-9]|[_a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))*$' //lgtm [js/redos]
|
||||
'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])(.([a-zA-Z0-9]|[_a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))*$'
|
||||
))
|
||||
return true;
|
||||
else
|
||||
@@ -1323,7 +1377,7 @@ function isValidHostname(value) {
|
||||
|
||||
function isValidServicename(value) {
|
||||
if (value.match(
|
||||
'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9 -]{0,61}[a-zA-Z0-9])(.([a-zA-Z0-9]|[_a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))*$' //lgtm [js/redos]
|
||||
'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9 -]{0,61}[a-zA-Z0-9])(.([a-zA-Z0-9]|[_a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))*$'
|
||||
))
|
||||
return true;
|
||||
else
|
||||
|
@@ -864,6 +864,7 @@ function useGroupId(id) {
|
||||
get_hue_lights();
|
||||
}
|
||||
|
||||
|
||||
async function discover_hue_bridges() {
|
||||
$('#wiz_hue_ipstate').html($.i18n('edt_dev_spec_devices_discovery_inprogress'));
|
||||
$('#wiz_hue_discovered').html("")
|
||||
@@ -1021,11 +1022,11 @@ function beginWizardHue() {
|
||||
$('#host').val(host);
|
||||
|
||||
var port = eV("port");
|
||||
if (port > 0) {
|
||||
$('#port').val(port);
|
||||
if (port == 0) {
|
||||
$('#port').val(80);
|
||||
}
|
||||
else {
|
||||
$('#port').val('');
|
||||
$('#port').val(port);
|
||||
}
|
||||
hueIPs.unshift({ host: host, port: port });
|
||||
|
||||
@@ -1042,7 +1043,13 @@ function beginWizardHue() {
|
||||
|
||||
hueIPs = [];
|
||||
hueIPsinc = 0;
|
||||
hueIPs.push({ host: $('#host').val(), port: $('#port').val() });
|
||||
|
||||
var port = $('#port').val();
|
||||
if (isNaN(port) || port < 1 || port > 65535) {
|
||||
port = 80;
|
||||
$('#port').val(80);
|
||||
}
|
||||
hueIPs.push({ host: $('#host').val(), port: port });
|
||||
}
|
||||
else {
|
||||
discover_hue_bridges();
|
||||
|
Reference in New Issue
Block a user