diff --git a/lib/class/subsonic_api.class.php b/lib/class/subsonic_api.class.php index 067c565b..1794ac5b 100644 --- a/lib/class/subsonic_api.class.php +++ b/lib/class/subsonic_api.class.php @@ -60,7 +60,7 @@ class Subsonic_Api return $input[$parameter]; } - + public static function output_header($ch, $header) { header($header); @@ -86,6 +86,10 @@ class Subsonic_Api curl_close($ch); } else { // Stream media using http redirect if no curl support + + // Bug fix for android clients looking for /rest/ in destination url + // Warning: external catalogs will not work! + $url = str_replace('/play/', '/rest/fake/', $url); header("Location: " . $url); } } @@ -1007,7 +1011,7 @@ class Subsonic_Api } self::apiOutput($input, $r); } - + /** * getUser * Get details about a given user. @@ -1017,9 +1021,9 @@ class Subsonic_Api public static function getuser($input) { self::check_version($input, "1.3.0"); - + $username = self::check_parameter($input, 'username'); - + if ($GLOBALS['user']->access >= 100 || $GLOBALS['user']->username == $username) { $r = Subsonic_XML_Data::createSuccessResponse(); if ($GLOBALS['user']->username == $username) { @@ -1052,7 +1056,7 @@ class Subsonic_Api $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED, $GLOBALS['user']->username . ' is not authorized to get details for other users.'); } self::apiOutput($input, $r); - } + } /**** CURRENT UNSUPPORTED FUNCTIONS ****/ @@ -1083,7 +1087,7 @@ class Subsonic_Api $r = Subsonic_XML_Data::createSuccessResponse(); self::apiOutput($input, $r); } - + /** * createUser * Create a new user. diff --git a/lib/class/subsonic_xml_data.class.php b/lib/class/subsonic_xml_data.class.php index ea925fc6..1da25e2d 100644 --- a/lib/class/subsonic_xml_data.class.php +++ b/lib/class/subsonic_xml_data.class.php @@ -451,7 +451,7 @@ class Subsonic_XML_Data self::addSong($xstarred, $song); } } - + public static function addUser($xml, $user) { $xuser = $xml->addChild('user'); @@ -471,7 +471,7 @@ class Subsonic_XML_Data $xuser->addAttribute('jukeboxRole', 'false'); $xuser->addAttribute('shareRole', 'false'); } - + public static function addUsers($xml, $users) { $xusers = $xml->addChild('users'); diff --git a/lib/class/user.class.php b/lib/class/user.class.php index 94f98065..4a30a1cd 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -135,7 +135,7 @@ class User extends database_object $this->playlist = Tmp_Playlist::get_from_session($session_id); } // load_playlist - + /** * get_valid_users * This returns all valid users in database. @@ -143,7 +143,7 @@ class User extends database_object public static function get_valid_users() { $users = array(); - + $sql = "SELECT `id` FROM `user` WHERE `disabled` = '0'"; $db_results = Dba::read($sql); while ($results = Dba::fetch_assoc($db_results)) { diff --git a/rest/.htaccess b/rest/.htaccess index aebeaea3..cb39ae67 100644 --- a/rest/.htaccess +++ b/rest/.htaccess @@ -3,4 +3,5 @@ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.+)\.view$ index.php?action=$1 [PT,L,QSA] + RewriteRule ^fake/(.+)$ ../play/$1 [PT,L,QSA] \ No newline at end of file diff --git a/rest/index.php b/rest/index.php index 02be0047..8f70db14 100644 --- a/rest/index.php +++ b/rest/index.php @@ -28,6 +28,11 @@ if (!AmpConfig::get('subsonic_backend')) { exit; } +$ssid = $_GET['ssid']; +if (!empty($ssid)) { + print_r('test', 'found!', '5'); +} + $action = strtolower($_GET['action']); $f = $_GET['f']; $callback = $_GET['callback'];