Present http:// alias by default in WebFinger output
because it might help us (and especially StatusNet sites) to recognize profiles that have migrated from HTTP to HTTPS!
This commit is contained in:
parent
c60b6bdb38
commit
396f1e92ca
|
@ -31,6 +31,13 @@ if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
|
|
||||||
class WebFingerPlugin extends Plugin
|
class WebFingerPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
public $http_alias = true;
|
||||||
|
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
common_config_set('webfinger', 'http_alias', $this->http_alias);
|
||||||
|
}
|
||||||
|
|
||||||
public function onRouterInitialized($m)
|
public function onRouterInitialized($m)
|
||||||
{
|
{
|
||||||
$m->connect('.well-known/host-meta', array('action' => 'hostmeta'));
|
$m->connect('.well-known/host-meta', array('action' => 'hostmeta'));
|
||||||
|
|
|
@ -34,7 +34,12 @@ abstract class WebFingerResource
|
||||||
$aliases = array();
|
$aliases = array();
|
||||||
|
|
||||||
// Add the URI as an identity, this is _not_ necessarily an HTTP url
|
// Add the URI as an identity, this is _not_ necessarily an HTTP url
|
||||||
$aliases[] = $this->object->getUri();
|
$uri = $this->object->getUri();
|
||||||
|
$aliases[] = $uri;
|
||||||
|
if (common_config('webfinger', 'http_alias')
|
||||||
|
&& strtolower(parse_url($uri, PHP_URL_SCHEME)) === 'https') {
|
||||||
|
$aliases[] = preg_replace('/^https:/', 'http:', $uri, 1);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$aliases[] = $this->object->getUrl();
|
$aliases[] = $this->object->getUrl();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user