diff --git a/.eleventy.js b/.eleventy.js index e54c1241..e2d61d13 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -10,6 +10,9 @@ const dateFilters = require('./config/dateFilters.js') const mediaFilters = require('./config/mediaFilters.js') const now = String(Date.now()) +// load .env +require('dotenv-flow').config() + module.exports = function (eleventyConfig) { // plugins eleventyConfig.addPlugin(syntaxHighlight) diff --git a/.env b/.env index ea30b615..af635f99 100644 --- a/.env +++ b/.env @@ -4,4 +4,4 @@ API_KEY_WEBMENTIONS_CORYD_DEV= API_KEY_MASTODON= VERCEL_SYNDICATE_KEY= TOKEN_CORYDDEV_GISTS= -GITHUB_TOKEN= \ No newline at end of file +GITHUB_TOKEN= diff --git a/.github/workflows/manual-build.yaml b/.github/workflows/manual-build.yaml index 6b2a9ad0..59f6846a 100644 --- a/.github/workflows/manual-build.yaml +++ b/.github/workflows/manual-build.yaml @@ -1,4 +1,4 @@ -name: manual-build +name: Manual Vercel build env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} diff --git a/.github/workflows/scheduled-build.yaml b/.github/workflows/scheduled-build.yaml index fefcd37a..482094b3 100644 --- a/.github/workflows/scheduled-build.yaml +++ b/.github/workflows/scheduled-build.yaml @@ -1,4 +1,4 @@ -name: scheduled-build +name: Scheduled Vercel build env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} diff --git a/package.json b/package.json index f2e2ae27..1bd574d9 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,14 @@ "sanitize-html": "^2.10.0" }, "dependencies": { + "@11ty/eleventy-activity-feed": "^1.0.9", "@11ty/eleventy-fetch": "^3.0.0", "@11ty/eleventy-img": "^3.0.0", + "@extractus/feed-extractor": "^6.2.1", "@sherby/eleventy-plugin-files-minifier": "^1.1.1", "@tailwindcss/typography": "^0.5.1", "autoprefixer": "^10.4.2", + "dotenv-flow": "^3.2.0", "eleventy-plugin-unfurl": "^1.0.0", "liquidjs": "^10.6.1", "markdown-it": "^13.0.1", diff --git a/src/_data/albums.js b/src/_data/albums.js new file mode 100644 index 00000000..8048a4f9 --- /dev/null +++ b/src/_data/albums.js @@ -0,0 +1,12 @@ +const EleventyFetch = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const MUSIC_KEY = process.env.API_KEY_LASTFM + const url = `http://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user=cdme_&api_key=${MUSIC_KEY}&limit=8&format=json&period=7day` + const res = EleventyFetch(url, { + duration: '1h', + type: 'json', + }) + const albums = await res + return albums.topalbums.album +} diff --git a/src/_data/artists.js b/src/_data/artists.js new file mode 100644 index 00000000..f64c72a0 --- /dev/null +++ b/src/_data/artists.js @@ -0,0 +1,12 @@ +const EleventyFetch = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const MUSIC_KEY = process.env.API_KEY_LASTFM + const url = `http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user=cdme_&api_key=${MUSIC_KEY}&limit=8&format=json&period=7day` + const res = EleventyFetch(url, { + duration: '1h', + type: 'json', + }) + const artists = await res + return artists.topartists.artist +} diff --git a/src/_data/books.js b/src/_data/books.js new file mode 100644 index 00000000..8658e455 --- /dev/null +++ b/src/_data/books.js @@ -0,0 +1,12 @@ +const { extract } = require('@extractus/feed-extractor') +const { AssetCache } = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const url = 'https://oku.club/rss/collection/POaRa' + const asset = new AssetCache('books_data') + if (asset.isCacheValid('1h')) return await asset.getCachedValue() + const res = await extract(url).catch((error) => {}) + const data = res.entries + await asset.save(data, 'json') + return data +} diff --git a/src/_data/movies.js b/src/_data/movies.js new file mode 100644 index 00000000..d1b6b4a6 --- /dev/null +++ b/src/_data/movies.js @@ -0,0 +1,12 @@ +const { extract } = require('@extractus/feed-extractor') +const { AssetCache } = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const url = 'https://letterboxd.com/cdme/rss' + const asset = new AssetCache('movies_data') + if (asset.isCacheValid('1h')) return await asset.getCachedValue() + const res = await extract(url).catch((error) => {}) + const data = res.entries.splice(0, 5) + await asset.save(data, 'json') + return data +} diff --git a/src/_data/now.js b/src/_data/now.js deleted file mode 100644 index f176dec9..00000000 --- a/src/_data/now.js +++ /dev/null @@ -1,17 +0,0 @@ -const EleventyFetch = require('@11ty/eleventy-fetch') - -module.exports = async function () { - const url = 'https://utils.coryd.dev/api/now?endpoints=artists,albums,books,movies,tv' - const res = EleventyFetch(url, { - duration: '1h', - type: 'json', - }) - const now = await res - return { - artists: now.artists, - albums: now.albums, - books: now.books, - movies: now.movies, - tv: now.tv, - } -} diff --git a/src/_data/nowplaying.js b/src/_data/nowplaying.js deleted file mode 100644 index b2ff8b9f..00000000 --- a/src/_data/nowplaying.js +++ /dev/null @@ -1,15 +0,0 @@ -const EleventyFetch = require('@11ty/eleventy-fetch') - -module.exports = async function () { - const url = 'https://utils.coryd.dev/api/music?limit=1' - const res = EleventyFetch(url, { - duration: '3m', - type: 'json', - }) - const music = await res - return { - artist: music.recenttracks.track[0].artist['#text'], - title: music.recenttracks.track[0].name, - url: music.recenttracks.track[0].url, - } -} diff --git a/src/_data/tv.js b/src/_data/tv.js new file mode 100644 index 00000000..2f741a6e --- /dev/null +++ b/src/_data/tv.js @@ -0,0 +1,13 @@ +const { extract } = require('@extractus/feed-extractor') +const { AssetCache } = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const TV_KEY = process.env.API_KEY_TRAKT + const url = `https://trakt.tv/users/cdransf/history.atom?slurm=${TV_KEY}` + const asset = new AssetCache('tv_data') + if (asset.isCacheValid('1h')) return await asset.getCachedValue() + const res = await extract(url).catch((error) => {}) + const data = res.entries.splice(0, 5) + await asset.save(data, 'json') + return data +} diff --git a/src/_data/webmentions.js b/src/_data/webmentions.js index fc4e0a8b..f813ed44 100644 --- a/src/_data/webmentions.js +++ b/src/_data/webmentions.js @@ -1,7 +1,8 @@ const EleventyFetch = require('@11ty/eleventy-fetch') module.exports = async function () { - const url = 'https://utils.coryd.dev/api/webmentions' + const KEY_CORYD = process.env.API_KEY_WEBMENTIONS_CORYD_DEV + const url = `https://webmention.io/api/mentions.jf2?token=${KEY_CORYD}&per-page=1000` const res = EleventyFetch(url, { duration: '1h', type: 'json', diff --git a/src/_includes/base.liquid b/src/_includes/base.liquid index 45a9830f..e84d6e42 100644 --- a/src/_includes/base.liquid +++ b/src/_includes/base.liquid @@ -23,6 +23,7 @@ + diff --git a/src/_includes/now-topper.liquid b/src/_includes/now-topper.liquid index 7a20d8da..f860fe90 100644 --- a/src/_includes/now-topper.liquid +++ b/src/_includes/now-topper.liquid @@ -1,13 +1,5 @@

Now

I'm a software developer in Camarillo, California. I enjoy hanging out with my beautiful family and 4 rescue dogs, technology, automation, music, writing, reading and tv and movies.

-

{{ status.emoji }} {{ status.content }}

-

- - {% heroicon "solid" "music-note" "Now playing" "width=20 height=20" %} - - - Loading track - -

+

{{ status.emoji }} {{ status.content }}

diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index 4f67678d..0b93a915 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -29,7 +29,7 @@ layout: main

{% heroicon "solid" "terminal" "Terminal" "width=20 height=20" %} Hacking away on random projects like this page, my blog, and whatever else I can find time for.

- {% if now.artists %} + {% if artists %}

@@ -37,7 +37,7 @@ layout: main

- {% for artist in now.artists %} + {% for artist in artists %}
@@ -61,7 +61,7 @@ layout: main
{% endif %} - {% if now.albums %} + {% if albums %}

@@ -69,7 +69,7 @@ layout: main

{% endif %} - {% if now.books %} + {% if books %}

@@ -102,7 +102,7 @@ layout: main

{% endif %} - {% if now.movies %} + {% if movies %}

@@ -120,7 +120,7 @@ layout: main

{% endif %} - {% if now.tv %} + {% if tv %}

@@ -138,7 +138,7 @@ layout: main