diff --git a/CHANGELOG.md b/CHANGELOG.md index 93c8febfc269..e2fdff243728 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ## Unreleased ### Added +- Add basic Progressive Web App support - The ability to escape `|` characters with `\` in Stats API filter values - An upper bound of 1000 to the `limit` parameter in Stats API - The `exclusions` script extension now also takes a `data-include` attribute tag diff --git a/assets/js/app.js b/assets/js/app.js index 9c2bb174d5f1..423d9824aaf4 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -117,3 +117,7 @@ if (embedButton) { } }) } + +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( 'serviceWorker.js' ); +} diff --git a/assets/static/app.webmanifest b/assets/static/app.webmanifest new file mode 100644 index 000000000000..dcdf40540ba3 --- /dev/null +++ b/assets/static/app.webmanifest @@ -0,0 +1,41 @@ +{ + "dir": "ltr", + "lang": "en", + "short_name": "Plausible", + "name": "Plausible Analytics", + "icons": [ + { + "src": "/images/icon/plausible_logo.svg", + "type": "image/svg+xml", + "sizes": "any" + }, + { + "src": "/images/icon/plausible_logo_192px.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "/images/icon/plausible_logo_192px_maskable.png", + "type": "image/png", + "sizes": "192x192", + "purpose": "maskable" + }, + { + "src": "/images/icon/plausible_logo_512px.png", + "type": "image/png", + "sizes": "512x512" + }, + { + "src": "/images/icon/plausible_logo_512px_maskable.png", + "type": "image/png", + "sizes": "512x512", + "purpose": "maskable" + } + ], + "start_url": "/", + "background_color": "#252f3f", + "display": "standalone", + "orientation": "portrait", + "theme_color": "#5850ec", + "description": "Web analytics tools" +} \ No newline at end of file diff --git a/assets/static/images/icon/plausible_logo.svg b/assets/static/images/icon/plausible_logo.svg new file mode 100644 index 000000000000..f0d0449ffefa --- /dev/null +++ b/assets/static/images/icon/plausible_logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/static/images/icon/plausible_logo_192px.png b/assets/static/images/icon/plausible_logo_192px.png new file mode 100644 index 000000000000..b71791dba4c2 Binary files /dev/null and b/assets/static/images/icon/plausible_logo_192px.png differ diff --git a/assets/static/images/icon/plausible_logo_192px_maskable.png b/assets/static/images/icon/plausible_logo_192px_maskable.png new file mode 100644 index 000000000000..c7628e1295fb Binary files /dev/null and b/assets/static/images/icon/plausible_logo_192px_maskable.png differ diff --git a/assets/static/images/icon/plausible_logo_512px.png b/assets/static/images/icon/plausible_logo_512px.png new file mode 100644 index 000000000000..c6888f02a78d Binary files /dev/null and b/assets/static/images/icon/plausible_logo_512px.png differ diff --git a/assets/static/images/icon/plausible_logo_512px_maskable.png b/assets/static/images/icon/plausible_logo_512px_maskable.png new file mode 100644 index 000000000000..27968d8e7636 Binary files /dev/null and b/assets/static/images/icon/plausible_logo_512px_maskable.png differ diff --git a/assets/static/serviceWorker.js b/assets/static/serviceWorker.js new file mode 100644 index 000000000000..a5098aa9aa48 --- /dev/null +++ b/assets/static/serviceWorker.js @@ -0,0 +1,11 @@ +self.addEventListener( 'install', ( event ) => { + console.log( 'Service worker installed' ); +} ); + +self.addEventListener( 'activate', ( event ) => { + console.log( 'Service worker activated' ); +} ); + +self.addEventListener( 'fetch', ( event ) => { + console.log( 'Service worker fetch' ); +} ); \ No newline at end of file diff --git a/lib/plausible_web/endpoint.ex b/lib/plausible_web/endpoint.ex index 34078e93ea5e..8f42bd2e576d 100644 --- a/lib/plausible_web/endpoint.ex +++ b/lib/plausible_web/endpoint.ex @@ -13,7 +13,7 @@ defmodule PlausibleWeb.Endpoint do at: "/", from: :plausible, gzip: false, - only: ~w(css fonts images js favicon.ico robots.txt) + only: ~w(css fonts images js favicon.ico robots.txt app.webmanifest serviceWorker.js) plug Plug.Static, at: "/kaffy", diff --git a/lib/plausible_web/templates/layout/app.html.eex b/lib/plausible_web/templates/layout/app.html.eex index af87952946b8..2026bfe6099c 100644 --- a/lib/plausible_web/templates/layout/app.html.eex +++ b/lib/plausible_web/templates/layout/app.html.eex @@ -9,6 +9,7 @@