From 7e5161bf759096ce679b8ff84229403d536a7f5e Mon Sep 17 00:00:00 2001 From: Cynthia Wang Date: Wed, 18 Oct 2023 16:21:48 -0400 Subject: [PATCH 1/2] fix: add appcheck for vanilla js --- vanilla-js/index.html | 3 ++- vanilla-js/scripts/FriendlyEats.View.js | 6 ++++++ vanilla-js/scripts/FriendlyEats.js | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/vanilla-js/index.html b/vanilla-js/index.html index c715e9161..ce7920c2b 100644 --- a/vanilla-js/index.html +++ b/vanilla-js/index.html @@ -352,7 +352,8 @@

- + + diff --git a/vanilla-js/scripts/FriendlyEats.View.js b/vanilla-js/scripts/FriendlyEats.View.js index 0e66f6a13..cc5b2e764 100644 --- a/vanilla-js/scripts/FriendlyEats.View.js +++ b/vanilla-js/scripts/FriendlyEats.View.js @@ -517,3 +517,9 @@ FriendlyEats.prototype.replaceElement = function(parent, content) { FriendlyEats.prototype.rerender = function() { this.router.navigate(document.location.pathname + '?' + new Date().getTime()); }; + +FriendlyEats.prototype.initAppCheck = function() { + /* + TODO: Initialize and activate App Check + */ +}; diff --git a/vanilla-js/scripts/FriendlyEats.js b/vanilla-js/scripts/FriendlyEats.js index 7220c0f29..e5e8ac77e 100644 --- a/vanilla-js/scripts/FriendlyEats.js +++ b/vanilla-js/scripts/FriendlyEats.js @@ -19,6 +19,21 @@ * Initializes the FriendlyEats app. */ function FriendlyEats() { + const isLocalhost = Boolean( + window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.1/8 is considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) +); + if(isLocalhost) { + /* + TODO: Set up local debug token + */ + } + this.filters = { city: '', price: '', @@ -29,6 +44,8 @@ function FriendlyEats() { this.dialogs = {}; var that = this; + that.initAppCheck(); + firebase.auth().signInAnonymously().then(function() { that.initTemplates(); that.initRouter(); From 4397b736742b301d37fb24239a47c5bd45c04f7c Mon Sep 17 00:00:00 2001 From: Cynthia Wang <44329917+HYACCCINT@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:28:54 -0400 Subject: [PATCH 2/2] Update index.html --- vanilla-js/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vanilla-js/index.html b/vanilla-js/index.html index ce7920c2b..3446067da 100644 --- a/vanilla-js/index.html +++ b/vanilla-js/index.html @@ -353,7 +353,7 @@

- +