diff --git a/.dockerignore b/.dockerignore index 615017f..4abae2b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,3 @@ -Dockerfile -.github -.vscode -*.md - -#### gitignore below # Nuxt dev/build outputs .output .data @@ -14,7 +8,6 @@ dist # Node dependencies node_modules -.yarn # Logs logs @@ -31,13 +24,3 @@ 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 7d708ff..bae34f6 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,8 @@ 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/.github/workflows/ci.yml b/.github/workflows/ci.yml index f04182e..1ae20e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,6 @@ name: CI -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -permissions: - contents: read +on: [pull_request, push] jobs: typecheck: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8045e05..2422087 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,29 +20,8 @@ jobs: uses: actions/checkout@v4 with: submodules: true - fetch-depth: 3 # fix for when this gets triggered by tag - fetch-tags: true - ref: ${{ github.ref }} 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 @@ -67,7 +46,6 @@ jobs: 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}} @@ -77,33 +55,14 @@ jobs: # set latest tag for stable releases type=raw,value=latest,enable=${{ github.event_name == 'release' && github.event.release.prerelease == false }} - - name: Cache - uses: actions/cache@v4 - id: cache - with: - path: cache-mount - key: cache-mount-${{ hashFiles('Dockerfile') }} - - - 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 7188be1..705c5c9 100644 --- a/.gitignore +++ b/.gitignore @@ -33,5 +33,4 @@ deploy-template/* !deploy-template/compose.yml # generated prisma client -/prisma/client -/prisma/validate \ No newline at end of file +/prisma/client \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index e24bb0c..222a086 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "drop-base"] path = drop-base - url = https://github.com/Drop-OSS/drop-base.git + url = https://github.com/Drop-OSS/drop-base.git \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 3c9727c..1e7121f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1 @@ -drop-base/ \ No newline at end of file +drop-base/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 2fc7cb9..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "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 76d084c..e426a5e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,21 +17,5 @@ "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"] - } + "typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9055675..3d883ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,15 +16,11 @@ 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) @@ -69,31 +65,6 @@ 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 @@ -159,10 +130,6 @@ and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-reque --- -## 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/) @@ -177,6 +144,7 @@ type(scope)!: subject ``` - `type`: the type of the commit is one of the following: + - `feat`: new features. - `fix`: bug fixes. - `docs`: documentation changes. @@ -193,6 +161,7 @@ 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: ``` @@ -206,6 +175,7 @@ type(scope)!: subject ``` For changes to plugins or themes, the scope should be the plugin or theme name: + - ✅ `fix(agnoster): commit subject` - ❌ `fix(theme/agnoster): commit subject` @@ -235,6 +205,7 @@ 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: ``` diff --git a/Dockerfile b/Dockerfile index d562926..128e0d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,56 +1,30 @@ -# syntax=docker/dockerfile:1 +# pull pre-configured and updated build environment +FROM debian:testing-20250317-slim AS build-system -### 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 -# 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 +# install dependencies and build +RUN apt-get update -y +RUN apt-get install node-corepack -y +RUN corepack enable COPY . . +RUN NUXT_TELEMETRY_DISABLED=1 yarn install --network-timeout 1000000 +RUN NUXT_TELEMETRY_DISABLED=1 yarn prisma generate +RUN NUXT_TELEMETRY_DISABLED=1 yarn build -ARG BUILD_DROP_VERSION -ARG BUILD_GIT_REF +# create run environment for Drop +FROM node:lts-slim AS run-system -# 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 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 -RUN pnpm install prisma@6.11.1 -# init prisma to download all required files -RUN pnpm prisma init - -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/package.json ./ COPY --from=build-system /app/build ./startup -ENV LIBRARY="/library" -ENV DATA="/data" +# 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@6.7.0 -CMD ["sh", "/app/startup/launch.sh"] +CMD ["/app/startup/launch.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 33cc5d0..ca881d9 100644 --- a/README.md +++ b/README.md @@ -6,32 +6,72 @@ # Drop [![Website](https://img.shields.io/badge/website-000000?style=for-the-badge&logo=About.me&logoColor=white)](https://droposs.org) -[![Docs](https://img.shields.io/badge/DOCS-black?style=for-the-badge&logo=docusaurus)](https://docs.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) -[![Weblate project translated](https://img.shields.io/weblate/progress/drop?server=https%3A%2F%2Ftranslate.droposs.org&style=for-the-badge&logo=weblate) -](https://translate.droposs.org/engage/drop/) -Drop is an open-source game distribution platform, similar to GameVault or Steam. It's designed to distribute and share DRM-free games quickly, all while being incredibly flexible, beautiful, and fast. - -
-Drop Screenshot -
+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 -1. Drop is flexible. While abstractions and interfaces can complicate the codebase, the flexibility is worth it. -2. Drop is secure. The nature of Drop means an instance can never be accessible without authentication. In line with #1, Drop also supports a huge variety of authentication mechanisms, from username/password to SSO. -3. Drop is user-friendly. The interface is designed to be clean and simple to use, with advanced features available to users who want them. +1. Drop is flexible. While abstractions and interfaces can make the codebase more complicated, the flexibility is worth it. +2. Drop is secure. The nature of Drop means an instance can never be accessible without authentication. In line with #1, Drop also supports a huge variety of authentication mechanisms, from a username/password to SSO. +3. Drop is user-friendly. The interface is designed to be clean and simple to use, with complexity available to the users who want it. ## Deployment -See our documentation on how to [deploy Drop](https://docs.droposs.org/docs/guides/quickstart) for more information. +To just deploy Drop, we've set up a simple docker compose file in deploy-template. + +1. Generate a [GiantBomb API Key](https://www.giantbomb.com/api/) +2. Navigate to the deploy-template directory in your terminal (`cd deploy-template`) +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 +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 +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 +9. You should see the game which you have just imported listed in this menu. There should be a notification that "Drop has detected you have new verions of this game to import". Select import here. +10. Select the game version to import and thus fill in fields as required. + +## Tech Stack + +This repo uses the Nuxt 3 + TailwindCSS stack, with the `yarn` package manager. + +For the database, Drop uses Prisma connected to PostgreSQL. + +## Development + +To get started with development, you need `yarn --optional` and `docker compose` installed (or know how to set up a PostgreSQL database). + +### Note: `--optional` flag is **REQUIRED** + +Drop uses a utility package called droplet that's written in Rust. It has builts for Linux (GNU) and Windows, and they are set up as optional packages. `npm` installs these by default, but `yarn` needs the `--optional` flag. + +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) +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/auth/register?id=admin ## Contributing -Please see the [in-depth contributing guide](CONTRIBUTING.md). The guide includes information on how to set up the project, how to contribute code, how to report issues, and even how to effectively translate Drop. - -[![Drop Translation Progress](https://translate.droposs.org/widget/drop/horizontal-auto.svg)](https://translate.droposs.org/engage/drop/) +Please see the [in-depth contributing guide](CONTRIBUTING.md) diff --git a/app.vue b/app.vue index 26c93ff..c70e804 100644 --- a/app.vue +++ b/app.vue @@ -4,52 +4,10 @@ -
-
- {{ - $t("errors.externalUrl.title") - }} - {{ - $t("errors.externalUrl.subtitle") - }} -
- -
diff --git a/pages/store/[id]/index.vue b/pages/store/[id]/index.vue index 4bcd942..cc6943f 100644 --- a/pages/store/[id]/index.vue +++ b/pages/store/[id]/index.vue @@ -44,7 +44,7 @@ type="button" class="inline-flex items-center gap-x-2 rounded-md bg-zinc-800 px-3 py-1 text-sm font-semibold font-display text-white shadow-sm hover:bg-zinc-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 duration-200 hover:scale-105 active:scale-95" > - {{ $t("store.openAdminDashboard") }} + Open in Admin Dashboard