GithubHelp home page GithubHelp logo

anthrax3 / messenger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from totaljs/messenger

0.0 0.0 0.0 116 KB

Node.js Open-Source Slack alternative

License: MIT License

JavaScript 51.21% CSS 16.91% HTML 31.88%

messenger's Introduction

MIT License

Support

Installation

First start

  • set up configuration file /config
  • run $ node debug.js (development) or $ node release.js (production)
  • open http://127.0.0.1:8000/
  • sign in user: [email protected], password: 123456 (credentials are stored in /databases/users.json)

How do I translate Messenger?

  • install Total.js as global module npm install -g total.js
  • then open Messenger directory cd messenger
  • then perform this command totaljs --translate
  • translate translated file translate.resource
  • and copy the content to /resources/default.resource
  • run app

How can I extend messenger independently?

Server-side

F.on('messenger.open', function(controller, client) {
    // open client
});

F.on('messenger.close', function(controller, client) {
    // disconnected client
});

F.on('messenger.data', function(controller, client, data) {
    // RAW data from websocket
    // data === OBJECT
});

F.on('messenger.message', function(controller, client, message) {
    // New message
    // message === OBJECT
});

// How to send a message?
options = {};

// REQUIRED
options.iduser = 'ID USER WHICH SENDS MESSAGE';
options.target = 'channel'; // or "user"
options.idtarget = 'idchannel' // or "iduser"
options.body = 'MARKDOWN MESSAGE'; // how to perform like? just send ":thumbs-up:" in body

// OPTIONAL
options.id = 'ID MESSAGE'; // for editing of an existing message
options.users = ['iduser1', 'iduser2']; // optional, which users can by notified? (works with channels only)
options.files = [{ name: 'filename', url: 'url to download' }]; // optional, (it serves for file browser only)

OPERATION('send', options, function(err, response) {
    console.log('DONE');
});

Client-side

ON('messager.ready', function() {
    // messenger is ready
});

ON('messenger.message', function(message) {
    // message === OBJECT
});

ON('messenger.send', function(message) {

});

// You can register unlimited count of workflows with same name
WORKFLOW('messenger.render', function(message) {
    // message.message  - instance of retrieved message
    // message.html     - rendered HTML (can be modified)
    
    // Example:
    message.html = message.html.replace(/\,/g, ' --- ');
});

// How to send a message to the server via WebSocket?
SETTER('websocket', 'send', OBJECT);

HTML Formatting

+v2.0.0. Administrators have disabled xss protection, so each admin can inject a raw HTML into the markdown directly, example:

Only administrators can inject HTML directly via:

\```xss
 <b>THIS WILL BE BOLDED</b>
\```

Contributors

messenger's People

Contributors

petersirka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.