542 lines
16 KiB
HTML
542 lines
16 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Required meta tags -->
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
<title>INSTALLER TOOL</title>
|
|
<!-- Bootstrap CSS -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
|
|
<!-- Custom styles for this template -->
|
|
<link href="installer.css?t=5" rel="stylesheet">
|
|
</head>
|
|
<body id="manage" class="text-center">
|
|
<div class="container-fluid">
|
|
<div class="col-md-12">
|
|
|
|
<h1>Found deployed environment</h1>
|
|
|
|
<div style="text-align:left;float:left;width:33%">
|
|
<a href="javascript:void()" id="vpn_btn">VPN</a>
|
|
Status:
|
|
<span id="vpn_on" class="hidden green"><b>ON</b></span>
|
|
<span id="vpn_off" class="hidden red"><b>OFF</b></span>
|
|
</div>
|
|
<div style="text-align:center;float:left;width:34%">
|
|
<a href="manage.html" id="refresh_btn">REFRESH</a>
|
|
</div>
|
|
<div style="text-align:right;float:right">
|
|
<a href="javascript:void()" id="settings_btn">SETTINGS</a>
|
|
</div>
|
|
<div style="float:none;clear:both"/>
|
|
|
|
<div id="vpn" class="hidden">
|
|
<fieldset>
|
|
<legend>Enable proxy</legend>
|
|
<form class="form-install" action="#" method="post" id="save_vpn">
|
|
<div class="row">
|
|
<div class="mb-3">
|
|
<label for="vpn_domain">Please add domain url to download the VPN hash from (default: https://portal.safebox.network):</label>
|
|
<input type="text" class="form-control" name="VPN_DOMAIN" id="vpn_domain" value="https://portal.safebox.network">
|
|
<div class="invalid-feedback">
|
|
Please enter a valid domain.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="mb-3">
|
|
<label for="vpn_pass">Please type in the generated VPN passkey (8 digits):</label>
|
|
<input type="text" class="form-control" name="VPN_PASS" id="vpn_pass" value="" maxlength="8" size="10">
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="mb-3">
|
|
<label for="letsencrypt_mail">Please add the letsencrypt mail address:</label>
|
|
<input type="email" class="form-control" name="LETSENCRYPT_MAIL" id="letsencrypt_mail" value="">
|
|
<div class="invalid-feedback">
|
|
Please enter a valid email.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="mb-3">
|
|
<label for="letsencrypt_servername">Please add letsencrypt server name (default is letsencrypt but you can add zerossl too):</label>
|
|
<input type="text" class="form-control" name="LETSENCRYPT_SERVERNAME" id="letsencrypt_servername" value="letsencrypt">
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="mb-3">
|
|
<button class="btn btn-lg btn-primary btn-block" type="submit" id="vpn_save_btn"> Save </button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</fieldset>
|
|
<br>
|
|
</div>
|
|
|
|
<div id="settings" class="hidden">
|
|
<fieldset>
|
|
<legend>Repositories</legend>
|
|
<div id="repositories" style="text-align:left">Loading...</div>
|
|
|
|
<hr>
|
|
<form class="form-install" action="#" method="post" id="add_repo">
|
|
<div class="row">
|
|
<div class="mb-3" style="text-align:left">
|
|
<label for="registry">Please add a new GIT repository URL: </label>
|
|
<input type="registry" class="form-control" name="repository" id="repository" size="100" value="" required>
|
|
<div class="invalid-feedback">
|
|
Please enter a valid repository url.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="mb-3">
|
|
<button class="btn btn-lg btn-primary btn-block" type="submit" id="repo_add_btn"> Add </button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</fieldset>
|
|
|
|
<fieldset>
|
|
<legend>System services</legend>
|
|
<div id="system" style="text-align:left">Loading...</div>
|
|
</fieldset>
|
|
|
|
<fieldset>
|
|
<legend>Updates</legend>
|
|
<div id="updates" style="text-align:left">
|
|
<a href="javascript:void()" id="update_btn">Search updates</a>
|
|
</div>
|
|
</fieldset>
|
|
<br>
|
|
</div>
|
|
|
|
<div id="default">
|
|
|
|
<fieldset>
|
|
<legend><a href="javascript:void()" id="deployments_btn">Deployments</a></legend>
|
|
<div id="deployments" style="text-align:left">Loading...</div>
|
|
</fieldset>
|
|
|
|
<fieldset>
|
|
<legend><a href="javascript:void()" id="services_btn">Services</a></legend>
|
|
<div id="services" style="text-align:left;display:none;">Loading...</div>
|
|
</fieldset>
|
|
|
|
<fieldset>
|
|
<legend>Disk management</legend>
|
|
</fieldset>
|
|
|
|
<fieldset>
|
|
<legend>Monitor</legend>
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<br>
|
|
<br>
|
|
<!-- Optional JavaScript -->
|
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
|
|
<script>
|
|
|
|
function check_deployments() {
|
|
var url = 'scan.php?op=check_deployments';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_deployments: '+data);
|
|
if (data=="WAIT" || data=="") {
|
|
setTimeout(check_deployments, 1000);
|
|
}
|
|
else jQuery("#deployments").html(data);
|
|
});
|
|
}
|
|
|
|
function get_deployments() {
|
|
var url = 'scan.php?op=deployments';
|
|
jQuery.get(url, function(data) {
|
|
console.log('deployments: '+data);
|
|
if (data=="OK") {
|
|
setTimeout(check_deployments, 1000);
|
|
}
|
|
else jQuery("#deployments").html(data);
|
|
});
|
|
}
|
|
|
|
function check_system() {
|
|
var url = 'scan.php?op=check_system&services=1';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_system: '+data);
|
|
if (data=="WAIT" || data=="") {
|
|
setTimeout(check_system, 1000);
|
|
}
|
|
else {
|
|
jQuery("#system").html(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
function get_system() {
|
|
var url = 'scan.php?op=system';
|
|
jQuery.get(url, function(data) {
|
|
console.log('system: '+data);
|
|
if (data=="OK") {
|
|
setTimeout(check_system, 1000);
|
|
}
|
|
else alert(data);
|
|
});
|
|
}
|
|
|
|
function check_repositories() {
|
|
var url = 'scan.php?op=check_repositories';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_repositories: '+data);
|
|
if (data=="WAIT" || data=="") {
|
|
setTimeout(check_repositories, 500);
|
|
}
|
|
else {
|
|
jQuery("#repositories").html(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
function get_repositories() {
|
|
var url = 'scan.php?op=repositories';
|
|
jQuery.get(url, function(data) {
|
|
console.log('repositories: '+data);
|
|
if (data=="OK") {
|
|
setTimeout(check_repositories, 500);
|
|
get_deployments();
|
|
}
|
|
else alert(data);
|
|
});
|
|
}
|
|
|
|
function add_repository() {
|
|
var url = 'scan.php?op=add_repository&repo='+jQuery('#repository').val();
|
|
jQuery.get(url, function(data) {
|
|
console.log('add_repository: '+data);
|
|
if (data=="OK") {
|
|
}
|
|
get_repositories();
|
|
});
|
|
}
|
|
|
|
function check_vpn() {
|
|
var url = 'scan.php?op=check_vpn';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_vpn: '+data);
|
|
if (data=="2") {
|
|
$('#vpn_off').hide();
|
|
$('#vpn_on').show();
|
|
}
|
|
else {
|
|
$('#vpn_on').hide();
|
|
$('#vpn_off').show();
|
|
}
|
|
setTimeout(check_vpn, 10000);
|
|
});
|
|
}
|
|
|
|
function save_vpn() {
|
|
var url = 'scan.php?op=save_vpn&vpn_domain='+jQuery('#vpn_domain').val()+'&vpn_pass='+jQuery('#vpn_pass').val()+'&letsencrypt_mail='+jQuery('#letsencrypt_mail').val()+'&letsencrypt_servername='+jQuery('#letsencrypt_servername').val();
|
|
|
|
jQuery.get(url, function(data) {
|
|
console.log('save_vpn: '+data);
|
|
if (data=="OK") {
|
|
}
|
|
//get_vpn();
|
|
});
|
|
}
|
|
|
|
function check_updates() {
|
|
var url = 'scan.php?op=check_updates';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_updates: '+data);
|
|
if (data=="WAIT" || data=="") {
|
|
setTimeout(check_updates, 1000);
|
|
}
|
|
else {
|
|
jQuery("#updates").html(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
function get_updates() {
|
|
var url = 'scan.php?op=updates';
|
|
jQuery.get(url, function(data) {
|
|
console.log('updates: '+data);
|
|
if (data=="OK") {
|
|
setTimeout(check_updates, 1000);
|
|
}
|
|
});
|
|
}
|
|
|
|
function load_template(additional) {
|
|
|
|
jQuery("div.deployment").each(function(index) {
|
|
$(this).html('');
|
|
});
|
|
jQuery("#"+additional).html('Loading '+additional+' template...');
|
|
var url = 'scan.php?op=deployment&additional='+additional;
|
|
jQuery.get(url, function(data) {
|
|
console.log('load_template: '+data);
|
|
if (data=="OK") {
|
|
setTimeout(check_deployment, 1000, additional);
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_reinstall(additional) {
|
|
var url = 'scan.php?op=check_reinstall';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_reinstall: '+data);
|
|
if (data!="") {
|
|
jQuery("#"+additional).html(data);
|
|
}
|
|
else setTimeout(check_reinstall, 1000, additional);
|
|
});
|
|
}
|
|
|
|
function reinstall(additional) {
|
|
jQuery("div.deployment").each(function(index) {
|
|
$(this).html('');
|
|
});
|
|
jQuery("#"+additional).html('Loading '+additional+' template...');
|
|
var url = 'scan.php?op=reinstall&additional='+additional;
|
|
jQuery.get(url, function(data) {
|
|
console.log('reinstall '+additional+': '+data);
|
|
if (data=="OK") {
|
|
setTimeout(check_reinstall, 1000, additional);
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_uninstall(additional) {
|
|
var url = 'scan.php?op=check_uninstall&additional='+additional;
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_uninstall '+additional+': '+data);
|
|
if (data!="") {
|
|
jQuery("#"+additional).html(data);
|
|
}
|
|
if (data!="OK") {
|
|
setTimeout(check_uninstall, 1000, additional);
|
|
}
|
|
else {
|
|
jQuery("#"+additional).html('Uninstall has finished');
|
|
get_deployments();
|
|
}
|
|
});
|
|
}
|
|
|
|
function uninstall(additional) {
|
|
|
|
jQuery("div.deployment").each(function(index) {
|
|
$(this).html('');
|
|
});
|
|
data = '<fieldset><form action="#" method="post"><div class="row">YOU ARE GOING TO UNINSTALL '+additional.toUpperCase()+'.<br>ARE YOU SURE? IF YES, PLEASE CLICK ON THE BUTTON BELOW.<br><br></div><div class="row"><div class="mb-3"><button class="btn btn-lg btn-primary btn-block" type="button" onclick="confirm_uninstall(\''+additional+'\')">Uninstall</button></div></div></form></fieldset>';
|
|
jQuery("#"+additional).html(data);
|
|
}
|
|
|
|
function confirm_uninstall(additional) {
|
|
jQuery("#"+additional).html('Loading...');
|
|
var url = 'scan.php?op=uninstall&additional='+additional;
|
|
jQuery.get(url, function(data) {
|
|
console.log('uninstall '+additional+': '+data);
|
|
if (data!="") {
|
|
jQuery("#"+additional).html(data);
|
|
setTimeout(check_uninstall, 1000, additional);
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_deployment(additional) {
|
|
var url = 'scan.php?op=check_deployment&additional='+additional;
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_deployment '+additional);
|
|
//console.log('check_deployment data: '+data);
|
|
if (data!="") {
|
|
jQuery("#"+additional).html(data);
|
|
}
|
|
else setTimeout(check_deployment, 1000, additional);
|
|
});
|
|
}
|
|
|
|
function deploy(additional) {
|
|
pars = '';
|
|
jQuery('input.additional_'+additional).each(function(index) {
|
|
console.log('Field ' + $(this).attr('name') + ': ' + $(this).val());
|
|
//pars += '&'+$(this).attr('id') + '=' + $(this).val();
|
|
pars += '&'+$(this).attr('name') + '=' + $(this).val();
|
|
});
|
|
//console.log(pars);
|
|
var url = 'scan.php?op=deploy&additional='+additional+pars;
|
|
jQuery.get(url, function(data) {
|
|
console.log('deploy '+additional+': '+data);
|
|
if (data!="") {
|
|
jQuery("#"+additional).html(data);
|
|
setTimeout(check_deployment, 1000, additional);
|
|
}
|
|
});
|
|
}
|
|
|
|
function redeploy(additional) {
|
|
pars = '';
|
|
jQuery('input.additional_'+additional).each(function(index) {
|
|
console.log('Field ' + $(this).attr('name') + ': ' + $(this).val());
|
|
//pars += '&'+$(this).attr('id') + '=' + $(this).val();
|
|
pars += '&'+$(this).attr('name') + '=' + $(this).val();
|
|
});
|
|
//console.log(pars);
|
|
var url = 'scan.php?op=redeploy&additional='+additional+pars;
|
|
jQuery.get(url, function(data) {
|
|
console.log('redeploy '+additional+': '+data);
|
|
if (data!="") {
|
|
jQuery("#"+additional).html(data);
|
|
setTimeout(check_deployment, 1000, additional);
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_services() {
|
|
var url = 'scan.php?op=check_services';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_services: '+data);
|
|
if (data=="WAIT" || data=="") {
|
|
setTimeout(check_services, 1000);
|
|
}
|
|
else {
|
|
jQuery("#services").html(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
function get_services() {
|
|
var url = 'scan.php?op=services';
|
|
jQuery.get(url, function(data) {
|
|
console.log('services: '+data);
|
|
setTimeout(check_services, 1000);
|
|
});
|
|
}
|
|
|
|
function check_containers() {
|
|
var url = 'scan.php?op=check_containers';
|
|
jQuery.get(url, function(data) {
|
|
console.log('check_containers: '+data);
|
|
if (data!="") {
|
|
jQuery("#containers").html(data);
|
|
}
|
|
else setTimeout(check_containers, 1000);
|
|
});
|
|
}
|
|
|
|
function get_containers() {
|
|
var url = 'scan.php?op=containers';
|
|
jQuery.get(url, function(data) {
|
|
console.log('containers: '+data);
|
|
if (data=="OK") {
|
|
setTimeout(check_containers, 1000);
|
|
}
|
|
});
|
|
}
|
|
|
|
jQuery(document).ready(function(){
|
|
|
|
get_repositories();
|
|
get_system();
|
|
get_services();
|
|
check_vpn();
|
|
|
|
jQuery('#deployments_btn').click(function() {
|
|
jQuery('#services').hide();
|
|
jQuery('#deployments').toggle();
|
|
});
|
|
|
|
jQuery('#services_btn').click(function() {
|
|
jQuery('#deployments').hide();
|
|
jQuery('#services').toggle();
|
|
});
|
|
|
|
jQuery('#settings_btn').click(function() {
|
|
jQuery('#settings').toggle();
|
|
jQuery('#default').toggle();
|
|
jQuery('#vpn').hide();
|
|
});
|
|
|
|
jQuery('#vpn_btn').click(function() {
|
|
jQuery('#vpn').toggle();
|
|
jQuery('#settings').hide();
|
|
});
|
|
|
|
jQuery('#update_btn').click(function() {
|
|
jQuery('#updates').html('Looking for updates... Please wait...');
|
|
get_updates();
|
|
});
|
|
|
|
jQuery('#add_repo').submit(function() {
|
|
jQuery('#repositories').html('Loading...');
|
|
add_repository();
|
|
return false;
|
|
});
|
|
|
|
jQuery('#save_vpn').submit(function() {
|
|
save_vpn();
|
|
jQuery('#vpn').html('Loading...');
|
|
return false;
|
|
});
|
|
|
|
jQuery('select#smarthost').click(function() {
|
|
if (jQuery(this).val()=='yes') jQuery('#div_smarthost').show();
|
|
else jQuery('#div_smarthost').hide();
|
|
|
|
if (jQuery("#smarthost").val()=='no' && jQuery("#localproxy").val()=='yes') {
|
|
alert("Warning! Local proxy will not work without smarthost proxy service.");
|
|
}
|
|
});
|
|
jQuery('select#vpn').click(function() {
|
|
if (jQuery(this).val()=='yes') jQuery('#div_vpn').show();
|
|
else jQuery('#div_vpn').hide();
|
|
});
|
|
/*
|
|
jQuery('select#discovery').click(function() {
|
|
if (jQuery(this).val()=='yes') jQuery('#div_discover').show();
|
|
else jQuery('#div_discover').hide();
|
|
});
|
|
jQuery('select#additionals').click(function() {
|
|
if (jQuery(this).val()=='yes') jQuery('#div_additionals').show();
|
|
else jQuery('#div_additionals').hide();
|
|
});
|
|
jQuery('select#nextcloud').click(function() {
|
|
if (jQuery(this).val()=='Y') jQuery('#div_nextcloud').show();
|
|
else jQuery('#div_nextcloud').hide();
|
|
});
|
|
jQuery('select#bitwarden').click(function() {
|
|
if (jQuery(this).val()=='Y') jQuery('#div_bitwarden').show();
|
|
else jQuery('#div_bitwarden').hide();
|
|
});
|
|
jQuery('select#bitwarden_smtp').click(function() {
|
|
if (jQuery(this).val()=='3') jQuery('#div_bitwarden_smtp').show();
|
|
else jQuery('#div_bitwarden_smtp').hide();
|
|
});
|
|
jQuery('select#guacamole').click(function() {
|
|
if (jQuery(this).val()=='Y') jQuery('#div_guacamole').show();
|
|
else jQuery('#div_guacamole').hide();
|
|
});
|
|
jQuery('select#smtp_server').click(function() {
|
|
if (jQuery(this).val()=='Y') jQuery('#div_smtp_server').show();
|
|
else jQuery('#div_smtp_server').hide();
|
|
});
|
|
jQuery('select#roundcube').click(function() {
|
|
if (jQuery(this).val()=='Y') jQuery('#div_roundcube').show();
|
|
else jQuery('#div_roundcube').hide();
|
|
});
|
|
*/
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|