diff options
-rw-r--r-- | README | 10 | ||||
-rwxr-xr-x | rh-bin/authtoken.json | 65 | ||||
-rwxr-xr-x | rh-bin/listdropboxes.cgi | 117 | ||||
-rw-r--r-- | www/js/jingles.js | 2 | ||||
-rw-r--r-- | www/js/shows.js | 2 |
5 files changed, 98 insertions, 98 deletions
@@ -31,8 +31,8 @@ LICENSE Installation ============ -# sudo aptitude install apache2 libapache2-mod-fcgid libconfig-inifiles-perl libcgi-fast-perl libdbd-mysql-perl libjson-pp-perl libxml-quote-perl librhrd-perl libjs-jquery rivendell-server -# sudo a2enmod ssl authnz_ldap fcgid proxy_wstunnel +# sudo aptitude install apache2 libapache2-mpm-itk libapache2-mod-perl2 libconfig-inifiles-perl libdbd-mysql-perl libjson-pp-perl libxml-quote-perl librhrd-perl libjs-jquery rivendell-server +# sudo a2enmod ssl authnz_ldap perl proxy_wstunnel # sudo /etc/init.d/apache2 restart add the following to /etc/apache2/mods-endabled/ldap.conf: @@ -46,12 +46,16 @@ LDAPTrustedGlobalCert CA_BASE64 /etc/ldap/ldapscert.pem add the following to the virtualhost config: ~~~snip~~~ + AssignUserID rduser rivendell + Include /etc/rivendell/apache-2.4.conf Include /etc/apache2/conf-available/javascript-common.conf Alias /rh-bin/ /var/www/rhwebimport/rh-bin/ <Directory /var/www/rhwebimport/rh-bin/> - SetHandler fcgid-script + SetHandler perl-script + PerlResponseHandler ModPerl::Registry + PerlOptions +ParseHeaders Options +ExecCGI Require all granted diff --git a/rh-bin/authtoken.json b/rh-bin/authtoken.json index 743ac96..2c19cb0 100755 --- a/rh-bin/authtoken.json +++ b/rh-bin/authtoken.json @@ -22,45 +22,42 @@ # use strict; -use CGI::Fast; use RHRD::rddb; use JSON; -while (my $q = CGI::Fast->new) { - my $status = 'ERROR'; - my $errorstring = 'unknown'; - my $username = ''; - my $token = ''; - my $fullname = ''; - my $responsecode = 500; +my $status = 'ERROR'; +my $errorstring = 'unknown'; +my $username = ''; +my $token = ''; +my $fullname = ''; +my $responsecode = 500; - if(defined $ENV{REMOTE_USER}) { - my $dbh; - ($dbh, $status, $errorstring) = RHRD::rddb::opendb(); - if(defined $dbh) { - $username = $ENV{REMOTE_USER}; - ($token, $status, $errorstring) = RHRD::rddb::get_token($dbh, $username); - $token = '' unless($token); - ($fullname, $status, $errorstring) = RHRD::rddb::get_fullname($dbh, $username); - $fullname = '' unless($fullname); - RHRD::rddb::closedb($dbh); - if($status == "OK") { - $responsecode = 200; - } +if(defined $ENV{REMOTE_USER}) { + my $dbh; + ($dbh, $status, $errorstring) = RHRD::rddb::opendb(); + if(defined $dbh) { + $username = $ENV{REMOTE_USER}; + ($token, $status, $errorstring) = RHRD::rddb::get_token($dbh, $username); + $token = '' unless($token); + ($fullname, $status, $errorstring) = RHRD::rddb::get_fullname($dbh, $username); + $fullname = '' unless($fullname); + RHRD::rddb::closedb($dbh); + if($status == "OK") { + $responsecode = 200; } - } else { - $errorstring = 'no username defined - are you logged in?'; - $responsecode = 400; } +} else { + $errorstring = 'no username defined - are you logged in?'; + $responsecode = 400; +} - my %answer; - $answer{'status'} = $status; - $answer{'errorstring'} = $errorstring; - $answer{'username'} = $username; - $answer{'fullname'} = $fullname; - $answer{'token'} = $token; +my %answer; +$answer{'status'} = $status; +$answer{'errorstring'} = $errorstring; +$answer{'username'} = $username; +$answer{'fullname'} = $fullname; +$answer{'token'} = $token; - print "Content-type: application/json; charset=UTF-8\n"; - print "Status: $responsecode\n\n"; - print encode_json \%answer; -} +print "Content-type: application/json; charset=UTF-8\n"; +print "Status: $responsecode\n\n"; +print encode_json \%answer; diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi index f008c51..a9df374 100755 --- a/rh-bin/listdropboxes.cgi +++ b/rh-bin/listdropboxes.cgi @@ -22,76 +22,75 @@ # use strict; -use CGI::Fast; +use CGI; use POSIX; use XML::Quote; use RHRD::rddb; -while (my $q = CGI::Fast->new) { - my $status = 'ERROR'; - my $errorstring = 'unknown'; - my $responsecode = 500; - my @dropboxes = (); +my $status = 'ERROR'; +my $errorstring = 'unknown'; +my $responsecode = 500; +my @dropboxes = (); - my $username = $q->param('LOGIN_NAME'); - my $token = $q->param('PASSWORD'); +my $q = CGI->new; +my $username = $q->param('LOGIN_NAME'); +my $token = $q->param('PASSWORD'); - my $dbh; - ($dbh, $status, $errorstring) = RHRD::rddb::opendb(); - if(defined $dbh) { - my $result; - ($result, $status, $errorstring) = RHRD::rddb::check_token($dbh, $username, $token); - if($result == 1) { - $responsecode = 200; - @dropboxes = RHRD::rddb::get_dropboxes($dbh, $username); - unless (defined $dropboxes[0]) { - $responsecode = 500; - $status = $dropboxes[1]; - $errorstring = $dropboxes[2]; - } - } elsif($result == 0) { - $responsecode = 401; - } else { +my $dbh; +($dbh, $status, $errorstring) = RHRD::rddb::opendb(); +if(defined $dbh) { + my $result; + ($result, $status, $errorstring) = RHRD::rddb::check_token($dbh, $username, $token); + if($result == 1) { + $responsecode = 200; + @dropboxes = RHRD::rddb::get_dropboxes($dbh, $username); + unless (defined $dropboxes[0]) { $responsecode = 500; + $status = $dropboxes[1]; + $errorstring = $dropboxes[2]; } - RHRD::rddb::closedb($dbh); + } elsif($result == 0) { + $responsecode = 401; + } else { + $responsecode = 500; } + RHRD::rddb::closedb($dbh); +} - print "Content-type: application/xml; charset=UTF-8\n"; - print "Status: $responsecode\n\n"; +print "Content-type: application/xml; charset=UTF-8\n"; +print "Status: $responsecode\n\n"; - if($responsecode != 200) { - print "<RDWebResult>\n"; - print " <ResponseCode>" . xml_quote($responsecode) . "</ResponseCode>\n"; - print " <ErrorString>" . xml_quote($errorstring) . "</ErrorString>\n"; - print "</RDWebResult>\n"; - } else { - print "<dropboxList>\n"; - for my $href (@dropboxes) { - print " <dropbox>\n"; - print " <group>" . xml_quote($href->{'GROUP'}) . "</group>\n"; - print " <group-description>" . xml_quote($href->{'GROUPDESC'}) . "</group-description>\n"; - print " <group-low-cart>" . xml_quote($href->{'GROUPLOWCART'}) . "</group-low-cart>\n"; - print " <group-high-cart>" . xml_quote($href->{'GROUPHIGHCART'}) . "</group-high-cart>\n"; - print " <normalization-level>" . floor($href->{'NORMLEVEL'}/100) . "</normalization-level>\n"; - print " <autotrim-level>" . floor($href->{'TRIMLEVEL'}/100) . "</autotrim-level>\n"; - print " <parameters>" . xml_quote($href->{'PARAM'}) . "</parameters>\n"; - print " <type>" . xml_quote($href->{'TYPE'}) . "</type>\n"; - if($href->{'TYPE'} eq "show") { - print " <show-id>" . xml_quote($href->{'SHOWID'}) . "</show-id>\n"; - print " <show-title>" . xml_quote($href->{'SHOWTITLE'}) . "</show-title>\n"; - print " <show-log>" . xml_quote($href->{'SHOWLOG'}) . "</show-log>\n"; - print " <show-rhythm>" . xml_quote($href->{'SHOWRHYTHM'}) . "</show-rhythm>\n"; - print " <show-dayofweek>" . xml_quote($href->{'SHOWDOW'}) . "</show-dayofweek>\n"; - print " <show-starttime>" . xml_quote($href->{'SHOWSTARTTIME'}) . "</show-starttime>\n"; - print " <show-length>" . xml_quote($href->{'SHOWLEN'}) . "</show-length>\n"; - } elsif($href->{'TYPE'} eq "jingle") { - print " <jingle-title>" . xml_quote($href->{'JINGLETITLE'}) . "</jingle-title>\n"; - } elsif($href->{'TYPE'} eq "musicpool") { - print " <musicpool-title>" . xml_quote($href->{'MUSICPOOLTITLE'}) . "</musicpool-title>\n"; - } - print " </dropbox>\n"; +if($responsecode != 200) { + print "<RDWebResult>\n"; + print " <ResponseCode>" . xml_quote($responsecode) . "</ResponseCode>\n"; + print " <ErrorString>" . xml_quote($errorstring) . "</ErrorString>\n"; + print "</RDWebResult>\n"; +} else { + print "<dropboxList>\n"; + for my $href (@dropboxes) { + print " <dropbox>\n"; + print " <group>" . xml_quote($href->{'GROUP'}) . "</group>\n"; + print " <group-description>" . xml_quote($href->{'GROUPDESC'}) . "</group-description>\n"; + print " <group-low-cart>" . xml_quote($href->{'GROUPLOWCART'}) . "</group-low-cart>\n"; + print " <group-high-cart>" . xml_quote($href->{'GROUPHIGHCART'}) . "</group-high-cart>\n"; + print " <normalization-level>" . floor($href->{'NORMLEVEL'}/100) . "</normalization-level>\n"; + print " <autotrim-level>" . floor($href->{'TRIMLEVEL'}/100) . "</autotrim-level>\n"; + print " <parameters>" . xml_quote($href->{'PARAM'}) . "</parameters>\n"; + print " <type>" . xml_quote($href->{'TYPE'}) . "</type>\n"; + if($href->{'TYPE'} eq "show") { + print " <show-id>" . xml_quote($href->{'SHOWID'}) . "</show-id>\n"; + print " <show-title>" . xml_quote($href->{'SHOWTITLE'}) . "</show-title>\n"; + print " <show-log>" . xml_quote($href->{'SHOWLOG'}) . "</show-log>\n"; + print " <show-rhythm>" . xml_quote($href->{'SHOWRHYTHM'}) . "</show-rhythm>\n"; + print " <show-dayofweek>" . xml_quote($href->{'SHOWDOW'}) . "</show-dayofweek>\n"; + print " <show-starttime>" . xml_quote($href->{'SHOWSTARTTIME'}) . "</show-starttime>\n"; + print " <show-length>" . xml_quote($href->{'SHOWLEN'}) . "</show-length>\n"; + } elsif($href->{'TYPE'} eq "jingle") { + print " <jingle-title>" . xml_quote($href->{'JINGLETITLE'}) . "</jingle-title>\n"; + } elsif($href->{'TYPE'} eq "musicpool") { + print " <musicpool-title>" . xml_quote($href->{'MUSICPOOLTITLE'}) . "</musicpool-title>\n"; } - print "</dropboxList>\n"; + print " </dropbox>\n"; } + print "</dropboxList>\n"; } diff --git a/www/js/jingles.js b/www/js/jingles.js index b40c973..16fbf8d 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -457,7 +457,7 @@ Importer.prototype.showUploadModal = function(cart) { uploadMultiple: false, // todo: maybe enable this? clickable: true, createImageThumbnails: false, - acceptedFiles: '.flac,.wav,.ogg,.mp3,.m4a,.aac', + acceptedFiles: '.flac,.wav,.ogg,.mp3', autoProcessQueue: false, init: function() { this.on("addedfile", function(file) { diff --git a/www/js/shows.js b/www/js/shows.js index 151eb36..268a76d 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -130,7 +130,7 @@ function shows_importCart(cart) { $('#uploadModal-confirm').attr('disabled','disabled').unbind('click'); var dz = form.dropzone({ url: "/rd-bin/rdxport.cgi", parallelUploads: 1, maxFilesize: 2048, paramName: 'FILENAME', uploadMultiple: false, clickable: true, createImageThumbnails: false, - acceptedFiles: ".flac,.wav,.ogg,.mp3,.m4a,.aac", autoProcessQueue: false, init: function() { + acceptedFiles: ".flac,.wav,.ogg,.mp3", autoProcessQueue: false, init: function() { this.on("addedfile", function(file) { shows_importFileAdded(this, file, cart); }); this.on("error", function(file, msg) { shows_importFileSelectError(this, file, msg); }); }}); |