diff --git a/Firebase Hosting/.firebase/hosting.0.cache b/Firebase Hosting/.firebase/hosting.0.cache new file mode 100644 index 0000000..8648d0a --- /dev/null +++ b/Firebase Hosting/.firebase/hosting.0.cache @@ -0,0 +1,12 @@ +404.html,1526589291891,b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537 +favicon.png,1539889144976,e897b793266fcb6c0ad80d280462a1248853348066c9a33e8eba95064a89cd4c +orsteg_apps_harold_og_image.png,1539889145004,6f110f19678772f87b42a9a4191a0dcc2f3a0f91342f61ff1c84ddeb05698771 +privacy_policy.html,1538443743080,35143676d4faa6f14acb49e7b1efbc79fef7af53b2b1d49ca27142f758bb3ebf +privacy_policy.txt,1538445275217,3f4b2d3b9a4672948c3b5a77af7b6b90b439d4f5da75d9313c3e140bbe4d2e75 +sitemap.xml,1540020198278,9170fd01fe0fedf999cdbdf2e0c93e9877eafdde03eb20423483b659bbda7268 +terms_and_conditions.html,1538443847592,b1deeae6b7ffb7a2c662460461fe97710e82979bfa5e3fb7e259ea0a641da604 +terms_and_conditions.txt,1538445397943,825a811236b1a4ba9937b3129d58054a8fba83c4e70cb0198cedc4bd399166da +featured_banner.png,1539889145000,92e6c05e89126e0d83dd787efd9231bfe576bd2c7e03aa3a429387de73e1db19 +index.html,1540155730858,5259b026cb212f9c0ead72150a72dee3e112ce2367e04443dcc017a5efd637dc +robots.txt,1540155820134,dec531097d819a68e5faac5e5c7bf59d1850b4a915b25e0347a04a34b616c3c0 +store/index.html,1540155782388,90afceed24d7a283233f1cbdca43498500f33c9930f17b3370cf6b2e4ce93d00 diff --git a/Firebase Hosting/database.rules.json b/Firebase Hosting/database.rules.json index d2b8268..c106abe 100644 --- a/Firebase Hosting/database.rules.json +++ b/Firebase Hosting/database.rules.json @@ -1,6 +1,38 @@ { - "rules": { - ".read": true, - ".write": true - } -} + "rules": { + ".read": false, + ".write": false, + "DepartmentList": { + ".read": true, + ".write": "auth !== null" + }, + "InstitutionList": { + ".read": true, + ".write": "auth !== null" + }, + "Institutions": { + ".read": true + }, + "Eds": { + ".read": true + }, + "CourseTemplates": { + ".read": true, + ".indexOn": ["edKey", "ownerId"], + "$id": { + ".write": "!data.exists() || data.child('ownerId').val() == auth.uid" + } + }, + "Users": { + "$uid": { + ".read": "$uid === auth.uid", + ".write": "$uid === auth.uid" + } + }, + "Requests": { + "$id": { + ".write": "auth !== null && !data.exists()" + } + } + } +} \ No newline at end of file diff --git a/Firebase Hosting/functions/index.js b/Firebase Hosting/functions/index.js index c497762..0c2e449 100644 --- a/Firebase Hosting/functions/index.js +++ b/Firebase Hosting/functions/index.js @@ -1,24 +1,19 @@ +/* Harold firebase cloud functions for checking database state and changes */ + const functions = require('firebase-functions'); const admin = require('firebase-admin'); -admin.initializeApp(functions.config().firebase); - -// // Create and Deploy Your First Cloud Functions -// // https://firebase.google.com/docs/functions/write-firebase-functions -// -exports.helloWorld = functions.https.onRequest((request, response) => { - response.send("Hello from Firebase!"); -}); +admin.initializeApp(); -exports.templateChange = functions.database.ref('/CourseTemplates/{id}').onWrite(event => { - const template = (event.data.val()) ? event.data.val() : event.data.previous.val(); - const pTemplate = event.data.previous.val(); +exports.templateChange = functions.database.ref('/CourseTemplates/{id}').onWrite((change, context) => { + const template = (change.after.val()) ? change.after.val() : change.before.val(); + const pTemplate = change.before.val(); const owner = template.ownerId; const iName = template.edKey.replace(/%&[\s\S]*/, ''); const dName = template.edKey.replace(/[\s\S]*%&/, ''); const inst = iName.replace(/\s+/g, '_'); const dept = dName.replace(/\s+/g, '_'); - if (event.data.previous.val() && event.data.current.val()) { + if (change.before.val() && change.after.val()) { return console.log('This is an update'); } @@ -78,11 +73,11 @@ exports.templateChange = functions.database.ref('/CourseTemplates/{id}').onWrite }); -exports.userNameChange = functions.database.ref('/Users/{id}/userName').onWrite(event => { - const userId = event.params.id; - const userName = event.data.val(); +exports.userNameChange = functions.database.ref('/Users/{id}/userName').onWrite((change, context) => { + const userId = context.params.id; + const userName = change.after.val(); - if (!event.data.previous.val()) { + if (!change.before.val()) { return console.log('new userName'); } @@ -99,10 +94,10 @@ exports.userNameChange = functions.database.ref('/Users/{id}/userName').onWrite( }); -exports.edKeyChanged = functions.database.ref('/Users/{id}').onWrite(event => { - const user = event.data.val(); - const userId = event.params.id; - const pUser = event.data.previous.val(); +exports.edKeyChanged = functions.database.ref('/Users/{id}').onWrite((change, context) => { + const user = change.after.val(); + const userId = context.params.id; + const pUser = change.before.val(); if (!pUser) { return console.log('new user'); @@ -190,8 +185,4 @@ exports.edKeyChanged = functions.database.ref('/Users/{id}').onWrite(event => { }); }); }); -}); - -exports.onRequest = functions.database.ref('/Requests/{id}').onWrite(event => { - }); \ No newline at end of file diff --git a/Firebase Hosting/functions/package.json b/Firebase Hosting/functions/package.json index dc2ec30..7b0a1e2 100644 --- a/Firebase Hosting/functions/package.json +++ b/Firebase Hosting/functions/package.json @@ -9,8 +9,8 @@ "logs": "firebase functions:log" }, "dependencies": { - "firebase-admin": "~6.0.0", + "firebase-admin": "6.0.0", "firebase-functions": "^2.0.5" }, "private": true -} \ No newline at end of file +} diff --git a/Firebase Hosting/functions/yarn.lock b/Firebase Hosting/functions/yarn.lock index ea27151..b9d509c 100644 --- a/Firebase Hosting/functions/yarn.lock +++ b/Firebase Hosting/functions/yarn.lock @@ -970,7 +970,7 @@ finalhandler@1.1.1: statuses "~1.4.0" unpipe "~1.0.0" -firebase-admin@~6.0.0: +firebase-admin@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/firebase-admin/-/firebase-admin-6.0.0.tgz#6a4be9e38b523ad7b4397b9b35853e4412e135ae" dependencies: diff --git a/Firebase Hosting/public/favicon.png b/Firebase Hosting/public/favicon.png new file mode 100644 index 0000000..99fe2d3 Binary files /dev/null and b/Firebase Hosting/public/favicon.png differ diff --git a/Firebase Hosting/public/index.html b/Firebase Hosting/public/index.html index d6dd03e..e9414cb 100644 --- a/Firebase Hosting/public/index.html +++ b/Firebase Hosting/public/index.html @@ -1,65 +1,54 @@ - + + + + + - Welcome to Firebase Hosting + Harold - CGPA & GPA Calculator | Free download on play store + + + + + + + + + + - - - - - - - - - + - - - -
-

Welcome

-

Firebase Hosting Setup Complete

-

You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!

- Open Hosting Documentation -
-

Firebase SDK Loading…

+ + + - - + + + + + + + \ No newline at end of file diff --git a/Firebase Hosting/public/orsteg_apps_harold_og_image.png b/Firebase Hosting/public/orsteg_apps_harold_og_image.png new file mode 100644 index 0000000..06d7821 Binary files /dev/null and b/Firebase Hosting/public/orsteg_apps_harold_og_image.png differ diff --git a/Firebase Hosting/public/robots.txt b/Firebase Hosting/public/robots.txt new file mode 100644 index 0000000..d0f0eb4 --- /dev/null +++ b/Firebase Hosting/public/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: /store + +Sitemap: http://harold.apps.orsteg.com/sitemap.xml \ No newline at end of file diff --git a/Firebase Hosting/public/sitemap.xml b/Firebase Hosting/public/sitemap.xml new file mode 100644 index 0000000..fd3062b --- /dev/null +++ b/Firebase Hosting/public/sitemap.xml @@ -0,0 +1,11 @@ + + + + https://harold.apps.orsteg.com + 2018-10-20 + + + https://harold.apps.orsteg.com/store + 2018-10-20 + + \ No newline at end of file diff --git a/Firebase Hosting/public/store/index.html b/Firebase Hosting/public/store/index.html index f5dc049..b175411 100644 --- a/Firebase Hosting/public/store/index.html +++ b/Firebase Hosting/public/store/index.html @@ -1,33 +1,60 @@ - - + + + - Harold - Timetable & (CGPA GPA) Calculator | Free download on play store + Harold - CGPA & GPA Calculator | Free download on play store - + - - + + - - - + + + + + + + + + - - + + + + - - + + + \ No newline at end of file