aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorwinter2024-12-23 22:26:46 +0000
committerwinter2024-12-23 22:26:46 +0000
commitaafbcc8fc1a07872fffa4d669117f41148e509a8 (patch)
tree0db483fc6883be0049590f612be8de9b025d2ab7
parent916d4521cb595493bc5df8b7f9ef52310b6d013a (diff)
rename "user" to actor and "post" to note everywhere
-rw-r--r--Digitigrade/Model/Actor.php22
-rw-r--r--Digitigrade/Model/Note.php6
-rw-r--r--routes/actor.php18
-rw-r--r--routes/actor_profile.php (renamed from routes/user.php)2
-rw-r--r--routes/homepage.php2
-rw-r--r--routes/note.php4
-rw-r--r--routes/webfinger.php2
-rw-r--r--templates/note.php2
8 files changed, 29 insertions, 29 deletions
diff --git a/Digitigrade/Model/Actor.php b/Digitigrade/Model/Actor.php
index d3589ae..3ad0efe 100644
--- a/Digitigrade/Model/Actor.php
+++ b/Digitigrade/Model/Actor.php
@@ -41,12 +41,12 @@ class Actor extends PushableModel implements RpcReceiver {
throw new \RuntimeException('an actor with that local handle already exists!');
}
$actor = new self();
- $actor->uri = path_to_uri("/user/$handle");
+ $actor->uri = path_to_uri("/actor/$handle");
$actor->isLocal = true;
$date = new \DateTimeImmutable();
$actor->created = $date;
$actor->modified = $date;
- // don't really need to set this as it's generated by the view at /user/:handle
+ // don't really need to set this as it's generated by the view at /actor/:handle
$actor->homepage = path_to_uri("/@/$handle");
$actor->handle = $handle;
$actor->displayName = $displayName ?? $handle;
@@ -56,7 +56,7 @@ class Actor extends PushableModel implements RpcReceiver {
// don't actually need to set these either
// just need to set the basicFeed since it's a required field
$actor->endpoints = new ActorEndpoints();
- $actor->endpoints->basicFeed = path_to_uri("/user/$handle/basicFeed");
+ $actor->endpoints->basicFeed = path_to_uri("/actor/$handle/basicFeed");
$actor->save();
return $actor;
}
@@ -212,13 +212,13 @@ class Actor extends PushableModel implements RpcReceiver {
if ($this->deleted) {
return [
'type' => 'tombstone',
- 'self' => path_to_uri("/user/$this->handle"),
+ 'self' => path_to_uri("/actor/$this->handle"),
'previousType' => 'actor'
];
}
return [
'type' => 'actor',
- 'self' => path_to_uri("/user/$this->handle"),
+ 'self' => path_to_uri("/actor/$this->handle"),
'created' => $this->created?->format('c'),
'modified' => $this->modified?->format('c'),
'homepage' => path_to_uri("/@/$this->handle"),
@@ -230,12 +230,12 @@ class Actor extends PushableModel implements RpcReceiver {
'automated' => $this->automated,
'requestToFollow' => $this->requestToFollow,
'endpoints' => [
- 'basicFeed' => path_to_uri("/user/$this->handle/basicFeed"),
- 'fullFeed' => path_to_uri("/user/$this->handle/fullFeed"),
- 'follow' => path_to_uri("/user/$this->handle/follow"),
- 'unfollow' => path_to_uri("/user/$this->handle/unfollow"),
- 'acceptedFollow' => path_to_uri("/user/$this->handle/acceptedFollow"),
- 'rejectedFollow' => path_to_uri("/user/$this->handle/rejectedFollow"),
+ 'basicFeed' => path_to_uri("/actor/$this->handle/basicFeed"),
+ 'fullFeed' => path_to_uri("/actor/$this->handle/fullFeed"),
+ 'follow' => path_to_uri("/actor/$this->handle/follow"),
+ 'unfollow' => path_to_uri("/actor/$this->handle/unfollow"),
+ 'acceptedFollow' => path_to_uri("/actor/$this->handle/acceptedFollow"),
+ 'rejectedFollow' => path_to_uri("/actor/$this->handle/rejectedFollow"),
]
];
}
diff --git a/Digitigrade/Model/Note.php b/Digitigrade/Model/Note.php
index 105f475..37ddff3 100644
--- a/Digitigrade/Model/Note.php
+++ b/Digitigrade/Model/Note.php
@@ -59,7 +59,7 @@ class Note extends PushableModel {
$note->privacy->indexable = $indexable;
$note->save();
- $note->uri = path_to_uri("/post/$note->id");
+ $note->uri = path_to_uri("/note/$note->id");
$note->save();
return $note;
@@ -137,13 +137,13 @@ class Note extends PushableModel {
if ($this->deleted) {
return [
'type' => 'tombstone',
- 'self' => path_to_uri("/post/$this->id"),
+ 'self' => path_to_uri("/note/$this->id"),
'previousType' => 'note'
];
}
return [
'type' => 'note',
- 'self' => path_to_uri("/post/$this->id"),
+ 'self' => path_to_uri("/note/$this->id"),
'created' => $this->created->format('c'),
'modified' => $this->modified?->format('c'),
'author' => $this->author->uri,
diff --git a/routes/actor.php b/routes/actor.php
index 8ebf1e2..d453a11 100644
--- a/routes/actor.php
+++ b/routes/actor.php
@@ -7,18 +7,18 @@ use Digitigrade\Model\Actor;
use Digitigrade\Model\Note;
use Digitigrade\Router;
-Router::getInstance()->mount('/user/:handle', function (array $args) {
+Router::getInstance()->mount('/actor/:handle', function (array $args) {
$actor = Actor::findLocalByHandle($args['handle']);
if ($actor == null || $actor->deleted) {
- throw new NotFound("i don't know any local user called " . $args['handle']);
+ throw new NotFound("i don't know any local actor called " . $args['handle']);
}
if (isset($_SERVER['HTTP_ACCEPT']) && str_contains($_SERVER['HTTP_ACCEPT'], 'text/html')) {
- throw new TemporaryRedirect(path_to_uri("/@/$actor->handle"));
+ throw new TemporaryRedirect("/@/$actor->handle");
}
json_response($actor);
});
-Router::getInstance()->mount('/user/:handle/basicFeed', function (array $args) {
+Router::getInstance()->mount('/actor/:handle/basicFeed', function (array $args) {
$actor = Actor::findLocalByHandle($args['handle']);
$notes = Note::findAllWithAuthor($actor);
// TODO: implement pagination
@@ -33,7 +33,7 @@ Router::getInstance()->mount('/user/:handle/basicFeed', function (array $args) {
]);
});
-Router::getInstance()->mount('/user/:handle/fullFeed', function (array $args) {
+Router::getInstance()->mount('/actor/:handle/fullFeed', function (array $args) {
$actor = Actor::findLocalByHandle($args['handle']);
$notes = Note::findAllWithAuthor($actor);
// TODO: implement pagination here as well
@@ -46,7 +46,7 @@ Router::getInstance()->mount('/user/:handle/fullFeed', function (array $args) {
]);
});
-Router::getInstance()->mount('/user/:handle/follow', function (array $args) {
+Router::getInstance()->mount('/actor/:handle/follow', function (array $args) {
$target = Actor::findLocalByHandle($args['handle']);
if ($target == null) {
throw new NotFound();
@@ -58,7 +58,7 @@ Router::getInstance()->mount('/user/:handle/follow', function (array $args) {
$initiator->follow($target);
});
-Router::getInstance()->mount('/user/:handle/unfollow', function (array $args) {
+Router::getInstance()->mount('/actor/:handle/unfollow', function (array $args) {
$target = Actor::findLocalByHandle($args['handle']);
if ($target == null) {
throw new NotFound();
@@ -70,7 +70,7 @@ Router::getInstance()->mount('/user/:handle/unfollow', function (array $args) {
$initiator->unfollow($target);
});
-Router::getInstance()->mount('/user/:handle/acceptedFollow', function (array $args) {
+Router::getInstance()->mount('/actor/:handle/acceptedFollow', function (array $args) {
$initiator = Actor::findLocalByHandle($args['handle']);
if ($initiator == null) {
throw new NotFound();
@@ -82,7 +82,7 @@ Router::getInstance()->mount('/user/:handle/acceptedFollow', function (array $ar
$target->acceptPendingFollowFrom($initiator);
});
-Router::getInstance()->mount('/user/:handle/rejectedFollow', function (array $args) {
+Router::getInstance()->mount('/actor/:handle/rejectedFollow', function (array $args) {
$initiator = Actor::findLocalByHandle($args['handle']);
if ($initiator == null) {
throw new NotFound();
diff --git a/routes/user.php b/routes/actor_profile.php
index c0a632a..4fea967 100644
--- a/routes/user.php
+++ b/routes/actor_profile.php
@@ -13,7 +13,7 @@ Router::getInstance()->mount('/@/:handle', function (array $args) {
$actor = Actor::findLocalByHandle($args['handle']);
}
if ($actor == null || $actor->deleted) {
- throw new NotFound("i don't know any user called " . $args['handle']);
+ throw new NotFound("i don't know any actor called " . $args['handle']);
}
render_template('actor_profile_page', ['actor' => $actor]);
}); \ No newline at end of file
diff --git a/routes/homepage.php b/routes/homepage.php
index 94fe4c9..c147d67 100644
--- a/routes/homepage.php
+++ b/routes/homepage.php
@@ -6,7 +6,7 @@ use Digitigrade\Router;
Router::getInstance()->mount('/', function (array $args) {
if (str_contains($_SERVER['HTTP_ACCEPT'] ?? '', 'text/html')) {
- throw new TemporaryRedirect(path_to_uri('/feed/global'));
+ throw new TemporaryRedirect('/feed/global');
}
throw new NotFound();
}); \ No newline at end of file
diff --git a/routes/note.php b/routes/note.php
index 4e0f867..071c86c 100644
--- a/routes/note.php
+++ b/routes/note.php
@@ -4,13 +4,13 @@ use Digitigrade\HttpResponseStatus\NotFound;
use Digitigrade\Model\Note;
use Digitigrade\Router;
-Router::getInstance()->mount('/post/:id', function (array $args) {
+Router::getInstance()->mount('/note/:id', function (array $args) {
$note = Note::find($args['id']);
if ($note == null || $note->deleted) {
throw new NotFound("i don't know that note");
}
if (!$note->author->isLocal) {
- throw new NotFound("i don't want to tell you about non local posts sorry");
+ throw new NotFound("i don't want to tell you about non local notes sorry");
}
json_response($note);
});
diff --git a/routes/webfinger.php b/routes/webfinger.php
index 541fb06..1b719cd 100644
--- a/routes/webfinger.php
+++ b/routes/webfinger.php
@@ -29,7 +29,7 @@ Router::getInstance()->mount('/.well-known/webfinger', function (array $args) {
'links' => [
[
'rel' => ActorWebfinger::REL_URI,
- 'href' => path_to_uri("/user/$actor->handle"),
+ 'href' => path_to_uri("/actor/$actor->handle"),
'type' => 'application/json'
]
]
diff --git a/templates/note.php b/templates/note.php
index 6fcb477..4f11d83 100644
--- a/templates/note.php
+++ b/templates/note.php
@@ -16,7 +16,7 @@
?>
</span>
</div>
- <div class="postContent">
+ <div class="content">
<?= $note->getFormattedContent('text/html') ?? htmlspecialchars($note->plainContent) ?>
</div>
</div>