Browse files

updating readme to make project more GH-friendly, etc.

  • Loading branch information...
1 parent 05dc79e commit 92b5c9f01b638e5880b2cdef26c8be030edbbde1 @zackster committed Mar 7, 2012
Showing with 130 additions and 25 deletions.
  1. +15 −10 README.markdown
  2. +5 −0 TODO
  3. +2 −2 app.js
  4. +3 −10 authentication/{server.js → auth-server.js}
  5. +102 −0 config-sample.js
  6. +1 −1 feedback/{server.js → feedback-server.js}
  7. +2 −2 views/chat.jade
View
25 README.markdown
@@ -37,13 +37,15 @@ To get project to run:
* install MongoDB: http://shiftcommathree.com/articles/how-to-install-mongodb-on-os-x
-* install node.js (nodejs.org)
+* install node.js (nodejs.org). Please use with version 0.60 or greater..
* install npm (node package manager). one line install:
`curl http://npmjs.org/install.sh | sh`
-* copy "config.js.template" to "config.js". config.js is in the .gitignore file, which git tracks. "static/style.min.css" and "static/script.min.js" are also included in ".gitignore"; those are automatically generated and minified when the application is run.
+* copy "config-sample.js" to "config.js". config.js is in the .gitignore file, which git tracks. "static/style.min.css" and "static/script.min.js" are also included in ".gitignore"; those are automatically generated and minified when the application is run.
+
+* fill out config.js according to your server
* install GeoIP lib:
@@ -56,12 +58,18 @@ To get project to run:
* `npm install geoip`
-* `cd node_modules/hashlib`
-
- `node-waf configure build`
+* `git clone https://github.com/brainfucker/hashlib.git
+ cd hashlib
+ make
+ sudo make install`
+
+* `NODE_ENV=development node app.js`
-* `node app.js`
+* you also need to run the leaderboard calculator, which you should run as a separate process: `NODE_ENV=development node leaderboard.js`
+* N.B. if after running "node app.js", the application complains about you missing any dependencies (e.g. "error, couldn't find module 'mongoose'"), you should be able to install them by simply doing "npm install mongoose"
+
+* i like to keep the app running with `forever start app.js` and `forever start leaderboard.js`. you may need to install the npm "gem" forever, first: `npm install forever -g`.
--------
@@ -166,7 +174,4 @@ Fetch status and messages of conversations
return m.partner + ": " + m.text;
})
};
- });
-
-
-// hello_moto!_!
+ });
View
5 TODO
@@ -0,0 +1,5 @@
+- let user save conversation to PDF
+- post stackoverflow question about how to make a pckage.json for my app
+- update README so contributors can contribute
+- make a config-sample.js file, and explain it in the readme
+
View
4 app.js
@@ -39,8 +39,8 @@ process.on('uncaughtException', function(err) {
mergeStatic = require("./mergeStatic"),
geoip = require("geoip"),
httpdigest = require('http-digest'),
- authServer = require('./authentication/server').authServer(),
- feedbackServer = require('./feedback/server').feedbackServer(),
+ authServer = require('./authentication/auth-server').authServer(),
+ feedbackServer = require('./feedback/feedback-server').feedbackServer(),
dnode = require("dnode");
var getRoomCounts = function () {
View
13 authentication/server.js → authentication/auth-server.js
@@ -41,30 +41,23 @@
this.login = function (id, username, password, callback) {
var self = this;
- console.log("ID: %s\nUSERNAME: %s\nPASSWORD: %s", id, username, password);
client.query(
'SELECT username, password, salt FROM user WHERE username=?', [username], function selectCb(err, results, fields) {
- console.log("Query callback");
- console.log("ERR: %s", err);
- console.log("\nRESULTS:");
- console.log(results);
- console.log("\nFIELDS:");
- console.log(fields);
if (err) {
throw err;
}
if(!results.length) {
callback(false);
- return;
+ return false;
}
if(results[0].password === hashlib.md5(hashlib.md5(password)+results[0].salt)) {
self.logged_in_users[id] = username;
callback(true);
- return;
+ return true;
}
else {
callback(false);
- return;
+ return false;
}
});
View
102 config-sample.js
@@ -0,0 +1,102 @@
+var config = {
+ development: {
+ port: 8000,
+ documentDomain: "localhost:8000",
+ mongodb: {
+ uri: "mongodb://localhost:27017/log-d",
+ logCollection: "logs"
+ },
+ logLimits: {
+ info: 1000,
+ warn: 1000,
+ error: 1000
+ },
+ forceLatency: 0, // can set this to 1000 for debugging
+ systemPassword: "password",
+ serveMerged: false,
+ disconnectLeeway: 10000,
+ messageBacklogPerUser: 100,
+ geoLocationParts: [
+ "region",
+ "country_name"
+ ],
+ hashIPAddressSalt: "somethingunique",
+ listenerAuthentication: {
+ username: 'listener',
+ password: 'listener'
+ },
+ vBulletin: {
+ database: 'vbulletin',
+ username: 'vbulletin',
+ password: 'password'
+ }
+ },
+ staging: {
+ port: 8001,
+ documentDomain: "staging.compassionpit.com",
+ mongodb: {
+ uri: "mongodb://localhost:27017/log-d",
+ logCollection: "logs"
+ },
+ logLimits: {
+ info: 1000,
+ warn: 1000,
+ error: 1000
+ },
+ forceLatency: 0, // can set this to 1000 for debugging
+ systemPassword: "password",
+ serveMerged: false,
+ disconnectLeeway: 10000,
+ messageBacklogPerUser: 100,
+ geoLocationParts: [
+ "region",
+ "country_name"
+ ],
+ hashIPAddressSalt: "somethingunique",
+ listenerAuthentication: {
+ username: 'listener',
+ password: 'listener'
+ },
+ vBulletin: {
+ database: 'vbulletin',
+ username: 'vbulletin',
+ password: 'password'
+ }
+ },
+ production: {
+ port: 8000,
+ documentDomain: "www.compassionpit.com",
+ mongodb: {
+ uri: "mongodb://localhost:27017/log-p",
+ logCollection: "logs"
+ },
+ logLimits: {
+ info: 1000,
+ warn: 1000,
+ error: 1000
+ },
+ forceLatency: 0,
+ systemPassword: "password",
+ serveMerged: true,
+ disconnectLeeway: 10000,
+ messageBacklogPerUser: 100,
+ geoLocationParts: [
+ "region",
+ "country_name"
+ ],
+ hashIPAddressSalt: "somethingunique",
+ listenerAuthentication: {
+ username: 'listener',
+ password: 'listener'
+ },
+ vBulletin: {
+ database: 'vbulletin',
+ username: 'vbulletin',
+ password: 'password'
+ }
+ }
+};
+
+module.exports = config[process.env.NODE_ENV || "development"];
+
+require('./static-config')(module.exports);
View
2 feedback/server.js → feedback/feedback-server.js
@@ -2,7 +2,7 @@
var mongoose = require('mongoose')
- , authServer = require('../authentication/server').authServer();
+ , authServer = require('../authentication/auth-server').authServer();
var Schema = mongoose.Schema
, ObjectId = Schema.ObjectId;
View
4 views/chat.jade
@@ -55,9 +55,9 @@
button(id="helpful") Yes!
button(id="notHelpful") No
div#loggedInAs
- Currently logged in as...
+ Your username:
span#currentUser
- b Logged in as
+ b
script

0 comments on commit 92b5c9f

Please sign in to comment.