Skip to content

Commit

Permalink
Fix download-location not loading
Browse files Browse the repository at this point in the history
Disallow ".." in the location to avoid going outside the music directory
Update readme
  • Loading branch information
jplsek committed Jul 19, 2017
1 parent d924c92 commit 5e1ed5c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Showing the Materialish theme, library view, and playlist editor
* Download Player
* Download videos, such as from YouTube, straight to the music library
* Update music database
* Basic album art detection (setting "library" in config.cfg)
* Basic mobile support
* Basic theming support
* Library searching
Expand Down
11 changes: 10 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,22 @@ function getHostname(ip, callback) {
}

var downloader = {
// some of these settings get set in config.json
// some of these settings get set in config.cfg
enabled: true,
directory: 'Downloads',
keepVideo: false,

// TODO check if file already exists
download: function (url, location, address, socket) {
if (location.includes('..')) {
console.log(address + " tried to access " + location + "!");
socket.send(JSON.stringify({
'type': 'downloader-status',
'info': 'You cannot have ".." in the location!'
}));
return;
}

location = downloader.getLocation(location);

socket.send(JSON.stringify({
Expand Down
2 changes: 1 addition & 1 deletion src/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ socket.onmessage = function (event) {
case 'init':
mpcp.playlist.updateTitle(msg['playlist-title']);
mpcp.vote.enabled = msg['song-vote'];
if (msg['downloader-enabled'] == 'true')
if (msg['downloader-enabled'])
mpcp.downloader.init(msg['downloader-location']);
mpcp.utils.setCurrentAlbumArt(msg['album-art']);
initAfterConnection();
Expand Down

0 comments on commit 5e1ed5c

Please sign in to comment.