From e220e23b24ab44fbe35857c3116ed860e9c2b6b1 Mon Sep 17 00:00:00 2001 From: ztimson Date: Mon, 2 Sep 2019 12:56:19 -0400 Subject: [PATCH] attempt --- firebase.json | 10 ++++++++++ firestore.indexes.json | 4 ++++ firestore.rules | 8 ++++++++ functions/.gitignore | 8 ++++++++ functions/src/index.ts | 10 ++++++++++ src/app/adjectives.ts | 30 +++++++++++++++--------------- src/app/views/map/map.component.ts | 2 +- 7 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 firestore.indexes.json create mode 100644 firestore.rules create mode 100644 functions/.gitignore create mode 100644 functions/src/index.ts diff --git a/firebase.json b/firebase.json index d5b37ab..692b5e6 100644 --- a/firebase.json +++ b/firebase.json @@ -12,5 +12,15 @@ "destination": "/index.html" } ] + }, + "firestore": { + "rules": "firestore.rules", + "indexes": "firestore.indexes.json" + }, + "functions": { + "predeploy": [ + "npm --prefix \"$RESOURCE_DIR\" run lint", + "npm --prefix \"$RESOURCE_DIR\" run build" + ] } } diff --git a/firestore.indexes.json b/firestore.indexes.json new file mode 100644 index 0000000..415027e --- /dev/null +++ b/firestore.indexes.json @@ -0,0 +1,4 @@ +{ + "indexes": [], + "fieldOverrides": [] +} diff --git a/firestore.rules b/firestore.rules new file mode 100644 index 0000000..917a13a --- /dev/null +++ b/firestore.rules @@ -0,0 +1,8 @@ +rules_version = '2'; +service cloud.firestore { + match /databases/{database}/documents { + match /Maps/{document=**} { + allow read, write; + } + } +} diff --git a/functions/.gitignore b/functions/.gitignore new file mode 100644 index 0000000..7fbb8b4 --- /dev/null +++ b/functions/.gitignore @@ -0,0 +1,8 @@ +## Compiled JavaScript files +**/*.js +**/*.js.map + +# Typescript v1 declaration files +typings/ + +node_modules/ \ No newline at end of file diff --git a/functions/src/index.ts b/functions/src/index.ts new file mode 100644 index 0000000..7d0a948 --- /dev/null +++ b/functions/src/index.ts @@ -0,0 +1,10 @@ +import * as functions from 'firebase-functions'; +import * as cor from 'cors'; + +const cors = cor({origin: true}); + +exports.helloWorld = functions.https.onRequest((req, res) => { + return cors(req, res, () => { + res.status(200).send('Hello World!'); + }); +}); diff --git a/src/app/adjectives.ts b/src/app/adjectives.ts index b300d49..fdba473 100644 --- a/src/app/adjectives.ts +++ b/src/app/adjectives.ts @@ -1,18 +1,18 @@ export const Adjectives = [ - 'strict', + 'Strict', 'poor', - 'old', - 'hot', - 'huge', - 'scared', - 'large', - 'tall', - 'antique', - 'complete', - 'offbeat', - 'selective', - 'unwilling', - 'lively', - 'nebulous', - 'deranged' + 'Old', + 'Hot', + 'Huge', + 'Scared', + 'Large', + 'Tall', + 'Antique', + 'Complete', + 'Offbeat', + 'Selective', + 'Unwilling', + 'Lively', + 'Nebulous', + 'Deranged' ]; diff --git a/src/app/views/map/map.component.ts b/src/app/views/map/map.component.ts index d83386f..c44deac 100644 --- a/src/app/views/map/map.component.ts +++ b/src/app/views/map/map.component.ts @@ -38,7 +38,7 @@ export class MapComponent implements OnDestroy, OnInit { menu: ToolbarItem[]; constructor(public physicsService: PhysicsService, private syncService: SyncService, private snackBar: MatSnackBar, private bottomSheet: MatBottomSheet, private dialog: MatDialog, private route: ActivatedRoute) { - this.name = Adjectives[Math.floor(Math.random() * Adjectives.length)] + ' ' + Nouns[Math.floor(Math.random() * Nouns.length)]; + this.name = Adjectives[Math.floor(Math.random() * Adjectives.length)] + Nouns[Math.floor(Math.random() * Nouns.length)]; this.menu = [ {name: 'Marker', icon: 'room', toggle: true, onEnabled: this.startMarker, onDisabled: this.unsub},