offload now calls + generation to 11ty; add activity feed; cleanup

This commit is contained in:
Cory Dransfeldt 2023-03-16 13:25:57 -07:00
parent 4bd059bc90
commit 4dd6cc9313
No known key found for this signature in database
18 changed files with 192 additions and 93 deletions

View file

@ -23,6 +23,7 @@
<link rel="pingback" href="https://webmention.io/coryd.dev/xmlrpc" />
<link type="application/atom+xml" rel="alternate" title="Cory Dransfeldt" href="/feed.xml">
<link rel="alternate" type="application/json" title="Cory Dransfeldt" href="/feed.json" />
<link rel="alternate" href="/follow.xml" title="Cory Dransfeldt's activity feed" type="application/rss+xml">
<script>
const isDarkMode = () => localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
if (isDarkMode()) {
@ -44,43 +45,6 @@
document.documentElement.classList.add('dark')
}
});
;(function () {
const nowPlayingWrapper = document.getElementById("now-playing");
if (nowPlayingWrapper) {
try {
const localStorageKey = "CD_NOW_PLAYING";
const cachedTemplate = localStorage.getItem(localStorageKey);
if (window.localStorage && cachedTemplate) {
nowPlayingWrapper.innerHTML = "";
nowPlayingWrapper.insertAdjacentHTML("beforeEnd", cachedTemplate);
}
fetch("https://utils.coryd.dev/api/music?limit=1")
.then((response) => response.json())
.then((data) => {
const track = data.recenttracks.track[0];
const artistName = track.artist["#text"];
const template = `<a href="${
track.url
}" class="no-underline dark:text-white text-gray-800 font-normal">${
track.name
}</a> by <a href="https://ddg.gg?q=!rym ${encodeURIComponent(
artistName
)}" class="no-underline dark:text-white text-gray-800 font-normal">${artistName}</a>`;
if (window.localStorage)
localStorage.setItem(localStorageKey, template);
nowPlayingWrapper.innerHTML = "";
nowPlayingWrapper.insertAdjacentHTML("beforeEnd", template);
});
} catch (e) {
nowPlayingWrapper.innerHTML = "";
}
}
})();
</script>
</body>
</html>

View file

@ -1,13 +1,5 @@
<div class="border-b border-gray-200 pb-8 dark:border-gray-700 mb-8 pb-8 dark:text-white text-gray-800">
<a class="no-underline" href="/now"><h2 class="m-0 text-xl font-black leading-tight tracking-normal md:text-2xl text-primary-500 hover:text-primary-400 mb-4">Now</h2></a>
<p>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.</p>
<p>{{ status.emoji }} {{ status.content }}</p>
<p class="mb-0">
<span class="icon-inline">
{% heroicon "solid" "music-note" "Now playing" "width=20 height=20" %}
</span>
<span id="now-playing">
<span class="blur-md">Loading track</span>
</span>
</p>
<p class="mb-0">{{ status.emoji }} {{ status.content }}</p>
</div>

View file

@ -29,7 +29,7 @@ layout: main
<div class="pl-4 md:pl-8">
<p class="my-2"><span class="icon-inline mr-1">{% heroicon "solid" "terminal" "Terminal" "width=20 height=20" %}</span> Hacking away on random projects like this page, my <a href="/">blog</a>, and whatever else I can find time for.</p>
</div>
{% if now.artists %}
{% if artists %}
<h2
class="m-0 text-xl font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4"
>
@ -37,7 +37,7 @@ layout: main
</h2>
<div>
<div class="grid grid-cols-2 gap-2 md:grid-cols-4 not-prose">
{% for artist in now.artists %}
{% for artist in artists %}
<a href="{{artist.url}}" title="{{artist.name | escape}}">
<div class="relative block">
<div class="absolute left-0 top-0 h-full w-full rounded-lg border border-primary-500 bg-cover-gradient dark:border-gray-500"></div>
@ -61,7 +61,7 @@ layout: main
</div>
</div>
{% endif %}
{% if now.albums %}
{% if albums %}
<h2
class="m-0 text-xl font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4"
>
@ -69,7 +69,7 @@ layout: main
</h2>
<div>
<div class="grid grid-cols-2 gap-2 md:grid-cols-4 not-prose">
{% for album in now.albums %}
{% for album in albums %}
<a href="{{album.url}}" title="{{album.name | escape}}">
<div class="relative block">
<div class="absolute left-0 top-0 h-full w-full rounded-lg border border-primary-500 bg-cover-gradient dark:border-gray-500"></div>
@ -94,7 +94,7 @@ layout: main
</div>
</div>
{% endif %}
{% if now.books %}
{% if books %}
<h2
class="m-0 text-xl font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-6 mb-4"
>
@ -102,7 +102,7 @@ layout: main
</h2>
<div>
<ul class="list-inside list-disc pl-5 md:pl-10">
{% for book in now.books %}
{% for book in books %}
<li class="mt-1.5 mb-2">
<a href="{{book.link}}" title="{{book.title | escape}}">
{{book.title}}
@ -112,7 +112,7 @@ layout: main
</ul>
</div>
{% endif %}
{% if now.movies %}
{% if movies %}
<h2
class="m-0 text-xl font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-6 mb-4"
>
@ -120,7 +120,7 @@ layout: main
</h2>
<div>
<ul class="list-inside list-disc pl-5 md:pl-10">
{% for movie in now.movies %}
{% for movie in movies %}
<li class="mt-1.5 mb-2">
<a href="{{movie.link}}" title="{{movie.title | escape}}">
{{movie.title}}
@ -130,7 +130,7 @@ layout: main
</ul>
</div>
{% endif %}
{% if now.tv %}
{% if tv %}
<h2
class="m-0 text-xl font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-6 mb-4"
>
@ -138,7 +138,7 @@ layout: main
</h2>
<div>
<ul class="list-inside list-disc pl-5 md:pl-10">
{% for show in now.tv %}
{% for show in tv %}
<li class="mt-1.5 mb-2">
<a href="{{show.link}}" title="{{show.title | escape}}">
{{show.title}}