mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
cleaning up readme file and fixing bugs in editing of posts ("asdf" anyone?)
This commit is contained in:
41
README.md
41
README.md
@@ -39,44 +39,3 @@ Lastly, we run the forum.
|
|||||||
*(Optional)* Some server configurations may install the node binary as `nodejs` instead of `node`. You can re-map it (so as to not break compatibility with `node-supervisor`) by running the following command:
|
*(Optional)* Some server configurations may install the node binary as `nodejs` instead of `node`. You can re-map it (so as to not break compatibility with `node-supervisor`) by running the following command:
|
||||||
|
|
||||||
# update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
|
# update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
|
||||||
|
|
||||||
## Server Configuration
|
|
||||||
|
|
||||||
The server configuration file (located at `/config.js`) contains default options required for the running of NodeBB. The following options are available:
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Option</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><b>base_url</b></td>
|
|
||||||
<td><i>(Default: 'http://localhost')</i> A web-accessible URL to your app, without the port</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><b>upload_path</b></td>
|
|
||||||
<td><i>(Default: '/public/uploads')</i> A relative path (relative to the application's web root) to the uploads folder. Please ensure that Node.js can write to this folder</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><b>use_port</b></td>
|
|
||||||
<td><i>(Default: true)</i> Whether or not to include the port number when constructing the url for use in NodeBB. If you are serving NodeBB via a proxy (i.e. nginx), switch this off.
|
|
||||||
<tr>
|
|
||||||
<td><b>port</b></td>
|
|
||||||
<td><i>(Default: 4567)</i> The default port that NodeBB runs on. Even if you are running NodeBB behind a proxy server, this port must be set.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><b>mailer</b></td>
|
|
||||||
<td>
|
|
||||||
<i>(Default: {<br />
|
|
||||||
host: 'localhost',<br />
|
|
||||||
port: '25',<br />
|
|
||||||
from: 'mailer@localhost.lan'<br />
|
|
||||||
})</i><br />
|
|
||||||
Settings for the outgoing mailer (for emails involving user registration/password resets)
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
## Client Configuration
|
|
||||||
|
|
||||||
As the client will utilise web sockets to connect to the server, you'll need to customise the client configuration file (located at `/public/config.json`) to point to your server's publically accessible IP. The port will be identical to the port specified in the server-side configuration (defaulted to `4567`).
|
|
||||||
@@ -58,6 +58,10 @@ define(function() {
|
|||||||
composer.load(uuid);
|
composer.load(uuid);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('api:composer.editCheck', function(editCheck) {
|
||||||
|
if (editCheck.titleEditable === true) composer.postContainer.querySelector('input').readOnly = false;
|
||||||
|
});
|
||||||
|
|
||||||
// Posts bar events
|
// Posts bar events
|
||||||
$(composer.btnContainer).on('click', 'li', function() {
|
$(composer.btnContainer).on('click', 'li', function() {
|
||||||
var uuid = this.getAttribute('data-uuid');
|
var uuid = this.getAttribute('data-uuid');
|
||||||
@@ -168,11 +172,11 @@ define(function() {
|
|||||||
composer.postContainer.setAttribute('data-uuid', post_uuid);
|
composer.postContainer.setAttribute('data-uuid', post_uuid);
|
||||||
if (parseInt(post_data.tid) > 0) {
|
if (parseInt(post_data.tid) > 0) {
|
||||||
titleEl.value = 'Replying to: ' + post_data.title;
|
titleEl.value = 'Replying to: ' + post_data.title;
|
||||||
titleEl.readonly = true;
|
titleEl.readOnly = true;
|
||||||
} else if (parseInt(post_data.pid) > 0) {
|
} else if (parseInt(post_data.pid) > 0) {
|
||||||
console.log(post_data);
|
titleEl.value = post_data.title;
|
||||||
titleEl.value = 'Editing: ' + post_data.title;
|
titleEl.readOnly = true;
|
||||||
titleEl.readonly = true;
|
socket.emit('api:composer.editCheck', post_data.pid);
|
||||||
} else {
|
} else {
|
||||||
titleEl.value = post_data.title;
|
titleEl.value = post_data.title;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ marked.setOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
(function(PostTools) {
|
(function(PostTools) {
|
||||||
|
PostTools.isMain = function(pid, tid, callback) {
|
||||||
|
RDB.lrange('tid:' + tid + ':posts', 0, 0, function(err, pids) {
|
||||||
|
if (pids[0] === pid) callback(true);
|
||||||
|
else callback(false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
PostTools.privileges = function(pid, uid, callback) {
|
PostTools.privileges = function(pid, uid, callback) {
|
||||||
//todo: break early if one condition is true
|
//todo: break early if one condition is true
|
||||||
@@ -48,19 +54,21 @@ marked.setOptions({
|
|||||||
|
|
||||||
PostTools.edit = function(uid, pid, title, content) {
|
PostTools.edit = function(uid, pid, title, content) {
|
||||||
var success = function() {
|
var success = function() {
|
||||||
|
|
||||||
RDB.set('pid:' + pid + ':content', content);
|
RDB.set('pid:' + pid + ':content', content);
|
||||||
RDB.set('pid:' + pid + ':edited', new Date().getTime());
|
RDB.set('pid:' + pid + ':edited', new Date().getTime());
|
||||||
RDB.set('pid:' + pid + ':editor', uid);
|
RDB.set('pid:' + pid + ':editor', uid);
|
||||||
|
|
||||||
posts.get_tid_by_pid(pid, function(tid) {
|
posts.get_tid_by_pid(pid, function(tid) {
|
||||||
RDB.set('tid:' + tid + ':title', title);
|
PostTools.isMain(pid, tid, function(isMainPost) {
|
||||||
|
if (isMainPost) RDB.set('tid:' + tid + ':title', title);
|
||||||
|
|
||||||
io.sockets.in('topic_' + tid).emit('event:post_edited', {
|
io.sockets.in('topic_' + tid).emit('event:post_edited', {
|
||||||
pid: pid,
|
pid: pid,
|
||||||
title: title,
|
title: title,
|
||||||
content: marked(content || '')
|
content: marked(content || '')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
PostTools.privileges(pid, uid, function(privileges) {
|
PostTools.privileges(pid, uid, function(privileges) {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ marked.setOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
(function(Posts) {
|
(function(Posts) {
|
||||||
|
|
||||||
Posts.getPostsByTid = function(tid, current_user, start, end, callback) {
|
Posts.getPostsByTid = function(tid, current_user, start, end, callback) {
|
||||||
RDB.lrange('tid:' + tid + ':posts', start, end, function(err, pids) {
|
RDB.lrange('tid:' + tid + ':posts', start, end, function(err, pids) {
|
||||||
RDB.handle(err);
|
RDB.handle(err);
|
||||||
|
|||||||
@@ -194,6 +194,12 @@ marked.setOptions({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Topics.getTitle = function(tid, callback) {
|
||||||
|
RDB.get('tid:' + tid + ':title', function(err, title) {
|
||||||
|
callback(title);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Topics.markAsRead = function(tid, uid) {
|
Topics.markAsRead = function(tid, uid) {
|
||||||
// there is an issue with this fn. if you read a topic that is previously read you will mark the category as read anyways - there is no check
|
// there is an issue with this fn. if you read a topic that is previously read you will mark the category as read anyways - there is no check
|
||||||
RDB.sadd(schema.topics(tid).read_by_uid, uid);
|
RDB.sadd(schema.topics(tid).read_by_uid, uid);
|
||||||
|
|||||||
@@ -323,15 +323,36 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (parseInt(data.pid) > 0) {
|
} else if (parseInt(data.pid) > 0) {
|
||||||
|
async.parallel([
|
||||||
|
function(next) {
|
||||||
posts.getRawContent(data.pid, function(raw) {
|
posts.getRawContent(data.pid, function(raw) {
|
||||||
|
next(null, raw);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
topics.getTitle(data.pid, function(title) {
|
||||||
|
next(null, title);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
], function(err, results) {
|
||||||
socket.emit('api:composer.push', {
|
socket.emit('api:composer.push', {
|
||||||
title: 'asdf',
|
title: results[1],
|
||||||
pid: data.pid,
|
pid: data.pid,
|
||||||
body: raw
|
body: results[0]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('api:composer.editCheck', function(pid) {
|
||||||
|
posts.get_tid_by_pid(pid, function(tid) {
|
||||||
|
postTools.isMain(pid, tid, function(isMain) {
|
||||||
|
socket.emit('api:composer.editCheck', {
|
||||||
|
titleEditable: isMain
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}(SocketIO));
|
}(SocketIO));
|
||||||
|
|||||||
Reference in New Issue
Block a user