Merge remote-tracking branch 'upstream/2021.12-rc' into api-direct-messages
This commit is contained in:
commit
94439a3b42
5 changed files with 22 additions and 3 deletions
|
@ -349,9 +349,9 @@ class GServer
|
||||||
}
|
}
|
||||||
|
|
||||||
// On a redirect follow the new host but mark the old one as failure
|
// On a redirect follow the new host but mark the old one as failure
|
||||||
if ($curlResult->isSuccess() && (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
|
if ($curlResult->isSuccess() && !empty($curlResult->getRedirectUrl()) && (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
|
||||||
$curlResult = DI::httpClient()->get($url, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
$curlResult = DI::httpClient()->get($url, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
||||||
if (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST)) {
|
if (!empty($curlResult->getRedirectUrl()) && parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST)) {
|
||||||
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
|
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
|
||||||
self::setFailure($url);
|
self::setFailure($url);
|
||||||
self::detect($curlResult->getRedirectUrl(), $network, $only_nodeinfo);
|
self::detect($curlResult->getRedirectUrl(), $network, $only_nodeinfo);
|
||||||
|
@ -388,7 +388,7 @@ class GServer
|
||||||
|
|
||||||
$curlResult = DI::httpClient()->get($baseurl, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
$curlResult = DI::httpClient()->get($baseurl, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
|
||||||
if ($curlResult->isSuccess()) {
|
if ($curlResult->isSuccess()) {
|
||||||
if ((parse_url($baseurl, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
|
if (!empty($curlResult->getRedirectUrl()) && (parse_url($baseurl, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
|
||||||
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
|
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
|
||||||
self::setFailure($url);
|
self::setFailure($url);
|
||||||
self::detect($curlResult->getRedirectUrl(), $network, $only_nodeinfo);
|
self::detect($curlResult->getRedirectUrl(), $network, $only_nodeinfo);
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Apps extends BaseApi
|
||||||
{
|
{
|
||||||
return parent::run($request, false);
|
return parent::run($request, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,12 +24,18 @@ namespace Friendica\Module\OAuth;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acknowledgement of OAuth requests
|
* Acknowledgement of OAuth requests
|
||||||
*/
|
*/
|
||||||
class Acknowledge extends BaseApi
|
class Acknowledge extends BaseApi
|
||||||
{
|
{
|
||||||
|
public function run(array $request = [], bool $scopecheck = true): ResponseInterface
|
||||||
|
{
|
||||||
|
return parent::run($request, false);
|
||||||
|
}
|
||||||
|
|
||||||
protected function post(array $request = [])
|
protected function post(array $request = [])
|
||||||
{
|
{
|
||||||
DI::session()->set('oauth_acknowledge', true);
|
DI::session()->set('oauth_acknowledge', true);
|
||||||
|
|
|
@ -26,12 +26,18 @@ use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://docs.joinmastodon.org/spec/oauth/
|
* @see https://docs.joinmastodon.org/spec/oauth/
|
||||||
*/
|
*/
|
||||||
class Revoke extends BaseApi
|
class Revoke extends BaseApi
|
||||||
{
|
{
|
||||||
|
public function run(array $request = [], bool $scopecheck = true): ResponseInterface
|
||||||
|
{
|
||||||
|
return parent::run($request, false);
|
||||||
|
}
|
||||||
|
|
||||||
protected function post(array $request = [])
|
protected function post(array $request = [])
|
||||||
{
|
{
|
||||||
$request = $this->getRequest([
|
$request = $this->getRequest([
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\DI;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
use Friendica\Security\OAuth;
|
use Friendica\Security\OAuth;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://docs.joinmastodon.org/spec/oauth/
|
* @see https://docs.joinmastodon.org/spec/oauth/
|
||||||
|
@ -35,6 +36,11 @@ use Friendica\Util\DateTimeFormat;
|
||||||
*/
|
*/
|
||||||
class Token extends BaseApi
|
class Token extends BaseApi
|
||||||
{
|
{
|
||||||
|
public function run(array $request = [], bool $scopecheck = true): ResponseInterface
|
||||||
|
{
|
||||||
|
return parent::run($request, false);
|
||||||
|
}
|
||||||
|
|
||||||
protected function post(array $request = [])
|
protected function post(array $request = [])
|
||||||
{
|
{
|
||||||
$request = $this->getRequest([
|
$request = $this->getRequest([
|
||||||
|
|
Loading…
Reference in a new issue