hyperion.ng/assets/webconfig/js/ui_utils.js

997 lines
28 KiB
JavaScript
Raw Normal View History

var prevTag;
function removeOverlay()
{
$("#loading_overlay").removeClass("overlay");
}
function reload()
{
2018-12-27 23:11:32 +01:00
location.reload();
}
function storageComp()
{
if (typeof(Storage) !== "undefined")
return true;
return false;
}
function getStorage(item, session)
{
if(storageComp())
{
if(session === true)
return sessionStorage.getItem(item);
else
return localStorage.getItem(item);
}
return null;
}
function setStorage(item, value, session)
{
if(storageComp())
{
if(session === true)
sessionStorage.setItem(item, value);
else
localStorage.setItem(item, value);
}
}
function removeStorage(item, session)
{
if(storageComp())
{
if(session === true)
sessionStorage.removeItem(item);
else
localStorage.removeItem(item);
}
}
function debugMessage(msg)
{
if (window.debugMessagesActive)
{
console.log(msg);
}
}
2018-12-27 23:11:32 +01:00
function updateSessions()
{
var sess = window.serverInfo.sessions;
Windows compilation support (#738) * Disable AVAHI * Replace SysInfo backport with Qt SysInfo * Update vscode config * Update LedDevices * Update Logger * Update hyperiond * Update hyperion-remote * Exclude avahi * Empty definition for Process * PythonInit path broken * Exclude PiBlaster and link ws2_32 * more avahi * resolve ui bug * Update Compile howto * JsonAPI QtGrabber missing * fix error * ssize_t replacement * Nope, doesn't work * Adjust compile description and verify winSDK * Update ci script * Update ci script * Update ci * Update ci script * update Logger * Update PythonInit * added Azure & GitHub Actions, Logger, PythonInit * resolve merge conflicts * revert ssize_t in FadeCandy * look at registry for QT5 & use find_package(Python) if cmake >= 3.12 * second try * another try * and yet another test * qt5 registry search undone * Package creation test * finished package creation. only fine tuning is required :-) Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * Dependencies for Windows finished Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * use 'add_definitions()' until CMake 3.12 Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * Update .github/workflows/pull-request.yml Co-Authored-By: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> * Update cmake/Dependencies.cmake Co-Authored-By: brindosch <edeltraud70@gmx.de> * fix typo/ add VCINSTALLDIR var * fix again * Undo change again (Not working) * fix QT grabber Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * first NSIS test Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * Update NSIS package * surprise :-) Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com> * Update NSIS package * fix: NSIS .bmps * Add nsis templates * Force windows gui app * fix: QSysInfo required Qt5.6, now it's 5.4 again * Update: Remove platform component and adjust package name * Add macOS as system name * Update docs * fix: Allow gh actions ci also for forks with branches * Add ReadMe docs, mention windows, add vscode linux debug config * fix: readme visual * reduce/hide banner/copyright/log message Infos here: https://docs.microsoft.com/de-de/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2019#switches * Fix PythonInit * vscode: Add runner task * fix(vscode): compiler path gcc ver independent * fix azure * vscode: add windows run tasks * move process detection * main: add windows process detection * Azure file shredder * Update docs Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> Co-authored-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
2020-05-12 19:51:19 +02:00
if (sess && sess.length)
2018-12-27 23:11:32 +01:00
{
window.wSess = [];
2018-12-27 23:11:32 +01:00
for(var i = 0; i<sess.length; i++)
{
if(sess[i].type == "_hyperiond-http._tcp.")
{
window.wSess.push(sess[i]);
2018-12-27 23:11:32 +01:00
}
}
if (window.wSess.length > 1)
2018-12-27 23:11:32 +01:00
$('#btn_instanceswitch').toggle(true);
else
$('#btn_instanceswitch').toggle(false);
}
}
2017-03-02 11:52:27 +01:00
function validateDuration(d)
{
if(typeof d === "undefined" || d < 0)
return 0;
2017-03-02 11:52:27 +01:00
else
return d *= 1000;
}
function getHashtag()
{
if(getStorage('lasthashtag', true) != null)
return getStorage('lasthashtag', true);
else
{
var tag = document.URL;
tag = tag.substr(tag.indexOf("#") + 1);
if(tag == "" || typeof tag === "undefined" || tag.startsWith("http"))
tag = "dashboard"
return tag;
}
}
function loadContent(event, forceRefresh)
{
var tag;
2018-12-27 23:11:32 +01:00
var lastSelectedInstance = getStorage('lastSelectedInstance', false);
if (lastSelectedInstance && (lastSelectedInstance != window.currentHyperionInstance))
add Hue EntertainmentAPI + Forwarder & other Fixes (#592) * whitespaces + typo fixes * JS / LGTM fixes * SSDP Handler crash fix * MessageForwarder handlePriorityChanges Slave fixes * use aboutToQuit Signal * complete rewriten Hue Entertainment API structure combined Philips Hue and Entertainment API with new MbedTLS based SSL UDP Provider * add required cross-compile submodules * logical rebuild fn: initLeds, setLights + new logs -more detailed checks and error handling inside iniLeds and setLights - logical script procedure before ProviderUdpSSL init - first steps for multiple ProviderUdpSSL usage - better fallback support to old RestAPI, if entertainment api is not supported - just 4 u LordGrey: new log fn for cosmetic config outputs ;) * add OSX CompileHowTo - undo from CrossCompileHowTo * whitespace fixes * lightID toString fix * fix unsigned int E-API + debug output * bugfixes, reworked black signal detection, wizard: - change device config field light-ids from int to string -> real unsigned int fix - add signal detection brightness minimum threshold value 0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection reason: input may not 100% black, like mine - i have a deep dark gray input signal -> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black - wizard optimations, with fallback without entertainment support (beta state) - whitespace fixes * cleanup + minor fixes * change fixed Hue UPD SSL config to _devConfig paras * Hotfix SSL Connection, new light models, wizard: - Fix UPD SSL Connection failed Problems - add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003 - wizard: extend fallback support to classic mode + hints * whitespace, typo fix * uncheck useEntertainmentAPI, if noAPISupport detected + hint * coredump fix -> add _blackLightsTimer nullptr init * code cleanup / remove old debugs + whitespacefixes * add gamut C LCP001, LCP002 * SSL UDP config made more flexible + remove qDebug -> switch to hyerion.ng _log -> replace logCommand with verbose -> code cleanups etc... * extended mbedtls debugging infos * add adjustable ssl timeout settings * error handling * streamdebugger bugfixes * UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix + - verbose option available without dependencies - whitespace fixes * Philips Hue Assistant now recognizes non-original bridges better... + Added note if no clientkey is set when using the entertainment API + User creation (+ clientkey) for non-original bridges can now also be used + Minor changes and bug fixes * CMAKE mbedTLS detection * minor bug fixes + code cleanups * FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true: conf_grabber don't displays other devices, if V4L2 is not available * compile mbedtls via cmake as static lib * remove libmbedtls-dev from compileHowto / scripts * Fix Windows build * Fix windows build (part 2) * removed unnecessary osx x11 include directory path * QTimer Shutdown bugfix * cmake win32 fix + minor bugfixes * cmake debug msg used mbedtls libs * Bugfix: noSignalDetection wasn't switchedOn again if no signal was previously detected * Some code fixes based on alerts from lgtm.com Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
if (typeof(window.serverInfo.instance[lastSelectedInstance].running) !== 'undefined' && window.serverInfo.instance[lastSelectedInstance].running)
instanceSwitch(lastSelectedInstance);
else
removeStorage('lastSelectedInstance', false);
if(typeof event != "undefined")
2018-12-27 23:11:32 +01:00
{
tag = event.currentTarget.hash;
tag = tag.substr(tag.indexOf("#") + 1);
setStorage('lasthashtag', tag, true);
}
else
tag = getHashtag();
if(forceRefresh || prevTag != tag)
{
prevTag = tag;
$("#page-content").off();
$("#page-content").load("/content/"+tag+".html", function(response,status,xhr){
if(status == "error")
{
$("#page-content").html('<h3>'+$.i18n('info_404')+'</h3>');
removeOverlay();
}
updateUiOnInstance(window.currentHyperionInstance);
});
}
}
function getInstanceNameByIndex(index)
{
var instData = window.serverInfo.instance
for(var key in instData)
{
if(instData[key].instance == index)
return instData[key].friendly_name;
}
return "unknown"
}
function updateHyperionInstanceListing()
{
var data = window.serverInfo.instance.filter(entry => entry.running);
$('#hyp_inst_listing').html("");
for(var key in data)
{
var currInstMarker = (data[key].instance == window.currentHyperionInstance) ? "component-on" : "";
var html = '<li id="hyperioninstance_'+data[key].instance+'"> \
<a> \
<div> \
<i class="fa fa-circle fa-fw '+currInstMarker+'"></i> \
<span>'+data[key].friendly_name+'</span> \
</div> \
</a> \
</li> '
if(data.length-1 > key)
html += '<li class="divider"></li>'
$('#hyp_inst_listing').append(html);
$('#hyperioninstance_'+data[key].instance).off().on("click",function(e){
var inst = e.currentTarget.id.split("_")[1]
instanceSwitch(inst)
});
}
}
2020-05-29 11:28:35 +02:00
function initLanguageSelection()
{
// Initialise language selection list with languages supported
for (var i = 0; i < availLang.length; i++)
{
$("#language-select").append('<option value="'+i+'" selected="">'+availLangText[i]+'</option>');
}
var langLocale = storedLang;
// If no language has been set, resolve browser locale
if ( langLocale === 'auto' )
{
langLocale = $.i18n().locale.substring(0,2);
}
// Resolve text for language code
var langText = 'Please Select';
//Test, if language is supported by hyperion
langIdx = availLang.indexOf(langLocale)
if ( langIdx > -1 )
{
langText = availLangText[langIdx];
}
else
{
// If language is not supported by hyperion, try fallback language
langLocale = $.i18n().options.fallbackLocale.substring(0,2);
langIdx = availLang.indexOf(langLocale)
if ( langIdx > -1 )
{
langText = availLangText[langIdx];
}
}
//console.log("langLocale: ", langLocale, "langText: ", langText);
2020-05-29 11:28:35 +02:00
$('#language-select').prop('title', langText);
$("#language-select").val(langIdx);
$("#language-select").selectpicker("refresh");
2020-05-29 11:28:35 +02:00
}
function updateUiOnInstance(inst)
{
if(inst != 0)
{
var currentURL = $(location).attr("href");
if(currentURL.indexOf('#conf_network') != -1 || currentURL.indexOf('#update') != -1 || currentURL.indexOf('#conf_webconfig') != -1 || currentURL.indexOf('#conf_grabber') != -1 || currentURL.indexOf('#conf_logging') != -1)
$("#hyperion_global_setting_notify").fadeIn("fast");
else
$("#hyperion_global_setting_notify").attr("style", "display:none");
$("#dashboard_active_instance_friendly_name").html($.i18n('dashboard_active_instance') + ': ' + window.serverInfo.instance[inst].friendly_name);
$("#dashboard_active_instance").removeAttr("style");
}
else
{
$("#hyperion_global_setting_notify").fadeOut("fast");
$("#dashboard_active_instance").attr("style", "display:none");
}
}
function instanceSwitch(inst)
{
requestInstanceSwitch(inst)
window.currentHyperionInstance = inst;
window.currentHyperionInstanceName = getInstanceNameByIndex(inst);
setStorage('lastSelectedInstance', inst, false)
updateHyperionInstanceListing()
}
function loadContentTo(containerId, fileName)
{
$(containerId).load("/content/"+fileName+".html");
}
function toggleClass(obj,class1,class2)
{
if ( $(obj).hasClass(class1))
{
$(obj).removeClass(class1);
$(obj).addClass(class2);
}
else
{
$(obj).removeClass(class2);
$(obj).addClass(class1);
}
}
function setClassByBool(obj,enable,class1,class2)
{
if (enable)
{
$(obj).removeClass(class1);
$(obj).addClass(class2);
}
else
{
$(obj).removeClass(class2);
$(obj).addClass(class1);
}
}
function showInfoDialog(type,header,message)
2018-12-27 23:11:32 +01:00
{
if (type=="success")
{
$('#id_body').html('<i style="margin-bottom:20px" class="fa fa-check modal-icon-check">');
if(header == "")
$('#id_body').append('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('infoDialog_general_success_title')+'</h4>');
$('#id_footer').html('<button type="button" class="btn btn-success" data-dismiss="modal">'+$.i18n('general_btn_ok')+'</button>');
}
else if (type=="warning")
{
$('#id_body').html('<i style="margin-bottom:20px" class="fa fa-warning modal-icon-warning">');
if(header == "")
$('#id_body').append('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('infoDialog_general_warning_title')+'</h4>');
$('#id_footer').html('<button type="button" class="btn btn-warning" data-dismiss="modal">'+$.i18n('general_btn_ok')+'</button>');
}
else if (type=="error")
{
$('#id_body').html('<i style="margin-bottom:20px" class="fa fa-warning modal-icon-error">');
if(header == "")
$('#id_body').append('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('infoDialog_general_error_title')+'</h4>');
$('#id_footer').html('<button type="button" class="btn btn-danger" data-dismiss="modal">'+$.i18n('general_btn_ok')+'</button>');
2018-12-27 23:11:32 +01:00
}
else if (type == "select")
{
$('#id_body').html('<img style="margin-bottom:20px" src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
$('#id_footer').html('<button type="button" id="id_btn_saveset" class="btn btn-primary" data-dismiss="modal"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_saveandreload')+'</button>');
$('#id_footer').append('<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
}
else if (type == "iswitch")
{
$('#id_body').html('<img style="margin-bottom:20px" src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
$('#id_footer').html('<button type="button" id="id_btn_saveset" class="btn btn-primary" data-dismiss="modal"><i class="fa fa-fw fa-exchange"></i>'+$.i18n('general_btn_iswitch')+'</button>');
$('#id_footer').append('<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
}
else if (type == "uilock")
{
$('#id_body').html('<img src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
$('#id_footer').html('<b>'+$.i18n('InfoDialog_nowrite_foottext')+'</b>');
}
else if (type == "import")
{
$('#id_body').html('<i style="margin-bottom:20px" class="fa fa-warning modal-icon-warning">');
$('#id_footer').html('<button type="button" id="id_btn_import" class="btn btn-warning" data-dismiss="modal"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_saverestart')+'</button>');
$('#id_footer').append('<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
}
else if (type == "delInst")
{
$('#id_body').html('<i style="margin-bottom:20px" class="fa fa-remove modal-icon-warning">');
$('#id_footer').html('<button type="button" id="id_btn_yes" class="btn btn-warning" data-dismiss="modal"><i class="fa fa-fw fa-trash"></i>'+$.i18n('general_btn_yes')+'</button>');
$('#id_footer').append('<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
}
else if (type == "renInst")
{
$('#id_body_rename').html('<i style="margin-bottom:20px" class="fa fa-pencil modal-icon-edit"><br>');
$('#id_body_rename').append('<h4>'+header+'</h4>');
$('#id_body_rename').append('<input class="form-control" id="renInst_name" type="text" value="'+message+'">');
$('#id_footer_rename').html('<button type="button" id="id_btn_ok" class="btn btn-success" data-dismiss-modal="#modal_dialog_rename" disabled><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_ok')+'</button>');
$('#id_footer_rename').append('<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
}
else if (type == "changePassword")
{
$('#id_body_rename').html('<i style="margin-bottom:20px" class="fa fa-key modal-icon-edit"><br>');
$('#id_body_rename').append('<h4>'+header+'</h4>');
$('#id_body_rename').append('<input class="form-control" id="oldPw" placeholder="Old" type="text"> <br />');
$('#id_body_rename').append('<input class="form-control" id="newPw" placeholder="New" type="text">');
$('#id_footer_rename').html('<button type="button" id="id_btn_ok" class="btn btn-success" data-dismiss-modal="#modal_dialog_rename" disabled><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_ok')+'</button>');
$('#id_footer_rename').append('<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
}
else if (type == "checklist")
{
$('#id_body').html('<img style="margin-bottom:20px" src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
$('#id_body').append('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('infoDialog_checklist_title')+'</h4>');
$('#id_body').append(header);
$('#id_footer').html('<button type="button" class="btn btn-primary" data-dismiss="modal">'+$.i18n('general_btn_ok')+'</button>');
}
else if (type == "newToken")
{
$('#id_body').html('<img style="margin-bottom:20px" src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
$('#id_footer').html('<button type="button" class="btn btn-primary" data-dismiss="modal">'+$.i18n('general_btn_ok')+'</button>');
}
else if (type == "grantToken")
{
$('#id_body').html('<img style="margin-bottom:20px" src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
$('#id_footer').html('<button type="button" class="btn btn-primary" data-dismiss="modal" id="tok_grant_acc">'+$.i18n('general_btn_grantAccess')+'</button>');
$('#id_footer').append('<button type="button" class="btn btn-danger" data-dismiss="modal" id="tok_deny_acc">'+$.i18n('general_btn_denyAccess')+'</button>');
}
2019-06-26 18:17:39 +02:00
if(type != "renInst")
{
$('#id_body').append('<h4 style="font-weight:bold;text-transform:uppercase;">'+header+'</h4>');
$('#id_body').append(message);
}
2018-12-27 23:11:32 +01:00
if(type == "select" || type == "iswitch")
$('#id_body').append('<select id="id_select" class="form-control" style="margin-top:10px;width:auto;"></select>');
2018-12-27 23:11:32 +01:00
$(type == "renInst" || type == "changePassword" ? "#modal_dialog_rename" : "#modal_dialog").modal({
backdrop : "static",
keyboard: false,
show: true
});
$(document).on('click', '[data-dismiss-modal]', function () {
var target = $(this).attr('data-dismiss-modal');
$(target).modal('hide');
});
}
function createHintH(type, text, container)
{
type = String(type);
if(type == "intro")
tclass = "introd";
2018-12-27 23:11:32 +01:00
$('#'+container).prepend('<div class="'+tclass+'"><h4 style="font-size:16px">'+text+'</h4><hr/></div>');
}
2017-04-07 21:33:40 +02:00
function createHint(type, text, container, buttonid, buttontxt)
{
var fe, tclass;
2018-12-27 23:11:32 +01:00
if(type == "intro")
{
fe = '';
tclass = "intro-hint";
}
else if(type == "info")
{
fe = '<div style="font-size:25px;text-align:center"><i class="fa fa-info"></i></div><div style="text-align:center;font-size:13px">Information</div>';
tclass = "info-hint";
}
else if(type == "wizard")
2018-12-27 23:11:32 +01:00
{
fe = '<div style="font-size:25px;text-align:center"><i class="fa fa-magic"></i></div><div style="text-align:center;font-size:13px">Information</div>';
tclass = "wizard-hint";
}
else if(type == "warning")
2018-12-27 23:11:32 +01:00
{
fe = '<div style="font-size:25px;text-align:center"><i class="fa fa-info"></i></div><div style="text-align:center;font-size:13px">Information</div>';
tclass = "warning-hint";
}
2018-12-27 23:11:32 +01:00
2017-04-07 21:33:40 +02:00
if(buttonid)
buttonid = '<p><button id="'+buttonid+'" class="btn btn-wizard" style="margin-top:15px;">'+text+'</button></p>';
else
buttonid = "";
2018-12-27 23:11:32 +01:00
2017-04-07 21:33:40 +02:00
if(type == "intro")
$('#'+container).prepend('<div class="bs-callout bs-callout-primary" style="margin-top:0px"><h4>'+$.i18n("conf_helptable_expl")+'</h4>'+text+'</div>');
else if(type == "wizard")
$('#'+container).prepend('<div class="bs-callout bs-callout-wizard" style="margin-top:0px"><h4>'+$.i18n("wiz_wizavail")+'</h4>'+$.i18n('wiz_guideyou',text)+buttonid+'</div>');
else
{
createTable('','htb',container, true, tclass);
$('#'+container+' .htb').append(createTableRow([fe ,text],false,true));
}
}
function createEffHint(title, text)
{
return '<div class="bs-callout bs-callout-primary" style="margin-top:0px"><h4>'+title+'</h4>'+text+'</div>';
}
function valValue(id,value,min,max)
{
if(typeof max === 'undefined' || max == "")
max = 999999;
2018-12-27 23:11:32 +01:00
if(Number(value) > Number(max))
{
$('#'+id).val(max);
showInfoDialog("warning","",$.i18n('edt_msg_error_maximum_incl',max));
return max;
}
else if(Number(value) < Number(min))
{
$('#'+id).val(min);
showInfoDialog("warning","",$.i18n('edt_msg_error_minimum_incl',min));
return min;
}
2018-12-27 23:11:32 +01:00
return value;
}
function readImg(input,cb)
{
if (input.files && input.files[0]) {
var reader = new FileReader();
// inject fileName property
reader.fileName = input.files[0].name
reader.onload = function (e) {
cb(e.target.result, e.target.fileName);
}
reader.readAsDataURL(input.files[0]);
}
}
function isJsonString(str)
{
try
{
JSON.parse(str);
}
catch (e)
{
return e;
}
return "";
}
function createJsonEditor(container,schema,setconfig,usePanel,arrayre)
{
$('#'+container).off();
$('#'+container).html("");
2018-12-27 23:11:32 +01:00
if (typeof arrayre === 'undefined')
arrayre = true;
2018-12-27 23:11:32 +01:00
var editor = new JSONEditor(document.getElementById(container),
{
theme: 'bootstrap3',
iconlib: "fontawesome4",
disable_collapse: 'true',
form_name_root: 'sa',
disable_edit_json: true,
disable_properties: true,
disable_array_reorder: arrayre,
no_additional_properties: true,
disable_array_delete_all_rows: true,
disable_array_delete_last_row: true,
access: storedAccess,
schema: {
title:'',
properties: schema
}
});
if(usePanel)
{
$('#'+container+' .well').first().removeClass('well well-sm');
$('#'+container+' h4').first().remove();
$('#'+container+' .well').first().removeClass('well well-sm');
}
if (setconfig)
{
for(var key in editor.root.editors)
{
editor.getEditor("root."+key).setValue( window.serverConfig[key] );
}
}
return editor;
}
2017-04-07 21:33:40 +02:00
function buildWL(link,linkt,cl)
2018-12-27 23:11:32 +01:00
{
2017-04-07 21:33:40 +02:00
var baseLink = "https://docs.hyperion-project.org/";
var lang;
2018-12-27 23:11:32 +01:00
2017-04-07 21:33:40 +02:00
if(typeof linkt == "undefined")
linkt = "Placeholder";
2018-12-27 23:11:32 +01:00
2017-04-07 21:33:40 +02:00
if(storedLang == "de" || navigator.locale == "de")
lang = "de";
else
lang = "en";
2018-12-27 23:11:32 +01:00
2017-04-07 21:33:40 +02:00
if(cl === true)
{
linkt = $.i18n(linkt);
return '<div class="bs-callout bs-callout-primary"><h4>'+linkt+'</h4>'+$.i18n('general_wiki_moreto',linkt)+': <a href="'+baseLink+lang+'/'+link+'" target="_blank">'+linkt+'<a></div>'
}
else
return ': <a href="'+baseLink+lang+'/'+link+'" target="_blank">'+linkt+'<a>';
}
function rgbToHex(rgb)
{
if(rgb.length == 3)
{
return "#" +
("0" + parseInt(rgb[0],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
2018-12-27 23:11:32 +01:00
("0" + parseInt(rgb[2],10).toString(16)).slice(-2);
}
else
debugMessage('rgbToHex: Given rgb is no array or has wrong length');
}
2017-04-07 21:33:40 +02:00
function hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
2018-12-27 23:11:32 +01:00
/*
Show a notification
@param type Valid types are "info","success","warning","danger"
@param message The message to show
@param title A title (optional)
@param addhtml Add custom html to the notification end
2018-12-27 23:11:32 +01:00
*/
function showNotification(type, message, title="", addhtml="")
2018-12-27 23:11:32 +01:00
{
if(title == "")
{
switch(type)
{
case "info":
title = $.i18n('infoDialog_general_info_title');
break;
case "success":
title = $.i18n('infoDialog_general_success_title');
break;
case "warning":
title = $.i18n('infoDialog_general_warning_title');
break;
case "danger":
title = $.i18n('infoDialog_general_error_title');
break;
}
}
$.notify({
// options
title: title,
message: message
},{
// settings
type: type,
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
},
placement:{
align:'center'
2018-12-27 23:11:32 +01:00
},
mouse_over : 'pause',
template: '<div data-notify="container" class="bg-w col-md-6 bs-callout bs-callout-{0}" role="alert">' +
2018-12-27 23:11:32 +01:00
'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
'<span data-notify="icon"></span> ' +
'<h4 data-notify="title">{1}</h4> ' +
'<span data-notify="message">{2}</span>' +
addhtml+
2018-12-27 23:11:32 +01:00
'<div class="progress" data-notify="progressbar">' +
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
'</div>' +
'<a href="{3}" target="{4}" data-notify="url"></a>' +
'</div>'
});
}
2017-04-07 21:33:40 +02:00
function createCP(id, color, cb)
{
if(Array.isArray(color))
color = rgbToHex(color);
else if(color == "undefined")
color = "#AA3399";
2018-12-27 23:11:32 +01:00
if(color.startsWith("#"))
{
$('#'+id).colorpicker({
format: 'rgb',
customClass: 'colorpicker-2x',
color: color,
sliders: {
saturation: {
maxLeft: 200,
maxTop: 200
},
hue: {
maxTop: 200
},
}
});
$('#'+id).colorpicker().on('changeColor', function(e) {
var rgb = e.color.toRGB();
var hex = e.color.toHex();
cb(rgb,hex,e);
});
}
else
debugMessage('createCP: Given color is not legit');
}
// Creates a table with thead and tbody ids
// @param string hid : a class for thead
// @param string bid : a class for tbody
// @param string cont : a container id to html() the table
// @param string bless: if true the table is borderless
function createTable(hid, bid, cont, bless, tclass)
{
var table = document.createElement('table');
var thead = document.createElement('thead');
var tbody = document.createElement('tbody');
2018-12-27 23:11:32 +01:00
table.className = "table";
if(bless === true)
table.className += " borderless";
if(typeof tclass !== "undefined")
table.className += " "+tclass;
table.style.marginBottom = "0px";
if(hid != "")
thead.className = hid;
tbody.className = bid;
if(hid != "")
table.appendChild(thead);
table.appendChild(tbody);
2018-12-27 23:11:32 +01:00
$('#'+cont).append(table);
}
// Creates a table row <tr>
// @param array list :innerHTML content for <td>/<th>
// @param bool head :if null or false it's body
2018-12-27 23:11:32 +01:00
// @param bool align :if null or false no alignment
//
// @return : <tr> with <td> or <th> as child(s)
function createTableRow(list, head, align)
{
var row = document.createElement('tr');
2018-12-27 23:11:32 +01:00
for(var i = 0; i < list.length; i++)
{
if(head === true)
var el = document.createElement('th');
else
var el = document.createElement('td');
2018-12-27 23:11:32 +01:00
if(align)
el.style.verticalAlign = "middle";
2018-12-27 23:11:32 +01:00
el.innerHTML = list[i];
row.appendChild(el);
}
return row;
}
function createRow(id)
{
var el = document.createElement('div');
el.className = "row";
el.setAttribute('id', id);
return el;
}
function createOptPanel(phicon, phead, bodyid, footerid)
{
phead = '<i class="fa '+phicon+' fa-fw"></i>'+phead;
var pfooter = document.createElement('button');
pfooter.className = "btn btn-primary";
pfooter.setAttribute("id", footerid);
pfooter.innerHTML = '<i class="fa fa-fw fa-save"></i>'+$.i18n('general_button_savesettings');
2018-12-27 23:11:32 +01:00
return createPanel(phead, "", pfooter, "panel-default", bodyid);
}
function sortProperties(list)
{
for(var key in list)
{
list[key].key = key;
}
list = $.map(list, function(value, index) {
return [value];
});
return list.sort(function(a,b) {
return a.propertyOrder - b.propertyOrder;
});
}
function createHelpTable(list, phead){
var table = document.createElement('table');
var thead = document.createElement('thead');
var tbody = document.createElement('tbody');
list = sortProperties(list);
2018-12-27 23:11:32 +01:00
phead = '<i class="fa fa-fw fa-info-circle"></i>'+phead+' '+$.i18n("conf_helptable_expl");
2018-12-27 23:11:32 +01:00
table.className = 'table table-hover borderless';
2018-12-27 23:11:32 +01:00
thead.appendChild(createTableRow([$.i18n('conf_helptable_option'), $.i18n('conf_helptable_expl')], true, false));
2018-12-27 23:11:32 +01:00
for (var key in list)
{
if(list[key].access != 'system')
{
// break one iteration (in the loop), if the schema has the entry hidden=true
if ("options" in list[key] && "hidden" in list[key].options && (list[key].options.hidden))
continue;
if ("access" in list[key] && ((list[key].access == "advanced" && storedAccess == "default") || (list[key].access == "expert" && storedAccess != "expert")))
continue;
var text = list[key].title.replace('title', 'expl');
tbody.appendChild(createTableRow([$.i18n(list[key].title), $.i18n(text)], false, false));
2018-12-27 23:11:32 +01:00
if(list[key].items && list[key].items.properties)
{
var ilist = sortProperties(list[key].items.properties);
for (var ikey in ilist)
{
// break one iteration (in the loop), if the schema has the entry hidden=true
if ("options" in ilist[ikey] && "hidden" in ilist[ikey].options && (ilist[ikey].options.hidden))
continue;
if ("access" in ilist[ikey] && ((ilist[ikey].access == "advanced" && storedAccess == "default") || (ilist[ikey].access == "expert" && storedAccess != "expert")))
continue;
var itext = ilist[ikey].title.replace('title', 'expl');
tbody.appendChild(createTableRow([$.i18n(ilist[ikey].title), $.i18n(itext)], false, false));
}
2018-12-27 23:11:32 +01:00
}
}
}
table.appendChild(thead);
table.appendChild(tbody);
return createPanel(phead, table);
}
function createPanel(head, body, footer, type, bodyid){
var cont = document.createElement('div');
var p = document.createElement('div');
var phead = document.createElement('div');
var pbody = document.createElement('div');
var pfooter = document.createElement('div');
2018-12-27 23:11:32 +01:00
cont.className = "col-lg-6";
2018-12-27 23:11:32 +01:00
if(typeof type == 'undefined')
type = 'panel-default';
2018-12-27 23:11:32 +01:00
p.className = 'panel '+type;
phead.className = 'panel-heading';
pbody.className = 'panel-body';
pfooter.className = 'panel-footer';
2018-12-27 23:11:32 +01:00
phead.innerHTML = head;
2018-12-27 23:11:32 +01:00
if(typeof bodyid != 'undefined')
{
pfooter.style.textAlign = 'right';
pbody.setAttribute("id", bodyid);
}
2018-12-27 23:11:32 +01:00
if(typeof body != 'undefined' && body != "")
pbody.appendChild(body);
2018-12-27 23:11:32 +01:00
if(typeof footer != 'undefined')
pfooter.appendChild(footer);
2018-12-27 23:11:32 +01:00
p.appendChild(phead);
p.appendChild(pbody);
2018-12-27 23:11:32 +01:00
if(typeof footer != 'undefined')
{
pfooter.style.textAlign = "right";
p.appendChild(pfooter);
}
2018-12-27 23:11:32 +01:00
cont.appendChild(p);
2018-12-27 23:11:32 +01:00
return cont;
}
function createSelGroup(group)
{
var el = document.createElement('optgroup');
el.setAttribute('label', group);
return el;
}
2018-12-27 23:11:32 +01:00
function createSelOpt(opt, title)
{
var el = document.createElement('option');
el.setAttribute('value', opt);
2018-12-27 23:11:32 +01:00
if (typeof title == 'undefined')
el.innerHTML = opt;
else
el.innerHTML = title;
return el;
}
function createSel(array, group, split)
{
if (array.length != 0)
{
var el = createSelGroup(group);
for(var i=0; i<array.length; i++)
{
var opt;
if(split)
{
opt = array[i].split(":")
opt = createSelOpt(opt[0],opt[1])
}
else
opt = createSelOpt(array[i])
el.appendChild(opt);
}
return el;
}
}
function performTranslation()
{
$('[data-i18n]').i18n();
}
function encode_utf8(s)
{
return unescape(encodeURIComponent(s));
}
2019-06-26 18:17:39 +02:00
function getReleases(callback)
{
$.ajax({
url: window.gitHubReleaseApiUrl,
method: 'get',
error: function(XMLHttpRequest, textStatus, errorThrown)
{
callback(false);
},
success: function(releases)
{
window.gitHubVersionList = releases;
var highestRelease = {
tag_name: '0.0.0'
};
var highestAlphaRelease = {
tag_name: '0.0.0'
};
var highestBetaRelease = {
tag_name: '0.0.0'
};
var highestRcRelease = {
tag_name: '0.0.0'
};
for(var i in releases) {
//drafts will be ignored
if(releases[i].draft)
continue;
2019-06-26 18:17:39 +02:00
if(releases[i].tag_name.includes('alpha'))
add Hue EntertainmentAPI + Forwarder & other Fixes (#592) * whitespaces + typo fixes * JS / LGTM fixes * SSDP Handler crash fix * MessageForwarder handlePriorityChanges Slave fixes * use aboutToQuit Signal * complete rewriten Hue Entertainment API structure combined Philips Hue and Entertainment API with new MbedTLS based SSL UDP Provider * add required cross-compile submodules * logical rebuild fn: initLeds, setLights + new logs -more detailed checks and error handling inside iniLeds and setLights - logical script procedure before ProviderUdpSSL init - first steps for multiple ProviderUdpSSL usage - better fallback support to old RestAPI, if entertainment api is not supported - just 4 u LordGrey: new log fn for cosmetic config outputs ;) * add OSX CompileHowTo - undo from CrossCompileHowTo * whitespace fixes * lightID toString fix * fix unsigned int E-API + debug output * bugfixes, reworked black signal detection, wizard: - change device config field light-ids from int to string -> real unsigned int fix - add signal detection brightness minimum threshold value 0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection reason: input may not 100% black, like mine - i have a deep dark gray input signal -> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black - wizard optimations, with fallback without entertainment support (beta state) - whitespace fixes * cleanup + minor fixes * change fixed Hue UPD SSL config to _devConfig paras * Hotfix SSL Connection, new light models, wizard: - Fix UPD SSL Connection failed Problems - add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003 - wizard: extend fallback support to classic mode + hints * whitespace, typo fix * uncheck useEntertainmentAPI, if noAPISupport detected + hint * coredump fix -> add _blackLightsTimer nullptr init * code cleanup / remove old debugs + whitespacefixes * add gamut C LCP001, LCP002 * SSL UDP config made more flexible + remove qDebug -> switch to hyerion.ng _log -> replace logCommand with verbose -> code cleanups etc... * extended mbedtls debugging infos * add adjustable ssl timeout settings * error handling * streamdebugger bugfixes * UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix + - verbose option available without dependencies - whitespace fixes * Philips Hue Assistant now recognizes non-original bridges better... + Added note if no clientkey is set when using the entertainment API + User creation (+ clientkey) for non-original bridges can now also be used + Minor changes and bug fixes * CMAKE mbedTLS detection * minor bug fixes + code cleanups * FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true: conf_grabber don't displays other devices, if V4L2 is not available * compile mbedtls via cmake as static lib * remove libmbedtls-dev from compileHowto / scripts * Fix Windows build * Fix windows build (part 2) * removed unnecessary osx x11 include directory path * QTimer Shutdown bugfix * cmake win32 fix + minor bugfixes * cmake debug msg used mbedtls libs * Bugfix: noSignalDetection wasn't switchedOn again if no signal was previously detected * Some code fixes based on alerts from lgtm.com Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
{
if (sem = semverLite.gt(releases[i].tag_name, highestAlphaRelease.tag_name))
add Hue EntertainmentAPI + Forwarder & other Fixes (#592) * whitespaces + typo fixes * JS / LGTM fixes * SSDP Handler crash fix * MessageForwarder handlePriorityChanges Slave fixes * use aboutToQuit Signal * complete rewriten Hue Entertainment API structure combined Philips Hue and Entertainment API with new MbedTLS based SSL UDP Provider * add required cross-compile submodules * logical rebuild fn: initLeds, setLights + new logs -more detailed checks and error handling inside iniLeds and setLights - logical script procedure before ProviderUdpSSL init - first steps for multiple ProviderUdpSSL usage - better fallback support to old RestAPI, if entertainment api is not supported - just 4 u LordGrey: new log fn for cosmetic config outputs ;) * add OSX CompileHowTo - undo from CrossCompileHowTo * whitespace fixes * lightID toString fix * fix unsigned int E-API + debug output * bugfixes, reworked black signal detection, wizard: - change device config field light-ids from int to string -> real unsigned int fix - add signal detection brightness minimum threshold value 0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection reason: input may not 100% black, like mine - i have a deep dark gray input signal -> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black - wizard optimations, with fallback without entertainment support (beta state) - whitespace fixes * cleanup + minor fixes * change fixed Hue UPD SSL config to _devConfig paras * Hotfix SSL Connection, new light models, wizard: - Fix UPD SSL Connection failed Problems - add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003 - wizard: extend fallback support to classic mode + hints * whitespace, typo fix * uncheck useEntertainmentAPI, if noAPISupport detected + hint * coredump fix -> add _blackLightsTimer nullptr init * code cleanup / remove old debugs + whitespacefixes * add gamut C LCP001, LCP002 * SSL UDP config made more flexible + remove qDebug -> switch to hyerion.ng _log -> replace logCommand with verbose -> code cleanups etc... * extended mbedtls debugging infos * add adjustable ssl timeout settings * error handling * streamdebugger bugfixes * UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix + - verbose option available without dependencies - whitespace fixes * Philips Hue Assistant now recognizes non-original bridges better... + Added note if no clientkey is set when using the entertainment API + User creation (+ clientkey) for non-original bridges can now also be used + Minor changes and bug fixes * CMAKE mbedTLS detection * minor bug fixes + code cleanups * FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true: conf_grabber don't displays other devices, if V4L2 is not available * compile mbedtls via cmake as static lib * remove libmbedtls-dev from compileHowto / scripts * Fix Windows build * Fix windows build (part 2) * removed unnecessary osx x11 include directory path * QTimer Shutdown bugfix * cmake win32 fix + minor bugfixes * cmake debug msg used mbedtls libs * Bugfix: noSignalDetection wasn't switchedOn again if no signal was previously detected * Some code fixes based on alerts from lgtm.com Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
highestAlphaRelease = releases[i];
2019-06-26 18:17:39 +02:00
}
else if (releases[i].tag_name.includes('beta'))
add Hue EntertainmentAPI + Forwarder & other Fixes (#592) * whitespaces + typo fixes * JS / LGTM fixes * SSDP Handler crash fix * MessageForwarder handlePriorityChanges Slave fixes * use aboutToQuit Signal * complete rewriten Hue Entertainment API structure combined Philips Hue and Entertainment API with new MbedTLS based SSL UDP Provider * add required cross-compile submodules * logical rebuild fn: initLeds, setLights + new logs -more detailed checks and error handling inside iniLeds and setLights - logical script procedure before ProviderUdpSSL init - first steps for multiple ProviderUdpSSL usage - better fallback support to old RestAPI, if entertainment api is not supported - just 4 u LordGrey: new log fn for cosmetic config outputs ;) * add OSX CompileHowTo - undo from CrossCompileHowTo * whitespace fixes * lightID toString fix * fix unsigned int E-API + debug output * bugfixes, reworked black signal detection, wizard: - change device config field light-ids from int to string -> real unsigned int fix - add signal detection brightness minimum threshold value 0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection reason: input may not 100% black, like mine - i have a deep dark gray input signal -> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black - wizard optimations, with fallback without entertainment support (beta state) - whitespace fixes * cleanup + minor fixes * change fixed Hue UPD SSL config to _devConfig paras * Hotfix SSL Connection, new light models, wizard: - Fix UPD SSL Connection failed Problems - add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003 - wizard: extend fallback support to classic mode + hints * whitespace, typo fix * uncheck useEntertainmentAPI, if noAPISupport detected + hint * coredump fix -> add _blackLightsTimer nullptr init * code cleanup / remove old debugs + whitespacefixes * add gamut C LCP001, LCP002 * SSL UDP config made more flexible + remove qDebug -> switch to hyerion.ng _log -> replace logCommand with verbose -> code cleanups etc... * extended mbedtls debugging infos * add adjustable ssl timeout settings * error handling * streamdebugger bugfixes * UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix + - verbose option available without dependencies - whitespace fixes * Philips Hue Assistant now recognizes non-original bridges better... + Added note if no clientkey is set when using the entertainment API + User creation (+ clientkey) for non-original bridges can now also be used + Minor changes and bug fixes * CMAKE mbedTLS detection * minor bug fixes + code cleanups * FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true: conf_grabber don't displays other devices, if V4L2 is not available * compile mbedtls via cmake as static lib * remove libmbedtls-dev from compileHowto / scripts * Fix Windows build * Fix windows build (part 2) * removed unnecessary osx x11 include directory path * QTimer Shutdown bugfix * cmake win32 fix + minor bugfixes * cmake debug msg used mbedtls libs * Bugfix: noSignalDetection wasn't switchedOn again if no signal was previously detected * Some code fixes based on alerts from lgtm.com Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
{
if (sem = semverLite.gt(releases[i].tag_name, highestBetaRelease.tag_name))
highestBetaRelease = releases[i];
}
else if (releases[i].tag_name.includes('rc'))
2019-06-26 18:17:39 +02:00
{
if (semverLite.gt(releases[i].tag_name, highestRcRelease.tag_name))
highestRcRelease = releases[i];
}
else
2019-06-26 18:17:39 +02:00
{
if (semverLite.gt(releases[i].tag_name, highestRelease.tag_name))
add Hue EntertainmentAPI + Forwarder & other Fixes (#592) * whitespaces + typo fixes * JS / LGTM fixes * SSDP Handler crash fix * MessageForwarder handlePriorityChanges Slave fixes * use aboutToQuit Signal * complete rewriten Hue Entertainment API structure combined Philips Hue and Entertainment API with new MbedTLS based SSL UDP Provider * add required cross-compile submodules * logical rebuild fn: initLeds, setLights + new logs -more detailed checks and error handling inside iniLeds and setLights - logical script procedure before ProviderUdpSSL init - first steps for multiple ProviderUdpSSL usage - better fallback support to old RestAPI, if entertainment api is not supported - just 4 u LordGrey: new log fn for cosmetic config outputs ;) * add OSX CompileHowTo - undo from CrossCompileHowTo * whitespace fixes * lightID toString fix * fix unsigned int E-API + debug output * bugfixes, reworked black signal detection, wizard: - change device config field light-ids from int to string -> real unsigned int fix - add signal detection brightness minimum threshold value 0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection reason: input may not 100% black, like mine - i have a deep dark gray input signal -> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black - wizard optimations, with fallback without entertainment support (beta state) - whitespace fixes * cleanup + minor fixes * change fixed Hue UPD SSL config to _devConfig paras * Hotfix SSL Connection, new light models, wizard: - Fix UPD SSL Connection failed Problems - add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003 - wizard: extend fallback support to classic mode + hints * whitespace, typo fix * uncheck useEntertainmentAPI, if noAPISupport detected + hint * coredump fix -> add _blackLightsTimer nullptr init * code cleanup / remove old debugs + whitespacefixes * add gamut C LCP001, LCP002 * SSL UDP config made more flexible + remove qDebug -> switch to hyerion.ng _log -> replace logCommand with verbose -> code cleanups etc... * extended mbedtls debugging infos * add adjustable ssl timeout settings * error handling * streamdebugger bugfixes * UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix + - verbose option available without dependencies - whitespace fixes * Philips Hue Assistant now recognizes non-original bridges better... + Added note if no clientkey is set when using the entertainment API + User creation (+ clientkey) for non-original bridges can now also be used + Minor changes and bug fixes * CMAKE mbedTLS detection * minor bug fixes + code cleanups * FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true: conf_grabber don't displays other devices, if V4L2 is not available * compile mbedtls via cmake as static lib * remove libmbedtls-dev from compileHowto / scripts * Fix Windows build * Fix windows build (part 2) * removed unnecessary osx x11 include directory path * QTimer Shutdown bugfix * cmake win32 fix + minor bugfixes * cmake debug msg used mbedtls libs * Bugfix: noSignalDetection wasn't switchedOn again if no signal was previously detected * Some code fixes based on alerts from lgtm.com Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
highestRelease = releases[i];
2019-06-26 18:17:39 +02:00
}
}
window.latestStableVersion = highestRelease;
window.latestBetaVersion = highestBetaRelease;
window.latestAlphaVersion= highestAlphaRelease;
window.latestRcVersion = highestRcRelease;
add Hue EntertainmentAPI + Forwarder & other Fixes (#592) * whitespaces + typo fixes * JS / LGTM fixes * SSDP Handler crash fix * MessageForwarder handlePriorityChanges Slave fixes * use aboutToQuit Signal * complete rewriten Hue Entertainment API structure combined Philips Hue and Entertainment API with new MbedTLS based SSL UDP Provider * add required cross-compile submodules * logical rebuild fn: initLeds, setLights + new logs -more detailed checks and error handling inside iniLeds and setLights - logical script procedure before ProviderUdpSSL init - first steps for multiple ProviderUdpSSL usage - better fallback support to old RestAPI, if entertainment api is not supported - just 4 u LordGrey: new log fn for cosmetic config outputs ;) * add OSX CompileHowTo - undo from CrossCompileHowTo * whitespace fixes * lightID toString fix * fix unsigned int E-API + debug output * bugfixes, reworked black signal detection, wizard: - change device config field light-ids from int to string -> real unsigned int fix - add signal detection brightness minimum threshold value 0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection reason: input may not 100% black, like mine - i have a deep dark gray input signal -> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black - wizard optimations, with fallback without entertainment support (beta state) - whitespace fixes * cleanup + minor fixes * change fixed Hue UPD SSL config to _devConfig paras * Hotfix SSL Connection, new light models, wizard: - Fix UPD SSL Connection failed Problems - add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003 - wizard: extend fallback support to classic mode + hints * whitespace, typo fix * uncheck useEntertainmentAPI, if noAPISupport detected + hint * coredump fix -> add _blackLightsTimer nullptr init * code cleanup / remove old debugs + whitespacefixes * add gamut C LCP001, LCP002 * SSL UDP config made more flexible + remove qDebug -> switch to hyerion.ng _log -> replace logCommand with verbose -> code cleanups etc... * extended mbedtls debugging infos * add adjustable ssl timeout settings * error handling * streamdebugger bugfixes * UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix + - verbose option available without dependencies - whitespace fixes * Philips Hue Assistant now recognizes non-original bridges better... + Added note if no clientkey is set when using the entertainment API + User creation (+ clientkey) for non-original bridges can now also be used + Minor changes and bug fixes * CMAKE mbedTLS detection * minor bug fixes + code cleanups * FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true: conf_grabber don't displays other devices, if V4L2 is not available * compile mbedtls via cmake as static lib * remove libmbedtls-dev from compileHowto / scripts * Fix Windows build * Fix windows build (part 2) * removed unnecessary osx x11 include directory path * QTimer Shutdown bugfix * cmake win32 fix + minor bugfixes * cmake debug msg used mbedtls libs * Bugfix: noSignalDetection wasn't switchedOn again if no signal was previously detected * Some code fixes based on alerts from lgtm.com Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
if(window.serverConfig.general.watchedVersionBranch == "Beta" && semverLite.gt(highestBetaRelease.tag_name, highestRelease.tag_name))
window.latestVersion = highestBetaRelease;
else
window.latestVersion = highestRelease;
if(window.serverConfig.general.watchedVersionBranch == "Alpha" && semverLite.gt(highestAlphaRelease.tag_name, highestBetaRelease.tag_name))
window.latestVersion = highestAlphaRelease;
if(window.serverConfig.general.watchedVersionBranch == "Alpha" && semverLite.lt(highestAlphaRelease.tag_name, highestBetaRelease.tag_name))
window.latestVersion = highestBetaRelease;
//next two if statements are only necessary if we don't have a beta or stable release. We need one alpha release at least
if(window.latestVersion.tag_name == '0.0.0' && highestBetaRelease.tag_name != '0.0.0')
window.latestVersion = highestBetaRelease;
if(window.latestVersion.tag_name == '0.0.0' && highestAlphaRelease.tag_name != '0.0.0')
window.latestVersion = highestAlphaRelease;
callback(true);
2019-06-26 18:17:39 +02:00
}
});
2019-06-26 18:17:39 +02:00
}
function handleDarkMode()
{
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "../css/darkMode.css"
}).appendTo("head");
setStorage("darkMode", "on", false);
$('#btn_darkmode_icon').removeClass('fa fa-moon-o');
$('#btn_darkmode_icon').addClass('fa fa-sun-o');
add Hue EntertainmentAPI + Forwarder & other Fixes (#592) * whitespaces + typo fixes * JS / LGTM fixes * SSDP Handler crash fix * MessageForwarder handlePriorityChanges Slave fixes * use aboutToQuit Signal * complete rewriten Hue Entertainment API structure combined Philips Hue and Entertainment API with new MbedTLS based SSL UDP Provider * add required cross-compile submodules * logical rebuild fn: initLeds, setLights + new logs -more detailed checks and error handling inside iniLeds and setLights - logical script procedure before ProviderUdpSSL init - first steps for multiple ProviderUdpSSL usage - better fallback support to old RestAPI, if entertainment api is not supported - just 4 u LordGrey: new log fn for cosmetic config outputs ;) * add OSX CompileHowTo - undo from CrossCompileHowTo * whitespace fixes * lightID toString fix * fix unsigned int E-API + debug output * bugfixes, reworked black signal detection, wizard: - change device config field light-ids from int to string -> real unsigned int fix - add signal detection brightness minimum threshold value 0.0 for 0% brightness - 1.0 for 100% brightness to count for blacklight signal detection reason: input may not 100% black, like mine - i have a deep dark gray input signal -> my threshold value is set to 0.005 for 0.5% minimum brightness = 1 (from max 255) to count as black - wizard optimations, with fallback without entertainment support (beta state) - whitespace fixes * cleanup + minor fixes * change fixed Hue UPD SSL config to _devConfig paras * Hotfix SSL Connection, new light models, wizard: - Fix UPD SSL Connection failed Problems - add new supported gamut C light models: LCG002, LCA001, LCA002, LCA003 - wizard: extend fallback support to classic mode + hints * whitespace, typo fix * uncheck useEntertainmentAPI, if noAPISupport detected + hint * coredump fix -> add _blackLightsTimer nullptr init * code cleanup / remove old debugs + whitespacefixes * add gamut C LCP001, LCP002 * SSL UDP config made more flexible + remove qDebug -> switch to hyerion.ng _log -> replace logCommand with verbose -> code cleanups etc... * extended mbedtls debugging infos * add adjustable ssl timeout settings * error handling * streamdebugger bugfixes * UPDSSL psk / psk_identity bugfixes! + hue wizard fn typo fix + - verbose option available without dependencies - whitespace fixes * Philips Hue Assistant now recognizes non-original bridges better... + Added note if no clientkey is set when using the entertainment API + User creation (+ clientkey) for non-original bridges can now also be used + Minor changes and bug fixes * CMAKE mbedTLS detection * minor bug fixes + code cleanups * FindMbedTLS.cmake remove Path-Hints + wizard.js: ajax timeout handling Test - content_grabber.js: run relevant code only, if V4L2_AVAIL is true: conf_grabber don't displays other devices, if V4L2 is not available * compile mbedtls via cmake as static lib * remove libmbedtls-dev from compileHowto / scripts * Fix Windows build * Fix windows build (part 2) * removed unnecessary osx x11 include directory path * QTimer Shutdown bugfix * cmake win32 fix + minor bugfixes * cmake debug msg used mbedtls libs * Bugfix: noSignalDetection wasn't switchedOn again if no signal was previously detected * Some code fixes based on alerts from lgtm.com Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-05-22 19:40:50 +02:00
}