$(document).ready(function () {
performTranslation();
function updateComponents() {
$("div[class*='currentInstance']").remove();
var instances_html = '
';
instances_html += '
';
instances_html += '
';
instances_html += '
';
instances_html += '
';
instances_html += '';
instances_html += '';
instances_html += '' + $.i18n('dashboard_infobox_label_title') + '';
instances_html += ' |
';
instances_html += '';
instances_html += ' | ' + $.i18n('conf_leds_contr_label_contrtype') + ' | ';
instances_html += '';
instances_html += '' + window.serverConfig.device.type + '';
instances_html += '';
instances_html += ' |
';
instances_html += '
';
instances_html += '
';
instances_html += '
';
$('.instances').prepend(instances_html);
updateUiOnInstance(window.currentHyperionInstance);
updateHyperionInstanceListing();
$('#instanceButton').bootstrapToggle();
$('#instanceButton').on("change", e => {
requestSetComponentState('ALL', e.currentTarget.checked);
});
for (var idx = 0; idx < components.length; idx++) {
if (components[idx].name != "ALL") {
$("#general_comp_" + components[idx].name).bootstrapToggle();
$("#general_comp_" + components[idx].name).bootstrapToggle(hyperion_enabled ? "enable" : "disable");
$("#general_comp_" + components[idx].name).on("change", e => {
requestSetComponentState(e.currentTarget.id.split('_')[2], e.currentTarget.checked);
});
}
}
}
// add more info
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 || audioGrabberAvailable) {
if (screenGrabberAvailable) {
var screenGrabber = window.serverConfig.framegrabber.enable ? $.i18n('general_enabled') : $.i18n('general_disabled');
$('#dash_screen_grabber').html(screenGrabber);
} else {
$("#dash_screen_grabber_row").hide();
}
if (videoGrabberAvailable) {
var videoGrabber = window.serverConfig.grabberV4L2.enable ? $.i18n('general_enabled') : $.i18n('general_disabled');
$('#dash_video_grabber').html(videoGrabber);
} 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();
}
if (jQuery.inArray("flatbuffer", window.serverInfo.services) !== -1) {
var fbPort = window.serverConfig.flatbufServer.enable ? window.serverConfig.flatbufServer.port : $.i18n('general_disabled');
$('#dash_fbPort').html(fbPort);
} else {
$("#dash_ports_flat_row").hide();
}
if (jQuery.inArray("protobuffer", window.serverInfo.services) !== -1) {
var pbPort = window.serverConfig.protoServer.enable ? window.serverConfig.protoServer.port : $.i18n('general_disabled');
$('#dash_pbPort').html(pbPort);
} else {
$("#dash_ports_proto_row").hide();
}
if (jQuery.inArray("boblight", window.serverInfo.services) !== -1) {
var boblightPort = window.serverConfig.boblightServer.enable ? window.serverConfig.boblightServer.port : $.i18n('general_disabled');
$('#dash_boblightPort').html(boblightPort);
} else {
$("#dash_ports_boblight_row").hide();
}
var jsonPort = window.serverConfig.jsonServer.port;
$('#dash_jsonPort').html(jsonPort);
var wsPorts = window.serverConfig.webConfig.port + ' | ' + window.serverConfig.webConfig.sslPort;
$('#dash_wsPorts').html(wsPorts);
$('#dash_currv').html(window.currentVersion);
$('#dash_watchedversionbranch').html(window.serverConfig.general.watchedVersionBranch);
getReleases(function (callback) {
if (callback) {
$('#dash_latev').html(window.latestVersion.tag_name);
if (semverLite.gt(window.latestVersion.tag_name, window.currentVersion))
$('#versioninforesult').html('');
else
$('#versioninforesult').html('' + $.i18n('dashboard_infobox_message_updatesuccess') + '
');
}
});
//interval update
updateComponents();
$(window.hyperion).on("components-updated", updateComponents);
if (window.showOptHelp)
createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro");
removeOverlay();
});