Compare commits
21 commits
Author | SHA1 | Date | |
---|---|---|---|
3b5bf08541 | |||
a8b77eca65 | |||
e79a6b29fc | |||
29a29e4d63 | |||
343568042c | |||
f80807eebd | |||
f755588f58 | |||
410f43166c | |||
0d0b9d44eb | |||
17e33c9659 | |||
e37836dd07 | |||
3f13ac28c4 | |||
f17673a404 | |||
02806a1563 | |||
1e1e4d6d4a | |||
516e9c459a | |||
079deaab41 | |||
a30afc3f3d | |||
cb373e49fd | |||
03bd251103 | |||
84e2c77078 |
11 changed files with 4837 additions and 17127 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
|||
dist/
|
||||
.output/
|
||||
.astro/
|
||||
.continue/
|
||||
|
||||
# dependencies
|
||||
node_modules/
|
||||
|
|
10
README.md
10
README.md
|
@ -29,9 +29,13 @@ $ pnpm i
|
|||
| `pnpm run deploy` | upload to my server |
|
||||
| `pnpm run prep:now` | back up and clear current `now page` constants |
|
||||
|
||||
> For the deploy script, you need to add an environmental variable named HOST
|
||||
## Deployment
|
||||
|
||||
For the script `npm run deploy`, you need to add an environmental variable named HOST containing the IP address of the host server. This will scp the build files into the server.
|
||||
|
||||
If you want to run build before deploying, do `npm run build:deploy`
|
||||
|
||||
-----
|
||||
|
||||
> Just keep building.
|
||||
> ~Ayo
|
||||
*Just keep building.*<br />
|
||||
*~Ayo*
|
||||
|
|
13094
package-lock.json
generated
13094
package-lock.json
generated
File diff suppressed because it is too large
Load diff
24
package.json
24
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@ayco/personal-website",
|
||||
"type": "module",
|
||||
"version": "1.1.0",
|
||||
"version": "1.3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"astro": "astro",
|
||||
|
@ -22,25 +22,25 @@
|
|||
"devDependencies": {
|
||||
"@astro-reactive/form": "^0.10.1",
|
||||
"@astro-reactive/validator": "^0.5.1",
|
||||
"@astrojs/sitemap": "^3.4.1",
|
||||
"@astrojs/sitemap": "^3.4.2",
|
||||
"@ayco/astro-sw": "^0.8.14",
|
||||
"@eslint/compat": "^1.3.1",
|
||||
"@eslint/js": "^9.30.1",
|
||||
"@eslint/js": "^9.32.0",
|
||||
"@iconify-json/mdi": "^1.2.3",
|
||||
"@iconify-json/simple-icons": "^1.2.42",
|
||||
"@iconify-json/tabler": "^1.2.19",
|
||||
"@typescript-eslint/parser": "^8.36.0",
|
||||
"astro": "^5.11.0",
|
||||
"@iconify-json/simple-icons": "^1.2.45",
|
||||
"@iconify-json/tabler": "^1.2.20",
|
||||
"@typescript-eslint/parser": "^8.38.0",
|
||||
"astro": "^5.12.8",
|
||||
"astro-eslint-parser": "^1.2.2",
|
||||
"astro-github-stats": "^0.8.0",
|
||||
"astro-icon": "^1.1.5",
|
||||
"consola": "^3.4.2",
|
||||
"eslint": "^9.30.1",
|
||||
"eslint": "^9.32.0",
|
||||
"eslint-plugin-astro": "^1.3.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"globals": "^16.3.0",
|
||||
"husky": "^9.1.7",
|
||||
"jiti": "^2.4.2",
|
||||
"jiti": "^2.5.1",
|
||||
"lint-staged": "^16.1.2",
|
||||
"pathe": "^2.0.3",
|
||||
"prettier": "^3.6.2",
|
||||
|
@ -49,8 +49,8 @@
|
|||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.1.2",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.36.0",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.38.0",
|
||||
"unified": "^11.0.5"
|
||||
},
|
||||
"lint-staged": {
|
||||
|
@ -62,5 +62,5 @@
|
|||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"packageManager": "pnpm@7.28.0+sha1.48be3292711ad554fe944f6caaf9b0f5477524fe"
|
||||
"packageManager": "pnpm@10.14.0"
|
||||
}
|
||||
|
|
8741
pnpm-lock.yaml
8741
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -32,8 +32,8 @@ const year = new Date().getFullYear()
|
|||
aria-label={linkObj.text}
|
||||
>
|
||||
<Icon
|
||||
width="1.5em"
|
||||
height="1.5em"
|
||||
width="1em"
|
||||
height="1em"
|
||||
name={`${linkObj.set ?? 'simple-icons'}:${linkObj.icon}`}
|
||||
/>
|
||||
</a>
|
||||
|
@ -47,7 +47,9 @@ const year = new Date().getFullYear()
|
|||
<a href="/">Ayo Ayco</a>. This website <a
|
||||
href="https://ayos.blog/stopped-tracking-on-my-sites"
|
||||
>does not track users</a
|
||||
>.
|
||||
>. See the <a href="https://git.sr.ht/~ayoayco/ayco.io-astro"
|
||||
>source code.</a
|
||||
>
|
||||
</p>
|
||||
|
||||
<WebRings />
|
||||
|
|
|
@ -40,11 +40,21 @@ export const links: Link[] = [
|
|||
export default links
|
||||
|
||||
export const footerLinks: Link[] = [
|
||||
{
|
||||
text: "Ayo's Forge",
|
||||
url: 'https://git.ayo.run/ayo/',
|
||||
icon: 'git',
|
||||
},
|
||||
{
|
||||
text: 'SourceHut',
|
||||
url: 'https://ayco.io/sh/',
|
||||
url: 'https://sr.ht/~ayoayco',
|
||||
icon: 'sourcehut',
|
||||
},
|
||||
{
|
||||
text: 'GitHub',
|
||||
url: 'https://ayco.io/gh',
|
||||
icon: 'github',
|
||||
},
|
||||
{
|
||||
text: 'Mastodon',
|
||||
url: 'https://social.ayco.io/public/local',
|
||||
|
@ -56,9 +66,14 @@ export const footerLinks: Link[] = [
|
|||
icon: 'pixelfed',
|
||||
},
|
||||
{
|
||||
text: 'GitHub',
|
||||
url: 'https://ayco.io/gh',
|
||||
icon: 'github',
|
||||
text: 'Bluesky',
|
||||
url: 'http://bsky.app/profile/ayco.io',
|
||||
icon: 'bluesky',
|
||||
},
|
||||
{
|
||||
text: 'LinkedIn',
|
||||
url: 'https://www.linkedin.com/in/ayoayco/',
|
||||
icon: 'linkedin',
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ const { title, description, ogImage } = Astro.props
|
|||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
a {
|
||||
color: var(--color-brand-blue-3);
|
||||
color: var(--text-color-light);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import Layout from '../layouts/Layout.astro'
|
||||
import Card from '../components/Card.astro'
|
||||
import Footer from '../components/Footer.astro'
|
||||
import now from '../constants/now.json'
|
||||
// import now from '../constants/now.json'
|
||||
---
|
||||
|
||||
<Layout>
|
||||
|
@ -29,11 +29,11 @@ import now from '../constants/now.json'
|
|||
<h1 title="Ayo Ayco | Software Engineer + Web Developer">
|
||||
Hi, I'm <span class="heavy-text">Ayo</span>!
|
||||
</h1>
|
||||
<!-- <a href="https://forms.ayo.run/form/tnz7FybY" class="now-wrapper"> -->
|
||||
<a href="/now" class="now-wrapper">
|
||||
<!--a href="https://forms.ayo.run/form/tnz7FybY" class="now-wrapper"-->
|
||||
<!--a href="/now" class="now-wrapper">
|
||||
<span class="now-label">now</span>
|
||||
<span class="status">{now.title}</span>
|
||||
</a>
|
||||
</a-->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
@ -16,6 +16,12 @@ import Card from '../components/Card.astro'
|
|||
>.
|
||||
</p>
|
||||
<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
|
||||
newTab
|
||||
href="https://mcfly.js.org"
|
||||
|
|
47
src/sw.mjs
47
src/sw.mjs
|
@ -6,17 +6,39 @@
|
|||
const cacheName = `${__prefix ?? 'app'}-v${__version ?? '000'}`
|
||||
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 allowCacheNames = [cacheName]
|
||||
const allCaches = await caches.keys()
|
||||
allCaches.forEach((key) => {
|
||||
if (!allowCacheNames.includes(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 cache = await caches.open(cacheName)
|
||||
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 cache = await caches.open(cacheName)
|
||||
|
||||
|
@ -49,9 +79,6 @@ const networkFirst = async ({ request, fallbackUrl }) => {
|
|||
try {
|
||||
// Try to get the resource from the network for 5 seconds
|
||||
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())
|
||||
console.info('using network response', responseFromNetwork.url)
|
||||
return responseFromNetwork
|
||||
|
@ -64,11 +91,13 @@ const networkFirst = async ({ request, fallbackUrl }) => {
|
|||
return responseFromCache
|
||||
}
|
||||
|
||||
// Try the fallback
|
||||
const fallbackResponse = await cache.match(fallbackUrl)
|
||||
if (fallbackResponse) {
|
||||
console.info('using fallback cached response...', fallbackResponse.url)
|
||||
return fallbackResponse
|
||||
// If fallback is provided, try to use it, otherwise return error
|
||||
if (fallbackUrl) {
|
||||
const fallbackResponse = await cache.match(fallbackUrl)
|
||||
if (fallbackResponse) {
|
||||
console.info('using fallback cached response...', fallbackResponse.url)
|
||||
return fallbackResponse
|
||||
}
|
||||
}
|
||||
|
||||
// when even the fallback response is not available,
|
||||
|
|
Loading…
Reference in a new issue