Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Transition to use hapi

  • Loading branch information...
commit 79c77da3626032e4e01d621f54314f847924e84f 1 parent b0fedba
@hueniverse authored
Showing with 148 additions and 1,344 deletions.
  1. +16 −4 LICENSE
  2. +0 −145 api/base64.js
  3. +3 −3 api/batch.js
  4. +3 −3 api/db.js
  5. +3 −3 api/details.js
  6. +13 −57 api/email.js
  7. +0 −73 api/error.js
  8. +1 −1  api/index.js
  9. +2 −2 api/install.js
  10. +3 −3 api/invite.js
  11. +3 −3 api/last.js
  12. +0 −79 api/log.js
  13. +1 −4 api/package.json
  14. +3 −3 api/project.js
  15. +1 −1  api/routes.js
  16. +2 −2 api/rules.js
  17. +22 −697 api/server.js
  18. +4 −4 api/session.js
  19. +3 −3 api/sort.js
  20. +3 −3 api/storage.js
  21. +4 −4 api/stream.js
  22. +4 −4 api/suggestions.js
  23. +3 −3 api/task.js
  24. +3 −3 api/tips.js
  25. +3 −3 api/user.js
  26. +0 −189 api/utils.js
  27. +2 −2 api/vault.js.example
  28. +1 −1  clients/view/js/authentication.js
  29. +1 −1  clients/view/js/calendar.js
  30. +1 −1  clients/view/js/contacts.js
  31. +1 −1  clients/view/js/dnd.js
  32. +1 −1  clients/view/js/global.js
  33. +1 −1  clients/view/js/history.js
  34. +1 −1  clients/view/js/load.js
  35. +1 −1  clients/view/js/menu.js
  36. +1 −1  clients/view/js/network.js
  37. +1 −1  clients/view/js/overlay-extras.js
  38. +1 −1  clients/view/js/project.js
  39. +1 −1  clients/view/js/projectslist.js
  40. +1 −1  clients/view/js/settings.js
  41. +1 −1  clients/view/js/stream.js
  42. +1 −1  clients/view/js/suggestions.js
  43. +1 −1  clients/view/js/tasklist.js
  44. +1 −1  clients/view/js/templates.js
  45. +1 −1  clients/view/js/tips.js
  46. +1 −1  clients/view/js/tooltips.js
  47. +1 −1  clients/view/js/tour.js
  48. +1 −1  clients/view/js/uiutils.js
  49. +1 −1  clients/view/js/user.js
  50. +1 −1  web/account.js
  51. +1 −1  web/api.js
  52. +2 −2 web/base64.js
  53. +1 −1  web/client.js
  54. +1 −1  web/email.js
  55. +1 −1  web/error.js
  56. +1 −1  web/home.js
  57. +1 −1  web/index.js
  58. +1 −1  web/log.js
  59. +1 −1  web/login.js
  60. +1 −1  web/misc.js
  61. +1 −1  web/routes.js
  62. +1 −1  web/server.js
  63. +1 −1  web/session.js
  64. +1 −1  web/signup.js
  65. +1 −1  web/static/scripts/base.js
  66. +1 −1  web/test.js
  67. +1 −1  web/tos.js
  68. +1 −1  web/utils.js
  69. +1 −1  web/vault.js.example
View
20 LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2011, Yahoo, Inc.
+Copyright (c) 2011, Eran Hammer-Lahav
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -8,17 +8,29 @@ modification, are permitted provided that the following conditions are met:
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- * Neither the name of Yahoo! Inc. nor the
+ * Neither the name of Eran Hammer-Lahav nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
+DISCLAIMED. IN NO EVENT SHALL ERAN HAMMER-LAHAV BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ * * *
+
+
+Portions of this project were initially based on the original Postmile project,
+Copyright (c) 2011, Yahoo Inc. The original Postmile project is published at
+https://github.com/yahoo/postmile and its licensing terms are published at
+https://github.com/yahoo/postmile/blob/master/LICENSE. This modified version
+of Postmile has no affiliation with Yahoo, Inc.
+
+
View
145 api/base64.js
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
-* See LICENSE file included with this code project for license terms.
-*/
-
-// Adapted from: Version 1.0 12/25/99 Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
-
-// Declare internals
-
-var internals = {
-
- encodeChars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
- decodeChars: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1]
-};
-
-
-// Base64 encode
-
-exports.encode = function (string) {
-
- var c1, c2, c3;
-
- var len = string.length;
- var i = 0;
- var result = '';
-
- while (i < len) {
-
- c1 = string.charCodeAt(i++) & 0xff;
-
- if (i === len) {
-
- result += internals.encodeChars.charAt(c1 >> 2);
- result += internals.encodeChars.charAt((c1 & 0x3) << 4);
- result += '===';
- break;
- }
-
- c2 = string.charCodeAt(i++);
-
- if (i === len) {
-
- result += internals.encodeChars.charAt(c1 >> 2);
- result += internals.encodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- result += internals.encodeChars.charAt((c2 & 0xF) << 2);
- result += '=';
- break;
- }
-
- c3 = string.charCodeAt(i++);
-
- result += internals.encodeChars.charAt(c1 >> 2);
- result += internals.encodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- result += internals.encodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
- result += internals.encodeChars.charAt(c3 & 0x3F);
- }
-
- return result;
-};
-
-
-// Base64 decode
-
-exports.decode = function (string) {
-
- var c1, c2, c3, c4;
-
- var len = string.length;
- var i = 0;
- var result = '';
-
- while (i < len) {
-
- do {
-
- c1 = internals.decodeChars[string.charCodeAt(i++) & 0xff];
- }
- while (i < len && c1 === -1);
-
- if (c1 === -1) {
-
- break;
- }
-
- do {
-
- c2 = internals.decodeChars[string.charCodeAt(i++) & 0xff];
- }
- while (i < len && c2 === -1);
-
- if (c2 === -1) {
-
- break;
- }
-
- result += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
-
- do {
-
- c3 = string.charCodeAt(i++) & 0xff;
- if (c3 === 61) {
-
- return result;
- }
-
- c3 = internals.decodeChars[c3];
- }
- while (i < len && c3 === -1);
-
- if (c3 === -1) {
-
- break;
- }
-
- result += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
-
- do {
-
- c4 = string.charCodeAt(i++) & 0xff;
- if (c4 === 61) {
-
- return result;
- }
-
- c4 = internals.decodeChars[c4];
- }
- while (i < len && c4 === -1);
-
- if (c4 === -1) {
-
- break;
- }
-
- result += String.fromCharCode(((c3 & 0x03) << 6) | c4);
- }
-
- return result;
-};
View
6 api/batch.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
@@ -7,8 +7,8 @@
var Http = require('http');
var MAC = require('mac');
-var Utils = require('./utils');
-var Err = require('./error');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
var Config = require('./config');
View
6 api/db.js
@@ -1,13 +1,13 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load Modules
var MongoDB = require('mongodb');
-var Err = require('./error');
-var Utils = require('./utils');
+var Err = require('hapi').Error;
+var Utils = require('hapi').Utils;
var Vault = require('./vault');
var Config = require('./config');
View
6 api/details.js
@@ -1,16 +1,16 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
+var Utils = require('hapi').Utils;
var Task = require('./task');
var Last = require('./last');
var User = require('./user');
-var Err = require('./error');
+var Err = require('hapi').Error;
var Stream = require('./stream');
View
70 api/email.js
@@ -1,15 +1,14 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
-var Email = require('emailjs');
var Db = require('./db');
-var Utils = require('./utils');
-var Err = require('./error');
-var Log = require('./log');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
+var Log = require('hapi').Log;
var Vault = require('./vault');
var User = require('./user');
var Config = require('./config');
@@ -277,7 +276,7 @@ exports.sendReminder = function (user, callback) {
'Use this link to sign into ' + Config.product.name + ': \n\n' +
' ' + Config.host.uri('web') + '/t/' + ticket;
- exports.send(user.emails[0].address, subject, text);
+ Utils.email(user.emails[0].address, subject, text);
callback(null);
}
else {
@@ -309,7 +308,7 @@ exports.sendValidation = function (user, address, callback) {
'Use this link to verify your email address: \n\n' +
' ' + Config.host.uri('web') + '/t/' + ticket;
- exports.send(address, subject, text);
+ Utils.email(address, subject, text);
callback(null);
}
else {
@@ -352,7 +351,7 @@ exports.sendWelcome = function (user, callback) {
text += 'Use this link to verify your email address: \n\n';
text += ' ' + Config.host.uri('web') + '/t/' + ticket + '\n\n';
- exports.send(address, subject, text);
+ Utils.email(address, subject, text);
callback(null);
}
else {
@@ -370,7 +369,7 @@ exports.sendWelcome = function (user, callback) {
text += 'Use this link to sign-into ' + Config.product.name + ': \n\n';
text += ' ' + Config.host.uri('web') + '/\n\n';
- exports.send(address, subject, text);
+ Utils.email(address, subject, text);
callback(null);
}
else {
@@ -385,7 +384,7 @@ exports.sendWelcome = function (user, callback) {
text += 'Since you have not yet linked a Facebook, Twitter, or Yahoo! account, you will need to use this link to sign back into ' + Config.product.name + ': \n\n';
text += ' ' + Config.host.uri('web') + '/t/' + ticket + '\n\n';
- exports.send(address, subject, text);
+ Utils.email(address, subject, text);
callback(null);
}
else {
@@ -431,9 +430,9 @@ exports.projectInvite = function (users, pids, project, message, inviter) {
link = 'Use this link to join: \n\n' +
' ' + Config.host.uri('web') + '/view/#project=' + project._id;
- exports.send(users[i].emails[0].address,
- subject,
- 'Hi ' + (users[i].name || users[i].username || users[i].emails[0].address) + ',\n\n' + text + link);
+ Utils.email(users[i].emails[0].address,
+ subject,
+ 'Hi ' + (users[i].name || users[i].username || users[i].emails[0].address) + ',\n\n' + text + link);
}
}
@@ -450,7 +449,7 @@ exports.projectInvite = function (users, pids, project, message, inviter) {
link = 'Use this link to join: \n\n' +
' ' + Config.host.uri('web') + '/i/' + invite;
- exports.send(pid.email, subject, 'Hi ' + (pid.display || pid.email) + ',\n\n' + text + link, null, function (err) {
+ Utils.email(pid.email, subject, 'Hi ' + (pid.display || pid.email) + ',\n\n' + text + link, null, function (err) {
if (err === null) {
@@ -471,48 +470,5 @@ exports.projectInvite = function (users, pids, project, message, inviter) {
};
-// Send message
-
-exports.send = function (to, subject, text, html, callback) {
-
- var headers = {
-
- from: Config.email.fromName + ' <' + Config.email.replyTo + '>',
- to: to,
- subject: subject,
- text: text
- };
-
- var message = Email.message.create(headers);
-
- if (html) {
-
- message.attach_alternative(html);
- }
-
- var mailer = Email.server.connect(Config.email.server);
- mailer.send(message, function (err, message) {
-
- if (err === null ||
- err === undefined) {
-
- if (callback) {
-
- callback(null);
- }
- }
- else {
-
- if (callback) {
-
- callback(Err.internal('Failed sending email: ' + JSON.stringify(err)));
- }
- else {
-
- Log.err('Email error: ' + JSON.stringify(err));
- }
- }
- });
-};
View
73 api/error.js
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
-* See LICENSE file included with this code project for license terms.
-*/
-
-// Declare internals
-
-var internals = {};
-
-
-// Define error codes
-
-exports.generic = function (code, text, message, log) {
-
- return { code: code, type: 'http', text: text, message: message, log: log };
-};
-
-exports.unauthorized = function (message) {
-
- return { code: 401, type: 'http', text: 'Unauthorized', message: message };
-};
-
-exports.badRequest = function (message) {
-
- return { code: 400, type: 'http', text: 'Bad request', message: message };
-};
-
-exports.forbidden = function (message) {
-
- return { code: 403, type: 'http', text: 'Not allowed', message: message };
-};
-
-exports.notFound = function (message) {
-
- return { code: 404, type: 'http', text: 'Not Found', message: message };
-};
-
-exports.internal = function (message, log) {
-
- return { code: 500, type: 'http', text: 'Internal error', message: message, log: { input: log, stack: internals.callStack()} };
-};
-
-exports.database = function (err, collection, action, input) {
-
- return { code: 500, type: 'http', text: 'Internal error', log: { error: err, collection: collection, action: action, input: input, stack: internals.callStack()} };
-};
-
-exports.informative = function (message) {
-
- return { code: 200, type: 'http', text: 'Informative', message: message };
-};
-
-exports.oauth = function (code, description) {
-
- return { code: 400, type: 'oauth', text: description, error: code };
-};
-
-
-internals.callStack = function () {
-
- try {
-
- throw new Error('Trace');
- }
- catch (e) {
-
- return e.stack;
- }
-
- return '';
-};
-
-
View
2  api/index.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
4 api/install.js
@@ -1,8 +1,8 @@
// Load modules
-var Utils = require('./utils');
+var Utils = require('hapi').Utils;
var Db = require('./db');
-var Log = require('./log');
+var Log = require('hapi').Log;
// Initialize database connection
View
6 api/invite.js
@@ -1,13 +1,13 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
-var Err = require('./error');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
var Project = require('./project');
var User = require('./user');
var Stream = require('./stream');
View
6 api/last.js
@@ -1,13 +1,13 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Err = require('./error');
-var Utils = require('./utils');
+var Err = require('hapi').Error;
+var Utils = require('hapi').Utils;
var Project = require('./project');
var Task = require('./task');
View
79 api/log.js
@@ -1,79 +0,0 @@
-/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
-* See LICENSE file included with this code project for license terms.
-*/
-
-// Declare internals
-
-var internals = {};
-
-
-// Info
-
-exports.info = function (message, req) {
-
- internals.log('info', message, req);
-};
-
-
-// Err
-
-exports.err = function (error, req) {
-
- internals.log('err', error, req);
-};
-
-
-// Log output
-
-internals.log = function (level, message, req) {
-
- if (typeof message === 'string') {
-
- internals.print(level, message, req);
- }
- else if (req) {
-
- if (message.type === 'oauth') {
-
- internals.print(level, 'OAuth: ' + message.error + ' (' + message.text + ')', req);
- }
- else {
-
- internals.print(level, 'HTTP: ' + message.code + ' ' + (message.message || message.text), req);
- }
-
- if (message.log) {
-
- internals.print(level, 'Log: ' + JSON.stringify(message.log), req);
- }
- }
- else {
-
- internals.print(level, JSON.stringify(message));
- }
-};
-
-
-// Format output
-
-internals.print = function (level, message, req) {
-
- function pad(value) {
-
- return (value < 10 ? '0' : '') + value;
- }
-
- var now = new Date();
- var timestamp = (now.getYear() - 100).toString() +
- pad(now.getMonth() + 1) +
- pad(now.getDate()) +
- '/' +
- pad(now.getHours()) +
- pad(now.getMinutes()) +
- pad(now.getSeconds()) +
- '.' +
- now.getMilliseconds();
-
- console.log(timestamp + ', ' + level + ', ' + message + (req ? ', ' + req.method + ', ' + req.url : ''));
-};
View
5 api/package.json
@@ -5,13 +5,10 @@
"author": "Eran Hammer-Lahav <eran@hammer-lahav.net>",
"private": true,
"dependencies": {
- "connect": "1.x.x",
- "express": "2.x.x",
- "emailjs": "0.x.x",
+ "hapi": "0.0.x",
"mongodb": "0.9.x",
"oauth": "0.9.x",
"socket.io": "0.8.x",
- "validator": "0.x.x",
"mac": "0.x.x",
"opts": "1.x.x"
},
View
6 api/project.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
@@ -7,8 +7,8 @@
var Db = require('./db');
var User = require('./user');
-var Utils = require('./utils');
-var Err = require('./error');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
var Tips = require('./tips');
var Suggestions = require('./suggestions');
var Sort = require('./sort');
View
2  api/routes.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
4 api/rules.js
@@ -1,11 +1,11 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
-var Log = require('./log');
+var Log = require('hapi').Log;
// Validate and process rule
View
719 api/server.js
@@ -1,94 +1,27 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
-var Os = require('os');
-var Express = require('express');
-var MAC = require('mac');
-var Session = require('./session');
-var Utils = require('./utils');
-var Err = require('./error');
+var Hapi = require('hapi');
var Db = require('./db');
-var Log = require('./log');
var Stream = require('./stream');
-var Email = require('./email');
var Config = require('./config');
+var Session = require('./session');
// Declare internals
-var internals = {
-
- // Globals
-
- minimumTOS: '20110623'
-};
-
-
-// Send startup email
-
-Email.send(Config.email.admin, 'NOTICE: API server started', 'Started on ' + Os.hostname());
-
-
-// Listen to uncaught exceptions
-
-process.on('uncaughtException', function (err) {
-
- Log.err('Uncaught exception: ' + err.stack);
-
- Email.send(Config.email.admin, 'ERROR: Exception on API server', err.stack, '', function (err) {
-
- process.exit(1);
- });
-});
+var internals = {};
// Create and configure server instance
exports.create = function (paths, onInitialized) {
- // Create server
-
- var server = Express.createServer();
-
- // Configure Server
-
- server.configure(function () {
-
- // Pre-Routes Middleware
-
- server.use(internals.preprocessRequest);
-
- // Load Routes
-
- server.use(server.router);
-
- // Post-Routes Middleware
-
- server.use(internals.finalizeResponse);
-
- // Err handler
-
- server.use(Express.errorHandler({ dumpExceptions: true, showStack: false }));
- });
-
- // Override generic OPTIONS route
-
- server.options(/.+/, function (req, res, next) {
-
- res.api.result = ' ';
- internals.finalizeResponse(req, res, next);
- });
-
- // Load paths
-
- for (var i = 0, il = paths.length; i < il; ++i) {
-
- internals.setRoute(server, paths[i]);
- }
+ var server = Hapi.Server.create(paths, internals.convertConfig());
// Initialize database connection
@@ -103,655 +36,47 @@ exports.create = function (paths, onInitialized) {
// Start Server
- server.listen(Config.host.api.port, Config.host.api.domain);
- Log.info('API Server started at http://' + Config.host.api.domain + ':' + Config.host.api.port);
+ Hapi.Server.start(server);
Stream.initialize(server);
-
- // Change OS User
-
- if (Config.process.api.runAs) {
-
- Log.info('API Server switching users from ' + process.getuid() + ' to ' + Config.process.api.runAs);
- try {
-
- process.setuid(Config.process.api.runAs);
- Log.info('API Server active user: ' + process.getuid());
- }
- catch (err) {
-
- Log.err('Failed setting uid: ' + err);
- process.exit(1);
- }
- }
}
else {
// Database connection failed
- Log.err(err);
+ Hapi.Log.err(err);
process.exit(1);
}
});
};
-// Route pre-processor
-
-internals.preprocessRequest = function (req, res, next) {
-
- Log.info('Received', req);
-
- req.api = {};
- res.api = {};
+// Convert project configuration to Hapi format
- // Parse body
+internals.convertConfig = function () {
- var parser = null;
+ var config = {
- var contentType = req.headers['content-type'];
- if (!contentType ||
- contentType.split(';')[0] === 'application/json') {
+ name: Config.product.name + ' API Server',
+ uri: Config.host.uri('api'),
+ process: Config.process.api,
+ email: Config.email,
- parser = JSON.parse;
- }
+ // Terms of Service
- var data = '';
- req.setEncoding('utf8');
- req.addListener('data', function (chunk) {
+ tos: {
- data += chunk;
- });
-
- req.addListener('end', function () {
-
- req.rawBody = data;
- req.body = {};
+ min: '20110623'
+ },
- if (data && parser) {
+ // Authentication
- try {
-
- req.body = parser(data);
- }
- catch (err) {
-
- res.api.error = Err.badRequest('Invalid JSON body');
- }
- }
- else if (data) {
-
- res.api.error = Err.badRequest('Unsupported content-type');
- }
-
- if (res.api.error) {
-
- internals.finalizeResponse(req, res, next);
- }
- else {
+ authentication: {
- next();
+ loadSession: Session.load
}
- });
-};
-
-
-// Setup route validation
-
-internals.setRoute = function (server, config) {
-
- var routes = [];
-
- // Authentication
-
- if (config.authentication !== 'none') {
-
- routes.push(internals.authenticate(config.scope || null, config.tos || internals.minimumTOS, config.user || 'required', config.authentication === 'optional'));
- }
-
- // Query parameters
-
- if (config.query) {
-
- routes.push(internals.validateQuery(config.query));
- }
-
- // Body structure
-
- if (config.data) {
-
- routes.push(internals.validateData(config.data));
- }
-
- // Set route
-
- switch (config.method) {
-
- case 'GET': server.get(config.path, routes, config.handler); break;
- case 'POST': server.post(config.path, routes, config.handler); break;
- case 'PUT': server.put(config.path, routes, config.handler); break;
- case 'DELETE': server.del(config.path, routes, config.handler); break;
- default: process.exit(1); break;
- }
-};
-
-
-// Token Authentication
-
-internals.authenticate = function (scope, minTos, userMode, isOptional) {
-
- var getSession = function (id, cookie, callback) {
-
- Session.load(id, function (session) {
-
- callback(session);
- });
- };
-
- var options = {
-
- isHTTPS: (Config.host.api.scheme === 'https'),
- bodyHashMode: 'require'
- };
-
- return function (req, res, next) {
-
- MAC.authenticate(req, res, getSession, options, function (isAuthenticated, session, err) {
-
- if (isAuthenticated) {
-
- if (session) {
-
- req.api.session = session;
-
- if (session.client) {
-
- req.api.clientId = session.client;
-
- // Check scope
-
- if (scope === null ||
- session.scope[scope]) {
-
- req.api.scope = session.scope;
-
- if (userMode === 'required') {
-
- if (session.user) {
-
- // Check TOS
-
- if (minTos === 'none' ||
- (session.tos && session.tos >= minTos)) {
-
- req.api.userId = session.user;
- next();
- }
- else {
-
- res.api.error = Err.forbidden('Insufficient TOS accepted');
- internals.finalizeResponse(req, res, next);
- }
- }
- else {
-
- res.api.error = Err.forbidden('Client token cannot be used on a user endpoint');
- internals.finalizeResponse(req, res, next);
- }
- }
- else if (userMode === 'none') {
-
- if (session.user) {
-
- res.api.error = Err.forbidden('User token cannot be used on a client endpoint');
- internals.finalizeResponse(req, res, next);
- }
- else {
-
- next();
- }
- }
- else if (userMode === 'any') {
-
- next();
- }
- else {
-
- res.api.error = Err.internal('Unknown endpoint user mode');
- internals.finalizeResponse(req, res, next);
- }
- }
- else {
-
- res.api.error = Err.forbidden('Insufficient token scope (\'' + scope + '\' expected for client ' + session.client + ')');
- internals.finalizeResponse(req, res, next);
- }
- }
- else {
-
- res.api.error = Err.internal('Missing client identifier in authenticated token');
- internals.finalizeResponse(req, res, next);
- }
- }
- else {
-
- res.api.error = Err.internal('Missing user object in authenticated token');
- internals.finalizeResponse(req, res, next);
- }
- }
- else {
-
- // Unauthenticated
-
- if (isOptional &&
- !req.headers.authorization) {
-
- next();
- }
- else {
-
- res.api.error = Err.generic(401, 'Invalid authentication', err);
- res.header('WWW-Authenticate', MAC.getWWWAuthenticateHeader(err));
- internals.finalizeResponse(req, res, next);
- }
- }
- });
};
-};
-
-
-// Validate query
-
-internals.validateQuery = function (definition) {
-
- var parameters = {};
- for (var i in definition) {
- if (definition.hasOwnProperty(i)) {
-
- parameters[definition[i]] = true;
- }
- }
-
- return function (req, res, next) {
-
- var isInvalid = false;
- for (var i in req.query) {
-
- if (req.query.hasOwnProperty(i)) {
-
- if (parameters[i] !== true) {
-
- isInvalid = true;
- break;
- }
- }
- }
-
- if (isInvalid) {
-
- res.api.error = Err.badRequest('Unknown parameter: ' + i);
- internals.finalizeResponse(req, res, next);
- }
- else {
-
- next();
- }
- };
+ return config;
};
-// Validate data
-
-internals.validateData = function (definition) {
-
- return function (req, res, next) {
-
- var isInvalid = false;
- var err = '';
-
- // Check required variables
-
- for (var i in definition) {
-
- if (definition.hasOwnProperty(i)) {
-
- if (definition[i].required === true) {
-
- if (req.body[i] === undefined) {
-
- err = 'missing required parameter';
- isInvalid = true;
- break;
- }
- }
- }
- }
-
- if (isInvalid === false) {
-
- // Check each incoming variable
-
- for (var i in req.body) {
-
- if (req.body.hasOwnProperty(i)) {
-
- // Lookup variable definition
-
- if (definition[i] === undefined) {
-
- err = 'unknown parameter';
- isInvalid = true;
- break;
- }
-
- // Check if update allowed
-
- if (definition[i].set === false) {
-
- err = 'forbidden parameter';
- isInvalid = true;
- break;
- }
-
- // Check for array type
-
- if (definition[i].array === true) {
-
- // If variable is an array
-
- if (req.body[i] instanceof Array) {
-
- // Check for empty array
-
- if (req.body[i].length === 0 &&
- definition[i].empty !== true) {
-
- err = 'empty array not allowed';
- isInvalid = true;
- break;
- }
-
- // For each array element, check type
-
- for (var a = 0, al = req.body[i].length; a < al; ++a) {
-
- var message = internals.checkValue(req.body[i][a], definition[i], false);
- if (message) {
-
- err = 'invalid array value - ' + message;
- isInvalid = true;
- break;
- }
- }
-
- // Double break
-
- if (isInvalid === true) {
-
- break;
- }
- }
- else {
-
- err = 'array value required';
- isInvalid = true;
- break;
- }
- }
- else {
-
- if (definition[i].type !== 'any') {
-
- var result = internals.checkValue(req.body[i], definition[i], definition[i].empty);
- if (result) {
-
- err = result;
- isInvalid = true;
- break;
- }
- }
- }
- }
- }
- }
-
- if (isInvalid) {
-
- res.api.error = Err.badRequest('\'' + i + '\': ' + err);
- internals.finalizeResponse(req, res, next);
- }
- else {
-
- next();
- }
- };
-};
-
-
-internals.checkValue = function (value, definition, isEmptyAllowed) {
-
- // Check for empty value
-
- if (value === null ||
- (typeof value === 'number' && isNaN(value)) ||
- (typeof value === 'string' && value === '')) {
-
- if (isEmptyAllowed !== true) {
-
- return 'empty value not allowed';
- }
- else {
-
- return '';
- }
- }
-
- // Check types
-
- var isValid = false;
-
- switch (definition.type) {
-
- case 'string': isValid = (typeof value === 'string'); break;
- case 'id': isValid = (typeof value === 'string'); break;
- case 'number': isValid = (typeof value === 'number'); break;
- case 'enum': isValid = (typeof value === 'string' && definition.values && definition.values[value] > 0); break;
- case 'object': isValid = (typeof value === 'object'); break;
- case 'email': isValid = Utils.checkEmail(value); break;
- case 'date':
-
- if (typeof value !== 'string') {
-
- return 'value must be a string';
- }
-
- var dateRegex = /^([12]\d\d\d)-([01]\d)-([0123]\d)$/;
- var date = dateRegex.exec(value);
-
- if (date === null || date.length !== 4) {
-
- return 'invalid date string format';
- }
-
- var year = parseInt(date[1], 10);
- var month = parseInt(date[2], 10);
- var day = parseInt(date[3], 10);
-
- if (year < 1970 || year > 3000) {
-
- return 'invalid year: ' + date[1];
- }
-
- if (month < 1 || month > 12) {
-
- return 'invalid month: ' + date[2];
- }
-
- if (day < 1 || day > 31) {
-
- return 'invalid day: ' + date[3];
- }
-
- isValid = true;
- break;
-
- case 'time':
-
- if (typeof value !== 'string') {
-
- return 'value must be a string';
- }
-
- var timeRegex = /^([012]\d):([012345]\d):([012345]\d)$/;
- var time = timeRegex.exec(value);
-
- if (time === null || time.length !== 4) {
-
- return 'invalid time string format';
- }
-
- var hour = parseInt(time[1], 10);
- var minute = parseInt(time[2], 10);
- var second = parseInt(time[3], 10);
-
- if (hour < 0 || hour > 23) {
-
- return 'invalid hour';
- }
-
- if (minute < 0 || minute > 59) {
-
- return 'invalid minute';
- }
-
- if (second < 0 || second > 59) {
-
- return 'invalid second';
- }
-
- isValid = true;
- break;
- }
-
- return (isValid ? '' : 'bad value type, ' + definition.type + ' expected');
-};
-
-
-// Set default response headers and send response
-
-internals.finalizeResponse = function (req, res, next) {
-
- if (res.api.isReplied !== true) {
-
- res.header('Access-Control-Allow-Origin', '*');
- res.header('Access-Control-Allow-Methods', 'GET, HEAD, POST, PUT, DELETE, OPTIONS');
- res.header('Access-Control-Allow-Headers', 'Authorization, Content-Type, If-None-Match');
- res.header('Access-Control-Max-Age', '86400'); // One day
-
- res.header('Cache-Control', 'must-revalidate');
-
- if (res.api.result) {
-
- // Sanitize database fields
-
- var rev = null; // res.api.result.modified;
-
- if (res.api.result._id) {
-
- res.api.result.id = res.api.result._id;
- delete res.api.result._id;
- }
-
- if (res.api.result instanceof Object) {
-
- for (var i in res.api.result) {
-
- if (res.api.result.hasOwnProperty(i)) {
-
- if (i[0] === '_') {
-
- delete res.api.result[i];
- }
- }
- }
- }
-
- if (req.method === 'GET' && rev) {
-
- res.header('ETag', rev);
-
- var condition = internals.parseCondition(req.headers['if-none-match']);
-
- if (condition[rev] ||
- condition['*']) {
-
- res.send('', 304);
- }
- else {
-
- res.send(res.api.result);
- }
- }
- else if (res.api.created) {
-
- res.send(res.api.result, { 'Location': Config.host.uri('api') + res.api.created }, 201);
- }
- else {
-
- res.send(res.api.result);
- }
-
- Log.info('Replied', req);
- }
- else {
-
- var error = res.api.error || Err.notFound('No such path or method');
-
- if (error.type === 'oauth') {
-
- res.send({ error: error.error, error_description: error.text }, error.code);
- }
- else {
-
- res.send({ error: error.text, message: error.message, code: error.code }, error.code);
- }
-
- if (res.api.error) {
-
- Log.err(res.api.error, req);
- }
- else {
-
- Log.info(error, req);
- }
- }
-
- res.api.isReplied = true;
- }
-};
-
-
-// Parse If-None-Match request header
-
-internals.parseCondition = function (condition) {
-
- if (condition) {
-
- result = {};
-
- var conditionRegex = (condition.indexOf('"') !== -1 ? /(?:^|,)(?:\s*")([^"]+)(?:"\s*)/g : /(?:^|,)(?:\s*)([^\s]+)(?:\s*)/g);
- condition.replace(conditionRegex, function ($0) {
-
- if ($0) {
-
- result[$0] = true;
- }
- });
-
- return result;
- }
- else {
-
- return {};
- }
-};
View
8 api/session.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
@@ -7,9 +7,9 @@
var Crypto = require('crypto');
var Db = require('./db');
-var Utils = require('./utils');
-var Err = require('./error');
-var Log = require('./log');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
+var Log = require('hapi').Log;
var User = require('./user');
var Email = require('./email');
var Vault = require('./vault');
View
6 api/sort.js
@@ -1,13 +1,13 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
-var Err = require('./error');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
// Get ordered items list
View
6 api/storage.js
@@ -1,13 +1,13 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
-var Err = require('./error');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
// Declare internals
View
8 api/stream.js
@@ -1,16 +1,16 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var SocketIO = require('socket.io');
-var Utils = require('./utils');
+var Utils = require('hapi').Utils;
var Project = require('./project');
var Session = require('./session');
-var Log = require('./log');
-var Err = require('./error');
+var Log = require('hapi').Log;
+var Err = require('hapi').Error;
// Declare internals
View
8 api/suggestions.js
@@ -1,14 +1,14 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
-var Err = require('./error');
-var Log = require('./log');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
+var Log = require('hapi').Log;
var Rules = require('./rules');
var Project = require('./project');
View
6 api/task.js
@@ -1,15 +1,15 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
+var Utils = require('hapi').Utils;
var Project = require('./project');
var Sort = require('./sort');
-var Err = require('./error');
+var Err = require('hapi').Error;
var Suggestions = require('./suggestions');
var Details = require('./details');
var Stream = require('./stream');
View
6 api/tips.js
@@ -1,13 +1,13 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
-var Log = require('./log');
+var Utils = require('hapi').Utils;
+var Log = require('hapi').Log;
var Rules = require('./rules');
// Declare internals
View
6 api/user.js
@@ -1,13 +1,13 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
// Load modules
var Db = require('./db');
-var Utils = require('./utils');
-var Err = require('./error');
+var Utils = require('hapi').Utils;
+var Err = require('hapi').Error;
var Email = require('./email');
var Invite = require('./invite');
var Last = require('./last');
View
189 api/utils.js
@@ -1,189 +0,0 @@
-/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
-* See LICENSE file included with this code project for license terms.
-*/
-
-// Load modules
-
-var Validator = require('validator');
-var Crypto = require('crypto');
-var Base64 = require('./base64');
-var Log = require('./log');
-
-
-// Get current date/time msec count
-
-exports.getTimestamp = function () {
-
- return (new Date()).getTime();
-};
-
-
-// Clone object or array
-
-exports.clone = function (obj) {
-
- if (obj === null ||
- obj === undefined) {
-
- return null;
- }
-
- var newObj = (obj instanceof Array) ? [] : {};
-
- for (var i in obj) {
-
- if (obj.hasOwnProperty(i)) {
-
- if (obj[i] && typeof obj[i] === 'object') {
-
- newObj[i] = exports.clone(obj[i]);
- }
- else {
-
- newObj[i] = obj[i];
- }
- }
- }
-
- return newObj;
-};
-
-
-// Remove duplicate items from array
-
-exports.unique = function (array, key) {
-
- var index = {};
- var result = [];
-
- for (var i = 0, il = array.length; i < il; ++i) {
-
- if (index[array[i][key]] !== true) {
-
- result.push(array[i]);
- index[array[i][key]] = true;
- }
- }
-
- return result;
-};
-
-
-// Convert array into object
-
-exports.map = function (array, key) {
-
- var obj = {};
- for (var i = 0, il = array.length; i < il; ++i) {
-
- if (key) {
-
- if (array[i][key]) {
-
- obj[array[i][key]] = true;
- }
- }
- else {
-
- obj[array[i]] = true;
- }
- }
-
- return obj;
-};
-
-
-// Check if a valid email address
-
-exports.checkEmail = function (email) {
-
- try {
-
- Validator.check(email).len(6, 64).isEmail();
- }
- catch (e) {
-
- return false;
- }
-
- return true;
-};
-
-
-// Remove hidden keys
-
-exports.hide = function (object, definition) {
-
- for (var i in definition) {
-
- if (definition.hasOwnProperty(i)) {
-
- if (definition[i].hide &&
- definition[i].hide === true) {
-
- delete object[i];
- }
- }
- }
-};
-
-
-// Random string
-
-exports.getRandomString = function (size) {
-
- var randomSource = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
- var len = randomSource.length;
-
- var result = [];
-
- for (var i = 0; i < size; ++i) {
-
- result[i] = randomSource[Math.floor(Math.random() * len)];
- }
-
- return result.join('');
-};
-
-
-// AES256 Symmetric encryption
-
-exports.encrypt = function (key, value) {
-
- var envelope = JSON.stringify({ v: value, a: exports.getRandomString(2) });
-
- var cipher = Crypto.createCipher('aes256', key);
- var enc = cipher.update(envelope, input_encoding = 'utf8', output_encoding = 'binary');
- enc += cipher.final(output_encoding = 'binary');
-
- var result = Base64.encode(enc).replace(/\+/g, '-').replace(/\//g, ':').replace(/\=/g, '');
- return result;
-};
-
-
-exports.decrypt = function (key, value) {
-
- var input = Base64.decode(value.replace(/-/g, '+').replace(/:/g, '/'));
-
- var decipher = Crypto.createDecipher('aes256', key);
- var dec = decipher.update(input, input_encoding = 'binary', output_encoding = 'utf8');
- dec += decipher.final(output_encoding = 'utf8');
-
- var envelope = null;
-
- try {
-
- envelope = JSON.parse(dec);
- }
- catch (e) {
-
- Log.err('Invalid encrypted envelope: ' + dec + ' / Exception: ' + JSON.stringify(e));
- }
-
- return envelope ? envelope.v : null;
-};
-
-
-
-
View
4 api/vault.js.example
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
@@ -33,4 +33,4 @@ exports.database = {
username: '',
password: ''
-};
+};
View
2  clients/view/js/authentication.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/calendar.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/contacts.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/dnd.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/global.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/history.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/load.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/menu.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/network.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/overlay-extras.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/project.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/projectslist.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/settings.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/stream.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/suggestions.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/tasklist.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/templates.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/tips.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/tooltips.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/tour.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/uiutils.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  clients/view/js/user.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  web/account.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  web/api.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
4 web/base64.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
@@ -142,4 +142,4 @@ exports.decode = function (string) {
}
return result;
-};
+};
View
2  web/client.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  web/email.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  web/error.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  web/home.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.
+* Copyright (c) 2011 Eran Hammer-Lahav. All rights reserved. Copyrights licensed under the New BSD License.
* See LICENSE file included with this code project for license terms.
*/
View
2  web/index.js
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License.