From c731661a3991a4c63142cfd165a3fda3dcd953a1 Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Thu, 23 Nov 2017 08:50:10 -0700
Subject: [PATCH] Remove external sources from installer page (#6101)
* Remove external sources from installer page
* Remove bootstrap.min.css
* Make spinner display consistently cross-platform
* Change spinner to look better
---
install/web.js | 31 +++++++++++++++-------
public/less/install.less | 47 ++++++++++++++++++++++++++++++++-
public/src/installer/install.js | 4 +--
src/views/install/index.tpl | 37 +++++++++-----------------
4 files changed, 82 insertions(+), 37 deletions(-)
diff --git a/install/web.js b/install/web.js
index 55f7db2a3a..730c8130c4 100644
--- a/install/web.js
+++ b/install/web.js
@@ -26,6 +26,7 @@ winston.add(winston.transports.File, {
var web = {};
var scripts = [
+ 'node_modules/jquery/dist/jquery.js',
'public/vendor/xregexp/xregexp.js',
'public/vendor/xregexp/unicode/unicode-base.js',
'public/src/utils.js',
@@ -53,7 +54,7 @@ web.install = function (port) {
extended: true,
}));
- async.parallel([compileLess, compileJS], function (err) {
+ async.parallel([compileLess, compileJS, copyCSS], function (err) {
if (err) {
winston.error(err);
}
@@ -136,14 +137,15 @@ function launch(req, res) {
process.stdout.write(' "./nodebb log" to view server output\n');
process.stdout.write(' "./nodebb restart" to restart NodeBB\n');
- async.parallel([
- function (next) {
- fs.unlink(path.join(__dirname, '../public/installer.css'), next);
- },
- function (next) {
- fs.unlink(path.join(__dirname, '../public/installer.min.js'), next);
- },
- ], function (err) {
+ var filesToDelete = [
+ 'installer.css',
+ 'installer.min.js',
+ 'bootstrap.min.css',
+ ];
+
+ async.each(filesToDelete, function (filename, next) {
+ fs.unlink(path.join(__dirname, '../public', filename), next);
+ }, function (err) {
if (err) {
winston.warn('Unable to remove installer files');
}
@@ -198,4 +200,15 @@ function compileJS(callback) {
});
}
+function copyCSS(next) {
+ async.waterfall([
+ function (next) {
+ fs.readFile(path.join(__dirname, '../node_modules/bootstrap/dist/css/bootstrap.min.css'), 'utf8', next);
+ },
+ function (src, next) {
+ fs.writeFile(path.join(__dirname, '../public/bootstrap.min.css'), src, next);
+ },
+ ], next);
+}
+
module.exports = web;
diff --git a/public/less/install.less b/public/less/install.less
index 1289c62941..a9f59dbb7b 100644
--- a/public/less/install.less
+++ b/public/less/install.less
@@ -1,3 +1,48 @@
+.working {
+ width: 24px;
+ height: 24px;
+
+ position: relative;
+ display: inline-block;
+ vertical-align: bottom;
+
+ &::before, &::after {
+ content: ' ';
+
+ width: 100%;
+ height: 100%;
+ border-radius: 50%;
+ background-color: #fff;
+ opacity: 0.6;
+ position: absolute;
+ top: 0;
+ left: 0;
+
+ -webkit-animation: sk-bounce 2.0s infinite ease-in-out;
+ animation: sk-bounce 2.0s infinite ease-in-out;
+ }
+
+ &::after {
+ -webkit-animation-delay: -1.0s;
+ animation-delay: -1.0s;
+ }
+}
+
+@-webkit-keyframes sk-bounce {
+ 0%, 100% { -webkit-transform: scale(0.0) }
+ 50% { -webkit-transform: scale(1.0) }
+}
+
+@keyframes sk-bounce {
+ 0%, 100% {
+ transform: scale(0.0);
+ -webkit-transform: scale(0.0);
+ } 50% {
+ transform: scale(1.0);
+ -webkit-transform: scale(1.0);
+ }
+}
+
.btn, .form-control, .navbar {
border-radius: 0;
}
@@ -8,7 +53,7 @@
}
body, small, p, div {
- font-family: "Roboto", sans-serif;
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.input-row {
diff --git a/public/src/installer/install.js b/public/src/installer/install.js
index 9fa8a248c7..201905a3c1 100644
--- a/public/src/installer/install.js
+++ b/public/src/installer/install.js
@@ -46,7 +46,7 @@ $('document').ready(function () {
return false;
}
- $('#submit .fa-spin').removeClass('hide');
+ $('#submit .working').removeClass('hide');
}
function activate(type, el) {
@@ -112,7 +112,7 @@ $('document').ready(function () {
}
function launchForum() {
- $('#launch .fa-spin').removeClass('hide');
+ $('#launch .working').removeClass('hide');
$.post('/launch', function () {
var successCount = 0;
diff --git a/src/views/install/index.tpl b/src/views/install/index.tpl
index 5183debbb4..39cc52f305 100644
--- a/src/views/install/index.tpl
+++ b/src/views/install/index.tpl
@@ -2,37 +2,28 @@
-
-
+
+
NodeBB Web Installer
-
-
-
+
-
+
+
@@ -104,7 +95,7 @@
-
+
@@ -113,7 +104,7 @@
Congratulations! Your NodeBB has been set-up.
-
+
@@ -131,9 +122,5 @@
-
-
-
-
\ No newline at end of file