i made a tiny frontend for whtwnd blogs
<?php
require_once 'vendor/autoload.php';
use League\CommonMark\CommonMarkConverter;
// short circuit if no other user is specified
$me = "benharri.org";
$mypds = "https://hellthread.pro";
$user = $_GET["user"] ?? $me;
if ($user !== $me) {
if (str_starts_with($user, "did:plc:")) {
$did_url = "https://plc.diretory/$user";
} else if (str_starts_with($user, "did:web:")) {
$web = str_replace("did:web:", "", $user);
$did_url = "https://$web/.well-known/did.json";
} else {
// we didn't get a did so we need to fetch it by handle
$did = json_decode(file_get_contents(
"https://hellthread.pro/xrpc/com.atproto.identity.resolveHandle?handle=$user"
))->did;
$did_url = "https://plc.diretory/$did";
}
$did_doc = json_decode(file_get_contents($did_url));
$pds = $did_doc->service[0]->serviceEndpoint;
}
$pds ??= $mypds;
$posts = json_decode(file_get_contents(
"$pds/xrpc/com.atproto.repo.listRecords?repo=$user&collection=com.whtwnd.blog.entry"
), true)["records"];
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="gruvbox.css">
<title>@<?=$did_doc->alsoKnownAs ?? $user?>'s atblog</title>
</head>
<body>
<main>
<p>
<a href="https://pdsls.dev/at/<?=$user?>/com.whtwnd.blog.entry">
at://<?=$user?>/com.whtwnd.blog.entry
</a>
</p>
<?php if (isset($_GET["p"])) {
// render individual post
foreach ($posts as $p) {
if ($_GET["p"] === explode('/', $p["uri"])[4]) {
$post = $p;
break;
}
}
$converter = new CommonMarkConverter();
?>
<a href="<?=$user === $me ? "." : "?user=$user"?>">back</a>
<h1><?=$post["value"]["title"]?></h1>
<?=$converter->convert($post["value"]["content"])->getContent()?>
<?php } else { ?>
<ul>
<?php foreach ($posts as $post) { ?>
<li><a href="?p=<?=explode('/', $post["uri"])[4]?><?=$user === $me ? "" : "&user=$user"?>">
<?=$post["value"]["title"]?>
</a></li>
<?php } ?>
</ul>
<?php } ?>
</main>
</body>
</html>
a bit of hacky php and it works
composer require league/commonmark
in the same dir and it's up and running.
pass a ?user query param and it will find your PDS and get your posts for you.
for example:
it's living in my pub dir for now.