Skip to content

Commit

Permalink
add basic pwa support
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcottle committed Nov 17, 2024
1 parent 47b3efe commit ed4d0ff
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="flex bg-white p-2 border-b h-16">
<div class="my-auto mr-2">
<img src="../assets/icon.png" class="size-12 rounded"/>
<img src="/icon.png" class="size-12 rounded"/>
</div>
<div class="my-auto mr-auto">
<div class="font-bold">MeshTXT</div>
Expand Down
9 changes: 8 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<title>MeshTXT</title>
<meta name="title" content="MeshTXT">
<meta name="description" content="A simple, mobile friendly, web based Meshtastic client.">
<link rel="icon" type="image/png" href="assets/icon.png"/>
<link rel="icon" type="image/png" href="icon.png"/>
<link rel="manifest" href="/manifest.json">

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
Expand All @@ -21,5 +22,11 @@
<body>
<div id="app" class="bg-gray-100"></div>
<script type="module" src="main.js"></script>
<script>
// install service worker to allow for pwa install
if('serviceWorker' in navigator){
navigator.serviceWorker.register('/service-worker.js');
}
</script>
</body>
</html>
17 changes: 17 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "MeshTXT",
"short_name": "MeshTXT",
"description": "A simple, mobile friendly, web based Meshtastic client.",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "icon.png",
"sizes": "512x512",
"type": "image/png"
}
],
"display": "standalone",
"theme_color": "#FFFFFF",
"background_color": "#FFFFFF"
}
File renamed without changes
4 changes: 4 additions & 0 deletions src/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
self.addEventListener('fetch',function() {
// this is required to meet the requirements for an installable pwa
// it allows the browser to ask the user if they want to install to their homescreen
});

0 comments on commit ed4d0ff

Please sign in to comment.