From 085762ec174eae1c519ec14db632f5ba197ed3c7 Mon Sep 17 00:00:00 2001 From: winter Date: Tue, 17 Dec 2024 18:39:18 +0000 Subject: hopefully implement push! again i can't really test this yet because i don't have two https instances that can talk to each other. soon i will set that up and test all these recent commits --- Digitigrade/Model/Note.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Digitigrade/Model/Note.php') diff --git a/Digitigrade/Model/Note.php b/Digitigrade/Model/Note.php index 3b7c362..1e867fa 100644 --- a/Digitigrade/Model/Note.php +++ b/Digitigrade/Model/Note.php @@ -3,7 +3,7 @@ namespace Digitigrade\Model; use Digitigrade\Db; -class Note extends FetchableModel implements \JsonSerializable { +class Note extends PushableModel { public ?int $id; public string $uri; public \DateTimeImmutable $created; @@ -44,6 +44,11 @@ class Note extends FetchableModel implements \JsonSerializable { $this->attachments = NoteAttachment::findAllWhere('note_id = ?', [$this->id]); } + protected function validate(): bool { + // author has to be from the same instance as the note itself + return hostname_from_uri($this->author->uri) == hostname_from_uri($this->uri); + } + private function findFormattedContents(): array { $pdo = Db::getInstance()->getPdo(); $stmt = $pdo->prepare('SELECT mimetype, body FROM note_formatted_content WHERE note_id = ?'); -- cgit v1.3