diff --git a/.env.example b/.env.example index 578d0f4c..230c4af3 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ FIREBASE_PROJECT_ID= FIREBASE_TOKEN= +VITE_APP_CDN_URL= VITE_DISCORD_INVITE_LINK= VITE_FATHOM_EVENT_CTA_CONTINUE_WITH_PRO= VITE_FATHOM_EVENT_CTA_MODAL_UPGRADE= @@ -20,6 +21,8 @@ VITE_FIREBASE_EMULATOR_AUTH= VITE_FIREBASE_EMULATOR_BYPASS= VITE_FIREBASE_EMULATOR_FIRESTORE_HOST= VITE_FIREBASE_EMULATOR_FIRESTORE_PORT= +VITE_FIREBASE_EMULATOR_STORAGE_HOST= +VITE_FIREBASE_EMULATOR_STORAGE_PORT= VITE_FIREBASE_LOG_LEVEL= VITE_FIREBASE_MESSAGING_SENDER_ID= VITE_FIREBASE_PROJECT_ID= diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..282f00bf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI Checks + +on: + pull_request + +jobs: + build: + runs-on: ubuntu-latest + env: + VITE_APP_CDN_URL: "" + VITE_DISCORD_INVITE_LINK: "" + VITE_FATHOM_EVENT_CTA_CONTINUE_WITH_PRO: "" + VITE_FATHOM_EVENT_CTA_MODAL_UPGRADE: "" + VITE_FATHOM_EVENT_CTA_OPEN_APP: "" + VITE_FATHOM_EVENT_CTA_SETTINGS_UPGRADE: "" + VITE_FATHOM_EVENT_CTA_SIGN_UP_NOW: "" + VITE_FATHOM_EVENT_CTA_TRY_IT_OUT: "" + VITE_FATHOM_EVENT_CTA_UPGRADE_TO_PRO: "" + VITE_FATHOM_GOAL_ACCOUNT_REGISTRATION: "" + VITE_FATHOM_GOAL_CTA_SYNC_DOCS: "" + VITE_FATHOM_SITE_ID: "" + VITE_FATHOM_SITE_URL: "" + VITE_FIREBASE_API_KEY: "" + VITE_FIREBASE_APP_ID: "" + VITE_FIREBASE_AUTH_DOMAIN: "" + VITE_FIREBASE_DATABASE_URL: "" + VITE_FIREBASE_LOG_LEVEL: "" + VITE_FIREBASE_MESSAGING_SENDER_ID: "" + VITE_FIREBASE_PROJECT_ID: "" + VITE_FIREBASE_STORAGE_BUCKET: "" + VITE_STRIPE_MONTHLY_PRICE: "" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - run: yarn install --frozen-lockfile + - run: yarn build diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 97e1b862..03d69b04 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest environment: github-pages env: + VITE_APP_CDN_URL: ${{ secrets.VITE_APP_CDN_URL }} VITE_DISCORD_INVITE_LINK: ${{ secrets.VITE_DISCORD_INVITE_LINK }} VITE_FATHOM_EVENT_CTA_CONTINUE_WITH_PRO: ${{ secrets.VUE_APP_FATHOM_EVENT_CTA_CONTINUE_WITH_PRO }} VITE_FATHOM_EVENT_CTA_MODAL_UPGRADE: ${{ secrets.VITE_FATHOM_EVENT_CTA_MODAL_UPGRADE }} diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml deleted file mode 100644 index 6a69ef77..00000000 --- a/.github/workflows/package.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Publish NPM Package - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - run: yarn install --frozen-lockfile - - publish: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - registry-url: https://registry.npmjs.org/ - - run: yarn publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} diff --git a/firebase/firebase.json b/firebase/firebase.json index 4bcff57f..8d59c2a2 100644 --- a/firebase/firebase.json +++ b/firebase/firebase.json @@ -8,6 +8,10 @@ "host": "0.0.0.0", "port": 32776 }, + "storage": { + "host": "0.0.0.0", + "port": 32778 + }, "ui": { "enabled": true, "host": "0.0.0.0", diff --git a/firebase/storage.rules b/firebase/storage.rules index 50feb2d9..838fdfda 100644 --- a/firebase/storage.rules +++ b/firebase/storage.rules @@ -1,28 +1,40 @@ -rules_version = '2'; +rules_version = '2' service firebase.storage { match /b/{bucket}/o { - match /files/v1/{uid} { - match /{file=**} { - allow read: if true; - allow write: if authenticated() && authorized() && pro() && underQuota(); - } - - function authenticated() { - return request.auth != null; - } - - function authorized() { - return request.auth.uid == uid; - } - - function pro() { - return request.auth.token.stripeRole == 'subscriber'; - } - - function underQuota() { - return request.resource.size < 10 * 1024 * 1024 - } + match /{file=**} { + allow read: if true + allow create: if allowed() && ownsRequest() + allow delete: if allowed() && ownsResource() + allow update: if allowed() && ownsRequest() && ownsResource() + } + + function allowed() { + return authenticated() && underQuota() && (ambassador() || pro()) + } + + function ambassador() { + return request.auth.token.ambassador + } + + function authenticated() { + return request.auth != null + } + + function ownsResource() { + return request.auth.uid == resource.metadata.ownerId + } + + function ownsRequest() { + return request.auth.uid == request.resource.metadata.ownerId + } + + function pro() { + return request.auth.token.stripeRole == 'subscriber' + } + + function underQuota() { + return request.resource.size < 10 * 1024 * 1024 } } } diff --git a/src/components/Banner.vue b/src/components/Banner.vue index 2c0043da..8b7e60de 100644 --- a/src/components/Banner.vue +++ b/src/components/Banner.vue @@ -1,5 +1,5 @@