diff --git a/.github/pull.yml b/.github/pull.yml index 795f82a..08eee1e 100644 --- a/.github/pull.yml +++ b/.github/pull.yml @@ -3,3 +3,6 @@ rules: - base: "prod" upstream: "develop" mergeMethod: hardreset + - base: "develop" + upstream: "update-lockfiles-npmjs" + mergeMethod: merge diff --git a/.github/workflows/build-static-pages.yml b/.github/workflows/build-static-pages.yml index b7cd578..fd18620 100644 --- a/.github/workflows/build-static-pages.yml +++ b/.github/workflows/build-static-pages.yml @@ -3,6 +3,11 @@ name: Static Page Buulder on: push: branches: [ develop ] + paths: + - "client/**" + - "server/**" + - "static/**" + - "package*.json" pull_request: branches: [ develop ] diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..5c817ee --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,71 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ develop, prod ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ develop ] + schedule: + - cron: '27 19 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/docker-build-beta.yaml b/.github/workflows/docker-build-beta.yaml index be38dc2..b6dc7d0 100644 --- a/.github/workflows/docker-build-beta.yaml +++ b/.github/workflows/docker-build-beta.yaml @@ -1,4 +1,4 @@ -name: Build and push image (develop) +name: Build and push image (beta) env: repository: "madebythepinshub/rtappdotio" @@ -15,7 +15,7 @@ on: - prod jobs: - docker-ci: + docker-ci-staging: runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/docker-build-latest.yaml b/.github/workflows/docker-build-dev.yml similarity index 84% rename from .github/workflows/docker-build-latest.yaml rename to .github/workflows/docker-build-dev.yml index 06e71e2..376e308 100644 --- a/.github/workflows/docker-build-latest.yaml +++ b/.github/workflows/docker-build-dev.yml @@ -11,9 +11,19 @@ on: push: branches: - develop + paths: + - "client/**" + - "server/**" + - "static/**" + - "Dockerfile" + - "start-rtappdotio" + - ".trigger-deploy" + - "package*.json" + workflow_dispatch: jobs: docker-ci: + if: ${{ github.event_name == 'push' }} runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/docker-build-release.yaml b/.github/workflows/docker-build-release.yaml index 4648b2e..b9d4a74 100644 --- a/.github/workflows/docker-build-release.yaml +++ b/.github/workflows/docker-build-release.yaml @@ -1,4 +1,4 @@ -name: Release-based Docker image builder +name: Build and push image (stable) env: repository: "madebythepinshub/rtappdotio" @@ -12,7 +12,7 @@ on: types: [published] jobs: - release-image: + docker-ci-prod: runs-on: ubuntu-latest steps: - name: Checkout @@ -47,4 +47,4 @@ jobs: context: . platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true - tags: ${{ env.repository }}:${{ env.tag }}, ghcr.io/${{ env.repository }}:latest, quay.io/${{ env.repository }}:${{ env.tag }}, quay.io/${{ env.repository }}:latest + tags: ghcr.io/${{ env.repository }}:${{ env.tag }}, ghcr.io/${{ env.repository }}:latest, ghcr.io/${{ env.repository }}:stable, quay.io/${{ env.repository }}:${{ env.tag }}, quay.io/${{ env.repository }}:latest, quay.io/${{ env.repository }}:stable diff --git a/.github/workflows/update-lockfile.yml b/.github/workflows/update-lockfile.yml new file mode 100644 index 0000000..2ce321c --- /dev/null +++ b/.github/workflows/update-lockfile.yml @@ -0,0 +1,35 @@ +name: Lockfile Updater + +on: + workflow_dispatch: + +env: + commitMessage: "chore(lockfile-npmjs): Updated lockfiles for npmjs" + +jobs: + lockfile-fixer: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_SERVICE_ACCOUNT_API_KEY }} + fetch-depth: 0 + - uses: actions/setup-node@v2 + name: "Setup Node.js 16" + with: + node-version: '16' + - run: npm cache verify --verbose && npm cache clean -f --verbose + name: Verify and nuke cache + - name: Rebuild package-lock.json + run: npm install --package-lock + - name: Stage and commit + run: + git branch update-lockfiles-npmjs && git switch update-lockfiles-npmjs + git config user.name "Recap Time Bot" + git config user.email "RecapTimeBot@users.noreply.github.com" + git add package*.json && git commit --signoff -m "${{ env.commitMessage }}" + git fetch && git push origin update-lockfiles-npmjs + - name: Trigger Pull app + run: curl -i ${PULL_APP_HOST}/process/${{ github.repository }} + env: + PULL_APP_HOST: "https://ghpullapp-thepinsteam.up.railway.app" diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 0000000..f6ee949 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,5 @@ +FROM gitpod/workspace-full:latest + +RUN bash -lc "source ~/.nvm/nvm-lazy.sh && nvm install --lts && nvm use --lts && nvm install-latest-npm" +RUN brew install hadolint shellcheck +RUN sudo install-packages gettext \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..793a614 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,9 @@ +image: + file: .gitpod.Dockerfile +tasks: + - init: | + npm install + npm run build + command: npm run gitpod:start + - name: Mail Debugging + command: sudo python3 -m smtpd -c DebuggingServer localhost:2680 \ No newline at end of file diff --git a/.trigger-deploy b/.trigger-deploy new file mode 100644 index 0000000..3b18e51 --- /dev/null +++ b/.trigger-deploy @@ -0,0 +1 @@ +hello world diff --git a/Dockerfile b/Dockerfile index dee112e..f4532d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,42 @@ -FROM node:14-alpine +FROM node:16-alpine # Only used for Railway to force-rebuild minus the cache. -ENV LAYER_CACHE=1 +ARG LAYER_CACHE=1 +ENV LAYER_CACHE=$LAYER_CACHE +# apk add is needed for our script to be working +RUN LAYER_CACHE=$LAYER_CACHE apk add --no-cache --update bash coreutils dumb-init -RUN LAYER_CACHE=$LAYER_CACHE apk add --no-cache --update bash coreutils - -# Setting working directory. +# Set working directory to /app WORKDIR /app -# Installing dependencies +# Install Node.js dependencies with npm (ensuring that package-lock.json is up-to-date) COPY package*.json ./ -RUN LAYER_CACHE=$LAYER_CACHE npm install +RUN LAYER_CACHE=$LAYER_CACHE npm cache clean --force && npm install --package-lock -# Copying source files +# After that, copy the rest of the codebase COPY . . +# Build-time envvars for npm run build, especially you don't want to pay more if +# FORCE_REBUILD_CLIENT is set to 1 and you're on Railway's free plan and don't have money yet. +# Contact and Abuse Report Emails +ARG CONTACT_EMAIL="hi@rtapp.tk" +ARG REPORT_EMAIL="abuse@rtapp.tk" +# Whenever generating shortlinks on anonymous users and registration should be allowed +ARG DISALLOW_ANONYMOUS_LINKS="false" +ARG DISALLOW_REGISTRATION="false" +ARG SITE_NAME="rtapp.io" +# Depending on our DNS provider, we can't just add an CNAME to root record, unless +# ANAMEs or CNAME flattening is supported. +ARG DEFAULT_DOMAIN="https://prod.rtapp.tk" +# The From address we're using +ARG MAIL_FROM_ADDRESS="noreply@mail.rtapp.tk" +# Google Analytics and ReCaptcha stuff +# We'll work to switch to hCaptcha and Ackee in the future. +ARG RECAPTCHA_SITE_KEY +ARG GOOGLE_ANALYTICS +# Sentry DSN +ARG SENTRY_PUBLIC_DSN + # Build files RUN LAYER_CACHE=$LAYER_CACHE npm run build @@ -23,4 +45,5 @@ ENV PORT=3000 EXPOSE 3000 # Running the app +ENTRYPOINT [ "dumb-init" ] CMD [ "/app/start-rtappdotio" ] diff --git a/client/components/Footer.tsx b/client/components/Footer.tsx index f3335be..7aee96b 100644 --- a/client/components/Footer.tsx +++ b/client/components/Footer.tsx @@ -26,18 +26,18 @@ const Footer: FC = () => { > {!isAuthenticated && } - Made with love by developers at{" "} + Made with love, originally by developers at{" "} The Devs - , and improved by{" "} - - The Pins Team + , and currently by{" "} + + Recap Time Squad .{" | "} Our fork's sauce on GitHub diff --git a/client/components/Settings/SettingsApi.tsx b/client/components/Settings/SettingsApi.tsx index d95ff56..f1f9651 100644 --- a/client/components/Settings/SettingsApi.tsx +++ b/client/components/Settings/SettingsApi.tsx @@ -57,7 +57,7 @@ const SettingsApi: FC = () => { Read API docs - and see list of integrations, community-maintained packages and extensions for your browser. + {" "}and see list of integrations, community-maintained packages and extensions for your browser. {apikey && ( diff --git a/client/components/__tests__/footer.test.tsx b/client/components/__tests__/footer.test.tsx index 5bcbcf4..314ebf3 100644 --- a/client/components/__tests__/footer.test.tsx +++ b/client/components/__tests__/footer.test.tsx @@ -19,8 +19,8 @@ describe("