mirror of
https://gitlab.com/Shinobi-Systems/ShinobiCE.git
synced 2025-03-09 15:40:15 +00:00
Blue Turtle - The Refactoring
This commit is contained in:
parent
04011678fb
commit
b7d08eb500
67 changed files with 11651 additions and 8452 deletions
|
@ -14,6 +14,7 @@
|
|||
<link href="<%-originalURL%>libs/css/main.dash2.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/pnotify.custom.min.css">
|
||||
<link href="<%-originalURL%>libs/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
|
||||
<link href="<%-originalURL%>libs/css/super-page.css" rel="stylesheet" />
|
||||
<script src="<%-originalURL%>libs/js/jquery.min.js"></script>
|
||||
<script src="<%-originalURL%>libs/js/jquery.serialize.js"></script>
|
||||
<script src="<%-originalURL%>libs/js/pnotify.custom.min.js"></script>
|
||||
|
@ -31,7 +32,7 @@
|
|||
<nav id="main-nav" class="navbar navbar-expand-lg bg-primary fixed-top" color-on-scroll="400">
|
||||
<div class="container">
|
||||
<div class="navbar-translate">
|
||||
<a tabindex="1" class="navbar-brand logout" href="/" data-placement="bottom" target="_blank">
|
||||
<a tabindex="1" class="navbar-brand logout" style="outline:0" href="/" data-placement="bottom">
|
||||
<%-lang.superAdminTitle%>
|
||||
</a>
|
||||
<button class="navbar-toggler navbar-toggler" type="button" data-toggle="collapse" data-target="#navigation" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
|
||||
|
@ -69,6 +70,9 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#system" role="tab">Controls and Logs</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#changeSuperPreferences" role="tab">Preferences</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body">
|
||||
<!-- Tab panes -->
|
||||
|
@ -96,15 +100,10 @@
|
|||
<div class="collapse navbar-collapse">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link add" href="javascript:$.conf.e.submit()">
|
||||
<a class="nav-link submit">
|
||||
<p><i class="fa fa-check"></i> <%-lang.Save%></p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link add" href="javascript:$.conf.e.submit()">
|
||||
<p class="msg"></p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -117,7 +116,7 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane" id="system" role="tabpanel">
|
||||
<div class="tab-pane text-left" id="system" role="tabpanel">
|
||||
<nav class="navbar navbar-rounded navbar-expand-lg bg-primary">
|
||||
<div class="container">
|
||||
<div class="collapse navbar-collapse">
|
||||
|
@ -157,6 +156,9 @@
|
|||
<table class="table table-striped"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane text-left" id="changeSuperPreferences" role="tabpanel">
|
||||
<% include blocks/changeSuperPreferences.ejs %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -209,26 +211,33 @@ switch($user.lang){
|
|||
$.ccio.ws=io(location.origin);
|
||||
$.ccio.cx=function(x){return $.ccio.ws.emit('super',x)}
|
||||
$.ccio.ws.on('connect',function(d){
|
||||
$.ccio.cx({f:'init',mail:$user.mail,pass:$user.pass});
|
||||
$.ccio.cx({f:'init',mail:$user.mail,pass:$user.pass})
|
||||
})
|
||||
$.ccio.ws.on('f',function(d){
|
||||
switch(d.f){
|
||||
case'init_success':
|
||||
$user.sessionKey = d.superSessionKey
|
||||
break;
|
||||
case'log':
|
||||
$.ccio.tm(4,d.log,'#logs table')
|
||||
break;
|
||||
case'save_configuration':
|
||||
d.msg = 'Saved, Restart Shinobi to apply changes.'
|
||||
break;
|
||||
case'save_preferences':
|
||||
d.msg = 'Saved Preferences'
|
||||
break;
|
||||
case'edit_account':
|
||||
d.msg='Account Edited';
|
||||
$.each(d.form,function(n,v){
|
||||
$.ccio.accounts[d.ke][n]=v;
|
||||
});
|
||||
$.ccio.accounts[d.ke][n]=v
|
||||
})
|
||||
$('[ke="'+d.ke+'"] .mail').text(d.form.mail)
|
||||
break;
|
||||
case'add_account':
|
||||
d.msg='Account Created';
|
||||
$.ccio.tm(0,d,'#accounts table')
|
||||
$.aN.selected=$.ccio.accounts[d.ke];
|
||||
$.aN.selected = $.ccio.accounts[d.ke]
|
||||
break;
|
||||
case'delete_account':
|
||||
$('#accounts table tr[ke="'+d.ke+'"]').remove()
|
||||
|
@ -328,10 +337,10 @@ $.logs={e:$('#logs')}
|
|||
var stringedConfig = JSON.stringify(plainConfig)
|
||||
%>
|
||||
var config = <%- JSON.stringify(plainConfig) || [] %>
|
||||
$.conf={e:$('#conf_json')};
|
||||
$.conf={e:$('#config')};
|
||||
$.conf.f = $.conf.e.find('form')
|
||||
$.conf.configForHumans=$('#configForHumans')
|
||||
$.conf.draw=$.conf.e.find('[name="json"]')
|
||||
$.conf.msg=$.conf.e.find('.msg')
|
||||
$.conf.valid=1;
|
||||
$.conf.jsonToFields = function(){
|
||||
// var tmp = ''
|
||||
|
@ -358,7 +367,10 @@ $.conf.draw.keyup(function(){
|
|||
}
|
||||
new PNotify({text:msg,type:color})
|
||||
})
|
||||
$.conf.e.submit(function(e){
|
||||
$.conf.e.find('.submit').click(function(e){
|
||||
$.conf.f.submit()
|
||||
})
|
||||
$.conf.f.submit(function(e){
|
||||
e.preventDefault()
|
||||
if($.conf.valid===1){
|
||||
$.confirm.e.modal('show');
|
||||
|
@ -367,7 +379,12 @@ $.conf.e.submit(function(e){
|
|||
e.html+='<pre>'+JSON.stringify($.parseJSON($.conf.draw.val()),null,3)+'</pre>'
|
||||
$.confirm.body.html(e.html)
|
||||
$.confirm.click({title:'Save',class:'btn-success'},function(){
|
||||
$.ccio.cx({f:'system',ff:'configure',data:$.parseJSON($.conf.draw.val())})
|
||||
$.post('<%=originalURL%><%=config.webPaths.superApiPrefix%>'+$user.sessionKey+'/system/configure',{
|
||||
data: $.conf.draw.val()
|
||||
},function(data){
|
||||
// console.log(data)
|
||||
})
|
||||
// $.ccio.cx({f:'system',ff:'configure',data:$.parseJSON($.conf.draw.val())})
|
||||
});
|
||||
}else{
|
||||
new PNotify({text:'Invalid JSON Syntax, Cannot Save.',type:'error'})
|
||||
|
@ -418,7 +435,7 @@ $.conf.e.on('keyup','.config-row input',function(){
|
|||
$.conf.draw.val(JSON.stringify(newConfig,null,3))
|
||||
console.log(newConfig)
|
||||
})
|
||||
$.conf.e.ready(function(){
|
||||
$.conf.f.ready(function(){
|
||||
$.conf.jsonToFields()
|
||||
})
|
||||
//sys controls
|
||||
|
@ -431,7 +448,10 @@ $.system.e.find('[system]').click(function(e){
|
|||
e.html='Do you want to delete these logs? User logs will <b>not</b> be deleted.'
|
||||
$.confirm.body.html(e.html)
|
||||
$.confirm.click({title:'Delete',class:'btn-danger'},function(){
|
||||
$.ccio.cx({f:'logs',ff:'delete',ke:'$'})
|
||||
// $.ccio.cx({f:'logs',ff:'delete',ke:'$'})
|
||||
$.get('<%=originalURL%><%=config.webPaths.superApiPrefix%>'+$user.sessionKey+'/logs/delete',function(data){
|
||||
console.log(data)
|
||||
})
|
||||
$.logs.e.find('table').empty()
|
||||
});
|
||||
break;
|
||||
|
@ -440,8 +460,11 @@ $.system.e.find('[system]').click(function(e){
|
|||
$.confirm.title.html('Update Shinobi?')
|
||||
$.confirm.body.html('Updating Shinobi means overwriting files. If you have modified any files yourself you should update Shinobi manually.')
|
||||
$.confirm.click({title:'Update',class:'btn-danger'},function(){
|
||||
$.ccio.cx({f:'system',ff:'update'})
|
||||
});
|
||||
// $.ccio.cx({f:'system',ff:'update'})
|
||||
$.get('<%=originalURL%><%=config.webPaths.superApiPrefix%>'+$user.sessionKey+'/system/update',function(data){
|
||||
console.log(data)
|
||||
})
|
||||
})
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
@ -466,9 +489,31 @@ $.system.e.find('[restart]').click(function(e){
|
|||
$.confirm.title.html('Restart?')
|
||||
$.confirm.body.html(e.html)
|
||||
$.confirm.click({title:'Restart',class:'btn-danger'},function(){
|
||||
$.ccio.cx({f:'system',ff:'restart',target:e.target})
|
||||
// $.ccio.cx({f:'system',ff:'restart',target:e.target})
|
||||
$.get('<%=originalURL%><%=config.webPaths.superApiPrefix%>'+$user.sessionKey+'/system/restart/'+encodeURIComponent(e.target),function(data){
|
||||
console.log(data)
|
||||
})
|
||||
});
|
||||
})
|
||||
$.changeSuperPreferences = {
|
||||
window : $('#changeSuperPreferences')
|
||||
}
|
||||
$.changeSuperPreferences.form = $.changeSuperPreferences.window.find('form')
|
||||
$.changeSuperPreferences.form.find('.submit').click(function(){
|
||||
$.changeSuperPreferences.form.submit()
|
||||
})
|
||||
$.changeSuperPreferences.form.submit(function(e){
|
||||
e.preventDefault()
|
||||
var formValues = $(this).serializeObject()
|
||||
// $.ccio.cx({f:'accounts',ff:'saveSuper',form:formValues})
|
||||
$.post('<%=originalURL%><%=config.webPaths.superApiPrefix%>'+$user.sessionKey+'/accounts/saveSettings',{
|
||||
data: JSON.stringify(formValues)
|
||||
},function(data){
|
||||
console.log(data)
|
||||
})
|
||||
return false
|
||||
})
|
||||
////
|
||||
$(document).ready(function(){
|
||||
$.each(<%-JSON.stringify(Logs)%>,function(n,v){
|
||||
$.ccio.tm(4,v,'#logs table')
|
||||
|
@ -478,7 +523,7 @@ $(document).ready(function(){
|
|||
$('body')
|
||||
.on('click','.logout',function(e){
|
||||
localStorage.removeItem('ShinobiLogin_'+location.host);location.href='/';
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<% include blocks/mainpermissions.ejs %>
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue