mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
refactor: API split (#721)
* refactor: API split * refactor: cleanup hyperiond
This commit is contained in:
@@ -49,6 +49,8 @@
|
||||
"general_btn_next": "Weiter",
|
||||
"general_btn_back": "Zurück",
|
||||
"general_btn_iswitch": "Switch",
|
||||
"general_btn_grantAccess": "Zugriff gewähren",
|
||||
"general_btn_denyAccess": "Zugriff ablehnen",
|
||||
"general_chars_needed": "weitere Zeichen benötigt",
|
||||
"general_wiki_moreto": "Mehr Informationen zu \"$1\" findest du in unserem Wiki",
|
||||
"dashboard_label_intro": "Das Dashboard zeigt dir Informationen zum Systemstatus, ob Updates verfügbar sind, den Komponentenstatus sowie die letzten Blog-Posts vom Hyperion Team.",
|
||||
@@ -203,6 +205,8 @@
|
||||
"conf_network_tok_diaTitle" : "Neues Token erstellt!",
|
||||
"conf_network_tok_diaMsg" : "Hier ist dein neues Token, welches für den Zugriff auf die Hyperion API verwendet werden kann. Aus Sicherheitsgründen können Tokens nach der Erstellung nur einmalig eingesehen werden, notiere es dir daher jetzt.",
|
||||
"conf_network_tok_intro" : "Hier kannst du Token zur API Authentifizierung erstellen oder löschen. Neu erstellte Token werden einmalig angezeigt.",
|
||||
"conf_network_tok_grantT": "App Token angefordert",
|
||||
"conf_network_tok_grantMsg": "Eine App fordert Zugriff auf die Hyperion API durch ein Token. Möchtest du dies zulassen? Bitte überprüfe die angegebenen Informationen!",
|
||||
"conf_logging_label_intro": "Überprüfe die Meldungen im Prokotoll um zu erfahren was Hyperion gerade beschäftigt. Je nach eingestellter Protokoll-Stufe siehst du mehr oder weniger Informationen.",
|
||||
"conf_logging_btn_pbupload": "Bericht für Supportanfrage hochladen",
|
||||
"conf_logging_btn_autoscroll": "Automatisch scrollen",
|
||||
|
@@ -48,6 +48,8 @@
|
||||
"general_btn_next" : "Next",
|
||||
"general_btn_back" : "Back",
|
||||
"general_btn_iswitch" : "Switch",
|
||||
"general_btn_grantAccess": "Grant Access",
|
||||
"general_btn_denyAccess": "Deny Access",
|
||||
"general_chars_needed": "more characters needed",
|
||||
"general_wiki_moreto" : "More information about \"$1\" is available at our",
|
||||
"dashboard_label_intro" : "This dashboard gives you a quick overview of your Hyperion installation and shows you the latest news from the Hyperion Blog.",
|
||||
@@ -202,6 +204,8 @@
|
||||
"conf_network_tok_diaTitle" : "New Token created!",
|
||||
"conf_network_tok_diaMsg" : "Here is your new token which can be used to grant an application access to the Hyperion API. For security reasons you can't view it again so use/note it down.",
|
||||
"conf_network_tok_intro" : "Here you can create and delete tokens for API authentication. Created tokens will only be displayed once.",
|
||||
"conf_network_tok_grantT": "App Requests Token",
|
||||
"conf_network_tok_grantMsg": "An App requested a token to get access to the Hyperion API. Do you want to grant access? Please verify the provided information!",
|
||||
"conf_logging_label_intro" : "Area to check log messages, you will see more or less information depending on the set logging level .",
|
||||
"conf_logging_btn_pbupload" : "Upload a report for support requests",
|
||||
"conf_logging_btn_autoscroll" : "Auto scrolling",
|
||||
|
@@ -1,22 +1,21 @@
|
||||
var instNameInit = false
|
||||
|
||||
$(document).ready( function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
loadContentTo("#container_connection_lost","connection_lost");
|
||||
loadContentTo("#container_restart","restart");
|
||||
loadContentTo("#container_connection_lost", "connection_lost");
|
||||
loadContentTo("#container_restart", "restart");
|
||||
initWebSocket();
|
||||
|
||||
$(window.hyperion).on("cmd-serverinfo",function(event){
|
||||
$(window.hyperion).on("cmd-serverinfo", function (event) {
|
||||
window.serverInfo = event.response.info;
|
||||
// comps
|
||||
window.comps = event.response.info.components
|
||||
window.comps = event.response.info.components
|
||||
|
||||
$(window.hyperion).trigger("ready");
|
||||
|
||||
window.comps.forEach( function(obj) {
|
||||
if (obj.name == "ALL")
|
||||
{
|
||||
if(obj.enabled)
|
||||
window.comps.forEach(function (obj) {
|
||||
if (obj.name == "ALL") {
|
||||
if (obj.enabled)
|
||||
$("#hyperion_disabled_notify").fadeOut("fast");
|
||||
else
|
||||
$("#hyperion_disabled_notify").fadeIn("fast");
|
||||
@@ -25,14 +24,13 @@ $(document).ready( function() {
|
||||
|
||||
// determine button visibility
|
||||
var running = window.serverInfo.instance.filter(entry => entry.running);
|
||||
if(running.length > 1)
|
||||
if (running.length > 1)
|
||||
$('#btn_hypinstanceswitch').toggle(true)
|
||||
else
|
||||
$('#btn_hypinstanceswitch').toggle(false)
|
||||
// update listing at button
|
||||
updateHyperionInstanceListing()
|
||||
if(!instNameInit)
|
||||
{
|
||||
if (!instNameInit) {
|
||||
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
|
||||
instNameInit = true;
|
||||
}
|
||||
@@ -40,17 +38,40 @@ $(document).ready( function() {
|
||||
updateSessions();
|
||||
}); // end cmd-serverinfo
|
||||
|
||||
$(window.hyperion).on("cmd-sessions-update", function(event) {
|
||||
$(window.hyperion).on("cmd-sessions-update", function (event) {
|
||||
window.serverInfo.sessions = event.response.data;
|
||||
updateSessions();
|
||||
});
|
||||
|
||||
$(window.hyperion).one("cmd-authorize-getTokenList", function(event) {
|
||||
$(window.hyperion).on("cmd-authorize-tokenRequest cmd-authorize-getPendingTokenRequests", function (event) {
|
||||
var val = event.response.info;
|
||||
if (Array.isArray(event.response.info)) {
|
||||
if (event.response.info.length == 0) {
|
||||
return
|
||||
}
|
||||
val = event.response.info[0]
|
||||
if (val.comment == '')
|
||||
$('#modal_dialog').modal('hide');
|
||||
}
|
||||
|
||||
showInfoDialog("grantToken", $.i18n('conf_network_tok_grantT'), $.i18n('conf_network_tok_grantMsg') + '<br><span style="font-weight:bold">App: ' + val.comment + '</span><br><span style="font-weight:bold">Code: ' + val.id + '</span>')
|
||||
$("#tok_grant_acc").off().on('click', function () {
|
||||
tokenList.push(val)
|
||||
// forward event, in case we need to rebuild the list now
|
||||
$(window.hyperion).trigger({ type: "build-token-list" });
|
||||
requestHandleTokenRequest(val.id, true)
|
||||
});
|
||||
$("#tok_deny_acc").off().on('click', function () {
|
||||
requestHandleTokenRequest(val.id, false)
|
||||
});
|
||||
});
|
||||
|
||||
$(window.hyperion).one("cmd-authorize-getTokenList", function (event) {
|
||||
tokenList = event.response.info;
|
||||
requestServerInfo();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-sysinfo", function(event) {
|
||||
$(window.hyperion).on("cmd-sysinfo", function (event) {
|
||||
requestServerInfo();
|
||||
window.sysInfo = event.response.info;
|
||||
|
||||
@@ -58,33 +79,34 @@ $(document).ready( function() {
|
||||
window.currentChannel = window.sysInfo.hyperion.channel;
|
||||
});
|
||||
|
||||
$(window.hyperion).one("cmd-config-getschema", function(event) {
|
||||
$(window.hyperion).one("cmd-config-getschema", function (event) {
|
||||
window.serverSchema = event.response.info;
|
||||
requestServerConfig();
|
||||
requestTokenInfo();
|
||||
requestTokenInfo();
|
||||
requestGetPendingTokenRequests();
|
||||
|
||||
window.schema = window.serverSchema.properties;
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-config-getconfig", function(event) {
|
||||
$(window.hyperion).on("cmd-config-getconfig", function (event) {
|
||||
window.serverConfig = event.response.info;
|
||||
requestSysInfo();
|
||||
|
||||
window.showOptHelp = window.serverConfig.general.showOptHelp;
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-config-setconfig", function(event) {
|
||||
if (event.response.success === true) {
|
||||
$(window.hyperion).on("cmd-config-setconfig", function (event) {
|
||||
if (event.response.success === true) {
|
||||
showNotification('success', $.i18n('dashboard_alert_message_confsave_success'), $.i18n('dashboard_alert_message_confsave_success_t'))
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-authorize-login", function(event) {
|
||||
$(window.hyperion).on("cmd-authorize-login", function (event) {
|
||||
$("#main-nav").removeAttr('style')
|
||||
$("#top-navbar").removeAttr('style')
|
||||
|
||||
if(window.defaultPasswordIsSet === true)
|
||||
showNotification('warning', $.i18n('dashboard_message_default_password'), $.i18n('dashboard_message_default_password_t'), '<a style="cursor:pointer" onClick="changePassword()"> '+$.i18n('InfoDialog_changePassword_title')+'</a>')
|
||||
if (window.defaultPasswordIsSet === true)
|
||||
showNotification('warning', $.i18n('dashboard_message_default_password'), $.i18n('dashboard_message_default_password_t'), '<a style="cursor:pointer" onClick="changePassword()"> ' + $.i18n('InfoDialog_changePassword_title') + '</a>')
|
||||
else
|
||||
//if logged on and pw != default show option to lock ui
|
||||
$("#btn_lock_ui").removeAttr('style')
|
||||
@@ -96,32 +118,30 @@ $(document).ready( function() {
|
||||
requestServerConfigSchema();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-authorize-newPassword", function(event) {
|
||||
if (event.response.success === true){
|
||||
showInfoDialog("success",$.i18n('InfoDialog_changePassword_success'));
|
||||
$(window.hyperion).on("cmd-authorize-newPassword", function (event) {
|
||||
if (event.response.success === true) {
|
||||
showInfoDialog("success", $.i18n('InfoDialog_changePassword_success'));
|
||||
// not necessarily true, but better than nothing
|
||||
window.defaultPasswordIsSet = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-authorize-newPasswordRequired", function(event) {
|
||||
$(window.hyperion).on("cmd-authorize-newPasswordRequired", function (event) {
|
||||
var loginToken = getStorage("loginToken", true)
|
||||
|
||||
if (event.response.info.newPasswordRequired == true)
|
||||
{
|
||||
if (event.response.info.newPasswordRequired == true) {
|
||||
window.defaultPasswordIsSet = true;
|
||||
|
||||
if(loginToken)
|
||||
if (loginToken)
|
||||
requestTokenAuthorization(loginToken)
|
||||
else
|
||||
requestAuthorization('hyperion');
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$("#main-nav").attr('style', 'display:none')
|
||||
$("#top-navbar").attr('style', 'display:none')
|
||||
|
||||
if(loginToken)
|
||||
if (loginToken)
|
||||
requestTokenAuthorization(loginToken)
|
||||
else
|
||||
loadContentTo("#page-content", "login")
|
||||
@@ -129,7 +149,7 @@ $(document).ready( function() {
|
||||
}
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-authorize-adminRequired", function(event) {
|
||||
$(window.hyperion).on("cmd-authorize-adminRequired", function (event) {
|
||||
//Check if a admin login is required.
|
||||
//If yes: check if default pw is set. If no: go ahead to get server config and render page
|
||||
if (event.response.info.adminRequired === true)
|
||||
@@ -138,50 +158,47 @@ $(document).ready( function() {
|
||||
requestServerConfigSchema();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("error",function(event){
|
||||
$(window.hyperion).on("error", function (event) {
|
||||
//If we are getting an error "No Authorization" back with a set loginToken we will forward to new Login (Token is expired.
|
||||
//e.g.: hyperiond was started new in the meantime)
|
||||
if (event.reason == "No Authorization" && getStorage("loginToken", true))
|
||||
{
|
||||
if (event.reason == "No Authorization" && getStorage("loginToken", true)) {
|
||||
removeStorage("loginToken", true);
|
||||
requestRequiresAdminAuth();
|
||||
}
|
||||
else
|
||||
{
|
||||
showInfoDialog("error","Error", event.reason);
|
||||
else {
|
||||
showInfoDialog("error", "Error", event.reason);
|
||||
}
|
||||
});
|
||||
|
||||
$(window.hyperion).on("open",function(event){
|
||||
$(window.hyperion).on("open", function (event) {
|
||||
requestRequiresAdminAuth();
|
||||
});
|
||||
|
||||
$(window.hyperion).one("ready", function(event) {
|
||||
$(window.hyperion).one("ready", function (event) {
|
||||
loadContent();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-adjustment-update", function(event) {
|
||||
$(window.hyperion).on("cmd-adjustment-update", function (event) {
|
||||
window.serverInfo.adjustment = event.response.data
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-videomode-update", function(event) {
|
||||
$(window.hyperion).on("cmd-videomode-update", function (event) {
|
||||
window.serverInfo.videomode = event.response.data.videomode
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-components-update", function(event) {
|
||||
$(window.hyperion).on("cmd-components-update", function (event) {
|
||||
let obj = event.response.data
|
||||
|
||||
// notfication in index
|
||||
if (obj.name == "ALL")
|
||||
{
|
||||
if(obj.enabled)
|
||||
if (obj.name == "ALL") {
|
||||
if (obj.enabled)
|
||||
$("#hyperion_disabled_notify").fadeOut("fast");
|
||||
else
|
||||
$("#hyperion_disabled_notify").fadeIn("fast");
|
||||
}
|
||||
|
||||
window.comps.forEach((entry, index) => {
|
||||
if (entry.name === obj.name){
|
||||
if (entry.name === obj.name) {
|
||||
window.comps[index] = obj;
|
||||
}
|
||||
});
|
||||
@@ -189,7 +206,7 @@ $(document).ready( function() {
|
||||
$(window.hyperion).trigger("components-updated");
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-instance-update", function(event) {
|
||||
$(window.hyperion).on("cmd-instance-update", function (event) {
|
||||
window.serverInfo.instance = event.response.data
|
||||
var avail = event.response.data;
|
||||
// notify the update
|
||||
@@ -197,16 +214,13 @@ $(document).ready( function() {
|
||||
|
||||
// if our current instance is no longer available we are at instance 0 again.
|
||||
var isInData = false;
|
||||
for(var key in avail)
|
||||
{
|
||||
if(avail[key].instance == currentHyperionInstance && avail[key].running)
|
||||
{
|
||||
for (var key in avail) {
|
||||
if (avail[key].instance == currentHyperionInstance && avail[key].running) {
|
||||
isInData = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isInData)
|
||||
{
|
||||
if (!isInData) {
|
||||
//Delete Storage information about the last used but now stopped instance
|
||||
if (getStorage('lastSelectedInstance', false))
|
||||
removeStorage('lastSelectedInstance', false)
|
||||
@@ -214,14 +228,14 @@ $(document).ready( function() {
|
||||
currentHyperionInstance = 0;
|
||||
currentHyperionInstanceName = getInstanceNameByIndex(0);
|
||||
requestServerConfig();
|
||||
setTimeout(requestServerInfo,100)
|
||||
setTimeout(requestTokenInfo,200)
|
||||
setTimeout(loadContent,300, undefined, true)
|
||||
setTimeout(requestServerInfo, 100)
|
||||
setTimeout(requestTokenInfo, 200)
|
||||
setTimeout(loadContent, 300, undefined, true)
|
||||
}
|
||||
|
||||
// determine button visibility
|
||||
var running = serverInfo.instance.filter(entry => entry.running);
|
||||
if(running.length > 1)
|
||||
if (running.length > 1)
|
||||
$('#btn_hypinstanceswitch').toggle(true)
|
||||
else
|
||||
$('#btn_hypinstanceswitch').toggle(false)
|
||||
@@ -230,27 +244,27 @@ $(document).ready( function() {
|
||||
updateHyperionInstanceListing()
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-instance-switchTo", function(event){
|
||||
$(window.hyperion).on("cmd-instance-switchTo", function (event) {
|
||||
requestServerConfig();
|
||||
setTimeout(requestServerInfo,200)
|
||||
setTimeout(requestTokenInfo,400)
|
||||
setTimeout(loadContent,400, undefined, true)
|
||||
setTimeout(requestServerInfo, 200)
|
||||
setTimeout(requestTokenInfo, 400)
|
||||
setTimeout(loadContent, 400, undefined, true)
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-effects-update", function(event){
|
||||
$(window.hyperion).on("cmd-effects-update", function (event) {
|
||||
window.serverInfo.effects = event.response.data.effects
|
||||
});
|
||||
|
||||
$(".mnava").bind('click.menu', function(e){
|
||||
$(".mnava").bind('click.menu', function (e) {
|
||||
loadContent(e);
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$(function () {
|
||||
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance
|
||||
sidebar.delegate('a.inactive','click',function(){
|
||||
sidebar.delegate('a.inactive', 'click', function () {
|
||||
sidebar.find('.active').toggleClass('active inactive');
|
||||
$(this).toggleClass('active inactive');
|
||||
});
|
||||
@@ -258,5 +272,5 @@ $(function(){
|
||||
|
||||
// hotfix body padding when bs modals overlap
|
||||
$(document.body).on('hide.bs.modal,hidden.bs.modal', function () {
|
||||
$('body').css('padding-right','0');
|
||||
$('body').css('padding-right', '0');
|
||||
});
|
||||
|
@@ -204,6 +204,10 @@ function requestTokenInfo()
|
||||
sendToHyperion("authorize","getTokenList","");
|
||||
}
|
||||
|
||||
function requestGetPendingTokenRequests (id, state) {
|
||||
sendToHyperion("authorize", "getPendingTokenRequests", "");
|
||||
}
|
||||
|
||||
function requestHandleTokenRequest(id, state)
|
||||
{
|
||||
sendToHyperion("authorize","answerRequest",'"id":"'+id+'", "accept":'+state);
|
||||
|
Reference in New Issue
Block a user