tiny whitewind client

just do slingshot anyways

+10 -14
+10 -14
index.php
··· 18 $converter = new MarkdownConverter($environment); 19 20 // short circuit if no other user is specified 21 - $me = "benharri.org"; 22 - $my_pds = "https://hellthread.pro"; 23 - $user = $_GET["user"] ?? $me; 24 - $pds = @$_GET["pds"]; 25 $format = $_GET["format"] ?? "html"; 26 27 - if ($user !== $me && empty($pds)) { 28 - $slingshot = json_decode(file_get_contents("https://slingshot.microcosm.blue/xrpc/com.bad-example.identity.resolveMiniDoc?identifier=$user")); 29 - $pds = $slingshot->pds; 30 - } 31 32 - $pds ??= $my_pds; 33 - $user_url = "?pds=$pds&user=$user"; 34 - $at_uri = "at://$user/com.whtwnd.blog.entry"; 35 36 if (isset($_GET["p"])) { 37 // get single post record 38 $query = http_build_query([ 39 - "repo" => $user, 40 "collection" => "com.whtwnd.blog.entry", 41 "rkey" => $_GET["p"] 42 ]); ··· 58 // get all posts 59 // TODO: pagination 60 $q = http_build_query([ 61 - "repo" => $user, 62 "collection" => "com.whtwnd.blog.entry", 63 "limit" => 100 64 ]); ··· 78 <link rel="alternate" type="text/markdown; variant=GFM" href="https://bhh.sh/pub/atblog/<?=$post_url?>&format=markdown"> 79 <?php } ?> 80 <link rel="alternate" href="<?=$at_uri?>"> 81 - <title>atblog: <?=$post["value"]["title"] ?? $did_doc->alsoKnownAs[0] ?? $user?></title> 82 </head> 83 84 <body>
··· 18 $converter = new MarkdownConverter($environment); 19 20 // short circuit if no other user is specified 21 + $user = $_GET["user"] ?? "benharri.org"; 22 $format = $_GET["format"] ?? "html"; 23 24 + $slingshot = json_decode(file_get_contents("https://slingshot.microcosm.blue/xrpc/com.bad-example.identity.resolveMiniDoc?identifier=$user")); 25 + $pds = $slingshot->pds; 26 + $did = $slingshot->did; 27 + $handle = $slingshot->handle; 28 29 + $user_url = "?user=$handle"; 30 + $at_uri = "at://$handle/com.whtwnd.blog.entry"; 31 32 if (isset($_GET["p"])) { 33 // get single post record 34 $query = http_build_query([ 35 + "repo" => $did, 36 "collection" => "com.whtwnd.blog.entry", 37 "rkey" => $_GET["p"] 38 ]); ··· 54 // get all posts 55 // TODO: pagination 56 $q = http_build_query([ 57 + "repo" => $did, 58 "collection" => "com.whtwnd.blog.entry", 59 "limit" => 100 60 ]); ··· 74 <link rel="alternate" type="text/markdown; variant=GFM" href="https://bhh.sh/pub/atblog/<?=$post_url?>&format=markdown"> 75 <?php } ?> 76 <link rel="alternate" href="<?=$at_uri?>"> 77 + <title>atblog: <?=$post["value"]["title"] ?? $handle?></title> 78 </head> 79 80 <body>