From 6fdea32a509c50acf7f7ad98ef10966e3fbedca7 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Fri, 7 Apr 2017 15:22:20 -0400 Subject: [PATCH] Install fixes --- configure.js | 2 +- libs/auth.js | 52 ++++++++++++++------------------------------------ npm/install.js | 6 ++++++ 3 files changed, 21 insertions(+), 39 deletions(-) diff --git a/configure.js b/configure.js index cb20c936..a271fb47 100644 --- a/configure.js +++ b/configure.js @@ -91,7 +91,7 @@ module.exports = (port, spinner) => { reject(new Error('Git is not installed or not reachable from PATH.')) } let gitver = _.chain(stdout.replace(/[^\d.]/g, '')).split('.').take(3).join('.').value() - if (!semver.satisfies(semver.clean(gitver), '>=2.11.0')) { + if (!semver.satisfies(semver.clean(gitver), '>=2.7.4')) { reject(new Error('Git version is too old. Minimum is v2.7.4.')) } resolve('Git v' + gitver + ' detected. Minimum is v2.7.4.') diff --git a/libs/auth.js b/libs/auth.js index 19feb4f1..92fd06fe 100644 --- a/libs/auth.js +++ b/libs/auth.js @@ -192,47 +192,23 @@ module.exports = function (passport) { db.onReady.then(() => { db.User.findOne({ provider: 'local', email: 'guest' }).then((c) => { if (c < 1) { - // Create root admin account + // Create guest account - winston.info('[AUTH] No administrator account found. Creating a new one...') - db.User.hashPassword('admin123').then((pwd) => { - return db.User.create({ - provider: 'local', - email: appconfig.admin, - name: 'Administrator', - password: pwd, - rights: [{ - role: 'admin', - path: '/', - exact: false, - deny: false - }] - }) + return db.User.create({ + provider: 'local', + email: 'guest', + name: 'Guest', + password: '', + rights: [{ + role: 'read', + path: '/', + exact: false, + deny: !appconfig.public + }] }).then(() => { - winston.info('[AUTH] Administrator account created successfully!') - }).then(() => { - if (appdata.capabilities.guest) { - // Create guest account - - return db.User.create({ - provider: 'local', - email: 'guest', - name: 'Guest', - password: '', - rights: [{ - role: 'read', - path: '/', - exact: false, - deny: !appconfig.public - }] - }).then(() => { - winston.info('[AUTH] Guest account created successfully!') - }) - } else { - return true - } + winston.info('[AUTH] Guest account created successfully!') }).catch((err) => { - winston.error('[AUTH] An error occured while creating administrator/guest account:') + winston.error('[AUTH] An error occured while creating guest account:') winston.error(err) }) } diff --git a/npm/install.js b/npm/install.js index 59a01b58..a4ca085a 100644 --- a/npm/install.js +++ b/npm/install.js @@ -11,6 +11,7 @@ const zlib = require('zlib') const inquirer = require('inquirer') const colors = require('colors/safe') const _ = require('lodash') +const os = require('os') let installDir = path.resolve(__dirname, '../..') @@ -32,6 +33,11 @@ pm2.connectAsync().then(() => { }).catch(err => { // eslint-disable-line handle-callback-err return true }) +}).then(() => { + if (os.totalmem() < 1024 * 1024 * 768) { + throw new Error('Not enough memory to install dependencies. Minimum is 768 MB.') + } + return true }).then(() => { /** * Fetch version from npm package