diff options
| author | winter | 2024-12-17 18:39:18 +0000 |
|---|---|---|
| committer | winter | 2024-12-17 18:39:18 +0000 |
| commit | 085762ec174eae1c519ec14db632f5ba197ed3c7 (patch) | |
| tree | 9ad49bc839b5f72ded47c119ff01a09dfa0b934a /Digitigrade/Model/Note.php | |
| parent | bc2cd99b108b8755a648c3915714e7c0e0771548 (diff) | |
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
Diffstat (limited to 'Digitigrade/Model/Note.php')
| -rw-r--r-- | Digitigrade/Model/Note.php | 7 |
1 files changed, 6 insertions, 1 deletions
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 = ?'); |
