Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit d72d2decd5

@ -23,7 +23,7 @@
NodeBB requires the following software to be installed:
* A version of Node.js at least 0.8 or greater
* Redis, version 2.6 or greater.
* Redis, version 2.6 or greater or MongoDB, version 2.4 or greater
* nginx, version 1.3.13 or greater (**only if** intending to use nginx to proxy requests to a NodeBB)
## Installation
@ -32,6 +32,8 @@ First, we install our base software stack:
# apt-get install git nodejs redis-server npm build-essential imagemagick
If you want to use MongoDB instead of Redis install it from http://www.mongodb.org/downloads and remove 'redis-server' from the above command. [MongoDB-Setup](https://github.com/designcreateplay/NodeBB/wiki/MongoDB-Setup)
**If your package manager only installed a version of Node.js that is less than 0.8 (e.g. Ubuntu 12.10, 13.04):**
# add-apt-repository ppa:chris-lea/node.js

@ -14,14 +14,10 @@
},
"dependencies": {
"socket.io": "~0.9.16",
"redis": "0.8.3",
"mongodb": "~1.3.19",
"express": "3.2.0",
"express-namespace": "~0.1.1",
"emailjs": "0.3.4",
"cookie": "0.0.6",
"connect-redis": "1.4.5",
"connect-mongo": "0.4.0",
"passport": "0.1.17",
"passport-local": "0.1.6",
"passport-twitter": "0.1.5",
@ -50,6 +46,10 @@
"semver": "~2.2.1"
},
"optionalDependencies": {
"redis": "0.8.3",
"mongodb": "~1.3.19",
"connect-redis": "1.4.5",
"connect-mongo": "0.4.0",
"hiredis": "~0.1.15"
},
"devDependencies": {

@ -7,18 +7,24 @@ define(['taskbar'], function(taskbar) {
postContainer: undefined,
};
var uploadsInProgress = [];
function createImagePlaceholder(img) {
var text = $('.post-window textarea').val(),
textarea = $('.post-window textarea'),
imgText = "!["+img.name+"](uploading...)";
imgText = "!["+img.name+"](uploading...)",
uuid = $('.post-window .imagedrop').parents('[data-uuid]').attr('data-uuid');
text += imgText;
textarea.val(text + " ");
uploadsInProgress.push(1);
socket.emit("api:posts.uploadImage", img, function(err, data) {
if(!composer.posts[uuid].uploadsInProgress) {
composer.posts[uuid].uploadsInProgress = [];
}
composer.posts[uuid].uploadsInProgress.push(1);
socket.emit("api:posts.uploadImage", img, function(err, data) {
if(err) {
return app.alertError(err.message);
}
var currentText = textarea.val();
imgText = "!["+data.name+"](uploading...)";
@ -26,14 +32,13 @@ define(['taskbar'], function(taskbar) {
textarea.val(currentText.replace(imgText, "!["+data.name+"]("+data.url+")"));
else
textarea.val(currentText.replace(imgText, "!["+data.name+"](upload error)"));
uploadsInProgress.pop();
composer.posts[uuid].uploadsInProgress.pop();
});
}
function loadFile(file) {
var reader = new FileReader(),
dropDiv = $('.post-window .imagedrop'),
uuid = dropDiv.parents('[data-uuid]').attr('data-uuid');
dropDiv = $('.post-window .imagedrop');
$(reader).on('loadend', function(e) {
var bin = this.result;
@ -68,8 +73,9 @@ define(['taskbar'], function(taskbar) {
});
textarea.on('dragenter', function(e) {
if(draggingDocument)
if(draggingDocument) {
return;
}
drop.css('top', textarea.position().top + 'px');
drop.show();
@ -133,8 +139,9 @@ define(['taskbar'], function(taskbar) {
document.body.insertBefore(composer.postContainer, taskbar);
if(config.imgurClientIDSet)
if(config.imgurClientIDSet) {
initializeFileReader();
}
socket.on('api:composer.push', function(threadData) {
if (!threadData.error) {
@ -330,7 +337,7 @@ define(['taskbar'], function(taskbar) {
titleEl.value = titleEl.value.trim();
bodyEl.value = bodyEl.value.trim();
if(uploadsInProgress.length) {
if(postData.uploadsInProgress && postData.uploadsInProgress.length) {
return app.alert({
type: 'warning',
timeout: 2000,
@ -387,7 +394,6 @@ define(['taskbar'], function(taskbar) {
if (composer.posts[post_uuid]) {
$(composer.postContainer).find('.imagedrop').hide();
delete composer.posts[post_uuid];
uploadsInProgress.length = 0;
composer.minimize();
taskbar.discard('composer', post_uuid);
}

@ -2,17 +2,25 @@
(function(module) {
'use strict';
var mongoClient = require('mongodb').MongoClient,
winston = require('winston'),
var winston = require('winston'),
async = require('async'),
nconf = require('nconf'),
express = require('express'),
mongoStore = require('connect-mongo')(express),
mongoHost = nconf.get('mongo:host'),
db;
db,
mongoClient,
mongoStore;
try {
mongoClient = require('mongodb').MongoClient;
mongoStore = require('connect-mongo')(express);
} catch (err) {
winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
process.exit();
}
module.init = function(callback) {
mongoClient.connect('mongodb://'+ mongoHost + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, _db) {
mongoClient.connect('mongodb://'+ nconf.get('mongo:host') + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, _db) {
if(err) {
winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message);
process.exit();

@ -2,16 +2,24 @@
(function(module) {
'use strict';
var redisClient,
redis = require('redis'),
winston = require('winston'),
var winston = require('winston'),
nconf = require('nconf'),
express = require('express'),
connectRedis = require('connect-redis')(express),
reds = require('reds'),
redis_socket_or_host = nconf.get('redis:host'),
utils = require('./../../public/src/utils.js');
utils = require('./../../public/src/utils.js'),
redis,
connectRedis,
reds,
redisClient;
try {
redis = require('redis');
connectRedis = require('connect-redis')(express);
reds = require('reds');
} catch (err) {
winston.error('Unable to initialize Redis! Is Redis installed? Error :' + err.message);
process.exit();
}
if (redis_socket_or_host && redis_socket_or_host.indexOf('/')>=0) {

Loading…
Cancel
Save