From 7e78638894ce360f163211972add009fce4874bf Mon Sep 17 00:00:00 2001 From: osmarks Date: Thu, 20 Aug 2026 12:33:06 +0100 Subject: [PATCH] redirect microblog --- src/global.json | 19 +++++++++++++++---- src/index.js | 37 +++++++++++++++++++++---------------- templates/blogPost.pug | 4 ++-- templates/layout.pug | 3 ++- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/src/global.json b/src/global.json index 99cf888..088770d 100644 --- a/src/global.json +++ b/src/global.json @@ -42,7 +42,6 @@ "Things Of Interest":"https://qntm.org/rss.php", "Chips and Cheese": "https://chipsandcheese.com/feed", "BOFH": "https://www.theregister.com/offbeat/bofh/headlines.atom", - "Don't Worry About the Vase": "https://thezvi.substack.com/feed", "KGOnTech": "https://kguttag.com/feed/", "Overcoming Bias": "https://www.overcomingbias.com/feed", "Construction Physics": "https://www.construction-physics.com/feed", @@ -69,10 +68,21 @@ "astrid dot tech": "https://astrid.tech/feed", "Stanichor": "https://stanichor.net/feed.xml", "Mariven": "https://mariven.substack.com/feed", - "Pylon of the Month": "https://pylonofthemonth.org/feed/" + "Pylon of the Month": "https://pylonofthemonth.org/feed/", + "benjojo blog": "https://blog.benjojo.co.uk/rss.xml", + "The Linchpin": "https://linch.substack.com/feed", + "BLDGBLOG": "https://bldgblog.com/feed/", + "Metal Ivy": "https://ivy0.substack.com/feed", + "Nanofactory Project": "https://nanofactory.substack.com/feed", + "Nick vs Networking": "https://nickvsnetworking.com/feed/", + "Nicole Kornher-Stace": "http://nicolekornherstace.com/feed/", + "Igor's Blog": "https://igor-blue.github.io/feed.xml", + "Jay Carlson": "https://jaycarlson.net/feed", + "Libertarian Development": "https://developmentalism.substack.com/feed", + "The Electric Grandma": "https://meredithangwin.substack.com/feed" }, "dateFormat": "YYYY-MM-DD", - "microblogSource": "https://b.osmarks.net/@o/feed.rss?min_id=0&limit=4000", + "microblogSource": "http://osmarks.net/feed/jsonfeed.json", "buttons": [ ["arch_btw.png", "https://archlinux.org/"], ["dyson_sphere.png", "https://www.schlockmercenary.com/2001-07-02"], @@ -105,7 +115,8 @@ ["merging.gif", "https://merge.moe/"], ["aacs.png", "https://en.wikipedia.org/wiki/Illegal_number"], ["dhmo.gif", "https://www.dhmo.org/"], - ["kiwix.gif", "https://a.osmarks.net"] + ["kiwix.gif", "https://a.osmarks.net"], + ["philpxa.gif", "https://philpax.me/"] ], "mycorrhiza": "https://docs.osmarks.net", "tagColors": { diff --git a/src/index.js b/src/index.js index d24861f..c4d0b93 100644 --- a/src/index.js +++ b/src/index.js @@ -99,6 +99,7 @@ const fetchLinksOut = async () => { if (!url.endsWith(".pdf")) { try { // I don't know why, but without the timeout race configured here + // What was that comment meant to say? const response = await Promise.race([ axiosInst({ url }), new Promise((_, reject) => @@ -114,7 +115,7 @@ const fetchLinksOut = async () => { console.warn(chalk.red(`Failed to fetch ${url}: ${e.message}`)) } } - if (article && article.title) { + if (article && article.title && !article.title.includes("Checking your browser")) { meta.excerpt = article.excerpt meta.title = article.title meta.author = article.byline && article.byline.split("\n")[0] @@ -382,7 +383,7 @@ const processExperiments = async () => { fts.pushEntry("experiment", { url: "/" + page.data.slug, title: page.data.title, - description: page.data.description, + description: fts.stripHTML(page.data.description), html: page.content, timestamp: dayjs(await fsp.stat(path.join(subdirectory, "index.html")).then(x => x.mtimeMs)) }) @@ -406,24 +407,28 @@ const processBlog = async () => { processTags(meta) const [html, urls] = renderMarkdown(page.content) meta.content = html - meta.references = [] + meta.extraReferences = [] meta.sourceFile = file meta.markdownAlt = `/${meta.slug}/index.md` + meta.references = [] for (const url of urls) { try { - const parsed = new URL(url) - if (parsed.protocol === "http:" || parsed.protocol === "https:") { - parsed.hash = "" // TODO handle this more cleanly - if (!links[parsed]) { - links[parsed] = { - inline: true - } - links[parsed].references = links[parsed].references ?? [] - links[parsed].references.push(meta.slug) + var parsed = new URL(url) + } catch (e) { + var parsed = url + } + if (parsed.protocol === "http:" || parsed.protocol === "https:") { + parsed.hash = "" // TODO handle this more cleanly + if (!links[parsed]) { + links[parsed] = { + inline: true } } - } catch (e) {} + links[parsed].references = links[parsed].references ?? [] + links[parsed].references.push(meta.slug) + meta.references.push(links[parsed]) + } } // this is quite inefficient but we don't have many links so whatever @@ -431,7 +436,7 @@ const processBlog = async () => { if (umeta.referenceIn) { const refText = umeta.referenceIn[meta.slug] if (refText !== undefined) { - meta.references.push({ + meta.extraReferences.push({ description: refText, ...links[url] }) @@ -548,7 +553,7 @@ const processEntry = (entry, feed, feedName) => { } entry.title = fts.stripHTML(entry.title) entry.published = dayjs(entry.published) - entry.content = cutDesc(fts.stripHTML(entry.description)) + entry.content = cutDesc(fts.stripHTML(entry.content_html || entry.description)) entry.feedName = feedName } @@ -567,7 +572,6 @@ const fetchMicroblog = async () => { } for (const post of globalData.microblog) { - if (!post.description) { continue } const desc = fts.stripHTML(post.content_html) fts.pushEntry("microblog", { url: post.url, @@ -802,6 +806,7 @@ const buildFTS = async () => { console.log(chalk.yellow("Building full-text search index")) const blob = fts.build() await fsp.writeFile(path.join(outDir, "fts.bin"), blob) + await childProcess.spawn("gzip", ["-f", "--", path.join(outDir, "fts.bin")]) } const tasks = { diff --git a/templates/blogPost.pug b/templates/blogPost.pug index 68c1656..02779d5 100644 --- a/templates/blogPost.pug +++ b/templates/blogPost.pug @@ -3,10 +3,10 @@ extends layout.pug block content div.content.blog-post!= content - if references.length > 0 + if extraReferences.length > 0 h2 See also div - each ref in references + each ref in extraReferences div.box.ref(style=generateBoxPattern(ref.url)) a.title(href=ref.url)= ref.title div.deemph diff --git a/templates/layout.pug b/templates/layout.pug index c94ff61..52a4a61 100644 --- a/templates/layout.pug +++ b/templates/layout.pug @@ -35,7 +35,8 @@ html(lang="en") link(rel="stylesheet", href="/assets/katex.min.css") if highlightCode link(rel="stylesheet", href="/assets/highlight.min.css") - link(rel="alternate", type="application/rss+xml", title="RSS", href="/rss.xml") + link(rel="alternate", type="application/rss+xml", title="Blog RSS", href="/rss.xml") + link(rel="alternate", type="application/rss+xml", title="Microblog RSS", href="/feed/rss.xml") style!= css if comments !== "off" script(src=`https://${domain}/rsapi/static/comments.js`, async=true)