diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 10e075a..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,52 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node -{ - "containerEnv": { - "DATABASE_URL": "postgres://drop:drop@db:5432/drop", - "EXTERNAL_URL": "http://localhost:4000", - "NUXT_PORT": "4000" - }, - - // Configure tool-specific properties. - "customizations": { - "vscode": { - "extensions": [ - "lokalise.i18n-ally", - "esbenp.prettier-vscode", - "Prisma.prisma", - "bradlc.vscode-tailwindcss", - "Vue.volar", - "arktypeio.arkdark", - "EditorConfig.EditorConfig", - "dbaeumer.vscode-eslint" - ] - } - }, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" - - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "dockerComposeFile": "docker-compose.yml", - // Features to add to the dev container. More info: https://containers.dev/features. - "features": { - "ghcr.io/devcontainers-extra/features/protoc:1": {}, - "ghcr.io/devcontainers/features/node:1": {}, - "ghcr.io/devcontainers/features/rust:1": { - "version": "nightly-2026-03-29" - } - }, - - "name": "Node.js", - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "git submodule update --init --recursive", - "postStartCommand": "pnpm install && pnpm prisma migrate deploy && cd torrential && cargo build --release && cd ..", - - "runServices": ["db", "app"], - "service": "app", - "shutdownAction": "stopCompose", - "workspaceFolder": "/workspaces/drop" -} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml deleted file mode 100644 index 5259802..0000000 --- a/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -services: - app: - image: mcr.microsoft.com/devcontainers/base:noble - command: sleep infinity - volumes: - - ..:/workspaces/drop:cached - depends_on: - db: - condition: service_healthy - - db: - image: postgres:14-alpine - environment: - POSTGRES_USER: drop - POSTGRES_PASSWORD: drop - POSTGRES_DB: drop - volumes: - - pgdata:/var/lib/postgresql/data - healthcheck: - test: ["CMD-SHELL", "pg_isready -U drop -d drop"] - interval: 5s - timeout: 5s - retries: 20 - -volumes: - pgdata: diff --git a/.env.example b/.env.example index 92ad2a2..7d708ff 100644 --- a/.env.example +++ b/.env.example @@ -3,5 +3,3 @@ DATABASE_URL="postgres://drop:drop@127.0.0.1:5432/drop" GIANT_BOMB_API_KEY="" EXTERNAL_URL="http://localhost:3000" - -NUXT_PORT=4000 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b60214..f04182e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,20 +21,17 @@ jobs: with: submodules: true - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Setup Node.js environment uses: actions/setup-node@v4 with: node-version: lts/* - cache: "pnpm" + cache: "yarn" - name: Install dependencies - run: pnpm install + run: yarn install --immutable --network-timeout 1000000 - name: Typecheck - run: pnpm run typecheck + run: yarn typecheck lint: name: Lint @@ -45,17 +42,14 @@ jobs: with: submodules: true - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Setup Node.js environment uses: actions/setup-node@v4 with: node-version: lts/* - cache: "pnpm" + cache: "yarn" - name: Install dependencies - run: pnpm install + run: yarn install --immutable --network-timeout 1000000 - name: Lint - run: pnpm run lint + run: yarn lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9fb54e..8045e05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,20 +8,10 @@ on: schedule: - cron: "0 2 * * *" # run at 2 AM UTC -env: - REGISTRY_IMAGE: ghcr.io/drop-oss/drop - jobs: - build: - strategy: - fail-fast: false - matrix: - include: - - platform: linux/amd64 - runner: ubuntu-latest - - platform: linux/arm64 - runner: ubuntu-24.04-arm - runs-on: ${{ matrix.runner }} + web: + name: Push website Docker image to registry + runs-on: ubuntu-latest permissions: packages: write contents: read @@ -35,30 +25,6 @@ jobs: ref: ${{ github.ref }} token: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare - run: | - platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY_IMAGE }} - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Determine final version id: get_final_ver run: | @@ -77,58 +43,22 @@ jobs: echo "Drop's release tag will be: $FINAL_VER" echo "final_ver=$FINAL_VER" >> $GITHUB_OUTPUT - - name: Build and push by digest - id: build - uses: docker/build-push-action@v6 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 with: - platforms: ${{ matrix.platform }} - labels: ${{ steps.meta.outputs.labels }} - tags: ${{ env.REGISTRY_IMAGE }} - outputs: type=image,push-by-digest=true,name-canonical=true,push=true - provenance: mode=max - sbom: true - build-args: | - BUILD_DROP_VERSION=${{ steps.get_final_ver.outputs.final_ver }} - BUILD_GIT_REF=${{ github.sha }} + buildkitd-flags: --debug - - name: Export digest - run: | - mkdir -p ${{ runner.temp }}/digests - digest="${{ steps.build.outputs.digest }}" - touch "${{ runner.temp }}/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-${{ env.PLATFORM_PAIR }} - path: ${{ runner.temp }}/digests/* - if-no-files-found: error - retention-days: 1 - - merge: - runs-on: ubuntu-latest - needs: - - build - permissions: - packages: write - contents: read - steps: - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: ${{ runner.temp }}/digests - pattern: digests-* - merge-multiple: true - - - name: Login to Docker Hub + - name: Log in to the Container registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -147,12 +77,33 @@ jobs: # set latest tag for stable releases type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }} - - name: Create manifest list and push - working-directory: ${{ runner.temp }}/digests - run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) + - name: Cache + uses: actions/cache@v4 + id: cache + with: + path: cache-mount + key: cache-mount-${{ hashFiles('Dockerfile') }} - - name: Inspect image - run: | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} + - name: Restore Docker cache mounts + uses: reproducible-containers/buildkit-cache-dance@v3 + with: + builder: ${{ steps.setup-buildx.outputs.name }} + cache-dir: cache-mount + dockerfile: Dockerfile + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + + - name: Build and push image + id: build-and-push + uses: docker/build-push-action@v6 + with: + context: . + push: true + provenance: mode=max + sbom: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + BUILD_DROP_VERSION=${{ steps.get_final_ver.outputs.final_ver }} diff --git a/.gitignore b/.gitignore index 1c3cf86..7188be1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ dist # Node dependencies node_modules .yarn -.pnpm-store # Logs logs @@ -35,6 +34,4 @@ deploy-template/* # generated prisma client /prisma/client -/prisma/validate - -/server/internal/proto +/prisma/validate \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..de22495 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,54 @@ +variables: + GIT_SUBMODULE_STRATEGY: recursive + +stages: + - build + +services: + - docker:24.0.5-dind + +before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" + +build: + stage: build + image: docker:latest + variables: + IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA + LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest + PUBLISH_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG + PUBLISH_LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE:latest + script: + - docker build -t $IMAGE_NAME . + - docker image tag $IMAGE_NAME $LATEST_IMAGE_NAME + - docker push $IMAGE_NAME + - docker push $LATEST_IMAGE_NAME + - | + if [ $CI_COMMIT_TAG ]; then + docker image tag $IMAGE_NAME $PUBLISH_IMAGE_NAME + docker image tag $IMAGE_NAME $PUBLISH_LATEST_IMAGE_NAME + docker push $PUBLISH_IMAGE_NAME $PUBLISH_LATEST_IMAGE_NAME + fi + +build-arm64: + stage: build + image: arm64v8/docker:latest + tags: + - aarch64 + variables: + IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA-arm64 + LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest-arm64 + PUBLISH_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-arm64 + PUBLISH_LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE:latest-arm64 + script: + - docker build -t $IMAGE_NAME . --platform=linux/arm64 + - docker image tag $IMAGE_NAME $LATEST_IMAGE_NAME + - docker push $IMAGE_NAME + - docker push $LATEST_IMAGE_NAME + - | + if [ $CI_COMMIT_TAG ]; then + docker image tag $IMAGE_NAME $PUBLISH_IMAGE_NAME + docker image tag $IMAGE_NAME $PUBLISH_LATEST_IMAGE_NAME + docker push $PUBLISH_IMAGE_NAME + docker push $PUBLISH_LATEST_IMAGE_NAME + fi diff --git a/.gitmodules b/.gitmodules index 07aa3da..e24bb0c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "drop-base"] path = drop-base url = https://github.com/Drop-OSS/drop-base.git -[submodule "torrential"] - path = torrential - url = https://github.com/Drop-OSS/torrential.git diff --git a/.prettierignore b/.prettierignore index ed27b4d..3c9727c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,7 +1 @@ -drop-base/ -# file is fully managed by pnpm, no reason to break it -pnpm-lock.yaml - -/torrential/ -.data/** -**/.data/** +drop-base/ \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 30581eb..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "jsonRecursiveSort": true, - "jsonSortOrder": "{\"/.*/\": \"lexical\"}", - "plugins": ["prettier-plugin-sort-json"] -} diff --git a/.vscode/settings.json b/.vscode/settings.json index 0660ee6..76d084c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,35 +1,37 @@ { + "spellchecker.ignoreWordsList": ["mTLS", "Wireguard"], + "sqltools.connections": [ + { + "previewLimit": 50, + "server": "localhost", + "port": 5432, + "driver": "PostgreSQL", + "name": "drop", + "database": "drop", + "username": "drop", + "password": "drop" + } + ], // allow autocomplete for ArkType expressions like "string | num" "editor.quickSuggestions": { "strings": "on" }, - "i18n-ally.extract.autoDetect": true, - "i18n-ally.extract.ignored": ["string >= 14", "string.alphanumeric >= 5"], - "i18n-ally.extract.ignoredByFiles": { - "components/NewsArticleCreateButton.vue": ["[", "`", "Enter"], - "pages/admin/library/sources/index.vue": ["Filesystem"], - "server/api/v1/auth/signin/simple.post.ts": ["boolean | undefined"] - }, - "i18n-ally.keepFulfilled": true, - "i18n-ally.keystyle": "nested", - "i18n-ally.localesPaths": ["i18n", "i18n/locales"], + // prioritize ArkType's "type" for autoimports + "typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"], // i18n Ally settings "i18n-ally.sortKeys": true, - "prisma.pinToPrisma6": false, - "spellchecker.ignoreWordsList": ["mTLS", "Wireguard"], - "sqltools.connections": [ - { - "database": "drop", - "driver": "PostgreSQL", - "name": "drop", - "password": "drop", - "port": 5432, - "previewLimit": 50, - "server": "localhost", - "username": "drop" - } + "i18n-ally.keepFulfilled": true, + "i18n-ally.extract.autoDetect": true, + "i18n-ally.localesPaths": ["i18n", "i18n/locales"], + "i18n-ally.keystyle": "nested", + "i18n-ally.extract.ignored": [ + "string >= 14", + "string.alphanumeric >= 5", + "/api/v1/admin/import/version/preload?id=${encodeURIComponent(\n gameId,\n )}&version=${encodeURIComponent(version)}" ], - "typescript.experimental.useTsgo": false, - // prioritize ArkType's "type" for autoimports - "typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"] + "i18n-ally.extract.ignoredByFiles": { + "pages/admin/library/sources/index.vue": ["Filesystem"], + "components/NewsArticleCreateButton.vue": ["[", "`", "Enter"], + "server/api/v1/auth/signin/simple.post.ts": ["boolean | undefined"] + } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b452b1f..9055675 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,271 @@ -# Contributing +# CONTRIBUTING GUIDELINES -Check out our contributing guidelines on our developer docs: [https://developer.droposs.org/contributing](https://developer.droposs.org/contributing). +Drop is a community-driven project. Contribution is welcome, encouraged, and appreciated. +It is also essential for the development of the project. + +First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md). + +These guidelines are an attempt at better addressing pending +issues and pull requests. Please read them closely. + +Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution +you would make is not already covered. + + + +- [Reporting Issues](#reporting-issues) + - [You have a problem](#you-have-a-problem) + - [You have a suggestion](#you-have-a-suggestion) +- [Development](#development) + - [Note: `--optional` flag is **REQUIRED**](#note-optional-flag-is-required) + - [Tech Stack](#tech-stack) +- [Submitting Pull Requests](#submitting-pull-requests) + - [Getting started](#getting-started) + - [You have a solution](#you-have-a-solution) + - [You have an addition](#you-have-an-addition) +- [Use the Search, Luke](#use-the-search-luke) +- [Translation](#translation) +- [Commit Guidelines](#commit-guidelines) + - [Format](#format) + - [Style](#style) + + + +## Reporting Issues + +### You have a problem + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your problem. + +If you find one, comment on it, so we know more people are experiencing it. + + + +If you cannot find an existing issue, you can go ahead and create an issue with as much +detail as you can provide. +It should include the data gathered as indicated above, along with the following: + +1. How to reproduce the problem +2. What the correct behavior should be +3. What the actual behavior is + +Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle +(starting with `@`) in your message. + +We will do our very best to help you. + +### You have a suggestion + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your suggestion. + +If you find one, comment on it, so we know more people are supporting it. + +If not, you can go ahead and create an issue. Please copy to anyone relevant (e.g. plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +## Development + +To get started with development, you need `yarn` and `docker compose` installed (or know how to set up a PostgreSQL database). + +Steps: + +1. Run `git submodule update --init --recursive` to setup submodules +1. Copy the `.env.example` to `.env` and add any api keys you need to use (e.g. for the Giant Bomb API) + - You can find other configuration options in the [documentation](https://docs.droposs.org/) +1. Create the `.data` directory with `mkdir .data` +1. Ensure that your user owns the `.data` directory with `sudo chown -R $(id -u $(whoami))` +1. Open up a terminal and navigate to `dev-tools`, and run `docker compose up` +1. Open up another terminal in the root directory of the project and run `yarn` and then `yarn prisma migrate dev` to setup the database +1. Run `yarn dev` to start the development server + +As part of the first-time bootstrap, Drop creates an invitation with the fixed id of 'admin'. So, to create an admin account, go to: + +http://localhost:3000/auth/register?id=admin + +### Tech Stack + +This repo uses the Nuxt 3 + TailwindCSS stack, with the `yarn` package manager. + +For the database, Drop uses Prisma connected to PostgreSQL. + +## Submitting Pull Requests + +### Getting started + +You should be familiar with the basics of +[contributing on GitHub](https://help.github.com/articles/using-pull-requests) + + + +You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree. + +If you create your own PR, please make sure you do it right. Also be so kind as to reference +any issue that would be solved in the PR description body, +[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/) +_"Fixes #XXXX"_ for issue number XXXX. + +### You have a solution + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering your solution. + +If the solution is already reported, try it out and +1 the pull request if the +solution works ok. On the other hand, if you think your solution is better, post +it with reference to the other one so we can have both solutions to compare. + +If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +### You have an addition + +We are absolutely accepting more contributions or features to drop, but please, make sure +that it is reasonable. Contributions that only cover a very small niche are likely to not +be added. + +Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests +covering or related to what you want to add. + +If you find one, try it out and work with the author on a common solution. + +If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +For any extensive change, such as API changes, you will have to find testers to +1 your PR. + +--- + +## Use the Search, Luke + +_May the Force (of past experiences) be with you_ + +GitHub offers [many search features](https://help.github.com/articles/searching-github/) +to help you check whether a similar contribution to yours already exists. Please search +before making any contribution, it avoids duplicates and eases maintenance. Trust me, +that works 90% of the time. + +You can also take a look at the [FAQ](https://github.com/Drop-OSS/docs/wiki/FAQ) +to be sure your contribution has not already come up. + +If all fails, your thing has probably not been reported yet, so you can go ahead +and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests). + +--- + +## Translation + +If you want to help translate Drop, we would love to have your help! You can do so on our [weblate instance](https://translate.droposs.org/engage/drop/). Please make sure to **read** the [message format syntax](https://vue-i18n.intlify.dev/guide/essentials/syntax.html) page before starting. We use this special syntax to enable high quality translations, and failure to do so may result in your translations **causing errors** in Drop. + +## Commit Guidelines + +Drop uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) +specification. The automatic changelog tool uses these to automatically generate +a changelog based on the commit messages. Here's a guide to writing a commit message +to allow this: + +### Format + +``` +type(scope)!: subject +``` + +- `type`: the type of the commit is one of the following: + - `feat`: new features. + - `fix`: bug fixes. + - `docs`: documentation changes. + - `refactor`: refactor of a particular code section without introducing + new features or bug fixes. + - `style`: code style improvements. + - `perf`: performance improvements. + - `test`: changes to the test suite. + - `ci`: changes to the CI system. + - `build`: changes to the build system. + - `chore`: for other changes that don't match previous types. This doesn't appear + in the changelog. + +- `scope`: section of the codebase that the commit makes changes to. If it makes changes to + many sections, or if no section in particular is modified, leave blank without the parentheses. + Examples: + - Commit that changes the `git` plugin: + + ``` + feat(git): add alias for `git commit` + ``` + + - Commit that changes many plugins: + + ``` + style: fix inline declaration of arrays + ``` + + For changes to plugins or themes, the scope should be the plugin or theme name: + - ✅ `fix(agnoster): commit subject` + - ❌ `fix(theme/agnoster): commit subject` + +- `!`: this goes after the `scope` (or the `type` if scope is empty), to indicate that the commit + introduces breaking changes. + + Optionally, you can specify a message that the changelog tool will display to the user to indicate + what's changed and what they can do to deal with it. You can use multiple lines to type this message; + the changelog parser will keep reading until the end of the commit message or until it finds an empty + line. + + Example (made up): + + ``` + style(agnoster)!: change dirty git repo glyph + + BREAKING CHANGE: the glyph to indicate when a git repository is dirty has + changed from a Powerline character to a standard UTF-8 emoji. You can + change it back by setting `ZSH_THEME_DIRTY_GLYPH`. + + Fixes #420 + + Co-authored-by: Username + ``` + +- `subject`: a brief description of the changes. This will be displayed in the changelog. If you need + to specify other details, you can use the commit body, but it won't be visible. + + Formatting tricks: the commit subject may contain: + - Links to related issues or PRs by writing `#issue`. This will be highlighted by the changelog tool: + + ``` + feat(archlinux): add support for aura AUR helper (#9467) + ``` + + - Formatted inline code by using backticks: the text between backticks will also be highlighted by + the changelog tool: + ``` + feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774) + ``` + +### Style + +Try to keep the first commit line short. It's harder to do using this commit style but try to be +concise, and if you need more space, you can use the commit body. Try to make sure that the commit +subject is clear and precise enough that users will know what changed by just looking at the changelog. + +--- + + + +## Reference + +This contributing guide is adapted from the +[oh-my-zsh contribution guide](https://github.com/ohmyzsh/ohmyzsh/blob/master/CONTRIBUTING.md). +If there are any issues with this, please email admin@deepcore.dev. diff --git a/Dockerfile b/Dockerfile index fb8f0e2..d562926 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,75 +1,56 @@ # syntax=docker/dockerfile:1 -FROM node:lts-alpine AS base -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" -RUN corepack enable +### Unified deps builder +# FROM node:lts-alpine AS deps +# WORKDIR /app +# COPY package.json yarn.lock ./ +# RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --network-timeout 1000000 --ignore-scripts + +### Build for app +FROM node:lts-alpine AS build-system +# setup workdir - has to be the same filepath as app because fuckin' Prisma WORKDIR /app -## so corepack knows pnpm's version -COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ -## prevent prompt to download -ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0 -## setup for offline -RUN corepack pack -## don't call out to network anymore -ENV COREPACK_ENABLE_NETWORK=0 - -### INSTALL DEPS ONCE -FROM base AS deps -RUN pnpm install --frozen-lockfile --ignore-scripts - -### BUILD TORRENTIAL -FROM rustlang/rust:nightly-alpine AS torrential-build -RUN apk add musl-dev -WORKDIR /build -COPY torrential . -RUN apk add protoc -RUN cargo build --release - -### BUILD APP -FROM base AS build-system - ENV NODE_ENV=production ENV NUXT_TELEMETRY_DISABLED=1 +# ENV YARN_CACHE_FOLDER=/root/.yarn -## add git so drop can determine its git ref at build -RUN apk add --no-cache git +# add git so drop can determine its git ref at build +# pnpm for build +RUN apk add --no-cache git pnpm -## copy deps and rest of project files -COPY --from=deps /app/node_modules ./node_modules +# copy deps and rest of project files +# COPY --from=deps /app/node_modules ./node_modules COPY . . ARG BUILD_DROP_VERSION ARG BUILD_GIT_REF -## build -RUN pnpm run postinstall && pnpm run build +# build +RUN pnpm import +RUN pnpm install --shamefully-hoist +RUN pnpm run build +# RUN --mount=type=cache,target=/root/.yarn yarn postinstall && yarn build - -# create run environment for Drop -FROM base AS run-system +### create run environment for Drop +FROM node:lts-alpine AS run-system +WORKDIR /app ENV NODE_ENV=production ENV NUXT_TELEMETRY_DISABLED=1 # RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn add --network-timeout 1000000 --no-lockfile --ignore-scripts prisma@6.11.1 -RUN apk add --no-cache pnpm 7zip nginx -RUN pnpm install prisma@7.3.0 +RUN apk add --no-cache pnpm +RUN pnpm install prisma@6.11.1 # init prisma to download all required files RUN pnpm prisma init -COPY --from=build-system /app/prisma.config.ts ./ +COPY --from=build-system /app/package.json ./ COPY --from=build-system /app/.output ./app COPY --from=build-system /app/prisma ./prisma COPY --from=build-system /app/build ./startup -COPY --from=build-system /app/build/nginx.conf /nginx.conf -COPY --from=torrential-build /build/target/release/torrential /usr/bin/ ENV LIBRARY="/library" ENV DATA="/data" -ENV NGINX_CONFIG="/nginx.conf" -# NGINX's port -ENV PORT=4000 CMD ["sh", "/app/startup/launch.sh"] diff --git a/app.vue b/app.vue index a64e442..26c93ff 100644 --- a/app.vue +++ b/app.vue @@ -29,11 +29,10 @@ await updateUser(); const user = useUser(); const apiDetails = await $dropFetch("/api/v1"); -const clientMode = isClientRequest(); const showExternalUrlWarning = ref(false); function checkExternalUrl() { - if (!import.meta.client || clientMode) return; + if (!import.meta.client) return; const realOrigin = window.location.origin.trim(); const chosenOrigin = apiDetails.external.trim(); const ignore = window.localStorage.getItem("ignoreExternalUrl"); @@ -52,3 +51,15 @@ if (user.value?.admin) { }); } + + diff --git a/buf.gen.yaml b/buf.gen.yaml deleted file mode 100644 index c9b4b7e..0000000 --- a/buf.gen.yaml +++ /dev/null @@ -1,5 +0,0 @@ -version: v2 -plugins: - - local: protoc-gen-es - out: server/internal/proto - opt: target=ts diff --git a/build/nginx.conf b/build/nginx.conf deleted file mode 100644 index 88b6dbf..0000000 --- a/build/nginx.conf +++ /dev/null @@ -1,41 +0,0 @@ -worker_processes 1; - -events { - worker_connections 1024; -} - -pid nginx.pid; -error_log stderr; -daemon off; - -http { - default_type application/octet-stream; - - sendfile on; - server_tokens off; - - access_log nginx_host.access.log; - client_body_temp_path client_body; - fastcgi_temp_path fastcgi_temp; - proxy_temp_path proxy_temp; - scgi_temp_path scgi_temp; - uwsgi_temp_path uwsgi_temp; - - server { - listen 3000; - server_name localhost; - - location / { - proxy_pass http://localhost:4000; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } - - location /api/v1/depot/ { - proxy_pass http://localhost:5000; - proxy_read_timeout 300s; - proxy_connect_timeout 75s; - } - } -} diff --git a/components/AccountSidebar.vue b/components/AccountSidebar.vue index b4e2b89..2c0a3ec 100644 --- a/components/AccountSidebar.vue +++ b/components/AccountSidebar.vue @@ -53,17 +53,10 @@ import type { Component } from "vue"; const notifications = useNotifications(); const { t } = useI18n(); -const navigation: Ref< - (NavigationItem & { icon: Component; count?: number })[] -> = computed(() => [ +const navigation: (NavigationItem & { icon: Component; count?: number })[] = [ + { label: t("home"), route: "/account", icon: HomeIcon, prefix: "/account" }, { - label: t("account.home.title"), - route: "/account", - icon: HomeIcon, - prefix: "/account", - }, - { - label: t("account.security.title"), + label: t("security"), route: "/account/security", prefix: "/account/security", icon: LockClosedIcon, @@ -74,12 +67,6 @@ const navigation: Ref< prefix: "/account/devices", icon: DevicePhoneMobileIcon, }, - { - label: t("account.token.title"), - route: "/account/tokens", - prefix: "/account/tokens", - icon: CodeBracketIcon, - }, { label: t("account.notifications.notifications"), route: "/account/notifications", @@ -87,13 +74,19 @@ const navigation: Ref< icon: BellIcon, count: notifications.value.length, }, + { + label: t("account.token.title"), + route: "/account/tokens", + prefix: "/account/tokens", + icon: CodeBracketIcon, + }, { label: t("account.settings"), route: "/account/settings", prefix: "/account/settings", icon: WrenchScrewdriverIcon, }, -]); +]; -const currentPageIndex = useCurrentNavigationIndex(navigation.value); +const currentPageIndex = useCurrentNavigationIndex(navigation); diff --git a/components/ApplicationLogo.vue b/components/ApplicationLogo.vue deleted file mode 100644 index 98fae49..0000000 --- a/components/ApplicationLogo.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/components/Auth/OpenID.vue b/components/Auth/OpenID.vue index dc151ca..3151948 100644 --- a/components/Auth/OpenID.vue +++ b/components/Auth/OpenID.vue @@ -4,14 +4,7 @@ :href="`/auth/oidc?redirect=${route.query.redirect ?? '/'}`" class="transition rounded-md grow inline-flex items-center justify-center bg-white/10 px-3.5 py-2.5 text-sm font-semibold text-white shadow-xs hover:bg-white/20" > - - + @@ -22,6 +15,4 @@ diff --git a/components/Auth/Simple.vue b/components/Auth/Simple.vue index 5454e88..7324467 100644 --- a/components/Auth/Simple.vue +++ b/components/Auth/Simple.vue @@ -12,7 +12,7 @@ v-model="username" name="username" type="username" - autocomplete="username webauthn" + autocomplete="username" required class="block w-full rounded-md border-0 py-1.5 px-3 shadow-sm bg-zinc-950/20 text-zinc-300 ring-1 ring-inset ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6" /> @@ -86,78 +86,36 @@ diff --git a/components/CarouselPagination.vue b/components/CarouselPagination.vue index fccc129..61be4b9 100644 --- a/components/CarouselPagination.vue +++ b/components/CarouselPagination.vue @@ -4,10 +4,9 @@ v-for="(_, i) in amount" :key="i" :class="[ - carousel.currentSlide === i ? 'bg-blue-600 w-6' : 'bg-zinc-700 w-3', + carousel.currentSlide == i ? 'bg-blue-600 w-6' : 'bg-zinc-700 w-3', 'transition-all cursor-pointer h-2 rounded-full', ]" - @click="slideTo(i)" /> @@ -19,8 +18,8 @@ const carousel = inject(injectCarousel)!; const amount = carousel.maxSlide - carousel.minSlide + 1; -function slideTo(index: number) { - const offsetIndex = index + carousel.minSlide; - carousel.nav.slideTo(offsetIndex); -} +// function slideTo(index: number) { +// const offsetIndex = index + carousel.minSlide; +// carousel.nav.slideTo(offsetIndex); +// } diff --git a/components/CodeInput.vue b/components/CodeInput.vue deleted file mode 100644 index 4fbec97..0000000 --- a/components/CodeInput.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - diff --git a/components/DropWordmark.vue b/components/DropWordmark.vue index 19118df..9cec6a8 100644 --- a/components/DropWordmark.vue +++ b/components/DropWordmark.vue @@ -10,18 +10,9 @@ d="M203.371.916c-26.013-2.078-76.686 1.963-124.73 9.946L67.3 12.749C35.421 18.062 18.2 21.766 6.004 25.934 1.244 27.561.828 27.778.874 28.61c.07 1.214.828 1.121 9.595-1.176 9.072-2.377 17.15-3.92 39.246-7.496C123.565 7.986 157.869 4.492 195.942 5.046c7.461.108 19.25 1.696 19.17 2.582-.107 1.183-7.874 4.31-25.75 10.366-21.992 7.45-35.43 12.534-36.701 13.884-2.173 2.308-.202 4.407 4.442 4.734 2.654.187 3.263.157 15.593-.78 35.401-2.686 57.944-3.488 88.365-3.143 46.327.526 75.721 2.23 130.788 7.584 19.787 1.924 20.814 1.98 24.557 1.332l.066-.011c1.201-.203 1.53-1.825.399-2.335-2.911-1.31-4.893-1.604-22.048-3.261-57.509-5.556-87.871-7.36-132.059-7.842-23.239-.254-33.617-.116-50.627.674-11.629.54-42.371 2.494-46.696 2.967-2.359.259 8.133-3.625 26.504-9.81 23.239-7.825 27.934-10.149 28.304-14.005.417-4.348-3.529-6-16.878-7.066Z" /> -