Skip to content

Node.js based forum software built for the modern web

interim commit

Julian Lam00a9ec0f1293
diff --git a/app.js b/app.js
index 818968e0fb..56b95a1cee 100644
--- a/app.js
+++ b/app.js
@@ -18,7 +18,7 @@ global.templates = {};
templates.init([
'header', 'footer', 'logout', 'admin/header', 'admin/footer', 'admin/index',
'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext',
- 'emails/header.tpl', 'emails/footer.tpl'
+ 'emails/header', 'emails/footer', 'install/header', 'install/footer', 'install/basic'
]);
templates.ready(function() {
diff --git a/public/templates/config.json b/public/templates/config.json
index 8a35b78e0b..04aa514a26 100644
--- a/public/templates/config.json
+++ b/public/templates/config.json
@@ -10,6 +10,8 @@
"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",
diff --git a/public/templates/install/basic.tpl b/public/templates/install/basic.tpl
new file mode 100644
index 0000000000..9ab273509e
--- /dev/null
+++ b/public/templates/install/basic.tpl
@@ -0,0 +1,28 @@
+
+<h1>Step 1 &ndash; Basic Information</h1>
+
+<p class="lead">
+ Thanks for choosing to install NodeBB! We&apos;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>
+
+<p>
+ <label class="checkbox"><input type="checkbox" data-field="use_port" /> Use port</label>
+</p>
+
+<form class="form-inline">
+ <label>Port</label> <input type="text" data-field="port" />
+</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" />
\ No newline at end of file
diff --git a/public/templates/install/footer.tpl b/public/templates/install/footer.tpl
new file mode 100644
index 0000000000..9c25607790
--- /dev/null
+++ b/public/templates/install/footer.tpl
@@ -0,0 +1,3 @@
+
+ </div>
+</body>
\ No newline at end of file
diff --git a/public/templates/install/header.tpl b/public/templates/install/header.tpl
new file mode 100644
index 0000000000..535efe3092
--- /dev/null
+++ b/public/templates/install/header.tpl
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>NodeBB</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="title" CONTENT="NodeBB">
+ <meta name="description" content="Node.js/Redis/Socket.io powered forums for a new generation">
+ <link href="/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
+ <link href="/vendor/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
+ <link rel="stylesheet" href="/vendor/fontawesome/css/font-awesome.min.css">
+ <script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
+ <script type="text/javascript" src="/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js"></script>
+ <script type="text/javascript" src="/vendor/bootstrap/js/bootstrap.min.js"></script>
+ <script type="text/javascript" src="/socket.io/socket.io.js"></script>
+ <script type="text/javascript" src="/src/app.js"></script>
+ <script type="text/javascript" src="/src/templates.js"></script>
+ <script type="text/javascript" src="/src/ajaxify.js"></script>
+ <script type="text/javascript" src="/src/jquery.form.js"></script>
+ <script type="text/javascript" src="/src/utils.js"></script>
+
+ <link rel="stylesheet" type="text/css" href="/css/style.css" />
+</head>
+
+<body>
+ <div class="navbar navbar-inverse navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/">NodeBB Installation</a>
+ <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <div class="nav-collapse collapse">
+ <ul class="nav nodebb-inline-block">
+ <li>
+ <a data-tab="basic" href="#"><i class="icon-cog"></i> Basic</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="container" id="content">
\ No newline at end of file
diff --git a/src/routes/install.js b/src/routes/install.js
new file mode 100644
index 0000000000..e882aa954a
--- /dev/null
+++ b/src/routes/install.js
@@ -0,0 +1,44 @@
+
+var RDB = require('../redis.js');
+
+(function(Install) {
+ Install.create_routes = function(app) {
+
+ (function() {
+ var routes = ['basic'];
+
+ for (var i=0, ii=routes.length; i<ii; i++) {
+ (function(route) {
+ app.get('/install/' + route, function(req, res) {
+ res.send(templates['install/header'] + app.create_route('install/' + route) + templates['install/footer']);
+ });
+ }(routes[i]));
+ }
+ }());
+
+ //todo consolidate.
+ app.get('/install', function(req, res) {
+ res.send(templates['install/header'] + app.create_route('install/basic') + templates['install/footer']);
+ });
+ app.get('/install/index', function(req, res) {
+ res.send(templates['install/header'] + app.create_route('install/index') + templates['install/footer']);
+ });
+
+
+ function api_method(req, res) {
+ switch(req.params.method) {
+ case 'basic' :
+ res.send('{}');
+ break;
+
+ default :
+ res.send('{}');
+ }
+ }
+
+ app.get('/api/install/:method/:tab?*', api_method);
+ app.get('/api/install/:method*', api_method);
+ };
+
+
+}(exports));
\ No newline at end of file
diff --git a/src/webserver.js b/src/webserver.js
index f7b8028b4b..111b50b40e 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -17,6 +17,7 @@ var express = require('express'),
notifications = require('./notifications.js'),
admin = require('./routes/admin.js'),
userRoute = require('./routes/user.js'),
+ installRoute = require('./routes/install.js'),
auth = require('./routes/authentication.js');
(function(app) {
@@ -62,6 +63,7 @@ var express = require('express'),
auth.create_routes(app);
admin.create_routes(app);
userRoute.create_routes(app);
+ installRoute.create_routes(app);
app.create_route = function(url, tpl) { // to remove