Пример #1
0
  init: function (app) {
    ss.client.define('main', {
      view: 'main.jade',
      css: ['styles.styl'],
      code: [
        'system',
        'libs/jquery.min.js',
        'libs/davis.min.js',
        'libs/bootstrap.min.js',
        'libs/d3.min.js',
        'libs/apprise.js',
        'libs/howler.min.js',
        'routes',
        'data',
        'admin',
        'shared',
        'game',
        'main'
      ],
      tmpl: '*'
    })

    ss.http.route('/', function (req, res) {
      res.serveClient('main')
    })
  }
Пример #2
0
	init: function(app) {

		ss.client.define('main', {
			view: 'main.jade',
			css: ['styles.styl'],
			code: [
				'libs/jquery-2.0.3.min.js',
				'libs/davis-0.9.6.min.js',
				'libs/underscore.js',
				'libs/bootstrap.min.js',
				'libs/d3.v2.min.js',
				'libs/howler.min.js',
				'libs/plugins.js',
				'routes',
				'admin',
				'shared',
				'game',
				'main'
			],
			tmpl: '*'
		});

		ss.http.route('/', function(req, res) {
			res.serveClient('main');
		});

		// 404'd
		app.use(function(req, res, next) {
			// res.send(404, 'Sorry cant find that!');
			CivicSeed.SocketStream = false;
			res.render(rootDir + '/client/views/app.jade', {
				title: '404 - Page Not Found',
				CivicSeed: JSON.stringify(CivicSeed),
				SocketStream: ''
			});
		});

	}
Пример #3
0
var c = function() {
  console.log.apply(console, arguments);
}

c('here');

var webpack_bundler = require('./webpack_bundler.js');

var t = require('socketstream'); var http = require('http');

t.client.define('basic', webpack_bundler, {
  view: 'basic.html',
  code: ['app']
});

t.http.route('/', function(req, res){
  c(Object.keys(req));
  res.serveClient('basic');
});

t.session.store.use('redis'); t.publish.transport.use('redis');

var server = http.createServer(t.http.middleware);

t.start(server);

process.on('uncaughtException', function(e){
  c('Exception caught', e);
});

var port = 3000;
Пример #4
0
#!/usr/bin/env node
var fs = require('fs');
var http = require('http');
var https = require('https');
var ss = require('socketstream');

var argv = require('yargs').argv;

var secureHeaders = require('./server/secure-headers.js');

var server;

//define assets for admin app
ss.client.define('main', {
  view: 'app.jade',
  css:  ['libs', 'app.styl'],
  code: ['libs', 'app'],
  tmpl: '*'
});

// serve main client on the root url
ss.http.route('/', function(req, res) {
  res.serveClient('main');
});

// code formatters
ss.client.formatters.add(require('ss-jade'));
ss.client.formatters.add(require('ss-stylus'));

ss.client.templateEngine.use(require('ss-hogan'));

// minimize and pack assets if you type: SS_ENV=production node app.js
Пример #5
0
// My SocketStream app

var http = require('http'),
    ss = require('socketstream');

// Define a single-page client
ss.client.define('main', {
  view: 'app.html',
  css:  ['base.css'],
  code: ['libs', 'app'],
  tmpl: '*'
});

// Serve this client on the root URL
ss.http.route('/', function(req, res){
  res.serveClient('main');
});

// Use server-side compiled Hogan (Mustache) templates. Others engines available
ss.client.templateEngine.use(require('ss-hogan'));

// Minimize and pack assets if you type: SS_ENV=production node app.js
if (ss.env == 'production') ss.client.packAssets();

// Start web server
var server = http.Server(ss.http.middleware);
server.listen(3000);

// Start SocketStream
ss.start(server);
console.log('Server running on http://localhost:3000');
Пример #6
0
// My SocketStream 0.3 app

var http = require('http'),
    ss = require('socketstream'),
    request = require('request'),
    jquery = require('jquery');

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.html',
  css:  ['app.styl', 'libs/nv.d3.css', 'libs/bootstrap.min.css'],
  code: ['libs/jquery.min.js', 'libs/d3.v2.min.js', 'libs/nvd3/nv.d3.min.js', 'libs/spin.min.js', 'app'],
  tmpl: '*'
});

// Serve this client on the root URL
ss.http.route('/', function(req, res){
  res.serveClient('main');
});

// Code Formatters
ss.client.formatters.add(require('ss-stylus'));

// Use server-side compiled Hogan (Mustache) templates. Others engines available
ss.client.templateEngine.use(require('ss-hogan'));

// Minimize and pack assets if you type: SS_ENV=production node app.js
if (ss.env === 'production') ss.client.packAssets();

// Start web server
var server = http.Server(ss.http.middleware);
Пример #7
0
// My SocketStream app

var ss = require('socketstream'),
    express = require('express'),
    authenticate = require('./server/handler/authenticate'),
    mongoose = require('mongoose');


ss.client.set({liveReload: false});

if (process.env.NODE_ENV == 'production'){
    ss.client.set({dirs: {static: '/client/static/build/production'}});
    mongoose.connect(process.env.MONGOLAB_URI);
}else {

    //connect to the mongoose database
    mongoose.connect('mongodb://localhost/draw_dev');
}

//overriding toJSON
var oldToJSON = mongoose.Document.prototype.toJSON;

mongoose.Document.prototype.toJSON = function(){
    var json = oldToJSON.call(this, arguments);
    json.id = json._id;
    delete json._id;
    return json;
};


var drawingsHandler = require('./server/handler/drawings');
Пример #8
0
// My SocketStream 0.3 app

var http = require('http'),
    ss = require('socketstream');

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.html',
  css:  ['libs/reset.css', 'app.styl'],
  code: ['libs/jquery.min.js', 'app'],
  tmpl: '*'
});

// Serve this client on the root URL
ss.http.route('/', function(req, res){
  res.serveClient('main');
});

// Code Formatters
ss.client.formatters.add(require('ss-stylus'));

// server-side backbone models
var ss_backbone_sync_opts = {
    models: {
        folder: "models"
    },
    dontSendLibs: false,
    addModelToReq: true
};
ss.responders.add(require('ss-backbone-sync'), ss_backbone_sync_opts);
Пример #9
0
var http = require('http')
  , ss = require('socketstream')
  , redis = require('redis')
  , db = redis.createClient();

ss.client.define('main', {
  view: 'app.jade',
  css:  ['libs', 'app.styl'],
  code: ['libs', 'app']
});

ss.http.router.on('/', function(req, res) {
  res.serveClient('main');
});

// Remove to use only plain .js, .html and .css files if you prefer
ss.client.formatters.add(require('ss-coffee'));
ss.client.formatters.add(require('ss-jade'));
ss.client.formatters.add(require('ss-stylus'));

// Use server-side compiled Hogan (Mustache) templates. Others engines available
ss.client.templateEngine.use(require('ss-hogan'));

// Minimise and pack assets if you type  SS_ENV=production node app.js
if (ss.env == 'production') ss.client.packAssets();

// Enable optional console server access. Run 'ss-client' to connect
var consoleServer = require('ss-console').init(ss);
consoleServer.listen(5000);

// Redis
Пример #10
0
// My SocketStream 0.3 app
var util = require('util');
var http = require('http'),
ss = require('socketstream');
Player = require('./server/models/player');
Game = require('./server/models/game');
cah = require('./server/rpc/cah');

players = [];
// Define a single-page client called 'main'
ss.client.define('game', {
  view: 'game.html',
  css:  ['libs/foundation.min.css', 'libs/cah.css', 'libs/icons.css'],
  code: ['libs/jquery.min.js', 'game/app', 'libs/custom.modernizr.js', 'libs/foundation.min.js', 'libs/foundation.reveal.js', 'libs/cah.js', 'libs/jquery.easing-1.3.js', 'libs/jquery.touchSwipe.js', 'libs/jquery.slide.js'],
  tmpl: 'game'
});

ss.client.define('join', {
  view: 'join.html',
  css:  ['libs/foundation.min.css', 'libs/cah.css', 'libs/icons.css'],
  code: ['libs/jquery.min.js', 'join/app', 'libs/custom.modernizr.js', 'libs/foundation.min.js', 'libs/cah.js', 'libs/jquery.easing-1.3.js', 'libs/jquery.touchSwipe.js'],
  tmpl: 'join'
});

ss.client.define('intro', {
  view: 'intro.html',
  css:  ['libs/foundation.min.css', 'libs/cah.css', 'libs/icons.css'],
  code: ['libs/jquery.min.js', 'intro/app', 'libs/custom.modernizr.js', 'libs/foundation.min.js', 'libs/cah.js', 'libs/jquery.easing-1.3.js', 'libs/jquery.touchSwipe.js'],
  tmpl: 'intro'
});
Пример #11
0
// parse urlencoded request bodies into req.body
app.use(bodyParser.urlencoded({ extended:false }));

// app.use('/',ss.http.middleware);
app.use(ss.http.session.middleware);
app.use(ss.http.cached.middleware);

// respond to all requests
app.use(function(req, res){
	res.end('Hello from Connect!\n');
});

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.jade',
  css:  ['../node_modules/normalize.css/normalize.css', './css/app.scss'],
  code: ['../node_modules/es6-shim/es6-shim.js', 'libs/jquery.min.js', 'app'],
  tmpl: '*'
});

// Serve this client on the root URL
ss.http.route('/').serveClient('main');

ss.client.formatters.add('sass');
ss.client.formatters.add('jade', {
	basedir: path.join(__dirname,'client','views')
});

// Use server-side compiled Hogan (Mustache) templates. Others engines available
ss.client.templateEngine.use(require('ss-hogan'));

ss.ws.transport.use('engineio',{ client: { localStorage:true }});
Пример #12
0
// My SocketStream 0.3 app

var http = require('http'),
    ss = require('socketstream');

ss.client.define('chat', {
  view: 'chat.html',
  css:  ['chat.less'],
  code: ['libs/jquery.min.js', 'libs/handlebars.js', 'libs/ember.js', 'chat'],
  tmpl: '*'
});

ss.http.route('/', function(req, res){
  res.serveClient('chat');
});

ss.client.formatters.add(require('ss-less'));
ss.client.templateEngine.use('ember');

if (ss.env === 'production') {
  ss.client.packAssets();
}

// Start web server
var server = http.Server(ss.http.middleware);
server.listen(3000);

// Start SocketStream
ss.start(server);
Пример #13
0
  'libs/coffee-script.js',
  'libs/codemirror-compressed.js',
  'libs/head.min.js',
  'libs/jquery.min.js',
  'libs/jquery.ui-1.8.20.custom.min.js',
  'libs/underscore.min.js',
  'libs/bootstrap.min.js',
  'libs/highlight.pack.js',
  'app'
];


// Define a single-page client
ss.client.define('main', {
	view  : 'app.jade',
	css   : ['libs', 'app.styl'],
	code  : codeLibDependencies,
	tmpl: ['account','app','dashboard','dashboardView','docs','homepage','widget','alert.jade','changePasswordModal.jade','inputFieldError.jade','loginModal.jade','signupModal.jade']
});



var api = require(__dirname + '/server/api');



ss.http.middleware.prepend(bodyParser.json());
ss.http.middleware.prepend(require('./server/queryMiddleware')());
ss.http.middleware.prepend(connectRoute(api));
ss.session.options.secret = ss.api.app.config.sessionSecret;

Пример #14
0
// My SocketStream 0.3 app

var http = require('http'),
    ss = require('socketstream');

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.jade',
  css:  ['libs/reset.css', 'app.styl'],
  code: ['libs/es5-shim.min.js','libs/jquery-1.9.1.min.js', 'libs/jquery-ui.min.js', 'libs/jquery.lettering.js', 'libs/jquery.lettering.animate.js','app'],
  tmpl: '*'
});

// Serve this client on the root URL
ss.http.route('/', function(req, res){
  res.serveClient('main');
});

// Code Formatters
ss.client.formatters.add(require('ss-coffee'));
ss.client.formatters.add(require('ss-jade'));
ss.client.formatters.add(require('ss-stylus'));

// Use server-side compiled Hogan (Mustache) templates. Others engines available
ss.client.templateEngine.use(require('ss-hogan'));

// Minimize and pack assets if you type: SS_ENV=production node app.js
if (ss.env === 'production') ss.client.packAssets();

// Start web server
var server = http.Server(ss.http.middleware);
Пример #15
0
"use strict";
var http = require('http')
  , redirect = require('connect-redirection')
  // , config = require('config')
  , ss = require('socketstream');

// Connect to MongoDB
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/pp');

global.cache = {pc: {} };

// Define a single-page client
ss.client.define('main', {
  view: 'main.html',
  css:  ['libs', 'main', 'app.styl', 'css.css', 'forms.css'],
  code: ['libs', 'app', 'system'],
  tmpl: '*'
});
ss.client.define('dialogeditor', {
  view: 'dialogeditor.html',
  css:  ['libs', 'dialogeditor.css'],
  code: ['libs', 'dialogeditor', 'system'],
  tmpl: '*'
});
ss.client.define('selectpc', {
  view: 'selectpc.html',
  css:  ['libs', 'selectpc.styl'],
  code: ['libs', 'selectpc', 'system'],
  tmpl: '*'
});
ss.client.define('admin', {
Пример #16
0
var http=require('http'), ss=require('socketstream');

ss.client.define('main',{
	view:'app.jade',
	css:['libs','app.styl'],
	code:['app','libs','pages','shared'],
	tmpl:'*',
});

ss.http.router.on('/',function(req,res){
	res.serveClient('main');
});

ss.client.formatters.add(require('ss-coffee'));
ss.client.formatters.add(require('ss-jade'));
ss.client.formatters.add(require('ss-stylus'));

ss.client.templateEngine.use(require('ss-clientjade'));

ss.client.set({liveReload: false});
ss.session.store.use('redis');
ss.publish.transport.use('redis');

if(ss.env=='production')ss.client.packAssets();

global.Config=require('./config/app.coffee');
//---- Middleware
var middleware=require('./server/middleware.coffee');
ss.http.middleware.prepend(middleware.jsonapi);
ss.http.middleware.prepend(middleware.manualxhr);
ss.http.middleware.prepend(middleware.images);
Пример #17
0
require('./server/session')(config.session);

ss.events.on('server:start', function() {
    ss.api.modules.load(config.modules);
});

ss.client.formatters.add(require('ss-less'));

ss.client.define('app', {
    'view': 'app.html',
    'tmpl': [],
    'css': [
        'bootstrap/bootstrap.less',
        'bootstrap-progressbar.less',
    ],
    'code': [
        'libs/jquery.min.js',
        'libs/bootstrap.min.js',
        'libs/jquery.smartresize.min.js',
        'libs/bootstrap-progressbar.js',
        'app',
    ],
});

ss.http.route('/', function(req, res) {
    res.serveClient('app');
});

ss.client.options.packAssets = process.env['SS_PACK'] || false;

if (env === 'production' || ss.client.options.packAssets) {
Пример #18
0
// My SocketStream app

var http = require('http'),
    ss = require('socketstream');

var sugar_auth_token = null;

_ = require('underscore');
require('colors');

ss.client.define('main', {
  view:   'app.jade',
  css:    ['app.css'],
  code:   ['libs/jquery-1.7.1.js', 'libs', 'app', 'main'],
  tmpl:   ['modules', 'partials'],
});

ss.http.router.on('/', function(req, res) {
  res.serve('main');
});

// Remove to use only plain .js, .html and .css files if you prefer
ss.client.formatters.add(require('ss-coffee'));
ss.client.formatters.add(require('ss-jade'));

// Add a formatter for Handlebar templates
ss.client.formatters.add(require('./formatters/hbt'));

// Use server-side compiled Handlebars templates.
ss.client.templateEngine.use(require('./template_engines/hbt'));
Пример #19
0
  server,
  app = express(),
  RouteDir = 'server/routes',
  files = fs.readdirSync(RouteDir),
  conf = require('./conf');

// code & template formatters
ss.client.formatters.add(require('ss-jade'));
ss.client.formatters.add(require('ss-stylus'));
// user server-side compiled Hogan (Mustache) templates
ss.client.templateEngine.use(require('ss-hogan')); 

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.jade',
  css:  ['libs', 'app.styl'],
  code: ['libs', 'app'],
  tmpl: '*'
});

// pack / minify if product env
if (ss.env === 'production') {
  ss.client.packAssets();
} else {
  // serve tests in non-production env
  ss.client.define('tests', {
    view: 'tests.jade',
    css: ['tests/mocha.css'],
    code: ['libs', 'app', 'tests'],
    tmpl: '*'
  });
Пример #20
0
//ss.session.store.use('redis');
//ss.publish.transport.use('redis');

//ss.ws.transport.use(require('ss-engine.io'));

// code & template formatters
ss.client.formatters.add(require('ss-coffee'));
ss.client.formatters.add(require('ss-jade'));
ss.client.formatters.add(require('ss-stylus'));
ss.client.templateEngine.use('angular');

// Define a single-page client called 'main'
ss.client.define('desktop', {
    view: 'desktop.jade',
    css:  ['libs', 'desktop.styl'],
    code: ['libs', 'common', 'desktop'],
    tmpl: ['common', 'desktop']
});
ss.client.define('mobile', {
    view: 'mobile.jade',
    css:  ['libs', 'mobile.styl'],
    code: ['libs', 'common', 'mobile'],
    tmpl: ['common', 'mobile']
});

// pack / minify if product env
if (ss.env === 'production') {
    ss.client.packAssets();
}

// Serve this client on the root URL 
Пример #21
0
'use strict';

var http = require('http'),
    ss = require('socketstream');

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.jade',
  css:  [''],
  code: [
    'libs/jquery.js',
    'libs/angular.js',
    'libs/angular-route.js',
    'libs/angular-resource-io.js',
    'app'
  ],
  tmpl: '*'
});

// Serve this client on the root URL
ss.http.route('/', function(req, res) {
  console.log('request++');
  res.serveClient('main');
});

// Code Formatters
ss.client.formatters.add(require('ss-jade'));

ss.client.set({ browserifyExcludePaths: ['app'] });

// Use server-side compiled Hogan (Mustache) templates. Others engines available
Пример #22
0
var routes = require('./routes');

// Configuration
// add cookieParser and currentUser to middlewares
app.configure( function () {
  app.use(express.cookieParser());
  app.use(express.bodyParser());
  app.use(app.router);
  app.use(express.favicon());
  app.use(express.static(path.join(__dirname, 'client')));
});

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.html',
  css: ['libs/jquery-ui.min.css'],
  code: ['libs/jquery.min.js', 'libs/jquery-ui.min.js', 'libs/knockout.js', 'app'],
});

// Use Express to route requests
app.get('/', function(req, res) {
  res.serveClient('main');
});
app.get('/events', routes.events);
app.get('/events/photos', routes.eventPhotos);
app.post('/events', routes.save);
app.post('/addPhoto', routes.addPhoto);

// Minimize and pack assets if you type: SS_ENV=production node app.js
if (ss.env === 'production') ss.client.packAssets();
Пример #23
0
            ss.api.publish.all('dberror', err);
    }
});*/


//ascending key-index to get queries faster
//db.collection('cgconnections').ensureIndex({ amcp: 1, osc: 1, host: 1 });
//add instance to socketstream api to use it by requests
ss.api.add('db', db);

//END DATABASE ADAPTER*********************************************************


ss.client.define('main', {
  view: 'casparctrl.html',
  css:  ['casparctrl.css','foundation.css', 'normalize.css'],
  code: ['libs/vendor/custom.modernizr.js','libs/jquery-1.9.1.min.js', 'libs/handlebars.js', 'libs/ember.js', 'libs/ember-data.js','libs/foundation.min.js','libs/foundation/foundation.js','libs/foundation/foundation.alerts.js','libs/foundation/foundation.clearing.js','libs/foundation/foundation.cookie.js','libs/foundation/foundation.dropdown.js','libs/foundation/foundation.forms.js','libs/foundation/foundation.joyride.js','libs/foundation/foundation.magellan.js','libs/foundation/foundation.orbit.js','libs/foundation/foundation.placeholder.js','libs/foundation/foundation.reveal.js','libs/foundation/foundation.section.js','libs/foundation/foundation.tooltips.js','libs/foundation/foundation.topbar.js','casparctrl'],
  tmpl: '*'
});

ss.http.route('/', function(req, res){
  res.serveClient('main');
});


ss.client.templateEngine.use('ember'); 

if (ss.env === 'production') 
	ss.client.packAssets();

 var server = http.Server(ss.http.middleware);
Пример #24
0
// My SocketStream 0.3 app

var http = require('http'),
    ss = require('socketstream'),
    crypto = require('crypto'),
    env = (process.env.FACEBOOK_APPID && process.env.FACEBOOK_DOMAIN) ? process.env : require('node-env-file')(__dirname + '/.env');

// Define a single-page client called 'screen'
ss.client.define('screen', {
  view: 'screen.ejs',
  css:  ['screen.styl'],
  code: ['screen']
});

// Define a single-page client called 'mobile'
ss.client.define('mobile', {
  view: 'mobile.ejs',
  css:  ['mobile.styl'],
  code: ['mobile']
});

// Serve this client on the root URL
ss.http.route('/', function(req, res){
  var ua = req.headers['user-agent'].toLowerCase();
  if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(ua)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0,4))) {
    res.serveClient('mobile');
  } else if (/ipad/.test(ua)) {
    res.serveClient('mobile');
  } else {
    res.serveClient('screen');
  }
Пример #25
0
// My SocketStream 0.3 app

var http = require('http'),
    reload = require('reload'),
    ss = require('socketstream');

// Define a single-page client called 'main'
ss.client.define('main', {
  view: 'app.html',
  css:  ['libs/reset.css', 'app.styl'],
  code: ['libs/jquery.min.js', 'app'],
  tmpl: '*'
});

 ss.client.define( "see", {
  view: 'src720.html',
  css:  ['libs' ],
  code: ['libs/jquery.min.js', 'libs/cp.min.js', 'libs/buffer-loader.js', 'libs/pixi.js', 'libs/TweenMax.min.js', 'libs/chance.js', 'source'],
  tmpl: '*'
  });

// Serve this client on the root URL
ss.http.route('/', function(req, res){
  res.serveClient('see');
});


// Minimize and pack assets if you type: SS_ENV=production node app.js
if (ss.env === 'production') ss.client.packAssets();

// Start web server
Пример #26
0
var http  = require("http"),
    ss    = require("socketstream");

// Define a single-page client called "timeline"
ss.client.define("timeline", {
  view: "app.html",
  css:  ["libs/reset.css", "libs/timeline.css"],
  code: ["libs/jquery.min.js", "libs/timeline.js", "app"],
  tmpl: "*"
});

// Serve this client on the root URL
ss.http.route("/", function(req, res){
  res.serveClient("timeline");
});

// Minimize and pack assets if you type: SS_ENV=production node app.js
if (ss.env === "production") ss.client.packAssets();

exports.publishTimelineData = function(message) {
  var data =  {
    "start":      message.start,
    "end":        message.end,

    "className":  message.className,
    "content":    message.content,
    "group":      message.group
  }
  console.log("ss publish data=" + JSON.stringify(data))
  ss.api.publish.all("newTimelineData", data)
}

//!!! SocketStream has built in messaging (pubsub) with configurable transport layers
//!!! REDIS has been the best pubsub engine I have seen yet and has not failed me, if you wanted
//!!! to use pubsub/messaging in your application stack then I highly recommend adding redis to your stack.
//ss.publish.transport.use('redis', {host: 'GO-REDIS-1', port: 6379});
//ss.publish.transport.use('redis', {host: 'localhost', port: 6379});



//!!! SocketStream will require at LEAST one main client defined.  I have found that I am able to split up and isolate multiple projects exposing
//!!! different types of endpoints within the application.  DRY DRY DRY, get it?  I will leave what I consider to be a must have secondary project 
//!!! below so you can begin DRY development too.
ss.client.define('main', {
  view: 'app.html',
  css:  ['bootstrap.min.css', 'bootstrap-responsive.min.css', 'bootstrap-editable.css', 'font-awesome.min.css', 'toggle-switch.css', 'custom.css','idangerous.swiper.css'],
  code: ['libs/jquery-1.9.1.min.js', 'libs/handlebars.js', 'libs/ember.js', 'libs/bootstrap.2.3.min.js','libs/moment.min.js','libs/lc.min.js','libs/meny.js','libs/idangerous.swiper-1.7.js','libs/ember-data.js','app'],
  tmpl: '*'
});

//!!! SocketStream loads all of the necessary portions of the codebase it takes to launch.  This is at a minimum.  Resources can be loaded at runtime as well from packages/compenents
//!!! the VIEW listed above is the "application" template, referred to by Ember and resides in client/views directory
//!!! the CSS files listed are used in the order given and reside in the /client/css directory
//!!! the code files are all loaded up at runtime and you will not have to include any script tags in your templates/views to pull these core resources into the application
//!!! the code files are used in the order provided as well and reside in the client/code/ directory.
//!!! the templates are exactly what they sound like, they reside in the client/templates directory.


//!!! SocketStream can handle top level routing for application specific instances.  This is a nice plus on top of application routing with just Ember as now we can hop
//!!! between various implementations for specific client types, TV's, iPads, Desktop, if we wanted to or switch to an admin panel, another app, etc.
//!!! here I am telling SocketStream to listen up on the default route and launch my main application that I defined above.
ss.http.route('/', function(req, res){
    connRedis = redis.createClient(redis_cfg["port"], redis_cfg["host"]);

require('./server/routes/routes')(ss, config['routes']);

ss.session.store.use('redis');
if (redis_cfg["auth"]) 
	connRedis.auth(redis_cfg["auth"]);

ss.api.add('db', connRedis);

ss.publish.transport.use('redis', {host: redis_cfg["host"], port: redis_cfg["port"], pass: redis_cfg["auth"], db: redis_cfg["db"]});
ss.session.options.maxAge = 8640000;
ss.session.options.secret = "xxllollxxlo";

// Defino rutas segun el archivo de configuracion
ss.client.templateEngine.use(require('ss-hogan'));
ss.client.set({liveReload: false})

// Minimize and pack assets if you type: SS_ENV=production node app.js
if (ss.env === 'production') ss.client.packAssets();

// Start web server
var server = http.Server(ss.http.middleware);
server.listen(config['app']['port'], config['app']['ip']);

// Start SocketStream
ss.start(server);

process.on('uncaughtException', function (err) {
	console.error('Exception caught: ', err);
});
Пример #29
0
  }
}

// Server-side templates
if (config.templateEngines) {
  for (i=0; i < config.templateEngines.length; i += 1) {
    ss.client.templateEngine.use(config.templateEngines[i]);
  }
}

// Define and serve the apps
if (config.apps) {
  for (i = 0; i < config.apps.length; i += 1) {
    var app = config.apps[i];
    console.log('Defining app: \'' + app.name + '\' at: \'' + app.route + '\'');
    ss.client.define(app.name, app);
    ss.http.route(app.route, function(req, res) {
      res.serveClient(app.name);
    });
  }
}

// Minimize and pack assets if you type: SS_ENV=production node start.js
if (ss.env === 'production') ss.client.packAssets();

// Start web server
var port = config.port || 3000;
var server = http.Server(ss.http.middleware);
console.log('Starting ' + ss.env + ' server on port: ' + port);
server.listen(port);
Пример #30
0
  mongoose = require('mongoose'),
  mongooseAuth = require('mongoose-auth'),
  security = require('./server/middleware/security'),
  UserModel = require('./server/models/user').User;

// connect to mongodb
mongoose.connect(conf.db.url);
mongoose.connection.on('open', function () {
  console.log("mongodb connection established");
});

/* _________________ VIEWS ________________ */
// the main webapp
ss.client.define('main', {
  view: 'app.jade',
  css:  ['libs', 'app.styl'],
  code: ['libs', 'app', 'shared', 'system'],
  tmpl: '*'
});

// the login page
ss.client.define('login', {
  view: 'login.jade',
  css: ['libs', 'app.styl', 'login.styl'],
  code: ['libs', 'app', 'system', 'shared'],
  tmpl: '*'
});

// the admin page
ss.client.define('admin', {
  view: 'admin.jade',
  css: ['libs', 'app.styl'],