also parse in-reply-to, fix random indieweb tags, use relative date in toot list

This commit is contained in:
Wouter Groeneveld 2021-03-04 10:04:25 +01:00
parent 11662c9f59
commit d3f1682f78
18 changed files with 58 additions and 8 deletions

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/1bab58d4-5bf3-472e-b268-ae2dd47dd24d"
context: ""
title: "Just saying hi @kogakure 👋 getting my feet wet with decentralized “tooting” (although I opted for..."
date: "2021-02-26T13:48:06"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/0707fd54-185d-4ee7-9204-be370d57663c"
context: ""
title: "@rubenerd just installed my own Pleroma server to say hi! Big fan of your micro-blog for ages here."
date: "2021-02-26T13:04:14"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/7b4e207f-47ed-4d2a-913e-9de73a1075c2"
context: ""
title: "Hi @laura thanks to your https://laurakalbag.com/what-is-mastodon-and-why-should-i-use-it/ I dipp..."
date: "2021-02-26T13:08:52"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/bd940e2d-12b0-4649-b198-053a49f81d34"
context: "https://mastodon.laurakalbag.com/users/laura/statuses/105798277886464888"
title: "@laura It did more than helping! I'm slowly but surely taking back my data. Started with Ever..."
date: "2021-02-26T19:55:59"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/f5fd9f27-460c-4984-aaf4-843788b94419"
context: ""
title: "Has anyone else noticed posted links on Twitter get re-encoded into t.co URLs in order to gather ..."
date: "2021-02-27T14:25:16"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/0a54f23f-d362-4b12-9d67-3f8a4945d5ae"
context: ""
title: "Trying to wrap my mind around WebMentions and how I could implement them without resorting to a t..."
date: "2021-02-27T17:51:39"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/fe700d1f-bc60-4707-bed1-45f9dfdf507c"
context: "https://chat.brainbaking.com/objects/0a54f23f-d362-4b12-9d67-3f8a4945d5ae"
title: "Okay, so sending involves Webmention.app and IFTTT to poll my RSS feed (According to https://www...."
date: "2021-02-27T18:00:19"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/eceb0da5-f424-4acb-b5ae-65a820d8b1eb"
context: "https://vis.social/users/darth_mall/statuses/105580591640900315"
title: "@darth_mall Interesting, did you use Bridgy to convert Mastodon posts into webmentions? Many site..."
date: "2021-02-28T11:47:37"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/77a3ecfb-47e1-4d7a-a24a-8b779d80a8ac"
context: ""
title: "I pulled the Google plug and installed LineageOS: https://brainbaking.com/post/2021/03/getting-ri..."
date: "2021-03-01T20:03:35"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/feb772dc-ffec-45c9-be75-51d56c5457ff"
context: "https://aus.social/users/aussocialadmin/statuses/105817435308293091"
title: "@aussocialadmin Great! I didn't even know https://joinmobilizon.org/ existed, thanks for shar..."
date: "2021-03-02T13:18:54"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/e31b1547-31b5-4a35-8c6d-535cdaec4725"
context: "https://social.linux.pizza/users/StampedingLonghorn/statuses/105821068976933063"
title: "@StampedingLonghorn @256 Don't forget the cleverly hidden Roland MT-32, a majestic piece of p..."
date: "2021-03-02T17:13:27"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/2e58289c-f5f0-415c-b2e1-62c74662aa16"
context: "https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793"
title: "@StampedingLonghorn I tried to chase him away, but you know how that turned out... 😼 There's ..."
date: "2021-03-02T17:18:46"
---

View File

@ -1,5 +1,6 @@
---
source: "https://chat.brainbaking.com/objects/2eb068ac-176f-4e25-a6db-53eca0342575"
context: ""
title: "Heads up RSS feed readers of brainbaking.com! Federated half-baked thoughts (https://brainbaking...."
date: "2021-03-03T16:00:44"
---

View File

@ -0,0 +1,9 @@
---
source: "https://chat.brainbaking.com/objects/ff55324d-bef9-40a5-96f3-2528e7d25333"
context: ""
title: "Dog-walk thought: how cool would it be if the Nintendo Switch would support publishing screenshot..."
date: "2021-03-04T08:47:31"
---
Dog-walk thought: how cool would it be if the Nintendo Switch would support publishing screenshots through <a href="https://indieweb.org/Micropub" rel="ugc">https://indieweb.org/Micropub</a> ? Instead, I&#39;m left to fiddling with Birdsite to manually <a href="https://indieweb.org/PESOS" rel="ugc">https://indieweb.org/PESOS</a> these things, after which I can finally use them in <a href="http://jefklakscodex.com/" rel="ugc">jefklakscodex.com/</a> ... As long as big companies only support silo infrastructures, we&#39;re left with PESOS instead of POSSE.

View File

@ -14,7 +14,7 @@
</h2>
<h3>
<time datetime='{{ .Date.Format "2006-01-02" }}' class="dt-published">
<time datetime='{{ .Date.Format "2006-01-02T15:04:00" }}' class="dt-published">
<svg class='icon icon-text' width='24' height='24'>
<use xlink:href='#cal1'></use>
</svg>
@ -29,6 +29,13 @@
</svg>
<a class="p-category u-url" href="/notes">notes</a>
</span>
{{ with .Params.context }}
&nbsp;|&nbsp;
<svg class='icon icon-text' width='24' height='24'>
<use xlink:href='#discuss'></use>
</svg>
<a href="{{ . }}">In reply to</a><br/>
{{ end }}
</h3>
</header>
<div class="inmargin">
@ -41,7 +48,7 @@
</div>
<hr/>
Also posted <svg class='icon icon-text' width='16' height='16'><use xlink:href='#discuss'></use></svg><a href="{{ .Params.source }}" rel="syndication" class="u-syndication">on Mastodon</a> by <a rel="author" href="{{ .Site.BaseURL }}about">{{ .Site.Author.name }}</a>.
Also posted <svg class='icon icon-text' width='16' height='16'><use xlink:href='#discuss'></use></svg><a href="{{ .Params.source }}" rel="syndication" class="u-syndication">on Mastodon</a> by <a rel="author" class="p-author h-card" href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>.
</article>
</main>

View File

@ -38,6 +38,7 @@ function convertAtomItemToMd(item) {
const mddata = `---
source: "${item.url}"
context: "${item.context}"
title: "${item.title}"
date: "${item.year}-${item.month}-${item.day}T${strpad(item.date.getHours())}:${strpad(item.date.getMinutes())}:${strpad(item.date.getSeconds())}"
---
@ -60,17 +61,22 @@ ${item.content}
timeout: 5000,
retry: 5
});
const root = parser.parse(buffer.toString())
const root = parser.parse(buffer.toString(), {
ignoreAttributes: false
})
const items = root.feed.entry.map(item => {
const date = new Date(item.published)
const year = date.getFullYear()
const month = strpad(date.getMonth() + 1)
const day = strpad(date.getDate())
// format: <thr:in-reply-to ref='https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793' href='https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793'/>
const context = item['thr:in-reply-to'] ? item['thr:in-reply-to']['@_ref'] : ""
return {
title: ent.decode(item.title), // summary (cut-off) of content
content: ent.decode(item.content), // format: &lt;span class=&quot;h-card....
content: ent.decode(item.content['#text']), // format: &lt;span class=&quot;h-card....
url: item.id, // format: https://chat.brainbaking.com/objects/0707fd54-185d-4ee7-9204-be370d57663c
context,
id: stripBeforeLastSlash(item.id),
hash: `${day}h${date.getHours()}m${date.getMinutes()}s${date.getSeconds()}`,
date, // format: 2021-03-02T16:18:46.658056Z

View File

@ -15,7 +15,7 @@
},
"scripts": {
"build": "/usr/local/bin/hugo",
"install": "node goodreads-fetch.js > static/js/goodreads.js && node build-lunr-index.js > static/js/brainbaking-post.json"
"install": "node masto-feed-parser.js && node goodreads-fetch.js > static/js/goodreads.js && node build-lunr-index.js > static/js/brainbaking-post.json"
},
"repository": {
"type": "git",

View File

@ -4,11 +4,26 @@
{{ .Content }}
</div>
<div class="meta">
<time datetime='{{ .Date.Format "2006-01-02" }}' class="dt-published">
<time datetime='{{ .Date.Format "2006-01-02T15:04:00" }}' class="dt-published">
<svg class='icon icon-text' width='24' height='24'>
<use xlink:href='#cal1'></use>
</svg>
{{ .Date.Format "2 Jan 2006, 15:04" }}
</svg>
<!-- ty, https://kodify.net/hugo/date-time/relative-age-hugo/ -->
{{ $ageDays := div (sub now.Unix .Date.Unix) 86400 }}
{{ $ageMonths := div (sub now.Unix .Date.Unix) 2592000 }}
{{ if eq $ageDays 0 }}
Today
{{ else if lt $ageDays 31 }}
{{ $ageDays }}
{{ cond (eq $ageDays 1) "day" "days"}}
ago
{{ else }}
{{ $ageMonths }}
{{ cond (eq $ageMonths 1) "month" "months" }}
ago
{{ end }}
</time>
&nbsp;|&nbsp;
<a href="{{ .RelPermalink }}" class="permalink">Permalink</a>