mondediefr / mondedie-chat Goto Github PK
View Code? Open in Web Editor NEWNode.js chat application using Express, Socket.io, Redis and Mithril
Home Page: https://chat.mondedie.fr
License: Apache License 2.0
Node.js chat application using Express, Socket.io, Redis and Mithril
Home Page: https://chat.mondedie.fr
License: Apache License 2.0
Changer la phrase : Je n'utilise pas le mode AFK vu je peux être à plusieurs endroits en même temps
par : Je n'utilise pas le mode AFK puisque je suis doué d'ubiquité.
Mouais, ca tape dans les serveurs de fb...
Cas ou sur npm y'a aussi un lock avec la commande npm shrinkwrap
.
A chaque fois que l'on recharge la page les options sont perdu.
Il faudrait ajouter des cookies pour conserver les réglages.
Mettre en place un système de déploiement avec docker / docker compose / docker hub automated builds :
http://mherman.org/blog/2015/03/06/node-with-docker-continuous-integration-and-delivery/
http://anandmanisankar.com/posts/docker-container-nginx-node-redis-example/
https://docs.docker.com/docker-hub/builds/
Proposition pour intégrer le chat sur un forum (flarum, fluxbb)
Exemple : https://sidecar.gitter.im/
Il serait bien de bien séparer le backend du front end afin de pouvoir faire différent clients et d'utiliser une API. Quand pensez vous ?
Hello,
Après l'installation, j'ai cette erreur sur la page web : une idée ?
Error: ENOENT: no such file or directory, open '/home/sites/chat.oreox.fr/mondedie-chat/views/includes/build/css.pug' at /home/sites/chat.oreox.fr/mondedie-chat/views/layout.pug line 13 at Object.fs.openSync (fs.js:667:18) at Object.fs.readFileSync (fs.js:572:33) at Function.read (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-load/index.js:69:13) at Object.read (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug/lib/index.js:141:25) at /home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-load/index.js:24:25 at walkAST (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:21:18) at /home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:98:20 at Array.reduce (<anonymous>) at walkAndMergeNodes (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:97:18) at walkAST (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:35:19) at walkAST (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:46:21) at /home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:98:20 at Array.reduce (<anonymous>) at walkAndMergeNodes (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:97:18) at walkAST (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:35:19) at walkAST (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:46:21) at /home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:98:20 at Array.reduce (<anonymous>) at walkAndMergeNodes (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:97:18) at walkAST (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-walk/index.js:35:19) at load (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-load/index.js:13:10) at Function.loadString [as string] (/home/sites/chat.oreox.fr/mondedie-chat/node_modules/pug-load/index.js:46:10)
Je propose de formater la date par rapport à l'instant présent.
http://momentjs.com/docs/#/displaying/from/
il y a 1 min, c'est plus intuitif pour les discussions instantanée.
Ensuite mettre la date à coté de la croix delete?
Ajouter un bouton permettant de switcher entre 2 thèmes, un clair et un sombre.
Commande permettant d'ignorer une personne. Exemple :
/ignore @user
Parfois la liste des utilisateurs connectés apparaît en double (voir plus). Je pense que ça vient du fait que le listener sur l'événement user_connected est enregistré une deuxième fois pour une raison que je ne maîtrise pas (problème réseau, déco/reco du chat suite à un push...etc).
socket.on('user_connected', function(user) {
vm.list.push(new users.User(user));
m.redraw();
});
Je viens d'en avoir un à l'instant :
2015-12-06T09:42:39 heroku router - - at=error code=H13 desc="Connection closed without response" method=GET path="/socket.io/?EIO=3&transport=websocket&sid=3bKAS4OKWTP1aYl5AABP" host=chat.mondedie.fr wd="88.xxx.xxx.xxx" dyno=web.1 connect=0ms service=1ms status=503 bytes=0
Moimeme semble avoir eu un petit soucis réseau, le socket semble avoir été ouvert 4 fois à la suite, peut-être que ça peut expliquer que l'event soit registered 4 fois aussi, je sais pas quoi en déduire. A méditer.
Pour identifier un mp réel d'un mp fictif...
Voir :
http://v4-alpha.getbootstrap.com/layout/overview/
http://v4-alpha.getbootstrap.com/layout/responsive-utilities/
https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss#L89-L100
Je n'arrive pas a installer le chat en suivant la procédure d'install manuelle décrite sur le github :
user@XXXX:~/chat/mondedie-chat# npm install -g bower gulp pm2
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN optional dep failed, continuing [email protected]
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp/bin/gulp.js
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
/usr/local/bin/pm2 -> /usr/local/lib/node_modules/pm2/bin/pm2
/usr/local/bin/pm2-dev -> /usr/local/lib/node_modules/pm2/bin/pm2-dev
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
[email protected] /usr/local/lib/node_modules/gulp
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
âââ [email protected]
âââ [email protected] ([email protected], [email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] /usr/local/lib/node_modules/pm2
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected] ([email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected], [email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected]
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected] ([email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
âââ [email protected] ([email protected])
âââ [email protected]
[email protected] /usr/local/lib/node_modules/bower
user@XXXX:~/chat/mondedie-chat# npm install
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please use gulp-clean-css
npm WARN engine [email protected]: wanted: {"node":">=0.12.0"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12.0"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12.0"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN engine [email protected]: wanted: {"node":">=0.10.32"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
\
[email protected] postinstall /root/chat/mondedie-chat/node_modules/gulp-sass/node_modules/node-sass/node_modules/cross-spawn/node_modules/spawn-sync
node postinstall
sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/root/chat/mondedie-chat/node_modules/gulp-sass/node_modules/node-sass/node_modules/sass-graph/node_modules/lodash'
npm ERR! error rolling back [email protected] { [Error: ENOTEMPTY, rmdir '/root/chat/mondedie-chat/node_modules/gulp-sass/node_modules/node-sass/node_modules/sass-graph/node_modules/lodash']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: '/root/chat/mondedie-chat/node_modules/gulp-sass/node_modules/node-sass/node_modules/sass-graph/node_modules/lodash' }
npm ERR! tar.unpack untar error /root/.npm/lodash/4.11.1/package.tgz
npm ERR! [email protected] postinstall: node postinstall
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.4.6-docker-6
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /root/chat/mondedie-chat
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! tar.unpack untar error /root/.npm/node-gyp/3.3.1/package.tgz
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/chat/mondedie-chat/npm-debug.log
npm ERR! not ok code 0
Implémenter une déconnexion préventive du socket dans les cas suivants :
1 - L'utilisateur se connecte depuis un autre PC/mobile
2 - L'utilisateur n'est plus dans la liste des membres connectés
3 - L'utilisateur ne possède pas de profil dans Redis
Pour les points 2 et 3, la vérification peut se faire pendant le Heartbeat toutes les 50 secondes.
Pour les modérateurs :
Depuis ce commit df5d6cf vagrant ne fonctionne plus
Error: secret option required for sessions
at session (/home/vagrant/mondedie-chat/node_modules/express-session/index.js:167:12)
at Layer.handle [as handle_request] (/home/vagrant/mondedie-chat/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:312:13)
at /home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:330:12)
at next (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:271:10)
at cookieParser (/home/vagrant/mondedie-chat/node_modules/cookie-parser/index.js:54:14)
at Layer.handle [as handle_request] (/home/vagrant/mondedie-chat/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:312:13)
at /home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:330:12)
at next (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:271:10)
at /home/vagrant/mondedie-chat/node_modules/express-validator/lib/express_validator.js:228:5
at Layer.handle [as handle_request] (/home/vagrant/mondedie-chat/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:312:13)
at /home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:330:12)
at next (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:271:10)
at urlencodedParser (/home/vagrant/mondedie-chat/node_modules/body-parser/lib/types/urlencoded.js:88:40)
at Layer.handle [as handle_request] (/home/vagrant/mondedie-chat/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:312:13)
at /home/vagrant/mondedie-chat/node_modules/express/lib/router/index.js:280:7
17 Nov 2015 07:51:20.534 app web.1 - - { [Error: ENOENT, no such file or directory '.env'] errno: -2, code: 'ENOENT', path: '.env', syscall: 'open' }
Le fichier .env est inutile sur heroku, il n'est utilisé qu'en environnement de développement par foreman ou vagrant, il faudra penser à spécifier le module dotenv en dépendance de dev et de mettre une condition avant le require dans app.js
Rien d'autre à dire, une modification s'impose !
Petite note pour pas que j'oublie, le système de template Jade a été renommé, maintenant c'est Pug : https://github.com/pugjs/pug
Liste des incompatibilités potentielles : pugjs/pug#2305
Pour l'instant on peut pas faire la mise à jour à cause de gulp-inject : klei/gulp-inject#181 Mais ça presse pas, Pug est encore en alpa pour le moment.
I followed the build instructions.
location:
/var/www/flarum/chat
I created a .env
file in /var/www/flarum/chat
I pasted the ENV as instructed on README
I create my own cookie and session unique password
When I try to login I get:
Erreur 500
secret option required for sessions
Error: secret option required for sessions
at session (/var/www/keysndaggers/chat/node_modules/express-session/index.js:199:12)
at Layer.handle [as handle_request] (/var/www/keysndaggers/chat/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:312:13)
at /var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:330:12)
at next (/var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:271:10)
at cookieParser (/var/www/keysndaggers/chat/node_modules/cookie-parser/index.js:70:5)
at Layer.handle [as handle_request] (/var/www/keysndaggers/chat/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:312:13)
at /var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:330:12)
at next (/var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:271:10)
at /var/www/keysndaggers/chat/node_modules/express-validator/lib/express_validator.js:351:5
at Layer.handle [as handle_request] (/var/www/keysndaggers/chat/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:312:13)
at /var/www/keysndaggers/chat/node_modules/express/lib/router/index.js:280:7
This is my Nginx config:
server {
listen 443;
server_name chat.keys-daggers.org;
include snippets/snakeoil.conf;
include snippets/ssl-params.conf;
ssl on;
add_header Strict-Transport-Security max-age=500;
location / {
proxy_pass http://127.0.0.1:5000; #private ip
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location ~* \.(eot|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types application/atom+xml
application/javascript
application/json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
}
This is my Nginx error:
[error] 3927#3927: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.22.2, server: chat.keys-daggers.org, request: "GET /var/www/keysndaggers/chat/node_modules/express-session/index.js HTTP/2.0", upstream: "http://127.0.0.1:5000/var/www/keysndaggers/chat/node_modules/express-session/index.js", host: "chat.keys-daggers.org"
May you please help?
J'ai bien ajouté et configuré les variables PIWIK_ID
et PIWIK_URL
mais aucun tracking n'est activé. Je constate la même chose sur chat.mondedie.fr, mais je ne sais pas si c'est volontaire.
Note: Faire en sorte de cacher les commandes pour les utilisateurs
Liste des commandes à rajouter:
/kick @user
seulement modérateur/unban @user
seulement modérateur/ban list
seulement modérateur/unlock @user
seulement modérateur/me
à tousCertaine personne disparaisse de la liste des utilisateurs quand ils ont une connexion avec un loadbalancing. Il y a une solution pour corriger ça de notre coté ?
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})
(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'XXXX', 'YYYY');
ga('send', 'pageview');
il faudrait ajouter XXXX et YYYY dans le fichier env
Lorsque le texte du message est long, il se superpose avec le bouton de suppression.
Permettant de décrire une action.
Pouvoir faire /afk
pour mettre le status afk et l'enlever.
plutôt que /afk on
et /afk off
We want to use /pizza for order a domino's pizza ❤️
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.