kopia lustrzana https://github.com/nextcloud/social
rodzic
4c013f149f
commit
3e9ca2f940
|
@ -33,7 +33,6 @@ namespace OCA\Social\Model\ActivityPub\Object;
|
|||
use DateTime;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Model\ActivityPub\ACore;
|
||||
use OCA\Social\Service\SignatureService;
|
||||
|
||||
|
||||
class Note extends ACore implements JsonSerializable {
|
||||
|
@ -195,7 +194,6 @@ class Note extends ACore implements JsonSerializable {
|
|||
*/
|
||||
public function convertPublished() {
|
||||
$dTime = new DateTime($this->getPublished());
|
||||
$dTime->format(SignatureService::DATE_FORMAT);
|
||||
$this->setPublishedTime($dTime->getTimestamp());
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,9 @@ class SignatureService {
|
|||
const ORIGIN_SIGNATURE = 2;
|
||||
|
||||
|
||||
const DATE_FORMAT = 'D, d M Y H:i:s T';
|
||||
const DATE_HEADER = 'D, d M Y H:i:s T';
|
||||
const DATE_OBJECT = 'Y-m-d\TH:i:s\Z';
|
||||
|
||||
const DATE_DELAY = 30;
|
||||
|
||||
|
||||
|
@ -135,7 +137,7 @@ class SignatureService {
|
|||
* @throws SocialAppConfigException
|
||||
*/
|
||||
public function signRequest(Request $request, RequestQueue $queue) {
|
||||
$date = gmdate(self::DATE_FORMAT);
|
||||
$date = gmdate(self::DATE_HEADER);
|
||||
$path = $queue->getInstance();
|
||||
|
||||
$localActor = $this->actorsRequest->getFromId($queue->getAuthor());
|
||||
|
@ -178,7 +180,6 @@ class SignatureService {
|
|||
*/
|
||||
public function checkRequest(IRequest $request, int &$time = 0): string {
|
||||
$dTime = new DateTime($request->getHeader('date'));
|
||||
$dTime->format(self::DATE_FORMAT);
|
||||
$time = $dTime->getTimestamp();
|
||||
|
||||
if ($time < (time() - self::DATE_DELAY)) {
|
||||
|
@ -249,7 +250,7 @@ class SignatureService {
|
|||
$signature->setPrivateKey($actor->getPrivateKey());
|
||||
$signature->setType('RsaSignature2017');
|
||||
$signature->setCreator($actor->getId() . '#main-key');
|
||||
$signature->setCreated($object->getPublished());
|
||||
$signature->setCreated($date = gmdate(self::DATE_OBJECT));
|
||||
$signature->setObject(json_decode(json_encode($object), true));
|
||||
|
||||
try {
|
||||
|
|
Ładowanie…
Reference in New Issue