Compare commits

...

10 commits
v1.2.0 ... main

Author SHA1 Message Date
Ayo
3b5bf08541 feat: hide now link (for now) 2025-09-15 09:09:56 +02:00
Ayo
a8b77eca65 feat: update link sr.ht 2025-09-07 10:22:52 +02:00
Ayo
e79a6b29fc feat: add simple-tts in showcase 2025-09-05 14:11:15 +02:00
Ayo
29a29e4d63 chore(sw): update jsdoc 2025-08-26 01:23:30 +02:00
Ayo
343568042c refactor(sw): check for fallbackUrl 2025-08-26 00:53:34 +02:00
Ayo
f80807eebd chore(sw): add jsdoc 2025-08-26 00:47:00 +02:00
Ayo
f755588f58 chore: formatting 2025-08-26 00:25:55 +02:00
Ayo
410f43166c feat(sw): warn if failed to delete old cache 2025-08-26 00:20:08 +02:00
Ayo
0d0b9d44eb 1.3.0 2025-08-19 16:32:42 +02:00
Ayo
17e33c9659 feat(footer): show more social links; add forgejo 2025-08-19 16:28:03 +02:00
7 changed files with 72 additions and 21 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
dist/ dist/
.output/ .output/
.astro/ .astro/
.continue/
# dependencies # dependencies
node_modules/ node_modules/

View file

@ -1,7 +1,7 @@
{ {
"name": "@ayco/personal-website", "name": "@ayco/personal-website",
"type": "module", "type": "module",
"version": "1.2.0", "version": "1.3.0",
"private": true, "private": true,
"scripts": { "scripts": {
"astro": "astro", "astro": "astro",

View file

@ -32,8 +32,8 @@ const year = new Date().getFullYear()
aria-label={linkObj.text} aria-label={linkObj.text}
> >
<Icon <Icon
width="1.5em" width="1em"
height="1.5em" height="1em"
name={`${linkObj.set ?? 'simple-icons'}:${linkObj.icon}`} name={`${linkObj.set ?? 'simple-icons'}:${linkObj.icon}`}
/> />
</a> </a>

View file

@ -40,14 +40,24 @@ export const links: Link[] = [
export default links export default links
export const footerLinks: Link[] = [ export const footerLinks: Link[] = [
{
text: "Ayo's Forge",
url: 'https://git.ayo.run/ayo/',
icon: 'git',
},
{ {
text: 'SourceHut', text: 'SourceHut',
url: 'https://ayco.io/sh/', url: 'https://sr.ht/~ayoayco',
icon: 'sourcehut', icon: 'sourcehut',
}, },
{
text: 'GitHub',
url: 'https://ayco.io/gh',
icon: 'github',
},
{ {
text: 'Mastodon', text: 'Mastodon',
url: 'https://yolk.ayo.run/https://social.ayco.io/public/local', url: 'https://social.ayco.io/public/local',
icon: 'mastodon', icon: 'mastodon',
}, },
{ {
@ -56,9 +66,14 @@ export const footerLinks: Link[] = [
icon: 'pixelfed', icon: 'pixelfed',
}, },
{ {
text: 'GitHub', text: 'Bluesky',
url: 'https://ayco.io/gh', url: 'http://bsky.app/profile/ayco.io',
icon: 'github', icon: 'bluesky',
},
{
text: 'LinkedIn',
url: 'https://www.linkedin.com/in/ayoayco/',
icon: 'linkedin',
}, },
] ]

View file

@ -2,7 +2,7 @@
import Layout from '../layouts/Layout.astro' import Layout from '../layouts/Layout.astro'
import Card from '../components/Card.astro' import Card from '../components/Card.astro'
import Footer from '../components/Footer.astro' import Footer from '../components/Footer.astro'
import now from '../constants/now.json' // import now from '../constants/now.json'
--- ---
<Layout> <Layout>
@ -29,11 +29,11 @@ import now from '../constants/now.json'
<h1 title="Ayo Ayco | Software Engineer + Web Developer"> <h1 title="Ayo Ayco | Software Engineer + Web Developer">
Hi, I'm <span class="heavy-text">Ayo</span>! Hi, I'm <span class="heavy-text">Ayo</span>!
</h1> </h1>
<!-- <a href="https://forms.ayo.run/form/tnz7FybY" class="now-wrapper"> --> <!--a href="https://forms.ayo.run/form/tnz7FybY" class="now-wrapper"-->
<a href="/now" class="now-wrapper"> <!--a href="/now" class="now-wrapper">
<span class="now-label">now</span> <span class="now-label">now</span>
<span class="status">{now.title}</span> <span class="status">{now.title}</span>
</a> </a-->
</div> </div>
</div> </div>
</section> </section>

View file

@ -16,6 +16,12 @@ import Card from '../components/Card.astro'
>. >.
</p> </p>
<ul> <ul>
<Card
newTab
href="https://git.ayo.run/ayo/simple-tts#readme"
title="Simple TTS"
body="A simple machine learning text-to-speech program for the terminal"
/>
<Card <Card
newTab newTab
href="https://mcfly.js.org" href="https://mcfly.js.org"

View file

@ -6,17 +6,39 @@
const cacheName = `${__prefix ?? 'app'}-v${__version ?? '000'}` const cacheName = `${__prefix ?? 'app'}-v${__version ?? '000'}`
const forceLogging = true const forceLogging = true
/**
* Cleans up old service worker caches by deleting any cache that doesn't match the current cache name.
* This ensures only the current version of the application's cache is retained.
* @async
* @function cleanOldCaches
* @returns {Promise<void>} A promise that resolves when old caches have been deleted
*/
const cleanOldCaches = async () => { const cleanOldCaches = async () => {
const allowCacheNames = [cacheName] const allowCacheNames = [cacheName]
const allCaches = await caches.keys() const allCaches = await caches.keys()
allCaches.forEach((key) => { allCaches.forEach((key) => {
if (!allowCacheNames.includes(key)) { if (!allowCacheNames.includes(key)) {
console.info('Deleting old cache', key) console.info('Deleting old cache', key)
caches.delete(key) caches
.delete(key)
.then(() => {
console.info('Successfully deleted cache:', key)
})
.catch((error) => {
console.warn('Failed to delete old cache:', key, error)
})
} }
}) })
} }
/**
* Adds specified resources to the service worker cache.
* This function is used to cache static assets for offline access.
* @async
* @function addResourcesToCache
* @param {Array<string>} resources - An array of URLs representing the resources to be cached.
* @returns {Promise<void>} A promise that resolves when all resources have been successfully added to the cache.
*/
const addResourcesToCache = async (resources) => { const addResourcesToCache = async (resources) => {
const cache = await caches.open(cacheName) const cache = await caches.open(cacheName)
console.info('adding resources to cache...', { console.info('adding resources to cache...', {
@ -34,6 +56,14 @@ const addResourcesToCache = async (resources) => {
} }
} }
/**
* Puts a response in the cache.
* @async
* @function putInCache
* @param {Request} request - The request to be cached.
* @param {Response} response - The response to be cached.
* @returns {Promise<void>} A promise that resolves when the response has been added to the cache.
*/
const putInCache = async (request, response) => { const putInCache = async (request, response) => {
const cache = await caches.open(cacheName) const cache = await caches.open(cacheName)
@ -49,9 +79,6 @@ const networkFirst = async ({ request, fallbackUrl }) => {
try { try {
// Try to get the resource from the network for 5 seconds // Try to get the resource from the network for 5 seconds
const responseFromNetwork = await fetch(request.clone()) const responseFromNetwork = await fetch(request.clone())
// response may be used only once
// we need to save clone to put one copy in cache
// and serve second one
putInCache(request, responseFromNetwork.clone()) putInCache(request, responseFromNetwork.clone())
console.info('using network response', responseFromNetwork.url) console.info('using network response', responseFromNetwork.url)
return responseFromNetwork return responseFromNetwork
@ -64,12 +91,14 @@ const networkFirst = async ({ request, fallbackUrl }) => {
return responseFromCache return responseFromCache
} }
// Try the fallback // If fallback is provided, try to use it, otherwise return error
if (fallbackUrl) {
const fallbackResponse = await cache.match(fallbackUrl) const fallbackResponse = await cache.match(fallbackUrl)
if (fallbackResponse) { if (fallbackResponse) {
console.info('using fallback cached response...', fallbackResponse.url) console.info('using fallback cached response...', fallbackResponse.url)
return fallbackResponse return fallbackResponse
} }
}
// when even the fallback response is not available, // when even the fallback response is not available,
// there is nothing we can do, but we must always // there is nothing we can do, but we must always