mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
Add 'fake' directory to Subsonic streaming url when cUrl unavailable
This commit is contained in:
parent
89b12c8f0a
commit
c3b3a8021e
5 changed files with 20 additions and 10 deletions
|
@ -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.
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue