Skip to content

Instantly share code, notes, and snippets.

@mess110
Created April 23, 2012 16:22
Show Gist options
  • Save mess110/2472049 to your computer and use it in GitHub Desktop.
Save mess110/2472049 to your computer and use it in GitHub Desktop.
diff --git a/README.md b/README.md
index d578a89..ea76518 100644
--- a/README.md
+++ b/README.md
@@ -41,9 +41,7 @@ It is written using [node.js][1], more precisely [Express][5] as a web framework
my_config.app = {
google_client_id: "GOOGLE_CLIENT_ID_TOKEN",
google_client_secret: "GOOGLE_CLIENT_SECRET_TOKEN"
- }
- my_config.calendar = {
- web_link: 'https://www.google.com/calendar/render?cid=<GOOGLE_CALENDAR_ID>'
+ calendar: 'https://www.google.com/calendar/render?cid=<GOOGLE_CALENDAR_ID>'
}
module.exports = my_config
diff --git a/config.js b/config.js
index fe94717..fadda49 100644
--- a/config.js
+++ b/config.js
@@ -17,15 +17,9 @@ config.app = {
sio: {
log_level: 1,
transports: ['websocket', 'xhr-polling']
- }
-}
-
-config.calendar = {
- web_link: 'https://www.google.com/calendar/render?cid=<GOOGLE_CALENDAR_ID>'
-}
-
-config.defaultTitle = {
- text: 'UbunTalk - chat for humans (and dancers)',
+ },
+ calendar: 'https://www.google.com/calendar/render?cid=<GOOGLE_CALENDAR_ID>',
+ defaultTitle: 'UbunTalk - chat for humans (and dancers)'
}
try {
diff --git a/public/js/script.js b/public/js/script.js
index 82cf36a..8ce44c0 100644
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -138,13 +138,13 @@ $(document).ready(function() {
socket.on('loadTitle', function(title) {
roomTitle = title;
- var result = handleLinksAndEscape(title.text);
+ var result = handleLinksAndEscape(title);
$('#roomTitle').html(result.html);
});
socket.on('updateTitle', function(title) {
roomTitle = title;
- var result = handleLinksAndEscape(title.text);
+ var result = handleLinksAndEscape(title);
$('#roomTitle').html(result.html);
displayNotification(title.user + ' changed chat title', false, true);
});
diff --git a/realtime.js b/realtime.js
index 23fe184..d882c06 100644
--- a/realtime.js
+++ b/realtime.js
@@ -5,7 +5,7 @@ var io = require('socket.io'),
parseCookie = require('connect').utils.parseCookie;
var online = {};
-var title = config.defaultTitle;
+var title = config.app.defaultTitle;
var PING_INTERVAL = 5 * 60 * 1000; // 5 min
var MAX_LATENCY = 10 * 1000; // 10 sec
@@ -81,7 +81,7 @@ function init(app, sessionStore) {
console.warn('Error getting title: ' + err, err.stack);
} else {
if (titles.length == 0) {
- title = config.defaultTitle;
+ title = config.app.defaultTitle;
} else {
title = titles[0];
}
diff --git a/requestHandlers.js b/requestHandlers.js
index 0013747..31605e1 100644
--- a/requestHandlers.js
+++ b/requestHandlers.js
@@ -29,7 +29,7 @@ function login(req, res) {
function index(req, res) {
isUserAllowed(req, res, function() {
res.render('index', {
- calendar_web_link: config.calendar.web_link
+ calendar_web_link: config.app.calendar
});
});
}
@@ -84,7 +84,7 @@ function getHistory(req, res) {
function beta(req, res) {
isUserAllowed(req, res, function() {
res.render('beta', {
- calendar_web_link: config.calendar.web_link
+ calendar_web_link: config.app.calendar
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment