kopia lustrzana https://github.com/nextcloud/social
compat pleroma
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/619/head
rodzic
b3514342f7
commit
6f549f0b64
|
@ -191,6 +191,7 @@ class SignatureService {
|
|||
* @throws ItemUnknownException
|
||||
* @throws RequestResultNotJsonException
|
||||
* @throws DateTimeException
|
||||
* @throws UnauthorizedFediverseException
|
||||
*/
|
||||
public function checkRequest(IRequest $request, int &$time = 0): string {
|
||||
try {
|
||||
|
@ -310,6 +311,7 @@ class SignatureService {
|
|||
* @throws RequestContentException
|
||||
* @throws RequestResultSizeException
|
||||
* @throws RequestResultNotJsonException
|
||||
* @throws UnauthorizedFediverseException
|
||||
*/
|
||||
private function checkRequestSignature(IRequest $request): string {
|
||||
$signatureHeader = $request->getHeader('Signature');
|
||||
|
@ -351,10 +353,11 @@ class SignatureService {
|
|||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
$estimated = "(request-target): " . $target;
|
||||
$estimated = '';
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if ($key === '(request-target)') {
|
||||
$estimated .= "(request-target): " . $target;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -363,10 +366,10 @@ class SignatureService {
|
|||
$value = $this->configService->getCloudAddress(true);
|
||||
}
|
||||
|
||||
$estimated .= "\n" . $key . ': ' . $value;
|
||||
$estimated .= $key . ': ' . $value . "\n";
|
||||
}
|
||||
|
||||
return $estimated;
|
||||
return trim($estimated, "\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -449,6 +452,9 @@ class SignatureService {
|
|||
case 'rsa-sha512':
|
||||
return 'sha512';
|
||||
|
||||
case 'rsa-sha256':
|
||||
return 'sha256';
|
||||
|
||||
default:
|
||||
return 'sha256';
|
||||
}
|
||||
|
|
|
@ -46,14 +46,12 @@ if (!array_key_exists('resource', $_GET)) {
|
|||
$subject = $_GET['resource'];
|
||||
|
||||
$urlGenerator = OC::$server->getURLGenerator();
|
||||
|
||||
list($type, $account) = explode(':', $subject, 2);
|
||||
if ($type !== 'acct') {
|
||||
echo 'no acct';
|
||||
exit();
|
||||
if (strpos($subject, 'acct:') === 0) {
|
||||
list($type, $account) = explode(':', $subject, 2);
|
||||
} else {
|
||||
$account = $subject;
|
||||
}
|
||||
|
||||
|
||||
list($username, $instance) = explode('@', $account);
|
||||
try {
|
||||
$cacheActorService = OC::$server->query(CacheActorService::class);
|
||||
|
|
Ładowanie…
Reference in New Issue