- Collapse sites with multiple exposure events
- Get exposure sites from VIC endpoint and handle pagination
- Cache exposure sites in localStorage
- Work on functions backend for getting site coords and updating firestore
- Format distance:
- Demonstrate calling Functions from the frontend the proper way
- Handle public transport sites (which don't have a single address)
- Handle duplicate sites and exposures from VIC data, unlikely but possible.
- < 1km: display in m and round to nearest 10m
- > 1km: display in km and round to nearest 100m
- Rearchitet backend to get, parse and store sites
- Backend: Paginate getSites response
- Frontend: Get site from paginated getSites endpoint
- Add Bootstrap
- Add Google Analytics
- Add 'site under development' banner
- Improve front end lifecyle and error handling
- Populate rows with all site data
- Style website
- Handle not getting user pos; 1. timeout (increase timeout or ask user to reload page) 2. ask user to give permission if denied.
- Privacy policy
- Limit number of sites shown, perhaps only those within 10km?
- Acceptable use
- Productionise app (see instructions below)
- Set budget for Hosting and Functions (done: can't really set a budget, only alerts)
- Use separate keys for development/debugging and production (done: only needed frontend autocomplete address)
- Security: restrict calls to my getSites API endpoint to only those coming from the frontend, requires onCall?
- Give scroll up button a shadow
- Favicon
- Add quota to throttle address autocomplete calls per user per minute
- Develop release build process:
- Release: js minifier
- Release: Remove console logs
- Add disclaimer
- Site title/description
- Check SEO
- Add ability to change position by entering an address using the Google autocomplete address widget (see commented out code)
- Fix case when 0 sites are downloaded due to some bug and cache prevents sites from being downloaded even after it's been fixed. Shouldn't have to wait for cache to expire to download sites again.
- Add extra badges for new sites (need Added_time_dtm for that!) and # of exposures
- Handle flights
- Fix privacy policy October 2020 wording
- Handle public transport (tram route titles are really long)
- Send myself an email for backend updateAllSites() failures with Sendgrid https://firebase.google.com/docs/functions/tips#use_sendgrid_to_send_emails
- Add hyperlink to address to open Google Maps to location
- Don't display VICs/NSWs address for site, but use the one fetched from Google API (it'd be more consistent)
- Handle not finding site position gracefully and inform user, log onto firestore and update manually?
- Add exposure time (e.g. HH:MM:SS) as a hover to the exposure add date
- Let users share a location (address) to others with a URL (put address and lat/lng in the params, e.g. /?address=4+melbourne+street&loc=-39.43242,144.34234324)
- Increase cache time of sites as I'm hitting the free tier for reads
- Fix case when 0 sites are downloaded due to some bug and cache prevents sites from being downloaded even after it's been fixed. Shouldn't have to wait for cache to expire to download sites again. This still seems to occur according to an email I got.
- Do backend
- Create table in frontend, copy most of it from VIC
- Clean up line endings in raw site titles, addressses etc. (\t, \r, \n)
- Clean raw exposure site data some more
Start emulators (for hosting, functions and firestore):
lsof -ti tcp:8080 | xargs kill
# this command will save what's in the emulator's firestore then import it when it starts again
firebase emulators:start --import=./emulator_data --export-on-exit
This hosts everything locally which makes development easy.
Test a function using the shell (for use with the emulator when it's on or otherwise for production functions)
firebase functions:shell
firebase> updateAllSites() # this way I can run updateAllSites myself in production
Deploy Functions first so that I get the URLs of the endpoints to put into the frontend. No longer needed when using the httpsCallable endpoints.
firebase deploy --only functions
# Deploy a single function with
firebase deploy --only "functions:getSites"
npm run deploy
firebase deploy --only hosting
Is not supported, see documentation here: https://firebase.google.com/docs/emulator-suite#feature-matrix
Put this at the beginning of your Functions onCall
endpoint.
// context.app will be undefined if the request doesn't include a valid app Check token.
// from: https://firebase.google.com/docs/app-check/cloud-functions?authuser=0
if (context.app == undefined) {
throw new functions.https.HttpsError(
"failed-precondition",
"The function must be called from an App Check verified app.");
}
Then register your website app by going to the Firebase console > Project settings > App Check and generating a reCaptcha and putting in the secret key where it asks. See documentation: https://firebase.google.com/docs/app-check/web/recaptcha-provider
Then put this in your frontend:
const appCheck = firebase.appCheck();
// Pass your reCAPTCHA v3 site key (public key) to activate(). Make sure this
// key is the counterpart to the secret key you set in the Firebase console.
appCheck.activate(
"<site token>",
// Optional argument. If true, the SDK automatically refreshes App Check
// tokens as needed.
true);
I put my reCaptcha site and secret keys in a safe place in .env (I shouldn't have to use them again).
This will work with the emulator, but it needs more work (documentation: https://firebase.google.com/docs/app-check/web/debug-provider?authuser=0):
- Add this line to your web app before including the app check SDK, keep it there for debug builds.
<script>self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;</script>
- Go to localhost and grab the debug token from the console log, keep it secret. I put mine in .env for safekeeping.
- Add the debug token in the App check menu in the Firebase console > Project settings menu.
- That's it, no need to change the actual call to the Functions endpoint.
npm run build; ./deploy-dev-frontend.sh