diff --git a/index.php b/index.php
index 222dc3c..91d73c1 100644
--- a/index.php
+++ b/index.php
@@ -1198,20 +1198,26 @@ echo <<< HTML
HTML;
+
+ // HTML is *probably* sanitised by the sender. But let's not risk it, eh?
+ // Using the allow-list from https://docs.joinmastodon.org/spec/activitypub/#sanitization
+ $allowed_elements = ["p", "span", "br", "a", "del", "pre", "code", "em", "strong", "b", "i", "u", "ul", "ol", "li", "blockquote"];
+
// Print the items in a list
foreach ( $inbox_ordered as $published=>$inbox_message ) {
// Set up the common components
$object = $inbox_message["object"];
+ if ( isset( $inbox_message["object"]["id"] ) ) {
+ $id = $inbox_message["object"]["id"];
+ } else {
+ $id = "";
+ }
$actor = $inbox_message["actor"];
$actorName = end( explode("/", $actor ) );
$actorHTML = "@{$actorName}";
- $timeHTML = "";
+ $timeHTML = "";
- // HTML is *probably* sanitised by the sender. But let's not risk it, eh?
- // Using the allow-list from https://docs.joinmastodon.org/spec/activitypub/#sanitization
- $allowed_elements = ["p", "span", "br", "a", "del", "pre", "code", "em", "strong", "b", "i", "u", "ul", "ol", "li", "blockquote"];
-
// What type of message is this?
$type = $inbox_message["type"];
@@ -1219,7 +1225,23 @@ HTML;
if ( "Create" == $type || "Update" == $type ) {
// Get the HTML content and sanitise it.
$content = $object["content"];
- $content = strip_tags($content, $allowed_elements);
+ $content = strip_tags( $content, $allowed_elements );
+
+ // Is this a reply to something?
+ if ( isset( $object["inReplyTo"] ) ) {
+ $replyToURl = $object["inReplyTo"];
+ $replyTo = " in reply to $replyToURl";
+ } else {
+ $replyTo = "";
+ }
+
+ // Check to see if there is a Content Warning
+ if ( isset( $object["summary"] ) ) {
+ $summary = $object["summary"];
+ $summary = strip_tags( $summary, $allowed_elements );
+
+ $content = "{$summary}
{$content} ";
+ }
// Add any images
if ( isset( $object["attachment"] ) ) {
@@ -1249,9 +1271,9 @@ HTML;
"Create" == $type ? $verb = "wrote" : $verb = "updated";
if ( $reply ) {
// Highlight that this is a reply
- echo "- {$timeHTML} {$actorHTML} {$verb}:
{$content}
";
+ echo "- {$timeHTML} {$actorHTML} {$verb}{$replyTo}:
{$content}
";
} else {
- echo "- {$timeHTML} {$actorHTML} {$verb}:
{$content}
";
+ echo "- {$timeHTML} {$actorHTML} {$verb}{$replyTo}:
{$content}
";
}
} else if ( "Like" == $type ) {