-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Progressive Web App (PWA)" support #383
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "privacy.sexy", | ||
"short_name": "privacy.sexy", | ||
"description": "Enforce privacy & security best-practices on Windows, macOS and Linux, because privacy is sexy.", | ||
"version": "0.13.5", | ||
"start_url": "/", | ||
"display": "standalone", | ||
"background_color": "#ffffff", | ||
"theme_color": "#000000", | ||
"icons": [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to automatically update the icons. There's This helps maintaining the project by updating the logo in single file/place and knowing that it will be updated throughout the application after single command. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @undergroundwires, I attempted to run the icons:build command, but it is dependent on ImageMagick. The software uses the convert command, which conflicts with the convert.exe utility in Windows. The convert.exe file in Windows is a command-line utility used to convert file systems on a volume to FAT32 or NTFS. Due to this conflict, I am encountering several errors. |
||
{ | ||
"src": "icons/manifest-icon-192.maskable.png", | ||
"sizes": "192x192", | ||
"type": "image/png", | ||
"purpose": "any" | ||
}, | ||
{ | ||
"src": "icons/manifest-icon-192.maskable.png", | ||
"sizes": "192x192", | ||
"type": "image/png", | ||
"purpose": "maskable" | ||
}, | ||
{ | ||
"src": "icons/manifest-icon-512.maskable.png", | ||
"sizes": "512x512", | ||
"type": "image/png", | ||
"purpose": "any" | ||
}, | ||
{ | ||
"src": "icons/manifest-icon-512.maskable.png", | ||
"sizes": "512x512", | ||
"type": "image/png", | ||
"purpose": "maskable" | ||
} | ||
], | ||
"screenshots": [ | ||
{ | ||
"src": "screenshots/screenshot-1280x720.png", | ||
"sizes": "1280x720", | ||
"type": "image/png", | ||
"form_factor": "wide" | ||
}, | ||
{ | ||
"src": "screenshots/screenshot-1366x768.png", | ||
"sizes": "1366x768", | ||
"type": "image/png", | ||
"form_factor": "wide" | ||
}, | ||
{ | ||
"src": "screenshots/screenshot-1600x900.png", | ||
"sizes": "1600x900", | ||
"type": "image/png", | ||
"form_factor": "wide" | ||
}, | ||
{ | ||
"src": "screenshots/screenshot-1920x1080.png", | ||
"sizes": "1920x1080", | ||
"type": "image/png", | ||
"form_factor": "wide" | ||
} | ||
] | ||
Comment on lines
+36
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need those? If we do, it would be hard to maintain screenshots images on each version change. Can we create like a conceptual picture like this without really showing the application but a concept with cards and code section so it can be reused all the time? Or is the point of screenshot to be real screenshots? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can also use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We actually need screenshots of every sizes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another option is to use Or else, we can just remove the screenshots from this PR and think / solve in future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I will research on this as soon as possible 🫡 |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Event listener for when the service worker is installed | ||
self.addEventListener('install', (event) => { | ||
plantindesk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Log that the service worker has been installed | ||
console.log('Service Worker: Installed'); | ||
|
||
// Open a cache called 'app-cache' and add the following URLs to it | ||
event.waitUntil( | ||
caches.open('app-cache').then((cache) => { | ||
return cache.addAll([ | ||
'/', // root URL | ||
'/icon.png', | ||
'/favicon.ico', | ||
'/main.ts', | ||
]); | ||
}), | ||
); | ||
}); | ||
|
||
// Event listener for when the service worker receives a fetch event | ||
self.addEventListener('fetch', (event) => { | ||
// Log that the service worker is fetching a URL | ||
console.log('Service Worker: Fetching', event.request.url); | ||
|
||
// Respond with a cached response if it exists, otherwise fetch the URL | ||
event.respondWith( | ||
caches.match(event.request).then((response) => { | ||
// If a cached response exists, return it | ||
if (response) { | ||
console.log('Service Worker: Found in cache', event.request.url); | ||
return response; | ||
} | ||
|
||
// If no cached response exists, fetch the URL and cache the response | ||
const fetchRequest = event.request.clone(); | ||
return fetch(fetchRequest).then((response) => { | ||
// If the response is not valid, return it without caching | ||
if (!response || response.status !== 200 || response.type !== 'basic') { | ||
return response; | ||
} | ||
|
||
// Cache the response and return it | ||
const responseToCache = response.clone(); | ||
caches.open('app-cache').then((cache) => { | ||
cache.put(event.request, responseToCache); | ||
}); | ||
return response; | ||
}); | ||
}), | ||
); | ||
}); | ||
|
||
// Event listener for when the service worker is activated | ||
self.addEventListener('activate', (event) => { | ||
// Log that the service worker has been activated | ||
console.log('Service Worker: Activated'); | ||
|
||
// Remove old caches that start with 'app-' except for 'app-cache' | ||
event.waitUntil( | ||
caches.keys().then((cacheNames) => { | ||
return Promise.all( | ||
cacheNames.filter((cacheName) => { | ||
return cacheName.startsWith('app-') && cacheName !== 'app-cache'; | ||
}).map((cacheName) => { | ||
return caches.delete(cacheName); | ||
}), | ||
); | ||
}), | ||
); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version should be bumped automatically. It would be better use some kind of logic in the vite build system to read the latest version and output it here.