From 245036ea698894a74e64f4cf62ab23751ce85fea Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 8 Mar 2022 18:57:44 -0800 Subject: [PATCH 1/4] Provision a new instance for Supersynchronous --- firestore.rules | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/firestore.rules b/firestore.rules index 8c419b01..e694fa1a 100644 --- a/firestore.rules +++ b/firestore.rules @@ -5,14 +5,18 @@ service cloud.firestore { match /databases/{database}/documents { function isAdmin() { - return request.auth.uid == 'igi2zGXsfxYPgB0DJTXVJVmwCOr2' // Austin - || request.auth.uid == '5LZ4LgYuySdL1huCWe7bti02ghx2' // James - || request.auth.uid == 'tlmGNz9kjXc2EteizMORes4qvWl2' // Stephen - || request.auth.uid == 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' // Manifold + return true + // return request.auth.uid == 'OTd2JFY7LOdvQg2ZQGYLUqrXAiD2' // Austin + // || request.auth.uid == 'czxKSN1Z03Mzu7UqIio3ppM0eDt2' // David + } + + function isAuthed() { + return true + // return request.auth != null } match /users/{userId} { - allow read; + allow read: if isAuthed(); allow update: if resource.data.id == request.auth.uid && request.resource.data.diff(resource.data).affectedKeys() .hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle']); @@ -23,7 +27,7 @@ service cloud.firestore { } match /contracts/{contractId} { - allow read; + allow read: if isAuthed(); allow update: if request.resource.data.diff(resource.data).affectedKeys() .hasOnly(['description', 'closeTime', 'tags', 'lowercaseTags']); allow update: if isAdmin(); @@ -31,25 +35,25 @@ service cloud.firestore { } match /{somePath=**}/bets/{betId} { - allow read; + allow read: if isAuthed(); } match /{somePath=**}/comments/{commentId} { - allow read; + allow read: if isAuthed(); allow create: if request.auth != null; } match /{somePath=**}/answers/{answerId} { - allow read; + allow read: if isAuthed(); } match /folds/{foldId} { - allow read; + allow read: if isAuthed(); allow update, delete: if request.auth.uid == resource.data.curatorId; } match /{somePath=**}/followers/{userId} { - allow read; + allow read: if isAuthed(); allow write: if request.auth.uid == userId; } } From 581319cc53e7ca1bce608205873b864f0cb77ed2 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 8 Mar 2022 19:24:40 -0800 Subject: [PATCH 2/4] Add config and scripts for Supersync --- common/envs/constants.ts | 2 ++ common/envs/supersync.ts | 26 ++++++++++++++++++++++++++ firestore.rules | 5 ++--- web/package.json | 1 + 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 common/envs/supersync.ts diff --git a/common/envs/constants.ts b/common/envs/constants.ts index b87948a7..08eb9667 100644 --- a/common/envs/constants.ts +++ b/common/envs/constants.ts @@ -1,5 +1,6 @@ import { DEV_CONFIG } from './dev' import { EnvConfig, PROD_CONFIG } from './prod' +import { SUPERSYNC_CONFIG } from './supersync' import { THEOREMONE_CONFIG } from './theoremone' const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD' @@ -8,6 +9,7 @@ const CONFIGS = { PROD: PROD_CONFIG, DEV: DEV_CONFIG, THEOREMONE: THEOREMONE_CONFIG, + SUPERSYNC: SUPERSYNC_CONFIG, } // @ts-ignore export const ENV_CONFIG: EnvConfig = CONFIGS[ENV] diff --git a/common/envs/supersync.ts b/common/envs/supersync.ts new file mode 100644 index 00000000..a3b7b587 --- /dev/null +++ b/common/envs/supersync.ts @@ -0,0 +1,26 @@ +import { EnvConfig, PROD_CONFIG } from './prod' + +export const SUPERSYNC_CONFIG: EnvConfig = { + domain: 'supersync.manifold.markets', + firebaseConfig: { + apiKey: 'AIzaSyCV2THIZ_DPuFe4SI033uE13XNjzBLHPGM', + authDomain: 'supersync-manifold.firebaseapp.com', + projectId: 'supersync-manifold', + storageBucket: 'supersync-manifold.appspot.com', + messagingSenderId: '385180520313', + appId: '1:385180520313:web:e4d99bf5b888d76b43a9a8', + measurementId: 'G-C28MP0GSDJ', + }, + adminEmails: [...PROD_CONFIG.adminEmails], + whitelistEmail: '@supsync.com', + moneyMoniker: 'S$', + visibility: 'PRIVATE', + faviconPath: '/favicon.ico', + // navbarLogoPath: '/theoremone/TheoremOne-Logo.svg', + newQuestionPlaceholders: [ + 'Will we have at least 5 new team members by the end of this quarter?', + 'Will we meet or exceed our goals this sprint?', + 'Will we sign on 3 or more new clients this month?', + 'Will Paul shave his beard by the end of the month?', + ], +} diff --git a/firestore.rules b/firestore.rules index e694fa1a..9e3c4b61 100644 --- a/firestore.rules +++ b/firestore.rules @@ -6,13 +6,12 @@ service cloud.firestore { function isAdmin() { return true - // return request.auth.uid == 'OTd2JFY7LOdvQg2ZQGYLUqrXAiD2' // Austin + return request.auth.uid == 'P0UsBCW7VmSR0co39kFlsjxWgLQ2' // Austin // || request.auth.uid == 'czxKSN1Z03Mzu7UqIio3ppM0eDt2' // David } function isAuthed() { - return true - // return request.auth != null + return request.auth != null } match /users/{userId} { diff --git a/web/package.json b/web/package.json index 61342e4d..52da924c 100644 --- a/web/package.json +++ b/web/package.json @@ -7,6 +7,7 @@ "devdev": "NEXT_PUBLIC_FIREBASE_ENV=DEV concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=DEV next dev -p 3000\" \"FIREBASE_ENV=DEV yarn ts --watch\"", "dev:dev": "yarn devdev", "dev:the": "NEXT_PUBLIC_FIREBASE_ENV=THEOREMONE concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=THEOREMONE next dev -p 3000\" \"FIREBASE_ENV=THEOREMONE yarn ts --watch\"", + "dev:ss": "NEXT_PUBLIC_FIREBASE_ENV=SUPERSYNC concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=SUPERSYNC next dev -p 3000\" \"FIREBASE_ENV=SUPERSYNC yarn ts --watch\"", "ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty", "build": "next build", "start": "next start", From 9974de574ada8a5587da209c104aee00d33dfb86 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 8 Mar 2022 19:26:48 -0800 Subject: [PATCH 3/4] Link to Supersynchronous's logo --- common/envs/supersync.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/envs/supersync.ts b/common/envs/supersync.ts index a3b7b587..19e0c817 100644 --- a/common/envs/supersync.ts +++ b/common/envs/supersync.ts @@ -16,7 +16,8 @@ export const SUPERSYNC_CONFIG: EnvConfig = { moneyMoniker: 'S$', visibility: 'PRIVATE', faviconPath: '/favicon.ico', - // navbarLogoPath: '/theoremone/TheoremOne-Logo.svg', + navbarLogoPath: + 'https://supsync.com/content/images/2021/03/supsync-logo-invert-1.svg', newQuestionPlaceholders: [ 'Will we have at least 5 new team members by the end of this quarter?', 'Will we meet or exceed our goals this sprint?', From 03567ad5cfe6a10a2b0cd93cae1c06d7128017ec Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 8 Mar 2022 19:47:35 -0800 Subject: [PATCH 4/4] Set cloud functions environment --- firestore.rules | 1 - functions/.env | 1 + functions/.gitignore | 3 --- 3 files changed, 1 insertion(+), 4 deletions(-) create mode 100644 functions/.env diff --git a/firestore.rules b/firestore.rules index 9e3c4b61..81772de6 100644 --- a/firestore.rules +++ b/firestore.rules @@ -5,7 +5,6 @@ service cloud.firestore { match /databases/{database}/documents { function isAdmin() { - return true return request.auth.uid == 'P0UsBCW7VmSR0co39kFlsjxWgLQ2' // Austin // || request.auth.uid == 'czxKSN1Z03Mzu7UqIio3ppM0eDt2' // David } diff --git a/functions/.env b/functions/.env new file mode 100644 index 00000000..0bfa1fb6 --- /dev/null +++ b/functions/.env @@ -0,0 +1 @@ +NEXT_PUBLIC_FIREBASE_ENV=SUPERSYNC diff --git a/functions/.gitignore b/functions/.gitignore index 8b54e3dc..e0ba0181 100644 --- a/functions/.gitignore +++ b/functions/.gitignore @@ -1,6 +1,3 @@ -# Secrets -.env* - # Compiled JavaScript files lib/**/*.js lib/**/*.js.map