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];
|
return $input[$parameter];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function output_header($ch, $header)
|
public static function output_header($ch, $header)
|
||||||
{
|
{
|
||||||
header($header);
|
header($header);
|
||||||
|
@ -86,6 +86,10 @@ class Subsonic_Api
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
} else {
|
} else {
|
||||||
// Stream media using http redirect if no curl support
|
// 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);
|
header("Location: " . $url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1007,7 +1011,7 @@ class Subsonic_Api
|
||||||
}
|
}
|
||||||
self::apiOutput($input, $r);
|
self::apiOutput($input, $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getUser
|
* getUser
|
||||||
* Get details about a given user.
|
* Get details about a given user.
|
||||||
|
@ -1017,9 +1021,9 @@ class Subsonic_Api
|
||||||
public static function getuser($input)
|
public static function getuser($input)
|
||||||
{
|
{
|
||||||
self::check_version($input, "1.3.0");
|
self::check_version($input, "1.3.0");
|
||||||
|
|
||||||
$username = self::check_parameter($input, 'username');
|
$username = self::check_parameter($input, 'username');
|
||||||
|
|
||||||
if ($GLOBALS['user']->access >= 100 || $GLOBALS['user']->username == $username) {
|
if ($GLOBALS['user']->access >= 100 || $GLOBALS['user']->username == $username) {
|
||||||
$r = Subsonic_XML_Data::createSuccessResponse();
|
$r = Subsonic_XML_Data::createSuccessResponse();
|
||||||
if ($GLOBALS['user']->username == $username) {
|
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.');
|
$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);
|
self::apiOutput($input, $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**** CURRENT UNSUPPORTED FUNCTIONS ****/
|
/**** CURRENT UNSUPPORTED FUNCTIONS ****/
|
||||||
|
|
||||||
|
@ -1083,7 +1087,7 @@ class Subsonic_Api
|
||||||
$r = Subsonic_XML_Data::createSuccessResponse();
|
$r = Subsonic_XML_Data::createSuccessResponse();
|
||||||
self::apiOutput($input, $r);
|
self::apiOutput($input, $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createUser
|
* createUser
|
||||||
* Create a new user.
|
* Create a new user.
|
||||||
|
|
|
@ -451,7 +451,7 @@ class Subsonic_XML_Data
|
||||||
self::addSong($xstarred, $song);
|
self::addSong($xstarred, $song);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addUser($xml, $user)
|
public static function addUser($xml, $user)
|
||||||
{
|
{
|
||||||
$xuser = $xml->addChild('user');
|
$xuser = $xml->addChild('user');
|
||||||
|
@ -471,7 +471,7 @@ class Subsonic_XML_Data
|
||||||
$xuser->addAttribute('jukeboxRole', 'false');
|
$xuser->addAttribute('jukeboxRole', 'false');
|
||||||
$xuser->addAttribute('shareRole', 'false');
|
$xuser->addAttribute('shareRole', 'false');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addUsers($xml, $users)
|
public static function addUsers($xml, $users)
|
||||||
{
|
{
|
||||||
$xusers = $xml->addChild('users');
|
$xusers = $xml->addChild('users');
|
||||||
|
|
|
@ -135,7 +135,7 @@ class User extends database_object
|
||||||
$this->playlist = Tmp_Playlist::get_from_session($session_id);
|
$this->playlist = Tmp_Playlist::get_from_session($session_id);
|
||||||
|
|
||||||
} // load_playlist
|
} // load_playlist
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_valid_users
|
* get_valid_users
|
||||||
* This returns all valid users in database.
|
* This returns all valid users in database.
|
||||||
|
@ -143,7 +143,7 @@ class User extends database_object
|
||||||
public static function get_valid_users()
|
public static function get_valid_users()
|
||||||
{
|
{
|
||||||
$users = array();
|
$users = array();
|
||||||
|
|
||||||
$sql = "SELECT `id` FROM `user` WHERE `disabled` = '0'";
|
$sql = "SELECT `id` FROM `user` WHERE `disabled` = '0'";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
while ($results = Dba::fetch_assoc($db_results)) {
|
while ($results = Dba::fetch_assoc($db_results)) {
|
||||||
|
|
|
@ -3,4 +3,5 @@
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !-s
|
RewriteCond %{REQUEST_FILENAME} !-s
|
||||||
RewriteRule ^(.+)\.view$ index.php?action=$1 [PT,L,QSA]
|
RewriteRule ^(.+)\.view$ index.php?action=$1 [PT,L,QSA]
|
||||||
|
RewriteRule ^fake/(.+)$ ../play/$1 [PT,L,QSA]
|
||||||
</IfModule>
|
</IfModule>
|
|
@ -28,6 +28,11 @@ if (!AmpConfig::get('subsonic_backend')) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ssid = $_GET['ssid'];
|
||||||
|
if (!empty($ssid)) {
|
||||||
|
print_r('test', 'found!', '5');
|
||||||
|
}
|
||||||
|
|
||||||
$action = strtolower($_GET['action']);
|
$action = strtolower($_GET['action']);
|
||||||
$f = $_GET['f'];
|
$f = $_GET['f'];
|
||||||
$callback = $_GET['callback'];
|
$callback = $_GET['callback'];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue