├── .env ├── server ├── models │ ├── privkey.js │ ├── membership.js │ ├── privatechat.js │ └── keyid.js ├── js │ ├── managers │ │ ├── membership.js │ │ └── authentication.js │ └── database.js └── routes │ ├── membership.js │ ├── user.js │ ├── auth.js │ └── client.js ├── .jslintrc ├── .eslintignore ├── .bowerrc ├── config ├── http.js ├── database.js ├── markdown.js ├── logger.js └── pipo.js ├── client ├── js │ ├── components │ │ ├── js-md5 │ │ │ ├── .covignore │ │ │ ├── .gitignore │ │ │ ├── bower.json │ │ │ ├── doc │ │ │ │ ├── fonts │ │ │ │ │ ├── OpenSans-Bold-webfont.eot │ │ │ │ │ ├── OpenSans-Bold-webfont.woff │ │ │ │ │ ├── OpenSans-Light-webfont.eot │ │ │ │ │ ├── OpenSans-Italic-webfont.eot │ │ │ │ │ ├── OpenSans-Italic-webfont.woff │ │ │ │ │ ├── OpenSans-Light-webfont.woff │ │ │ │ │ ├── OpenSans-Regular-webfont.eot │ │ │ │ │ ├── OpenSans-BoldItalic-webfont.eot │ │ │ │ │ ├── OpenSans-Regular-webfont.woff │ │ │ │ │ ├── OpenSans-BoldItalic-webfont.woff │ │ │ │ │ ├── OpenSans-LightItalic-webfont.eot │ │ │ │ │ └── OpenSans-LightItalic-webfont.woff │ │ │ │ ├── scripts │ │ │ │ │ ├── linenumber.js │ │ │ │ │ └── prettify │ │ │ │ │ │ └── lang-css.js │ │ │ │ └── styles │ │ │ │ │ └── prettify-jsdoc.css │ │ │ ├── .travis.yml │ │ │ ├── .bower.json │ │ │ ├── CHANGELOG.md │ │ │ ├── LICENSE.txt │ │ │ └── package.json │ │ ├── binaryjs │ │ │ ├── .travis.yml │ │ │ ├── examples │ │ │ │ ├── helloworld │ │ │ │ │ ├── flower.png │ │ │ │ │ ├── README.md │ │ │ │ │ ├── server.js │ │ │ │ │ └── index.html │ │ │ │ ├── fileupload │ │ │ │ │ ├── README.md │ │ │ │ │ ├── server.js │ │ │ │ │ └── public │ │ │ │ │ │ └── index.html │ │ │ │ ├── README.md │ │ │ │ └── imageshare │ │ │ │ │ ├── server.js │ │ │ │ │ └── public │ │ │ │ │ └── index.html │ │ │ ├── .gitignore │ │ │ ├── dist │ │ │ │ └── README.md │ │ │ ├── Makefile │ │ │ ├── doc │ │ │ │ └── README.md │ │ │ ├── .gitmodules │ │ │ ├── .bower.json │ │ │ ├── package.json │ │ │ ├── LICENSE │ │ │ ├── test │ │ │ │ ├── server.js │ │ │ │ └── stream.js │ │ │ ├── README.md │ │ │ └── lib │ │ │ │ ├── util.js │ │ │ │ ├── server.js │ │ │ │ └── client │ │ │ │ └── stream.js │ │ ├── async │ │ │ ├── mocha_test │ │ │ │ ├── support │ │ │ │ │ └── is_browser.js │ │ │ │ └── forever.js │ │ │ ├── karma.conf.js │ │ │ ├── component.json │ │ │ ├── Makefile │ │ │ ├── LICENSE │ │ │ ├── perf │ │ │ │ └── memory.js │ │ │ ├── bower.json │ │ │ ├── deps │ │ │ │ └── nodeunit.css │ │ │ ├── support │ │ │ │ └── sync-package-managers.js │ │ │ ├── .bower.json │ │ │ └── package.json │ │ ├── http │ │ │ ├── bower.json │ │ │ ├── package.json │ │ │ ├── readme.md │ │ │ └── .bower.json │ │ ├── https │ │ │ ├── bower.json │ │ │ ├── package.json │ │ │ ├── readme.md │ │ │ └── .bower.json │ │ ├── buffer │ │ │ ├── bower.json │ │ │ ├── package.json │ │ │ ├── readme.md │ │ │ └── .bower.json │ │ ├── crypto │ │ │ ├── bower.json │ │ │ ├── package.json │ │ │ ├── readme.md │ │ │ └── .bower.json │ │ ├── querystring │ │ │ ├── bower.json │ │ │ ├── package.json │ │ │ ├── readme.md │ │ │ ├── .bower.json │ │ │ └── querystring.min.js │ │ ├── base64 │ │ │ ├── bower.json │ │ │ ├── LICENSE │ │ │ ├── package.json │ │ │ ├── base64.min.js │ │ │ ├── .bower.json │ │ │ ├── README.md │ │ │ └── base64.js │ │ └── SparkMD5 │ │ │ ├── component.json │ │ │ ├── LICENSE │ │ │ ├── bower.json │ │ │ ├── package.json │ │ │ ├── .bower.json │ │ │ └── LICENSE2 │ ├── client │ │ └── index.js │ ├── users │ │ ├── masterUserlist.js │ │ └── user.js │ ├── utils.js │ ├── messaging │ │ └── serverCommand.js │ ├── network │ │ └── binSocketClient.js │ ├── lib │ │ ├── livestamp.min.js │ │ └── jquery.pulse.js │ └── chat │ │ └── header.js ├── img │ ├── pipo.icns │ ├── favicon.ico │ ├── gravatar_default.jpg │ └── gravatar_phutchins.jpeg ├── css │ ├── highlight.js │ │ ├── styles │ │ │ ├── school_book.png │ │ │ ├── brown_papersq.png │ │ │ ├── ascetic.css │ │ │ ├── vs.css │ │ │ ├── ir_black.css │ │ │ ├── dark.css │ │ │ ├── idea.css │ │ │ ├── github.css │ │ │ ├── brown_paper.css │ │ │ ├── magula.css │ │ │ ├── zenburn.css │ │ │ ├── default.css.orig │ │ │ ├── school_book.css │ │ │ └── far.css │ │ ├── languages │ │ │ ├── ini.js │ │ │ ├── dos.js │ │ │ ├── parser3.js │ │ │ ├── profile.js │ │ │ ├── smalltalk.js │ │ │ ├── diff.js │ │ │ ├── tex.js │ │ │ ├── javascript.js │ │ │ ├── bash.js │ │ │ ├── java.js │ │ │ ├── axapta.js │ │ │ ├── erlang-repl.js │ │ │ ├── go.js │ │ │ ├── cs.js │ │ │ ├── php.js │ │ │ ├── scala.js │ │ │ ├── vhdl.js │ │ │ ├── haskell.js │ │ │ ├── python.js │ │ │ ├── cmake.js │ │ │ └── cpp.js │ │ ├── LICENSE │ │ ├── AUTHORS.ru.txt │ │ └── AUTHORS.en.txt │ └── themes │ │ ├── basic │ │ └── assets │ │ │ └── fonts │ │ │ ├── icons.eot │ │ │ ├── icons.ttf │ │ │ └── icons.woff │ │ └── default │ │ └── assets │ │ ├── fonts │ │ ├── icons.eot │ │ ├── icons.otf │ │ ├── icons.ttf │ │ ├── icons.woff │ │ └── icons.woff2 │ │ └── images │ │ └── flags.png ├── views │ ├── preDeps.pug │ └── postDeps.pug └── test │ └── js │ └── chatHeader.unit.js ├── env ├── test ├── main.unit.js ├── scripts │ └── line_count.sh └── server │ ├── js │ ├── database.unit.js │ └── managers │ │ └── authentication.unit.js │ └── server.unit.js ├── docs ├── screenshots │ ├── pipo_flip.png │ └── pipo_phutchins.png ├── codebaseRefactorAndCleanup.md ├── running_notes ├── chat_and_pm_merge_and_chat_id ├── pipo_whitepaper ├── todo.airplane ├── membership_and_active_status └── refactor.notes ├── jsdoc ├── fonts │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ └── OpenSans-LightItalic-webfont.woff ├── scripts │ ├── linenumber.js │ └── prettify │ │ └── lang-css.js └── styles │ ├── prettify-jsdoc.css │ └── prettify-tomorrow.css ├── .gitignore ├── .eslintrc ├── .jsdoc.json ├── main.js ├── .jshintrc └── keys └── pipo.pub /.env: -------------------------------------------------------------------------------- 1 | NODE_ENV=production 2 | -------------------------------------------------------------------------------- /server/models/privkey.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.jslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "indent": 2 3 | } 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | coverage/ 3 | test/ 4 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "client/js/components" 3 | } 4 | -------------------------------------------------------------------------------- /config/http.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | port: 3030, 3 | }; 4 | -------------------------------------------------------------------------------- /client/js/components/js-md5/.covignore: -------------------------------------------------------------------------------- 1 | /tests/ 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /env: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | environment: 'production' 3 | } 4 | -------------------------------------------------------------------------------- /client/js/client/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Web client starting point 3 | */ 4 | -------------------------------------------------------------------------------- /client/js/components/js-md5/.gitignore: -------------------------------------------------------------------------------- 1 | covreporter 2 | node_modules 3 | -------------------------------------------------------------------------------- /server/js/managers/membership.js: -------------------------------------------------------------------------------- 1 | function MembershipManager() { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /test/main.unit.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('Main', function() { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /client/img/pipo.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/img/pipo.icns -------------------------------------------------------------------------------- /client/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/img/favicon.ico -------------------------------------------------------------------------------- /client/js/components/binaryjs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.6 4 | - 0.8 -------------------------------------------------------------------------------- /client/img/gravatar_default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/img/gravatar_default.jpg -------------------------------------------------------------------------------- /docs/screenshots/pipo_flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/docs/screenshots/pipo_flip.png -------------------------------------------------------------------------------- /client/img/gravatar_phutchins.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/img/gravatar_phutchins.jpeg -------------------------------------------------------------------------------- /docs/screenshots/pipo_phutchins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/docs/screenshots/pipo_phutchins.png -------------------------------------------------------------------------------- /docs/codebaseRefactorAndCleanup.md: -------------------------------------------------------------------------------- 1 | public 2 | chat/ (should include all room stuff also) 3 | membership.js 4 | 5 | 6 | -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /client/css/highlight.js/styles/school_book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/highlight.js/styles/school_book.png -------------------------------------------------------------------------------- /client/css/themes/basic/assets/fonts/icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/basic/assets/fonts/icons.eot -------------------------------------------------------------------------------- /client/css/themes/basic/assets/fonts/icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/basic/assets/fonts/icons.ttf -------------------------------------------------------------------------------- /jsdoc/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/jsdoc/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /client/css/highlight.js/styles/brown_papersq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/highlight.js/styles/brown_papersq.png -------------------------------------------------------------------------------- /client/css/themes/basic/assets/fonts/icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/basic/assets/fonts/icons.woff -------------------------------------------------------------------------------- /client/css/themes/default/assets/fonts/icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/default/assets/fonts/icons.eot -------------------------------------------------------------------------------- /client/css/themes/default/assets/fonts/icons.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/default/assets/fonts/icons.otf -------------------------------------------------------------------------------- /client/css/themes/default/assets/fonts/icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/default/assets/fonts/icons.ttf -------------------------------------------------------------------------------- /client/css/themes/default/assets/fonts/icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/default/assets/fonts/icons.woff -------------------------------------------------------------------------------- /client/css/themes/default/assets/images/flags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/default/assets/images/flags.png -------------------------------------------------------------------------------- /client/css/themes/default/assets/fonts/icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/css/themes/default/assets/fonts/icons.woff2 -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/helloworld/flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/binaryjs/examples/helloworld/flower.png -------------------------------------------------------------------------------- /client/js/components/js-md5/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-md5", 3 | "version": "0.4.1", 4 | "main": ["src/md5.js"], 5 | "ignore": [ 6 | "tests" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /config/adminData 3 | *.log 4 | /dist 5 | /packages 6 | /cache/ 7 | /out/ 8 | .DS_Store 9 | /files/ 10 | /coverage/ 11 | .idea 12 | /client/bundle.js 13 | -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phutchins/pipo/HEAD/client/js/components/js-md5/doc/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /client/js/components/binaryjs/.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | 10 | pids 11 | logs 12 | results 13 | 14 | node_modules 15 | npm-debug.log -------------------------------------------------------------------------------- /client/js/components/binaryjs/dist/README.md: -------------------------------------------------------------------------------- 1 | ## BinaryJS Clients 2 | 3 | These files are available via cdn 4 | 5 | http://cdn.binaryjs.com/0/binary.js 6 | 7 | http://cdn.binaryjs.com/0/binary.min.js 8 | -------------------------------------------------------------------------------- /client/js/components/async/mocha_test/support/is_browser.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return (typeof process === "undefined") || 3 | (process + "" !== "[object process]"); // browserify 4 | }; 5 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/Makefile: -------------------------------------------------------------------------------- 1 | default: compress 2 | 3 | compress: 4 | @node bin/build.js; 5 | 6 | test: 7 | @mocha \ 8 | -t 2000 \ 9 | $(TESTFLAGS) \ 10 | $(TESTS) 11 | 12 | .PHONY: test -------------------------------------------------------------------------------- /client/js/components/binaryjs/doc/README.md: -------------------------------------------------------------------------------- 1 | ## BinaryJS Documentations 2 | 3 | ### [Getting started guide](https://github.com/binaryjs/binaryjs/blob/master/doc/start.md) 4 | ### [API reference](https://github.com/binaryjs/binaryjs/blob/master/doc/api.md) 5 | -------------------------------------------------------------------------------- /config/database.js: -------------------------------------------------------------------------------- 1 | // config/database.js 2 | var logger = require('./logger'); 3 | 4 | module.exports = { 5 | 'url' : { 6 | 'development': 'mongodb://localhost:27017/pipo', 7 | 'test': 'mongodb://localhost:27017/pipo_test' 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/js-binarypack"] 2 | path = deps/js-binarypack 3 | url = git://github.com/binaryjs/js-binarypack.git 4 | [submodule "deps/EventEmitter"] 5 | path = deps/EventEmitter 6 | url = git://github.com/ericz/EventEmitter.git 7 | -------------------------------------------------------------------------------- /server/routes/membership.js: -------------------------------------------------------------------------------- 1 | require('../../config/database'); 2 | var passport = require('passport'); 3 | 4 | module.exports = function(app) { 5 | app.get('/membership/userlist/:channel', passport.authenticate('keyverify', { session: false }), function(req, res) { 6 | 7 | }); 8 | }; 9 | -------------------------------------------------------------------------------- /client/views/preDeps.pug: -------------------------------------------------------------------------------- 1 | link(rel='stylesheet', href=depRoot + "css/google_fonts_roboto.css", type='text/css') 2 | link(rel='stylesheet', href=depRoot + "css/semantic.css") 3 | link(rel='stylesheet', href=depRoot + "css/pipo.css") 4 | link(rel='stylesheet', href=depRoot + "css/highlight.js/styles/default.css") 5 | -------------------------------------------------------------------------------- /client/js/components/js-md5/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "4.1" 4 | - "4.0" 5 | - "0.12" 6 | - "0.11" 7 | - "0.10" 8 | before_install: 9 | - npm install coveralls 10 | - npm install mocha-lcov-reporter 11 | script: npm run-script coveralls 12 | branches: 13 | only: 14 | - master 15 | -------------------------------------------------------------------------------- /test/scripts/line_count.sh: -------------------------------------------------------------------------------- 1 | find ./* -type f -not \( -path "./node_modules/*" -prune \) -not \( -path "./public/css/*" -prune \) -not \( -path "./bower_components/*" -prune \) -not \( -path "./log/*" -prune \) -not \( -path "./public/js/lib/*" -prune \) -not \( -path "./openpgp.*" -prune \) -type f -print 2 | 0 | xargs -0 wc -l 3 | -------------------------------------------------------------------------------- /server/models/membership.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'); 2 | var Schema = mongoose.Schema; 3 | 4 | var membershipSchema = new Schema({ 5 | type: { type: String }, 6 | channel: { type: String }, 7 | members: [{ type: String }], 8 | socketId: { type: String } 9 | }); 10 | 11 | module.exports = mongoose.model('Membership', membershipSchema); 12 | -------------------------------------------------------------------------------- /client/js/components/async/karma.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = function (config) { 2 | config.set({ 3 | browsers: ['Firefox'], 4 | files: ['mocha_test/*.js'], 5 | frameworks: ['browserify', 'mocha'], 6 | preprocessors: { 7 | 'mocha_test/*.js': ['browserify'] 8 | }, 9 | reporters: ['mocha'], 10 | singleRun: true 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /client/js/components/http/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http", 3 | "version": "3.24.10", 4 | "main": "http.min.js", 5 | "description": "'http' nodejs core module browserify-ied with `--standalone http`. Should support all module systems (commonjs, AMD & `window.http`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "http" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/http/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http", 3 | "version": "3.24.10", 4 | "main": "http.min.js", 5 | "description": "'http' nodejs core module browserify-ied with `--standalone http`. Should support all module systems (commonjs, AMD & `window.http`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "http" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/https/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "https", 3 | "version": "3.46.1", 4 | "main": "https.min.js", 5 | "description": "'https' nodejs core module browserify-ied with `--standalone https`. Should support all module systems (commonjs, AMD & `window.https`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "https" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/https/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "https", 3 | "version": "3.46.1", 4 | "main": "https.min.js", 5 | "description": "'https' nodejs core module browserify-ied with `--standalone https`. Should support all module systems (commonjs, AMD & `window.https`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "https" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/buffer/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buffer", 3 | "version": "3.46.1", 4 | "main": "buffer.min.js", 5 | "description": "'buffer' nodejs core module browserify-ied with `--standalone buffer`. Should support all module systems (commonjs, AMD & `window.buffer`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "buffer" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/buffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buffer", 3 | "version": "3.46.1", 4 | "main": "buffer.min.js", 5 | "description": "'buffer' nodejs core module browserify-ied with `--standalone buffer`. Should support all module systems (commonjs, AMD & `window.buffer`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "buffer" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/crypto/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto", 3 | "version": "3.46.1", 4 | "main": "crypto.min.js", 5 | "description": "'crypto' nodejs core module browserify-ied with `--standalone crypto`. Should support all module systems (commonjs, AMD & `window.crypto`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "crypto" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/crypto/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto", 3 | "version": "3.46.1", 4 | "main": "crypto.min.js", 5 | "description": "'crypto' nodejs core module browserify-ied with `--standalone crypto`. Should support all module systems (commonjs, AMD & `window.crypto`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "crypto" 10 | ] 11 | } -------------------------------------------------------------------------------- /config/markdown.js: -------------------------------------------------------------------------------- 1 | var marked = require('marked'); 2 | 3 | marked.setOptions({ 4 | renderer: new marked.Renderer(), 5 | gfm: true, 6 | tables: true, 7 | breaks: false, 8 | pedantic: false, 9 | sanatize: true, 10 | smartLists: true, 11 | smartypants: false, 12 | highlight: function (code) { 13 | return require('highlight').highlightAuto(code).value; 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/helloworld/README.md: -------------------------------------------------------------------------------- 1 | ## Hello World example 2 | 3 | 4 | 1. Run the server: 5 | ``` 6 | node server.js 7 | ``` 8 | 9 | 2. Open `index.html` in your browser 10 | 11 | You should see a flower. If not, your browser probably doesn't support binary websockets. 12 | 13 | Server code is contained in `server.js` 14 | Client side code is contained in `index.html` -------------------------------------------------------------------------------- /server/models/privatechat.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'); 2 | var Schema = mongoose.Schema; 3 | var logger = require('../config/logger'); 4 | 5 | var privateChatSchema = new Schema({ 6 | date: { type: Date, default: new Date() }, 7 | _encryptedMessages: [{ type: mongoose.SchemaTypes.ObjectId, ref: "Message" }], 8 | }); 9 | 10 | module.exports = mongoose.model('PrivateChat', privateChatSchema); 11 | -------------------------------------------------------------------------------- /server/routes/user.js: -------------------------------------------------------------------------------- 1 | var passport = require('passport'); 2 | 3 | module.exports = function(app) { 4 | app.post('/user/data', 5 | passport.authenticate('keyverify', { session: false }), 6 | function(req, res) { 7 | var userName = req.param('userName'); 8 | var fullName = req.param('fullName'); 9 | var email = req.param('email'); 10 | 11 | return res.sendStatus(404); 12 | }); 13 | }; 14 | -------------------------------------------------------------------------------- /client/js/components/querystring/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "querystring", 3 | "version": "3.46.1", 4 | "main": "querystring.min.js", 5 | "description": "'querystring' nodejs core module browserify-ied with `--standalone querystring`. Should support all module systems (commonjs, AMD & `window.querystring`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "querystring" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/querystring/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "querystring", 3 | "version": "3.46.1", 4 | "main": "querystring.min.js", 5 | "description": "'querystring' nodejs core module browserify-ied with `--standalone querystring`. Should support all module systems (commonjs, AMD & `window.querystring`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "querystring" 10 | ] 11 | } -------------------------------------------------------------------------------- /client/js/components/http/readme.md: -------------------------------------------------------------------------------- 1 | 'http' nodejs core module browserify-ied with `--standalone http`. Should support all module systems (commonjs, AMD & `window.http`) - check browserify docs. 2 | 3 | From [node2web](http://github.com/anodynos/node2web) collection, 4 | should/will be exposed as 'http' to [bower](http://bower.io) for *browser* usage. 5 | 6 | browserify version: '3.24.10', build date 'Sun Feb 02 2014 23:12:52 GMT+0200 (EET)' -------------------------------------------------------------------------------- /client/js/components/async/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "async", 3 | "description": "Higher-order functions and common patterns for asynchronous code", 4 | "version": "1.5.2", 5 | "keywords": [ 6 | "async", 7 | "callback", 8 | "utility", 9 | "module" 10 | ], 11 | "license": "MIT", 12 | "main": "lib/async.js", 13 | "repository": "caolan/async", 14 | "scripts": [ 15 | "lib/async.js" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /client/js/components/https/readme.md: -------------------------------------------------------------------------------- 1 | 'https' nodejs core module browserify-ied with `--standalone https`. Should support all module systems (commonjs, AMD & `window.https`) - check browserify docs. 2 | 3 | From [node2web](http://github.com/anodynos/node2web) collection, 4 | should/will be exposed as 'https' to [bower](http://bower.io) for *browser* usage. 5 | 6 | browserify version: '3.46.1', build date 'Wed Oct 08 2014 17:37:43 GMT+0300 (EEST)' -------------------------------------------------------------------------------- /client/js/components/buffer/readme.md: -------------------------------------------------------------------------------- 1 | 'buffer' nodejs core module browserify-ied with `--standalone buffer`. Should support all module systems (commonjs, AMD & `window.buffer`) - check browserify docs. 2 | 3 | From [node2web](http://github.com/anodynos/node2web) collection, 4 | should/will be exposed as 'buffer' to [bower](http://bower.io) for *browser* usage. 5 | 6 | browserify version: '3.46.1', build date 'Wed Oct 08 2014 17:37:09 GMT+0300 (EEST)' -------------------------------------------------------------------------------- /client/js/components/crypto/readme.md: -------------------------------------------------------------------------------- 1 | 'crypto' nodejs core module browserify-ied with `--standalone crypto`. Should support all module systems (commonjs, AMD & `window.crypto`) - check browserify docs. 2 | 3 | From [node2web](http://github.com/anodynos/node2web) collection, 4 | should/will be exposed as 'crypto' to [bower](http://bower.io) for *browser* usage. 5 | 6 | browserify version: '3.46.1', build date 'Wed Oct 08 2014 17:36:41 GMT+0300 (EEST)' -------------------------------------------------------------------------------- /client/js/components/base64/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base64", 3 | "version": "0.3.0", 4 | "description": "Base64 encoding and decoding", 5 | "main": "./base64.js", 6 | "license": "WTFPL", 7 | "repository": { 8 | "type": "git", 9 | "url": "git://github.com/davidchambers/Base64.js.git" 10 | }, 11 | "ignore": [ 12 | "**/.*", 13 | "Makefile", 14 | "coverage/", 15 | "scripts/", 16 | "test/" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/helloworld/server.js: -------------------------------------------------------------------------------- 1 | var BinaryServer = require('../../').BinaryServer; 2 | var fs = require('fs'); 3 | 4 | // Start Binary.js server 5 | var server = BinaryServer({port: 9000}); 6 | // Wait for new user connections 7 | server.on('connection', function(client){ 8 | // Stream a flower as a hello! 9 | var file = fs.createReadStream(__dirname + '/flower.png'); 10 | client.send(file); 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /client/js/components/querystring/readme.md: -------------------------------------------------------------------------------- 1 | 'querystring' nodejs core module browserify-ied with `--standalone querystring`. Should support all module systems (commonjs, AMD & `window.querystring`) - check browserify docs. 2 | 3 | From [node2web](http://github.com/anodynos/node2web) collection, 4 | should/will be exposed as 'querystring' to [bower](http://bower.io) for *browser* usage. 5 | 6 | browserify version: '3.46.1', build date 'Wed Oct 08 2014 17:37:55 GMT+0300 (EEST)' -------------------------------------------------------------------------------- /test/server/js/database.unit.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var expect = require('chai').expect; 4 | var mongoose = require('mongoose'); 5 | 6 | describe('database', function() { 7 | var database = require('../../../server/js/database'); 8 | 9 | describe('#connect', function() { 10 | it('should return a mongoose connection to the database', function() { 11 | //expect(database.connect).to.be.instanceof(mongoose.Connection); 12 | }); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "binaryjs", 3 | "homepage": "https://github.com/binaryjs/binaryjs", 4 | "version": "0.2.1", 5 | "_release": "0.2.1", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "0.2.1", 9 | "commit": "260859aadff04f922818fef4aa3fb602d9dfa863" 10 | }, 11 | "_source": "https://github.com/binaryjs/binaryjs.git", 12 | "_target": "^0.2.1", 13 | "_originalSource": "binaryjs", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /client/js/components/SparkMD5/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "md5", 3 | "repo": "satazor/js-spark-md5", 4 | "description": "Lightning fast normal and incremental md5 for javascript", 5 | "version": "2.0.0", 6 | "keywords": [ 7 | "md5", 8 | "fast", 9 | "spark", 10 | "incremental" 11 | ], 12 | "dependencies": {}, 13 | "development": {}, 14 | "license": "WTFPL", 15 | "main": "spark-md5.js", 16 | "scripts": [ 17 | "spark-md5.js" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/fileupload/README.md: -------------------------------------------------------------------------------- 1 | ## Drag and Drop File Upload Example w/ Percentage completion 2 | 3 | 4 | 1. Run the server: 5 | ``` 6 | node server.js 7 | ``` 8 | 9 | 2. Go to 10 | ``` 11 | http://localhost:9000/ 12 | ``` 13 | 14 | 3. Drag a file into the box. Percent transferred will be shown and the file will be saved in the example's directory. 15 | 16 | 17 | 18 | Server code is contained in `server.js` 19 | Client side code is contained in `public/index.html` -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "mocha": true 5 | }, 6 | "extends": "defaults/configurations/walmart/es6-node", 7 | "rules": { 8 | "quotes": [2, "single"], 9 | "strict": [0, "global"], 10 | "no-magic-numbers": [0], 11 | "new-cap": [1], 12 | "max-params": [0], 13 | "max-len": [0], 14 | "max-statements": [1], 15 | "max-nested-callbacks": [0], 16 | "filenames/filenames": [0], 17 | "prefer-spread": [0], 18 | "no-invalid-this": [0] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /client/js/components/js-md5/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-md5", 3 | "version": "0.4.1", 4 | "main": [ 5 | "src/md5.js" 6 | ], 7 | "ignore": [ 8 | "tests" 9 | ], 10 | "homepage": "https://github.com/emn178/js-md5", 11 | "_release": "0.4.1", 12 | "_resolution": { 13 | "type": "version", 14 | "tag": "v0.4.1", 15 | "commit": "8ff14a9a0365ba6cc136a27376a6655cc6262953" 16 | }, 17 | "_source": "https://github.com/emn178/js-md5.git", 18 | "_target": "^0.4.1", 19 | "_originalSource": "md5", 20 | "_direct": true 21 | } -------------------------------------------------------------------------------- /client/js/components/SparkMD5/LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2015 André Cruz 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /client/js/components/base64/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 3 | Version 2, December 2004 4 | 5 | Copyright (c) 2011..2012 David Chambers 6 | 7 | Everyone is permitted to copy and distribute verbatim or modified 8 | copies of this license document, and changing it is allowed as long 9 | as the name is changed. 10 | 11 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 12 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 13 | 14 | 0. You just DO WHAT THE FUCK YOU WANT TO. 15 | -------------------------------------------------------------------------------- /.jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": true, 4 | "dictionaries": ["jsdoc","closure"] 5 | }, 6 | "source": { 7 | "includePattern": ".+\\.js(doc|x)?$", 8 | "excludePattern": "(^|\\/|\\\\)_", 9 | "include": [ 10 | "main.js" 11 | ], 12 | "exclude": [ 13 | "client/js/bundle.js", 14 | "client/js/lib", 15 | "client/js/components" 16 | ] 17 | 18 | }, 19 | "plugins": [], 20 | "templates": { 21 | "cleverLinks": false, 22 | "monospaceLinks": false 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /client/js/components/SparkMD5/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SparkMD5", 3 | "version": "2.0.2", 4 | "homepage": "https://github.com/satazor/js-spark-md5", 5 | "authors": [ 6 | "André Cruz " 7 | ], 8 | "description": "Lightning fast normal and incremental md5 for javascript", 9 | "main": "spark-md5.js", 10 | "keywords": [ 11 | "md5", 12 | "spark", 13 | "incremental", 14 | "fast" 15 | ], 16 | "license": "http://www.wtfpl.net/", 17 | "ignore": [ 18 | "**/.*", 19 | "node_modules", 20 | "bower_components", 21 | "test", 22 | "tests" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /test/server/server.unit.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var sinon = require('sinon'); 4 | var expect = require('chai').expect; 5 | var Server = require('../../server/server.js'); 6 | 7 | 8 | describe('Server', function() { 9 | describe('@constructor', function() { 10 | it('should create instance', function() { 11 | expect(Server()).to.be.instanceOf(Server); 12 | }); 13 | 14 | // Should create an instance of http server 15 | }); 16 | 17 | describe('#createSystemUser', function() { 18 | it('should create a system user', function() { 19 | //check if it created system user 20 | }); 21 | }); 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /server/routes/auth.js: -------------------------------------------------------------------------------- 1 | var passport = require('passport'); 2 | //var passportPublicKey = require('passport-publickey'); 3 | 4 | function Auth(app) { 5 | app.post('/login', 6 | passport.authenticate('keyverify', { session: false }), 7 | function(req, res) { 8 | console.log("IT WORKEEEDDDDD"); 9 | return res.sendStatus(200); 10 | } 11 | ); 12 | 13 | app.post('/sessiontest', 14 | passport.authenticate('keyverify', { session: false }), 15 | function(req, res) { 16 | console.log("Authentication worked!"); 17 | return res.sendStatus(200); 18 | } 19 | ); 20 | }; 21 | 22 | module.exports = Auth; 23 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | // Main start script for PiPo 2 | // 3 | var env = require('./env'); 4 | 5 | // Detect whether we are running inside of electron or nodejs 6 | if (process.versions.electron) { 7 | // Running inside of electron so run the client 8 | // Set the environment here (should be much smarter than this) 9 | process.env.NODE_ENV = 'production'; 10 | process.env.NODE_ENV = env.environment; 11 | 12 | console.log('Starting as Electron'); 13 | console.log('process.env', process.env); 14 | require('./client/client.js'); 15 | } else { 16 | // Running in node so load the server 17 | console.log('Starting as Server'); 18 | require('./server/server.js')(); 19 | } 20 | -------------------------------------------------------------------------------- /docs/running_notes: -------------------------------------------------------------------------------- 1 | ## Doing 2 | - Converting sendFileModal into a prototype and passing chatManager to it on init 3 | - Changing the way that modals init so that they can have managers passed in on init 4 | - Making sure that we wait for document ready in chatmanager init, then init all modals and move forward 5 | 6 | ## Questions/To Fix 7 | - in ChatManager, focus chat, do we really need to be creating a new fileManager instance each time we click the downloadLink? 8 | - Can we use nodecrypto everywhere, or require crypto?? 9 | - Need to have the server check to see if the files directory exists and if not, create it 10 | - Is the files directory configurable easily from the config? 11 | -------------------------------------------------------------------------------- /client/js/components/base64/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Base64", 3 | "version": "0.3.0", 4 | "description": "Base64 encoding and decoding", 5 | "author": "David Chambers ", 6 | "main": "./base64.js", 7 | "licenses": [ 8 | { 9 | "type": "WTFPL", 10 | "url": "https://raw.github.com/davidchambers/Base64.js/master/LICENSE" 11 | } 12 | ], 13 | "repository": { 14 | "type": "git", 15 | "url": "git://github.com/davidchambers/Base64.js.git" 16 | }, 17 | "devDependencies": { 18 | "coffee-script": "1.7.x", 19 | "istanbul": "0.2.x", 20 | "mocha": "1.18.x", 21 | "uglify-js": "2.4.x", 22 | "xyz": "0.3.x" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docs/chat_and_pm_merge_and_chat_id: -------------------------------------------------------------------------------- 1 | + Need to be able to create and join private chats the same way as regular chats 2 | + Private chats are currently referred to by their array hash initially so that they can be created immediately and referenced by the client 3 | + Is this needed? 4 | 5 | 6 | Finding a private chat from Client 7 | + Possible states: 8 | + We don't have the chat cached locally 9 | + We have the chat cached locally 10 | + It has been initiated? 11 | + It has not been init'd (will this ever happen?) 12 | + Do we ever want to cache a chat or PM but not open it? Is there a point in this? 13 | + What do we know? 14 | + The chat participants 15 | 16 | 17 | -------------------------------------------------------------------------------- /server/js/database.js: -------------------------------------------------------------------------------- 1 | // Configuration 2 | var configDB = require('../../config/database'); 3 | 4 | // Modules 5 | var mongoose = require('mongoose'); 6 | 7 | // Local modules 8 | var logger = require('../../config/logger'); 9 | 10 | var connect = function(env) { 11 | var env = env; 12 | return mongoose.connect(configDB.url[env], function(err) { 13 | logger.debug("Connecting to "+configDB.url[env]); 14 | if (err) { 15 | logger.error('Failed to connect to mongo on startup - retrying in 5 sec', err); 16 | retry(env); 17 | } 18 | }); 19 | }; 20 | 21 | var retry = function(env) { 22 | setTimeout(connect.bind(null, env), 5000); 23 | }; 24 | 25 | module.exports = { 26 | connect: connect 27 | }; 28 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Eric Zhang (http://ericzhang.com)", 3 | "name": "binaryjs", 4 | "description": "Binary realtime streaming made easy", 5 | "version": "0.2.2", 6 | "homepage": "http://binaryjs.com", 7 | "repository": { 8 | "type": "git", 9 | "url": "git://github.com/binaryjs/binaryjs.git" 10 | }, 11 | "main": "lib/server.js", 12 | "scripts": { 13 | "test": "make test" 14 | }, 15 | "engines": { 16 | "node": ">=0.10.20" 17 | }, 18 | "dependencies": { 19 | "streamws": ">=0.1.1", 20 | "binarypack": ">=0.0.4", 21 | "streamers": ">=0.1.0" 22 | }, 23 | "devDependencies": { 24 | "mocha": "~1.3.0", 25 | "uglify-js": "~1.3.5" 26 | } 27 | } -------------------------------------------------------------------------------- /client/js/components/http/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http", 3 | "version": "3.24.10", 4 | "main": "http.min.js", 5 | "description": "'http' nodejs core module browserify-ied with `--standalone http`. Should support all module systems (commonjs, AMD & `window.http`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "http" 10 | ], 11 | "homepage": "https://github.com/anodynos/node2web_http", 12 | "_release": "3.24.10", 13 | "_resolution": { 14 | "type": "version", 15 | "tag": "3.24.10", 16 | "commit": "e866fb0957c4bc784b8fe5aa714d16fdbc645b30" 17 | }, 18 | "_source": "git://github.com/anodynos/node2web_http.git", 19 | "_target": "~3.24.10", 20 | "_originalSource": "http", 21 | "_direct": true 22 | } -------------------------------------------------------------------------------- /client/js/components/https/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "https", 3 | "version": "3.46.1", 4 | "main": "https.min.js", 5 | "description": "'https' nodejs core module browserify-ied with `--standalone https`. Should support all module systems (commonjs, AMD & `window.https`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "https" 10 | ], 11 | "homepage": "https://github.com/anodynos/node2web_https", 12 | "_release": "3.46.1", 13 | "_resolution": { 14 | "type": "version", 15 | "tag": "3.46.1", 16 | "commit": "3e01fa57701f46321d24b20247eb4effe9ed3904" 17 | }, 18 | "_source": "git://github.com/anodynos/node2web_https.git", 19 | "_target": "~3.46.1", 20 | "_originalSource": "https", 21 | "_direct": true 22 | } -------------------------------------------------------------------------------- /client/js/components/buffer/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buffer", 3 | "version": "3.46.1", 4 | "main": "buffer.min.js", 5 | "description": "'buffer' nodejs core module browserify-ied with `--standalone buffer`. Should support all module systems (commonjs, AMD & `window.buffer`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "buffer" 10 | ], 11 | "homepage": "https://github.com/anodynos/node2web_buffer", 12 | "_release": "3.46.1", 13 | "_resolution": { 14 | "type": "version", 15 | "tag": "3.46.1", 16 | "commit": "91433d256cacfc3814d71e9e0c458af2a0cb575a" 17 | }, 18 | "_source": "https://github.com/anodynos/node2web_buffer.git", 19 | "_target": "^3.46.1", 20 | "_originalSource": "buffer", 21 | "_direct": true 22 | } -------------------------------------------------------------------------------- /client/js/components/crypto/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto", 3 | "version": "3.46.1", 4 | "main": "crypto.min.js", 5 | "description": "'crypto' nodejs core module browserify-ied with `--standalone crypto`. Should support all module systems (commonjs, AMD & `window.crypto`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "crypto" 10 | ], 11 | "homepage": "https://github.com/anodynos/node2web_crypto", 12 | "_release": "3.46.1", 13 | "_resolution": { 14 | "type": "version", 15 | "tag": "3.46.1", 16 | "commit": "f64a3ccf174c068fee471d57cfc2dc3470785c57" 17 | }, 18 | "_source": "https://github.com/anodynos/node2web_crypto.git", 19 | "_target": "^3.46.1", 20 | "_originalSource": "crypto", 21 | "_direct": true 22 | } -------------------------------------------------------------------------------- /jsdoc/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /client/js/components/base64/base64.min.js: -------------------------------------------------------------------------------- 1 | !function(){function t(t){this.message=t}var r="undefined"!=typeof exports?exports:this,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d="";a.charAt(0|i)||(c="=",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(n=a.charCodeAt(i+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}(); -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /client/js/components/base64/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base64", 3 | "version": "0.3.0", 4 | "description": "Base64 encoding and decoding", 5 | "main": "./base64.js", 6 | "license": "WTFPL", 7 | "repository": { 8 | "type": "git", 9 | "url": "git://github.com/davidchambers/Base64.js.git" 10 | }, 11 | "ignore": [ 12 | "**/.*", 13 | "Makefile", 14 | "coverage/", 15 | "scripts/", 16 | "test/" 17 | ], 18 | "homepage": "https://github.com/davidchambers/Base64.js", 19 | "_release": "0.3.0", 20 | "_resolution": { 21 | "type": "version", 22 | "tag": "0.3.0", 23 | "commit": "772df096a5ffe983f40202684ad45eed1e0e2d59" 24 | }, 25 | "_source": "git://github.com/davidchambers/Base64.js.git", 26 | "_target": "~0.3.0", 27 | "_originalSource": "base64", 28 | "_direct": true 29 | } -------------------------------------------------------------------------------- /client/js/components/querystring/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "querystring", 3 | "version": "3.46.1", 4 | "main": "querystring.min.js", 5 | "description": "'querystring' nodejs core module browserify-ied with `--standalone querystring`. Should support all module systems (commonjs, AMD & `window.querystring`) - check browserify docs.", 6 | "keywords": [ 7 | "nodejs", 8 | "browserify", 9 | "querystring" 10 | ], 11 | "homepage": "https://github.com/anodynos/node2web_querystring", 12 | "_release": "3.46.1", 13 | "_resolution": { 14 | "type": "version", 15 | "tag": "3.46.1", 16 | "commit": "7396748a4d49c19165146d17229f4a4593f75851" 17 | }, 18 | "_source": "git://github.com/anodynos/node2web_querystring.git", 19 | "_target": "~3.46.1", 20 | "_originalSource": "querystring", 21 | "_direct": true 22 | } -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/README.md: -------------------------------------------------------------------------------- 1 | ## BinaryJS Examples 2 | 3 | ### [Hello World](https://github.com/binaryjs/binaryjs/tree/master/examples/helloworld) 4 | 5 | [View live demo](http://examples.binaryjs.com/hw.html) 6 | 7 | Simple example that streams a flower picture to the client 8 | 9 | ### [Streaming File Upload](https://github.com/binaryjs/binaryjs/tree/master/examples/fileupload) 10 | 11 | HTML5 drag and drop file upload with percentage progress 12 | 13 | ### [Image Share](https://github.com/binaryjs/binaryjs/tree/master/examples/imageshare) 14 | 15 | Upload and broadcast images to other browsers (via file input) 16 | 17 | ### [ASCII Webcam](https://github.com/ericz/ascam) 18 | 19 | [View live demo](http://ascam.ericzhang.com/) 20 | 21 | [Requires Chrome 21+] Stream webcam video in ASCII (or not) without flash! 22 | -------------------------------------------------------------------------------- /jsdoc/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "bitwise": false, 4 | "browser": true, 5 | "camelcase": false, 6 | "curly": true, 7 | "devel": false, 8 | "eqeqeq": true, 9 | "esnext": true, 10 | "freeze": true, 11 | "immed": true, 12 | "indent": 2, 13 | "latedef": true, 14 | "newcap": false, 15 | "noarg": true, 16 | "node": true, 17 | "noempty": true, 18 | "nonew": true, 19 | "quotmark": "single", 20 | "regexp": true, 21 | "smarttabs": false, 22 | "strict": true, 23 | "trailing": true, 24 | "undef": true, 25 | "unused": true, 26 | "maxparams": 4, 27 | "maxstatements": 12, 28 | "maxcomplexity": 6, 29 | "maxdepth": 3, 30 | "maxlen": 80, 31 | "multistr": true, 32 | "predef": [ 33 | "after", 34 | "afterEach", 35 | "before", 36 | "beforeEach", 37 | "describe", 38 | "exports", 39 | "it", 40 | "module", 41 | "require" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/helloworld/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/ini.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Ini 3 | Category: common 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.ini = { 7 | case_insensitive: true, 8 | defaultMode: { 9 | illegal: '[^\\s]', 10 | contains: [ 11 | { 12 | className: 'comment', 13 | begin: ';', end: '$' 14 | }, 15 | { 16 | className: 'title', 17 | begin: '^\\[', end: '\\]' 18 | }, 19 | { 20 | className: 'setting', 21 | begin: '^[a-z0-9_\\[\\]]+[ \\t]*=[ \\t]*', end: '$', 22 | contains: [ 23 | { 24 | className: 'value', 25 | endsWithParent: true, 26 | keywords: {'on': 1, 'off': 1, 'true': 1, 'false': 1, 'yes': 1, 'no': 1}, 27 | contains: [hljs.QUOTE_STRING_MODE, hljs.NUMBER_MODE] 28 | } 29 | ] 30 | } 31 | ] 32 | } 33 | }; 34 | }; -------------------------------------------------------------------------------- /client/js/components/js-md5/doc/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/ascetic.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Original style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background: white; color: black; 10 | } 11 | 12 | pre .string, 13 | pre .tag .value, 14 | pre .filter .argument, 15 | pre .addition, 16 | pre .change, 17 | pre .apache .tag, 18 | pre .apache .cbracket, 19 | pre .nginx .built_in, 20 | pre .tex .formula { 21 | color: #888; 22 | } 23 | 24 | pre .comment, 25 | pre .template_comment, 26 | pre .shebang, 27 | pre .doctype, 28 | pre .pi, 29 | pre .javadoc, 30 | pre .deletion, 31 | pre .apache .sqbracket { 32 | color: #CCC; 33 | } 34 | 35 | pre .keyword, 36 | pre .tag .title, 37 | pre .css .tag, 38 | pre .ini .title, 39 | pre .winutils, 40 | pre .flow, 41 | pre .lisp .title, 42 | pre .apache .tag, 43 | pre .tex .command { 44 | font-weight: bold; 45 | } 46 | -------------------------------------------------------------------------------- /client/js/components/SparkMD5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spark-md5", 3 | "version": "2.0.2", 4 | "description": "Lightning fast normal and incremental md5 for javascript", 5 | "main": "spark-md5.js", 6 | "files": [ 7 | "spark-md5.js", 8 | "spark-md5.min.js" 9 | ], 10 | "directories": { 11 | "test": "test" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git@github.com:satazor/js-spark-md5.git" 16 | }, 17 | "keywords": [ 18 | "md5", 19 | "fast", 20 | "spark", 21 | "incremental" 22 | ], 23 | "author": "André Cruz ", 24 | "license": "WTFPL", 25 | "bugs": { 26 | "url": "https://github.com/satazor/js-spark-md5/issues" 27 | }, 28 | "scripts": { 29 | "min": "uglifyjs spark-md5.js > spark-md5.min.js", 30 | "test": "open test/index.html" 31 | }, 32 | "devDependencies": { 33 | "uglify-js": "^2.4.16" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /client/js/components/SparkMD5/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SparkMD5", 3 | "version": "2.0.2", 4 | "homepage": "https://github.com/satazor/js-spark-md5", 5 | "authors": [ 6 | "André Cruz " 7 | ], 8 | "description": "Lightning fast normal and incremental md5 for javascript", 9 | "main": "spark-md5.js", 10 | "keywords": [ 11 | "md5", 12 | "spark", 13 | "incremental", 14 | "fast" 15 | ], 16 | "license": "http://www.wtfpl.net/", 17 | "ignore": [ 18 | "**/.*", 19 | "node_modules", 20 | "bower_components", 21 | "test", 22 | "tests" 23 | ], 24 | "_release": "2.0.2", 25 | "_resolution": { 26 | "type": "version", 27 | "tag": "2.0.2", 28 | "commit": "48eb911d4a5d119e7e8818789fdcf63b2f532bc5" 29 | }, 30 | "_source": "https://github.com/satazor/SparkMD5.git", 31 | "_target": "^2.0.2", 32 | "_originalSource": "spark-md5", 33 | "_direct": true 34 | } -------------------------------------------------------------------------------- /client/js/components/base64/README.md: -------------------------------------------------------------------------------- 1 | # Base64.js 2 | 3 | ≈ 500 byte* polyfill for browsers which don't provide [`window.btoa`][1] and 4 | [`window.atob`][2]. 5 | 6 | Although the script does no harm in browsers which do provide these functions, 7 | a conditional script loader such as [yepnope][3] can prevent unnecessary HTTP 8 | requests. 9 | 10 | ```javascript 11 | yepnope({ 12 | test: window.btoa && window.atob, 13 | nope: 'base64.js', 14 | callback: function () { 15 | // `btoa` and `atob` are now safe to use 16 | } 17 | }) 18 | ``` 19 | 20 | Base64.js stems from a [gist][4] by [yahiko][5]. 21 | 22 | ### Running the test suite 23 | 24 | make setup 25 | make test 26 | 27 | \* Minified and gzipped. Run `make bytes` to verify. 28 | 29 | 30 | [1]: https://developer.mozilla.org/en/DOM/window.btoa 31 | [2]: https://developer.mozilla.org/en/DOM/window.atob 32 | [3]: http://yepnopejs.com/ 33 | [4]: https://gist.github.com/229984 34 | [5]: https://github.com/yahiko 35 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/fileupload/server.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var http = require('http'); 3 | 4 | // Serve client side statically 5 | var express = require('express'); 6 | var app = express(); 7 | app.use(express.static(__dirname + '/public')); 8 | 9 | var server = http.createServer(app); 10 | 11 | // Start Binary.js server 12 | var BinaryServer = require('../../').BinaryServer; 13 | var bs = BinaryServer({server: server}); 14 | 15 | // Wait for new user connections 16 | bs.on('connection', function(client){ 17 | // Incoming stream from browsers 18 | client.on('stream', function(stream, meta){ 19 | // 20 | var file = fs.createWriteStream(__dirname+ '/public/' + meta.name); 21 | stream.pipe(file); 22 | // 23 | // Send progress back 24 | stream.on('data', function(data){ 25 | stream.write({rx: data.length / meta.size}); 26 | }); 27 | // 28 | }); 29 | }); 30 | // 31 | // 32 | 33 | server.listen(9000); 34 | console.log('HTTP and BinaryJS server started on port 9000'); 35 | -------------------------------------------------------------------------------- /client/js/components/async/Makefile: -------------------------------------------------------------------------------- 1 | export PATH := ./node_modules/.bin/:$(PATH):./bin/ 2 | 3 | PACKAGE = asyncjs 4 | XYZ = node_modules/.bin/xyz --repo git@github.com:caolan/async.git 5 | 6 | BUILDDIR = dist 7 | SRC = lib/async.js 8 | 9 | all: lint test clean build 10 | 11 | build: $(wildcard lib/*.js) 12 | mkdir -p $(BUILDDIR) 13 | cp $(SRC) $(BUILDDIR)/async.js 14 | uglifyjs $(BUILDDIR)/async.js -mc \ 15 | --source-map $(BUILDDIR)/async.min.map \ 16 | -o $(BUILDDIR)/async.min.js 17 | 18 | test: 19 | nodeunit test 20 | 21 | clean: 22 | rm -rf $(BUILDDIR) 23 | 24 | lint: 25 | jshint $(SRC) test/*.js mocha_test/* perf/*.js 26 | jscs $(SRC) test/*.js mocha_test/* perf/*.js 27 | 28 | .PHONY: test lint build all clean 29 | 30 | 31 | .PHONY: release-major release-minor release-patch 32 | release-major release-minor release-patch: all 33 | ./support/sync-package-managers.js 34 | git add --force *.json 35 | git add --force $(BUILDDIR) 36 | git commit -am "update minified build"; true 37 | $(XYZ) --increment $(@:release-%=%) 38 | -------------------------------------------------------------------------------- /test/server/js/managers/authentication.unit.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var expect = require('chai').expect; 4 | var app = require('express')(); 5 | 6 | describe('AuthenticationManager', function() { 7 | var AuthenticationManager = require('../../../../server/js/managers/authentication'); 8 | 9 | describe('#init', function() { 10 | AuthenticationManager.init(app); 11 | 12 | it('should initialize passport', function() { 13 | }); 14 | 15 | it('should use the KeyVerifyStrategy', function() { 16 | }); 17 | }); 18 | 19 | describe('#verify', function() { 20 | var badCreds = { 21 | username: 'badguy', 22 | nonce: 'jkf3jkj3fjfk32934', 23 | signature: 'ksdfjoiwhbvlkjweo' 24 | }; 25 | 26 | it('verification should return false with bad credentials', function() { 27 | AuthenticationManager.verify(badCreds.username, badCreds.nonce, badCreds.signature, function(err, verified) { 28 | expect(err).to.be.null; 29 | expect(verified).to.be.false; 30 | }); 31 | }); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /server/routes/client.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // routes/chat.js 3 | 4 | var pug = require('pug'); 5 | var path = require('path'); 6 | 7 | module.exports = function(app, pipo) { 8 | var logger = require('../../config/logger'); 9 | var clientConfig = require('../../config/pipo')(); 10 | 11 | app.get('/', function(req, res) { 12 | logger.debug("[ROUTE] '/'"); 13 | var username = 'default'; 14 | var templateBasedir = path.join(__dirname, '../../client/views/'); 15 | 16 | var templateOptions = { 17 | pretty: true, 18 | depRoot: '' 19 | }; 20 | 21 | var preDeps = pug.renderFile(templateBasedir + 'preDeps.pug', templateOptions); 22 | var postDeps = pug.renderFile(templateBasedir + 'postDeps.pug', templateOptions); 23 | 24 | var locals = { 25 | username : username, 26 | preDeps: preDeps, 27 | postDeps: postDeps, 28 | config: clientConfig 29 | }; 30 | 31 | var renderedClient = pug.renderFile(path.join(__dirname, '../../client/views/client.pug'), locals); 32 | res.send(renderedClient); 33 | }); 34 | }; 35 | -------------------------------------------------------------------------------- /client/js/components/SparkMD5/LICENSE2: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 André Cruz 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /client/js/users/masterUserlist.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var masterUserlist = {}; 4 | 5 | function MasterUserlist(socketClient, options) { 6 | if (!(this instanceof MasterUserlist)) { 7 | return new MasterUserlist(socketClient, options); 8 | } 9 | 10 | this.chatManager = socketClient.chatManager; 11 | this.encryptionManager = socketClient.encryptionManager; 12 | this._options = options; 13 | } 14 | 15 | /* 16 | * Update the master userlist 17 | */ 18 | MasterUserlist.prototype.update = function update(userlist, callback) { 19 | var self = this; 20 | self.chatManager.userlist = userlist; 21 | 22 | // Update key instance for all users 23 | Object.keys(userlist).forEach(function(userId) { 24 | var userPubKey = userlist[userId].publicKey; 25 | if (userPubKey) { 26 | self.encryptionManager.getKeyInstance( 27 | userPubKey, 28 | function(keyInstance) { 29 | self.chatManager.userlist[userId].keyInstance = keyInstance; 30 | } 31 | ); 32 | } 33 | }); 34 | 35 | return callback(null); 36 | }; 37 | 38 | module.exports = MasterUserlist; 39 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/imageshare/server.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var http = require('http'); 3 | 4 | // Serve client side statically 5 | var express = require('express'); 6 | var app = express(); 7 | app.use(express.static(__dirname + '/public')); 8 | 9 | var server = http.createServer(app); 10 | 11 | // Start Binary.js server 12 | var BinaryServer = require('../../').BinaryServer; 13 | 14 | // link it to express 15 | var bs = BinaryServer({server: server}); 16 | 17 | // Wait for new user connections 18 | bs.on('connection', function(client){ 19 | 20 | // Incoming stream from browsers 21 | client.on('stream', function(stream, meta){ 22 | 23 | // broadcast to all other clients 24 | for(var id in bs.clients){ 25 | if(bs.clients.hasOwnProperty(id)){ 26 | var otherClient = bs.clients[id]; 27 | if(otherClient != client){ 28 | var send = otherClient.createStream(meta); 29 | stream.pipe(send); 30 | } 31 | } 32 | } 33 | }); 34 | }); 35 | 36 | server.listen(9000); 37 | console.log('HTTP and BinaryJS server started on port 9000'); 38 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/dos.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: DOS .bat 3 | Author: Alexander Makarov (http://rmcreative.ru/) 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.dos = { 7 | case_insensitive: true, 8 | defaultMode: { 9 | keywords: { 10 | 'flow': {'if':1, 'else':1, 'goto':1, 'for':1, 'in':1, 'do':1, 'call':1, 'exit':1, 'not':1, 'exist':1, 'errorlevel':1, 'defined':1, 'equ':1, 'neq':1, 'lss':1, 'leq':1, 'gtr':1, 'geq':1}, 11 | 'keyword':{'shift':1, 'cd':1, 'dir':1, 'echo':1, 'setlocal':1, 'endlocal':1, 'set':1, 'pause':1, 'copy':1}, 12 | 'stream':{'prn':1, 'nul':1, 'lpt3':1, 'lpt2':1, 'lpt1':1, 'con':1, 'com4':1, 'com3':1, 'com2':1, 'com1':1, 'aux':1}, 13 | 'winutils':{'ping':1, 'net':1, 'ipconfig':1, 'taskkill':1, 'xcopy':1, 'ren':1, 'del':1} 14 | }, 15 | contains: [ 16 | { 17 | className: 'envvar', begin: '%[^ ]+?%' 18 | }, 19 | { 20 | className: 'number', begin: '\\b\\d+', 21 | relevance: 0 22 | }, 23 | { 24 | className: 'comment', 25 | begin: '@?rem', end: '$' 26 | } 27 | ] 28 | } 29 | }; 30 | }; -------------------------------------------------------------------------------- /client/js/components/js-md5/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v0.4.1 / 2016-03-31 2 | 3 | * Removed length detection in node.js. 4 | * Deprecated `buffer` and replace by `arrayBuffer`. 5 | 6 | # v0.4.0 / 2015-12-28 7 | 8 | * Added support for update hash. 9 | * Added support for bytes array output. 10 | * Added support for ArrayBuffer output. 11 | * Added support for AMD. 12 | 13 | # v0.3.0 / 2015-03-07 14 | 15 | * Support byte Array, Uint8Array and ArrayBuffer input. 16 | 17 | # v0.2.2 / 2015-02-01 18 | 19 | * Fixed bug when special length. 20 | * Improve performance for node.js. 21 | 22 | # v0.2.1 / 2015-01-13 23 | 24 | * Improve performance. 25 | 26 | # v0.2.0 / 2015-01-12 27 | 28 | * Remove ascii parameter. 29 | * Improve performance. 30 | 31 | # v0.1.4 / 2015-01-11 32 | 33 | * Improve performance. 34 | * Add test case. 35 | 36 | # v0.1.3 / 2015-01-05 37 | 38 | * Improve performance. 39 | * Add bower package. 40 | * Fixed JSHint warnings. 41 | * Add travis. 42 | * Add coveralls. 43 | 44 | # v0.1.2 / 2014-07-27 45 | 46 | Fixed accents bug 47 | 48 | # v0.1.1 / 2014-01-05 49 | 50 | Update license 51 | 52 | # v0.1.0 / 2014-01-04 53 | 54 | Initial release 55 | -------------------------------------------------------------------------------- /client/js/components/async/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2014 Caolan McMahon 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /client/js/components/js-md5/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2014-2016 Chen, Yi-Cyuan 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Eric Zhang, http://binaryjs.com 2 | 3 | (The MIT License) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/imageshare/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /client/js/components/async/perf/memory.js: -------------------------------------------------------------------------------- 1 | if (process.execArgv[0] !== "--expose-gc") { 2 | console.error("please run with node --expose-gc"); 3 | process.exit(1); 4 | } 5 | 6 | var async = require("../"); 7 | global.gc(); 8 | var startMem = process.memoryUsage().heapUsed; 9 | 10 | function waterfallTest(cb) { 11 | var functions = []; 12 | 13 | for(var i = 0; i < 10000; i++) { 14 | functions.push(function leaky(next) { 15 | function func1(cb) {return cb(); } 16 | 17 | function func2(callback) { 18 | if (true) { 19 | callback(); 20 | //return next(); // Should be callback here. 21 | } 22 | } 23 | 24 | function func3(cb) {return cb(); } 25 | 26 | async.waterfall([ 27 | func1, 28 | func2, 29 | func3 30 | ], next); 31 | }); 32 | } 33 | 34 | async.parallel(functions, cb); 35 | } 36 | 37 | function reportMemory() { 38 | global.gc(); 39 | var increase = process.memoryUsage().heapUsed - startMem; 40 | console.log("memory increase: " + 41 | (+(increase / 1024).toPrecision(3)) + "kB"); 42 | } 43 | 44 | waterfallTest(function () { 45 | setTimeout(reportMemory, 0); 46 | }); 47 | -------------------------------------------------------------------------------- /client/js/components/js-md5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-md5", 3 | "version": "0.4.1", 4 | "description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.", 5 | "main": "src/md5.js", 6 | "devDependencies": { 7 | "expect.js": "~0.3.1", 8 | "jscoverage": "~0.5.9", 9 | "jsdoc": "^3.4.0", 10 | "mocha": "~2.3.4", 11 | "requirejs": "^2.1.22", 12 | "uglifyjs": "~2.4.10" 13 | }, 14 | "scripts": { 15 | "test": "mocha tests/node-test.js -r jscoverage", 16 | "report": "mocha tests/node-test.js -r jscoverage --covout=html", 17 | "coveralls": "mocha tests/node-test.js -R mocha-lcov-reporter -r jscoverage | coveralls", 18 | "doc": "rm -rf doc;jsdoc src README.md -d doc", 19 | "compress": "uglifyjs src/md5.js --compress --mangle --comments --output build/md5.min.js", 20 | "build": "npm run-script compress;npm run-script doc" 21 | }, 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/emn178/js-md5.git" 25 | }, 26 | "keywords": [ 27 | "md5", 28 | "hash", 29 | "encryption", 30 | "cryptography", 31 | "HMAC" 32 | ], 33 | "license": "MIT", 34 | "author": "Chen, Yi-Cyuan ", 35 | "homepage": "https://github.com/emn178/js-md5", 36 | "bugs": { 37 | "url": "https://github.com/emn178/js-md5/issues" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/js/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module pipo/utils 3 | * @license LGPL-3.0 4 | */ 5 | 6 | 'use strict'; 7 | 8 | /** 9 | * Dynamically sorts an object by a particular property 10 | * @param {String} property - The name of the field to sort by 11 | */ 12 | module.exports.dynamicSort = function(property) { 13 | var sortOrder = 1; 14 | if(property[0] === "-") { 15 | sortOrder = -1; 16 | property = property.substr(1); 17 | } 18 | return function (a,b) { 19 | var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0; 20 | return result * sortOrder; 21 | }; 22 | }; 23 | 24 | /** 25 | * Finds the location of the cursor in a text field 26 | * @param {HTMLImputElement} - The text field from which to retrieve the cursor location 27 | */ 28 | module.exports.getCaret = function(el) { 29 | if (el.selectionStart) { 30 | return el.selectionStart; 31 | } else if (document.selection) { 32 | el.focus(); 33 | var r = document.selection.createRange(); 34 | if (r === null) { 35 | return 0; 36 | } 37 | var re = el.createTextRange(), 38 | rc = re.duplicate(); 39 | re.moveToBookmark(r.getBookmark()); 40 | rc.setEndPoint('EndToStart', re); 41 | return rc.text.length; 42 | } 43 | return 0; 44 | }; 45 | 46 | /** 47 | * Empty function stub 48 | + @private 49 | */ 50 | module.exports.noop = function() {}; 51 | -------------------------------------------------------------------------------- /client/test/js/chatHeader.unit.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var expect = require('chai').expect; 4 | var chatHeader = require('../../js/chat/header.js'); 5 | 6 | describe('chatHeader', function() { 7 | 8 | describe('update', function() { 9 | it('should update the icon appropriately for type chat', function(callback) { 10 | }); 11 | 12 | it('should update the icon appropriately for type room', function(callback) { 13 | 14 | }); 15 | 16 | it('should enable the favorite button if room is a favorite', function(callback) { 17 | //chatHeader.update('57cb9d08f0c5bea981140b65'); 18 | }); 19 | 20 | it('should be able to determine if a room is a favorite or not', function(callback) { 21 | var ChatManager = { 22 | userProfile: { 23 | membership: { 24 | favoriteRooms: [ 25 | '57cb9d08f0c5bea981140b65' 26 | ] 27 | } 28 | }, 29 | activeChat: '57cb9d08f0c5bea981140b65', 30 | chats: { 31 | '57cb9d08f0c5bea981140b65': { 32 | name: 'testChat', 33 | topic: 'test topic', 34 | group: 'test group' 35 | } 36 | } 37 | }; 38 | 39 | var isFavorite = chatHeader.isFavorite('57cb9d08f0c5bea981140b65'); 40 | 41 | expect(isFavorite).to.equal(true); 42 | callback(); 43 | 44 | }); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/parser3.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Parser3 3 | Requires: xml.js 4 | Author: Oleg Volchkov 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.parser3 = function() { 8 | var COMMENTED_BLOCK = { 9 | begin: '{', end: '}' 10 | }; 11 | COMMENTED_BLOCK.contains = [COMMENTED_BLOCK]; 12 | 13 | return { 14 | defaultMode: { 15 | subLanguage: 'html', 16 | contains: [ 17 | { 18 | className: 'comment', 19 | begin: '^#', end: '$' 20 | }, 21 | { 22 | className: 'comment', 23 | contains: [COMMENTED_BLOCK], 24 | begin: '\\^rem{', end: '}', 25 | relevance: 10 26 | }, 27 | { 28 | className: 'preprocessor', 29 | begin: '^@(?:BASE|USE|CLASS|OPTIONS)$', 30 | relevance: 10 31 | }, 32 | { 33 | className: 'title', 34 | begin: '@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$' 35 | }, 36 | { 37 | className: 'variable', 38 | begin: '\\$\\{?[\\w\\-\\.\\:]+\\}?' 39 | }, 40 | { 41 | className: 'keyword', 42 | begin: '\\^[\\w\\-\\.\\:]+' 43 | }, 44 | { 45 | className: 'number', 46 | begin: '\\^#[0-9a-fA-F]+' 47 | }, 48 | hljs.C_NUMBER_MODE 49 | ] 50 | } 51 | }; 52 | }(); 53 | }; -------------------------------------------------------------------------------- /client/js/users/user.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | /** 4 | * @module pipo/users/user 5 | * @license LGPL-3.0 6 | */ 7 | 8 | /** 9 | * Things relating to managing users 10 | */ 11 | 12 | function User() { 13 | if (!(this instanceof User)) { 14 | return new User(); 15 | } 16 | } 17 | 18 | User.prototype.init = function init(managers) { 19 | this.socketClient = managers.socketClient; 20 | }; 21 | 22 | User.prototype.checkAvailability = function checkAvailability(username, callback) { 23 | var self = this; 24 | var usernameCallback = callback; 25 | 26 | // Create a listener tied to the username we are checking 27 | self.socketClient.socket.on('availability-' + username, function(data) { 28 | console.log("[socketClient.checkUsernameAvailability] Got availability callback"); 29 | var available = data.available; 30 | var error = data.error; 31 | 32 | if (error) { 33 | console.log("[socketClient.checkUsernameAvailability] There was an error while checking username availability"); 34 | 35 | // Show error on modal 36 | }; 37 | 38 | self.socketClient.socket.removeListener('availability-' + username); 39 | usernameCallback({ available: available }); 40 | }); 41 | 42 | // Send the socket request to check the username 43 | self.socketClient.socket.emit('checkUsernameAvailability', { username: username, socketCallback: 'availability-' + username }); 44 | }; 45 | 46 | module.exports = User; 47 | -------------------------------------------------------------------------------- /docs/pipo_whitepaper: -------------------------------------------------------------------------------- 1 | # PiPo Protocol 2 | 3 | 4 | 5 | ## Trust Chain 6 | 7 | ### Initial chain of trust certificate creation 8 | 9 | ### Server sitnature 10 | 11 | ### Signing an action as a level 0 chain member 12 | 13 | ### Signing an action as a level 1+ chain member 14 | 15 | ### Confirming authenticity as a client 16 | 17 | 18 | 19 | ## Membership Authenticity Confirmation 20 | 21 | ### Member gets a notification that a new user has been added to a room. This member needs to confirm that the user was actually added by someone in the chain of trust 22 | - Level 0 member adds user and signs a block of JSON confirming that this user is authorized to be a member of a specific room 23 | - Message is relayed by the server to all appropriate users 24 | - Receiving user uses the level 0 member's public key to confirm the signature of that data 25 | - User then locally signs the transaction to add that member to their local chain so that the chain integrity can be confirmed when signing in again? 26 | 27 | ## Issues to solve 28 | 29 | ### New user signs up after server has been compromised 30 | #### New user checks with majority of aged clients for concensus 31 | 32 | 33 | 34 | ## Room Protocol 35 | 36 | ## Ad Hoc Room Protocol 37 | 38 | ## One to One Protocol 39 | 40 | ## Client to Server Command Protocol 41 | 42 | ## Server to Client Protocol 43 | 44 | 45 | ## Chat history retention 46 | 47 | ### When enabled 48 | 49 | ### When disabled 50 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/profile.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Python profile 3 | Description: Python profiler results 4 | Author: Brian Beck 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.profile = { 8 | defaultMode: { 9 | contains: [ 10 | hljs.C_NUMBER_MODE, 11 | { 12 | className: 'builtin', 13 | begin: '{', end: '}$', 14 | excludeBegin: true, excludeEnd: true, 15 | contains: [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE], 16 | relevance: 0 17 | }, 18 | { 19 | className: 'filename', 20 | begin: '(/\w|[a-zA-Z_][\da-zA-Z_]+\\.[\da-zA-Z_]{1,3})', end: ':', 21 | excludeEnd: true 22 | }, 23 | { 24 | className: 'header', 25 | begin: '(ncalls|tottime|cumtime)', end: '$', 26 | keywords: {'ncalls': 1, 'tottime': 10, 'cumtime': 10, 'filename': 1}, 27 | relevance: 10 28 | }, 29 | { 30 | className: 'summary', 31 | begin: 'function calls', end: '$', 32 | contains: [hljs.C_NUMBER_MODE], 33 | relevance: 10 34 | }, 35 | hljs.APOS_STRING_MODE, 36 | hljs.QUOTE_STRING_MODE, 37 | { 38 | className: 'function', 39 | begin: '\\(', end: '\\)$', 40 | contains: [{ 41 | className: 'title', 42 | begin: hljs.UNDERSCORE_IDENT_RE, 43 | relevance: 0 44 | }], 45 | relevance: 0 46 | } 47 | ] 48 | } 49 | }; 50 | }; -------------------------------------------------------------------------------- /client/js/components/async/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "async", 3 | "description": "Higher-order functions and common patterns for asynchronous code", 4 | "main": "lib/async.js", 5 | "keywords": [ 6 | "async", 7 | "callback", 8 | "utility", 9 | "module" 10 | ], 11 | "license": "MIT", 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/caolan/async.git" 15 | }, 16 | "devDependencies": { 17 | "benchmark": "bestiejs/benchmark.js", 18 | "bluebird": "^2.9.32", 19 | "chai": "^3.1.0", 20 | "coveralls": "^2.11.2", 21 | "es6-promise": "^2.3.0", 22 | "jscs": "^1.13.1", 23 | "jshint": "~2.8.0", 24 | "karma": "^0.13.2", 25 | "karma-browserify": "^4.2.1", 26 | "karma-firefox-launcher": "^0.1.6", 27 | "karma-mocha": "^0.2.0", 28 | "karma-mocha-reporter": "^1.0.2", 29 | "lodash": "^3.9.0", 30 | "mkdirp": "~0.5.1", 31 | "mocha": "^2.2.5", 32 | "native-promise-only": "^0.8.0-a", 33 | "nodeunit": ">0.0.0", 34 | "nyc": "^2.1.0", 35 | "rsvp": "^3.0.18", 36 | "semver": "^4.3.6", 37 | "uglify-js": "~2.4.0", 38 | "xyz": "^0.5.0", 39 | "yargs": "~3.9.1" 40 | }, 41 | "moduleType": [ 42 | "amd", 43 | "globals", 44 | "node" 45 | ], 46 | "ignore": [ 47 | "**/.*", 48 | "node_modules", 49 | "bower_components", 50 | "test", 51 | "tests" 52 | ], 53 | "authors": [ 54 | "Caolan McMahon" 55 | ], 56 | "version": "1.5.2" 57 | } 58 | -------------------------------------------------------------------------------- /config/logger.js: -------------------------------------------------------------------------------- 1 | var winston = require('winston'); 2 | 3 | var logger = new (winston.Logger)({ 4 | levels: { 5 | trace: 0, 6 | input: 1, 7 | verbose: 2, 8 | prompt: 3, 9 | debug: 4, 10 | info: 5, 11 | data: 6, 12 | help: 7, 13 | warn: 8, 14 | error: 9 15 | }, 16 | colors: { 17 | trace: 'magenta', 18 | input: 'grey', 19 | verbose: 'cyan', 20 | prompt: 'grey', 21 | debug: 'blue', 22 | info: 'green', 23 | data: 'grey', 24 | help: 'cyan', 25 | warn: 'yellow', 26 | error: 'red' 27 | }, 28 | }); 29 | 30 | if (process.env.NODE_ENV !== 'test') { 31 | logger.add(winston.transports.File, { 32 | level: 'info', 33 | prettyPrint: false, 34 | colorize: true, 35 | silent: false, 36 | timestamp: true, 37 | filename: './pipo.log', 38 | maxsize: 4000000, 39 | maxFiles: 10, 40 | json: false 41 | }) 42 | 43 | logger.add(winston.transports.Console, { 44 | level: 'debug', 45 | prettyPrint: true, 46 | colorize: true, 47 | silent: false, 48 | timestamp: false 49 | }) 50 | } else { 51 | // while testing, log only to file, leaving stdout free for unit test status messages 52 | logger.add(winston.transports.File, { 53 | level: 'debug', 54 | prettyPrint: false, 55 | colorize: true, 56 | silent: false, 57 | timestamp: true, 58 | filename: './pipo.log', 59 | maxsize: 4000000, 60 | maxFiles: 10, 61 | json: false 62 | }) 63 | } 64 | 65 | module.exports = logger; 66 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/smalltalk.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Smalltalk 3 | Author: Vladimir Gubarkov 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.smalltalk = function() { 7 | var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*'; 8 | var CHAR = { 9 | className: 'char', 10 | begin: '\\$.{1}' 11 | }; 12 | var SYMBOL = { 13 | className: 'symbol', 14 | begin: '#' + hljs.UNDERSCORE_IDENT_RE 15 | }; 16 | return { 17 | defaultMode: { 18 | keywords: {'self': 1, 'super': 1, 'nil': 1, 'true': 1, 'false': 1, 'thisContext': 1}, // only 6 19 | contains: [ 20 | { 21 | className: 'comment', 22 | begin: '"', end: '"', 23 | relevance: 0 24 | }, 25 | hljs.APOS_STRING_MODE, 26 | { 27 | className: 'class', 28 | begin: '\\b[A-Z][A-Za-z0-9_]*', 29 | relevance: 0 30 | }, 31 | { 32 | className: 'method', 33 | begin: VAR_IDENT_RE + ':' 34 | }, 35 | hljs.C_NUMBER_MODE, 36 | SYMBOL, 37 | CHAR, 38 | { 39 | className: 'localvars', 40 | begin: '\\|\\s*((' + VAR_IDENT_RE + ')\\s*)+\\|' 41 | }, 42 | { 43 | className: 'array', 44 | begin: '\\#\\(', end: '\\)', 45 | contains: [ 46 | hljs.APOS_STRING_MODE, 47 | CHAR, 48 | hljs.C_NUMBER_MODE, 49 | SYMBOL 50 | ] 51 | } 52 | ] 53 | } 54 | }; 55 | }(); 56 | }; -------------------------------------------------------------------------------- /docs/todo.airplane: -------------------------------------------------------------------------------- 1 | - Figure out how to detect when we can't fetch a gravatar avatar and load a default image 2 | - Load all fonts locally instead of from google fonts 3 | 4 | Crypto Problems to solve 5 | - How to do user/key verification in private chats 6 | - How to verify users in rooms created by a random user 7 | - Might just use the chain from the main admin that added the user 8 | - If the user was added by email address, they may have to pop on a confirmation list for someone to 9 | verify their key in person or via an acceptable method before the user is added 10 | 11 | 12 | Private Chat join/part 13 | - Private Chat Initiation 14 | * User clicks the private chat button on user popup 15 | - This emits getChat with the chatHash and waits for a chatUpdate 16 | * User gets a private chat message 17 | - Private Chat Destroy 18 | 19 | - Private chat userlist status should go by user.active 20 | 21 | 22 | Recover from a crash 23 | - At the very last moment when the server is shutting down, set some flag in the DB so we know there wasn't a crash and all methods have been completed 24 | - On startup check this flag (maybe always do this) and check things to make sure they are in a godo state 25 | - Check user.active status for all users (or clear all) 26 | - Check user.membership._currentRooms (or clear all) 27 | 28 | 29 | Update Active Users 30 | - Disconnect 31 | - Connect 32 | - Join 33 | - Room 34 | - Chat 35 | - Part 36 | - Room 37 | - Chat 38 | 39 | 40 | Need to figure out how to force a space in jade for client.jade (line: 197) 41 | -------------------------------------------------------------------------------- /client/css/highlight.js/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006, Ivan Sagalaev 2 | All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of highlight.js nor the names of its contributors 12 | may be used to endorse or promote products derived from this software 13 | without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY 16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /client/js/messaging/serverCommand.js: -------------------------------------------------------------------------------- 1 | var ServerCommand = {}; 2 | 3 | ServerCommand.parse = function parse(data, callback) { 4 | var regexResult = data.regexResult; 5 | 6 | // Catch commands here and encrypt data to users as needed 7 | var command = regexResult[1]; 8 | var splitCommand = command.split(" "); 9 | var currentChatId = ChatManager.activeChat.id; 10 | console.log("Split command is: " + splitCommand.toString()); 11 | 12 | // Catch join command 13 | if (splitCommand[0] == "join") { 14 | var room = splitCommand[1]; 15 | socketClient.joinRoom(room, function(err) { 16 | console.log("Sent request to join room " + room); 17 | }); 18 | } 19 | else if (splitCommand[0] == "part") { 20 | var name = splitCommand[1]; 21 | socketClient.partRoom({ chatId: currentChatId }, function(err) { 22 | console.log("Sent request to part room " + name); 23 | }) 24 | } 25 | else if (splitCommand[0] == "help") { 26 | var command = splitCommand[1]; 27 | ChatManager.showHelp(); 28 | //var message = command.split(" ").slice(2).join(" "); 29 | } 30 | else { 31 | // Not a locally parsed command so sending unencrypted to server (server might should have its own key to decrypt server commands) 32 | var currentChannel = null; 33 | currentChannel = ChatManager.chats[ChatManager.activeChat.id].name; 34 | socketClient.sendServerCommand({ command: regexResult[1], currentChat: ChatManager.activeChat.id }); 35 | console.log("Sending command '" + regexResult[1] + "' to server"); 36 | } 37 | $('#message-input').val(''); 38 | return callback(); 39 | }; 40 | 41 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/test/server.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var binaryjs = require('../'); 3 | var BinaryServer = binaryjs.BinaryServer; 4 | var BinaryClient = binaryjs.BinaryClient; 5 | var http = require('http'); 6 | 7 | var server, client, serverUrl = 'ws://localhost:9101'; 8 | 9 | describe('BinaryServer', function(){ 10 | describe('creating servers', function(){ 11 | it('should allow creating servers with a port', function(){ 12 | server = new BinaryServer({port: 9101}); 13 | }); 14 | it('should allow creating servers with an http server', function(){ 15 | new BinaryServer({port: 9102}); 16 | }); 17 | }); 18 | describe('.clients', function(){ 19 | it('should contain a list of clients', function(done){ 20 | var i = 0; 21 | var startLength = Object.keys(server.clients).length; 22 | server.on('connection', function(client){ 23 | assert.equal(server.clients[client.id], client); 24 | if(++i == 3) { 25 | var endLength = Object.keys(server.clients).length; 26 | assert.equal(endLength - startLength, i); 27 | done(); 28 | } 29 | }); 30 | new BinaryClient(serverUrl); 31 | new BinaryClient(serverUrl); 32 | new BinaryClient(serverUrl); 33 | }); 34 | }); 35 | describe('.close()', function(){ 36 | it('should prevent future clients connecting', function(done){ 37 | server.close(); 38 | var client = new BinaryClient(serverUrl); 39 | client.on('error', function(){ 40 | done(); 41 | }); 42 | }); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/diff.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Diff 3 | Description: Unified and context diff 4 | Author: Vasily Polovnyov 5 | Category: common 6 | */ 7 | module.exports = function(hljs){ 8 | hljs.LANGUAGES.diff = { 9 | case_insensitive: true, 10 | defaultMode: { 11 | contains: [ 12 | { 13 | className: 'chunk', 14 | begin: '^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$', 15 | relevance: 10 16 | }, 17 | { 18 | className: 'chunk', 19 | begin: '^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$', 20 | relevance: 10 21 | }, 22 | { 23 | className: 'chunk', 24 | begin: '^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$', 25 | relevance: 10 26 | }, 27 | { 28 | className: 'header', 29 | begin: 'Index: ', end: '$' 30 | }, 31 | { 32 | className: 'header', 33 | begin: '=====', end: '=====$' 34 | }, 35 | { 36 | className: 'header', 37 | begin: '^\\-\\-\\-', end: '$' 38 | }, 39 | { 40 | className: 'header', 41 | begin: '^\\*{3} ', end: '$' 42 | }, 43 | { 44 | className: 'header', 45 | begin: '^\\+\\+\\+', end: '$' 46 | }, 47 | { 48 | className: 'header', 49 | begin: '\\*{5}', end: '\\*{5}$' 50 | }, 51 | { 52 | className: 'addition', 53 | begin: '^\\+', end: '$' 54 | }, 55 | { 56 | className: 'deletion', 57 | begin: '^\\-', end: '$' 58 | }, 59 | { 60 | className: 'change', 61 | begin: '^\\!', end: '$' 62 | } 63 | ] 64 | } 65 | }; 66 | }; -------------------------------------------------------------------------------- /client/js/components/async/deps/nodeunit.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Styles taken from qunit.css 3 | */ 4 | 5 | h1#nodeunit-header, h1.nodeunit-header { 6 | padding: 15px; 7 | font-size: large; 8 | background-color: #06b; 9 | color: white; 10 | font-family: 'trebuchet ms', verdana, arial; 11 | margin: 0; 12 | } 13 | 14 | h1#nodeunit-header a { 15 | color: white; 16 | } 17 | 18 | h2#nodeunit-banner { 19 | height: 2em; 20 | border-bottom: 1px solid white; 21 | background-color: #eee; 22 | margin: 0; 23 | font-family: 'trebuchet ms', verdana, arial; 24 | } 25 | h2#nodeunit-banner.pass { 26 | background-color: green; 27 | } 28 | h2#nodeunit-banner.fail { 29 | background-color: red; 30 | } 31 | 32 | h2#nodeunit-userAgent, h2.nodeunit-userAgent { 33 | padding: 10px; 34 | background-color: #eee; 35 | color: black; 36 | margin: 0; 37 | font-size: small; 38 | font-weight: normal; 39 | font-family: 'trebuchet ms', verdana, arial; 40 | font-size: 10pt; 41 | } 42 | 43 | div#nodeunit-testrunner-toolbar { 44 | background: #eee; 45 | border-top: 1px solid black; 46 | padding: 10px; 47 | font-family: 'trebuchet ms', verdana, arial; 48 | margin: 0; 49 | font-size: 10pt; 50 | } 51 | 52 | ol#nodeunit-tests { 53 | font-family: 'trebuchet ms', verdana, arial; 54 | font-size: 10pt; 55 | } 56 | ol#nodeunit-tests li strong { 57 | cursor:pointer; 58 | } 59 | ol#nodeunit-tests .pass { 60 | color: green; 61 | } 62 | ol#nodeunit-tests .fail { 63 | color: red; 64 | } 65 | 66 | p#nodeunit-testresult { 67 | margin-left: 1em; 68 | font-size: 10pt; 69 | font-family: 'trebuchet ms', verdana, arial; 70 | } 71 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://secure.travis-ci.org/binaryjs/binaryjs.png)](http://travis-ci.org/binaryjs/binaryjs) 2 | 3 | BinaryJS 4 | ======== 5 | 6 | We're under development! 7 | 8 | For docs and more info 9 | http://binaryjs.com 10 | 11 | Node binary websocket streaming made easy 12 | 13 | 14 | ## Download 15 | 16 | Server 17 | 18 | ```console 19 | $ npm install binaryjs 20 | ``` 21 | or from Git 22 | ```console 23 | $ git clone git://github.com/binaryjs/binaryjs.git 24 | $ cd binaryjs 25 | $ npm install -g 26 | ``` 27 | 28 | Client 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### http://binaryjs.com for docs and demos 35 | 36 | 37 | ## Changelog 38 | 0.2.2 39 | 40 | - Update js-binarypack to 0.0.9, removed unused check. 41 | 42 | 0.2.1 43 | 44 | - Update js-binarypack to 0.0.7, fast utf8 support now on by default. 45 | 46 | 0.2.0 47 | 48 | - Fix critical BinaryPack issue prevent TypedArrays of 16 bit or greater from being serialized correctly 49 | 50 | 0.1.9 51 | 52 | - Fix close internal socket (removing not supported code/message parameters) 53 | 54 | 0.1.8 55 | 56 | - Does not throw exceptions when writing on a stream with closed underlying socket 57 | - StreamID no longer has to be a number 58 | - Use newer version of node-binarypack 59 | 60 | 0.1.7 61 | 62 | - Fix critical bug involving drain event not firing. Bump `streamws` to 0.1.1 63 | 64 | 0.1.5 65 | 66 | - `streamws` version `>=0.1.0` is now required 67 | - Streams no longer add their own listeners to error/close/drain events (fixes leaks) 68 | - Calls to `socket.send` no longer include `{binary: true}` or callback parameters (fixes type error in some browsers) 69 | -------------------------------------------------------------------------------- /client/js/network/binSocketClient.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var through = require('through'); 4 | 5 | function BinSocketClient(options) { 6 | if (!(this instanceof BinSocketClient)) { 7 | return new BinSocketClient(options); 8 | } 9 | 10 | this._options = options || {}; 11 | var protocol = window.location.protocol; 12 | 13 | var binServerProtocol = 'ws'; 14 | // Need to set sane defaults for these or derive them from window.location 15 | var binServerHost = ''; 16 | var binServerPort = ''; 17 | 18 | if (window.config) { 19 | binServerHost = window.config.binClient.host; 20 | binServerPort = window.config.binClient.port; 21 | 22 | if (window.config.binClient.ssl) { 23 | binServerProtocol = 'wss'; 24 | } 25 | } 26 | 27 | var binServer = binServerProtocol + '://' + binServerHost + ':' + binServerPort; 28 | 29 | console.log("Binary Server: " + binServer); 30 | 31 | this.binSocket = new BinaryClient(binServer); 32 | console.log("[binSocketClient.init] binSocket: ", this.binSocket); 33 | console.log("[binSocketClient.init] Connected to binServer at " + binServer); 34 | } 35 | 36 | BinSocketClient.prototype.close = function() { 37 | return this.binSocket.close(); 38 | }; 39 | 40 | BinSocketClient.prototype.getSocket = function() { 41 | return this.binSocket; 42 | }; 43 | 44 | // Need to make this be able to handle multiple streams at one time (pass id or something) 45 | // Could create a local listener with event emitter to wait for a id 46 | BinSocketClient.prototype.listenForFileStream = function(callback) { 47 | this.binSocket.on('stream', function(fileStream, metadata) { 48 | callback(fileStream, metadata); 49 | }); 50 | }; 51 | 52 | module.exports = BinSocketClient; 53 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/tex.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: TeX 3 | Author: Vladimir Moskva 4 | Website: http://fulc.ru/ 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.tex = function() { 8 | var COMMAND1 = { 9 | className: 'command', 10 | begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?', 11 | relevance: 10 12 | }; 13 | var COMMAND2 = { 14 | className: 'command', 15 | begin: '\\\\[^a-zA-Zа-яА-я0-9]', 16 | relevance: 0 17 | }; 18 | var SPECIAL = { 19 | className: 'special', 20 | begin: '[{}\\[\\]\\&#~]', 21 | relevance: 0 22 | }; 23 | 24 | return { 25 | defaultMode: { 26 | contains: [ 27 | { // parameter 28 | begin: '\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?', 29 | returnBegin: true, 30 | contains: [ 31 | COMMAND1, COMMAND2, 32 | { 33 | className: 'number', 34 | begin: ' *=', end: '-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?', 35 | excludeBegin: true 36 | } 37 | ], 38 | relevance: 10 39 | }, 40 | COMMAND1, COMMAND2, 41 | SPECIAL, 42 | { 43 | className: 'formula', 44 | begin: '\\$\\$', end: '\\$\\$', 45 | contains: [COMMAND1, COMMAND2, SPECIAL], 46 | relevance: 0 47 | }, 48 | { 49 | className: 'formula', 50 | begin: '\\$', end: '\\$', 51 | contains: [COMMAND1, COMMAND2, SPECIAL], 52 | relevance: 0 53 | }, 54 | { 55 | className: 'comment', 56 | begin: '%', end: '$', 57 | relevance: 0 58 | } 59 | ] 60 | } 61 | }; 62 | }(); 63 | }; -------------------------------------------------------------------------------- /client/js/components/async/mocha_test/forever.js: -------------------------------------------------------------------------------- 1 | var async = require('../lib/async'); 2 | var expect = require('chai').expect; 3 | var isBrowser = require('./support/is_browser'); 4 | 5 | describe('forever', function(){ 6 | context('function is asynchronous', function(){ 7 | it('executes the function over and over until it yields an error', function(done){ 8 | var counter = 0; 9 | function addOne(callback) { 10 | counter++; 11 | if (counter === 50) { 12 | return callback('too big!'); 13 | } 14 | async.setImmediate(function () { 15 | callback(); 16 | }); 17 | } 18 | async.forever(addOne, function (err) { 19 | expect(err).to.eql('too big!'); 20 | expect(counter).to.eql(50); 21 | done(); 22 | }); 23 | }); 24 | }); 25 | 26 | context('function is synchronous', function(){ 27 | it('does not cause a stack overflow', function(done){ 28 | if (isBrowser()) return done(); // this will take forever in a browser 29 | var counter = 0; 30 | function addOne(callback) { 31 | counter++; 32 | if (counter === 50000) { // needs to be huge to potentially overflow stack in node 33 | return callback('too big!'); 34 | } 35 | callback(); 36 | } 37 | async.forever(addOne, function (err) { 38 | expect(err).to.eql('too big!'); 39 | expect(counter).to.eql(50000); 40 | done(); 41 | }); 42 | }); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /client/css/highlight.js/AUTHORS.ru.txt: -------------------------------------------------------------------------------- 1 | Подсветка синтаксиса с автоопределением языка. 2 | 3 | URL: http://softwaremaniacs.org/soft/highlight/ 4 | 5 | Первоначальный автор и ведущий проекта: 6 | Иван Сагалаев 7 | 8 | Внесли свой вклад: 9 | 10 | - Петр Леонов 11 | - Виктор Карамзин 12 | - Всеволод Соловьёв 13 | - Антон Ковалёв 14 | - Никита Ледяев 15 | - Константин Евдокименко 16 | - Дмитрий Рудаков 17 | - Юрий Иванов 18 | - Владимир Ермаков 19 | - Владимир Губарьков 20 | - Брайан Бек 21 | - MajestiC 22 | - Василий Половнёв 23 | - Владимир Епифанов 24 | - Александр Макаров (http://rmcreative.ru/) 25 | - Vah 26 | - Шуэн-Хуэй Гуан 27 | - Джейсон Даймонд 28 | - Михал Габрукевич 29 | - Руслан Кеба 30 | - Сергей Баранов 31 | - Зарипов Юра 32 | - Олег Волчков 33 | - Василий Михайличенко 34 | - Ян Беркель 35 | - Владимир Москва 36 | - Лорен Сегал 37 | - Андрей Фёдоров 38 | - Игорь Кальницкий 39 | - Джереми Халл 40 | - Валерий Хиора 41 | - Николай Захаров 42 | - Дмитрий Ковега 43 | - Сергей Игнатов 44 | - Антоно Васильев 45 | - Степан Кунцьо 46 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/vs.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Visual Studio-like style based on original C# coloring by Jason Diamond 4 | 5 | */ 6 | pre code { 7 | display: block; padding: 0.5em; 8 | } 9 | 10 | pre .comment, 11 | pre .annotation, 12 | pre .template_comment, 13 | pre .diff .header, 14 | pre .chunk, 15 | pre .apache .cbracket { 16 | color: rgb(0, 128, 0); 17 | } 18 | 19 | pre .keyword, 20 | pre .id, 21 | pre .title, 22 | pre .built_in, 23 | pre .aggregate, 24 | pre .smalltalk .class, 25 | pre .winutils, 26 | pre .bash .variable, 27 | pre .tex .command { 28 | color: rgb(0, 0, 255); 29 | } 30 | 31 | pre .string, 32 | pre .title, 33 | pre .parent, 34 | pre .tag .value, 35 | pre .rules .value, 36 | pre .rules .value .number, 37 | pre .ruby .symbol, 38 | pre .ruby .symbol .string, 39 | pre .ruby .symbol .keyword, 40 | pre .ruby .symbol .keymethods, 41 | pre .instancevar, 42 | pre .aggregate, 43 | pre .template_tag, 44 | pre .django .variable, 45 | pre .addition, 46 | pre .flow, 47 | pre .stream, 48 | pre .apache .tag, 49 | pre .date, 50 | pre .tex .formula { 51 | color: rgb(163, 21, 21); 52 | } 53 | 54 | pre .ruby .string, 55 | pre .decorator, 56 | pre .filter .argument, 57 | pre .localvars, 58 | pre .array, 59 | pre .attr_selector, 60 | pre .pseudo, 61 | pre .pi, 62 | pre .doctype, 63 | pre .deletion, 64 | pre .envvar, 65 | pre .shebang, 66 | pre .preprocessor, 67 | pre .userType, 68 | pre .apache .sqbracket, 69 | pre .nginx .built_in, 70 | pre .tex .special, 71 | pre .input_number { 72 | color: rgb(43, 145, 175); 73 | } 74 | 75 | pre .phpdoc, 76 | pre .javadoc, 77 | pre .xmlDocTag { 78 | color: rgb(128, 128, 128); 79 | } 80 | 81 | pre .vhdl .type { font-weight: bold; } 82 | pre .vhdl .string { color: #666666; } 83 | pre .vhdl .literal { color: rgb(163, 21, 21); } 84 | 85 | -------------------------------------------------------------------------------- /client/css/highlight.js/AUTHORS.en.txt: -------------------------------------------------------------------------------- 1 | Syntax highlighting with language autodetection. 2 | 3 | URL: http://softwaremaniacs.org/soft/highlight/en/ 4 | 5 | Original author and current maintainer: 6 | Ivan Sagalaev 7 | 8 | Contributors: 9 | 10 | - Peter Leonov 11 | - Victor Karamzin 12 | - Vsevolod Solovyov 13 | - Anton Kovalyov 14 | - Nikita Ledyaev 15 | - Konstantin Evdokimenko 16 | - Dmitri Roudakov 17 | - Yuri Ivanov 18 | - Vladimir Ermakov 19 | - Vladimir Gubarkov 20 | - Brian Beck 21 | - MajestiC 22 | - Vasily Polovnyov 23 | - Vladimir Epifanov 24 | - Alexander Makarov (http://rmcreative.ru/) 25 | - Vah 26 | - Shuen-Huei Guan 27 | - Jason Diamond 28 | - Michal Gabrukiewicz 29 | - Ruslan Keba 30 | - Sergey Baranov 31 | - Zaripov Yura 32 | - Oleg Volchkov 33 | - Vasily Mikhailitchenko 34 | - Jan Berkel 35 | - Vladimir Moskva 36 | - Loren Segal 37 | - Andrew Fedorov 38 | - Igor Kalnitsky 39 | - Jeremy Hull 40 | - Valerii Hiora 41 | - Nikolay Zakharov 42 | - Dmitry Kovega 43 | - Sergey Ignatov 44 | - Antono Vasiljev 45 | - Stephan Kountso 46 | -------------------------------------------------------------------------------- /keys/pipo.pub: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: OpenPGP.js v1.0.1 3 | Comment: http://openpgpjs.org 4 | 5 | xsBNBFcZYSQBCAC5CRZeyagAWtdmxOKvAyB7WcF6bGwhRkdEPm0iZfDIlrNz 6 | hWI/vPCLq/Vylnl4c4IAS5dhW9nLQ9yAzsj1nFzq1d30cmticNMmvhpo86iM 7 | JrjZfr6x4t4rexZkhGksc/Hq5rY+tdPPBQzLKZ1h2BXQTWpdIGIDmg2xMW2o 8 | UhGLKWbdZ1LcnjFlHOsldn9+rMM8hYEyzjwRzf19RdeaETlTES+uR9UAG76y 9 | DAFmjPBKXNH1sp3roMdmNM7w3E/bq6N5Oyjqlow2zjOcpxFonBvRjTvuU30o 10 | 7H1kw5lwZ+/lmJdqs/8y1mbIVabe7UhraCBVB7OHHjJdkSPIN8mbO4pLABEB 11 | AAHNBHBpcG/CwHIEEAEIACYFAlcZYSYGCwkIBwMCCRAZv62fqqdHsAQVCAIK 12 | AxYCAQIbAwIeAQAAy/oH/RrkUFrrOVR1yxcqIY5r9FoGLkID2vNG4Ay51LBm 13 | Z6EdQi9iQ+nuROgcS6oHDLGOgwr5LW66NrWA8Ug5HmB8i1jZu/RRzeEB2TRC 14 | MG8Xj6XkSJXOKdTxSjHaZa3DcE5wOn7kfnnzTs/AiVv6aqnoBAIKODHH4OXt 15 | eg+yAqE6BKsk0oeFpcVheOcEZzDnxIIwXnqbbrY0C+ct49NjglHueQxp2+RR 16 | GPvBa0yH3HFL0uh5Q+1IjdpfNqN9CtqkrRJJTlUkkfJku2a2IVAoI5ExiDaV 17 | owiv90w8OQX712zQ8+MqLR5yxI9qb02eF7xD5xNmbnQepRRHvqrKxKBwVDns 18 | 43HOwE0EVxlhJAEIAMZe14LkGSCZVnoyIeTnS9+ac9k06SJ+0bWnuuN2BuKk 19 | UqDVdsAA6SJ7KRLBkMckX7S4tzjtCfo7k9uUKVpoI+GgLISvd3xziTNQhKea 20 | d9/KhyqkMOQA7D1pJq+9hJxHWf249nFrMbAmAt+QajJGVXHWfPgjTFJx3uTk 21 | Ytg60XrTt1sHtAdJlC0yK81rQ1tOHFZmaGYYxRZ2YTmA6TppeZ24SLFpUq2K 22 | aNdz34rqV6AKYrS0cbSrWGNGqMoZr3Io0mlecnEhPRuMxLPMg+nnR5lY09Sf 23 | LI028OmsyI76O9TB4l8txjltX982NBwTChaJaNELqx0UWCSkQonyz8G3gAcA 24 | EQEAAcLAXwQYAQgAEwUCVxlhJgkQGb+tn6qnR7ACGwwAAI4tCACF7Qcwvah1 25 | HzuNyF32xOzK+XKmoxGrqD/c7LZa8uQ8CYoK/QjffE1tgI/wtgFZNjxa7tfO 26 | UZFsx0XJYB2x3JHcPv/k7iYtemmqSQt1hjiNgMw3VP7Zx1jS7uKZo2kzf6Kb 27 | 82pvpiGdez3wA+9KcCY1VLDXt3B9IwTFXL9rY/DFCLpclw/i+tuEU/XWmUhQ 28 | nrTRFTw0iS0NyOfB08s4v4vt0AfV1sBRL/PsiwXv5Wwbt4jhDBo1ha3e1Pt7 29 | pvXbJKbJQKswU5deyc09Pt1rlV9nqOlKxgQDWWp4FsIaXBASPeO5tVJN3OUd 30 | fM9iOIDQR6ZhKKcQUpcU7IlhrwDrlzWj 31 | =bMGM 32 | -----END PGP PUBLIC KEY BLOCK----- 33 | -------------------------------------------------------------------------------- /client/js/components/async/support/sync-package-managers.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // This should probably be its own module but complaints about bower/etc. 4 | // support keep coming up and I'd rather just enable the workflow here for now 5 | // and figure out where this should live later. -- @beaugunderson 6 | 7 | var fs = require('fs'); 8 | var _ = require('lodash'); 9 | 10 | var packageJson = require('../package.json'); 11 | 12 | var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests']; 13 | var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE']; 14 | var REPOSITORY_NAME = 'caolan/async'; 15 | 16 | packageJson.jam = { 17 | main: packageJson.main, 18 | include: INCLUDES, 19 | categories: ['Utilities'] 20 | }; 21 | 22 | packageJson.spm = { 23 | main: packageJson.main 24 | }; 25 | 26 | packageJson.volo = { 27 | main: packageJson.main, 28 | ignore: IGNORES 29 | }; 30 | 31 | var bowerSpecific = { 32 | moduleType: ['amd', 'globals', 'node'], 33 | ignore: IGNORES, 34 | authors: [packageJson.author] 35 | }; 36 | 37 | var bowerInclude = ['name', 'description', 'main', 'keywords', 38 | 'license', 'homepage', 'repository', 'devDependencies']; 39 | 40 | var componentSpecific = { 41 | repository: REPOSITORY_NAME, 42 | scripts: [packageJson.main] 43 | }; 44 | 45 | var componentInclude = ['name', 'description', 'version', 'keywords', 46 | 'license', 'main']; 47 | 48 | var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific); 49 | var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific); 50 | 51 | fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2)); 52 | fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2)); 53 | fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2)); 54 | -------------------------------------------------------------------------------- /client/views/postDeps.pug: -------------------------------------------------------------------------------- 1 | if(platform == "electron") 2 | script. 3 | window.config = !{JSON.stringify(config)}; 4 | window.$ = window.jQuery = require('jquery'); 5 | window.io = io = require('socket.io-client'); 6 | else 7 | script(src=depRoot + 'js/lib/jquery-1.11.1.js') 8 | script(src=depRoot + 'js/lib/kbpgp.js') 9 | script(src=depRoot + 'js/lib/semantic.js') 10 | script(src=depRoot + 'js/lib/highlight.min.js') 11 | script(src=depRoot + 'js/lib/moment.min.js') 12 | script(src=depRoot + 'js/lib/livestamp.min.js') 13 | script(src=depRoot + 'js/lib/marked.js') 14 | script(src=depRoot + 'js/lib/FileSaver.js') 15 | script(src=depRoot + 'js/lib/blob.js') 16 | script(src=depRoot + 'js/lib/jquery.pulse.js') 17 | script(src=depRoot + 'js/lib/socket.io-stream.js') 18 | script(src=depRoot + 'js/components/querystring/querystring.js') 19 | script(src=depRoot + 'js/components/http/http.js') 20 | script(src=depRoot + 'js/components/https/https.js') 21 | script(src=depRoot + 'js/components/base64/base64.js') 22 | script(src=depRoot + 'js/components/async/lib/async.js') 23 | script(src=depRoot + 'js/components/buffer/buffer.js') 24 | script(src=depRoot + 'js/components/binaryjs/dist/binary.js') 25 | script(src=depRoot + 'js/components/SparkMD5/spark-md5.js') 26 | 27 | // Load Modals (Browserify these) 28 | //script(src=depRoot + 'js/modals/registerUserPrompt.js') 29 | //script(src=depRoot + 'js/modals/unlockClientKeyPairModal.js') 30 | //script(src=depRoot + 'js/modals/createRoomModal.js') 31 | //script(src=depRoot + 'js/modals/editRoomModal.js') 32 | //script(src=depRoot + 'js/modals/sendFileModal.js') 33 | 34 | // Browserify bundle 35 | script(src=depRoot + 'js/bundle.js') 36 | 37 | // Load Helpers (Browserify these) 38 | script(src=depRoot + 'js/messaging/serverCommand.js') 39 | 40 | script. 41 | hljs.initHighlightingOnLoad(); 42 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/examples/fileupload/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 39 | 40 | 41 |
0% complete
42 |
43 | Connecting... 44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /client/js/components/async/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "async", 3 | "description": "Higher-order functions and common patterns for asynchronous code", 4 | "main": "lib/async.js", 5 | "keywords": [ 6 | "async", 7 | "callback", 8 | "utility", 9 | "module" 10 | ], 11 | "license": "MIT", 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/caolan/async.git" 15 | }, 16 | "devDependencies": { 17 | "benchmark": "bestiejs/benchmark.js", 18 | "bluebird": "^2.9.32", 19 | "chai": "^3.1.0", 20 | "coveralls": "^2.11.2", 21 | "es6-promise": "^2.3.0", 22 | "jscs": "^1.13.1", 23 | "jshint": "~2.8.0", 24 | "karma": "^0.13.2", 25 | "karma-browserify": "^4.2.1", 26 | "karma-firefox-launcher": "^0.1.6", 27 | "karma-mocha": "^0.2.0", 28 | "karma-mocha-reporter": "^1.0.2", 29 | "lodash": "^3.9.0", 30 | "mkdirp": "~0.5.1", 31 | "mocha": "^2.2.5", 32 | "native-promise-only": "^0.8.0-a", 33 | "nodeunit": ">0.0.0", 34 | "nyc": "^2.1.0", 35 | "rsvp": "^3.0.18", 36 | "semver": "^4.3.6", 37 | "uglify-js": "~2.4.0", 38 | "xyz": "^0.5.0", 39 | "yargs": "~3.9.1" 40 | }, 41 | "moduleType": [ 42 | "amd", 43 | "globals", 44 | "node" 45 | ], 46 | "ignore": [ 47 | "**/.*", 48 | "node_modules", 49 | "bower_components", 50 | "test", 51 | "tests" 52 | ], 53 | "authors": [ 54 | "Caolan McMahon" 55 | ], 56 | "version": "1.5.2", 57 | "homepage": "https://github.com/caolan/async", 58 | "_release": "1.5.2", 59 | "_resolution": { 60 | "type": "version", 61 | "tag": "v1.5.2", 62 | "commit": "a47eef3dac38d593180b1e2eaed7b512b022cb9f" 63 | }, 64 | "_source": "git://github.com/caolan/async.git", 65 | "_target": "^1.5.2", 66 | "_originalSource": "async", 67 | "_direct": true 68 | } -------------------------------------------------------------------------------- /client/css/highlight.js/languages/javascript.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Javascript 3 | Category: common 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.javascript = { 7 | defaultMode: { 8 | keywords: { 9 | 'keyword': {'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, 'new': 1, 'function': 1, 'do': 1, 'return': 1, 'void': 1, 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, 'throw': 1, 'case': 1, 'default': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'typeof': 1, 'delete': 1}, 10 | 'literal': {'true': 1, 'false': 1, 'null': 1} 11 | }, 12 | contains: [ 13 | hljs.APOS_STRING_MODE, 14 | hljs.QUOTE_STRING_MODE, 15 | hljs.C_LINE_COMMENT_MODE, 16 | hljs.C_BLOCK_COMMENT_MODE, 17 | hljs.C_NUMBER_MODE, 18 | { // regexp container 19 | begin: '(' + hljs.RE_STARTERS_RE + '|case|return|throw)\\s*', 20 | keywords: {'return': 1, 'throw': 1, 'case': 1}, 21 | contains: [ 22 | hljs.C_LINE_COMMENT_MODE, 23 | hljs.C_BLOCK_COMMENT_MODE, 24 | { 25 | className: 'regexp', 26 | begin: '/.*?[^\\\\/]/[gim]*' 27 | } 28 | ], 29 | relevance: 0 30 | }, 31 | { 32 | className: 'function', 33 | begin: '\\bfunction\\b', end: '{', 34 | keywords: {'function': 1}, 35 | contains: [ 36 | { 37 | className: 'title', begin: '[A-Za-z$_][0-9A-Za-z$_]*' 38 | }, 39 | { 40 | className: 'params', 41 | begin: '\\(', end: '\\)', 42 | contains: [ 43 | hljs.APOS_STRING_MODE, 44 | hljs.QUOTE_STRING_MODE, 45 | hljs.C_LINE_COMMENT_MODE, 46 | hljs.C_BLOCK_COMMENT_MODE 47 | ] 48 | } 49 | ] 50 | } 51 | ] 52 | } 53 | }; 54 | }; -------------------------------------------------------------------------------- /client/js/lib/livestamp.min.js: -------------------------------------------------------------------------------- 1 | // Livestamp.js / v1.1.2 / (c) 2012 Matt Bradley / MIT License 2 | (function(d,g){var h=1E3,i=!1,e=d([]),j=function(b,a){var c=b.data("livestampdata");"number"==typeof a&&(a*=1E3);b.removeAttr("data-livestamp").removeData("livestamp");a=g(a);g.isMoment(a)&&!isNaN(+a)&&(c=d.extend({},{original:b.contents()},c),c.moment=g(a),b.data("livestampdata",c).empty(),e.push(b[0]))},k=function(){i||(f.update(),setTimeout(k,h))},f={update:function(){d("[data-livestamp]").each(function(){var a=d(this);j(a,a.data("livestamp"))});var b=[];e.each(function(){var a=d(this),c=a.data("livestampdata"); 3 | if(void 0===c)b.push(this);else if(g.isMoment(c.moment)){var e=a.html(),c=c.moment.fromNow();if(e!=c){var f=d.Event("change.livestamp");a.trigger(f,[e,c]);f.isDefaultPrevented()||a.html(c)}}});e=e.not(b)},pause:function(){i=!0},resume:function(){i=!1;k()},interval:function(b){if(void 0===b)return h;h=b}},l={add:function(b,a){"number"==typeof a&&(a*=1E3);a=g(a);g.isMoment(a)&&!isNaN(+a)&&(b.each(function(){j(d(this),a)}),f.update());return b},destroy:function(b){e=e.not(b);b.each(function(){var a= 4 | d(this),c=a.data("livestampdata");if(void 0===c)return b;a.html(c.original?c.original:"").removeData("livestampdata")});return b},isLivestamp:function(b){return void 0!==b.data("livestampdata")}};d.livestamp=f;d(function(){f.resume()});d.fn.livestamp=function(b,a){l[b]||(a=b,b="add");return l[b](this,a)}})(jQuery,moment); 5 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/bash.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Bash 3 | Author: vah 4 | Category: common 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.bash = function(){ 8 | var BASH_LITERAL = {'true' : 1, 'false' : 1}; 9 | var VAR1 = { 10 | className: 'variable', 11 | begin: '\\$([a-zA-Z0-9_]+)\\b' 12 | }; 13 | var VAR2 = { 14 | className: 'variable', 15 | begin: '\\$\\{(([^}])|(\\\\}))+\\}', 16 | contains: [hljs.C_NUMBER_MODE] 17 | }; 18 | var STRING = { 19 | className: 'string', 20 | begin: '"', end: '"', 21 | illegal: '\\n', 22 | contains: [hljs.BACKSLASH_ESCAPE, VAR1, VAR2], 23 | relevance: 0 24 | }; 25 | var TEST_CONDITION = { 26 | className: 'test_condition', 27 | begin: '', end: '', 28 | contains: [STRING, VAR1, VAR2, hljs.C_NUMBER_MODE], 29 | keywords: { 30 | 'literal': BASH_LITERAL 31 | }, 32 | relevance: 0 33 | }; 34 | 35 | return { 36 | defaultMode: { 37 | keywords: { 38 | 'keyword': {'if' : 1, 'then' : 1, 'else' : 1, 'fi' : 1, 'for' : 1, 'break' : 1, 'continue' : 1, 'while' : 1, 'in' : 1, 'do' : 1, 'done' : 1, 'echo' : 1, 'exit' : 1, 'return' : 1, 'set' : 1, 'declare' : 1}, 39 | 'literal': BASH_LITERAL 40 | }, 41 | contains: [ 42 | { 43 | className: 'shebang', 44 | begin: '(#!\\/bin\\/bash)|(#!\\/bin\\/sh)', 45 | relevance: 10 46 | }, 47 | hljs.HASH_COMMENT_MODE, 48 | { 49 | className: 'comment', 50 | begin: '\\/\\/', end: '$', 51 | illegal: '.' 52 | }, 53 | hljs.C_NUMBER_MODE, 54 | STRING, 55 | VAR1, 56 | VAR2, 57 | hljs.inherit(TEST_CONDITION, {begin: '\\[ ', end: ' \\]', relevance: 0}), 58 | hljs.inherit(TEST_CONDITION, {begin: '\\[\\[ ', end: ' \\]\\]'}) 59 | ] 60 | } 61 | }; 62 | }(); 63 | }; -------------------------------------------------------------------------------- /server/models/keyid.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'); 2 | var Schema = mongoose.Schema; 3 | 4 | var keyIdSchema = new Schema({ 5 | type: { type: String }, 6 | room: { type: String }, 7 | id: { type: Number } 8 | }); 9 | 10 | keyIdSchema.statics.getMasterKeyId = function getMasterKeyId(room, callback) { 11 | var self = this; 12 | var keyId = null; 13 | self.findOne({ type: 'master', room: room }, function(err, keyId, count) { 14 | if (err) { 15 | return callback(err, null); 16 | } else if (typeof keyId == 'undefined' || keyId == null) { 17 | self.create(room, function(err, keyId) { keyId = self.id; 18 | }); 19 | } else { 20 | console.log("keyId is: "+keyId); 21 | return callback(null, keyId.id); 22 | }; 23 | }); 24 | }; 25 | 26 | keyIdSchema.statics.create = function createMasterKeyId(room, callback) { 27 | new this({ 28 | type: 'master', 29 | room: room, 30 | id: 0 31 | }).save(function(err, keyId) { 32 | if (err) { 33 | return callback(err, null); 34 | } else { 35 | console.log("Added master key id '"+keyId.id+"' as it did not exist yet"); 36 | return callback(null, keyId); 37 | }; 38 | }); 39 | }; 40 | 41 | keyIdSchema.statics.increment = function incrementMasterKeyId(room, callback) { 42 | var self = this; 43 | this.findOne({ type: 'master', room: room }, function(err, keyId, count) { 44 | if (typeof keyId == 'undefined') { 45 | return callback("Cannot find master key ID while trying to increment", null); 46 | } else { 47 | var id = keyId.id + 1; 48 | keyId.id = id; 49 | keyId.save(function(err, keyId, count) { 50 | if (err) { 51 | return callback("Error saving key id"); 52 | } else { 53 | return callback(null, keyId.id); 54 | } 55 | }); 56 | }; 57 | }); 58 | }; 59 | 60 | module.exports = mongoose.model('KeyId', keyIdSchema); 61 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/java.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Java 3 | Author: Vsevolod Solovyov 4 | Category: common 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.java = { 8 | defaultMode: { 9 | keywords: {'false': 1, 'synchronized': 1, 'int': 1, 'abstract': 1, 'float': 1, 'private': 1, 'char': 1, 'interface': 1, 'boolean': 1, 'static': 1, 'null': 1, 'if': 1, 'const': 1, 'for': 1, 'true': 1, 'while': 1, 'long': 1, 'throw': 1, 'strictfp': 1, 'finally': 1, 'protected': 1, 'extends': 1, 'import': 1, 'native': 1, 'final': 1, 'implements': 1, 'return': 1, 'void': 1, 'enum': 1, 'else': 1, 'break': 1, 'transient': 1, 'new': 1, 'catch': 1, 'instanceof': 1, 'byte': 1, 'super': 1, 'class': 1, 'volatile': 1, 'case': 1, 'assert': 1, 'short': 1, 'package': 1, 'default': 1, 'double': 1, 'public': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'throws': 1}, 10 | contains: [ 11 | { 12 | className: 'javadoc', 13 | begin: '/\\*\\*', end: '\\*/', 14 | contains: [{ 15 | className: 'javadoctag', begin: '@[A-Za-z]+' 16 | }], 17 | relevance: 10 18 | }, 19 | hljs.C_LINE_COMMENT_MODE, 20 | hljs.C_BLOCK_COMMENT_MODE, 21 | hljs.APOS_STRING_MODE, 22 | hljs.QUOTE_STRING_MODE, 23 | { 24 | className: 'class', 25 | begin: '(class |interface )', end: '{', 26 | keywords: {'class': 1, 'interface': 1}, 27 | illegal: ':', 28 | contains: [ 29 | { 30 | begin: '(implements|extends)', 31 | keywords: {'extends': 1, 'implements': 1}, 32 | relevance: 10 33 | }, 34 | { 35 | className: 'title', 36 | begin: hljs.UNDERSCORE_IDENT_RE 37 | } 38 | ] 39 | }, 40 | hljs.C_NUMBER_MODE, 41 | { 42 | className: 'annotation', begin: '@[A-Za-z]+' 43 | } 44 | ] 45 | } 46 | }; 47 | }; -------------------------------------------------------------------------------- /client/css/highlight.js/languages/axapta.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Axapta 3 | Author: Dmitri Roudakov 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.axapta = { 7 | defaultMode: { 8 | keywords: {'false': 1, 'int': 1, 'abstract': 1, 'private': 1, 'char': 1, 'interface': 1, 'boolean': 1, 'static': 1, 'null': 1, 'if': 1, 'for': 1, 'true': 1, 'while': 1, 'long': 1, 'throw': 1, 'finally': 1, 'protected': 1, 'extends': 1, 'final': 1, 'implements': 1, 'return': 1, 'void': 1, 'enum': 1, 'else': 1, 'break': 1, 'new': 1, 'catch': 1, 'byte': 1, 'super': 1, 'class': 1, 'case': 1, 'short': 1, 'default': 1, 'double': 1, 'public': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 9 | 'reverse':1, 'firstfast':1,'firstonly':1,'forupdate':1,'nofetch':1, 'sum':1, 'avg':1, 'minof':1, 'maxof':1, 'count':1, 'order':1, 'group':1, 'by':1, 'asc':1, 'desc':1, 'index':1, 'hint':1, 'like':1, 10 | 'dispaly':1, 'edit':1, 'client':1, 'server':1, 'ttsbegin':1, 'ttscommit':1, 11 | 'str':1, 'real':1, 'date':1, 'container':1, 'anytype':1, 'common':1, 'div':1,'mod':1 12 | }, 13 | contains: [ 14 | hljs.C_LINE_COMMENT_MODE, 15 | hljs.C_BLOCK_COMMENT_MODE, 16 | hljs.APOS_STRING_MODE, 17 | hljs.QUOTE_STRING_MODE, 18 | hljs.C_NUMBER_MODE, 19 | { 20 | className: 'preprocessor', 21 | begin: '#', end: '$' 22 | }, 23 | { 24 | className: 'class', 25 | begin: '(class |interface )', end: '{', 26 | illegal: ':', 27 | keywords: {'class': 1, 'interface': 1}, 28 | contains: [ 29 | { 30 | className: 'inheritance', 31 | begin: '(implements|extends)', 32 | keywords: {'extends': 1, 'implements': 1}, 33 | relevance: 10 34 | }, 35 | { 36 | className: 'title', 37 | begin: hljs.UNDERSCORE_IDENT_RE 38 | } 39 | ] 40 | } 41 | ] 42 | } 43 | }; 44 | }; -------------------------------------------------------------------------------- /client/css/highlight.js/styles/ir_black.css: -------------------------------------------------------------------------------- 1 | /* 2 | IR_Black style (c) Vasily Mikhailitchenko 3 | */ 4 | 5 | pre code { 6 | display: block; padding: 0.5em; 7 | background: #000; color: #f8f8f8; 8 | } 9 | 10 | pre .shebang, 11 | pre .comment, 12 | pre .template_comment, 13 | pre .javadoc { 14 | color: #7c7c7c; 15 | } 16 | 17 | pre .keyword, 18 | pre .tag, 19 | pre .ruby .function .keyword, 20 | pre .tex .command { 21 | color: #96CBFE; 22 | } 23 | 24 | pre .function .keyword, 25 | pre .sub .keyword, 26 | pre .method, 27 | pre .list .title { 28 | color: #FFFFB6; 29 | } 30 | 31 | pre .string, 32 | pre .tag .value, 33 | pre .cdata, 34 | pre .filter .argument, 35 | pre .attr_selector, 36 | pre .apache .cbracket, 37 | pre .date { 38 | color: #A8FF60; 39 | } 40 | 41 | pre .subst { 42 | color: #DAEFA3; 43 | } 44 | 45 | pre .regexp { 46 | color: #E9C062; 47 | } 48 | 49 | pre .function .title, 50 | pre .sub .identifier, 51 | pre .pi, 52 | pre .decorator, 53 | pre .ini .title, 54 | pre .tex .special { 55 | color: #FFFFB6; 56 | } 57 | 58 | pre .class .title, 59 | pre .haskell .label, 60 | pre .constant, 61 | pre .smalltalk .class, 62 | pre .javadoctag, 63 | pre .yardoctag, 64 | pre .phpdoc, 65 | pre .nginx .built_in { 66 | color: #FFFFB6; 67 | } 68 | 69 | pre .symbol, 70 | pre .ruby .symbol .string, 71 | pre .ruby .symbol .keyword, 72 | pre .ruby .symbol .keymethods, 73 | pre .number, 74 | pre .variable, 75 | pre .vbscript, 76 | pre .literal { 77 | color: #C6C5FE; 78 | } 79 | 80 | pre .css .tag { 81 | color: #96CBFE; 82 | } 83 | 84 | pre .css .rules .property, 85 | pre .css .id { 86 | color: #FFFFB6; 87 | } 88 | 89 | pre .css .class { 90 | color: #FFF; 91 | } 92 | 93 | pre .hexcolor { 94 | color: #C6C5FE; 95 | } 96 | 97 | pre .number { 98 | color:#FF73FD; 99 | } 100 | 101 | pre .tex .formula { 102 | opacity: 0.7; 103 | } 104 | -------------------------------------------------------------------------------- /client/js/components/binaryjs/lib/util.js: -------------------------------------------------------------------------------- 1 | // if node 2 | var BinaryPack = require('binarypack'); 3 | // end node 4 | 5 | var util = { 6 | inherits: function(ctor, superCtor) { 7 | ctor.super_ = superCtor; 8 | ctor.prototype = Object.create(superCtor.prototype, { 9 | constructor: { 10 | value: ctor, 11 | enumerable: false, 12 | writable: true, 13 | configurable: true 14 | } 15 | }); 16 | }, 17 | extend: function(dest, source) { 18 | for(var key in source) { 19 | if(source.hasOwnProperty(key)) { 20 | dest[key] = source[key]; 21 | } 22 | } 23 | return dest; 24 | }, 25 | pack: BinaryPack.pack, 26 | unpack: BinaryPack.unpack, 27 | // if node 28 | isNode: true, 29 | // end node 30 | setZeroTimeout: (function(global) { 31 | // if node 32 | 33 | return process.nextTick; 34 | 35 | // end node 36 | var timeouts = []; 37 | var messageName = 'zero-timeout-message'; 38 | 39 | // Like setTimeout, but only takes a function argument. There's 40 | // no time argument (always zero) and no arguments (you have to 41 | // use a closure). 42 | function setZeroTimeoutPostMessage(fn) { 43 | timeouts.push(fn); 44 | global.postMessage(messageName, '*'); 45 | } 46 | 47 | function handleMessage(event) { 48 | if (event.source == global && event.data == messageName) { 49 | if (event.stopPropagation) { 50 | event.stopPropagation(); 51 | } 52 | if (timeouts.length) { 53 | timeouts.shift()(); 54 | } 55 | } 56 | } 57 | if (global.addEventListener) { 58 | global.addEventListener('message', handleMessage, true); 59 | } else if (global.attachEvent) { 60 | global.attachEvent('onmessage', handleMessage); 61 | } 62 | return setZeroTimeoutPostMessage; 63 | }(this)) 64 | }; 65 | 66 | exports.util = util; 67 | // if node 68 | module.exports = util; 69 | // end node 70 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/erlang-repl.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Erlang 3 | Author: Sergey Ignatov 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.erlang_repl = { 7 | defaultMode: { 8 | keywords: { 9 | 'special_functions':{ 10 | 'spawn':10, 11 | 'spawn_link':10, 12 | 'self':2 13 | }, 14 | 'reserved':{ 15 | 'after':1, 16 | 'and':1, 17 | 'andalso':5, 18 | 'band':1, 19 | 'begin':1, 20 | 'bnot':1, 21 | 'bor':1, 22 | 'bsl':1, 23 | 'bsr':1, 24 | 'bxor':1, 25 | 'case':1, 26 | 'catch':0, 27 | 'cond':1, 28 | 'div':1, 29 | 'end':1, 30 | 'fun':0, 31 | 'if':0, 32 | 'let':1, 33 | 'not':0, 34 | 'of':1, 35 | 'or':1, 36 | 'orelse':5, 37 | 'query':1, 38 | 'receive':0, 39 | 'rem':1, 40 | 'try':0, 41 | 'when':1, 42 | 'xor':1 43 | } 44 | }, 45 | contains: [ 46 | { 47 | className: 'input_number', begin: '^[0-9]+> ', 48 | relevance: 10 49 | }, 50 | { 51 | className: 'comment', 52 | begin: '%', end: '$' 53 | }, 54 | hljs.NUMBER_MODE, 55 | hljs.APOS_STRING_MODE, 56 | hljs.QUOTE_STRING_MODE, 57 | { 58 | className: 'constant', begin: '\\?(::)?([A-Z]\\w*(::)?)+' 59 | }, 60 | { 61 | className: 'arrow', begin: '->' 62 | }, 63 | { 64 | className: 'ok', begin: 'ok' 65 | }, 66 | { 67 | className: 'exclamation_mark', begin: '!' 68 | }, 69 | { 70 | className: 'function_or_atom', 71 | begin: '(\\b[a-z\'][a-zA-Z0-9_\']*:[a-z\'][a-zA-Z0-9_\']*)|(\\b[a-z\'][a-zA-Z0-9_\']*)', 72 | relevance: 0 73 | }, 74 | { 75 | className: 'variable', 76 | begin: '[A-Z][a-zA-Z0-9_\']*', 77 | relevance: 0 78 | } 79 | ] 80 | } 81 | }; 82 | }; -------------------------------------------------------------------------------- /client/css/highlight.js/languages/go.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Go 3 | Author: Stephan Kountso aka StepLg 4 | Description: Google go language (golang). For info about language see http://golang.org/ 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.go = function(){ 8 | var GO_KEYWORDS = { 9 | 'keyword': { 10 | 'break' : 1, 'default' : 1, 'func' : 1, 'interface' : 1, 'select' : 1, 11 | 'case' : 1, 'map' : 1, 'struct' : 1, 'chan' : 1, 12 | 'else' : 1, 'goto' : 1, 'package' : 1, 'switch' : 1, 'const' : 1, 13 | 'fallthrough' : 1, 'if' : 1, 'range' : 1, 'type' : 1, 'continue' : 1, 14 | 'for' : 1, 'import' : 1, 'return' : 1, 'var' : 1, 'go': 1, 'defer' : 1 15 | }, 16 | 'constant': { 17 | 'true': 1, 'false': 1, 'iota': 1, 'nil': 1 18 | }, 19 | 'typename': { 20 | 'bool': 1, 'byte': 1, 'complex64': 1, 'complex128': 1, 'float32': 1, 21 | 'float64': 1, 'int8': 1, 'int16': 1, 'int32': 1, 'int64': 1, 'string': 1, 22 | 'uint8': 1, 'uint16': 1, 'uint32': 1, 'uint64': 1, 'int': 1, 'uint': 1, 23 | 'uintptr': 1 24 | }, 25 | 'built_in': { 26 | 'append': 1, 'cap': 1, 'close': 1, 'complex': 1, 'copy': 1, 'imag': 1, 27 | 'len': 1, 'make': 1, 'new': 1, 'panic': 1, 'print': 1, 'println': 1, 28 | 'real': 1, 'recover': 1 29 | } 30 | }; 31 | return { 32 | defaultMode: { 33 | keywords: GO_KEYWORDS, 34 | illegal: ' 0 )) { 21 | return (userProfile.membership.favoriteRooms.indexOf(chatId) > -1); 22 | } else { 23 | return false; 24 | } 25 | }; 26 | 27 | chatHeader.update = function update(chatId) { 28 | var self = this; 29 | ChatManager = this; 30 | var chat = ChatManager.chats[chatId]; 31 | var headerAvatarHtml = ''; 32 | var chatTopic = ''; 33 | var chatHeaderTitle = ''; 34 | var activeChatId = ChatManager.activeChat; 35 | 36 | if (chat.type === 'chat') { 37 | headerAvatarHtml = ''; 38 | chatTopic = 'One to one encrypted chat with ' + chat.name; 39 | chatHeaderTitle = 'pm' + '/' + chat.name; 40 | } else if (chat.type === 'room') { 41 | headerAvatarHtml = ''; 42 | chatTopic = chat.topic; 43 | chatHeaderTitle = chat.group + '/' + chat.name; 44 | } else { 45 | return console.log('Error, unknown chat type'); 46 | } 47 | 48 | chatHeader.updateFavoriteButton.call(ChatManager, { favorite: chatHeader.isFavorite(chatId) }); 49 | 50 | /* 51 | * Catch clicks on favorite room button (star) 52 | */ 53 | $('.chat-header__favorite').unbind().click(function(e) { 54 | console.log("[chatManager.chat-header__favorite] (click) Got click on favorite button"); 55 | 56 | socketClient.toggleFavorite({ chatId: activeChatId }); 57 | }); 58 | 59 | $('.chat-topic').text(chatTopic); 60 | $('.chat-header__title').text(chatHeaderTitle); 61 | $('.chat-header__avatar').html(headerAvatarHtml); 62 | }; 63 | 64 | module.exports = chatHeader; 65 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/cs.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: C# 3 | Author: Jason Diamond 4 | Category: common 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.cs = { 8 | defaultMode: { 9 | keywords: { 10 | // Normal keywords. 11 | 'abstract': 1, 'as': 1, 'base': 1, 'bool': 1, 'break': 1, 'byte': 1, 'case': 1, 'catch': 1, 'char': 1, 'checked': 1, 'class': 1, 'const': 1, 'continue': 1, 'decimal': 1, 'default': 1, 'delegate': 1, 'do': 1, 'do': 1, 'double': 1, 'else': 1, 'enum': 1, 'event': 1, 'explicit': 1, 'extern': 1, 'false': 1, 'finally': 1, 'fixed': 1, 'float': 1, 'for': 1, 'foreach': 1, 'goto': 1, 'if': 1, 'implicit': 1, 'in': 1, 'int': 1, 'interface': 1, 'internal': 1, 'is': 1, 'lock': 1, 'long': 1, 'namespace': 1, 'new': 1, 'null': 1, 'object': 1, 'operator': 1, 'out': 1, 'override': 1, 'params': 1, 'private': 1, 'protected': 1, 'public': 1, 'readonly': 1, 'ref': 1, 'return': 1, 'sbyte': 1, 'sealed': 1, 'short': 1, 'sizeof': 1, 'stackalloc': 1, 'static': 1, 'string': 1, 'struct': 1, 'switch': 1, 'this': 1, 'throw': 1, 'true': 1, 'try': 1, 'typeof': 1, 'uint': 1, 'ulong': 1, 'unchecked': 1, 'unsafe': 1, 'ushort': 1, 'using': 1, 'virtual': 1, 'volatile': 1, 'void': 1, 'while': 1, 12 | // Contextual keywords. 13 | 'ascending': 1, 'descending': 1, 'from': 1, 'get': 1, 'group': 1, 'into': 1, 'join': 1, 'let': 1, 'orderby': 1, 'partial': 1, 'select': 1, 'set': 1, 'value': 1, 'var': 1, 'where': 1, 'yield': 1 14 | }, 15 | contains: [ 16 | { 17 | className: 'comment', 18 | begin: '///', end: '$', returnBegin: true, 19 | contains: [ 20 | { 21 | className: 'xmlDocTag', 22 | begin: '///|' 23 | }, 24 | { 25 | className: 'xmlDocTag', 26 | begin: '' 27 | } 28 | ] 29 | }, 30 | hljs.C_LINE_COMMENT_MODE, 31 | hljs.C_BLOCK_COMMENT_MODE, 32 | { 33 | className: 'string', 34 | begin: '@"', end: '"', 35 | contains: [{begin: '""'}] 36 | }, 37 | hljs.APOS_STRING_MODE, 38 | hljs.QUOTE_STRING_MODE, 39 | hljs.C_NUMBER_MODE 40 | ] 41 | } 42 | }; 43 | }; -------------------------------------------------------------------------------- /client/css/highlight.js/languages/php.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: PHP 3 | Author: Victor Karamzin 4 | Category: common 5 | */ 6 | module.exports = function(hljs){ 7 | hljs.LANGUAGES.php = { 8 | case_insensitive: true, 9 | defaultMode: { 10 | keywords: { 11 | 'and': 1, 'include_once': 1, 'list': 1, 'abstract': 1, 'global': 1, 12 | 'private': 1, 'echo': 1, 'interface': 1, 'as': 1, 'static': 1, 13 | 'endswitch': 1, 'array': 1, 'null': 1, 'if': 1, 'endwhile': 1, 'or': 1, 14 | 'const': 1, 'for': 1, 'endforeach': 1, 'self': 1, 'var': 1, 'while': 1, 15 | 'isset': 1, 'public': 1, 'protected': 1, 'exit': 1, 'foreach': 1, 16 | 'throw': 1, 'elseif': 1, 'extends': 1, 'include': 1, '__FILE__': 1, 17 | 'empty': 1, 'require_once': 1, 'function': 1, 'do': 1, 'xor': 1, 18 | 'return': 1, 'implements': 1, 'parent': 1, 'clone': 1, 'use': 1, 19 | '__CLASS__': 1, '__LINE__': 1, 'else': 1, 'break': 1, 'print': 1, 20 | 'eval': 1, 'new': 1, 'catch': 1, '__METHOD__': 1, 'class': 1, 'case': 1, 21 | 'exception': 1, 'php_user_filter': 1, 'default': 1, 'die': 1, 22 | 'require': 1, '__FUNCTION__': 1, 'enddeclare': 1, 'final': 1, 'try': 1, 23 | 'this': 1, 'switch': 1, 'continue': 1, 'endfor': 1, 'endif': 1, 24 | 'declare': 1, 'unset': 1, 'true': 1, 'false': 1, 'namespace': 1 25 | }, 26 | contains: [ 27 | hljs.C_LINE_COMMENT_MODE, 28 | hljs.HASH_COMMENT_MODE, 29 | { 30 | className: 'comment', 31 | begin: '/\\*', end: '\\*/', 32 | contains: [{ 33 | className: 'phpdoc', 34 | begin: '\\s@[A-Za-z]+', 35 | relevance: 10 36 | }] 37 | }, 38 | hljs.C_NUMBER_MODE, 39 | hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}), 40 | hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}), 41 | { 42 | className: 'variable', 43 | begin: '\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' 44 | }, 45 | { 46 | className: 'preprocessor', 47 | begin: '<\\?php', 48 | relevance: 10 49 | }, 50 | { 51 | className: 'preprocessor', 52 | begin: '\\?>' 53 | } 54 | ] 55 | } 56 | }; 57 | }; -------------------------------------------------------------------------------- /client/js/components/binaryjs/test/stream.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var binaryjs = require('../'); 3 | var BinaryServer = binaryjs.BinaryServer; 4 | var BinaryClient = binaryjs.BinaryClient; 5 | var http = require('http'); 6 | 7 | var server, client, serverUrl = 'ws://localhost:9101'; 8 | 9 | describe('BinaryStream', function(){ 10 | beforeEach(function(){ 11 | server = new BinaryServer({port: 9101}); 12 | }); 13 | afterEach(function(){ 14 | server.close(); 15 | }); 16 | describe('Messaging', function(){ 17 | it('should send and receive messages', function(done){ 18 | server.on('connection', function(client){ 19 | client.on('stream', function(stream){ 20 | stream.on('data', function(){ 21 | done(); 22 | }); 23 | stream.write('hi'); 24 | }); 25 | }); 26 | var client = new BinaryClient(serverUrl); 27 | client.on('open', function(){ 28 | var stream = client.createStream(); 29 | stream.on('data', function(){ 30 | stream.write('bye'); 31 | }); 32 | }); 33 | }); 34 | it('should send and receive pause, resume, and end', function(done){ 35 | server.on('connection', function(client){ 36 | client.on('stream', function(stream){ 37 | stream.on('pause', function(){ 38 | assert(stream.paused); 39 | }); 40 | stream.resume(); 41 | stream.on('resume', function(){ 42 | assert(!stream.paused); 43 | }); 44 | stream.on('end', function(){ 45 | assert(!stream.readable); 46 | done(); 47 | }); 48 | }); 49 | }); 50 | var client = new BinaryClient(serverUrl); 51 | client.on('open', function(){ 52 | var stream = client.createStream(); 53 | stream.pause(); 54 | stream.on('pause', function(){ 55 | assert(stream.paused); 56 | }); 57 | stream.on('resume', function(){ 58 | assert(!stream.paused); 59 | stream.end(); 60 | }); 61 | stream.on('end', function(){ 62 | assert(!stream.readable); 63 | }); 64 | }); 65 | }); 66 | }); 67 | }); 68 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Dark style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background: #444; 10 | } 11 | 12 | pre .keyword, 13 | pre .literal, 14 | pre .change, 15 | pre .winutils, 16 | pre .flow, 17 | pre .lisp .title, 18 | pre .tex .special { 19 | color: white; 20 | } 21 | 22 | pre code, 23 | pre .ruby .subst { 24 | color: #DDD; 25 | } 26 | 27 | pre .string, 28 | pre .function .title, 29 | pre .class .title, 30 | pre .haskell .label, 31 | pre .ini .title, 32 | pre .tag .value, 33 | pre .css .rules .value, 34 | pre .preprocessor, 35 | pre .ruby .symbol, 36 | pre .ruby .symbol .string, 37 | pre .ruby .symbol .keyword, 38 | pre .ruby .symbol .keymethods, 39 | pre .ruby .instancevar, 40 | pre .ruby .class .parent, 41 | pre .built_in, 42 | pre .sql .aggregate, 43 | pre .django .template_tag, 44 | pre .django .variable, 45 | pre .smalltalk .class, 46 | pre .javadoc, 47 | pre .ruby .string, 48 | pre .django .filter .argument, 49 | pre .smalltalk .localvars, 50 | pre .smalltalk .array, 51 | pre .attr_selector, 52 | pre .pseudo, 53 | pre .addition, 54 | pre .stream, 55 | pre .envvar, 56 | pre .apache .tag, 57 | pre .apache .cbracket, 58 | pre .tex .command, 59 | pre .input_number { 60 | color: #D88; 61 | } 62 | 63 | pre .comment, 64 | pre .java .annotation, 65 | pre .python .decorator, 66 | pre .template_comment, 67 | pre .pi, 68 | pre .doctype, 69 | pre .deletion, 70 | pre .shebang, 71 | pre .apache .sqbracket, 72 | pre .tex .formula { 73 | color: #777; 74 | } 75 | 76 | pre .keyword, 77 | pre .literal, 78 | pre .css .id, 79 | pre .phpdoc, 80 | pre .function .title, 81 | pre .class .title, 82 | pre .haskell .label, 83 | pre .vbscript .built_in, 84 | pre .sql .aggregate, 85 | pre .rsl .built_in, 86 | pre .smalltalk .class, 87 | pre .xml .tag .title, 88 | pre .diff .header, 89 | pre .chunk, 90 | pre .winutils, 91 | pre .bash .variable, 92 | pre .lisp .title, 93 | pre .apache .tag, 94 | pre .tex .special { 95 | font-weight: bold; 96 | } 97 | 98 | pre .xml .css, 99 | pre .xml .javascript, 100 | pre .xml .vbscript, 101 | pre .tex .formula { 102 | opacity: 0.5; 103 | } 104 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/idea.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Intellij Idea-like styling (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | color: #000; 10 | background: #fff; 11 | } 12 | 13 | pre .subst, 14 | pre .title { 15 | font-weight: normal; 16 | color: #000; 17 | } 18 | 19 | pre .comment, 20 | pre .template_comment, 21 | pre .javadoc, 22 | pre .diff .header { 23 | color: #808080; 24 | font-style: italic; 25 | } 26 | 27 | pre .annotation, 28 | pre .decorator, 29 | pre .preprocessor, 30 | pre .doctype, 31 | pre .pi, 32 | pre .chunk, 33 | pre .shebang, 34 | pre .apache .cbracket, 35 | pre .input_number { 36 | color: #808000; 37 | } 38 | 39 | pre .tag, 40 | pre .pi { 41 | background: #efefef; 42 | } 43 | 44 | pre .tag .title, 45 | pre .id, 46 | pre .attr_selector, 47 | pre .pseudo, 48 | pre .literal, 49 | pre .keyword, 50 | pre .hexcolor, 51 | pre .css .function, 52 | pre .ini .title, 53 | pre .css .class, 54 | pre .list .title, 55 | pre .tex .command { 56 | font-weight: bold; 57 | color: #000080; 58 | } 59 | 60 | pre .attribute, 61 | pre .rules .keyword, 62 | pre .number, 63 | pre .date, 64 | pre .regexp, 65 | pre .tex .special { 66 | font-weight: bold; 67 | color: #0000ff; 68 | } 69 | 70 | pre .number, 71 | pre .regexp { 72 | font-weight: normal; 73 | } 74 | 75 | pre .string, 76 | pre .value, 77 | pre .filter .argument, 78 | pre .css .function .params, 79 | pre .apache .tag { 80 | color: #008000; 81 | font-weight: bold; 82 | } 83 | 84 | pre .symbol, 85 | pre .ruby .symbol .string, 86 | pre .ruby .symbol .keyword, 87 | pre .ruby .symbol .keymethods, 88 | pre .char, 89 | pre .tex .formula { 90 | color: #000; 91 | background: #d0eded; 92 | font-style: italic; 93 | } 94 | 95 | pre .phpdoc, 96 | pre .yardoctag, 97 | pre .javadoctag { 98 | text-decoration: underline; 99 | } 100 | 101 | pre .variable, 102 | pre .envvar, 103 | pre .apache .sqbracket, 104 | pre .nginx .built_in { 105 | color: #660e7a; 106 | } 107 | 108 | pre .addition { 109 | background: #baeeba; 110 | } 111 | 112 | pre .deletion { 113 | background: #ffc8bd; 114 | } 115 | 116 | pre .diff .change { 117 | background: #bccff9; 118 | } 119 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/scala.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Scala 3 | Author: Jan Berkel 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.scala = function() { 7 | var ANNOTATION = { 8 | className: 'annotation', begin: '@[A-Za-z]+' 9 | }; 10 | var STRING = { 11 | className: 'string', 12 | begin: 'u?r?"""', end: '"""', 13 | relevance: 10 14 | }; 15 | return { 16 | defaultMode: { 17 | keywords: { 'type': 1, 'yield': 1, 'lazy': 1, 'override': 1, 'def': 1, 'with': 1, 'val':1, 'var': 1, 'false': 1, 'true': 1, 'sealed': 1, 'abstract': 1, 'private': 1, 'trait': 1, 'object': 1, 'null': 1, 'if': 1, 'for': 1, 'while': 1, 'throw': 1, 'finally': 1, 'protected': 1, 'extends': 1, 'import': 1, 'final': 1, 'return': 1, 'else': 1, 'break': 1, 'new': 1, 'catch': 1, 'super': 1, 'class': 1, 'case': 1,'package': 1, 'default': 1, 'try': 1, 'this': 1, 'match': 1, 'continue': 1, 'throws': 1}, 18 | contains: [ 19 | { 20 | className: 'javadoc', 21 | begin: '/\\*\\*', end: '\\*/', 22 | contains: [{ 23 | className: 'javadoctag', 24 | begin: '@[A-Za-z]+' 25 | }], 26 | relevance: 10 27 | }, 28 | hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, 29 | hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, STRING, 30 | { 31 | className: 'class', 32 | begin: '((case )?class |object |trait )', end: '({|$)', 33 | illegal: ':', 34 | keywords: {'case' : 1, 'class': 1, 'trait': 1, 'object': 1}, 35 | contains: [ 36 | { 37 | begin: '(extends|with)', 38 | keywords: {'extends': 1, 'with': 1}, 39 | relevance: 10 40 | }, 41 | { 42 | className: 'title', 43 | begin: hljs.UNDERSCORE_IDENT_RE 44 | }, 45 | { 46 | className: 'params', 47 | begin: '\\(', end: '\\)', 48 | contains: [ 49 | hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, STRING, 50 | ANNOTATION 51 | ] 52 | } 53 | ] 54 | }, 55 | hljs.C_NUMBER_MODE, 56 | ANNOTATION 57 | ] 58 | } 59 | }; 60 | }(); 61 | }; -------------------------------------------------------------------------------- /client/js/lib/jquery.pulse.js: -------------------------------------------------------------------------------- 1 | /*global jQuery*/ 2 | /*jshint curly:false*/ 3 | 4 | ;(function ( $, window) { 5 | "use strict"; 6 | 7 | var defaults = { 8 | pulses : 1, 9 | interval : 0, 10 | returnDelay : 0, 11 | duration : 500 12 | }; 13 | 14 | $.fn.pulse = function(properties, options, callback) { 15 | // $(...).pulse('destroy'); 16 | var stop = properties === 'destroy'; 17 | 18 | if (typeof options === 'function') { 19 | callback = options; 20 | options = {}; 21 | } 22 | 23 | options = $.extend({}, defaults, options); 24 | 25 | if (!(options.interval >= 0)) options.interval = 0; 26 | if (!(options.returnDelay >= 0)) options.returnDelay = 0; 27 | if (!(options.duration >= 0)) options.duration = 500; 28 | if (!(options.pulses >= -1)) options.pulses = 1; 29 | if (typeof callback !== 'function') callback = function(){}; 30 | 31 | return this.each(function () { 32 | var el = $(this), 33 | property, 34 | original = {}; 35 | 36 | var data = el.data('pulse') || {}; 37 | data.stop = stop; 38 | el.data('pulse', data); 39 | 40 | for (property in properties) { 41 | if (properties.hasOwnProperty(property)) original[property] = el.css(property); 42 | } 43 | 44 | var timesPulsed = 0; 45 | 46 | var fromOptions = $.extend({}, options); 47 | fromOptions.duration = options.duration / 2; 48 | fromOptions.complete = function() { 49 | window.setTimeout(animate, options.interval); 50 | }; 51 | 52 | var toOptions = $.extend({}, options); 53 | toOptions.duration = options.duration / 2; 54 | toOptions.complete = function(){ 55 | window.setTimeout(function(){ 56 | el.animate(original, fromOptions); 57 | },options.returnDelay); 58 | }; 59 | 60 | function animate() { 61 | if (typeof el.data('pulse') === 'undefined') return; 62 | if (el.data('pulse').stop) return; 63 | if (options.pulses > -1 && ++timesPulsed > options.pulses) return callback.apply(el); 64 | el.animate( 65 | properties, 66 | toOptions 67 | ); 68 | } 69 | 70 | animate(); 71 | }); 72 | }; 73 | 74 | })( jQuery, window, document ); 75 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/vhdl.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: VHDL 3 | Description: VHDL is a hardware description language used in electronic design automation to describe digital and mixed-signal systems. 4 | Author: Igor Kalnitsky 5 | Website: http://kalnitsky.org.ua/ 6 | */ 7 | module.exports = function(hljs){ 8 | hljs.LANGUAGES.vhdl = { 9 | case_insensitive: true, 10 | defaultMode: { 11 | keywords: { 12 | 'keyword': { 'abs': 1, 'access': 1, 'after': 1, 'alias': 1, 'all': 1, 'and': 1, 'architecture': 2, 'array': 1, 'assert': 1, 'attribute': 1, 'begin': 1, 'block': 1, 'body': 1, 'buffer': 1, 'bus': 1, 'case': 1, 'component': 2, 'configuration': 1, 'constant': 1, 'disconnect': 2, 'downto': 2, 'else': 1, 'elsif': 1, 'end': 1, 'entity': 2, 'exit': 1, 'file': 1, 'for': 1, 'function': 1, 'generate': 2, 'generic': 2, 'group': 1, 'guarded': 2, 'if': 0, 'impure': 2, 'in': 1, 'inertial': 1, 'inout': 1, 'is': 1, 'label': 1, 'library': 1, 'linkage': 1, 'literal': 1, 'loop': 1, 'map': 1, 'mod': 1, 'nand': 1, 'new': 1, 'next': 1, 'nor': 1, 'not': 1, 'null': 1, 'of': 1, 'on': 1, 'open': 1, 'or': 1, 'others': 1, 'out': 1, 'package': 1, 'port': 2, 'postponed': 1, 'procedure': 1, 'process': 1, 'pure': 2, 'range': 1, 'record': 1, 'register': 1, 'reject': 1, 'return': 1, 'rol': 1, 'ror': 1, 'select': 1, 'severity': 1, 'signal': 1, 'shared': 1, 'sla': 1, 'sli': 1, 'sra': 1, 'srl': 1, 'subtype': 2, 'then': 1, 'to': 1, 'transport': 1, 'type': 1, 'units': 1, 'until': 1, 'use': 1, 'variable': 1, 'wait': 1, 'when': 1, 'while': 1, 'with': 1, 'xnor': 1, 'xor': 1}, 13 | 'type': { 'boolean': 1, 'bit': 1, 'character': 1, 'severity_level': 2, 'integer': 1, 'time': 1, 'delay_length': 2, 'natural': 1, 'positive': 1, 'string': 1, 'bit_vector': 2, 'file_open_kind': 2, 'file_open_status': 2, 'std_ulogic': 2, 'std_ulogic_vector': 2, 'std_logic': 2, 'std_logic_vector': 2 } 14 | }, 15 | contains: [ 16 | { 17 | className: 'comment', 18 | begin: '--', end: '$' 19 | }, 20 | hljs.QUOTE_STRING_MODE, 21 | hljs.C_NUMBER_MODE, 22 | { 23 | className: 'literal', 24 | begin: '\'(U|X|0|1|Z|W|L|H|-)', end: '\'', 25 | contains: [hljs.BACKSLASH_ESCAPE], 26 | relevance: 5 27 | } 28 | ] 29 | } 30 | }; 31 | }; -------------------------------------------------------------------------------- /client/css/highlight.js/languages/haskell.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Haskell 3 | Author: Jeremy Hull 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.haskell = function(){ 7 | var LABEL = { 8 | className: 'label', 9 | begin: '\\b[A-Z][\\w\\\']*', 10 | relevance: 0 11 | }; 12 | var CONTAINER = { 13 | className: 'container', 14 | begin: '\\(', end: '\\)', 15 | contains: [ 16 | {className: 'label', begin: '\\b[A-Z][\\w\\(\\)\\.\\\']*'}, 17 | {className: 'title', begin: '[_a-z][\\w\\\']*'} 18 | ] 19 | }; 20 | 21 | return { 22 | defaultMode: { 23 | keywords: { 24 | 'keyword': {'let': 1,'in': 1,'if': 1,'then': 1,'else': 1,'case': 1,'of': 1,'where': 1,'do': 1,'module': 1,'import': 1, 'hiding': 1,'qualified': 1,'type': 1,'data': 1,'newtype': 1,'deriving': 1,'class': 1,'instance': 1,'null': 1,'not': 1,'as': 1}, 25 | 'built_in': {'Bool': 1,'True': 1,'False': 1,'Int': 1,'Char': 1,'Maybe': 1,'Nothing': 1,'String': 1} 26 | }, 27 | contains: [ 28 | { 29 | className: 'comment', 30 | begin: '--', end: '$' 31 | }, 32 | { 33 | className: 'comment', 34 | begin: '{-', end: '-}' 35 | }, 36 | hljs.APOS_STRING_MODE, 37 | hljs.QUOTE_STRING_MODE, 38 | { 39 | className: 'import', 40 | begin: '\\bimport', end: '$', 41 | keywords: {'import': 1, 'qualified': 1, 'as': 1, 'hiding': 1}, 42 | contains: [CONTAINER] 43 | }, 44 | { 45 | className: 'module', 46 | begin: '\\bmodule', end: 'where', 47 | keywords: {'module': 1, 'where': 1}, 48 | contains: [CONTAINER] 49 | }, 50 | { 51 | className: 'class', 52 | begin: '\\b(class|instance|data|(new)?type)', end: '(where|$)', 53 | keywords: {'class': 1, 'where': 1, 'instance': 1,'data': 1,'type': 1,'newtype': 1, 'deriving': 1}, 54 | contains: [LABEL] 55 | }, 56 | hljs.C_NUMBER_MODE, 57 | { 58 | className: 'shebang', 59 | begin: '#!\\/usr\\/bin\\/env\ runhaskell', end: '$' 60 | }, 61 | LABEL, 62 | { 63 | className: 'title', begin: '^[_a-z][\\w\\\']*' 64 | } 65 | ] 66 | } 67 | }; 68 | }(); 69 | }; -------------------------------------------------------------------------------- /client/css/highlight.js/styles/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | color: #000; 10 | background: #f8f8ff 11 | } 12 | 13 | pre .comment, 14 | pre .template_comment, 15 | pre .diff .header, 16 | pre .javadoc { 17 | color: #998; 18 | font-style: italic 19 | } 20 | 21 | pre .keyword, 22 | pre .css .rule .keyword, 23 | pre .winutils, 24 | pre .javascript .title, 25 | pre .lisp .title, 26 | pre .subst { 27 | color: #000; 28 | font-weight: bold 29 | } 30 | 31 | pre .number, 32 | pre .hexcolor { 33 | color: #40a070 34 | } 35 | 36 | pre .string, 37 | pre .tag .value, 38 | pre .phpdoc, 39 | pre .tex .formula { 40 | color: #d14 41 | } 42 | 43 | pre .title, 44 | pre .id { 45 | color: #900; 46 | font-weight: bold 47 | } 48 | 49 | pre .javascript .title, 50 | pre .lisp .title, 51 | pre .subst { 52 | font-weight: normal 53 | } 54 | 55 | pre .class .title, 56 | pre .haskell .label, 57 | pre .tex .command { 58 | color: #458; 59 | font-weight: bold 60 | } 61 | 62 | pre .tag, 63 | pre .tag .title, 64 | pre .rules .property, 65 | pre .django .tag .keyword { 66 | color: #000080; 67 | font-weight: normal 68 | } 69 | 70 | pre .attribute, 71 | pre .variable, 72 | pre .instancevar, 73 | pre .lisp .body { 74 | color: #008080 75 | } 76 | 77 | pre .regexp { 78 | color: #009926 79 | } 80 | 81 | pre .class { 82 | color: #458; 83 | font-weight: bold 84 | } 85 | 86 | pre .symbol, 87 | pre .ruby .symbol .string, 88 | pre .ruby .symbol .keyword, 89 | pre .ruby .symbol .keymethods, 90 | pre .lisp .keyword, 91 | pre .tex .special, 92 | pre .input_number { 93 | color: #990073 94 | } 95 | 96 | pre .builtin, 97 | pre .built_in, 98 | pre .lisp .title { 99 | color: #0086b3 100 | } 101 | 102 | pre .preprocessor, 103 | pre .pi, 104 | pre .doctype, 105 | pre .shebang, 106 | pre .cdata { 107 | color: #999; 108 | font-weight: bold 109 | } 110 | 111 | pre .deletion { 112 | background: #fdd 113 | } 114 | 115 | pre .addition { 116 | background: #dfd 117 | } 118 | 119 | pre .diff .change { 120 | background: #0086b3 121 | } 122 | 123 | pre .chunk { 124 | color: #aaa 125 | } 126 | 127 | pre .tex .formula { 128 | opacity: 0.5; 129 | } 130 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/brown_paper.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Brown Paper style from goldblog.com.ua (c) Zaripov Yura 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background:#b7a68e url(./brown_papersq.png); 10 | } 11 | 12 | pre .keyword, 13 | pre .literal, 14 | pre .change, 15 | pre .winutils, 16 | pre .flow, 17 | pre .lisp .title, 18 | pre .tex .special { 19 | color:#005599; 20 | font-weight:bold; 21 | } 22 | 23 | pre code, 24 | pre .ruby .subst, 25 | pre .tag .keyword { 26 | color: #363C69; 27 | } 28 | 29 | pre .string, 30 | pre .function .title, 31 | pre .class .title, 32 | pre .haskell .label, 33 | pre .ini .title, 34 | pre .tag .value, 35 | pre .css .rules .value, 36 | pre .preprocessor, 37 | pre .ruby .symbol, 38 | pre .ruby .symbol .string, 39 | pre .ruby .symbol .keyword, 40 | pre .ruby .symbol .keymethods, 41 | pre .ruby .instancevar, 42 | pre .ruby .class .parent, 43 | pre .built_in, 44 | pre .sql .aggregate, 45 | pre .django .template_tag, 46 | pre .django .variable, 47 | pre .smalltalk .class, 48 | pre .javadoc, 49 | pre .ruby .string, 50 | pre .django .filter .argument, 51 | pre .smalltalk .localvars, 52 | pre .smalltalk .array, 53 | pre .attr_selector, 54 | pre .pseudo, 55 | pre .addition, 56 | pre .stream, 57 | pre .envvar, 58 | pre .apache .tag, 59 | pre .apache .cbracket, 60 | pre .tex .number { 61 | color: #2C009F; 62 | } 63 | 64 | pre .comment, 65 | pre .java .annotation, 66 | pre .python .decorator, 67 | pre .template_comment, 68 | pre .pi, 69 | pre .doctype, 70 | pre .deletion, 71 | pre .shebang, 72 | pre .apache .sqbracket, 73 | pre .nginx .built_in, 74 | pre .tex .formula { 75 | color: #802022; 76 | } 77 | 78 | pre .keyword, 79 | pre .literal, 80 | pre .css .id, 81 | pre .phpdoc, 82 | pre .function .title, 83 | pre .class .title, 84 | pre .haskell .label, 85 | pre .vbscript .built_in, 86 | pre .sql .aggregate, 87 | pre .rsl .built_in, 88 | pre .smalltalk .class, 89 | pre .xml .tag .title, 90 | pre .diff .header, 91 | pre .chunk, 92 | pre .winutils, 93 | pre .bash .variable, 94 | pre .lisp .title, 95 | pre .apache .tag, 96 | pre .tex .command { 97 | font-weight: bold; 98 | } 99 | 100 | pre .xml .css, 101 | pre .xml .javascript, 102 | pre .xml .vbscript, 103 | pre .tex .formula { 104 | opacity: 0.8; 105 | } 106 | -------------------------------------------------------------------------------- /server/js/managers/authentication.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var User = require('../../models/user'); 4 | var passport = require('passport'); 5 | var KeyVerifyStrategy = require('passport-keyverify').Strategy; 6 | var logger = require('../../../config/logger'); 7 | var EncryptionManager = require('./encryption'); 8 | 9 | function Authentication() { 10 | if (!(this instanceof Authentication)) { 11 | return new Authentication(); 12 | } 13 | } 14 | 15 | Authentication.prototype.init = function ( app ) { 16 | var self = this; 17 | 18 | app.use(passport.initialize()); 19 | app.use(passport.session()); 20 | 21 | passport.serializeUser(function(user, done) { 22 | done(null, user); 23 | }); 24 | 25 | passport.deserializeUser(function(user, done) { 26 | logger.debug('deserializing user from passport'); 27 | User.findById(user, function(err, user) { 28 | done(null, user); 29 | }); 30 | }); 31 | 32 | // 33 | // Authentication 34 | passport.use(new KeyVerifyStrategy( self.verify )); 35 | }; 36 | 37 | Authentication.prototype.verify = function(username, nonce, signature, callback) { 38 | var self = this; 39 | this.encryption = new EncryptionManager(); 40 | logger.debug('Verifying authentication of user %s', username); 41 | 42 | User.findByUsername(username, function (err, user) { 43 | if (err) { 44 | logger.debug('Error getting user by username'); 45 | return callback(err); 46 | } 47 | if (!user) { return callback(null, false); } 48 | 49 | var sigBuffer = new Buffer(signature, 'base64'); 50 | var sigString = sigBuffer.toString(); 51 | 52 | var publicKey = user.publicKey; 53 | self.encryption.verifyMessageSignature(sigString, publicKey, nonce, function(err, signatureFingerprint) { 54 | if (err) { return callback("[Authentication.verifySignature] ERROR: " + err, false); }; 55 | 56 | var sessionUser = user.id; 57 | 58 | if (signatureFingerprint) { 59 | logger.debug("[authentication.verify] User '" + user.username + "' verification SUCCESS with signature fingerprint '" + signatureFingerprint + "'"); 60 | return callback(null, true); 61 | logger.debug("[authentication.verify] User '" + user.username + "' verification FAILED!"); 62 | } else { 63 | return callback(null, false); 64 | } 65 | }); 66 | }); 67 | }; 68 | 69 | module.exports = Authentication; 70 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/python.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: Python 3 | Category: common 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.python = function() { 7 | var STR1 = { 8 | className: 'string', 9 | begin: 'u?r?\'\'\'', end: '\'\'\'', 10 | relevance: 10 11 | }; 12 | var STR2 = { 13 | className: 'string', 14 | begin: 'u?r?"""', end: '"""', 15 | relevance: 10 16 | }; 17 | var STR3 = { 18 | className: 'string', 19 | begin: '(u|r|ur)\'', end: '\'', 20 | contains: [hljs.BACKSLASH_ESCAPE], 21 | relevance: 10 22 | }; 23 | var STR4 = { 24 | className: 'string', 25 | begin: '(u|r|ur)"', end: '"', 26 | contains: [hljs.BACKSLASH_ESCAPE], 27 | relevance: 10 28 | }; 29 | var TITLE = { 30 | className: 'title', begin: hljs.UNDERSCORE_IDENT_RE 31 | }; 32 | var PARAMS = { 33 | className: 'params', 34 | begin: '\\(', end: '\\)', 35 | contains: [STR1, STR2, STR3, STR4, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE] 36 | }; 37 | 38 | return { 39 | defaultMode: { 40 | keywords: { 41 | 'keyword': {'and': 1, 'elif': 1, 'is': 1, 'global': 1, 'as': 1, 'in': 1, 'if': 1, 'from': 1, 'raise': 1, 'for': 1, 'except': 1, 'finally': 1, 'print': 1, 'import': 1, 'pass': 1, 'return': 1, 'exec': 1, 'else': 1, 'break': 1, 'not': 1, 'with': 1, 'class': 1, 'assert': 1, 'yield': 1, 'try': 1, 'while': 1, 'continue': 1, 'del': 1, 'or': 1, 'def': 1, 'lambda': 1, 'nonlocal': 10}, 42 | 'built_in': {'None': 1, 'True': 1, 'False': 1, 'Ellipsis': 1, 'NotImplemented': 1} 43 | }, 44 | illegal: '(|\\?)', 45 | contains: [ 46 | hljs.HASH_COMMENT_MODE, 47 | STR1, STR2, STR3, STR4, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, 48 | { 49 | className: 'function', 50 | begin: '\\bdef ', end: ':', 51 | illegal: '$', 52 | keywords: {'def': 1}, 53 | contains: [TITLE, PARAMS], 54 | relevance: 10 55 | }, 56 | { 57 | className: 'class', 58 | begin: '\\bclass ', end: ':', 59 | illegal: '[${]', 60 | keywords: {'class': 1}, 61 | contains: [TITLE, PARAMS], 62 | relevance: 10 63 | }, 64 | hljs.C_NUMBER_MODE, 65 | { 66 | className: 'decorator', 67 | begin: '@', end: '$' 68 | } 69 | ] 70 | } 71 | }; 72 | }(); 73 | }; -------------------------------------------------------------------------------- /client/js/components/querystring/querystring.min.js: -------------------------------------------------------------------------------- 1 | /** 'querystring' nodejs module minified for AMD, CommonJS & `window.querystring`. browserify v3.46.1 **/ 2 | !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.querystring=e()}}(function(){return function e(r,n,t){function o(i,f){if(!n[i]){if(!r[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);throw new Error("Cannot find module '"+i+"'")}var a=n[i]={exports:{}};r[i][0].call(a.exports,function(e){var n=r[i][1][e];return o(n?n:e)},a,a.exports,e,r,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i0&&a>c&&(a=c);for(var s=0;a>s;++s){var p,d,l,y,v=e[s].replace(f,"%20"),m=v.indexOf(o);m>=0?(p=v.substr(0,m),d=v.substr(m+1)):(p=v,d=""),l=decodeURIComponent(p),y=decodeURIComponent(d),n(i,l)?t(i[l])?i[l].push(y):i[l]=[i[l],y]:i[l]=y}return i};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],2:[function(e,r){"use strict";function n(e,r){if(e.map)return e.map(r);for(var n=[],t=0;t 4 | Website: http://rukeba.com/ 5 | Version: 1.0 6 | Date: 2009-01-03 7 | Music: Aphex Twin / Xtal 8 | */ 9 | 10 | pre code { 11 | display: block; padding: 0.5em; 12 | background-color: #f4f4f4; 13 | } 14 | 15 | pre code, 16 | pre .ruby .subst, 17 | pre .lisp .title { 18 | color: black; 19 | } 20 | 21 | pre .string, 22 | pre .title, 23 | pre .parent, 24 | pre .tag .value, 25 | pre .rules .value, 26 | pre .rules .value .number, 27 | pre .preprocessor, 28 | pre .ruby .symbol, 29 | pre .ruby .symbol .string, 30 | pre .ruby .symbol .keyword, 31 | pre .ruby .symbol .keymethods, 32 | pre .instancevar, 33 | pre .aggregate, 34 | pre .template_tag, 35 | pre .django .variable, 36 | pre .smalltalk .class, 37 | pre .addition, 38 | pre .flow, 39 | pre .stream, 40 | pre .bash .variable, 41 | pre .apache .cbracket { 42 | color: #050; 43 | } 44 | 45 | pre .comment, 46 | pre .annotation, 47 | pre .template_comment, 48 | pre .diff .header, 49 | pre .chunk { 50 | color: #777; 51 | } 52 | 53 | pre .number, 54 | pre .date, 55 | pre .regexp, 56 | pre .literal, 57 | pre .smalltalk .symbol, 58 | pre .smalltalk .char, 59 | pre .change, 60 | pre .tex .special { 61 | color: #800; 62 | } 63 | 64 | pre .label, 65 | pre .javadoc, 66 | pre .ruby .string, 67 | pre .decorator, 68 | pre .filter .argument, 69 | pre .localvars, 70 | pre .array, 71 | pre .attr_selector, 72 | pre .pseudo, 73 | pre .pi, 74 | pre .doctype, 75 | pre .deletion, 76 | pre .envvar, 77 | pre .shebang, 78 | pre .apache .sqbracket, 79 | pre .nginx .built_in, 80 | pre .tex .formula, 81 | pre .input_number { 82 | color: #00e; 83 | } 84 | 85 | pre .keyword, 86 | pre .id, 87 | pre .phpdoc, 88 | pre .title, 89 | pre .built_in, 90 | pre .aggregate, 91 | pre .smalltalk .class, 92 | pre .winutils, 93 | pre .bash .variable, 94 | pre .apache .tag, 95 | pre .xml .tag, 96 | pre .xml .title, 97 | pre .tex .command { 98 | font-weight: bold; 99 | color: navy; 100 | } 101 | 102 | pre .nginx .built_in { 103 | font-weight: normal; 104 | } 105 | 106 | pre .xml .css, 107 | pre .xml .javascript, 108 | pre .xml .vbscript, 109 | pre .tex .formula { 110 | opacity: 0.5; 111 | } 112 | 113 | /* --- */ 114 | pre .apache .tag { 115 | font-weight: bold; 116 | color: blue; 117 | } 118 | 119 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/zenburn.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Zenburn style from voldmar.ru (c) Vladimir Epifanov 4 | based on dark.css by Ivan Sagalaev 5 | 6 | */ 7 | 8 | pre code { 9 | display: block; padding: 0.5em; 10 | background: #3F3F3F; 11 | color: #DCDCDC; 12 | } 13 | 14 | pre .keyword, 15 | pre .tag, 16 | pre .django .tag, 17 | pre .django .keyword, 18 | pre .css .class, 19 | pre .css .id, 20 | pre .lisp .title { 21 | color: #E3CEAB; 22 | } 23 | 24 | pre .django .template_tag, 25 | pre .django .variable, 26 | pre .django .filter .argument { 27 | color: #DCDCDC; 28 | } 29 | 30 | pre .number, 31 | pre .date { 32 | color: #8CD0D3; 33 | } 34 | 35 | pre .dos .envvar, 36 | pre .dos .stream, 37 | pre .variable, 38 | pre .apache .sqbracket { 39 | color: #EFDCBC; 40 | } 41 | 42 | pre .dos .flow, 43 | pre .diff .change, 44 | pre .python .exception, 45 | pre .python .built_in, 46 | pre .literal, 47 | pre .tex .special { 48 | color: #EFEFAF; 49 | } 50 | 51 | pre .diff .chunk, 52 | pre .ruby .subst { 53 | color: #8F8F8F; 54 | } 55 | 56 | pre .dos .keyword, 57 | pre .python .decorator, 58 | pre .class .title, 59 | pre .haskell .label, 60 | pre .function .title, 61 | pre .ini .title, 62 | pre .diff .header, 63 | pre .ruby .class .parent, 64 | pre .apache .tag, 65 | pre .nginx .built_in, 66 | pre .tex .command, 67 | pre .input_number { 68 | color: #efef8f; 69 | } 70 | 71 | pre .dos .winutils, 72 | pre .ruby .symbol, 73 | pre .ruby .symbol .string, 74 | pre .ruby .symbol .keyword, 75 | pre .ruby .symbol .keymethods, 76 | pre .ruby .string, 77 | pre .ruby .instancevar { 78 | color: #DCA3A3; 79 | } 80 | 81 | pre .diff .deletion, 82 | pre .string, 83 | pre .tag .value, 84 | pre .preprocessor, 85 | pre .built_in, 86 | pre .sql .aggregate, 87 | pre .javadoc, 88 | pre .smalltalk .class, 89 | pre .smalltalk .localvars, 90 | pre .smalltalk .array, 91 | pre .css .rules .value, 92 | pre .attr_selector, 93 | pre .pseudo, 94 | pre .apache .cbracket, 95 | pre .tex .formula { 96 | color: #CC9393; 97 | } 98 | 99 | pre .shebang, 100 | pre .diff .addition, 101 | pre .comment, 102 | pre .java .annotation, 103 | pre .template_comment, 104 | pre .pi, 105 | pre .doctype { 106 | color: #7F9F7F; 107 | } 108 | 109 | pre .xml .css, 110 | pre .xml .javascript, 111 | pre .xml .vbscript, 112 | pre .tex .formula { 113 | opacity: 0.5; 114 | } 115 | 116 | -------------------------------------------------------------------------------- /client/js/components/async/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "async", 3 | "description": "Higher-order functions and common patterns for asynchronous code", 4 | "main": "lib/async.js", 5 | "files": [ 6 | "lib", 7 | "dist/async.js", 8 | "dist/async.min.js" 9 | ], 10 | "author": "Caolan McMahon", 11 | "version": "1.5.2", 12 | "keywords": [ 13 | "async", 14 | "callback", 15 | "utility", 16 | "module" 17 | ], 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/caolan/async.git" 21 | }, 22 | "bugs": { 23 | "url": "https://github.com/caolan/async/issues" 24 | }, 25 | "license": "MIT", 26 | "devDependencies": { 27 | "benchmark": "bestiejs/benchmark.js", 28 | "bluebird": "^2.9.32", 29 | "chai": "^3.1.0", 30 | "coveralls": "^2.11.2", 31 | "es6-promise": "^2.3.0", 32 | "jscs": "^1.13.1", 33 | "jshint": "~2.8.0", 34 | "karma": "^0.13.2", 35 | "karma-browserify": "^4.2.1", 36 | "karma-firefox-launcher": "^0.1.6", 37 | "karma-mocha": "^0.2.0", 38 | "karma-mocha-reporter": "^1.0.2", 39 | "lodash": "^3.9.0", 40 | "mkdirp": "~0.5.1", 41 | "mocha": "^2.2.5", 42 | "native-promise-only": "^0.8.0-a", 43 | "nodeunit": ">0.0.0", 44 | "nyc": "^2.1.0", 45 | "rsvp": "^3.0.18", 46 | "semver": "^4.3.6", 47 | "uglify-js": "~2.4.0", 48 | "xyz": "^0.5.0", 49 | "yargs": "~3.9.1" 50 | }, 51 | "jam": { 52 | "main": "lib/async.js", 53 | "include": [ 54 | "lib/async.js", 55 | "README.md", 56 | "LICENSE" 57 | ], 58 | "categories": [ 59 | "Utilities" 60 | ] 61 | }, 62 | "scripts": { 63 | "mocha-node-test": "mocha mocha_test/", 64 | "mocha-browser-test": "karma start", 65 | "mocha-test": "npm run mocha-node-test && npm run mocha-browser-test", 66 | "nodeunit-test": "nodeunit test/test-async.js", 67 | "test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test", 68 | "lint": "jshint lib/*.js test/*.js perf/*.js && jscs lib/*.js test/*.js perf/*.js", 69 | "coverage": "nyc npm test && nyc report", 70 | "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls" 71 | }, 72 | "spm": { 73 | "main": "lib/async.js" 74 | }, 75 | "volo": { 76 | "main": "lib/async.js", 77 | "ignore": [ 78 | "**/.*", 79 | "node_modules", 80 | "bower_components", 81 | "test", 82 | "tests" 83 | ] 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /client/js/components/base64/base64.js: -------------------------------------------------------------------------------- 1 | ;(function () { 2 | 3 | var object = typeof exports != 'undefined' ? exports : this; // #8: web workers 4 | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 5 | 6 | function InvalidCharacterError(message) { 7 | this.message = message; 8 | } 9 | InvalidCharacterError.prototype = new Error; 10 | InvalidCharacterError.prototype.name = 'InvalidCharacterError'; 11 | 12 | // encoder 13 | // [https://gist.github.com/999166] by [https://github.com/nignag] 14 | object.btoa || ( 15 | object.btoa = function (input) { 16 | var str = String(input); 17 | for ( 18 | // initialize result and counter 19 | var block, charCode, idx = 0, map = chars, output = ''; 20 | // if the next str index does not exist: 21 | // change the mapping table to "=" 22 | // check if d has no fractional digits 23 | str.charAt(idx | 0) || (map = '=', idx % 1); 24 | // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 25 | output += map.charAt(63 & block >> 8 - idx % 1 * 8) 26 | ) { 27 | charCode = str.charCodeAt(idx += 3/4); 28 | if (charCode > 0xFF) { 29 | throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); 30 | } 31 | block = block << 8 | charCode; 32 | } 33 | return output; 34 | }); 35 | 36 | // decoder 37 | // [https://gist.github.com/1020396] by [https://github.com/atk] 38 | object.atob || ( 39 | object.atob = function (input) { 40 | var str = String(input).replace(/=+$/, ''); 41 | if (str.length % 4 == 1) { 42 | throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded."); 43 | } 44 | for ( 45 | // initialize result and counters 46 | var bc = 0, bs, buffer, idx = 0, output = ''; 47 | // get next character 48 | buffer = str.charAt(idx++); 49 | // character found in table? initialize bit storage and add its ascii value; 50 | ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, 51 | // and if not first of each 4 characters, 52 | // convert the first 8 bits to one ascii character 53 | bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 54 | ) { 55 | // try to find character in table (0-63, not found => -1) 56 | buffer = chars.indexOf(buffer); 57 | } 58 | return output; 59 | }); 60 | 61 | }()); 62 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/cmake.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: CMake 3 | Description: CMake is an open-source cross-platform system for build automation. 4 | Author: Igor Kalnitsky 5 | Website: http://kalnitsky.org.ua/ 6 | */ 7 | module.exports = function(hljs){ 8 | hljs.LANGUAGES.cmake = { 9 | case_insensitive: true, 10 | defaultMode: { 11 | keywords: { 12 | 'add_custom_command': 2, 'add_custom_target': 2, 'add_definitions': 2, 'add_dependencies': 2, 'add_executable': 2, 'add_library': 2, 'add_subdirectory': 2, 'add_executable': 2, 'add_library': 2, 'add_subdirectory': 2, 'add_test': 2, 'aux_source_directory': 2, 'break': 1, 'build_command': 2, 'cmake_minimum_required': 3, 'cmake_policy': 3, 'configure_file': 1, 'create_test_sourcelist': 1, 'define_property': 1, 'else': 1, 'elseif': 1, 'enable_language': 2, 'enable_testing': 2, 'endforeach': 1, 'endfunction': 1, 'endif': 1, 'endmacro': 1, 'endwhile': 1, 'execute_process': 2, 'export': 1, 'find_file': 1, 'find_library': 2, 'find_package': 2, 'find_path': 1, 'find_program': 1, 'fltk_wrap_ui': 2, 'foreach': 1, 'function': 1, 'get_cmake_property': 3, 'get_directory_property': 1, 'get_filename_component': 1, 'get_property': 1, 'get_source_file_property': 1, 'get_target_property': 1, 'get_test_property': 1, 'if': 1, 'include': 1, 'include_directories': 2, 'include_external_msproject': 1, 'include_regular_expression': 2, 'install': 1, 'link_directories': 1, 'load_cache': 1, 'load_command': 1, 'macro': 1, 'mark_as_advanced': 1, 'message': 1, 'option': 1, 'output_required_files': 1, 'project': 1, 'qt_wrap_cpp': 2, 'qt_wrap_ui': 2, 'remove_definitions': 2, 'return': 1, 'separate_arguments': 1, 'set': 1, 'set_directory_properties': 1, 'set_property': 1, 'set_source_files_properties': 1, 'set_target_properties': 1, 'set_tests_properties': 1, 'site_name': 1, 'source_group': 1, 'string': 1, 'target_link_libraries': 2, 'try_compile': 2, 'try_run': 2, 'unset': 1, 'variable_watch': 2, 'while': 1, 'build_name': 1, 'exec_program': 1, 'export_library_dependencies': 1, 'install_files': 1, 'install_programs': 1, 'install_targets': 1, 'link_libraries': 1, 'make_directory': 1, 'remove': 1, 'subdir_depends': 1, 'subdirs': 1, 'use_mangled_mesa': 1, 'utility_source': 1, 'variable_requires': 1, 'write_file': 1 }, 13 | 14 | contains: [ 15 | { 16 | className: 'envvar', 17 | begin: '\\${', end: '}' 18 | }, 19 | hljs.HASH_COMMENT_MODE, 20 | hljs.QUOTE_STRING_MODE, 21 | hljs.NUMBER_MODE 22 | ] 23 | } 24 | }; 25 | }; -------------------------------------------------------------------------------- /docs/refactor.notes: -------------------------------------------------------------------------------- 1 | ## Clean up Directory Structure 2 | ### First Iteration 3 | + server/ 4 | + server.js 5 | + models/ 6 | + chat.js 7 | + keyid.js 8 | + keypair.js 9 | + membership.js 10 | + message.js 11 | + pfile.js 12 | + privatechat.js 13 | + privkey.js 14 | + room.js 15 | + user.js 16 | + routes/ 17 | + auth.js 18 | + client.js 19 | + keys.js 20 | + membership.js 21 | + user.js 22 | + js/ 23 | + database.js 24 | + socketServer.js 25 | + bower_components 26 | + authentication 27 | + index.js 28 | + files/ (set these up as prototypes? or leave as a function?, notifyError should be 29 | made to be reusable somewhere in messaging) 30 | + index.js (has handlers in it, need to be cleaned up) 31 | + get.js (handleGetFile bits broken out) 32 | + put.js (handleChunk bits broken out) 33 | + notify.js 34 | + client/ 35 | + client.js 36 | + views/ 37 | + js/ (contains src for bundles and other js files) 38 | + client/ 39 | + index.js (maybe should have this be the web client and move ../client.js to electron.js in this folder) 40 | - everything could then be included from the ../client.js to be built by browserify? Will this work with electron somehow? 41 | + bundles/ (contains conpiled bundles) 42 | 43 | Questions: 44 | + How to build only one file to get all files bundled? 45 | + Which files do I have left to bundle? 46 | + Compile pug templates then browserify that? (would need to have require) 47 | + Why are we using Userlist and masterUserlist? Do we need both? 48 | 49 | 50 | ### Second Iteration 51 | + Add src directory 52 | + Src dir files are compiled into client/[specific_dir] 53 | + specific_dir files are git ignored 54 | + Set up bower to correctly install and then git ignore the components folder 55 | 56 | Make `npm run build` build all browserify things 57 | 58 | Exclude built files from git 59 | 60 | Clean up test directories 61 | 62 | 63 | ## Tech Debt 64 | + Need to make accessing username (used to be window.username) consistent 65 | + Determine how to pass along references to socket, chatManager, etc... 66 | + modals should probably be managed from a single lib that requires them all 67 | 68 | ## Questions (input required from trusted devs) 69 | + Which modules should be prototypes and which should me modeled like utils where it simpyl exports functions? 70 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/default.css.orig: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Original style from softwaremaniacs.org (c) Ivan Sagalaev 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background: #F0F0F0; 10 | } 11 | 12 | pre code, 13 | pre .ruby .subst, 14 | pre .tag .title, 15 | pre .lisp .title { 16 | color: black; 17 | } 18 | 19 | pre .string, 20 | pre .title, 21 | pre .constant, 22 | pre .parent, 23 | pre .tag .value, 24 | pre .rules .value, 25 | pre .rules .value .number, 26 | pre .preprocessor, 27 | pre .ruby .symbol, 28 | pre .ruby .symbol .string, 29 | pre .ruby .symbol .keyword, 30 | pre .ruby .symbol .keymethods, 31 | pre .instancevar, 32 | pre .aggregate, 33 | pre .template_tag, 34 | pre .django .variable, 35 | pre .smalltalk .class, 36 | pre .addition, 37 | pre .flow, 38 | pre .stream, 39 | pre .bash .variable, 40 | pre .apache .tag, 41 | pre .apache .cbracket, 42 | pre .tex .command, 43 | pre .tex .special, 44 | pre .erlang_repl .function_or_atom { 45 | color: #800; 46 | } 47 | 48 | pre .comment, 49 | pre .annotation, 50 | pre .template_comment, 51 | pre .diff .header, 52 | pre .chunk { 53 | color: #888; 54 | } 55 | 56 | pre .number, 57 | pre .date, 58 | pre .regexp, 59 | pre .literal, 60 | pre .smalltalk .symbol, 61 | pre .smalltalk .char, 62 | pre .go .constant, 63 | pre .change { 64 | color: #080; 65 | } 66 | 67 | pre .label, 68 | pre .javadoc, 69 | pre .ruby .string, 70 | pre .decorator, 71 | pre .filter .argument, 72 | pre .localvars, 73 | pre .array, 74 | pre .attr_selector, 75 | pre .important, 76 | pre .pseudo, 77 | pre .pi, 78 | pre .doctype, 79 | pre .deletion, 80 | pre .envvar, 81 | pre .shebang, 82 | pre .apache .sqbracket, 83 | pre .nginx .built_in, 84 | pre .tex .formula, 85 | pre .erlang_repl .reserved, 86 | pre .input_number { 87 | color: #88F 88 | } 89 | 90 | pre .css .tag, 91 | pre .javadoctag, 92 | pre .phpdoc, 93 | pre .yardoctag { 94 | font-weight: bold; 95 | } 96 | 97 | pre .keyword, 98 | pre .id, 99 | pre .phpdoc, 100 | pre .title, 101 | pre .built_in, 102 | pre .aggregate, 103 | pre .smalltalk .class, 104 | pre .winutils, 105 | pre .bash .variable, 106 | pre .apache .tag, 107 | pre .go .typename, 108 | pre .tex .command { 109 | font-weight: bold; 110 | } 111 | 112 | pre .nginx .built_in { 113 | font-weight: normal; 114 | } 115 | 116 | pre .xml .css, 117 | pre .xml .javascript, 118 | pre .xml .vbscript, 119 | pre .tex .formula { 120 | opacity: 0.5; 121 | } 122 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/school_book.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | School Book style from goldblog.com.ua (c) Zaripov Yura 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 15px 0.5em 0.5em 30px; 9 | font-size: 11px !important; 10 | line-height:16px !important; 11 | } 12 | 13 | pre{ 14 | background:#f6f6ae url(./school_book.png); 15 | border-top: solid 2px #d2e8b9; 16 | border-bottom: solid 1px #d2e8b9; 17 | } 18 | 19 | pre .keyword, 20 | pre .literal, 21 | pre .change, 22 | pre .winutils, 23 | pre .flow, 24 | pre .lisp .title, 25 | pre .tex .special { 26 | color:#005599; 27 | font-weight:bold; 28 | } 29 | 30 | pre code, 31 | pre .ruby .subst, 32 | pre .tag .keyword { 33 | color: #3E5915; 34 | } 35 | 36 | pre .string, 37 | pre .function .title, 38 | pre .class .title, 39 | pre .haskell .label, 40 | pre .ini .title, 41 | pre .tag .value, 42 | pre .css .rules .value, 43 | pre .preprocessor, 44 | pre .ruby .symbol, 45 | pre .ruby .symbol .string, 46 | pre .ruby .symbol .keyword, 47 | pre .ruby .symbol .keymethods, 48 | pre .ruby .instancevar, 49 | pre .ruby .class .parent, 50 | pre .built_in, 51 | pre .sql .aggregate, 52 | pre .django .template_tag, 53 | pre .django .variable, 54 | pre .smalltalk .class, 55 | pre .javadoc, 56 | pre .ruby .string, 57 | pre .django .filter .argument, 58 | pre .smalltalk .localvars, 59 | pre .smalltalk .array, 60 | pre .attr_selector, 61 | pre .pseudo, 62 | pre .addition, 63 | pre .stream, 64 | pre .envvar, 65 | pre .apache .tag, 66 | pre .apache .cbracket, 67 | pre .nginx .built_in, 68 | pre .tex .command { 69 | color: #2C009F; 70 | } 71 | 72 | pre .comment, 73 | pre .java .annotation, 74 | pre .python .decorator, 75 | pre .template_comment, 76 | pre .pi, 77 | pre .doctype, 78 | pre .deletion, 79 | pre .shebang, 80 | pre .apache .sqbracket { 81 | color: #E60415; 82 | } 83 | 84 | pre .keyword, 85 | pre .literal, 86 | pre .css .id, 87 | pre .phpdoc, 88 | pre .function .title, 89 | pre .class .title, 90 | pre .haskell .label, 91 | pre .vbscript .built_in, 92 | pre .sql .aggregate, 93 | pre .rsl .built_in, 94 | pre .smalltalk .class, 95 | pre .xml .tag .title, 96 | pre .diff .header, 97 | pre .chunk, 98 | pre .winutils, 99 | pre .bash .variable, 100 | pre .lisp .title, 101 | pre .apache .tag, 102 | pre .tex .command { 103 | font-weight: bold; 104 | } 105 | 106 | pre .xml .css, 107 | pre .xml .javascript, 108 | pre .xml .vbscript, 109 | pre .tex .formula { 110 | opacity: 0.5; 111 | } 112 | -------------------------------------------------------------------------------- /client/css/highlight.js/styles/far.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | FAR Style (c) MajestiC 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | background: #000080; 10 | } 11 | 12 | pre code, 13 | .ruby .subst { 14 | color: #0FF; 15 | } 16 | 17 | pre .string, 18 | pre .ruby .string, 19 | pre .function .title, 20 | pre .class .title, 21 | pre .haskell .label, 22 | pre .ini .title, 23 | pre .tag .value, 24 | pre .css .rules .value, 25 | pre .css .rules .value .number, 26 | pre .preprocessor, 27 | pre .ruby .symbol, 28 | pre .ruby .symbol .string, 29 | pre .ruby .symbol .keyword, 30 | pre .ruby .symbol .keymethods, 31 | pre .built_in, 32 | pre .sql .aggregate, 33 | pre .django .template_tag, 34 | pre .django .variable, 35 | pre .smalltalk .class, 36 | pre .addition, 37 | pre .apache .tag, 38 | pre .apache .cbracket, 39 | pre .tex .command { 40 | color: #FF0; 41 | } 42 | 43 | pre .keyword, 44 | pre .css .id, 45 | pre .function .title, 46 | pre .class .title, 47 | pre .haskell .label, 48 | pre .ini .title, 49 | pre .vbscript .built_in, 50 | pre .sql .aggregate, 51 | pre .rsl .built_in, 52 | pre .smalltalk .class, 53 | pre .xml .tag .title, 54 | pre .winutils, 55 | pre .flow, 56 | pre .lisp .title, 57 | pre .change, 58 | pre .envvar, 59 | pre .bash .variable, 60 | pre .tex .special { 61 | color: #FFF; 62 | } 63 | 64 | pre .comment, 65 | pre .phpdoc, 66 | pre .javadoc, 67 | pre .java .annotation, 68 | pre .template_comment, 69 | pre .deletion, 70 | pre .apache .sqbracket, 71 | pre .tex .formula { 72 | color: #888; 73 | } 74 | 75 | pre .number, 76 | pre .date, 77 | pre .regexp, 78 | pre .literal, 79 | pre .smalltalk .symbol, 80 | pre .smalltalk .char { 81 | color: #0F0; 82 | } 83 | 84 | pre .python .decorator, 85 | pre .django .filter .argument, 86 | pre .smalltalk .localvars, 87 | pre .smalltalk .array, 88 | pre .attr_selector, 89 | pre .pseudo, 90 | pre .xml .pi, 91 | pre .diff .header, 92 | pre .chunk, 93 | pre .shebang, 94 | pre .nginx .built_in, 95 | pre .input_number { 96 | color: #008080; 97 | } 98 | 99 | pre .keyword, 100 | pre .css .id, 101 | pre .function .title, 102 | pre .class .title, 103 | pre .haskell .label, 104 | pre .ini .title, 105 | pre .vbscript .built_in, 106 | pre .sql .aggregate, 107 | pre .rsl .built_in, 108 | pre .smalltalk .class, 109 | pre .xml .tag .title, 110 | pre .winutils, 111 | pre .flow, 112 | pre .lisp .title, 113 | pre .apache .tag, 114 | pre .nginx .built_in, 115 | pre .tex .command, 116 | pre .tex .special { 117 | font-weight: bold; 118 | } 119 | -------------------------------------------------------------------------------- /client/css/highlight.js/languages/cpp.js: -------------------------------------------------------------------------------- 1 | /* 2 | Language: C++ 3 | Category: common 4 | */ 5 | module.exports = function(hljs){ 6 | hljs.LANGUAGES.cpp = function(){ 7 | var CPP_KEYWORDS = { 8 | 'keyword': { 9 | 'false': 1, 'int': 1, 'float': 1, 'while': 1, 'private': 1, 'char': 1, 10 | 'catch': 1, 'export': 1, 'virtual': 1, 'operator': 2, 'sizeof': 2, 11 | 'dynamic_cast': 2, 'typedef': 2, 'const_cast': 2, 'const': 1, 12 | 'struct': 1, 'for': 1, 'static_cast': 2, 'union': 1, 'namespace': 1, 13 | 'unsigned': 1, 'long': 1, 'throw': 1, 'volatile': 2, 'static': 1, 14 | 'protected': 1, 'bool': 1, 'template': 1, 'mutable': 1, 'if': 1, 15 | 'public': 1, 'friend': 2, 'do': 1, 'return': 1, 'goto': 1, 'auto': 1, 16 | 'void': 2, 'enum': 1, 'else': 1, 'break': 1, 'new': 1, 'extern': 1, 17 | 'using': 1, 'true': 1, 'class': 1, 'asm': 1, 'case': 1, 'typeid': 1, 18 | 'short': 1, 'reinterpret_cast': 2, 'default': 1, 'double': 1, 19 | 'register': 1, 'explicit': 1, 'signed': 1, 'typename': 1, 'try': 1, 20 | 'this': 1, 'switch': 1, 'continue': 1, 'wchar_t': 1, 'inline': 1, 21 | 'delete': 1, 'alignof': 1, 'char16_t': 1, 'char32_t': 1, 'constexpr': 1, 22 | 'decltype': 1, 'noexcept': 1, 'nullptr': 1, 'static_assert': 1, 23 | 'thread_local': 1 24 | }, 25 | 'built_in': { 26 | 'std': 1, 'string': 1, 'cin': 1, 'cout': 1, 'cerr': 1, 'clog': 1, 27 | 'stringstream': 1, 'istringstream': 1, 'ostringstream': 1, 'auto_ptr': 1, 28 | 'deque': 1, 'list': 1, 'queue': 1, 'stack': 1, 'vector': 1, 'map': 1, 29 | 'set': 1, 'bitset': 1, 'multiset': 1, 'multimap': 1, 'unordered_set': 1, 30 | 'unordered_map': 1, 'unordered_multiset': 1, 'unordered_multimap': 1, 31 | 'array': 1, 'shared_ptr': 1 32 | } 33 | }; 34 | var STL_CONTAINER = { 35 | className: 'stl_container', 36 | begin: '\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>', 37 | keywords: CPP_KEYWORDS['built_in'], 38 | relevance: 10 39 | }; 40 | STL_CONTAINER.contains = [STL_CONTAINER]; 41 | return { 42 | defaultMode: { 43 | keywords: CPP_KEYWORDS, 44 | illegal: '