Be-Prepared / Be-Prepared.github.io

Handy PWA filled with useful tools.
Other
0 stars 0 forks source link

Be Prepared

A toolbox filled with offline-only tools. Useful for your everyday life and can turn your backup phone into a useful device. Nothing uses the internet, accesses local files, or sends content to a remote server. I care about your privacy and security, so please feel free to audit the code.

Use this application at Be-Prepared.github.io. It's a PWA and is installable as an application or you can run it from your web browser. Because it's a PWA, it can only auto-update itself when you are online. This can happen in the background or when you launch the application. You can detect if a new version is available by a drawer that opens on the bottom after the update is downloaded. An easy way to ensure you have the latest version is to make sure you are on the internet and run the app, wait a minute, close the app, then open it again.

Index

This PWA is also an example for how to use the following:

What's included

Flashlight

Front Light

Magnifier

Compass

Location Location List Location Edit Location Navigate

Barcode Reader

Sun and Moon

Info

Field Functions

The Location app can show a number of different fields. The majority can be used at any time and a select few are available only during navigation to a waypoint. Any figures that indicate "Navigation only" will all reset if you leave the navigation screen.

Notes about Data

For Developers

This project runs like most other typical Node.js projects. First clone or download the repository, then install packages, and finally serve content.

git clone https://github.com/fidian/be-prepared.git
cd be-prepared
npm install
npm run start

The server is started at http://localhost:8080/ and is exposed to everyone on your network through your computer's IP address, which makes testing on mobile devices much easier. The IP address and port will be displayed when the server starts.

Remote Tunnel: This will expose your copy of the application to the whole internet behind an SSL-enabled website. Run the server in one terminal and then run npm run tunnel in another terminal. Go to the generated URL and enter your public IP address as the password. You can use Eruda (see "Debugging" below) and console.log() statements.

Android & Chrome: The easiest way to test is to use a remote tunnel (see above). Another option is to go to chrome://flags and look for "Insecure origins treated as secure" (go there directly with chrome://flags#unsafely-treat-insecure-origins-as-secure). Add your computer's URL to the exceptions box and change the option to Enabled. The screenshot is how it looks on my device; your IP address will likely be different. You can also hook up a USB cable and enable remote debugging.

Chrome Flags Screenshot

iOS & Safari: The easiest is to run a remote tunnel (see above). Another option is to use a local debugger, which is described in this article. I also have a Dockerfile that can help connect to Safari from Linux.

Debugging: Eruda, a console for mobile browsers, can be loaded two different ways. One is to add "?eruda" to the end of the URL and the other is to tap the "Build Information" header on the info screen ten times. Disabling Eruda will happen automatically with a new session (close the app and open it again), or by tapping the "Build Information" header 10 more times. Turning on and off the console will trigger a page refresh. Eruda will be configured to fully initialize before the application starts, allowing all messages and errors to get logged appropriately. This is extremely useful.

Pull requests for additional functionality are welcome. Please make sure you maintain the intent of this code.