diff options
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | CHANGELOG.md | 12 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | app.js | 29 | ||||
-rw-r--r-- | app/config.js | 3 | ||||
-rw-r--r-- | app/controllers/files.js | 3 | ||||
-rw-r--r-- | app/controllers/messages.js | 4 | ||||
-rw-r--r-- | app/middlewares/cleanupFiles.js | 18 | ||||
-rw-r--r-- | defaults.yml | 2 | ||||
-rw-r--r-- | docker/Dockerfile | 4 | ||||
-rw-r--r-- | locales/it.json | 84 | ||||
-rw-r--r-- | media/js/util/message.js | 4 | ||||
-rw-r--r-- | migroose.js | 34 | ||||
-rw-r--r-- | migrootions/1421181022156-drop-sessions.js | 8 | ||||
-rw-r--r-- | migrootions/1421181064775-rooms.js | 57 | ||||
-rw-r--r-- | migrootions/1421183479874-users.js | 73 | ||||
-rw-r--r-- | migrootions/1432313365109-private-rooms.js | 13 | ||||
-rw-r--r-- | package.json | 46 |
18 files changed, 146 insertions, 256 deletions
diff --git a/.travis.yml b/.travis.yml index 2bfe894..0eeaa5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,7 @@ sudo: false language: node_js node_js: - - "0.10" - - "0.12" - - "4.0" - - "4.1" - - "4.2" + - node env: - CXX="g++-4.8" diff --git a/CHANGELOG.md b/CHANGELOG.md index 375f4f5..4acd179 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 0.4.7 (2016-5-10) + +Fixes + +* Update dependencies +* Chrome display issues +* CSP warning + +Enhancements + +* Azerbaijani, Turkish language packs + ## 0.4.6 (2016-1-22) Fixes @@ -37,7 +37,7 @@ For installation instructions, please use the following links: * [Docker][install-docker] * [Heroku][install-heroku] * [Vagrant][install-vagrant] -* [Cloudron](https://github.com/cloudron-io/lets-chat/wiki/Cloudron) +* [Cloudron](https://github.com/cloudron-io/letschat-app/blob/master/README.md) ## Support & Problems @@ -20,7 +20,6 @@ var _ = require('lodash'), http = require('http'), nunjucks = require('nunjucks'), mongoose = require('mongoose'), - migroose = require('./migroose'), connectMongo = require('connect-mongo/es5'), all = require('require-tree'), psjon = require('./package.json'), @@ -42,7 +41,8 @@ var MongoStore = connectMongo(express.session), if (httpsEnabled) { app = express().https({ key: fs.readFileSync(settings.https.key), - cert: fs.readFileSync(settings.https.cert) + cert: fs.readFileSync(settings.https.cert), + passphrase: settings.https.passphrase }).io(); } else { app = express().http().io(); @@ -148,8 +148,9 @@ nun.addGlobal('text_search', false); // i18n i18n.configure({ - directory: __dirname + '/locales', - defaultLocale: settings.i18n && settings.i18n.locale || 'en' + directory: path.resolve(__dirname, './locales'), + locales: settings.i18n.locales || settings.i18n.locale, + defaultLocale: settings.i18n.locale }); app.use(i18n.init); @@ -265,23 +266,5 @@ mongoose.connect(settings.database.uri, function(err) { } checkForMongoTextSearch(); - - migroose.needsMigration(function(err, migrationRequired) { - if (err) { - console.error(err); - } - - else if (migrationRequired) { - console.log('Database migration required'.red); - console.log('Ensure you backup your database first.'); - console.log(''); - console.log( - 'Run the following command: ' + 'npm run migrate'.yellow - ); - - return process.exit(); - } - - startApp(); - }); + startApp(); }); diff --git a/app/config.js b/app/config.js index 8279207..f3ed36e 100644 --- a/app/config.js +++ b/app/config.js @@ -156,6 +156,9 @@ var pipeline = [ if (process.env.MONGOLAB_URI) { context.result.database.uri = process.env.MONGOLAB_URI; } + if (process.env.MONGODB_URI) { + context.result.database.uri = process.env.MONGODB_URI; + } }, function openShift(context) { diff --git a/app/controllers/files.js b/app/controllers/files.js index c46e93a..13b3007 100644 --- a/app/controllers/files.js +++ b/app/controllers/files.js @@ -69,7 +69,8 @@ module.exports = function() { if (settings.provider === 'local') {
res.sendFile(url, {
headers: {
- 'Content-Type': file.type
+ 'Content-Type': file.type, + 'Content-Disposition': 'attachment' }
});
} else {
diff --git a/app/controllers/messages.js b/app/controllers/messages.js index 670b5c8..68e7748 100644 --- a/app/controllers/messages.js +++ b/app/controllers/messages.js @@ -71,8 +71,8 @@ module.exports = function() { to: req.param('to'),
query: req.param('query'),
reverse: req.param('reverse'),
- skip: req.param('skip'),
- take: req.param('take'),
+ skip: parseInt(req.param('skip')),
+ take: parseInt(req.param('take')),
expand: req.param('expand')
};
diff --git a/app/middlewares/cleanupFiles.js b/app/middlewares/cleanupFiles.js index 437b8df..327569a 100644 --- a/app/middlewares/cleanupFiles.js +++ b/app/middlewares/cleanupFiles.js @@ -17,15 +17,17 @@ function cleanupReqFiles(req, cb) { async.each(files, function(file, callback) { fs.stat(file.path, function(err, stats) { - if (!err && stats.isFile()) { - fs.unlink(file.path, function(e) { - if (e) { - console.error(e); - } - - callback(); - }); + if (err || !stats.isFile()) { + return callback(); } + + fs.unlink(file.path, function(e) { + if (e) { + console.error(e); + } + + callback(); + }); }); }); } diff --git a/defaults.yml b/defaults.yml index d28c367..b91c9b4 100644 --- a/defaults.yml +++ b/defaults.yml @@ -74,4 +74,4 @@ rooms: private: false i18n: - locale: en
\ No newline at end of file + locale: en diff --git a/docker/Dockerfile b/docker/Dockerfile index 6ad0054..3f732a0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -30,7 +30,9 @@ RUN tar -xzvf master.tar.gz \ RUN groupadd -r node \ && useradd -r -g node node \ -&& chown node:node uploads +&& chown node:node uploads \ +&& mkdir -p builtAssets \ +&& chown node:node builtAssets ENV LCB_DATABASE_URI=mongodb://mongo/letschat \ LCB_HTTP_HOST=0.0.0.0 \ diff --git a/locales/it.json b/locales/it.json new file mode 100644 index 0000000..3ad3d1c --- /dev/null +++ b/locales/it.json @@ -0,0 +1,84 @@ +{ + "Sign In": "Entra", + "Sign in": "Entra", + "Username or Email": "Nome utente o Email", + "Password": "Password", + "I need an account": "Voglio un account", + "Register": "Registrazione", + "Username": "Nome utente", + "Email": "Email", + "Display Name": "Nome Visualizzato", + "First Name": "Nome", + "Last Name": "Cognome", + "Confirm Password": "Conferma la Password", + "I already have an account": "Ho già un account", + "From Toronto with Love": "Da Toronto con Ammmore", + "Photos by %s and Friends": "Foto di %s e Amici", + "Fork me on GitHub": "Fork me on GitHub", + "Edit Profile": "Modifica Profilo", + "Account Settings": "Impostazioni Account", + "Notifications": "Notifiche", + "Auth Tokens": "Token di autorizzazione", + "Logout": "Esci", + "Disconnected": "Disconnesso", + "Connected": "Connesso", + "All Rooms": "Tutte le stanze", + "Loading": "Caricamento", + "New Password": "Nuova Password", + "Confirm New Password": "Conferma la Nuova Password", + "Current Password": "Password Attuale", + "Required": "Dato obbligatorio", + "Save": "Salva", + "This room requires password to enter": "Questa stanza necessita di una password per entrare", + "Edit Room": "Modifica Stanza", + "Chat History": "Storia della Chat", + "Upload Files": "Carica Files", + "Giphy": "Giphy", + "Got something to say?": "Qualcosa da dire?", + "Send": "Invia", + "Who's Here": "Chi c'è", + "Files": "Files", + "Name": "Nome", + "Description": "Descrizione", + "Participants": "Partecipante", + "Archive Room": "Stanza Archivio", + "Password required": "Password necessaria", + "Room %s requires a password.": "La Stanza %s richiede una password.", + "Cancel": "Annulla", + "Enter": "Enter", + "Desktop Notifications are": "Le Notifiche Desktop sono", + "enabled": "abilitato", + "Use your browser settings to disable them": "Usa le impostazioni del browser per disabilitarle", + "Enable Desktop Notifications": "Abilita Notifiche Desktop", + "blocked": "bloccato", + "Please check your browser settings": "Controlla le impostazioni del browser", + "Profile Settings": "Impostazioni Profilo", + "XMPP/Jabber Connection Details": "Dettagli Connessione XMPP/Jabber", + "Connection Details": "Dettagli Connessione", + "Host": "Host", + "Port": "Porta", + "Conference Host": "Host Conferenze", + "Supported Clients": "Client Supportati", + "Desktop": "Desktop", + "Search": "Cerca", + "Upload": "Carica", + "Select Files": "Seleziona i File", + "Room": "Stanza", + "Post in room?": "Scrivere nella stanza?", + "Authentication tokens": "Token di autenticazione", + "Auth tokens are used to access the Let's Chat API.": "I token di autenticazione sono usati per accedere alle API di Let's Chat.", + "Generate token": "Genera token", + "Revoke token": "Revoca token", + "Your generated token is below. It will not be shown again.": "Il tuo token generato è qui sotto e non sarà mostrato un'altra volta.", + "Add Room": "Aggiungi stanza", + "Slug": "Slug", + "XMPP/Jabber": "XMPP/Jabber", + "Private?": "Privata?", + "Empty for public room": "Lascia vuoto per stanza pubblica", + "Toggle Navigation": "Nascondi/mostra Navigazione", + "Home": "Home", + "Toggle Sidebar": "Nascondi/mostra Sidebar", + "Close": "Chiudi", + "Transcript for": "Transcript for", + "Find a room...": "Trova una stanza..." +}
\ No newline at end of file diff --git a/media/js/util/message.js b/media/js/util/message.js index 8ed4d8d..8fcfb38 100644 --- a/media/js/util/message.js +++ b/media/js/util/message.js @@ -38,10 +38,6 @@ if (typeof exports !== 'undefined') { return part.length; }); - if (parts.length) { - parts.splice(parts.length - 1, 1); - } - var path = window.location.origin; if (parts.length) { diff --git a/migroose.js b/migroose.js deleted file mode 100644 index e27f9ba..0000000 --- a/migroose.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -var mongoose = require('mongoose'), - settings = require('./app/config'), - migroose = require('migroose'), - Runner = require('migroose-cli/cli/runner/index'); - -var MigrationModel = migroose.MigrationModel; - -module.exports = { - connect: function(cb){ - mongoose.connect(settings.database.uri, function(err){ - if (err) { throw err; } - cb(); - }); - }, - - needsMigration: function(cb) { - var runner = new Runner(process.cwd(), 'migrootions'); - var migrations = runner.getMigrations(); - var lastMigration = migrations.slice(migrations.length - 1)[0]; - MigrationModel.findOne({migrationId: lastMigration.migrationId}, function(err, model) { - if (err) { - return cb(err); - } - - if (model) { - cb(null, false); - } else { - cb(null, true); - } - }); - } -}; diff --git a/migrootions/1421181022156-drop-sessions.js b/migrootions/1421181022156-drop-sessions.js deleted file mode 100644 index 5a6ae3a..0000000 --- a/migrootions/1421181022156-drop-sessions.js +++ /dev/null @@ -1,8 +0,0 @@ -var Migroose = require('migroose');
-var migration = new Migroose.Migration('1421181022156-drop-sessions');
-
-migration.remove({
- sessions: 'sessions'
-});
-
-module.exports = migration;
diff --git a/migrootions/1421181064775-rooms.js b/migrootions/1421181064775-rooms.js deleted file mode 100644 index f7912e8..0000000 --- a/migrootions/1421181064775-rooms.js +++ /dev/null @@ -1,57 +0,0 @@ -var Migroose = require('migroose');
-var async = require('async');
-var Room = require('./../app/models/room');
-var migration = new Migroose.Migration('1421181064775-add-room-slugs');
-
-migration.load({
- rooms: {
- collection: 'rooms',
- query: {
- slug: {$exists: false }
- }
- }
-});
-
-migration.step(function(data, stepComplete) {
-
- function getSlug(name) {
- return name.trim()
- .toLowerCase()
- .replace(/[\W\&]+/ig, '_')
- .replace(/_+/ig, '_')
- .replace(/^_+/ig, '')
- .replace(/_+$/ig, '');
- }
-
- function updateDoc(item, callback) {
- if (item.slug) {
- return callback();
- }
-
- Room.findById(item._id, function(err, doc) {
- if (err) {
- console.error(err);
- return callback(err);
- }
-
- doc.slug = getSlug(doc.name);
-
-
- // TODO: Need to handle conflict
- doc.save(function(err) {
- if (err) {
- console.error(err);
- return callback(err);
- }
-
- callback();
- });
- });
- }
-
- async.each(data.rooms.documents, updateDoc, function(err) {
- stepComplete(err);
- });
-});
-
-module.exports = migration;
diff --git a/migrootions/1421183479874-users.js b/migrootions/1421183479874-users.js deleted file mode 100644 index fe86498..0000000 --- a/migrootions/1421183479874-users.js +++ /dev/null @@ -1,73 +0,0 @@ -var Migroose = require('migroose');
-var async = require('async');
-var User = require('./../app/models/user');
-var migration = new Migroose.Migration('1421183479874-users');
-
-migration.load({
- external_users: {
- collection: 'users',
- query: { uid: { $exists: true } }
- },
- local_users: {
- collection: 'users',
- query: { uid: { $exists: false } }
- }
-});
-
-migration.step(function(data, stepComplete) {
-
- function getUsername(displayName) {
- return displayName.trim()
- .toLowerCase()
- .replace(/[\W\&]+/ig, '_')
- .replace(/_+/ig, '_')
- .replace(/^_+/ig, '')
- .replace(/_+$/ig, '');
- }
-
- function updateDoc(item, callback) {
- User.findById(item._id, function(err, doc) {
- if (err) {
- console.error(err);
- return callback(err);
- }
-
- if (doc.uid) {
-
- if (!doc.provider) {
- doc.provider = 'kerberos';
- }
- if (!doc.username) {
- doc.username = doc.uid;
- }
-
- } else {
-
- if (!doc.provider) {
- doc.provider = 'local';
- }
- if (!doc.username) {
- doc.username = getUsername(doc.displayName);
- }
- }
-
- // TODO: Need to handle conflict
- doc.save(function(err) {
- if (err) {
- console.error(err);
- return callback(err);
- }
-
- callback();
- });
- });
- }
-
- var users = data.external_users.documents.concat(data.local_users.documents);
-
- async.each(users, updateDoc, function(err) {
- stepComplete(err);
- });
-});
-
-module.exports = migration;
diff --git a/migrootions/1432313365109-private-rooms.js b/migrootions/1432313365109-private-rooms.js deleted file mode 100644 index bcf5ba1..0000000 --- a/migrootions/1432313365109-private-rooms.js +++ /dev/null @@ -1,13 +0,0 @@ -var Migroose = require('migroose');
-var Room = require('./../app/models/room');
-var migration = new Migroose.Migration('1432313365109-private-rooms');
-
-migration.step(function(data, stepComplete) {
- var query = { password: { $exists: true, $nin: [ '', null ] }};
-
- Room.update(query, { private: true }, { multi: true}, function(err) {
- stepComplete(err);
- })
-});
-
-module.exports = migration;
diff --git a/package.json b/package.json index 28396b6..f9f6a56 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,12 @@ { "name": "lets-chat", - "version": "0.4.6", + "version": "0.4.7", "description": "A chat app for small teams.", "license": "MIT", "main": "app.js", "scripts": { "start": "node app.js", "stop": "pkill --signal SIGINT letschat", - "prestart": "migroose", - "migrate": "migroose", "test": "eslint ." }, "engine": { @@ -62,45 +60,43 @@ }, "homepage": "https://github.com/sdelements/lets-chat", "dependencies": { - "async": "^2.0.0-rc.2", + "async": "^2.0.0", "bcryptjs": "^2.3.0", - "body-parser": "^1.14.0", + "body-parser": "^1.15.2", "colors": "~1.1.2", - "compression": "^1.5.2", - "connect-assets": "^5.0.1", - "connect-mongo": "^1.1.0", - "cookie-parser": "^1.4.0", - "express.oi": "0.0.20", - "helmet": "^2.0.0", - "i18n": "^0.8.1", - "js-yaml": "^3.4.2", - "less": "^2.5.1", - "lodash": "^4.7.0", - "md5": "^2.0.0", - "migroose": "^0.5.0", - "migroose-cli": "^0.1.0", - "moment": "^2.12.0", - "mongoose": "^4.4.11", + "compression": "^1.6.2", + "connect-assets": "^5.3.0", + "connect-mongo": "^1.2.1", + "cookie-parser": "^1.4.3", + "express.oi": "0.0.21", + "helmet": "^2.1.1", + "i18n": "^0.8.3", + "js-yaml": "^3.6.1", + "less": "^2.7.1", + "lodash": "^4.13.1", + "md5": "^2.1.0", + "moment": "^2.14.1", + "mongoose": "^4.5.5", "mongoose-unique-validator": "^1.0.2", "mongoose-validate": "0.0.5", "multer": "^1.1.0", "node-uuid": "^1.4.7", - "node-xmpp-server": "^2.1.2", + "node-xmpp-server": "^2.2.0", "node_hash": "^0.2.0", - "nunjucks": "^2.4.1", + "nunjucks": "^2.4.2", "on-finished": "^2.3.0", "passport": "^0.3.2", "passport-http": "0.3.0", "passport-http-bearer": "1.0.1", "passport-local": "1.0.0", - "passport.socketio": "3.6.1", + "passport.socketio": "3.6.2", "require-directory": "~2.1.1", "require-tree": "^1.1.1" }, "devDependencies": { - "eslint": "^2.6.0", + "eslint": "^3.1.1", "grunt": "~0.4.5", - "grunt-bower": "^0.21.0", + "grunt-bower": "^0.21.2", "grunt-bower-task": "~0.4.0" } } |