From 8079fa1880f9ef6e40d999285bcf0eb871adbbdc Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Wed, 27 Sep 2023 11:41:33 -0700 Subject: [PATCH] chore: update uses --- .eleventy.js | 8 ++++++++ .env | 4 ++-- src/_data/articles.js | 38 +++++++++++++++++++++----------------- src/uses.md | 5 +++-- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 65d99415..b6055027 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -91,6 +91,14 @@ module.exports = function (eleventyConfig) { if (tagString) tags[url] = tagString }) } + if (item.data.articles) { + item.data.articles.forEach((article) => { + const tagString = [...new Set(article.tags.map((tag) => tagAliases[tag.toLowerCase()]))] + .join(' ') + .trim() + if (tagString) tags[article.url] = tagString + }) + } }) return tags }) diff --git a/.env b/.env index 242f9d8d..a6cecfad 100644 --- a/.env +++ b/.env @@ -1,8 +1,8 @@ API_KEY_LASTFM= API_KEY_TRAKT= API_KEY_WEBMENTIONS_CORYD_DEV= +ACCESS_TOKEN_MATTER= SITE_ID_CLICKY= SITE_KEY_CLICKY= SECRET_FEED_ALBUM_RELEASES= -SECRET_FEED_GOODREADS= -SECRET_FEED_INSTAPAPER_LIKES= \ No newline at end of file +SECRET_FEED_GOODREADS= \ No newline at end of file diff --git a/src/_data/articles.js b/src/_data/articles.js index 7e892f8f..48a0c774 100644 --- a/src/_data/articles.js +++ b/src/_data/articles.js @@ -1,24 +1,28 @@ -const Parser = require('rss-parser') -const { AssetCache } = require('@11ty/eleventy-fetch') +const EleventyFetch = require('@11ty/eleventy-fetch') module.exports = async function () { - const parser = new Parser() - const url = process.env.SECRET_FEED_INSTAPAPER_LIKES - const asset = new AssetCache('articles_data') - if (asset.isCacheValid('1h')) return await asset.getCachedValue() - const res = await parser.parseURL(url).catch((error) => { - console.log(error.message) + const MATTER_TOKEN = process.env.ACCESS_TOKEN_MATTER + const headers = { Cookie: MATTER_TOKEN } + const url = `https://web.getmatter.com/api/library_items/favorites_feed` + const res = EleventyFetch(url, { + duration: '1h', + type: 'json', + fetchOptions: { headers }, }) - const articles = res.items.map((item) => { + const feed = await res + const articles = feed.feed + return articles.reverse().map((article) => { + const tags = article['content']['tags'].map((tag) => tag['name']) return { - title: item['title'], - date: item['pubDate'], - description: item['contentSnippet'], - url: item['link'], - id: item['guid'], - type: 'article', + url: article['content']['url'], + title: article['content']['title'], + date: article['content']['library']['modified_date'] + ? new Date(article['content']['library']['modified_date']) + : new Date(article['content']['publication_date']), + description: article['content']['excerpt'], + notes: article['content']['my_notes'] || '', + tags, + id: btoa(article['id']), } }) - await asset.save(articles, 'json') - return articles } diff --git a/src/uses.md b/src/uses.md index ca6fee55..2b250492 100644 --- a/src/uses.md +++ b/src/uses.md @@ -40,7 +40,7 @@ Software and services that I use for work and my own enjoyment. - [Orion](https://browser.kagi.com) - [Obsidian](https://obsidian.md) - [Mona](https://mastodon.social/@MonaApp) -- [ReadKit](https://readkit.app) +- [NetNewsWire](https://netnewswire.com) - [Parcel](https://parcelapp.net)

iOS

@@ -52,6 +52,7 @@ Software and services that I use for work and my own enjoyment. - [VS Code](https://code.visualstudio.com) - [iTerm2](https://iterm2.com) - [Magnet](https://magnet.crowdcafe.com) +- [Keyboard Maestro](https://www.keyboardmaestro.com) - [Bartender](https://www.macbartender.com) - [AirBuddy](https://v2.airbuddy.app) - [Lingon](https://www.peterborgapps.com/lingon) @@ -75,7 +76,7 @@ Software and services that I use for work and my own enjoyment. - [Mullvad](https://mullvad.net) - [Kagi](https://kagi.com) - [Feedbin](https://feedbin.com) -- [Instapaper](https://instapaper.com) +- [Matter](https://getmatter.com) - [forwardemail.net](https://forwardemail.net) - [1Password](https://1password.com) - [Spotify](https://spotify.com)