[xiph-commits] r18940 - branches/dir.xiph.org/cgi-bin
dm8tbr at svn.xiph.org
dm8tbr at svn.xiph.org
Fri May 10 23:39:40 PDT 2013
Author: dm8tbr
Date: 2013-05-10 23:39:40 -0700 (Fri, 10 May 2013)
New Revision: 18940
Modified:
branches/dir.xiph.org/cgi-bin/yp.php
Log:
YP dir.xiph.org yp.php changes
- Added Opus detection (untested)
- Added detection of .local listen-url
- Added detection of dev.local listen-url
- Changed logging behavior.
Modified: branches/dir.xiph.org/cgi-bin/yp.php
===================================================================
--- branches/dir.xiph.org/cgi-bin/yp.php 2013-05-10 21:04:55 UTC (rev 18939)
+++ branches/dir.xiph.org/cgi-bin/yp.php 2013-05-11 06:39:40 UTC (rev 18940)
@@ -70,6 +70,10 @@
{
$media_type .= '+vorbis';
}
+ elseif (preg_match('/opus/i', $_REQUEST['stype']))
+ {
+ $media_type .= '+opus';
+ }
}
// Genre, space-normalized
$genre = clean_string($_REQUEST['genre']);
@@ -102,10 +106,17 @@
{
throw new ServerRefusedAPIException('Could not parse listen_url.', SERVER_REFUSED_PARSE_ERROR, $listen_url);
}
+
+ if ( preg_match('/^dev.local$/', $url['host']))
+ {
+ throw new ServerRefusedAPIException('Illegal listen_url. Don\'t test against a production server, thanks! ', SERVER_REFUSED_ILLEGAL_URL, $listen_url);
+ }
+
if (empty($url['scheme']) || $url['scheme'] != 'http'
|| !array_key_exists('host', $url)
|| !preg_match('/^.*[A-Za-z0-9\-]+\.[A-Za-z0-9]+$/', $url['host'])
- || preg_match('/^(10\.|192\.168\.|127\.)/', $url['host']))
+ || preg_match('/^(10\.|192\.168\.|127\.)/', $url['host'])
+ || preg_match('/^.*\.local$/', $url['host']))
{
throw new ServerRefusedAPIException('Illegal listen_url. Incorrect <hostname>.', SERVER_REFUSED_ILLEGAL_URL, $listen_url);
}
@@ -205,7 +216,6 @@
header("YPMessage: Successfully added.");
header("SID: ".$sid);
header("TouchFreq: 242");
-
// Log stuff
APILog::request(REQUEST_ADD, true, $listen_url, $server_id,
$mp_id);
@@ -416,7 +426,7 @@
// Log stuff
APILog::request(REQUEST_REMOVE, false, $listen_url,
$server_id !== false ? $server_id : null,
- $mp_id !== false ? $mp_id : null);
+ $mp_id !== false ? $mp_id : 1);
}
catch (APIException $e)
{
@@ -428,7 +438,7 @@
// Log stuff
APILog::request(REQUEST_REMOVE, false, $listen_url,
$server_id !== false ? $server_id : null,
- $mp_id !== false ? $mp_id : null);
+ $mp_id !== false ? $mp_id : 2);
}
break;
More information about the commits
mailing list