diff --git a/.dockerignore b/.dockerignore index 4abae2bf..615017f5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,9 @@ +Dockerfile +.github +.vscode +*.md + +#### gitignore below # Nuxt dev/build outputs .output .data @@ -8,6 +14,7 @@ dist # Node dependencies node_modules +.yarn # Logs logs @@ -24,3 +31,13 @@ logs !.env.example .data + + +# deploy template +deploy-template/* + +!deploy-template/compose.yml + +# generated prisma client +/prisma/client +/prisma/validate diff --git a/.env.example b/.env.example index bae34f6a..7d708ff5 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,5 @@ DATABASE_URL="postgres://drop:drop@127.0.0.1:5432/drop" -CLIENT_CERTIFICATES="./.data/ca" - -FS_BACKEND_PATH="./.data/objects" - GIANT_BOMB_API_KEY="" +EXTERNAL_URL="http://localhost:3000" diff --git a/.gitattributes b/.gitattributes index af3ad128..e3f08fc5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ /.yarn/releases/* binary /.yarn/plugins/**/* binary /.pnp.* binary linguist-generated +* text=auto eol=lf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f04182eb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +permissions: + contents: read + +jobs: + typecheck: + name: Typecheck + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Node.js environment + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "yarn" + + - name: Install dependencies + run: yarn install --immutable --network-timeout 1000000 + + - name: Typecheck + run: yarn typecheck + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Node.js environment + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "yarn" + + - name: Install dependencies + run: yarn install --immutable --network-timeout 1000000 + + - name: Lint + run: yarn lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ed29fb50 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,95 @@ +name: Release Workflow + +on: + workflow_dispatch: {} + release: + types: [published] + # This can be used to automatically publish nightlies at UTC nighttime + schedule: + - cron: "0 2 * * *" # run at 2 AM UTC + +permissions: + contents: read + +jobs: + web: + name: Push website Docker image to registry + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Check out the repo + uses: actions/checkout@v4 + with: + submodules: true + fetch-tags: true + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Determine final version + id: get_final_ver + run: | + BASE_VER=v$(jq -r '.version' package.json) + TODAY=$(date +'%Y.%m.%d') + + echo "Today will be: $TODAY" + echo "today=$TODAY" >> $GITHUB_OUTPUT + + if [[ "${{ github.event_name }}" == "release" ]]; then + FINAL_VER="$BASE_VER" + else + FINAL_VER="${BASE_VER}-nightly.$TODAY" + fi + + echo "Drop's release tag will be: $FINAL_VER" + echo "final_ver=$FINAL_VER" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + with: + buildkitd-flags: --debug + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/drop-OSS/drop + tags: | + type=schedule,pattern=nightly + type=schedule,pattern=nightly.${{ steps.get_final_ver.outputs.today }} + type=semver,pattern=v{{version}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern=v{{major}} + type=ref,event=branch,prefix=branch- + type=ref,event=pr + type=sha + # set latest tag for stable releases + type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }} + + - 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 915b82c5..7188be16 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,8 @@ logs # deploy template deploy-template/* -!deploy-template/compose.yml \ No newline at end of file +!deploy-template/compose.yml + +# generated prisma client +/prisma/client +/prisma/validate \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37893f59..de224957 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,3 +29,26 @@ build: 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/.prettierignore b/.prettierignore new file mode 100644 index 00000000..3c9727cb --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +drop-base/ \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..2fc7cb9e --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,12 @@ +{ + "recommendations": [ + "lokalise.i18n-ally", + "esbenp.prettier-vscode", + "Prisma.prisma", + "bradlc.vscode-tailwindcss", + "Vue.volar", + "arktypeio.arkdark", + "EditorConfig.EditorConfig", + "dbaeumer.vscode-eslint" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 87ca8efb..76d084c8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,18 +1,37 @@ { - "spellchecker.ignoreWordsList": [ - "mTLS", - "Wireguard" - ], - "sqltools.connections": [ - { - "previewLimit": 50, - "server": "localhost", - "port": 5432, - "driver": "PostgreSQL", - "name": "drop", - "database": "drop", - "username": "drop", - "password": "drop" - } - ] + "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" + }, + // prioritize ArkType's "type" for autoimports + "typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"], + // i18n Ally settings + "i18n-ally.sortKeys": true, + "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)}" + ], + "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/.yarnrc b/.yarnrc deleted file mode 100644 index 9bcf9469..00000000 --- a/.yarnrc +++ /dev/null @@ -1 +0,0 @@ -"@drop:registry" "https://lab.deepcore.dev/api/v4/projects/57/packages/npm/" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f7a20b4e..5bb86362 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,8 @@ TODO: Add Troubleshooting If not, look at the [Troubleshooting](https://github.com/Drop-OSS/docs/Troubleshooting) page for instructions on how to gather data to better debug your problem. --> -If you cannot find an existing issue, you can go ahead and create an issue with as much + +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: @@ -69,7 +70,8 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa ### Getting started You should be familiar with the basics of -[contributing on GitHub](https://help.github.com/articles/using-pull-requests) +[contributing on GitHub](https://help.github.com/articles/using-pull-requests) + @@ -95,8 +97,8 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa ### 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 +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 @@ -109,7 +111,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa For any extensive change, such as API changes, you will have to find testers to +1 your PR. ----- +--- ## Use the Search, Luke @@ -126,7 +128,11 @@ 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. Please make sure to read the [message format syntax](https://vue-i18n.intlify.dev/guide/essentials/syntax.html) page before starting. Failure to do so may result in your translations causing errors in Drop. ## Commit Guidelines @@ -142,7 +148,6 @@ type(scope)!: subject ``` - `type`: the type of the commit is one of the following: - - `feat`: new features. - `fix`: bug fixes. - `docs`: documentation changes. @@ -159,19 +164,19 @@ type(scope)!: subject - `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` @@ -201,8 +206,8 @@ type(scope)!: subject 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) ``` @@ -219,7 +224,7 @@ Try to keep the first commit line short. It's harder to do using this commit sty 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. \ No newline at end of file + +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 33e714a3..19e6a846 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,49 @@ -# pull pre-configured and updated build environment -FROM registry.deepcore.dev/drop-oss/drop-server-build-environment/main:latest AS build-system +# syntax=docker/dockerfile:1 -# setup workdir -RUN mkdir /build -WORKDIR /build +# 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 + +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 -# install dependencies and build -RUN corepack enable +# copy deps and rest of project files +COPY --from=deps /app/node_modules ./node_modules COPY . . -RUN NUXT_TELEMETRY_DISABLED=1 yarn install -RUN NUXT_TELEMETRY_DISABLED=1 yarn build -# create run environment for Drop -FROM node:lts-slim AS run-system +ARG BUILD_DROP_VERSION +ARG BUILD_GIT_REF + +# build +RUN --mount=type=cache,target=/root/.yarn yarn postinstall && \ + yarn build -RUN mkdir /app +# create run environment for Drop +FROM node:lts-alpine AS run-system WORKDIR /app -COPY --from=build-system /build/.output ./app -COPY --from=build-system /build/prisma ./prisma -COPY --from=build-system /build/build ./startup +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 + +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 -# OpenSSL as a dependency for Drop (TODO: seperate build environment) -RUN apt-get update -y && apt-get install -y openssl -RUN yarn global add prisma +ENV LIBRARY="/library" +ENV DATA="/data" -CMD ["/app/startup/launch.sh"] \ No newline at end of file +CMD ["sh", "/app/startup/launch.sh"] diff --git a/README.md b/README.md index 33d1533a..69ae3078 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,16 @@
- +
-
- Contribution guide    - Our website    -
-
-
- -[![GitHub License](https://img.shields.io/github/license/Drop-OSS/drop-app)](LICENSE) -[![Gitlab Pipeline Status](https://img.shields.io/gitlab/pipeline-status/drop-oss%2Fdrop?gitlab_url=https%3A%2F%2Flab.deepcore.dev)](https://lab.deepcore.dev/drop-oss/drop/-/pipelines) -[![Discord](https://img.shields.io/discord/1291622805124812871?label=discord)](https://discord.gg/ACq4qZp4a9) -[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org) +
# Drop +[![Website](https://img.shields.io/badge/website-000000?style=for-the-badge&logo=About.me&logoColor=white)](https://droposs.org) +[![Static Badge](https://img.shields.io/badge/FORUM-blue?style=for-the-badge)](https://forum.droposs.org) +[![GitHub License](https://img.shields.io/badge/AGPL--3.0-red?style=for-the-badge)](LICENSE) +[![Discord](https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/ACq4qZp4a9) +[![Open Collective](https://img.shields.io/badge/OpenCollective-1F87FF?style=for-the-badge&logo=OpenCollective&logoColor=white)](https://opencollective.com/drop-oss) + Drop is an open-source game distribution platform, like GameVault or Steam. It's designed to distribute and shared DRM-free game quickly, all while being incredibly flexible, beautiful and fast. ## Philosophy @@ -32,16 +28,18 @@ To just deploy Drop, we've set up a simple docker compose file in deploy-templat 3. Edit the compose.yml file (`nano compose.yml`) and copy your GiamtBomb API Key into the GIANT_BOMB_API_KEY environment variable 4. Run `docker compose up -d` -Your drop server should now be running. To register the admin user, navigate to http://your.drop.server.ip:3000/register?id=admin +Your drop server should now be running. To register the admin user, navigate to http://your.drop.server.ip:3000/register?id=admin and fill in the required forms ### Adding a game + To add a game to the drop library, do as follows: + 1. Ensure that the current user owns the library folder with `sudo chown -R $(id -u $(whoami)) library` 2. `cd library` 3. `mkdir ` with the name of the game which you would like to register 4. `cd ` -5. `mkdir ` Upload files for the specific game version to this folder +5. `mkdir ` Upload files for the specific game version to this folder 6. Navigate to http://your.drop.server.ip:3000/ 7. Import game metadata (uses GiantBomb API Key) by selecting the game and specifying which entry to import 8. Navigate to http://your.drop.server.ip:3000/admin/library @@ -64,15 +62,16 @@ Drop uses a utility package called droplet that's written in Rust. It has builts Steps: +1. Run `git submodule update --init --recursive` to setup submodules 1. Copy the `.env.example` to `.env` and add your GiantBomb metadata key (more metadata providers coming) -2. Create the `.data` directory with `mkdir .data` -3. Ensure that your user owns the `.data` directory with `sudo chown -R $(id -u $(whoami))` -4. Open up a terminal and navigate to `dev-tools`, and run `docker compose up` -5. Open up another terminal in the root directory of the project and run `yarn` and then `yarn dev` to start the dev server +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 dev` to start the dev 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/register?id=admin +http://localhost:3000/auth/register?id=admin ## Contributing diff --git a/SECURITY.md b/SECURITY.md index b11f4ee8..8fc42ef6 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,4 +1,5 @@ # Security + To report a vulnerability, please DO NOT create an issue for it as this may lead to the vulnerability being exploited before it can be fixed. Instead, please email [security@deepcore.dev](mailto:security@deepcore.dev) diff --git a/app.vue b/app.vue index 5b6668fb..c70e8047 100644 --- a/app.vue +++ b/app.vue @@ -1,4 +1,5 @@ diff --git a/components/Directory/Library.vue b/components/Directory/Library.vue new file mode 100644 index 00000000..ced13de6 --- /dev/null +++ b/components/Directory/Library.vue @@ -0,0 +1,75 @@ + + + diff --git a/components/Directory/News.vue b/components/Directory/News.vue new file mode 100644 index 00000000..e8a88ad5 --- /dev/null +++ b/components/Directory/News.vue @@ -0,0 +1,212 @@ + + + + + + diff --git a/components/Docs/Sidebar.vue b/components/Docs/Sidebar.vue deleted file mode 100644 index a8d1ed12..00000000 --- a/components/Docs/Sidebar.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - diff --git a/components/Docs/SidebarNavItem.vue b/components/Docs/SidebarNavItem.vue deleted file mode 100644 index ae6e96af..00000000 --- a/components/Docs/SidebarNavItem.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/components/DropLogo.vue b/components/DropLogo.vue new file mode 100644 index 00000000..8645c5be --- /dev/null +++ b/components/DropLogo.vue @@ -0,0 +1,14 @@ + diff --git a/components/DropWordmark.vue b/components/DropWordmark.vue new file mode 100644 index 00000000..7288677b --- /dev/null +++ b/components/DropWordmark.vue @@ -0,0 +1,18 @@ + diff --git a/components/EmojiText.vue b/components/EmojiText.vue new file mode 100644 index 00000000..694f68a1 --- /dev/null +++ b/components/EmojiText.vue @@ -0,0 +1,15 @@ + + + diff --git a/components/GameCarousel.vue b/components/GameCarousel.vue index bf9da98d..6b2cc3eb 100644 --- a/components/GameCarousel.vue +++ b/components/GameCarousel.vue @@ -1,41 +1,76 @@