Progressive Web Apps provide a big set of features to webapps. Some of them are critical for the LiMe-App, in particular accessing the geolocation, and the caching of the mobile app in the phone for faster loading.
In order for this features to be accessed, the app needs to be offered over SSL.
There is a very specific complication in relation to the SSL certificate: each router has one HTTP server, so each of them need to have an SSL certificate for their node.
There are different approaches to this:
For the LibreRouter case, we will be using the SSL cert exclusively to be able to access the mobile phones's hardware features like geolocation, so we will go for the second option.
We will be using an uhttpd instance with uhttpd-mod-tls as described in this guide.
We will be using the app.thisnode.info domain, so we separate the traffic from the usual local domain with this specific one that will be used for https traffic.
We will point the app.thisnode.info domain to a public server so we can share this cert with the routers.
The certificate will be retrieved using letsencrypt with a bot that will refresh the certificate every week, so when the nodes try to update they receive a long enough certificate every time.
As the post previously mentioned states, the certs provided by letsencrypt need to be converted in order to be used, so the cron script needs also to run:
And then by running any HTTP server on /var/www will be enough to publicly share this cert with the world.
This can be done when the certificate is one week old or more, each time the node gets internet.
In order to do that, we could trigger it by monitoring the ip monitor route
output and reacting to new routes to 0.0.0.0/0.
For now, we will use a 30 min cron action that will do a wget of the certs if the cert is old enough:
The idea is to have a very narrow approach with this app, for the app to only be used when it is strictly necessary. This decision is based on putting usability first: if the certificate goes invalid (because it is an offline network for example), only the functionality here will be affected.
Based on this decision, for now we will be using it for the geolocation. An example can be found here: https://codepen.io/anon/pen/MMpXrm
This app should work as an Android service, receive messages from Operating System, and popup the UI if needed. As a base this can be used: https://medium.com/reactbrasil/how-to-create-an-unstoppable-service-in-react-native-using-headless-js-93656b6fd5d1