From 306840fa1d7cad434bbd08af15abaae64679a162 Mon Sep 17 00:00:00 2001 From: Govert Buijs Date: Wed, 8 Jun 2016 23:20:27 +0200 Subject: [PATCH 01/12] Added crude filtering for browsing db --- htdocs/index.html | 2 +- htdocs/js/mpd.js | 79 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 77 insertions(+), 4 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index ed77279..92fa2a3 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -99,7 +99,7 @@ -
+
diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 6000b79..0e3c09a 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -29,6 +29,7 @@ var dirble_selected_cat = ""; var dirble_catid = ""; var dirble_page = 1; var isTouch = Modernizr.touch ? 1 : 0; +var filter = undefined; var app = $.sammy(function() { @@ -36,6 +37,7 @@ var app = $.sammy(function() { current_app = 'queue'; $('#breadcrump').addClass('hide'); + $('#filter').addClass('hide'); $('#salamisandwich').removeClass('hide').find("tr:gt(0)").remove(); $('#dirble_panel').addClass('hide'); socket.send('MPD_API_GET_QUEUE,'+pagination); @@ -63,7 +65,8 @@ var app = $.sammy(function() { browsepath = this.params['splat'][1]; pagination = parseInt(this.params['splat'][0]); current_app = 'browse'; - $('#breadcrump').removeClass('hide').empty().append("
  • root
  • "); + $('#breadcrump').removeClass('hide').empty().append("
  • root
  • "); + $('#filter').removeClass('hide'); $('#salamisandwich').removeClass('hide').find("tr:gt(0)").remove(); $('#dirble_panel').addClass('hide'); socket.send('MPD_API_GET_BROWSE,'+pagination+','+(browsepath ? browsepath : "/")); @@ -178,6 +181,8 @@ $(document).ready(function(){ else if ($.cookie("notification") === "true") $('#btnnotify').addClass("active") + + add_filter(); }); @@ -270,16 +275,31 @@ function webSocketConnect() { for (var item in obj.data) { switch(obj.data[item].type) { case "directory": + var clazz = 'dir'; + if (filter !== undefined) { + var first = obj.data[item].dir[0]; + if (filter === "#" && isNaN(first)) { + clazz += ' hide'; + } else if (filter >= "A" && filter <= "Z" && first.toUpperCase() !== filter) { + clazz += ' hide'; + } else if (filter === "||") { + clazz += ' hide'; + } + } $('#salamisandwich > tbody').append( - "" + + "" + "" + "" + basename(obj.data[item].dir) + "" + "" ); break; case "playlist": + var clazz = 'plist'; + if (filter !== "||") { + clazz += ' hide'; + } $('#salamisandwich > tbody').append( - "" + + "" + "" + "" + basename(obj.data[item].plist) + "" + "" @@ -934,3 +954,56 @@ function dirble_load_stations() { }); }); } + +function set_filter (c) { + filter = c; + + $.each($('#salamisandwich > tbody > tr.dir'), function(i, line) { + var first = $(line).attr('uri')[0]; + + if (filter === undefined) { + $(line).removeClass('hide'); + } + + else if (filter === "#") { + if (!isNaN(first)) { + $(line).removeClass('hide'); + } else { + $(line).addClass('hide'); + } + } + + else if (filter >= "A" && filter <= "Z") { + if (first.toUpperCase() === filter) { + $(line).removeClass('hide'); + } else { + $(line).addClass('hide'); + } + } + + else if (filter === "||") { + $(line).addClass('hide'); + } + }); + + $.each($('#salamisandwich > tbody > tr.plist'), function(i, line) { + if (filter === undefined) { + $(line).removeClass('hide'); + } else if (filter === "||") { + $(line).removeClass('hide'); + } else { + $(line).addClass('hide'); + } + }); +} + +function add_filter () { + $('#filter').append(' #'); + + for (i = 65; i <= 90; i++) { + var c = String.fromCharCode(i); + $('#filter').append(' ' + c + ''); + } + + $('#filter').append(' '); +} From d9ec70a9da5d496a8062782ae7f0dc5d11836e39 Mon Sep 17 00:00:00 2001 From: Les De Ridder Date: Sun, 11 Sep 2016 17:54:25 +0200 Subject: [PATCH 02/12] Make the Dirble API token configurable and use HTTPS Fixes #140 --- README.md | 13 +++++++------ contrib/init.debian | 3 ++- contrib/ympd.default | 1 + contrib/ympd.service | 3 ++- htdocs/js/mpd.js | 45 +++++++++++++++++++++++++++++++++++--------- src/mpd_client.c | 7 ++++++- src/mpd_client.h | 3 +++ src/ympd.c | 7 +++++++ 8 files changed, 64 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 08ef76d..da55299 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,13 @@ Run flags ``` Usage: ./ympd [OPTION]... - -h, --host connect to mpd at host [localhost] - -p, --port connect to mpd at port [6600] - -w, --webport [ip:] listen interface/port for webserver [8080] - -u, --user drop priviliges to user after socket bind - -V, --version get version - --help this help + -h, --host connect to mpd at host [localhost] + -p, --port connect to mpd at port [6600] + -w, --webport [ip:] listen interface/port for webserver [8080] + -d, --dirbletoken Dirble API token + -u, --user drop priviliges to user after socket bind + -V, --version get version + --help this help ``` SSL Support diff --git a/contrib/init.debian b/contrib/init.debian index 5c10bdf..31c00d3 100755 --- a/contrib/init.debian +++ b/contrib/init.debian @@ -24,6 +24,7 @@ YMPD_USER=nobody MPD_HOST=localhost MPD_PORT=6600 WEB_PORT=8080 +DIRBLE_API_TOKEN=2e223c9909593b94fc6577361a # Exit if the package is not installed @@ -35,7 +36,7 @@ WEB_PORT=8080 # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS -DAEMON_OPT="--user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" +DAEMON_OPT="--user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT --dirbletoken $DIRBLE_API_TOKEN" do_start() { diff --git a/contrib/ympd.default b/contrib/ympd.default index c7bbcda..c74b860 100644 --- a/contrib/ympd.default +++ b/contrib/ympd.default @@ -2,3 +2,4 @@ MPD_HOST=localhost MPD_PORT=6600 WEB_PORT=8080 YMPD_USER=nobody +DIRBLE_API_TOKEN=2e223c9909593b94fc6577361a diff --git a/contrib/ympd.service b/contrib/ympd.service index 2289550..7516818 100644 --- a/contrib/ympd.service +++ b/contrib/ympd.service @@ -7,8 +7,9 @@ Environment=MPD_HOST=localhost Environment=MPD_PORT=6600 Environment=WEB_PORT=8080 Environment=YMPD_USER=nobody +Environment=DIRBLE_API_TOKEN=2e223c9909593b94fc6577361a EnvironmentFile=/etc/default/ympd -ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT +ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT --dirbletoken $DIRBLE_API_TOKEN Type=simple [Install] diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 6000b79..6e57d26 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -1,6 +1,6 @@ /* ympd (c) 2013-2014 Andrew Karpow - This project's homepage is: http://www.ympd.org + This project's homepage is: https://www.ympd.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,8 @@ var dirble_selected_cat = ""; var dirble_catid = ""; var dirble_page = 1; var isTouch = Modernizr.touch ? 1 : 0; +var dirble_api_token = ""; +var dirble_stations = false; var app = $.sammy(function() { @@ -127,7 +129,13 @@ var app = $.sammy(function() { dirble_catid = this.params['splat'][0]; dirble_page = this.params['splat'][1]; - dirble_load_stations(); + dirble_stations = true; + + if(dirble_api_token) { + dirble_load_stations(); + } else { + getDirbleApiToken(); + } }); @@ -144,7 +152,13 @@ var app = $.sammy(function() { $('#panel-heading').text("Dirble"); $('#dirble').addClass('active'); - dirble_load_categories(); + dirble_stations = false; + + if(dirble_api_token) { + dirble_load_categories(); + } else { + getDirbleApiToken(); + } }); this.get("/", function(context) { @@ -493,6 +507,15 @@ function webSocketConnect() { if(obj.data.passwort_set) $('#mpd_password_set').removeClass('hide'); break; + case "dirbleapitoken": + dirble_api_token = obj.data; + + if(dirble_stations) { + dirble_load_stations(); + } else { + dirble_load_categories(); + } + break; case "error": $('.top-right').notify({ message:{text: obj.data}, @@ -652,6 +675,10 @@ function getHost() { $('#mpd_pw_con').keypress(onEnter); } +function getDirbleApiToken() { + socket.send('MPD_API_GET_DIRBLEAPITOKEN'); +} + $('#search').submit(function () { app.setLocation("#/search/"+$('#search > div > input').val()); $('#wait').modal('show'); @@ -784,7 +811,7 @@ function dirble_load_categories() { dirble_page = 1; - $.getJSON( "http://api.dirble.com/v2/categories?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "https://api.dirble.com/v2/categories?token=" + dirble_api_token, function( data ) { $('#dirble_loading').addClass('hide'); @@ -832,7 +859,7 @@ function dirble_load_categories() { function dirble_load_stations() { - $.getJSON( "http://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "https://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token=" + dirble_api_token, function( data ) { $('#dirble_loading').addClass('hide'); if (data.length == 20) $('#next').removeClass('hide'); @@ -859,7 +886,7 @@ function dirble_load_stations() { click: function() { var _this = $(this); - $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "https://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=" + dirble_api_token, function( data ) { socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); $('.top-right').notify({ @@ -877,7 +904,7 @@ function dirble_load_stations() { "").find('a').click(function(e) { e.stopPropagation(); - $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "https://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=" + dirble_api_token, function( data ) { socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); $('.top-right').notify({ @@ -898,7 +925,7 @@ function dirble_load_stations() { click: function() { var _this = $(this); - $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "https://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=" + dirble_api_token, function( data ) { socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); $('.top-right').notify({ @@ -916,7 +943,7 @@ function dirble_load_stations() { "").find('a').click(function(e) { e.stopPropagation(); - $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "https://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=" + dirble_api_token, function( data ) { socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); $('.top-right').notify({ diff --git a/src/mpd_client.c b/src/mpd_client.c index 7271984..6894fd5 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -63,7 +63,8 @@ int callback_mpd(struct mg_connection *c) return MG_TRUE; if(mpd.conn_state != MPD_CONNECTED && cmd_id != MPD_API_SET_MPDHOST && - cmd_id != MPD_API_GET_MPDHOST && cmd_id != MPD_API_SET_MPDPASS) + cmd_id != MPD_API_GET_MPDHOST && cmd_id != MPD_API_SET_MPDPASS && + cmd_id != MPD_API_GET_DIRBLEAPITOKEN) return MG_TRUE; switch(cmd_id) @@ -256,6 +257,10 @@ out_host_change: "{\"host\" : \"%s\", \"port\": \"%d\", \"passwort_set\": %s}" "}", mpd.host, mpd.port, mpd.password ? "true" : "false"); break; + case MPD_API_GET_DIRBLEAPITOKEN: + n = snprintf(mpd.buf, MAX_SIZE, "{\"type\":\"dirbleapitoken\", \"" + "data\": \"%s\"}", dirble_api_token); + break; case MPD_API_SET_MPDPASS: p_charbuf = strdup(c->content); if(strcmp(strtok(p_charbuf, ","), "MPD_API_SET_MPDPASS")) diff --git a/src/mpd_client.h b/src/mpd_client.h index dd78af9..0e11c5a 100644 --- a/src/mpd_client.h +++ b/src/mpd_client.h @@ -40,6 +40,7 @@ X(MPD_API_GET_QUEUE) \ X(MPD_API_GET_BROWSE) \ X(MPD_API_GET_MPDHOST) \ + X(MPD_API_GET_DIRBLEAPITOKEN) \ X(MPD_API_ADD_TRACK) \ X(MPD_API_ADD_PLAY_TRACK) \ X(MPD_API_ADD_PLAYLIST) \ @@ -94,6 +95,8 @@ struct t_mpd { unsigned queue_version; } mpd; +char dirble_api_token[28]; + struct t_mpd_client_session { int song_id; unsigned queue_version; diff --git a/src/ympd.c b/src/ympd.c index afa25c6..caa02f7 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -80,10 +80,13 @@ int main(int argc, char **argv) mpd.port = 6600; strcpy(mpd.host, "127.0.0.1"); + strcpy(dirble_api_token, "2e223c9909593b94fc6577361a"); + static struct option long_options[] = { {"host", required_argument, 0, 'h'}, {"port", required_argument, 0, 'p'}, {"webport", required_argument, 0, 'w'}, + {"dirbletoken", required_argument, 0, 'd'}, {"user", required_argument, 0, 'u'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 0 }, @@ -102,6 +105,9 @@ int main(int argc, char **argv) case 'w': webport = strdup(optarg); break; + case 'd': + strncpy(dirble_api_token, optarg, sizeof(dirble_api_token)); + break; case 'u': run_as_user = strdup(optarg); break; @@ -118,6 +124,7 @@ int main(int argc, char **argv) " -p, --port \t\tconnect to mpd at port [6600]\n" " -w, --webport [ip:]\tlisten interface/port for webserver [8080]\n" " -u, --user \t\tdrop priviliges to user after socket bind\n" + " -d, --dirbletoken \tDirble API token\n" " -V, --version\t\t\tget version\n" " --help\t\t\t\tthis help\n" , argv[0]); From 40906e2beef24661cc9bb01c5d2aed6a296bece1 Mon Sep 17 00:00:00 2001 From: "Felix J. Ogris" Date: Mon, 6 Feb 2017 20:19:09 +0100 Subject: [PATCH 03/12] added FreeBSD RC script --- contrib/ympd.freebsd | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 contrib/ympd.freebsd diff --git a/contrib/ympd.freebsd b/contrib/ympd.freebsd new file mode 100755 index 0000000..4dcbedd --- /dev/null +++ b/contrib/ympd.freebsd @@ -0,0 +1,29 @@ +#!/bin/sh + +# PROVIDE: ympd +# REQUIRE: DAEMON musicpd +# KEYWORD: shutdown + +# Add the following line to /etc/rc.conf to enable ympd: +# +# ympd_enable="YES" + +. /etc/rc.subr + +name="ympd" +rcvar="${name}_enable" +command="/usr/local/bin/ympd" +pidfile="/var/run/${name}.pid" +start_cmd="ympd_start" + +load_rc_config "$name" +: ${ympd_enable:="NO"} +: ${ympd_user:="nobody"} + +ympd_start() +{ + check_startmsgs && echo "Starting ${name}." + /usr/sbin/daemon -f -p "${pidfile}" -t "${name}" -u "${ympd_user}" "${command}" +} + +run_rc_command "$1" From f79dea44a23f51433465e0320f93eb138f8eccef Mon Sep 17 00:00:00 2001 From: unknownln Date: Sat, 18 Feb 2017 11:42:20 -0500 Subject: [PATCH 04/12] Add option to set MPD password --- src/ympd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ympd.c b/src/ympd.c index afa25c6..d89f630 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -87,10 +87,11 @@ int main(int argc, char **argv) {"user", required_argument, 0, 'u'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 0 }, + {"mpdpass", required_argument, 0, 'm'}, {0, 0, 0, 0 } }; - while((n = getopt_long(argc, argv, "h:p:w:u:v", + while((n = getopt_long(argc, argv, "h:p:w:u:v:m", long_options, &option_index)) != -1) { switch (n) { case 'h': @@ -105,6 +106,9 @@ int main(int argc, char **argv) case 'u': run_as_user = strdup(optarg); break; + case 'm': + mpd.password = strdup(optarg); + break; case 'v': fprintf(stdout, "ympd %d.%d.%d\n" "Copyright (C) 2014 Andrew Karpow \n" From a6ba0d640cdfdd169af271881f6b791cfb824c3e Mon Sep 17 00:00:00 2001 From: unknownln Date: Sat, 18 Feb 2017 11:51:03 -0500 Subject: [PATCH 05/12] Update documentation for new option --- src/ympd.c | 1 + ympd.1 | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/ympd.c b/src/ympd.c index d89f630..f27c38e 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -123,6 +123,7 @@ int main(int argc, char **argv) " -w, --webport [ip:]\tlisten interface/port for webserver [8080]\n" " -u, --user \t\tdrop priviliges to user after socket bind\n" " -V, --version\t\t\tget version\n" + " -m, --mpdpass \tspecifies the password to use when connecting to mpd\n" " --help\t\t\t\tthis help\n" , argv[0]); return EXIT_FAILURE; diff --git a/ympd.1 b/ympd.1 index d94ed30..c8160a6 100644 --- a/ympd.1 +++ b/ympd.1 @@ -23,6 +23,9 @@ specifies the port for the webserver to listen to, defaults to 8080 \fB\-u\fR, \fB\-\-user username\fR drop privileges to the provided username after socket binding .TP +\fB\-m\fR, \fB\-\-mpdpass password\fR +specifies the password to use when connecting to mpd +.TP \fB\-V\fR, \fB\-\-version\fR print version and exit .TP From ec74ef463ba5a617d1e2f9fd08c823f93a536408 Mon Sep 17 00:00:00 2001 From: unknownln Date: Sat, 18 Feb 2017 12:00:28 -0500 Subject: [PATCH 06/12] config for system services --- contrib/init.debian | 2 +- contrib/ympd.default | 1 + contrib/ympd.service | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/init.debian b/contrib/init.debian index 5c10bdf..405739c 100755 --- a/contrib/init.debian +++ b/contrib/init.debian @@ -35,7 +35,7 @@ WEB_PORT=8080 # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS -DAEMON_OPT="--user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" +DAEMON_OPT="--user $YMPD_USER --mpdpass $MPD_PASSWORD --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" do_start() { diff --git a/contrib/ympd.default b/contrib/ympd.default index c7bbcda..e5e7c74 100644 --- a/contrib/ympd.default +++ b/contrib/ympd.default @@ -1,4 +1,5 @@ MPD_HOST=localhost MPD_PORT=6600 +MPD_PASSWORD= WEB_PORT=8080 YMPD_USER=nobody diff --git a/contrib/ympd.service b/contrib/ympd.service index 2289550..d4d2ae2 100644 --- a/contrib/ympd.service +++ b/contrib/ympd.service @@ -5,10 +5,11 @@ Requires=network.target local-fs.target [Service] Environment=MPD_HOST=localhost Environment=MPD_PORT=6600 +Environment=MPD_PASSWORD= Environment=WEB_PORT=8080 Environment=YMPD_USER=nobody EnvironmentFile=/etc/default/ympd -ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT +ExecStart=/usr/bin/ympd --user $YMPD_USER --mpdpass $MPD_PASSWORD --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT Type=simple [Install] From e5a88b1ffea9804462c6e3fa6f12e21668d75410 Mon Sep 17 00:00:00 2001 From: unknownln Date: Sat, 18 Feb 2017 12:05:24 -0500 Subject: [PATCH 07/12] quote password --- contrib/init.debian | 2 +- contrib/ympd.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/init.debian b/contrib/init.debian index 405739c..163b7ef 100755 --- a/contrib/init.debian +++ b/contrib/init.debian @@ -35,7 +35,7 @@ WEB_PORT=8080 # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS -DAEMON_OPT="--user $YMPD_USER --mpdpass $MPD_PASSWORD --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" +DAEMON_OPT="--user $YMPD_USER --mpdpass '$MPD_PASSWORD' --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" do_start() { diff --git a/contrib/ympd.service b/contrib/ympd.service index d4d2ae2..023b926 100644 --- a/contrib/ympd.service +++ b/contrib/ympd.service @@ -9,7 +9,7 @@ Environment=MPD_PASSWORD= Environment=WEB_PORT=8080 Environment=YMPD_USER=nobody EnvironmentFile=/etc/default/ympd -ExecStart=/usr/bin/ympd --user $YMPD_USER --mpdpass $MPD_PASSWORD --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT +ExecStart=/usr/bin/ympd --user $YMPD_USER --mpdpass "$MPD_PASSWORD" --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT Type=simple [Install] From fa4cb48830757dcea1405605aa204de4796de9c3 Mon Sep 17 00:00:00 2001 From: Galen Alderson Date: Wed, 29 Mar 2017 12:17:01 -0400 Subject: [PATCH 08/12] Fix segfault when using short password option (-m) --- src/ympd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ympd.c b/src/ympd.c index f27c38e..304f5b8 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -91,7 +91,7 @@ int main(int argc, char **argv) {0, 0, 0, 0 } }; - while((n = getopt_long(argc, argv, "h:p:w:u:v:m", + while((n = getopt_long(argc, argv, "h:p:w:u:vm:", long_options, &option_index)) != -1) { switch (n) { case 'h': From c1f1adbc280b6003c731578e7870a7094a9ac43d Mon Sep 17 00:00:00 2001 From: azrdev Date: Sun, 14 May 2017 07:37:46 +0200 Subject: [PATCH 09/12] Don't overwrite CFLAGS Preserve user/system-configured C_FLAGS. This broke the rpm package build on fedora: They enable a hardened config (i.e. ASLR) by default, which adds -pie and -fPIC to linker and compiler flags. Overwriting C_FLAGS removed the compiler spec, but not the linker one, leading to an error like: /bin/cc -std=gnu99 -Wall -ggdb -pedantic -specs=/usr/lib/rpm/redhat/redhat-hardened-ld CMakeFiles/mkdata.dir/tools/mkdata.c.o -o mkdata -rdynamic bin/ld: CMakeFiles/mkdata.dir/tools/mkdata.c.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC CMakeFiles/mkdata.dir/tools/mkdata.c.o: error adding symbols: Bad value With this fix, the error is gone: /bin/cc -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -std=gnu99 -Wall -g -ggdb -pedantic -specs=/usr/lib/rpm/redhat/redhat-hardened-ld CMakeFiles/mkdata.dir/tools/mkdata.c.o -o mkdata -rdynamic --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cce24fe..fb4945d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,8 @@ include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${LIBMPDCLIENT_I include(CheckCSourceCompiles) -set(CMAKE_C_FLAGS "-std=gnu99 -Wall") -set(CMAKE_C_FLAGS_DEBUG "-ggdb -pedantic") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -pedantic") if(WITH_IPV6) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_IPV6) endif() From 02ab7df3c615cbf6faaf9abaf29838cfcb5371e9 Mon Sep 17 00:00:00 2001 From: Zachary Boyd Date: Sat, 23 Dec 2017 12:11:47 -0800 Subject: [PATCH 10/12] Adds a Dockerfile for building a lightweight Docker container based on alpine --- Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c89b804 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM alpine:3.5 +WORKDIR /app/build +COPY . /app +RUN apk add --no-cache g++ make cmake libmpdclient-dev openssl-dev +RUN cmake .. +RUN make + +FROM alpine:3.5 +RUN apk add --no-cache libmpdclient openssl +EXPOSE 8080 +COPY --from=0 /app/build/ympd /usr/bin/ympd +COPY --from=0 /app/build/mkdata /usr/bin/mkdata +CMD ympd \ No newline at end of file From bba35bf682b70e7374d6ad5097ed471e10485e29 Mon Sep 17 00:00:00 2001 From: Florian Heinemann Date: Sun, 21 Jan 2018 22:06:40 +0100 Subject: [PATCH 11/12] Update README.md to highlight OpenSSL dependency --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 08ef76d..ba198ba 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,12 @@ Dependencies ------------ - libmpdclient 2: http://www.musicpd.org/libs/libmpdclient/ - cmake 2.6: http://cmake.org/ + - OpenSSL: https://www.openssl.org/ Unix Build Instructions ----------------------- -1. install dependencies, cmake and libmpdclient are available from all major distributions. +1. install dependencies. cmake, libmpdclient (dev), and OpenSSL (dev) are available from all major distributions. 2. create build directory ```cd /path/to/src; mkdir build; cd build``` 3. create makefile ```cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr``` 4. build ```make``` From 95f8ccd7a4328794563d64344966ff17d72f82fd Mon Sep 17 00:00:00 2001 From: Andrew Karpow Date: Mon, 22 Jan 2018 04:45:59 +0100 Subject: [PATCH 12/12] update travis image --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index aab29ee..4b2afb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: c sudo: required -dist: precise +dist: trusty compiler: - gcc