add LICENSE and COPYING; fix workaround for plantuml
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"host" : "localhost",
|
||||
"user" : "root",
|
||||
"port" : 8654,
|
||||
"password" : "ert456",
|
||||
"database" : "safechat",
|
||||
"max_allowed_packet": 1000000000
|
||||
}
|
@@ -1,13 +1,11 @@
|
||||
module.exports = function() {
|
||||
var mysql = require('mysql');
|
||||
var fs = require('fs');
|
||||
var config = require(__dirname+'/config.json');
|
||||
config.multipleStatements = true;
|
||||
var pool = mysql.createPool(config);
|
||||
|
||||
pool.query(fs.readFileSync(__dirname+'/schema.sql').toString());
|
||||
if (config.max_allowed_packet)
|
||||
pool.query("set global max_allowed_packet=?", [config.max_allowed_packet]);
|
||||
|
||||
return pool;
|
||||
module.exports = function(config) {
|
||||
var mysql = require('mysql');
|
||||
var fs = require('fs');
|
||||
config.multipleStatements = true;
|
||||
var pool = mysql.createPool(config);
|
||||
console.log(__dirname+'/schema.sql')
|
||||
pool.query(fs.readFileSync(__dirname+'/schema.sql').toString());
|
||||
if (config.max_allowed_packet)
|
||||
pool.query("set global max_allowed_packet=?", [config.max_allowed_packet]);
|
||||
return pool;
|
||||
};
|
||||
|
10
nodejs/etc/safechat.json
Normal file
10
nodejs/etc/safechat.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"mysql": {
|
||||
"host" : "localhost",
|
||||
"user" : "root",
|
||||
"port" : 8654,
|
||||
"password" : "ert456",
|
||||
"database" : "safechat",
|
||||
"max_allowed_packet": 1000000000
|
||||
}
|
||||
}
|
@@ -1,12 +1,29 @@
|
||||
{
|
||||
"name": "@PACKAGE_NAME@",
|
||||
"version": "@PACKAGE_VERSION@",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"express": "2.5.8",
|
||||
"stylus": ">= 0.0.1",
|
||||
"ejs": ">= 0.0.1",
|
||||
"mysql": "~2.10.2",
|
||||
"socket.io": "~1.4.4"
|
||||
}
|
||||
"name": "@PACKAGE_NAME@",
|
||||
"version": "@PACKAGE_VERSION@",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"express": "2.5.8",
|
||||
"stylus": ">= 0.0.1",
|
||||
"ejs": ">= 0.0.1",
|
||||
"mysql": "~2.10.2",
|
||||
"socket.io": "~1.4.4"
|
||||
},
|
||||
"description": "@DESCRIPTION@",
|
||||
"main": "@PACKAGE_NAME@.js",
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "@AUTHOR@",
|
||||
"license": "@LICENSE@",
|
||||
"path": {
|
||||
"prefix": "@PREFIX@",
|
||||
"sysconf": "@SYSCONFDIR@",
|
||||
"pkgdata": "@PKGDATADIR@",
|
||||
"localstate": "@LOCALSTATEDIR@",
|
||||
"log": "@LOCALSTATEDIR@/log/@PACKAGE_NAME@.log",
|
||||
"config": "@SYSCONFDIR@/@PACKAGE_NAME@.json",
|
||||
"nodejs": "@PKGDATADIR@/nodejs"
|
||||
}
|
||||
}
|
||||
|
@@ -657,7 +657,9 @@ function sendmessage(recv, txt) {
|
||||
privkey.decrypt(password); // get own private key ready
|
||||
var message = JSON.stringify({receiver: recv, text: txt, files: filecontent});
|
||||
notice("2/3 encrypting message …");
|
||||
openpgp.signAndEncryptMessage(key.keys.concat(publicKey().keys), privkey, message)
|
||||
openpgp.signAndEncryptMessage(key.keys.concat(publicKey().keys),
|
||||
privkey,
|
||||
message)
|
||||
.then(function(msg) { // message is encrypted
|
||||
notice("3/3 sending message …");
|
||||
emit("message", {user: userid(), content: msg});
|
||||
|
@@ -5,12 +5,26 @@
|
||||
var express = require('express'),
|
||||
routes = require(__dirname+'/routes');
|
||||
|
||||
var package = require(__dirname+'/package.json');
|
||||
var config = require(package.path.config);
|
||||
var app = module.exports = express.createServer();
|
||||
var io = require('socket.io').listen(app);
|
||||
var sql = require(__dirname+'/database')();
|
||||
var sql = require(__dirname+'/database')(config.mysql);
|
||||
var sockets = require(__dirname+'/sockets')(sql);
|
||||
|
||||
// Configuration
|
||||
process.argv.forEach(function(val, index) {
|
||||
if (index<2) {return}
|
||||
if (index!=2 || isNaN(val)) {
|
||||
console.log("**** ERROR: Unexpected Argument - allowed is only a port number");
|
||||
process.exit(1);
|
||||
}
|
||||
config.port = parseInt(val);
|
||||
});
|
||||
if (typeof config.port != 'number') {
|
||||
console.log("**** WARNING: no valid port given, defaults to 8888");
|
||||
config.port = 8888;
|
||||
}
|
||||
|
||||
app.configure(function(){
|
||||
app.set('views', __dirname + '/views');
|
||||
@@ -38,6 +52,6 @@ io.sockets.on('connection', sockets.connection);
|
||||
|
||||
app.get('/', routes.index);
|
||||
|
||||
app.listen(8888, function(){
|
||||
app.listen(config.port, function(){
|
||||
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
|
||||
});
|
||||
|
Reference in New Issue
Block a user