User agents and generators changed to GNU social
This commit is contained in:
parent
ca66860a4f
commit
255943d78f
@ -165,7 +165,7 @@ class ActivityStreamJSONDocument extends JSONActivityCollection
|
|||||||
*/
|
*/
|
||||||
function asString()
|
function asString()
|
||||||
{
|
{
|
||||||
$this->doc['generator'] = 'StatusNet ' . STATUSNET_VERSION; // extension
|
$this->doc['generator'] = 'GNU social ' . GNUSOCIAL_VERSION; // extension
|
||||||
$this->doc['title'] = $this->title;
|
$this->doc['title'] = $this->title;
|
||||||
$this->doc['url'] = $this->url;
|
$this->doc['url'] = $this->url;
|
||||||
$this->doc['totalItems'] = $this->count;
|
$this->doc['totalItems'] = $this->count;
|
||||||
|
@ -158,7 +158,7 @@ class HTTPClient extends HTTP_Request2
|
|||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($url, $method, $config);
|
parent::__construct($url, $method, $config);
|
||||||
$this->setHeader('User-Agent', $this->userAgent());
|
$this->setHeader('User-Agent', self::userAgent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -247,9 +247,10 @@ class HTTPClient extends HTTP_Request2
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function userAgent()
|
static public function userAgent()
|
||||||
{
|
{
|
||||||
return "GNU Social/".GNUSOCIAL_VERSION." (".GNUSOCIAL_CODENAME.")";
|
return GNUSOCIAL_ENGINE . '/' . GNUSOCIAL_VERSION
|
||||||
|
. ' (' . GNUSOCIAL_CODENAME . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,11 +90,11 @@ function ping_broadcast_notice($notice) {
|
|||||||
|
|
||||||
if ($type === 'get') {
|
if ($type === 'get') {
|
||||||
$result = $fetcher->get($notify_url . '?' . http_build_query($args),
|
$result = $fetcher->get($notify_url . '?' . http_build_query($args),
|
||||||
array('User-Agent: StatusNet/'.STATUSNET_VERSION));
|
array('User-Agent: ' . HTTPClient::userAgent()));
|
||||||
} else {
|
} else {
|
||||||
$result = $fetcher->post($notify_url,
|
$result = $fetcher->post($notify_url,
|
||||||
http_build_query($args),
|
http_build_query($args),
|
||||||
array('User-Agent: StatusNet/'.STATUSNET_VERSION));
|
array('User-Agent: ' . HTTPClient::userAgent()));
|
||||||
}
|
}
|
||||||
if ($result->status != '200') {
|
if ($result->status != '200') {
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
|
@ -158,12 +158,22 @@ class Plugin
|
|||||||
$this->log(LOG_DEBUG, $msg);
|
$this->log(LOG_DEBUG, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
function name()
|
public function name()
|
||||||
{
|
{
|
||||||
$cls = get_class($this);
|
$cls = get_class($this);
|
||||||
return mb_substr($cls, 0, -6);
|
return mb_substr($cls, 0, -6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function version()
|
||||||
|
{
|
||||||
|
return GNUSOCIAL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function userAgent() {
|
||||||
|
return HTTPClient::userAgent()
|
||||||
|
. ' (' . get_class($this) . ' v' . $this->version() . ')';
|
||||||
|
}
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$name = $this->name();
|
$name = $this->name();
|
||||||
|
@ -143,9 +143,9 @@ class BlogspamNetPlugin extends Plugin
|
|||||||
return '127.0.0.1';
|
return '127.0.0.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
function userAgent()
|
function version()
|
||||||
{
|
{
|
||||||
return 'BlogspamNetPlugin/'.BLOGSPAMNETPLUGIN_VERSION . ' StatusNet/' . STATUSNET_VERSION;
|
return BLOGSPAMNETPLUGIN_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(&$versions)
|
||||||
|
@ -227,10 +227,9 @@ class LinkbackPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function userAgent()
|
public function version()
|
||||||
{
|
{
|
||||||
return 'LinkbackPlugin/'.LINKBACKPLUGIN_VERSION .
|
return LINKBACKPLUGIN_VERSION;
|
||||||
' StatusNet/' . STATUSNET_VERSION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(&$versions)
|
||||||
|
@ -67,12 +67,6 @@ class SpotifyPlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function userAgent()
|
|
||||||
{
|
|
||||||
return 'SpotifyPlugin/'.SPOTIFYPLUGIN_VERSION .
|
|
||||||
' StatusNet/' . STATUSNET_VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPluginVersion(&$versions)
|
function onPluginVersion(&$versions)
|
||||||
{
|
{
|
||||||
$versions[] = array('name' => 'Spotify',
|
$versions[] = array('name' => 'Spotify',
|
||||||
|
@ -129,7 +129,7 @@ abstract class JsonStreamReader
|
|||||||
$lines = array(
|
$lines = array(
|
||||||
"GET $path HTTP/1.1",
|
"GET $path HTTP/1.1",
|
||||||
"Host: $host",
|
"Host: $host",
|
||||||
"User-Agent: StatusNet/" . STATUSNET_VERSION . " (TwitterBridgePlugin)",
|
'User-Agent: ' . HTTPClient::userAgent() . ' (TwitterBridgePlugin)',
|
||||||
"Connection: close",
|
"Connection: close",
|
||||||
"",
|
"",
|
||||||
""
|
""
|
||||||
|
Loading…
Reference in New Issue
Block a user