Skip to content

Commit

Permalink
modified: astro.config.mjs
Browse files Browse the repository at this point in the history
	modified:   public/manifest.json
	new file:   public/sw.js
	modified:   src/components/BaseHead.astro
	modified:   src/components/Layout/Footer.astro
  • Loading branch information
s0u7a committed Nov 17, 2023
1 parent 2b1de2d commit 79e4031
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
5 changes: 3 additions & 2 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { defineConfig } from 'astro/config';
import cloudflare from "@astrojs/cloudflare";

import tailwind from "@astrojs/tailwind";
// https://astro.build/config
export default defineConfig({
output: "server",
adapter: cloudflare(),
integrations: [tailwind()],
integrations: [
tailwind()
],
site: "https://s0u7a.net"
});
36 changes: 13 additions & 23 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,74 +6,64 @@
"start_url": "/",
"display": "standalone",
"orientation": "any",
"background_color": "#fff",
"theme_color": "#fff",
"background_color": "#0F172A",
"theme_color": "#0F172A",
"icons": [
{
"src": "/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-128x128.png",
"sizes": "128x128",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-152x152.png",
"sizes": "152x152",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png",
"purpose": "maskable"
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
"purpose": "any maskable"
}
]
}
10 changes: 10 additions & 0 deletions public/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
self.addEventListener('activate', (event) => {
event.waitUntil(self.clients.claim());
});
self.addEventListener('install', (event) => {
console.log('インストール');
event.waitUntil(self.skipWaiting());
});
self.addEventListener("fetch", (e) => {
console.log("[Service Worker] Fetched resource " + e.request.url);
});
4 changes: 4 additions & 0 deletions src/components/BaseHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ function parseOGP(link: string): string {
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content={Astro.generator} />
<meta name="theme-color" content="#0F172A"/>
<link rel="canonical" href="https://s0u7a.net/" />
<title>{title}</title>
<!-- OGP -->
<meta property="og:locale" content="ja_JP" />
<meta property="og:type" content="website" />
<meta property="og:type" content="website">
<meta property="og:title" content={title}>
<meta property="og:description" content={description}>
Expand Down Expand Up @@ -86,4 +89,5 @@ function parseOGP(link: string): string {
<link rel="icon" type="image/png" sizes="24x24" href="/icon-24x24.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icon-32x32.png">
<link rel="manifest" href="/manifest.json">
<script>const registerServiceWorker=async()=>{if("serviceWorker"in navigator)try{let e=await navigator.serviceWorker.register("/sw.js",{scope:"/"});e.installing?console.log("Service worker installing"):e.waiting?console.log("Service worker installed"):e.active&&console.log("Service worker active")}catch(r){console.error(`Registration failed with ${r}`)}};registerServiceWorker();</script>
<ViewTransitions />
2 changes: 1 addition & 1 deletion src/components/Layout/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---

<footer class="fixed bottom-0 left-0 z-20 w-full p-4 bg-white border-t border-gray-200 shadow md:flex md:items-center md:justify-between md:p-6 dark:bg-gray-800 dark:border-gray-600">
<span class="text-sm text-gray-500 sm:text-center dark:text-gray-400">© 2023 <a href="https://flowbite.com/" class="hover:underline">Flowbite™</a>. All Rights Reserved.
<span class="text-sm text-gray-500 sm:text-center dark:text-gray-400">© 2023 <a href="https://s0u7a.net/" class="hover:underline">s0u7a</a>. All Rights Reserved.
</span>
<ul class="flex flex-wrap items-center mt-3 text-sm font-medium text-gray-500 dark:text-gray-400 sm:mt-0">
<li>
Expand Down

0 comments on commit 79e4031

Please sign in to comment.