-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added service worker & ready for deploy
- Loading branch information
1 parent
6c47a86
commit 41b60f8
Showing
15 changed files
with
237 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Build website | ||
run: npx vite build --base=image-converter | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: 'dist' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"name": "image-converter", | ||
"short_name": "image-converter", | ||
"start_url": "index.html", | ||
"display": "standalone", | ||
"background_color": "#151515", | ||
"theme_color": "#138375", | ||
"orientation": "any", | ||
"icons": [ | ||
{ | ||
"src": "./icon.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"file_handlers": [ | ||
{ | ||
"action": "./", | ||
"accept": { | ||
"image/jpeg": [ | ||
".jpg", | ||
".jpeg", | ||
".jfif", | ||
".pjpeg", | ||
".pjp", | ||
".heic", | ||
".heif", | ||
".heifs", | ||
".heics" | ||
], | ||
"image/png": [ | ||
".png" | ||
], | ||
"image/gif": [ | ||
".gif" | ||
], | ||
"image/webp": [ | ||
".webp" | ||
], | ||
"image/avif": [ | ||
".avif" | ||
], | ||
"image/apng": [ | ||
".apng" | ||
], | ||
"image/bmp": [ | ||
".bmp" | ||
], | ||
"image/x-icon": [ | ||
".ico", | ||
".cur" | ||
], | ||
"image/tiff": [ | ||
".tiff", | ||
".tif" | ||
], | ||
"image/heic": [ | ||
".heif", | ||
".heifs", | ||
".heic", | ||
".heics" | ||
], | ||
"image/heif": [ | ||
".heif", | ||
".heifs", | ||
".heic", | ||
".heics" | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const cacheName = 'imageconverter-cache'; | ||
const filestoCache = [ | ||
'./', | ||
'./index.html', | ||
'./icon.png', | ||
'./assets/icon.svg', | ||
'./assets/heic2any.js', | ||
'./assets/index.css', | ||
'./assets/index.js', | ||
'./assets/index2.js', | ||
'./assets/UTIF.js', | ||
'https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;700&display=swap' | ||
]; | ||
self.addEventListener('install', e => { | ||
e.waitUntil( | ||
caches.open(cacheName) | ||
.then(cache => cache.addAll(filestoCache)) | ||
); | ||
}); | ||
self.addEventListener('activate', e => self.clients.claim()); | ||
self.addEventListener('fetch', event => { | ||
const req = event.request; | ||
if (req.url.indexOf("updatecode") !== -1) return fetch(req); else event.respondWith(networkFirst(req)); | ||
}); | ||
|
||
async function networkFirst(req) { | ||
try { | ||
const networkResponse = await fetch(req); | ||
const cache = await caches.open('imageconverter-cache'); | ||
await cache.delete(req); | ||
await cache.put(req, networkResponse.clone()); | ||
return networkResponse; | ||
} catch (error) { | ||
const cachedResponse = await caches.match(req); | ||
return cachedResponse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import TitleIcon from "./Styles/TitleIcon.svelte"; | ||
</script> | ||
|
||
<div class="card"> | ||
<TitleIcon asset="apps">Install as a PWA:</TitleIcon> | ||
<p> | ||
Install image-rerender as a Progressive Web App to use it offline and to | ||
open images directly from File Explorer / Finder | ||
</p> | ||
<i> | ||
Install it by clicking on the "Install" button at the right of the | ||
address (Chromium) or by adding this website to the home from the Share | ||
menu (Safari) | ||
</i> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters