1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-24 07:37:04 +00:00

Bump web dependencies (#1)

- Bootstrap: 3.3.7 -> 4.4.1
- - New admin panel style and respective corrections applied.

- JQuery: 2.1.4 -> 3.5.0
This commit is contained in:
David Duque 2020-04-16 19:52:01 +01:00 committed by GitHub
parent 785280c86b
commit 7ffc889c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 153 additions and 147 deletions

View File

@ -21,6 +21,8 @@ This is a fork of MiaB (duh), hacked and tuned to my needs:
- 💤 Possibility of disabling some services (\*cough\* NextCloud \*cough\*); - 💤 Possibility of disabling some services (\*cough\* NextCloud \*cough\*);
- ✅ Bumped the bootstrap and jQuery dependencies' versions - and we've got a brand new admin panel now!
- 💤 Anything else I might need to use; - 💤 Anything else I might need to use;
All in all, I think I should rename this to something like "Central [Clown Computing](https://www.urbandictionary.com/define.php?term=clown%20computing)", since I'm trying to cram as many services as possible into that poor machine (Spending 5$ is better than spending 10$) All in all, I think I should rename this to something like "Central [Clown Computing](https://www.urbandictionary.com/define.php?term=clown%20computing)", since I'm trying to cram as many services as possible into that poor machine (Spending 5$ is better than spending 10$)

View File

@ -69,7 +69,6 @@
margin-bottom: 1em; margin-bottom: 1em;
} }
</style> </style>
<link rel="stylesheet" href="/admin/assets/bootstrap/css/bootstrap-theme.min.css">
</head> </head>
<body> <body>
@ -78,46 +77,51 @@
<!--[if gt IE 7]><!--> <!--[if gt IE 7]><!-->
<div class="navbar navbar-inverse navbar-static-top" role="navigation"> <div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container"> <div class="container bg-light">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">{{hostname}}</a> <a class="navbar-brand" href="#">{{hostname}}</a>
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar navbar-expand-lg">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="dropdown"> <li class="btn dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">System <b class="caret"></b></a> <a style="color: black;" href="#" class="dropdown-toggle" data-toggle="dropdown">System <b
class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#system_status" onclick="return show_panel(this);">Status Checks</a></li> <li class="dropdown-item"><a href="#system_status" onclick="return show_panel(this);">Status
<li><a href="#tls" onclick="return show_panel(this);">TLS (SSL) Certificates</a></li> Checks</a></li>
<li><a href="#system_backup" onclick="return show_panel(this);">Backup Status</a></li> <li class="dropdown-item"><a href="#tls" onclick="return show_panel(this);">TLS (SSL)
<li><a href="#smtp_relays" onclick="return show_panel(this);">SMTP Relays</a></li> Certificates</a></li>
<li class="dropdown-item"><a href="#system_backup" onclick="return show_panel(this);">Backup
Status</a></li>
<li class="dropdown-item"><a href="#smtp_relays" onclick="return show_panel(this);">SMTP
Relays</a></li>
<li class="divider"></li> <li class="divider"></li>
<li class="dropdown-header">Advanced Pages</li> <li class="dropdown-header">Advanced Pages</li>
<li><a href="#custom_dns" onclick="return show_panel(this);">Custom DNS</a></li> <li class="dropdown-item"><a href="#custom_dns" onclick="return show_panel(this);">Custom
<li><a href="#external_dns" onclick="return show_panel(this);">External DNS</a></li> DNS</a></li>
<li><a href="/admin/munin" target="_blank">Munin Monitoring</a></li> <li class="dropdown-item"><a href="#external_dns"
onclick="return show_panel(this);">External DNS</a></li>
<li class="dropdown-item"><a href="/admin/munin" target="_blank">Munin Monitoring</a></li>
</ul> </ul>
</li> </li>
<li class="dropdown"> <li class="btn dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Mail <b class="caret"></b></a> <a style="color: black;" href="#" class="dropdown-toggle" data-toggle="dropdown">Mail <b
class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#mail-guide" onclick="return show_panel(this);">Instructions</a></li> <li class="dropdown-item"><a href="#mail-guide"
<li><a href="#users" onclick="return show_panel(this);">Users</a></li> onclick="return show_panel(this);">Instructions</a></li>
<li><a href="#aliases" onclick="return show_panel(this);">Aliases</a></li> <li class="dropdown-item"><a href="#users" onclick="return show_panel(this);">Users</a></li>
<li class="dropdown-item"><a href="#aliases" onclick="return show_panel(this);">Aliases</a>
</li>
</ul> </ul>
</li> </li>
<li><a href="#sync_guide" onclick="return show_panel(this);">Contacts/Calendar</a></li> <li class="btn"><a style="color: black;" href="#sync_guide"
<li><a href="#web" onclick="return show_panel(this);">Web</a></li> onclick="return show_panel(this);">Contacts/Calendar</a></li>
<li class="btn"><a style="color: black;" href="#web" onclick="return show_panel(this);">Web</a></li>
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="btn nav navbar-nav navbar-right">
<li><a href="#" onclick="do_logout(); return false;" style="color: white">Log out</a></li> <li><a href="#" onclick="do_logout(); return false;" style="color: black; font-weight: bold;">Log
out</a></li>
</ul> </ul>
</div> </div>
<!--/.navbar-collapse --> <!--/.navbar-collapse -->
@ -177,7 +181,7 @@
<footer> <footer>
<p>This is a <a href="https://github.com/ddavness/power-mailinabox">Power Mail-in-a-Box</a>. (Debian <p>This is a <a href="https://github.com/ddavness/power-mailinabox">Power Mail-in-a-Box</a>. (Debian
GNU/Linux 10 (Buster))</p> GNU/Linux 10)</p>
</footer> </footer>
</div> <!-- /container --> </div> <!-- /container -->
@ -194,8 +198,8 @@
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-sm">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="errorModalTitle"> </h4> <h4 class="modal-title" id="errorModalTitle"> </h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p> </p> <p> </p>

View File

@ -2,7 +2,7 @@
{% if no_users_exist or no_admins_exist %} {% if no_users_exist or no_admins_exist %}
<div class="row"> <div class="row">
<div class="col-md-offset-2 col-md-8"> <div class="col-md-offset-2 col-md-8">
{% if no_users_exist %} {% if no_users_exist %}
<p class="text-danger">There are no users on this system! To make an administrative user, <p class="text-danger">There are no users on this system! To make an administrative user,
log into this machine using SSH (like when you first set it up) and run:</p> log into this machine using SSH (like when you first set it up) and run:</p>
@ -16,7 +16,7 @@ sudo tools/mail.py user make-admin me@{{hostname}}</pre>
sudo tools/mail.py user make-admin me@{{hostname}}</pre> sudo tools/mail.py user make-admin me@{{hostname}}</pre>
{% endif %} {% endif %}
<hr> <hr>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -26,13 +26,13 @@ sudo tools/mail.py user make-admin me@{{hostname}}</pre>
<form class="form-horizontal" role="form" onsubmit="do_login(); return false;" method="get"> <form class="form-horizontal" role="form" onsubmit="do_login(); return false;" method="get">
<div class="form-group"> <div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">Email</label> <label for="inputEmail3" class="col-sm-3 control-label">Email</label>
<div class="col-sm-9"> <div class="col-sm-12">
<input name="email" type="email" class="form-control" id="loginEmail" placeholder="Email"> <input name="email" type="email" class="form-control" id="loginEmail" placeholder="Email">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="inputPassword3" class="col-sm-3 control-label">Password</label> <label for="inputPassword3" class="col-sm-3 control-label">Password</label>
<div class="col-sm-9"> <div class="col-sm-12">
<input name="password" type="password" class="form-control" id="loginPassword" placeholder="Password"> <input name="password" type="password" class="form-control" id="loginPassword" placeholder="Password">
</div> </div>
</div> </div>
@ -55,15 +55,15 @@ sudo tools/mail.py user make-admin me@{{hostname}}</pre>
<script> <script>
function do_login() { function do_login() {
if ($('#loginEmail').val() == "") { if ($('#loginEmail').val() == "") {
show_modal_error("Login Failed", "Enter your email address.", function() { show_modal_error("Login Failed", "Enter your email address.", function () {
$('#loginEmail').focus(); $('#loginEmail').focus();
}); });
return false; return false;
} }
if ($('#loginPassword').val() == "") { if ($('#loginPassword').val() == "") {
show_modal_error("Login Failed", "Enter your email password.", function() { show_modal_error("Login Failed", "Enter your email password.", function () {
$('#loginPassword').focus(); $('#loginPassword').focus();
}); });
return false; return false;
@ -75,8 +75,8 @@ function do_login() {
api( api(
"/me", "/me",
"GET", "GET",
{ }, {},
function(response){ function (response) {
// This API call always succeeds. It returns a JSON object indicating // This API call always succeeds. It returns a JSON object indicating
// whether the request was authenticated or not. // whether the request was authenticated or not.
if (response.status != "ok") { if (response.status != "ok") {
@ -117,27 +117,27 @@ function do_login() {
// Open the next panel the user wants to go to. Do this after the XHR response // Open the next panel the user wants to go to. Do this after the XHR response
// is over so that we don't start a new XHR request while this one is finishing, // is over so that we don't start a new XHR request while this one is finishing,
// which confuses the loading indicator. // which confuses the loading indicator.
setTimeout(function() { show_panel(!switch_back_to_panel || switch_back_to_panel == "login" ? 'system_status' : switch_back_to_panel) }, 300); setTimeout(function () { show_panel(!switch_back_to_panel || switch_back_to_panel == "login" ? 'system_status' : switch_back_to_panel) }, 300);
} }
}) })
} }
function do_logout() { function do_logout() {
api_credentials = ["", ""]; api_credentials = ["", ""];
if (typeof localStorage != 'undefined') if (typeof localStorage != 'undefined')
localStorage.removeItem("miab-cp-credentials"); localStorage.removeItem("miab-cp-credentials");
if (typeof sessionStorage != 'undefined') if (typeof sessionStorage != 'undefined')
sessionStorage.removeItem("miab-cp-credentials"); sessionStorage.removeItem("miab-cp-credentials");
show_panel('login'); show_panel('login');
} }
function show_login() { function show_login() {
$('#loginEmail,#loginPassword').each(function() { $('#loginEmail,#loginPassword').each(function () {
var input = $(this); var input = $(this);
if (!$.trim(input.val())) { if (!$.trim(input.val())) {
input.focus(); input.focus();
return false; return false;
} }
}); });
} }
</script> </script>

View File

@ -69,18 +69,18 @@ rm -rf $assets_dir
mkdir -p $assets_dir mkdir -p $assets_dir
# jQuery CDN URL # jQuery CDN URL
jquery_version=2.1.4 jquery_version=3.5.0
jquery_url=https://code.jquery.com jquery_url=https://code.jquery.com
# Get jQuery # Get jQuery
wget_verify $jquery_url/jquery-$jquery_version.min.js 43dc554608df885a59ddeece1598c6ace434d747 $assets_dir/jquery.min.js wget_verify $jquery_url/jquery-$jquery_version.min.js 1d6ae46f2ffa213dede37a521b011ec1cd8d1ad3 $assets_dir/jquery.min.js
# Bootstrap CDN URL # Bootstrap CDN URL
bootstrap_version=3.3.7 bootstrap_version=4.4.1
bootstrap_url=https://github.com/twbs/bootstrap/releases/download/v$bootstrap_version/bootstrap-$bootstrap_version-dist.zip bootstrap_url=https://github.com/twbs/bootstrap/releases/download/v$bootstrap_version/bootstrap-$bootstrap_version-dist.zip
# Get Bootstrap # Get Bootstrap
wget_verify $bootstrap_url e6b1000b94e835ffd37f4c6dcbdad43f4b48a02a /tmp/bootstrap.zip wget_verify $bootstrap_url 52759c9d307308da862ac29e1c41bfcfe81313eb /tmp/bootstrap.zip
unzip -q /tmp/bootstrap.zip -d $assets_dir unzip -q /tmp/bootstrap.zip -d $assets_dir
mv $assets_dir/bootstrap-$bootstrap_version-dist $assets_dir/bootstrap mv $assets_dir/bootstrap-$bootstrap_version-dist $assets_dir/bootstrap
rm -f /tmp/bootstrap.zip rm -f /tmp/bootstrap.zip