Skip to content

Commit

Permalink
Merge branch 'dev' at v1.6.1-alpha.
Browse files Browse the repository at this point in the history
Fixes:
  Username always being 'undefined' with LDAP auth.
  User's names being double escaped.

Changes:
  Moved fonts, styles, scripts, and images dirs to static dir.
  Serve compiled less from less/, not styles/.
  • Loading branch information
dag10 committed Mar 9, 2015
2 parents 8608299 + 554e7b3 commit dd11fe2
Show file tree
Hide file tree
Showing 48 changed files with 33 additions and 16 deletions.
6 changes: 6 additions & 0 deletions config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ module.exports = {
// Secret strong used for authentication. Make this unique.
secret: 'change me!',

// Compress css generated from less.
compress_css: true,

// Use minified js where possible.
compress_js: true,

// Max upload file size (in mb).
max_file_size: 50
},
Expand Down
9 changes: 5 additions & 4 deletions logic/auth/ldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ function auth(username, password) {
attrs[attr.type] = attr.vals[0];
});

var user = {};
var user = {
username: username,
};

Object.keys(config.auth.ldap.attributes).forEach(function(userAttr) {
user[userAttr] = attrs[config.auth.ldap.attributes[userAttr]];
Expand Down Expand Up @@ -305,10 +307,9 @@ function handleLoginPostRequest(render, req, res) {
};

if (config.auth.ldap.strictFullName) {
cleanuser.fullName = sanitizer.escape(
user.firstName + ' ' + user.lastName);
cleanuser.fullName = user.firstName + ' ' + user.lastName;
} else {
cleanuser.fullName = sanitizer.escape(user.fullName);
cleanuser.fullName = user.fullName;
}

req.session.user = cleanuser;
Expand Down
14 changes: 7 additions & 7 deletions logic/web/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ exports.init = function(app) {
app.use(lessMiddleware({
src: base_dir + '/less',
dest: tmpDir,
prefix: '/styles',
compress: !config.web.debug,
prefix: '/less',
compress: config.web.compress_css,
force: config.web.debug
}));

app.use('/styles', express.static(base_dir + '/styles'));
app.use('/images', express.static(base_dir + '/images'));
app.use('/scripts', express.static(base_dir + '/scripts'));
app.use('/fonts', express.static(base_dir + '/fonts'));
app.use('/styles', express.static(tmpDir));
app.use('/styles', express.static(base_dir + '/static/styles'));
app.use('/images', express.static(base_dir + '/static/images'));
app.use('/scripts', express.static(base_dir + '/static/scripts'));
app.use('/fonts', express.static(base_dir + '/static/fonts'));
app.use('/less', express.static(tmpDir));
app.use('/artwork', express.static(upload.artwork_dir));
app.use('/songs', express.static(upload.song_dir));

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "DJ",
"description": "A virtual DJ website, where you can play and listen to music together. Inspired by turntable.fm.",
"version": "1.6.0-alpha",
"version": "1.6.1-alpha",
"author": "Drew Gottlieb (dag10) <[email protected]>",
"repository": {
"type": "git",
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions utils/load_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var default_values = {
debug: true,
title: 'CSH DJ',
secret: 'change me!',
compress_css: true,
compress_js: true,
max_file_size: 50,
},
auth: {
Expand Down
12 changes: 10 additions & 2 deletions views/layouts/page.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1" />
<link
href='http://fonts.googleapis.com/css?family=Lato:300,400,700'
href='https://fonts.googleapis.com/css?family=Lato:300,400,700'
rel='stylesheet'
type='text/css'>
<% if (config.web.compress_css) { %>
<link rel="stylesheet" href="/styles/bootstrap.min.css" />
<% } else { %>
<link rel="stylesheet" href="/styles/bootstrap.css" />
<% } %>
<%- stylesheets %>
<link rel="stylesheet" href="/styles/style.css" />
<link rel="stylesheet" href="/less/style.css" />
<link rel="shortcut icon" href="/images/csh_dj_favicon.png" />
</head>
<body>
Expand Down Expand Up @@ -92,7 +96,11 @@
</div>
</footer>
<script src="/scripts/jquery-1.10.2.js"></script>
<% if (config.web.compress_js) { %>
<script src="/scripts/bootstrap.min.js"></script>
<% } else { %>
<script src="/scripts/bootstrap.js"></script>
<% } %>
<script>
window.config = {
max_file_size: <%= config.web.max_file_size*1024*1024 %>
Expand Down
2 changes: 1 addition & 1 deletion views/login.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% layout('layouts/page') -%>
<% block('title', 'Log In') -%>
<% stylesheet('/styles/login.css') %>
<% stylesheet('/less/login.css') %>
<% script('/scripts/login.js') %>

<%
Expand Down
2 changes: 1 addition & 1 deletion views/room.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%
layout('layouts/page');
block('title', room.name);
stylesheet('/styles/room.custom.css');
stylesheet('/less/room.custom.css');
script('/socket.io/socket.io.js');
script('/scripts/underscore-min.js');
script('/scripts/backbone-min.js');
Expand Down

0 comments on commit dd11fe2

Please sign in to comment.