mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge remote-tracking branch 'origin/master' into temperture
This commit is contained in:
@@ -715,7 +715,6 @@
|
||||
"edt_dev_spec_port_expl": "Service Port [1-65535]",
|
||||
"edt_dev_spec_port_title": "Port",
|
||||
"edt_dev_spec_printTimeStamp_title": "Add timestamp",
|
||||
"edt_dev_spec_skydimo_mode_title": "Skydimo Mode",
|
||||
"edt_dev_spec_stream_protocol_title": "Streaming protocol",
|
||||
"edt_dev_spec_pwmChannel_title": "PWM channel",
|
||||
"edt_dev_spec_razer_device_title": "Razer Chroma Device",
|
||||
@@ -1019,8 +1018,8 @@
|
||||
"infoDialog_import_comperror_text": "Sad! Your browser doesn't support importing. Please try again with another browser.",
|
||||
"infoDialog_import_confirm_text": "Are you sure to import \"$1\"? This process can't be reverted!",
|
||||
"infoDialog_import_confirm_title": "Confirm import",
|
||||
"infoDialog_import_hyperror_text": "The selected configuration file \"$1\" can't be imported. It's not compatible with Hyperion 2.0 and higher!",
|
||||
"infoDialog_import_jsonerror_text": "The selected configuration file \"$1\" is not a .json file, or it's corrupted. Error message: ($2)",
|
||||
"infoDialog_import_version_error_text": "The selected configuration file \"$1\" can not be imported. It's not compatible with Hyperion 2.0.17 and higher!",
|
||||
"infoDialog_wizrgb_text": "Your RGB Byte Order is already well adjusted.",
|
||||
"infoDialog_writeconf_error_text": "Saving your configuration failed.",
|
||||
"infoDialog_writeimage_error_text": "The selected file \"$1\" is not an image file, or it's corrupted! Please select another image file.",
|
||||
|
@@ -28,11 +28,6 @@ $(document).ready(function () {
|
||||
// Instance handling
|
||||
function handleInstanceRename(e) {
|
||||
|
||||
conf_editor.on('change', function () {
|
||||
window.readOnlyMode ? $('#btn_cl_save').prop('disabled', true) : $('#btn_submit').prop('disabled', false);
|
||||
window.readOnlyMode ? $('#btn_ma_save').prop('disabled', true) : $('#btn_submit').prop('disabled', false);
|
||||
});
|
||||
|
||||
var inst = e.currentTarget.id.split("_")[1];
|
||||
showInfoDialog('renInst', $.i18n('conf_general_inst_renreq_t'), getInstanceNameByIndex(inst));
|
||||
|
||||
@@ -119,14 +114,14 @@ $(document).ready(function () {
|
||||
//check file is json
|
||||
var check = isJsonString(content);
|
||||
if (check.length != 0) {
|
||||
showInfoDialog('error', "", $.i18n('infoDialog_import_jsonerror_text', f.name, JSON.stringify(check)));
|
||||
showInfoDialog('error', "", $.i18n('infoDialog_import_jsonerror_text', f.name, JSON.stringify(check.message)));
|
||||
dis_imp_btn(true);
|
||||
}
|
||||
else {
|
||||
content = JSON.parse(content);
|
||||
//check for hyperion json
|
||||
if (typeof content.leds === 'undefined' || typeof content.general === 'undefined') {
|
||||
showInfoDialog('error', "", $.i18n('infoDialog_import_hyperror_text', f.name));
|
||||
if (typeof content.global === 'undefined' || typeof content.instances === 'undefined') {
|
||||
showInfoDialog('error', "", $.i18n('infoDialog_import_version_error_text', f.name));
|
||||
dis_imp_btn(true);
|
||||
}
|
||||
else {
|
||||
@@ -143,10 +138,10 @@ $(document).ready(function () {
|
||||
$('#btn_import_conf').off().on('click', function () {
|
||||
showInfoDialog('import', $.i18n('infoDialog_import_confirm_title'), $.i18n('infoDialog_import_confirm_text', confName));
|
||||
|
||||
$('#id_btn_import').off().on('click', function () {
|
||||
$('#id_btn_import').off().on('click', function () {
|
||||
requestRestoreConfig(importedConf);
|
||||
setTimeout(initRestart, 100);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#select_import_conf').off().on('change', function (e) {
|
||||
@@ -157,18 +152,17 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
//export
|
||||
$('#btn_export_conf').off().on('click', function () {
|
||||
var name = window.serverConfig.general.name;
|
||||
$('#btn_export_conf').off().on('click', async () =>
|
||||
{
|
||||
const d = new Date();
|
||||
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(d.getDate()).padStart(2, '0');
|
||||
const timestamp = `${d.getFullYear()}-${month}-${day}`;
|
||||
|
||||
var d = new Date();
|
||||
var month = d.getMonth() + 1;
|
||||
var day = d.getDate();
|
||||
|
||||
var timestamp = d.getFullYear() + '.' +
|
||||
(month < 10 ? '0' : '') + month + '.' +
|
||||
(day < 10 ? '0' : '') + day;
|
||||
|
||||
download(JSON.stringify(window.serverConfig, null, "\t"), 'Hyperion-' + window.currentVersion + '-Backup (' + name + ') ' + timestamp + '.json', "application/json");
|
||||
const configBackup = await requestConfig();
|
||||
if (configBackup.success === true) {
|
||||
download(JSON.stringify(configBackup.info, null, "\t"), 'HyperionBackup-' + timestamp + '_v' + window.currentVersion + '.json', "application/json");
|
||||
}
|
||||
});
|
||||
|
||||
//create introduction
|
||||
@@ -180,3 +174,8 @@ $(document).ready(function () {
|
||||
|
||||
removeOverlay();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-config-restoreconfig", function (event) {
|
||||
setTimeout(initRestart, 100);
|
||||
});
|
||||
|
||||
|
@@ -128,7 +128,7 @@ $(document).ready(function () {
|
||||
requestSysInfo();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-config-getconfig", function (event) {
|
||||
$(window.hyperion).on("cmd-config-getconfig-old", function (event) {
|
||||
window.serverConfig = event.response.info;
|
||||
|
||||
window.showOptHelp = window.serverConfig.general.showOptHelp;
|
||||
@@ -278,7 +278,7 @@ $(document).ready(function () {
|
||||
window.currentHyperionInstance = 0;
|
||||
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
|
||||
|
||||
requestServerConfig();
|
||||
requestServerConfigOld();
|
||||
setTimeout(requestServerInfo, 100)
|
||||
setTimeout(requestTokenInfo, 200)
|
||||
}
|
||||
@@ -296,7 +296,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-instance-switchTo", function (event) {
|
||||
requestServerConfig();
|
||||
requestServerConfigOld();
|
||||
setTimeout(requestServerInfo, 200)
|
||||
setTimeout(requestTokenInfo, 400)
|
||||
});
|
||||
@@ -338,11 +338,6 @@ $(function () {
|
||||
});
|
||||
});
|
||||
|
||||
// hotfix body padding when bs modals overlap
|
||||
$(document.body).on('hide.bs.modal,hidden.bs.modal', function () {
|
||||
$('body').css('padding-right', '0');
|
||||
});
|
||||
|
||||
//Dark Mode
|
||||
$("#btn_darkmode").off().on("click", function (e) {
|
||||
if (getStorage("darkMode") != "on") {
|
||||
|
@@ -23,7 +23,7 @@ var devFTDI = ['apa102_ftdi', 'sk6812_ftdi', 'ws2812_ftdi'];
|
||||
var devRPiPWM = ['ws281x'];
|
||||
var devRPiGPIO = ['piblaster'];
|
||||
var devNET = ['atmoorb', 'cololight', 'fadecandy', 'homeassistant', 'philipshue', 'nanoleaf', 'razer', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udpddp', 'udph801', 'udpraw', 'wled', 'yeelight'];
|
||||
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'tpm2', 'karate'];
|
||||
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'skydimo', 'tpm2', 'karate'];
|
||||
var devHID = ['hyperionusbasp', 'lightpack', 'paintpack', 'rawhid'];
|
||||
|
||||
var infoTextDefault = '<span>' + $.i18n("conf_leds_device_info_log") + ' </span><a href="" onclick="SwitchToMenuItem(\'MenuItemLogging\')" style="cursor:pointer">' + $.i18n("main_menu_logging_token") + '</a>';
|
||||
@@ -1122,6 +1122,7 @@ $(document).ready(function () {
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
|
||||
//FTDI devices
|
||||
@@ -1231,6 +1232,7 @@ $(document).ready(function () {
|
||||
case "karate":
|
||||
case "dmx":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2": {
|
||||
let currentDeviceType = window.serverConfig.device.type;
|
||||
if ($.inArray(currentDeviceType, devSerial) === -1) {
|
||||
@@ -1462,6 +1464,7 @@ $(document).ready(function () {
|
||||
case "adalight":
|
||||
case "dmx":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
case "apa102":
|
||||
case "apa104":
|
||||
@@ -1801,6 +1804,7 @@ $(document).ready(function () {
|
||||
break;
|
||||
|
||||
case "adalight":
|
||||
case "skydimo":
|
||||
var currentLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount").getValue();
|
||||
params = Object.assign(conf_editor.getEditor("root.generalOptions").getValue(),
|
||||
conf_editor.getEditor("root.specificOptions").getValue(),
|
||||
@@ -1942,6 +1946,7 @@ function saveLedConfig(genDefLayout = false) {
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
case "apa102":
|
||||
case "apa104":
|
||||
@@ -1976,7 +1981,7 @@ function saveLedConfig(genDefLayout = false) {
|
||||
break;
|
||||
}
|
||||
|
||||
//Rewrite whole LED & Layout configuration, in case changes were done accross tabs and no default layout
|
||||
//Rewrite whole LED & Layout configuration, in case changes were done across tabs and no default layout
|
||||
if (genDefLayout !== true) {
|
||||
result.ledConfig = getLedConfig();
|
||||
result.leds = JSON.parse(aceEdt.getText());
|
||||
@@ -2105,6 +2110,7 @@ var updateOutputSelectList = function (ledType, discoveryInfo) {
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
for (const device of discoveryInfo.devices) {
|
||||
if (device.udev) {
|
||||
|
@@ -34,36 +34,29 @@ tokenList = {};
|
||||
|
||||
const ENDLESS = -1;
|
||||
|
||||
function initRestart()
|
||||
{
|
||||
function initRestart() {
|
||||
$(window.hyperion).off();
|
||||
requestServerConfigReload();
|
||||
window.watchdog = 10;
|
||||
connectionLostDetection('restart');
|
||||
}
|
||||
|
||||
function connectionLostDetection(type)
|
||||
{
|
||||
if ( window.watchdog > 2 )
|
||||
{
|
||||
var interval_id = window.setInterval(function(){clearInterval(interval_id);}, 9999); // Get a reference to the last
|
||||
function connectionLostDetection(type) {
|
||||
if (window.watchdog > 2) {
|
||||
var interval_id = window.setInterval(function () { clearInterval(interval_id); }, 9999); // Get a reference to the last
|
||||
for (var i = 1; i < interval_id; i++)
|
||||
window.clearInterval(i);
|
||||
if(type == 'restart')
|
||||
{
|
||||
if (type == 'restart') {
|
||||
$("body").html($("#container_restart").html());
|
||||
// setTimeout delay for probably slower systems, some browser don't execute THIS action
|
||||
setTimeout(restartAction,250);
|
||||
setTimeout(restartAction, 250);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$("body").html($("#container_connection_lost").html());
|
||||
connectionLostAction();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$.get( "/cgi/cfg_jsonserver", function() {window.watchdog=0}).fail(function() {window.watchdog++;});
|
||||
else {
|
||||
$.get("/cgi/cfg_jsonserver", function () { window.watchdog = 0 }).fail(function () { window.watchdog++; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,25 +64,22 @@ setInterval(connectionLostDetection, 3000);
|
||||
|
||||
// init websocket to hyperion and bind socket events to jquery events of $(hyperion) object
|
||||
|
||||
function initWebSocket()
|
||||
{
|
||||
if ("WebSocket" in window)
|
||||
{
|
||||
if (window.websocket == null)
|
||||
{
|
||||
function initWebSocket() {
|
||||
if ("WebSocket" in window) {
|
||||
if (window.websocket == null) {
|
||||
window.jsonPort = '';
|
||||
if(document.location.port == '' && document.location.protocol == "http:")
|
||||
if (document.location.port == '' && document.location.protocol == "http:")
|
||||
window.jsonPort = '80';
|
||||
else if (document.location.port == '' && document.location.protocol == "https:")
|
||||
window.jsonPort = '443';
|
||||
else
|
||||
window.jsonPort = document.location.port;
|
||||
window.websocket = (document.location.protocol == "https:") ? new WebSocket('wss://'+document.location.hostname+":"+window.jsonPort) : new WebSocket('ws://'+document.location.hostname+":"+window.jsonPort);
|
||||
window.websocket = (document.location.protocol == "https:") ? new WebSocket('wss://' + document.location.hostname + ":" + window.jsonPort) : new WebSocket('ws://' + document.location.hostname + ":" + window.jsonPort);
|
||||
|
||||
window.websocket.onopen = function (event) {
|
||||
$(window.hyperion).trigger({type:"open"});
|
||||
$(window.hyperion).trigger({ type: "open" });
|
||||
|
||||
$(window.hyperion).on("cmd-serverinfo", function(event) {
|
||||
$(window.hyperion).on("cmd-serverinfo", function (event) {
|
||||
window.watchdog = 0;
|
||||
});
|
||||
};
|
||||
@@ -97,8 +87,7 @@ function initWebSocket()
|
||||
window.websocket.onclose = function (event) {
|
||||
// See http://tools.ietf.org/html/rfc6455#section-7.4.1
|
||||
var reason;
|
||||
switch(event.code)
|
||||
{
|
||||
switch (event.code) {
|
||||
case 1000: reason = "Normal closure, meaning that the purpose for which the connection was established has been fulfilled."; break;
|
||||
case 1001: reason = "An endpoint is \"going away\", such as a server going down or a browser having navigated away from a page."; break;
|
||||
case 1002: reason = "An endpoint is terminating the connection due to a protocol error"; break;
|
||||
@@ -114,71 +103,66 @@ function initWebSocket()
|
||||
case 1015: reason = "The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."; break;
|
||||
default: reason = "Unknown reason";
|
||||
}
|
||||
$(window.hyperion).trigger({type:"close", reason:reason});
|
||||
$(window.hyperion).trigger({ type: "close", reason: reason });
|
||||
window.watchdog = 10;
|
||||
connectionLostDetection();
|
||||
};
|
||||
|
||||
window.websocket.onmessage = function (event) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
var response = JSON.parse(event.data);
|
||||
var success = response.success;
|
||||
var cmd = response.command;
|
||||
var tan = response.tan
|
||||
if (success || typeof(success) == "undefined")
|
||||
{
|
||||
$(window.hyperion).trigger({type:"cmd-"+cmd, response:response});
|
||||
if (success || typeof (success) == "undefined") {
|
||||
$(window.hyperion).trigger({ type: "cmd-" + cmd, response: response });
|
||||
}
|
||||
else
|
||||
{
|
||||
// skip tan -1 error handling
|
||||
if(tan != -1){
|
||||
var error = response.hasOwnProperty("error")? response.error : "unknown";
|
||||
if (error == "Service Unavailable") {
|
||||
window.location.reload();
|
||||
} else {
|
||||
$(window.hyperion).trigger({type:"error",reason:error});
|
||||
}
|
||||
console.log("[window.websocket::onmessage] ",error)
|
||||
else {
|
||||
// skip tan -1 error handling
|
||||
if (tan != -1) {
|
||||
var error = response.hasOwnProperty("error") ? response.error : "unknown";
|
||||
if (error == "Service Unavailable") {
|
||||
window.location.reload();
|
||||
} else {
|
||||
$(window.hyperion).trigger({ type: "error", reason: error });
|
||||
}
|
||||
let errorData = response.hasOwnProperty("errorData") ? response.errorData : "";
|
||||
console.log("[window.websocket::onmessage] ", error, ", Description:", errorData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(exception_error)
|
||||
{
|
||||
$(window.hyperion).trigger({type:"error",reason:exception_error});
|
||||
console.log("[window.websocket::onmessage] ",exception_error)
|
||||
catch (exception_error) {
|
||||
$(window.hyperion).trigger({ type: "error", reason: exception_error });
|
||||
console.log("[window.websocket::onmessage] ", exception_error)
|
||||
}
|
||||
};
|
||||
|
||||
window.websocket.onerror = function (error) {
|
||||
$(window.hyperion).trigger({type:"error",reason:error});
|
||||
console.log("[window.websocket::onerror] ",error)
|
||||
$(window.hyperion).trigger({ type: "error", reason: error });
|
||||
console.log("[window.websocket::onerror] ", error)
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$(window.hyperion).trigger("error");
|
||||
alert("Websocket is not supported by your browser");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function sendToHyperion(command, subcommand, msg)
|
||||
{
|
||||
function sendToHyperion(command, subcommand, msg) {
|
||||
if (typeof subcommand != 'undefined' && subcommand.length > 0)
|
||||
subcommand = ',"subcommand":"'+subcommand+'"';
|
||||
subcommand = ',"subcommand":"' + subcommand + '"';
|
||||
else
|
||||
subcommand = "";
|
||||
|
||||
if (typeof msg != 'undefined' && msg.length > 0)
|
||||
msg = ","+msg;
|
||||
msg = "," + msg;
|
||||
else
|
||||
msg = "";
|
||||
|
||||
window.wsTan = Math.floor(Math.random() * 1000)
|
||||
window.websocket.send('{"command":"'+command+'", "tan":'+window.wsTan+subcommand+msg+'}');
|
||||
window.wsTan = Math.floor(Math.random() * 1000)
|
||||
window.websocket.send('{"command":"' + command + '", "tan":' + window.wsTan + subcommand + msg + '}');
|
||||
}
|
||||
|
||||
// Send a json message to Hyperion and wait for a matching response
|
||||
@@ -188,9 +172,9 @@ function sendToHyperion(command, subcommand, msg)
|
||||
// data: The json data as Object
|
||||
// tan: The optional tan, default 1. If the tan is -1, we skip global response error handling
|
||||
// Returns data of response or false if timeout
|
||||
async function sendAsyncToHyperion (command, subcommand, data, tan = Math.floor(Math.random() * 1000) ) {
|
||||
async function sendAsyncToHyperion(command, subcommand, data, tan = Math.floor(Math.random() * 1000)) {
|
||||
let obj = { command, tan }
|
||||
if (subcommand) {Object.assign(obj, {subcommand})}
|
||||
if (subcommand) { Object.assign(obj, { subcommand }) }
|
||||
if (data) { Object.assign(obj, data) }
|
||||
|
||||
//if (process.env.DEV || sstore.getters['common/getDebugState']) console.log('SENDAS', obj)
|
||||
@@ -200,7 +184,7 @@ async function sendAsyncToHyperion (command, subcommand, data, tan = Math.floor(
|
||||
// Send a json message to Hyperion and wait for a matching response
|
||||
// A response matches, when command(+subcommand) of request and response is the same
|
||||
// Returns data of response or false if timeout
|
||||
async function __sendAsync (data) {
|
||||
async function __sendAsync(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let cmd = data.command
|
||||
let subc = data.subcommand
|
||||
@@ -213,7 +197,7 @@ async function __sendAsync (data) {
|
||||
try {
|
||||
rdata = JSON.parse(e.data)
|
||||
} catch (error) {
|
||||
console.error("[window.websocket::onmessage] ",error)
|
||||
console.error("[window.websocket::onmessage] ", error)
|
||||
resolve(false)
|
||||
}
|
||||
if (rdata.command == cmd && rdata.tan == tan) {
|
||||
@@ -232,274 +216,273 @@ async function __sendAsync (data) {
|
||||
// wrapped server commands
|
||||
|
||||
// Test if admin requires authentication
|
||||
function requestRequiresAdminAuth()
|
||||
{
|
||||
sendToHyperion("authorize","adminRequired");
|
||||
function requestRequiresAdminAuth() {
|
||||
sendToHyperion("authorize", "adminRequired");
|
||||
}
|
||||
// Test if the default password needs to be changed
|
||||
function requestRequiresDefaultPasswortChange()
|
||||
{
|
||||
sendToHyperion("authorize","newPasswordRequired");
|
||||
function requestRequiresDefaultPasswortChange() {
|
||||
sendToHyperion("authorize", "newPasswordRequired");
|
||||
}
|
||||
// Change password
|
||||
function requestChangePassword(oldPw, newPw)
|
||||
{
|
||||
sendToHyperion("authorize","newPassword",'"password": "'+oldPw+'", "newPassword":"'+newPw+'"');
|
||||
function requestChangePassword(oldPw, newPw) {
|
||||
sendToHyperion("authorize", "newPassword", '"password": "' + oldPw + '", "newPassword":"' + newPw + '"');
|
||||
}
|
||||
|
||||
function requestAuthorization(password)
|
||||
{
|
||||
sendToHyperion("authorize","login",'"password": "' + password + '"');
|
||||
function requestAuthorization(password) {
|
||||
sendToHyperion("authorize", "login", '"password": "' + password + '"');
|
||||
}
|
||||
|
||||
function requestTokenAuthorization(token)
|
||||
{
|
||||
sendToHyperion("authorize","login",'"token": "' + token + '"');
|
||||
function requestTokenAuthorization(token) {
|
||||
sendToHyperion("authorize", "login", '"token": "' + token + '"');
|
||||
}
|
||||
|
||||
function requestToken(comment)
|
||||
{
|
||||
sendToHyperion("authorize","createToken",'"comment": "'+comment+'"');
|
||||
function requestToken(comment) {
|
||||
sendToHyperion("authorize", "createToken", '"comment": "' + comment + '"');
|
||||
}
|
||||
|
||||
function requestTokenInfo()
|
||||
{
|
||||
sendToHyperion("authorize","getTokenList","");
|
||||
function requestTokenInfo() {
|
||||
sendToHyperion("authorize", "getTokenList", "");
|
||||
}
|
||||
|
||||
function requestGetPendingTokenRequests (id, state) {
|
||||
function requestGetPendingTokenRequests(id, state) {
|
||||
sendToHyperion("authorize", "getPendingTokenRequests", "");
|
||||
}
|
||||
|
||||
function requestHandleTokenRequest(id, state)
|
||||
{
|
||||
sendToHyperion("authorize","answerRequest",'"id":"'+id+'", "accept":'+state);
|
||||
function requestHandleTokenRequest(id, state) {
|
||||
sendToHyperion("authorize", "answerRequest", '"id":"' + id + '", "accept":' + state);
|
||||
}
|
||||
|
||||
function requestTokenDelete(id)
|
||||
{
|
||||
sendToHyperion("authorize","deleteToken",'"id":"'+id+'"');
|
||||
function requestTokenDelete(id) {
|
||||
sendToHyperion("authorize", "deleteToken", '"id":"' + id + '"');
|
||||
}
|
||||
|
||||
function requestInstanceRename(inst, name)
|
||||
{
|
||||
sendToHyperion("instance", "saveName",'"instance": '+inst+', "name": "'+name+'"');
|
||||
function requestInstanceRename(inst, name) {
|
||||
sendToHyperion("instance", "saveName", '"instance": ' + inst + ', "name": "' + name + '"');
|
||||
}
|
||||
|
||||
function requestInstanceStartStop(inst, start)
|
||||
{
|
||||
if(start)
|
||||
sendToHyperion("instance","startInstance",'"instance": '+inst);
|
||||
function requestInstanceStartStop(inst, start) {
|
||||
if (start)
|
||||
sendToHyperion("instance", "startInstance", '"instance": ' + inst);
|
||||
else
|
||||
sendToHyperion("instance","stopInstance",'"instance": '+inst);
|
||||
sendToHyperion("instance", "stopInstance", '"instance": ' + inst);
|
||||
}
|
||||
|
||||
function requestInstanceDelete(inst)
|
||||
{
|
||||
sendToHyperion("instance","deleteInstance",'"instance": '+inst);
|
||||
function requestInstanceDelete(inst) {
|
||||
sendToHyperion("instance", "deleteInstance", '"instance": ' + inst);
|
||||
}
|
||||
|
||||
function requestInstanceCreate(name)
|
||||
{
|
||||
sendToHyperion("instance","createInstance",'"name": "'+name+'"');
|
||||
function requestInstanceCreate(name) {
|
||||
sendToHyperion("instance", "createInstance", '"name": "' + name + '"');
|
||||
}
|
||||
|
||||
function requestInstanceSwitch(inst)
|
||||
{
|
||||
sendToHyperion("instance","switchTo",'"instance": '+inst);
|
||||
function requestInstanceSwitch(inst) {
|
||||
sendToHyperion("instance", "switchTo", '"instance": ' + inst);
|
||||
}
|
||||
|
||||
function requestServerInfo()
|
||||
{
|
||||
sendToHyperion("serverinfo","",'"subscribe":["components-update", "priorities-update", "imageToLedMapping-update", "adjustment-update", "videomode-update", "effects-update", "settings-update", "instance-update"]');
|
||||
function requestServerInfo() {
|
||||
sendToHyperion("serverinfo", "", '"subscribe":["components-update", "priorities-update", "imageToLedMapping-update", "adjustment-update", "videomode-update", "effects-update", "settings-update", "instance-update"]');
|
||||
}
|
||||
|
||||
function requestSysInfo()
|
||||
{
|
||||
function requestSysInfo() {
|
||||
sendToHyperion("sysinfo");
|
||||
}
|
||||
|
||||
function requestSystemSuspend()
|
||||
{
|
||||
sendToHyperion("system","suspend");
|
||||
function requestSystemSuspend() {
|
||||
sendToHyperion("system", "suspend");
|
||||
}
|
||||
|
||||
function requestSystemResume()
|
||||
{
|
||||
sendToHyperion("system","resume");
|
||||
function requestSystemResume() {
|
||||
sendToHyperion("system", "resume");
|
||||
}
|
||||
|
||||
function requestSystemRestart()
|
||||
{
|
||||
sendToHyperion("system","restart");
|
||||
function requestSystemRestart() {
|
||||
sendToHyperion("system", "restart");
|
||||
}
|
||||
|
||||
function requestServerConfigSchema()
|
||||
{
|
||||
sendToHyperion("config","getschema");
|
||||
function requestServerConfigSchema() {
|
||||
sendToHyperion("config", "getschema");
|
||||
}
|
||||
|
||||
function requestServerConfig()
|
||||
{
|
||||
function requestServerConfig() {
|
||||
sendToHyperion("config", "getconfig");
|
||||
}
|
||||
|
||||
function requestServerConfigReload()
|
||||
{
|
||||
function requestServerConfigOld() {
|
||||
sendToHyperion("config", "getconfig-old");
|
||||
}
|
||||
|
||||
function requestServerConfigReload() {
|
||||
sendToHyperion("config", "reload");
|
||||
}
|
||||
|
||||
function requestLedColorsStart()
|
||||
{
|
||||
window.ledStreamActive=true;
|
||||
function requestLedColorsStart() {
|
||||
window.ledStreamActive = true;
|
||||
sendToHyperion("ledcolors", "ledstream-start");
|
||||
}
|
||||
|
||||
function requestLedColorsStop()
|
||||
{
|
||||
window.ledStreamActive=false;
|
||||
function requestLedColorsStop() {
|
||||
window.ledStreamActive = false;
|
||||
sendToHyperion("ledcolors", "ledstream-stop");
|
||||
}
|
||||
|
||||
function requestLedImageStart()
|
||||
{
|
||||
window.imageStreamActive=true;
|
||||
function requestLedImageStart() {
|
||||
window.imageStreamActive = true;
|
||||
sendToHyperion("ledcolors", "imagestream-start");
|
||||
}
|
||||
|
||||
function requestLedImageStop()
|
||||
{
|
||||
window.imageStreamActive=false;
|
||||
function requestLedImageStop() {
|
||||
window.imageStreamActive = false;
|
||||
sendToHyperion("ledcolors", "imagestream-stop");
|
||||
}
|
||||
|
||||
function requestPriorityClear(prio)
|
||||
{
|
||||
if(typeof prio !== 'number')
|
||||
function requestPriorityClear(prio) {
|
||||
if (typeof prio !== 'number')
|
||||
prio = window.webPrio;
|
||||
|
||||
$(window.hyperion).trigger({type:"stopBrowerScreenCapture"});
|
||||
sendToHyperion("clear", "", '"priority":'+prio+'');
|
||||
$(window.hyperion).trigger({ type: "stopBrowerScreenCapture" });
|
||||
sendToHyperion("clear", "", '"priority":' + prio + '');
|
||||
}
|
||||
|
||||
function requestClearAll()
|
||||
{
|
||||
$(window.hyperion).trigger({type:"stopBrowerScreenCapture"});
|
||||
function requestClearAll() {
|
||||
$(window.hyperion).trigger({ type: "stopBrowerScreenCapture" });
|
||||
requestPriorityClear(-1)
|
||||
}
|
||||
|
||||
function requestPlayEffect(effectName, duration)
|
||||
{
|
||||
$(window.hyperion).trigger({type:"stopBrowerScreenCapture"});
|
||||
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'"},"priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
|
||||
function requestPlayEffect(effectName, duration) {
|
||||
$(window.hyperion).trigger({ type: "stopBrowerScreenCapture" });
|
||||
sendToHyperion("effect", "", '"effect":{"name":"' + effectName + '"},"priority":' + window.webPrio + ',"duration":' + validateDuration(duration) + ',"origin":"' + window.webOrigin + '"');
|
||||
}
|
||||
|
||||
function requestSetColor(r,g,b,duration)
|
||||
{
|
||||
$(window.hyperion).trigger({type:"stopBrowerScreenCapture"});
|
||||
sendToHyperion("color", "", '"color":['+r+','+g+','+b+'], "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+',"origin":"'+window.webOrigin+'"');
|
||||
function requestSetColor(r, g, b, duration) {
|
||||
$(window.hyperion).trigger({ type: "stopBrowerScreenCapture" });
|
||||
sendToHyperion("color", "", '"color":[' + r + ',' + g + ',' + b + '], "priority":' + window.webPrio + ',"duration":' + validateDuration(duration) + ',"origin":"' + window.webOrigin + '"');
|
||||
}
|
||||
|
||||
function requestSetImage(data,duration,name)
|
||||
{
|
||||
sendToHyperion("image", "", '"imagedata":"'+data+'", "priority":'+window.webPrio+',"duration":'+validateDuration(duration)+', "format":"auto", "origin":"'+window.webOrigin+'", "name":"'+name+'"');
|
||||
function requestSetImage(data, duration, name) {
|
||||
sendToHyperion("image", "", '"imagedata":"' + data + '", "priority":' + window.webPrio + ',"duration":' + validateDuration(duration) + ', "format":"auto", "origin":"' + window.webOrigin + '", "name":"' + name + '"');
|
||||
}
|
||||
|
||||
function requestSetComponentState(comp, state)
|
||||
{
|
||||
function requestSetComponentState(comp, state) {
|
||||
var state_str = state ? "true" : "false";
|
||||
sendToHyperion("componentstate", "", '"componentstate":{"component":"'+comp+'","state":'+state_str+'}');
|
||||
sendToHyperion("componentstate", "", '"componentstate":{"component":"' + comp + '","state":' + state_str + '}');
|
||||
}
|
||||
|
||||
function requestSetSource(prio)
|
||||
{
|
||||
if ( prio == "auto" )
|
||||
function requestSetSource(prio) {
|
||||
if (prio == "auto")
|
||||
sendToHyperion("sourceselect", "", '"auto":true');
|
||||
else
|
||||
sendToHyperion("sourceselect", "", '"priority":'+prio);
|
||||
sendToHyperion("sourceselect", "", '"priority":' + prio);
|
||||
}
|
||||
|
||||
function requestWriteConfig(config, full)
|
||||
{
|
||||
if(full === true)
|
||||
window.serverConfig = config;
|
||||
else
|
||||
{
|
||||
jQuery.each(config, function(i, val) {
|
||||
window.serverConfig[i] = val;
|
||||
});
|
||||
// Function to transform the legacy config into thee new API format
|
||||
function transformConfig(configInput, instanceId = 0) {
|
||||
const globalConfig = {};
|
||||
const instanceSettings = {};
|
||||
|
||||
// Populate globalConfig and instanceSettings based on the specified properties
|
||||
for (const [key, value] of Object.entries(configInput)) {
|
||||
if (window.schema.propertiesTypes.globalProperties.includes(key)) {
|
||||
globalConfig[key] = value;
|
||||
} else if (window.schema.propertiesTypes.instanceProperties.includes(key)) {
|
||||
instanceSettings[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
sendToHyperion("config","setconfig", '"config":'+JSON.stringify(window.serverConfig));
|
||||
// Initialize the final transformed configuration
|
||||
const transformedConfig = {};
|
||||
|
||||
// Add `global` only if it has properties
|
||||
if (Object.keys(globalConfig).length > 0) {
|
||||
transformedConfig.global = { settings: globalConfig };
|
||||
}
|
||||
|
||||
// Add `instance` only if there are instance settings
|
||||
if (Object.keys(instanceSettings).length > 0) {
|
||||
transformedConfig.instances = [
|
||||
{
|
||||
id: instanceId,
|
||||
settings: instanceSettings
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
return transformedConfig;
|
||||
}
|
||||
|
||||
function requestWriteConfig(singleInstanceConfig, full) {
|
||||
let newConfig = "";
|
||||
const instance = Number(window.currentHyperionInstance);
|
||||
|
||||
if (full === true) {
|
||||
window.serverConfig = singleInstanceConfig;
|
||||
newConfig = transformConfig(window.serverConfig, instance);
|
||||
}
|
||||
else {
|
||||
jQuery.each(singleInstanceConfig, function (i, val) {
|
||||
window.serverConfig[i] = val;
|
||||
});
|
||||
newConfig = transformConfig(singleInstanceConfig, instance);
|
||||
}
|
||||
|
||||
sendToHyperion("config", "setconfig", '"config":' + JSON.stringify(newConfig));
|
||||
}
|
||||
|
||||
function requestRestoreConfig(config) {
|
||||
sendToHyperion("config", "restoreconfig", '"config":' + JSON.stringify(config));
|
||||
}
|
||||
|
||||
function requestWriteEffect(effectName,effectPy,effectArgs,data)
|
||||
{
|
||||
function requestWriteEffect(effectName, effectPy, effectArgs, data) {
|
||||
var cutArgs = effectArgs.slice(1, -1);
|
||||
sendToHyperion("create-effect", "", '"name":"'+effectName+'", "script":"'+effectPy+'", '+cutArgs+',"imageData":"'+data+'"');
|
||||
sendToHyperion("create-effect", "", '"name":"' + effectName + '", "script":"' + effectPy + '", ' + cutArgs + ',"imageData":"' + data + '"');
|
||||
}
|
||||
|
||||
function requestTestEffect(effectName,effectPy,effectArgs,data)
|
||||
{
|
||||
sendToHyperion("effect", "", '"effect":{"name":"'+effectName+'", "args":'+effectArgs+'}, "priority":'+window.webPrio+', "origin":"'+window.webOrigin+'", "pythonScript":"'+effectPy+'", "imageData":"'+data+'"');
|
||||
function requestTestEffect(effectName, effectPy, effectArgs, data) {
|
||||
sendToHyperion("effect", "", '"effect":{"name":"' + effectName + '", "args":' + effectArgs + '}, "priority":' + window.webPrio + ', "origin":"' + window.webOrigin + '", "pythonScript":"' + effectPy + '", "imageData":"' + data + '"');
|
||||
}
|
||||
|
||||
function requestDeleteEffect(effectName)
|
||||
{
|
||||
sendToHyperion("delete-effect", "", '"name":"'+effectName+'"');
|
||||
function requestDeleteEffect(effectName) {
|
||||
sendToHyperion("delete-effect", "", '"name":"' + effectName + '"');
|
||||
}
|
||||
|
||||
function requestLoggingStart()
|
||||
{
|
||||
window.loggingStreamActive=true;
|
||||
function requestLoggingStart() {
|
||||
window.loggingStreamActive = true;
|
||||
sendToHyperion("logging", "start");
|
||||
}
|
||||
|
||||
function requestLoggingStop()
|
||||
{
|
||||
window.loggingStreamActive=false;
|
||||
function requestLoggingStop() {
|
||||
window.loggingStreamActive = false;
|
||||
sendToHyperion("logging", "stop");
|
||||
}
|
||||
|
||||
function requestMappingType(type)
|
||||
{
|
||||
sendToHyperion("processing", "", '"mappingType": "'+type+'"');
|
||||
function requestMappingType(type) {
|
||||
sendToHyperion("processing", "", '"mappingType": "' + type + '"');
|
||||
}
|
||||
|
||||
function requestVideoMode(newMode)
|
||||
{
|
||||
sendToHyperion("videomode", "", '"videoMode": "'+newMode+'"');
|
||||
function requestVideoMode(newMode) {
|
||||
sendToHyperion("videomode", "", '"videoMode": "' + newMode + '"');
|
||||
}
|
||||
|
||||
function requestAdjustment(type, value, complete)
|
||||
{
|
||||
if(complete === true)
|
||||
sendToHyperion("adjustment", "", '"adjustment": '+type+'');
|
||||
function requestAdjustment(type, value, complete) {
|
||||
if (complete === true)
|
||||
sendToHyperion("adjustment", "", '"adjustment": ' + type + '');
|
||||
else
|
||||
sendToHyperion("adjustment", "", '"adjustment": {"'+type+'": '+value+'}');
|
||||
sendToHyperion("adjustment", "", '"adjustment": {"' + type + '": ' + value + '}');
|
||||
}
|
||||
|
||||
async function requestLedDeviceDiscovery(type, params)
|
||||
{
|
||||
async function requestLedDeviceDiscovery(type, params) {
|
||||
let data = { ledDeviceType: type, params: params };
|
||||
|
||||
return sendAsyncToHyperion("leddevice", "discover", data);
|
||||
}
|
||||
|
||||
async function requestLedDeviceProperties(type, params)
|
||||
{
|
||||
async function requestLedDeviceProperties(type, params) {
|
||||
let data = { ledDeviceType: type, params: params };
|
||||
|
||||
return sendAsyncToHyperion("leddevice", "getProperties", data);
|
||||
}
|
||||
|
||||
function requestLedDeviceIdentification(type, params)
|
||||
{
|
||||
let data = { ledDeviceType: type, params: params };
|
||||
function requestLedDeviceIdentification(type, params) {
|
||||
let data = { ledDeviceType: type, params: params };
|
||||
|
||||
return sendAsyncToHyperion("leddevice", "identify", data);
|
||||
}
|
||||
@@ -522,3 +505,12 @@ async function requestServiceDiscovery(type, params) {
|
||||
return sendAsyncToHyperion("service", "discover", data);
|
||||
}
|
||||
|
||||
async function requestConfig(globalTypes, instances, instanceTypes) {
|
||||
let globalFilter = { "global": { "types": globalTypes } };
|
||||
let instanceFilter = { "instances": { "ids": instances, "types": instanceTypes } };
|
||||
let filter = { "configFilter": { globalFilter, instanceFilter } };
|
||||
|
||||
return sendAsyncToHyperion("config", "getconfig", filter);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -129,7 +129,7 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
// apply new serverinfos
|
||||
$(window.hyperion).on("cmd-config-getconfig", function (event) {
|
||||
$(window.hyperion).on("cmd-config-getconfig-old", function (event) {
|
||||
leds = event.response.info.leds;
|
||||
grabberConfig = event.response.info.grabberV4L2;
|
||||
updateLedLayout();
|
||||
|
@@ -239,7 +239,7 @@ function showInfoDialog(type, header, message) {
|
||||
$('#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>');
|
||||
$('#id_footer').html('<button type="button" class="btn btn-danger" data-dismiss-modal="#modal_dialog">' + $.i18n('general_btn_ok') + '</button>');
|
||||
}
|
||||
else if (type == "select") {
|
||||
$('#id_body').html('<img style="margin-bottom:20px" id="id_logo" src="img/hyperion/logo_positiv.png" alt="Redefine ambient light!">');
|
||||
@@ -256,9 +256,9 @@ function showInfoDialog(type, header, message) {
|
||||
$('#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>');
|
||||
$('#id_body').html('<i style="margin-bottom:20px" class="fa fa-warning modal-icon-warning"></i>');
|
||||
$('#id_footer').html('<button type="button" id="id_btn_import" class="btn btn-warning"><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="#modal_dialog"><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">');
|
||||
@@ -1222,7 +1222,7 @@ function getSystemInfo() {
|
||||
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 += '- Config database: ' + shy.configDatabaseFile + '\n';
|
||||
info += '- Database: ' + (shy.readOnlyMode ? "ready-only" : "read/write") + '\n';
|
||||
info += '- Mode: ' + (shy.isGuiMode ? "GUI" : "Non-GUI") + '\n';
|
||||
|
||||
|
Reference in New Issue
Block a user