installation wizard under /install
parent
00a9ec0f12
commit
65b6010d74
@ -1,25 +1,29 @@
|
||||
{
|
||||
"custom_mapping": {
|
||||
"admin/topics[^]*": "admin/topics",
|
||||
"admin/categories[^]*": "admin/categories",
|
||||
"admin/users[^]*": "admin/users",
|
||||
"admin/redis[^]*": "admin/redis",
|
||||
"admin/index[^]*": "admin/index",
|
||||
"admin/themes[^]*": "admin/themes",
|
||||
"admin/settings[^]*": "admin/settings",
|
||||
"admin/twitter[^]*": "admin/twitter",
|
||||
"admin/facebook[^]*": "admin/facebook",
|
||||
"admin/gplus[^]*": "admin/gplus",
|
||||
"install/?$": "install/basic",
|
||||
"install/basic/?$": "install/basic",
|
||||
"users[^]*edit": "accountedit",
|
||||
"users[^]*friends": "friends",
|
||||
"users/[^]*": "account",
|
||||
"latest": "category",
|
||||
"popular": "category",
|
||||
"active": "category"
|
||||
},
|
||||
"force_refresh": {
|
||||
"logout": true
|
||||
}
|
||||
"custom_mapping": {
|
||||
"admin/topics[^]*": "admin/topics",
|
||||
"admin/categories[^]*": "admin/categories",
|
||||
"admin/users[^]*": "admin/users",
|
||||
"admin/redis[^]*": "admin/redis",
|
||||
"admin/index[^]*": "admin/index",
|
||||
"admin/themes[^]*": "admin/themes",
|
||||
"admin/settings[^]*": "admin/settings",
|
||||
"admin/twitter[^]*": "admin/twitter",
|
||||
"admin/facebook[^]*": "admin/facebook",
|
||||
"admin/gplus[^]*": "admin/gplus",
|
||||
"install/?$": "install/redis",
|
||||
"install/basic/?": "install/basic",
|
||||
"install/redis/?": "install/redis",
|
||||
"install/mail/?": "install/mail",
|
||||
"install/social/?": "install/social",
|
||||
"install/privileges/?": "install/privileges",
|
||||
"users[^]*edit": "accountedit",
|
||||
"users[^]*friends": "friends",
|
||||
"users/[^]*": "account",
|
||||
"latest": "category",
|
||||
"popular": "category",
|
||||
"active": "category"
|
||||
},
|
||||
"force_refresh": {
|
||||
"logout": true
|
||||
}
|
||||
}
|
@ -1,28 +1,51 @@
|
||||
|
||||
<h1>Step 1 – Basic Information</h1>
|
||||
<h1>Step 2 – Basic Information</h1>
|
||||
|
||||
<p class="lead">
|
||||
Thanks for choosing to install NodeBB! We'll need some information to set up your installation
|
||||
configuration...
|
||||
</p>
|
||||
|
||||
<h3>Path Information</h3>
|
||||
<p>
|
||||
Please enter the web-accessible url that will be used to point to the NodeBB installation. If you are using a port number in the address,
|
||||
<strong>include it in the field below, not here</strong>
|
||||
<input type="text" class="input-large" data-field="base_url" placeholder="http://www.example.org" />
|
||||
</p>
|
||||
<form class="form-inline">
|
||||
<h3>Path Information</h3>
|
||||
<p>
|
||||
Please enter the web-accessible url that will be used to point to the NodeBB installation. If you are using a port number in the address,
|
||||
<strong>include it in the field below, not here</strong>. Do not include a trailing slash.<br />
|
||||
<input type="text" class="input-large" data-field="base_url" placeholder="http://www.example.org" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label class="checkbox"><input type="checkbox" data-field="use_port" /> Use port</label>
|
||||
</p>
|
||||
<p>
|
||||
<label class="checkbox"><input type="checkbox" data-field="use_port" checked /> Use port</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>Port</label> <input type="number" class="input-mini" data-field="port" value="4567" placeholder="4567" />
|
||||
</p>
|
||||
|
||||
<form class="form-inline">
|
||||
<label>Port</label> <input type="text" data-field="port" />
|
||||
<p>
|
||||
Path to uploads folder (relative to the root of the NodeBB install)<br />
|
||||
<input type="text" class="input-large" data-field="upload_url" value="/public/uploads" placeholder="/public/uploads" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<h3>NodeBB Secret</h3>
|
||||
<p>
|
||||
This "secret" is used to encode user sessions, so they are not stored in plaintext. Enter a bunch of random characters below:
|
||||
</p>
|
||||
<input type="text" class="input-xxlarge" data-field="secret" placeholder="n239he#dh9j9$jc4h%y4yuhnx9y(&#y9ryn9c3" />
|
||||
<input type="text" class="input-xxlarge" data-field="secret" placeholder="n239he#dh9j9$jc4h%y4yuhnx9y(&#y9ryn9c3" />
|
||||
|
||||
<hr />
|
||||
<div class="pull-right">
|
||||
<button data-path="mail" class="btn btn-primary btn-large">Next – <i class="icon-envelope"></i> Mail</button>
|
||||
</div>
|
||||
<div>
|
||||
<button data-path="redis" class="btn btn-primary btn-large">Previous – <i class="icon-hdd"></i> Redis</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
nodebb_setup.prepare();
|
||||
|
||||
var portToggle = document.querySelector('input[data-field="use_port"]'),
|
||||
portEl = document.querySelector('input[data-field="port"]');
|
||||
|
||||
portToggle.addEventListener('change', function(e) {
|
||||
if (e.target.checked) portEl.disabled = false;
|
||||
else portEl.disabled = true;
|
||||
});
|
||||
})();
|
||||
</script>
|
@ -1,3 +1,130 @@
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var nodebb_setup = {
|
||||
config: undefined,
|
||||
prepare: function() {
|
||||
// Bounce if config is not ready
|
||||
if (nodebb_setup.config === undefined) {
|
||||
ajaxify.go('install/redis');
|
||||
app.alert({
|
||||
alert_id: 'config-ready',
|
||||
type: 'error',
|
||||
timeout: 10000,
|
||||
title: 'NodeBB Configuration Not Ready!',
|
||||
message: 'NodeBB cannot proceed with setup at this time as Redis database information ' +
|
||||
'was not found. Please enter the information below.'
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Populate the fields on the page from the config
|
||||
var fields = document.querySelectorAll('#content [data-field]'),
|
||||
numFields = fields.length,
|
||||
x, key, inputType;
|
||||
for(x=0;x<numFields;x++) {
|
||||
key = fields[x].getAttribute('data-field');
|
||||
inputType = fields[x].getAttribute('type');
|
||||
if (nodebb_setup.config[key]) {
|
||||
switch(inputType) {
|
||||
case 'text':
|
||||
case 'textarea':
|
||||
case 'number':
|
||||
fields[x].value = nodebb_setup.config[key];
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
fields[x].checked = nodebb_setup.config[key] ? true : false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Save defaults, if they're not found in the config
|
||||
var defaultFields = [
|
||||
'use_port', 'port', 'upload_url', 'mailer:host',
|
||||
'mailer:port', 'privileges:manage_content',
|
||||
'privileges:manage_topic'
|
||||
],
|
||||
defaultVal;
|
||||
if (defaultFields.indexOf(key) !== -1) {
|
||||
console.log('saving default value: ', key);
|
||||
switch(inputType) {
|
||||
case 'text':
|
||||
case 'textarea':
|
||||
case 'number':
|
||||
defaultVal = fields[x].value;
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
defaultVal = fields[x].checked ? '1' : '0';
|
||||
break;
|
||||
}
|
||||
socket.emit('api:config.set', {
|
||||
key: key,
|
||||
value: defaultVal
|
||||
});
|
||||
nodebb_setup.config[key] = defaultVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
(function() {
|
||||
// Listen for field changes and auto-save on change
|
||||
var contentEl = document.getElementById('content');
|
||||
|
||||
contentEl.addEventListener('change', function(e) {
|
||||
if (e.target.hasAttribute('data-field')) {
|
||||
var key = e.target.getAttribute('data-field'),
|
||||
value;
|
||||
|
||||
switch(e.target.getAttribute('type')) {
|
||||
case 'text':
|
||||
case 'textarea':
|
||||
case 'number':
|
||||
value = e.target.value;
|
||||
break;
|
||||
case 'checkbox':
|
||||
value = e.target.checked ? 1 : 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
socket.emit('api:config.set', { key: key, value: value });
|
||||
nodebb_setup.config[key] = value;
|
||||
}
|
||||
}, false);
|
||||
contentEl.addEventListener('click', function(e) {
|
||||
if (e.target.hasAttribute('data-path')) {
|
||||
var href = 'install/' + e.target.getAttribute('data-path');
|
||||
console.log(href);
|
||||
if (!e.target.disabled) ajaxify.go(href);
|
||||
}
|
||||
}, false);
|
||||
|
||||
socket.on('api:config.set', function(data) {
|
||||
if (data.status === 'ok') {
|
||||
app.alert({
|
||||
alert_id: 'config_status',
|
||||
timeout: 2500,
|
||||
title: 'Configuration Saved',
|
||||
message: 'Your changes to the NodeBB configuration have been saved',
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
app.alert({
|
||||
alert_id: 'config_status',
|
||||
timeout: 2500,
|
||||
title: 'Configuration Not Saved',
|
||||
message: 'NodeBB encountered a problem saving your changes',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
@ -0,0 +1,36 @@
|
||||
|
||||
<h1>Step 3 – Mailer Information</h1>
|
||||
|
||||
<form class="form-inline">
|
||||
<p>
|
||||
The mailer information is used when sending out registration confirmation emails to new users.
|
||||
It is also used to send password reset emails to users who have forgotten their password.
|
||||
</p>
|
||||
<p>
|
||||
The defaults here correspond to a local <code>sendmail</code> server, although any third-party
|
||||
mail server can be used.
|
||||
</p>
|
||||
<p>
|
||||
<label>Hostname</label> <input type="text" class="input-medium" data-field="mailer:host" value="127.0.0.1" placeholder="127.0.0.1" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Port</label> <input type="number" class="input-mini" data-field="mailer:port" value="25" placeholder="25" />
|
||||
</p>
|
||||
<p>
|
||||
<label>From</label> <input type="text" class="input-large" data-field="mailer:from" placeholder="John Smith <jsmith@example.org>" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
<div class="pull-right">
|
||||
<button data-path="social" class="btn btn-primary btn-large">Next – <i class="icon-facebook"></i> Social</button>
|
||||
</div>
|
||||
<div>
|
||||
<button data-path="basic" class="btn btn-primary btn-large">Previous – <i class="icon-cog"></i> Basic</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
nodebb_setup.prepare();
|
||||
})();
|
||||
</script>
|
@ -0,0 +1,40 @@
|
||||
|
||||
<h1>Step 5 – User Privilege Thresholds</h1>
|
||||
|
||||
<form class="form-inline">
|
||||
<p>
|
||||
Privilege thresholds grants a community membership the ability to moderate itself.
|
||||
These numbers denote the minimum amount of user reputation required before the
|
||||
corresponding privilege is unlocked.
|
||||
</p>
|
||||
<p>
|
||||
Reputation is gained when other users favourite posts that you have made.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label>Manage Content</label> <input type="number" class="input-mini" value="1000" placeholder="1000" data-field="privileges:manage_content" />
|
||||
</p>
|
||||
<p>
|
||||
Users with reach the "Manage Content" threshold are able to edit/delete other users' posts.
|
||||
</p>
|
||||
<p>
|
||||
<label>Manage Topics</label> <input type="number" class="input-mini" value="2000" placeholder="2000" data-field="privileges:manage_topic" />
|
||||
</p>
|
||||
<p>
|
||||
Users with reach the "Manage Topics" threshold are able to edit, lock, pin, close, and delete topics.
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
<div class="pull-right">
|
||||
<a href="/" class="btn btn-success btn-large"><i class="icon-thumbs-up"></i> Start using NodeBB!</a>
|
||||
</div>
|
||||
<div>
|
||||
<button data-path="social" class="btn btn-primary btn-large">Previous – <i class="icon-facebook"></i> Social</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
nodebb_setup.prepare();
|
||||
})();
|
||||
</script>
|
@ -0,0 +1,81 @@
|
||||
|
||||
<h1>Step 1 – Establish Redis Connection</h1>
|
||||
|
||||
<p class="lead">
|
||||
Thanks for choosing to install NodeBB! We'll need some information to set up your installation
|
||||
configuration...
|
||||
</p>
|
||||
<p>
|
||||
Please enter the details of your Redis server here. If redis is hosted on the same
|
||||
server as NodeBB, you can leave the default values as-is.
|
||||
</p>
|
||||
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="redis-hostname">Hostname</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="redis-hostname" class="input-medium" placeholder="127.0.0.1" value="127.0.0.1" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="redis-port">Port</label>
|
||||
<div class="controls">
|
||||
<input type="number" id="redis-port" class="input-mini" placeholder="6379" value="6379" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button class="btn" id="test-redis">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
<div class="pull-right">
|
||||
<button data-path="basic" class="btn btn-primary btn-large" disabled>Next – <i class="icon-cog"></i> Basic</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var testRedisEl = document.getElementById('test-redis');
|
||||
testRedisEl.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (e.target.className.indexOf('testing') === -1) {
|
||||
e.target.className += ' testing';
|
||||
e.target.innerHTML = '<i class="icon-spinner icon-spin"></i> Testing';
|
||||
socket.once('api:config.redisTest', function(data) {
|
||||
if (data && data.status === 'ok') {
|
||||
e.target.className = 'btn btn-success testing';
|
||||
e.target.innerHTML = 'Redis Connection Successful!';
|
||||
|
||||
app.alert({
|
||||
type: 'success',
|
||||
timeout: 10000,
|
||||
alert_id: 'config-ready',
|
||||
title: 'Setup Ready!',
|
||||
message: 'NodeBB is ready to continue with the setup process. ' +
|
||||
'Any changes you make now will be saved automatically'
|
||||
});
|
||||
|
||||
// Grab configs from the db and enable the 'next' button
|
||||
socket.emit('api:config.setup', {
|
||||
'redis/host': document.getElementById('redis-hostname').value,
|
||||
'redis/port': document.getElementById('redis-port').value
|
||||
});
|
||||
} else {
|
||||
e.target.className = 'btn btn-danger';
|
||||
e.target.innerHTML = 'Could not connect to Redis, click here to test again';
|
||||
}
|
||||
});
|
||||
socket.emit('api:config.redisTest');
|
||||
}
|
||||
});
|
||||
|
||||
var nextBtn = document.querySelector('button[data-path="basic"]');
|
||||
socket.once('api:config.setup', function(data) {
|
||||
nodebb_setup.config = data;
|
||||
nextBtn.disabled = false;
|
||||
});
|
||||
})();
|
||||
</script>
|
@ -0,0 +1,47 @@
|
||||
|
||||
<h1>Step 4 – Social Media Logins (Optional)</h1>
|
||||
|
||||
<form class="form-inline">
|
||||
<p>
|
||||
You may opt to allow users to register and login in via a social media account, if that
|
||||
social network supports doing so.
|
||||
</p>
|
||||
|
||||
<h3>Facebook</h3>
|
||||
<p>
|
||||
<label>Application ID</label> <input type="text" class="input-medium" data-field="social/facebook/app_id" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Application Secret</label> <input type="text" class="input-large" data-field="social/facebook/secret" />
|
||||
</p>
|
||||
|
||||
<h3>Twitter</h3>
|
||||
<p>
|
||||
<label>Application Key</label> <input type="text" class="input-medium" data-field="social/twitter/key" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Application Secret</label> <input type="text" class="input-large" data-field="social/twitter/secret" />
|
||||
</p>
|
||||
|
||||
<h3>Google</h3>
|
||||
<p>
|
||||
<label>Application Key</label> <input type="text" class="input-xxlarge" data-field="social/google/key" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Application Secret</label> <input type="text" class="input-large" data-field="social/google/secret" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
<div class="pull-right">
|
||||
<button data-path="privileges" class="btn btn-primary btn-large">Next – <i class="icon-legal"></i> Privileges</button>
|
||||
</div>
|
||||
<div>
|
||||
<button data-path="mail" class="btn btn-primary btn-large">Previous – <i class="icon-envelope"></i> Mail</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
nodebb_setup.prepare();
|
||||
})();
|
||||
</script>
|
@ -0,0 +1,59 @@
|
||||
var config = require('../config.js'),
|
||||
utils = require('./../public/src/utils.js'),
|
||||
RDB = require('./redis.js'),
|
||||
async = require('async');
|
||||
|
||||
(function(Meta) {
|
||||
Meta.testRedis = function(callback) {
|
||||
RDB.set('nodebb-redis-test', 'foobar', function(err, res) {
|
||||
if (!err) {
|
||||
RDB.get('nodebb-redis-test', function(err, res) {
|
||||
if (!err && res === 'foobar') {
|
||||
callback(true);
|
||||
} else {
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Meta.config = {
|
||||
get: function(callback) {
|
||||
var config = {};
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
RDB.hkeys('config', function(err, keys) {
|
||||
next(err, keys);
|
||||
});
|
||||
},
|
||||
function(keys, next) {
|
||||
async.each(keys, function(key, next) {
|
||||
RDB.hget('config', key, function(err, value) {
|
||||
if (!err) {
|
||||
config[key] = value;
|
||||
}
|
||||
|
||||
next(err);
|
||||
});
|
||||
}, next);
|
||||
}
|
||||
], function(err) {
|
||||
if (!err) {
|
||||
config.status = 'ok';
|
||||
callback(config);
|
||||
} else callback({
|
||||
status: 'error'
|
||||
});
|
||||
});
|
||||
},
|
||||
set: function(field, value, callback) {
|
||||
RDB.hset('config', field, value, function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}(exports));
|
Loading…
Reference in New Issue