From bdc0e3064a7d21f636d81b6fe410142bb3cf3b32 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Thu, 2 Mar 2023 18:55:46 +0200 Subject: [PATCH] Updated PWA (markdown) --- PWA.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/PWA.md b/PWA.md index ae64bb4..00bf1c7 100644 --- a/PWA.md +++ b/PWA.md @@ -80,3 +80,81 @@ 3. At right side of URL address, click [V] / Add to home screen. 4. Follow the onscreen instructions to install. + +### Fullscreen Android app with Caddy and WeKan Server + +1. https://www.pwabuilder.com to create Android app. When creating app, make your own signing key if you don't have one yet. Releasing Android app is at Play Console https://play.google.com/console/ . + +2. PWABuilder has about 100+ downloadable icons etc webmanifest requirements like is at https://github.com/wekan/wekan/tree/master/public + +3. Clone WeKan repo, add favicons etc from step 2 to wekan/public/ , and build WeKan bundle from source like at https://github.com/wekan/wekan/wiki/Emoji . Note: Currently WeKan does not have feature for custom favicons, it would require a lot of work for 100+ favicons etc customizations. + +4. Run bundle at server like https://github.com/wekan/wekan/wiki/Offline or https://github.com/wekan/wekan/wiki/Raspberry-Pi + +5. Install Caddy like https://github.com/wekan/wekan/wiki/Caddy-Webserver-Config , with this config for PWA at https://boards.example.com , there add assetlinks.json details you got when you downloaded Android .zip file from https://pwabuilder.com , see assetlinks issue about where at Play Console those 2 SHA256 keys https://github.com/pwa-builder/PWABuilder/issues/3867#issuecomment-1450826565 + +You will want to click the `App Integrity` button in the sidemenu (highlighted blue in the screenshot) ![image](https://user-images.githubusercontent.com/8823093/222261921-1afc64bd-6bcf-4ba1-9620-88572162746e.png) + +Caddy uses tabs for indenting. At `/etc/caddy` you can also `caddy format > ca` to format output and forward to new file, and if it works then `mv ca Caddyfile` and validate it `caddy validate` and reload `caddy reload`. Sometimes update caddy with `caddy upgrade` and after that `caddy stop` and `caddy start`. + +Also related is Parallel Snaps install to one server at encrypted VM at https://github.com/wekan/wekan-snap/wiki/Many-Snaps-on-LXC + +In newest requirements installing assetlinks.json is to PWA URL (like https://boards.example.com), when it before was to main domain (like https://example.com), so here just in case it's installed to both, as text in `/etc/caddy/Caddyfile`. + +``` +# Redirecting http to https + +(redirect) { + @http { + protocol http + } + redir @http https://{host}{uri} +} + +example.com { + tls { + load /etc/caddy/certs + alpn http/1.1 + } + header /.well-known/* Content-Type application/json + header /.well-known/* Access-Control-Allow-Origin * + respond /.well-known/assetlinks.json `[ + { + "relation": ["delegate_permission/common.handle_all_urls"], + "target": { + "namespace": "android_app", + "package_name": "team.example.boards.twa", + "sha256_cert_fingerprints": [ + "AA:AA... FIRST SHA256 KEY", + "61:41... 2nd SHA256 KEY" + ] + } + } +]` + root * /data/websites/example.com + file_server +} + +boards.example.com { + tls { + load /etc/caddy/certs + alpn http/1.1 + } + header /.well-known/* Content-Type application/json + header /.well-known/* Access-Control-Allow-Origin * + respond /.well-known/assetlinks.json `[ + { + "relation": ["delegate_permission/common.handle_all_urls"], + "target": { + "namespace": "android_app", + "package_name": "team.example.boards.twa", + "sha256_cert_fingerprints": [ + "AA:AA... FIRST SHA256 KEY", + "61:41... 2nd SHA256 KEY" + ] + } + } +]` + reverse_proxy 192.168.100.3:3025 +} +```