From d3f1682f7810f73d8a221f414c8dbe9160612a09 Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Thu, 4 Mar 2021 10:04:25 +0100 Subject: [PATCH] also parse in-reply-to, fix random indieweb tags, use relative date in toot list --- content/notes/2021/02/26h13m48s6.md | 1 + content/notes/2021/02/26h13m4s14.md | 1 + content/notes/2021/02/26h13m8s52.md | 1 + content/notes/2021/02/26h19m55s59.md | 1 + content/notes/2021/02/27h14m25s16.md | 1 + content/notes/2021/02/27h17m51s39.md | 1 + content/notes/2021/02/27h18m0s19.md | 1 + content/notes/2021/02/28h11m47s37.md | 1 + content/notes/2021/03/01h20m3s35.md | 1 + content/notes/2021/03/02h13m18s54.md | 1 + content/notes/2021/03/02h17m13s27.md | 1 + content/notes/2021/03/02h17m18s46.md | 1 + content/notes/2021/03/03h16m0s44.md | 1 + content/notes/2021/03/04h8m47s31.md | 9 ++++++++ layouts/notes/single.html | 11 ++++++++-- masto-feed-parser.js | 10 +++++++-- package.json | 2 +- .../layouts/partials/toot.html | 21 ++++++++++++++++--- 18 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 content/notes/2021/03/04h8m47s31.md diff --git a/content/notes/2021/02/26h13m48s6.md b/content/notes/2021/02/26h13m48s6.md index 0d75e350..16357289 100644 --- a/content/notes/2021/02/26h13m48s6.md +++ b/content/notes/2021/02/26h13m48s6.md @@ -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" --- diff --git a/content/notes/2021/02/26h13m4s14.md b/content/notes/2021/02/26h13m4s14.md index 44ecd8cb..33ef103a 100644 --- a/content/notes/2021/02/26h13m4s14.md +++ b/content/notes/2021/02/26h13m4s14.md @@ -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" --- diff --git a/content/notes/2021/02/26h13m8s52.md b/content/notes/2021/02/26h13m8s52.md index a7986135..4d85e8ea 100644 --- a/content/notes/2021/02/26h13m8s52.md +++ b/content/notes/2021/02/26h13m8s52.md @@ -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" --- diff --git a/content/notes/2021/02/26h19m55s59.md b/content/notes/2021/02/26h19m55s59.md index 3a6f4a1c..e305517b 100644 --- a/content/notes/2021/02/26h19m55s59.md +++ b/content/notes/2021/02/26h19m55s59.md @@ -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" --- diff --git a/content/notes/2021/02/27h14m25s16.md b/content/notes/2021/02/27h14m25s16.md index 4f72cbae..c740f50e 100644 --- a/content/notes/2021/02/27h14m25s16.md +++ b/content/notes/2021/02/27h14m25s16.md @@ -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" --- diff --git a/content/notes/2021/02/27h17m51s39.md b/content/notes/2021/02/27h17m51s39.md index c72fdc04..2b58d16c 100644 --- a/content/notes/2021/02/27h17m51s39.md +++ b/content/notes/2021/02/27h17m51s39.md @@ -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" --- diff --git a/content/notes/2021/02/27h18m0s19.md b/content/notes/2021/02/27h18m0s19.md index 31819263..99d6380e 100644 --- a/content/notes/2021/02/27h18m0s19.md +++ b/content/notes/2021/02/27h18m0s19.md @@ -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" --- diff --git a/content/notes/2021/02/28h11m47s37.md b/content/notes/2021/02/28h11m47s37.md index 92d152cd..0cd5484a 100644 --- a/content/notes/2021/02/28h11m47s37.md +++ b/content/notes/2021/02/28h11m47s37.md @@ -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" --- diff --git a/content/notes/2021/03/01h20m3s35.md b/content/notes/2021/03/01h20m3s35.md index b65c5af3..1159fae9 100644 --- a/content/notes/2021/03/01h20m3s35.md +++ b/content/notes/2021/03/01h20m3s35.md @@ -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" --- diff --git a/content/notes/2021/03/02h13m18s54.md b/content/notes/2021/03/02h13m18s54.md index 4eb649ee..62db0bae 100644 --- a/content/notes/2021/03/02h13m18s54.md +++ b/content/notes/2021/03/02h13m18s54.md @@ -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" --- diff --git a/content/notes/2021/03/02h17m13s27.md b/content/notes/2021/03/02h17m13s27.md index c6e4ae04..47467f79 100644 --- a/content/notes/2021/03/02h17m13s27.md +++ b/content/notes/2021/03/02h17m13s27.md @@ -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" --- diff --git a/content/notes/2021/03/02h17m18s46.md b/content/notes/2021/03/02h17m18s46.md index 85c29a6b..ba1cb89a 100644 --- a/content/notes/2021/03/02h17m18s46.md +++ b/content/notes/2021/03/02h17m18s46.md @@ -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" --- diff --git a/content/notes/2021/03/03h16m0s44.md b/content/notes/2021/03/03h16m0s44.md index e729a29e..d1f55ccc 100644 --- a/content/notes/2021/03/03h16m0s44.md +++ b/content/notes/2021/03/03h16m0s44.md @@ -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" --- diff --git a/content/notes/2021/03/04h8m47s31.md b/content/notes/2021/03/04h8m47s31.md new file mode 100644 index 00000000..c228e872 --- /dev/null +++ b/content/notes/2021/03/04h8m47s31.md @@ -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 https://indieweb.org/Micropub ? Instead, I'm left to fiddling with Birdsite to manually https://indieweb.org/PESOS these things, after which I can finally use them in jefklakscodex.com/ ... As long as big companies only support silo infrastructures, we're left with PESOS instead of POSSE. + \ No newline at end of file diff --git a/layouts/notes/single.html b/layouts/notes/single.html index 20687b6c..318ca2cd 100644 --- a/layouts/notes/single.html +++ b/layouts/notes/single.html @@ -14,7 +14,7 @@

-

@@ -41,7 +48,7 @@

- Also posted on Mastodon by . + Also posted on Mastodon by . diff --git a/masto-feed-parser.js b/masto-feed-parser.js index 15f8994a..3412cb41 100644 --- a/masto-feed-parser.js +++ b/masto-feed-parser.js @@ -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: + 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: <span class="h-card.... + content: ent.decode(item.content['#text']), // format: <span class="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 diff --git a/package.json b/package.json index 1dc7a948..0c2ac086 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/themes/brainbaking-minimal/layouts/partials/toot.html b/themes/brainbaking-minimal/layouts/partials/toot.html index aca5174a..0697ee2e 100644 --- a/themes/brainbaking-minimal/layouts/partials/toot.html +++ b/themes/brainbaking-minimal/layouts/partials/toot.html @@ -4,11 +4,26 @@ {{ .Content }}
-