Remember when you made an A+ post last year and everyone clapped bailey.tngl.io/remember-when
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

first version of getting posts

+49 -2
+1 -1
README.md
··· 9 9 ## TODO 10 10 11 11 - [x] input for the users handle or did 12 - - [ ] that input will look up the users posts for that day a year ago 12 + - [x] that input will look up the users posts for that day a year ago 13 13 - [ ] show the posts using bluesky's embed (keep it nice and simple) 14 14 - [ ] add in oauth login to repost the post 15 15 - [ ] publish on tangled
+48 -1
index.html
··· 12 12 <form id="lookupForm"> 13 13 <h1>Remember when?</h1> 14 14 <label>Atmosphere account:</label> 15 - <input id="handle" /> 15 + <input required id="handle" /> 16 16 <button type="submit">Remember</button> 17 17 </form> 18 18 </div> ··· 32 32 import { getPdsEndpoint } from "https://cdn.jsdelivr.net/npm/@atcute/identity/+esm"; 33 33 34 34 import * as TID from "https://cdn.jsdelivr.net/npm/@atcute/tid/+esm"; 35 + 36 + import { 37 + Client, 38 + simpleFetchHandler, 39 + } from "https://cdn.jsdelivr.net/npm/@atcute/client/+esm"; 35 40 36 41 const handleResolver = new CompositeHandleResolver({ 37 42 methods: { ··· 80 85 const lastYearTimestamp = thisDayLastYear.getTime() * 1_000; 81 86 const lastYearTid = TID.create(lastYearTimestamp, 23); 82 87 console.log(lastYearTid); 88 + 89 + const rpc = new Client({ 90 + handler: simpleFetchHandler({ 91 + service: pds, 92 + }), 93 + }); 94 + // https://selfhosted.social/xrpc/com.atproto.repo.listRecords?repo=did%3Aplc%3Arnpkyqnmsw4ipey6eotbdnnf&collection=app.bsky.feed.post&limit=100&reverse=false&cursor=3lnmguhip222r 95 + const response = await rpc.get( 96 + "com.atproto.repo.listRecords", 97 + { 98 + params: { 99 + repo: did, 100 + collection: "app.bsky.feed.post", 101 + limit: 100, 102 + reverse: true, 103 + cursor: lastYearTid, 104 + }, 105 + }, 106 + ); 107 + 108 + const posts = response.data.records; 109 + const postsFromThatDay = posts.filter((post) => { 110 + let postedDate = new Date(post.value.createdAt); 111 + // console.log( 112 + // postedDate.getDate(), 113 + // thisDayLastYear.getDate(), 114 + // ); 115 + 116 + // console.log( 117 + // postedDate.getMonth(), 118 + // thisDayLastYear.getMonth(), 119 + // ); 120 + 121 + return ( 122 + postedDate.getDate() === 123 + thisDayLastYear.getDate() && 124 + postedDate.getMonth() === 125 + thisDayLastYear.getMonth() && 126 + post.value.reply == null 127 + ); 128 + }); 129 + console.log(postsFromThatDay); 83 130 } catch (e) { 84 131 console.error(e); 85 132 alert("Failed to find posts from that day: " + e.message);