mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-06-22 12:21:34 +10:00
Compare commits
185 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b9a154dde8 | |||
| 93a58c0d04 | |||
| 36776cc61e | |||
| a309651fe4 | |||
| 716eac79bf | |||
| f3ed0f6430 | |||
| c7eb11a836 | |||
| 39d7ce7d1b | |||
| 02d6346b01 | |||
| a8f21068fc | |||
| 2cfe75a551 | |||
| 5a1f8411de | |||
| a86045c307 | |||
| db103de24d | |||
| e505e58192 | |||
| b75ebd13b7 | |||
| 937954fa02 | |||
| 43e32b44a2 | |||
| 61d88c3091 | |||
| 12e312593e | |||
| 4f9b94921a | |||
| 0a5a649cfe | |||
| 2f52a16d52 | |||
| 38fc6b81df | |||
| 28baabc122 | |||
| 9b12d4576c | |||
| e5cf13fd93 | |||
| dbb315a8d7 | |||
| 2c19e13c09 | |||
| fe9373af78 | |||
| eadcaa1b05 | |||
| 5f29c28e04 | |||
| db916bf970 | |||
| 2309407ca6 | |||
| 5c78b20504 | |||
| cada630e81 | |||
| a361c38e82 | |||
| 0f10626b1b | |||
| 8945196633 | |||
| 31e8359ec0 | |||
| 089c3e03f6 | |||
| fd4a7d1981 | |||
| b50e27f4b0 | |||
| 54c5d55da7 | |||
| 25fc957092 | |||
| 5393db3236 | |||
| 6df560ca37 | |||
| 789d3ba2f2 | |||
| c4391d3f4d | |||
| 1f4d07568f | |||
| e408ac5df8 | |||
| 305de9f45a | |||
| ecc819eebc | |||
| 9cbdcbcdf6 | |||
| 9c2249ed08 | |||
| 7b3b919581 | |||
| ef8f3ae6fd | |||
| 7a88f4c52d | |||
| 6e6f09dba0 | |||
| 62ea9a116b | |||
| f7d767d73e | |||
| 26a31f6d56 | |||
| 5358f1f52c | |||
| bc0c47c487 | |||
| 8463e35a10 | |||
| 2859005ad4 | |||
| 44c60280ef | |||
| 9011cf5c83 | |||
| 2c21a235b2 | |||
| 87230fb0e7 | |||
| 4488ae269b | |||
| bfafe02d48 | |||
| d7160abc47 | |||
| 76bceb121f | |||
| 952ece8c83 | |||
| 33d37700e1 | |||
| a815542604 | |||
| e796b465d1 | |||
| b511b40d7c | |||
| 599da0e348 | |||
| c7b675f841 | |||
| be6c30dfee | |||
| 7d72a86876 | |||
| adb4b7381e | |||
| f2e018277b | |||
| 9c4b6f35bb | |||
| b9ae26cb27 | |||
| ce0a9ab538 | |||
| 8999303f0a | |||
| 69e4c2592b | |||
| 1d5e1bda85 | |||
| 39fe9d55fd | |||
| a8a152e578 | |||
| 74fa671b69 | |||
| 7b0756c6bd | |||
| 17971e0a5a | |||
| d3d93b03de | |||
| 22366221b2 | |||
| b0ef675e7e | |||
| cd0d2bfdea | |||
| 4273a20180 | |||
| c4a419f2e4 | |||
| 3a51c9cc9c | |||
| c3914cc1ed | |||
| 69f341b329 | |||
| b03d790247 | |||
| df41dd1c6f | |||
| ad25d3e462 | |||
| 8097dd6721 | |||
| 803752e745 | |||
| 6328c24537 | |||
| f40f8c87f4 | |||
| 886beb62ea | |||
| 0f80fcd830 | |||
| 52315d09da | |||
| 62a111b0fc | |||
| 7194d35cf5 | |||
| 03b0b0c38b | |||
| b744671e57 | |||
| a8f58eba7c | |||
| 46d35adfdb | |||
| eb66c5c07a | |||
| 13bfad4966 | |||
| e47944a3b0 | |||
| 9cb2d6d02f | |||
| 36568c3845 | |||
| a208fbedbd | |||
| 584bcf1cdf | |||
| c5d00b4766 | |||
| 5fe2036f0b | |||
| 583301ff40 | |||
| 88c95d6bf7 | |||
| 848a611751 | |||
| 2e44ef3501 | |||
| ecb381e1ca | |||
| b2ab827a55 | |||
| 46551f9330 | |||
| e4339c34ec | |||
| 7d2a1c6952 | |||
| 24a0d118f2 | |||
| ef13b68592 | |||
| c4a3e4e9a7 | |||
| 7f4db0c1dc | |||
| 3dd6062af4 | |||
| 6e2dc89670 | |||
| 93bc143dac | |||
| 03a37f72aa | |||
| 7e176262cc | |||
| e1c1d7ea39 | |||
| c355f6fdbb | |||
| 0a715fef08 | |||
| 395219d0cb | |||
| eb3f9f91ca | |||
| cf578bd005 | |||
| 1f575b2bc0 | |||
| 91b7e1071c | |||
| 329c74d3ce | |||
| 8674ac7211 | |||
| 328b9ba46c | |||
| 9b7ee4e746 | |||
| 27070b6a4c | |||
| 46c8f0c48a | |||
| a7c33e7d43 | |||
| 718f5ba514 | |||
| f3672f81dd | |||
| 6b5e48d6fe | |||
| 486bce8bc7 | |||
| 435551c207 | |||
| de388a937a | |||
| 4fa771a0b5 | |||
| 6ba5cdddc5 | |||
| d4e2dc8cb6 | |||
| 425934d3ef | |||
| c4d81135a2 | |||
| 2b4382d013 | |||
| 7523e536b5 | |||
| 909432a6ce | |||
| ceacd8469d | |||
| 7869043c28 | |||
| bfafd2a044 | |||
| 1bd19ad917 | |||
| e52f072091 | |||
| 22ac7f6b15 | |||
| 196f87c219 | |||
| e1a789fa36 |
+25
-5
@@ -1,6 +1,26 @@
|
||||
/sites
|
||||
/cli
|
||||
/desktop
|
||||
/backend # go backend
|
||||
# Nuxt dev/build outputs
|
||||
.output
|
||||
.data
|
||||
.nuxt
|
||||
.nitro
|
||||
.cache
|
||||
dist
|
||||
|
||||
node_modules
|
||||
# Node dependencies
|
||||
node_modules
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.fleet
|
||||
.idea
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
.data
|
||||
|
||||
@@ -1,7 +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"
|
||||
|
||||
NUXT_PORT=4000
|
||||
@@ -2,4 +2,3 @@
|
||||
/.yarn/releases/* binary
|
||||
/.yarn/plugins/**/* binary
|
||||
/.pnp.* binary linguist-generated
|
||||
* text=auto eol=lf
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
name: "Build and release desktop"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tagName:
|
||||
required: false
|
||||
type: string
|
||||
description: "tagName to be associated with this release."
|
||||
release:
|
||||
types: [published]
|
||||
# This can be used to automatically publish nightlies at UTC nighttime
|
||||
# schedule:
|
||||
# - cron: "0 2 * * *" # run at 2 AM UTC
|
||||
|
||||
# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
|
||||
|
||||
jobs:
|
||||
publish-tauri:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: "macos-14" # for Arm based macs (M1 and above).
|
||||
args: "--target aarch64-apple-darwin"
|
||||
- platform: "macos-14" # for Intel based macs.
|
||||
args: "--target x86_64-apple-darwin"
|
||||
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
|
||||
args: ""
|
||||
- platform: "ubuntu-22.04-arm"
|
||||
args: "--target aarch64-unknown-linux-gnu"
|
||||
- platform: "windows-latest"
|
||||
args: ""
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: pnpm
|
||||
|
||||
|
||||
- name: install Rust nightly
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
|
||||
targets: ${{ matrix.platform == 'macos-14' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './desktop/src-tauri -> target'
|
||||
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-22.04-arm' # This must match the platform value defined above.
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
|
||||
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
|
||||
|
||||
- name: Import Apple Developer Certificate
|
||||
if: matrix.platform == 'macos-14'
|
||||
env:
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||
run: |
|
||||
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
|
||||
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security default-keychain -s build.keychain
|
||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security set-keychain-settings -t 3600 -u build.keychain
|
||||
|
||||
# Add build.keychain to the user keychain search list so that codesign
|
||||
# (invoked later by tauri-action WITHOUT an explicit --keychain) can
|
||||
# resolve the signing identity from it.
|
||||
security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')
|
||||
|
||||
echo "Created keychain"
|
||||
|
||||
curl https://droposs.org/drop.der --output drop.der
|
||||
|
||||
# swiftc libs/appletrust/add-certificate.swift
|
||||
# ./add-certificate drop.der
|
||||
# rm add-certificate
|
||||
|
||||
# echo "Added certificate to keychain using swift util"
|
||||
|
||||
## Script is equivalent to:
|
||||
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||
sudo security add-trusted-cert -d -r trustRoot -k build.keychain -p codeSign -u -1 drop.der
|
||||
sudo security authorizationdb remove com.apple.trust-settings.admin
|
||||
|
||||
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
|
||||
echo "Imported certificate"
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security find-identity -v -p codesigning build.keychain
|
||||
|
||||
- name: Verify Certificate
|
||||
if: matrix.platform == 'macos-14'
|
||||
run: |
|
||||
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Drop OSS")
|
||||
CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}')
|
||||
echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV
|
||||
echo "Certificate imported. Using identity: $CERT_ID"
|
||||
|
||||
- name: install frontend dependencies
|
||||
run: pnpm install # change this to npm, pnpm or bun depending on which one you use.
|
||||
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Do NOT set APPLE_CERTIFICATE / APPLE_CERTIFICATE_PASSWORD here. Doing so
|
||||
# makes tauri-action import the cert into its own throwaway keychain and
|
||||
# look up the identity by Apple-only name prefixes (e.g.
|
||||
# "Developer ID Application:"), which never matches our "Drop OSS" cert
|
||||
# and fails with "failed to resolve signing identity". Instead we rely on
|
||||
# the build.keychain prepared above and only pass the resolved identity.
|
||||
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
|
||||
NO_STRIP: true
|
||||
with:
|
||||
tagName: ${{ inputs.print_tags || 'v__VERSION__' }} # the action automatically replaces \_\_VERSION\_\_ with the app version.
|
||||
releaseName: "Auto-release v__VERSION__"
|
||||
releaseBody: "See the assets to download this version and install. This release was created automatically."
|
||||
releaseDraft: false
|
||||
prerelease: true
|
||||
args: ${{ matrix.args }}
|
||||
projectPath: './desktop'
|
||||
@@ -1,56 +0,0 @@
|
||||
name: Droplet CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
paths:
|
||||
- "libraries/droplet/**"
|
||||
- "libraries/droplet_types/**"
|
||||
- "libraries/libarchive/**"
|
||||
- ".github/workflows/droplet-ci.yml"
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
paths:
|
||||
- "libraries/droplet/**"
|
||||
- "libraries/droplet_types/**"
|
||||
- "libraries/libarchive/**"
|
||||
- ".github/workflows/droplet-ci.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: Build, Test, Lint
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: libraries/droplet
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "./libraries/droplet -> target"
|
||||
|
||||
- name: Install libarchive
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libarchive-dev
|
||||
|
||||
- name: Check formatting
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: Run Clippy (lint)
|
||||
run: cargo clippy --all-targets --all-features -- -D warnings
|
||||
|
||||
- name: Run tests
|
||||
run: cargo test --all-features --all --verbose
|
||||
@@ -1,100 +0,0 @@
|
||||
name: Deploy website to GitHub Pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: [develop]
|
||||
paths:
|
||||
- "sites/promo/**"
|
||||
- "sites/docs/**"
|
||||
- "package.json"
|
||||
- "pnpm-lock.yaml"
|
||||
- "pnpm-workspace.yaml"
|
||||
- ".github/workflows/pages.yml"
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment per the "pages" group, skipping runs queued
|
||||
# between the in-progress run and the latest queued one. cancel-in-progress defaults
|
||||
# to false, so in-flight production deployments are allowed to complete.
|
||||
concurrency: "pages"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "pnpm"
|
||||
|
||||
# Only install the promo site (radiant) and docs site (docs-next) and their
|
||||
# dependencies so the public website deploy stays decoupled from the
|
||||
# server/desktop build pipelines.
|
||||
- name: Install dependencies
|
||||
run: pnpm install --filter radiant... --filter docs-next...
|
||||
|
||||
- name: Setup Pages
|
||||
id: setup_pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
sites/promo/.next/cache
|
||||
# Generate a new cache whenever packages or source files change.
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('sites/promo/**.[jt]s', 'sites/promo/**.[jt]sx') }}
|
||||
# If source files changed but packages didn't, rebuild from a prior cache.
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
|
||||
|
||||
- name: Build promo site with Next.js
|
||||
working-directory: sites/promo
|
||||
run: pnpm run build
|
||||
env:
|
||||
PAGES_BASE_PATH: ${{ steps.setup_pages.outputs.base_path }}
|
||||
|
||||
- name: Build docs site with Astro
|
||||
working-directory: sites/docs
|
||||
run: pnpm run build
|
||||
|
||||
# Nest the Starlight docs (built with base: "/docs") inside the promo export
|
||||
# so both ship from a single GitHub Pages deployment at /docs.
|
||||
- name: Assemble docs into /docs
|
||||
run: |
|
||||
rm -rf sites/promo/out/docs
|
||||
mkdir -p sites/promo/out/docs
|
||||
cp -r sites/docs/dist/. sites/promo/out/docs/
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: sites/promo/out
|
||||
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -1,71 +0,0 @@
|
||||
name: Server CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
paths:
|
||||
- "server/**"
|
||||
- "libraries/base/**"
|
||||
- "package.json"
|
||||
- "pnpm-lock.yaml"
|
||||
- "pnpm-workspace.yaml"
|
||||
- ".github/workflows/server-ci.yml"
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
paths:
|
||||
- "server/**"
|
||||
- "libraries/base/**"
|
||||
- "package.json"
|
||||
- "pnpm-lock.yaml"
|
||||
- "pnpm-workspace.yaml"
|
||||
- ".github/workflows/server-ci.yml"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
typecheck:
|
||||
name: Typecheck
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Typecheck
|
||||
working-directory: server
|
||||
run: pnpm run typecheck
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint
|
||||
working-directory: server
|
||||
run: pnpm run lint
|
||||
@@ -1,157 +0,0 @@
|
||||
name: Build and release server
|
||||
|
||||
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
|
||||
|
||||
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 }}
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 3 # fix for when this gets triggered by tag
|
||||
fetch-tags: true
|
||||
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: |
|
||||
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: Build and push by digest
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
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 }}
|
||||
|
||||
- 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
|
||||
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
|
||||
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: 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: Inspect image
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
||||
+33
-2
@@ -1,2 +1,33 @@
|
||||
dist/
|
||||
node_modules/
|
||||
# Nuxt dev/build outputs
|
||||
.output
|
||||
.data
|
||||
.nuxt
|
||||
.nitro
|
||||
.cache
|
||||
dist
|
||||
|
||||
# Node dependencies
|
||||
node_modules
|
||||
.yarn
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.fleet
|
||||
.idea
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
.data
|
||||
|
||||
|
||||
# deploy template
|
||||
deploy-template/*
|
||||
|
||||
!deploy-template/compose.yml
|
||||
@@ -0,0 +1,31 @@
|
||||
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
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "drop-base"]
|
||||
path = drop-base
|
||||
url = https://github.com/Drop-OSS/drop-base.git
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"spellchecker.ignoreWordsList": [
|
||||
"mTLS",
|
||||
"Wireguard"
|
||||
],
|
||||
"sqltools.connections": [
|
||||
{
|
||||
"previewLimit": 50,
|
||||
"server": "localhost",
|
||||
"port": 5432,
|
||||
"driver": "PostgreSQL",
|
||||
"name": "drop",
|
||||
"database": "drop",
|
||||
"username": "drop",
|
||||
"password": "drop"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
"@drop:registry" "https://lab.deepcore.dev/api/v4/projects/57/packages/npm/"
|
||||
+235
@@ -0,0 +1,235 @@
|
||||
# CONTRIBUTING GUIDELINES
|
||||
|
||||
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.
|
||||
|
||||
<!-- TOC updateonsave:true depthfrom:2 -->
|
||||
|
||||
- [Reporting Issues](#reporting-issues)
|
||||
- [You have a problem](#you-have-a-problem)
|
||||
- [You have a suggestion](#you-have-a-suggestion)
|
||||
- [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)
|
||||
- [Commit Guidelines](#commit-guidelines)
|
||||
- [Format](#format)
|
||||
- [Style](#style)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
## 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.
|
||||
|
||||
<!--
|
||||
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
|
||||
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.
|
||||
|
||||
## Submitting Pull Requests
|
||||
|
||||
### Getting started
|
||||
|
||||
You should be familiar with the basics of
|
||||
[contributing on GitHub](https://help.github.com/articles/using-pull-requests)
|
||||
<!--and have a fork
|
||||
[properly set up](https://github.com/drop/docs/Contribution-Technical-Practices).
|
||||
-->
|
||||
|
||||
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).
|
||||
|
||||
----
|
||||
|
||||
## 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 <email>
|
||||
```
|
||||
|
||||
- `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.
|
||||
|
||||
----
|
||||
|
||||
<!--
|
||||
## Volunteer
|
||||
|
||||
Very nice!! :)
|
||||
|
||||
Please have a look at the [Volunteer](https://github.com/ohmyzsh/ohmyzsh/wiki/Volunteers)
|
||||
page for instructions on where to start and more.
|
||||
-->
|
||||
## 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.
|
||||
+19
-96
@@ -1,105 +1,28 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# pull pre-configured and updated build environment
|
||||
FROM registry.deepcore.dev/drop-oss/drop-server-build-environment/main:latest AS build-system
|
||||
|
||||
# Pinned to bookworm so the glibc here matches the torrential build stage
|
||||
# and the libarchive runtime package is named `libarchive13` (trixie renames it to libarchive13t64).
|
||||
FROM node:lts-bookworm-slim AS base
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
WORKDIR /app
|
||||
|
||||
## so corepack knows pnpm's version
|
||||
COPY . .
|
||||
## 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
|
||||
# Bookworm-pinned to match the runtime image's glibc (a trixie build would not run on bookworm).
|
||||
FROM rustlang/rust:nightly-bookworm-slim AS torrential-build
|
||||
## libarchive-dev + pkg-config let libarchive3-sys link libarchive dynamically (glibc).
|
||||
## protobuf-compiler is kept for parity (torrential's build.rs uses a vendored protoc).
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pkg-config \
|
||||
libarchive-dev \
|
||||
protobuf-compiler \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# setup workdir
|
||||
RUN mkdir /build
|
||||
WORKDIR /build
|
||||
|
||||
# install dependencies and build
|
||||
RUN corepack enable
|
||||
COPY . .
|
||||
RUN cargo build --release --manifest-path ./torrential/Cargo.toml
|
||||
|
||||
### BUILD APP
|
||||
FROM base AS build-system
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NUXT_TELEMETRY_DISABLED=1
|
||||
|
||||
## add git so drop can determine its git ref at build
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
## copy deps and rest of project files
|
||||
COPY . .
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
|
||||
|
||||
ARG BUILD_DROP_VERSION
|
||||
ARG BUILD_GIT_REF
|
||||
|
||||
## build
|
||||
RUN pnpm run --filter=drop postinstall && pnpm run --filter=drop build
|
||||
|
||||
RUN NUXT_TELEMETRY_DISABLED=1 yarn install
|
||||
RUN NUXT_TELEMETRY_DISABLED=1 yarn build
|
||||
|
||||
# create run environment for Drop
|
||||
FROM base AS run-system
|
||||
FROM node:lts-slim AS run-system
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NUXT_TELEMETRY_DISABLED=1
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
# The base stage's `COPY . .` puts the whole repo into the runtime WORKDIR (/app),
|
||||
# but at runtime only the artifacts copied explicitly below are needed. Drop the
|
||||
# inherited `torrential` source dir: the service resolves the binary by scanning
|
||||
# the cwd for `torrential`, and a directory there is spawned as ./torrential and
|
||||
# fails with EACCES. With it gone, resolution falls through to the `torrential`
|
||||
# binary installed on PATH (/usr/bin/torrential) below.
|
||||
RUN rm -rf /app/torrential
|
||||
COPY --from=build-system /build/.output ./app
|
||||
COPY --from=build-system /build/prisma ./prisma
|
||||
COPY --from=build-system /build/build ./startup
|
||||
|
||||
# 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
|
||||
## runtime deps:
|
||||
## - libarchive13: torrential now links libarchive dynamically (glibc build)
|
||||
## - p7zip-full: provides the 7z CLI
|
||||
## - nginx: front-end proxy
|
||||
## - openssl + ca-certificates: required by Prisma's query engine on Debian
|
||||
## pnpm itself is provided by corepack (enabled in the base stage)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libarchive13 \
|
||||
p7zip-full \
|
||||
nginx \
|
||||
openssl \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN pnpm install prisma@7.7.0 --global
|
||||
# init prisma to download all required files
|
||||
RUN pnpm prisma init
|
||||
# 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
|
||||
|
||||
COPY --from=build-system /app/server/prisma.config.ts ./
|
||||
COPY --from=build-system /app/server/.output ./app
|
||||
COPY --from=build-system /app/server/prisma ./prisma
|
||||
COPY --from=build-system /app/server/build ./startup
|
||||
COPY --from=build-system /app/server/build/nginx.conf /nginx.conf
|
||||
COPY --from=torrential-build /build/torrential/target/release/torrential /usr/bin/
|
||||
|
||||
ENV LIBRARY="/library"
|
||||
ENV DATA="/data"
|
||||
ENV NGINX_CONFIG="/nginx.conf"
|
||||
# Nuxt's port
|
||||
ENV PORT=4000
|
||||
|
||||
CMD ["sh", "/app/startup/launch.sh"]
|
||||
CMD ["/app/startup/launch.sh"]
|
||||
@@ -1,37 +1,79 @@
|
||||
<div align="center">
|
||||
<img src="https://raw.githubusercontent.com/Drop-OSS/media-sources/refs/heads/main/drop.svg" width="200rem"/>
|
||||
<img src="https://raw.githubusercontent.com/Drop-OSS/media-sources/refs/heads/main/drop.svg" width="400rem"/>
|
||||
</div>
|
||||
<br/>
|
||||
<div align="center">
|
||||
<a href="CONTRIBUTING.md">Contribution guide</a>
|
||||
<a href="https://deepcore.dev">Our website</a>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](LICENSE)
|
||||
[](https://lab.deepcore.dev/drop-oss/drop/-/pipelines)
|
||||
[](https://discord.gg/ZVGggfXN)
|
||||
[](https://conventionalcommits.org)
|
||||
|
||||
# Drop
|
||||
|
||||
[](https://droposs.org)
|
||||
[](https://droposs.org/docs)
|
||||
[](https://forum.droposs.org)
|
||||
[](LICENSE)
|
||||
[](https://discord.gg/ACq4qZp4a9)
|
||||
[](https://opencollective.com/drop-oss)
|
||||
[
|
||||
](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.
|
||||
|
||||
<div align="center">
|
||||
<img src="https://droposs.org/_ipx/f_webp&q_80/images/carousel/store.png" alt="Drop Screenshot" width="900rem"/>
|
||||
</div>
|
||||
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://droposs.org/docs/admin/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 <GAME_NAME>` with the name of the game which you would like to register
|
||||
4. `cd <GAME_NAME>`
|
||||
5. `mkdir <VERSION_NAME>` 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. 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
|
||||
|
||||
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
|
||||
|
||||
## 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.
|
||||
|
||||
[](https://translate.droposs.org/engage/drop/)
|
||||
Please see the [in-depth contributing guide](CONTRIBUTING.md)
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
# 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@droposs.org](mailto:security@droposs.org)
|
||||
can be fixed. Instead, please email [security@deepcore.dev](mailto:security@deepcore.dev)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
<ModalStack />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
await updateUser();
|
||||
</script>
|
||||
@@ -1,3 +1,7 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
$motiva: (
|
||||
("MotivaSansThin.ttf", "ttf", 100, normal),
|
||||
("MotivaSansLight.woff.ttf", "woff", 300, normal),
|
||||
@@ -62,16 +66,4 @@ $helvetica: (
|
||||
}
|
||||
.carousel__pagination-button--active:hover::after {
|
||||
background-color: #d4d4d8;
|
||||
}
|
||||
|
||||
.store-carousel > .carousel__viewport {
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
html {
|
||||
background-color: oklch(0.21 0.006 285.885);
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
/bin
|
||||
@@ -1,19 +0,0 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
)
|
||||
|
||||
func connect() {
|
||||
conn, err := pgx.Connect(context.Background(), os.Getenv("DATABASE_URL"))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer conn.Close(context.Background())
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
module drop/core
|
||||
|
||||
go 1.26.1
|
||||
|
||||
require (
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/pgx/v5 v5.9.1 // indirect
|
||||
golang.org/x/text v0.29.0 // indirect
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgx/v5 v5.9.1 h1:uwrxJXBnx76nyISkhr33kQLlUqjv7et7b9FjCen/tdc=
|
||||
github.com/jackc/pgx/v5 v5.9.1/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
@@ -1,5 +0,0 @@
|
||||
module drop
|
||||
|
||||
go 1.26.1
|
||||
|
||||
require github.com/gorilla/mux v1.8.1
|
||||
@@ -1,2 +0,0 @@
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
@@ -1,3 +0,0 @@
|
||||
go 1.26.1
|
||||
|
||||
use ./core
|
||||
@@ -1,9 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
|
||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
@@ -1,37 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func handler(res http.ResponseWriter, req *http.Request) {
|
||||
fmt.Fprintf(res, "G'day there mate")
|
||||
}
|
||||
func routingMiddleware(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
url := *r.URL
|
||||
url.Path = strings.TrimSuffix(r.URL.Path, "/")
|
||||
r.URL = &url
|
||||
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
func main() {
|
||||
r := mux.NewRouter().StrictSlash(true)
|
||||
r.Use(routingMiddleware)
|
||||
|
||||
r.HandleFunc("/api/v1", handler)
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: ":3433",
|
||||
Handler: r,
|
||||
}
|
||||
log.Printf("starting drop server on :3433")
|
||||
srv.ListenAndServe()
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This file starts up the Drop server by running migrations and then starting the executable
|
||||
echo "[Drop] performing migrations..."
|
||||
pnpm prisma migrate deploy
|
||||
prisma migrate deploy
|
||||
|
||||
# Actually start the application
|
||||
node /app/app/server/index.mjs
|
||||
node /app/app/server/index.mjs
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
|
||||
|
||||
## Release 0.1.0-beta
|
||||
|
||||
### Fixes
|
||||
- remove dynamic imports #0f10626
|
||||
- fix for missing developers or publishers #25fc957
|
||||
- split prisma schemas #2859005
|
||||
- results are returned alphabetically #33d3770
|
||||
- properly disconnect websockets from task handler #5358f1f
|
||||
- follow best practices #54c5d55
|
||||
- future lenience #5c78b20
|
||||
- fixed websocket authentication #62ea9a1
|
||||
- fix delta manifest generation #6df560c
|
||||
- admin invitation w/ system user #8463e35
|
||||
- properly import icons #8945196
|
||||
- prisma create footprint #952ece8
|
||||
- game panel now always shows 3 lines exactly #9c2249e
|
||||
- remove unnecessary import #a361c38
|
||||
- fix types #b511b40
|
||||
- fix expires requirement in the admin endpoint #c7b675f
|
||||
- moved icons and created PlatformClient so we can use the enum on the frontend #cada630
|
||||
- only show versions that are directories #ef8f3ae
|
||||
|
||||
|
||||
### Features
|
||||
- update prisma & delete games #089c3e0
|
||||
- fetch game endpoint #1f4d075
|
||||
- under the hood organisation and consolidation #26a31f6
|
||||
- introduction of 'system user' #2c21a23
|
||||
- automatically create library folder if it doesn't exist #39fe9d5
|
||||
- smoother bar in admin task ui #4488ae2
|
||||
- add version metadata route #5393db3
|
||||
- completed admin UI, with minor changes to backend #599da0e
|
||||
- keep track of last connected #69e4c25
|
||||
- added notification system w/ interwoven refactoring #6e6f09d
|
||||
- content length header for chunk downloads #76bceb1
|
||||
- add title to tab #7b0756c
|
||||
- add button to open in admin panel #7b3b919
|
||||
- client capability framework + peer API configuration #7d72a86
|
||||
- generate a server certificate for mtls APIs #9c4b6f3
|
||||
- new endpoints, ui and beginnings of main store page #9cbdcbc
|
||||
- more subtle design improvements #a815542
|
||||
- add header #a8a152e
|
||||
- client side search #b50e27f
|
||||
- new ws handler #bc0c47c
|
||||
- user widget now redirects to actual page #bfafe02
|
||||
- require lowercase usernames #d7160ab
|
||||
- more ui improvements #e408ac5
|
||||
- slightly improved game page #e796b46
|
||||
- game carousel #ecc819e
|
||||
- add enum dictionary type #f2e0182
|
||||
- cleanup and raw accessors #f7d767d
|
||||
- add support for overriding UMU id #fd4a7d1
|
||||
|
||||
|
||||
### Other Changes
|
||||
- quexeky <git@quexeky.dev>
|
||||
- fixed manifest generation #03a37f7
|
||||
- manual ci/cd #03b0b0c
|
||||
- ability to fetch client certs for p2p #0a715fe
|
||||
- disable tls in build #0f80fcd
|
||||
- Updated README.md #17971e0
|
||||
- initial work on metadata system #196f87c
|
||||
- more ui #1bd19ad
|
||||
- remove log statements #1d5e1bd
|
||||
- small fixes & SSR disabled #1f575b2
|
||||
- update information and setup guide #2236622
|
||||
- metadata engine #22ac7f6
|
||||
- Update CONTRIBUTING.md #2309407
|
||||
- slight bug fixes and clean up #24a0d11
|
||||
- almst complete admin ui and initial store designs #27070b6
|
||||
- handshakes #2b4382d
|
||||
- user mobile header #2e44ef3
|
||||
- more consistent naming for globals #305de9f
|
||||
- replaced markdown-it with micromark #31e8359
|
||||
- fixes to store page for mobile clients #328b9ba
|
||||
- game version re-ordering #329c74d
|
||||
- verbose yarn install #36568c3
|
||||
- patch for no version check in manifest generation #395219d
|
||||
- migrate bcrypt to bcryptjs #3a51c9c
|
||||
- added download chunk endpoint #3dd6062
|
||||
- Update README.md #425934d
|
||||
- build only ci #4273a20
|
||||
- object storage + full permission system + testing #435551c
|
||||
- rename admin socket session map #44c6028
|
||||
- bump droplet and add vue carousel #46551f9
|
||||
- version importing #46c8f0c
|
||||
- back to yarn, with nuxt telemetry force disabled #46d35ad
|
||||
- finished object endpoints #486bce8
|
||||
- update dependencies and add note about optional dependencies #4fa771a
|
||||
- use configuration from docs for ci/cd #52315d0
|
||||
- slight fixes to register logic #583301f
|
||||
- removed yarn.lock #584bcf1
|
||||
- Version bump #5f29c28
|
||||
- immutable application settings framework #5fe2036
|
||||
- fixed docker daemon location #62a111b
|
||||
- copy autodevops configuration #6328c24
|
||||
- Delete .gitlab-ci.yml #69f341b
|
||||
- admin ui shell #6b5e48d
|
||||
- bump @drop/droplet version for windows developers #6ba5cdd
|
||||
- Add LICENSE #6e2dc89
|
||||
- task API #718f5ba
|
||||
- use gitlab ci variable declaration #7194d35
|
||||
- move icons into dedicated folder #74fa671
|
||||
- another stage of client authentication #7523e53
|
||||
- refactoring #7869043
|
||||
- moved windows logo into logos dir #789d3ba
|
||||
- updated text colours across app #7a88f4c
|
||||
- starting docs infra #7d2a1c6
|
||||
- more cleaning #7e17626
|
||||
- slight patch to rename query to be more consistent #7f4db0c
|
||||
- move to raw docker #803752e
|
||||
- server side and user client side completed for registration #848a611
|
||||
- beginnings of download implementation #8674ac7
|
||||
- more consistent naming for object handler #87230fb
|
||||
- use autodevops build stage #886beb6
|
||||
- Updated tailwind config #88c95d6
|
||||
- change name of store file #8999303
|
||||
- split prisma schemas #9011cf5
|
||||
- client initiate #909432a
|
||||
- more client routes to support Drop app update #91b7e10
|
||||
- additional polish and QoL features #93bc143
|
||||
- upload images to games #9b7ee4e
|
||||
- migrate to pnpm due to ci/cd issues with yarn #9cb2d6d
|
||||
- run yarn install in CI/CD non interactively #a208fbe
|
||||
- completed game importing; partial work on version importing #a7c33e7
|
||||
- remove canvas from dependencies #a8f58eb
|
||||
- fix registry authentication #ad25d3e
|
||||
- consolidate type utils #adb4b73
|
||||
- Updated README.md #b0ef675
|
||||
- add proper carousel to store page #b2ab827
|
||||
- move to yarn v2 #b744671
|
||||
- remove client API deadweight #b9ae26c
|
||||
- add expires field #be6c30d
|
||||
- ca groundwork #bfafd2a
|
||||
- cleanup & polish #c355f6f
|
||||
- remove bcrypt (debug) #c3914cc
|
||||
- non rounded bottom #c4391d3
|
||||
- failed gracefully on invalid chunk index #c4a3e4e
|
||||
- update deploy template #c4a419f
|
||||
- migrate to new droplet ca system #c4d8113
|
||||
- docker based deployment #c5d00b4
|
||||
- updated CONTRIBUTING.md #cd0d2bf
|
||||
- update prisma version #ce0a9ab
|
||||
- README update #ceacd84
|
||||
- patch metadata handler #cf578bd
|
||||
- Added SECURITY.md #d3d93b0
|
||||
- finalised client APIs and authentication method #d4e2dc8
|
||||
- Update README.md #db916bf
|
||||
- object storage interface + utility functions #de388a9
|
||||
- initial commit #e1a789f
|
||||
- fixed task system #e1c1d7e
|
||||
- Update file chunk.get.ts #e4339c3
|
||||
- ui groundwork #e52f072
|
||||
- check for no version in manifest generation #eb3f9f9
|
||||
- break into single column store on lg devices #ecb381e
|
||||
- better server side signin redirects #ef13b68
|
||||
- patch signin #f3672f8
|
||||
|
||||
|
||||
_changelog generated by_ [go-conventional-commits](https://github.com/joselitofilho/go-conventional-commits)
|
||||
@@ -1 +0,0 @@
|
||||
use flake
|
||||
@@ -1,4 +0,0 @@
|
||||
/target
|
||||
logs/
|
||||
.vscode
|
||||
.direnv
|
||||
Generated
-3396
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
[package]
|
||||
name = "downpour"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.100"
|
||||
async-trait = "0.1.89"
|
||||
chrono = "0.4.43"
|
||||
clap = { version = "4.5.54", features = ["derive"] }
|
||||
console = "0.16.2"
|
||||
dialoguer = "0.12.0"
|
||||
dirs = "6.0.0"
|
||||
droplet-rs = { path = "../libraries/droplet" }
|
||||
fern = { version = "0.7.1", features = ["colored"] }
|
||||
futures = "0.3.31"
|
||||
indicatif = "0.18.3"
|
||||
log = "0.4.29"
|
||||
opendal = { version = "0.55.0", features = ["services-s3"] }
|
||||
rand = "0.9.2"
|
||||
reqwest = { version = "0.13.1", features = ["json"] }
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
serde_json = "1.0.148"
|
||||
tokio = { version = "1.48.0", features = ["fs", "macros"] }
|
||||
tokio-util = { version = "0.7.18", features = ["compat"] }
|
||||
url = "2.5.8"
|
||||
webbrowser = "1.0.6"
|
||||
@@ -1,3 +0,0 @@
|
||||
# CLI (`downpour`)
|
||||
|
||||
The cli way to access Drop. Used for admin tasks that require local access, like uploading game content.
|
||||
Generated
-96
@@ -1,96 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1768564909,
|
||||
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1744536153,
|
||||
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1768704795,
|
||||
"narHash": "sha256-Y33TAp2BHEcuspYvcmBXXD0qdvjftv73PwyKTDOjoSY=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "4b7472a78857ac789fb26616040f55cfcbd36c6e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
description = "Drop-OSS app development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
rust-overlay,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
libraries = with pkgs; [
|
||||
glib
|
||||
glibc
|
||||
openssl
|
||||
];
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
git
|
||||
rust-bin.nightly.latest.default
|
||||
rust-analyzer
|
||||
cargo-expand
|
||||
];
|
||||
|
||||
|
||||
buildInputs = libraries;
|
||||
|
||||
shellHook = ''
|
||||
export LD_LIBRARY_PATH="${
|
||||
pkgs.lib.makeLibraryPath libraries
|
||||
}:$LD_LIBRARY_PATH"
|
||||
echo "Downpour development environment loaded"
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
[toolchain]
|
||||
channel = "nightly"
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
# Downpour CLI spec
|
||||
`downpour [command] --opts`
|
||||
## Commands:
|
||||
- new <path/s3 name> <public endpoint> - creates/initalizes a depot at the endpoint. Creates manifest.json and speedtest
|
||||
- connect <s3 endpoint> <key> <secret> [name] - connects to an s3 endpoint and saves the endpoint to some sort of credentials file. Name is either as provided or the hostname of the endpoint
|
||||
- upload <game id> <localpath> <path/s3 name> - uploads game as described before. Should fail if depot isn't initialized with new from above
|
||||
- copy <game id> <version id> <src path/s3 name> <dest path/s3 name> - copies between two depots
|
||||
- mark [exists/absent] <game id> <version id> <path/s3 name> - modifies depot's manifest.json to show content exists or is absent without copying (for third party copies)
|
||||
- rename <public endpoint> <new public endpoint> - renames an endpoint [NEEDS API ROUTES - can't do yet]
|
||||
- delete <public endpoint> - delete an endpoint [NEEDS API ROUTES - can't do yet]
|
||||
@@ -1,69 +0,0 @@
|
||||
use clap::{Args, Parser, Subcommand, ValueEnum};
|
||||
|
||||
use crate::{commands::connect::config_option::ConfigOptionCli, interactive_variable};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(version, about, long_about = None)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Commands,
|
||||
|
||||
/// Specify data file path
|
||||
#[arg(short, long)]
|
||||
pub data: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Commands {
|
||||
/// Configures downpour endpoints
|
||||
Connect {
|
||||
#[arg(short, long)]
|
||||
name: Option<String>,
|
||||
#[command(subcommand)]
|
||||
option: ConfigOptionCli,
|
||||
},
|
||||
/// Uploads new game version to depot
|
||||
Upload {
|
||||
#[clap(flatten)]
|
||||
info: UploadInfoCli,
|
||||
#[arg(short, long)]
|
||||
/// Alias of a given connection
|
||||
name: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct UploadInfo {
|
||||
pub path: String,
|
||||
pub game_id: String,
|
||||
pub version_id: String,
|
||||
}
|
||||
#[derive(Args)]
|
||||
pub struct UploadInfoCli {
|
||||
/// Relative path to new version files
|
||||
#[arg(short, long, default_value_t = String::from("."))]
|
||||
pub path: String,
|
||||
/// ID of game to attach to
|
||||
#[arg(short, long)]
|
||||
pub game_id: Option<String>,
|
||||
/// Version ID to attach to
|
||||
#[arg(short, long)]
|
||||
pub version_id: Option<String>,
|
||||
}
|
||||
impl UploadInfoCli {
|
||||
pub fn interactive_configure(self) -> UploadInfo {
|
||||
let path = self.path;
|
||||
interactive_variable!(self, game_id, "Game ID");
|
||||
interactive_variable!(self, version_id, "Version ID");
|
||||
UploadInfo {
|
||||
path,
|
||||
game_id,
|
||||
version_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum UploadStyle {
|
||||
S3,
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
use crate::{
|
||||
commands::connect::{
|
||||
config_option::{ConfigOption, ConfigOptionCli},
|
||||
configurable::Configure,
|
||||
speedtest::{SPEEDTEST_PATH, Speedtest},
|
||||
},
|
||||
manifest::DepotManifest,
|
||||
};
|
||||
use dialoguer::{Confirm, theme::ColorfulTheme};
|
||||
use futures::AsyncWriteExt;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use log::{debug, info};
|
||||
use opendal::Operator;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashMap, fs, ops::Not};
|
||||
use tokio_util::compat::FuturesAsyncWriteCompatExt;
|
||||
|
||||
const CONFIG_DIR: &str = "downpour/config.json";
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Config {
|
||||
configurations: HashMap<String, ConfigOption>,
|
||||
active: Option<String>,
|
||||
}
|
||||
impl Config {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
configurations: HashMap::new(),
|
||||
active: None,
|
||||
}
|
||||
}
|
||||
pub fn exists(&self, name: &String) -> bool {
|
||||
self.configurations.contains_key(name)
|
||||
}
|
||||
pub fn save(&self) -> anyhow::Result<()> {
|
||||
let json = serde_json::to_string(self)?;
|
||||
let save_path = dirs::config_dir()
|
||||
.expect("Apparently your home directory doesn't exist") // Should probably formalise that error
|
||||
.join(CONFIG_DIR);
|
||||
fs::create_dir_all(save_path.parent().unwrap())?;
|
||||
fs::write(save_path, json)?;
|
||||
Ok(())
|
||||
}
|
||||
pub fn read() -> Self {
|
||||
let save_path = dirs::config_dir()
|
||||
.expect("Apparently your home directory doesn't exist") // Should probably formalise that error
|
||||
.join(CONFIG_DIR);
|
||||
if fs::exists(&save_path)
|
||||
.unwrap_or_else(|_| panic!("Could not read save path {:#?}", &save_path))
|
||||
{
|
||||
serde_json::from_str(&fs::read_to_string(save_path).unwrap()).unwrap()
|
||||
} else {
|
||||
Config::new()
|
||||
}
|
||||
}
|
||||
pub fn add_item(&mut self, name: String, object: ConfigOption) {
|
||||
if matches!(object, ConfigOption::S3(..)) {
|
||||
self.active = Some(name.clone())
|
||||
}
|
||||
self.configurations.insert(name, object);
|
||||
self.save().expect("Failed to save config");
|
||||
}
|
||||
|
||||
pub fn get_active(&self) -> Option<&ConfigOption> {
|
||||
if let Some(active) = &self.active {
|
||||
self.configurations.get(active)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
pub fn get<T: AsRef<str>>(&self, name: T) -> Option<&ConfigOption> {
|
||||
self.configurations.get(name.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn manage_configuration(
|
||||
config: &mut Config,
|
||||
name: Option<String>,
|
||||
option: ConfigOptionCli,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut name = name;
|
||||
if let Some(name) = &name
|
||||
&& config.exists(name)
|
||||
{
|
||||
let confirm = Confirm::with_theme(&ColorfulTheme::default())
|
||||
.with_prompt(format!(
|
||||
"An entry already exists with the name \"{}\". Would you like to overwrite it?",
|
||||
name
|
||||
))
|
||||
.interact()?;
|
||||
if !confirm {
|
||||
return Err(anyhow::anyhow!("User cancelled action"));
|
||||
}
|
||||
}
|
||||
let config_option = match option {
|
||||
ConfigOptionCli::S3(s3_config_cli) => s3_config_cli.clone().configure(&mut name).await?,
|
||||
};
|
||||
let name = name.expect("Default name was not provided by ConfigOption. This is a bug");
|
||||
config.add_item(name, config_option.clone());
|
||||
let operator = config_option.build()?;
|
||||
|
||||
generate_manifest(&operator).await?;
|
||||
info!("Finished uploading manifest");
|
||||
generate_speedtest(&operator).await?;
|
||||
info!("Finished uploading speedtest");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn generate_speedtest(operator: &Operator) -> anyhow::Result<()> {
|
||||
// Workaround to operator.exists("...") also logging a 404 warning
|
||||
let lister = operator.list_with(SPEEDTEST_PATH).limit(1).await?;
|
||||
if lister.is_empty().not() {
|
||||
info!("Speedtest already exists on Depot. Skipping speedtest upload...");
|
||||
return Ok(());
|
||||
}
|
||||
let mut writer = operator
|
||||
.writer(SPEEDTEST_PATH)
|
||||
.await?
|
||||
.into_futures_async_write()
|
||||
.compat_write();
|
||||
|
||||
let progress_bar = ProgressBar::new(10_000).with_style(
|
||||
ProgressStyle::default_bar()
|
||||
.template("[{elapsed_precise}] [ETA {eta}] {bar} {percent_precise}%")
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
let mut reader = Speedtest::new(|progress| {
|
||||
let progress_int = (progress * 100f32).round() as u64;
|
||||
progress_bar.set_position(progress_int);
|
||||
});
|
||||
let written = tokio::io::copy(&mut reader, &mut writer).await?;
|
||||
progress_bar.finish();
|
||||
debug!("Wrote {} bytes to {:?}", written, operator.info());
|
||||
writer.into_inner().close().await?;
|
||||
debug!("Closed writer");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn generate_manifest(operator: &Operator) -> anyhow::Result<()> {
|
||||
let lister = operator.list_with("manifest.json").limit(1).await?;
|
||||
if lister.is_empty().not() {
|
||||
info!("Manifest already exists on Depot. Skipping manifest upload...");
|
||||
return Ok(());
|
||||
}
|
||||
let data = DepotManifest::new();
|
||||
operator
|
||||
.write("manifest.json", serde_json::to_string(&data)?)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
use clap::Subcommand;
|
||||
use opendal::{Operator, layers::LoggingLayer};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
commands::connect::s3::{S3Config, S3ConfigCli},
|
||||
operator_builder::OperatorBuilder,
|
||||
};
|
||||
|
||||
#[derive(Subcommand, Clone)]
|
||||
pub enum ConfigOptionCli {
|
||||
// Connect to any S3-compatible endpoint
|
||||
S3(S3ConfigCli),
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub enum ConfigOption {
|
||||
S3(S3Config),
|
||||
}
|
||||
|
||||
impl ConfigOption {
|
||||
pub fn build(&self) -> anyhow::Result<Operator> {
|
||||
Ok(match self {
|
||||
ConfigOption::S3(s3_config) => s3_config.build()?,
|
||||
}
|
||||
.layer(LoggingLayer::default()))
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
use crate::commands::connect::config_option::ConfigOption;
|
||||
|
||||
pub trait Configure {
|
||||
async fn configure(self, name: &mut Option<String>) -> anyhow::Result<ConfigOption>;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use dialoguer::{Input, theme::ColorfulTheme};
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! interactive_variable {
|
||||
($value:ident, $var:ident, $prompt:expr) => {
|
||||
let $var = if let Some($var) = $value.$var {
|
||||
$var
|
||||
} else {
|
||||
$crate::commands::connect::interactive::query_variable($prompt).unwrap()
|
||||
};
|
||||
};
|
||||
}
|
||||
#[macro_export]
|
||||
macro_rules! interactive_optional_variable {
|
||||
($value:ident, $var:ident, $prompt:expr) => {
|
||||
let $var = if let Some($var) = $value.$var {
|
||||
Some($var)
|
||||
} else {
|
||||
$crate::commands::connect::interactive::query_optional_variable($prompt).unwrap()
|
||||
};
|
||||
};
|
||||
}
|
||||
pub fn query_variable<T: Clone + FromStr + ToString>(prompt: impl ToString) -> dialoguer::Result<T>
|
||||
where
|
||||
<T as FromStr>::Err: ToString,
|
||||
{
|
||||
Input::with_theme(&ColorfulTheme::default())
|
||||
.with_prompt(prompt.to_string())
|
||||
.interact_text()
|
||||
}
|
||||
pub fn query_optional_variable<T: Clone + FromStr + ToString>(
|
||||
prompt: impl ToString,
|
||||
) -> dialoguer::Result<Option<T>>
|
||||
where
|
||||
<T as FromStr>::Err: ToString,
|
||||
{
|
||||
let input: T = Input::with_theme(&ColorfulTheme::default())
|
||||
.with_prompt(prompt.to_string())
|
||||
.allow_empty(true)
|
||||
.interact_text()?;
|
||||
if input.to_string().is_empty() {
|
||||
return Ok(None);
|
||||
}
|
||||
Ok(Some(input))
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
pub mod config;
|
||||
pub mod configurable;
|
||||
pub mod s3;
|
||||
#[macro_use]
|
||||
pub mod interactive;
|
||||
pub mod config_option;
|
||||
pub mod speedtest;
|
||||
@@ -1,67 +0,0 @@
|
||||
use clap::Args;
|
||||
use opendal::Operator;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
commands::connect::{config_option::ConfigOption, configurable::Configure},
|
||||
interactive_variable,
|
||||
operator_builder::OperatorBuilder,
|
||||
};
|
||||
|
||||
#[derive(Args, Clone)]
|
||||
pub struct S3ConfigCli {
|
||||
key_id: Option<String>,
|
||||
secret_key: Option<String>,
|
||||
endpoint: Option<String>,
|
||||
region: Option<String>,
|
||||
bucket_name: Option<String>,
|
||||
root: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct S3Config {
|
||||
key_id: String,
|
||||
secret_key: String,
|
||||
endpoint: String,
|
||||
region: String,
|
||||
bucket_name: String,
|
||||
root: Option<String>,
|
||||
}
|
||||
|
||||
impl Configure for S3ConfigCli {
|
||||
async fn configure(self, name: &mut Option<String>) -> anyhow::Result<ConfigOption> {
|
||||
interactive_variable!(self, key_id, "S3 Key ID");
|
||||
interactive_variable!(self, secret_key, "S3 Secret Key");
|
||||
interactive_variable!(self, region, "S3 Region");
|
||||
interactive_variable!(self, bucket_name, "S3 Bucket Name");
|
||||
interactive_variable!(self, endpoint, "S3 Endpoint");
|
||||
if let None = name {
|
||||
*name = Some(endpoint.clone());
|
||||
}
|
||||
Ok(ConfigOption::S3(S3Config {
|
||||
secret_key,
|
||||
key_id,
|
||||
region,
|
||||
bucket_name,
|
||||
endpoint,
|
||||
root: self.root,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
impl OperatorBuilder for S3Config {
|
||||
fn build(&self) -> anyhow::Result<Operator> {
|
||||
let builder = opendal::services::S3::default()
|
||||
.access_key_id(&self.key_id)
|
||||
.secret_access_key(&self.secret_key)
|
||||
.region(&self.region)
|
||||
.endpoint(&self.endpoint)
|
||||
.root(self.root.as_deref().unwrap_or("/"))
|
||||
.bucket(&self.bucket_name)
|
||||
.disable_config_load();
|
||||
|
||||
let op: Operator = Operator::new(builder)?.finish();
|
||||
|
||||
Ok(op)
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
use rand::{RngCore, SeedableRng, rng, rngs::StdRng};
|
||||
use tokio::io::AsyncRead;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Speedtest<F: Fn(f32)> {
|
||||
core: rand::rngs::StdRng,
|
||||
to_write: usize,
|
||||
callback: Box<F>,
|
||||
}
|
||||
pub const SPEEDTEST_BYTES: usize = 64 * 1024 * 1024;
|
||||
pub const SPEEDTEST_PATH: &str = "speedtest";
|
||||
|
||||
impl<F: Fn(f32)> AsyncRead for Speedtest<F> {
|
||||
fn poll_read(
|
||||
self: std::pin::Pin<&mut Self>,
|
||||
_cx: &mut std::task::Context<'_>,
|
||||
buf: &mut tokio::io::ReadBuf<'_>,
|
||||
) -> std::task::Poll<std::io::Result<()>> {
|
||||
let mut s = self;
|
||||
let to_write = buf.remaining().min(s.to_write);
|
||||
|
||||
let filled = {
|
||||
let fill_slice = buf.initialize_unfilled_to(to_write);
|
||||
s.core.fill_bytes(fill_slice);
|
||||
fill_slice.len()
|
||||
};
|
||||
s.to_write = s.to_write.saturating_sub(filled);
|
||||
(s.callback)((1f32 - (s.to_write as f32 / SPEEDTEST_BYTES as f32)) * 100f32);
|
||||
buf.advance(filled);
|
||||
std::task::Poll::Ready(Ok(()))
|
||||
}
|
||||
}
|
||||
impl<F: Fn(f32)> Speedtest<F> {
|
||||
pub fn new(callback: F) -> Self {
|
||||
Self {
|
||||
core: StdRng::from_rng(&mut rng()),
|
||||
to_write: SPEEDTEST_BYTES,
|
||||
callback: Box::new(callback),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
pub mod connect;
|
||||
pub mod upload;
|
||||
@@ -1,79 +0,0 @@
|
||||
use std::path::Path;
|
||||
|
||||
use crate::{
|
||||
cli::UploadInfo,
|
||||
commands::connect::{config::Config, config_option::ConfigOption},
|
||||
manifest::{ClosureFactory, CompressionOption, DepotManifest, generate_v2_manifest},
|
||||
operator_builder::OperatorBuilder,
|
||||
};
|
||||
use futures::AsyncWriteExt;
|
||||
use log::info;
|
||||
use opendal::{FuturesAsyncWriter, Operator};
|
||||
use tokio_util::compat::{Compat, FuturesAsyncWriteCompatExt};
|
||||
|
||||
pub async fn upload(
|
||||
upload_info: &UploadInfo,
|
||||
config: Config,
|
||||
name: &Option<String>,
|
||||
) -> anyhow::Result<()> {
|
||||
let game_id = upload_info.game_id.clone();
|
||||
let path = upload_info.path.clone();
|
||||
let version_id = upload_info.version_id.clone();
|
||||
|
||||
let operator = get_operator(config, name)?;
|
||||
|
||||
let mut existing_depot_manifest = get_depot_manifest(&operator).await?;
|
||||
|
||||
info!("Uploading chunks");
|
||||
|
||||
let v2_manifest = generate_v2_manifest(
|
||||
Path::new(&path),
|
||||
ClosureFactory::new(
|
||||
async move |id: String| {
|
||||
info!("Uploading chunk id {id}");
|
||||
let writer = operator
|
||||
.writer(&format!("{game_id}/{version_id}/{id}"))
|
||||
.await
|
||||
.unwrap()
|
||||
.into_futures_async_write()
|
||||
.compat_write();
|
||||
writer
|
||||
},
|
||||
|writer: Compat<FuturesAsyncWriter>| async {
|
||||
writer.into_inner().close().await.unwrap();
|
||||
},
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
info!("Finished uploading chunks");
|
||||
|
||||
existing_depot_manifest.append(
|
||||
upload_info.game_id.to_string(),
|
||||
upload_info.version_id.to_string(),
|
||||
CompressionOption::None,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn get_depot_manifest(operator: &Operator) -> Result<DepotManifest, anyhow::Error> {
|
||||
let existing_depot_manifest = operator.read("manifest.json").await?.to_bytes();
|
||||
let existing_depot_manifest: DepotManifest =
|
||||
serde_json::from_slice(existing_depot_manifest.as_ref())?;
|
||||
Ok(existing_depot_manifest)
|
||||
}
|
||||
|
||||
fn get_operator(config: Config, name: &Option<String>) -> anyhow::Result<Operator> {
|
||||
let operator = match if let Some(name) = name {
|
||||
config
|
||||
.get(name)
|
||||
.ok_or(anyhow::anyhow!("Name does not exist"))?
|
||||
} else {
|
||||
config.get_active().ok_or(anyhow::anyhow!(
|
||||
"No active connection set. Please specify with --name"
|
||||
))?
|
||||
} {
|
||||
ConfigOption::S3(s3_config) => s3_config.build()?,
|
||||
};
|
||||
Ok(operator)
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
pub mod interface;
|
||||
@@ -1,53 +0,0 @@
|
||||
use fern::colors::{Color, ColoredLevelConfig};
|
||||
use log::LevelFilter;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
|
||||
pub fn configure_logging() -> anyhow::Result<()> {
|
||||
let log_level = env::var("RUST_LOG")
|
||||
.unwrap_or_else(|_| "info".to_string())
|
||||
.parse::<LevelFilter>()?;
|
||||
|
||||
let log_dir = env::var("LOG_FILE_DIR").unwrap_or_else(|_| "logs".to_string());
|
||||
|
||||
fs::create_dir_all(&log_dir)?;
|
||||
|
||||
let colors = ColoredLevelConfig::new()
|
||||
.error(Color::Red)
|
||||
.warn(Color::Yellow)
|
||||
.info(Color::Blue)
|
||||
.debug(Color::Green)
|
||||
.trace(Color::Magenta);
|
||||
|
||||
fern::Dispatch::new()
|
||||
.chain(
|
||||
fern::Dispatch::new()
|
||||
.format(move |out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"[{}] {}: {}",
|
||||
chrono::Local::now().format("%H:%M:%S%.3f"),
|
||||
colors.color(record.level()),
|
||||
message
|
||||
))
|
||||
})
|
||||
.chain(io::stdout()),
|
||||
)
|
||||
.chain(
|
||||
fern::Dispatch::new()
|
||||
.format(|out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"[{}] {} {} - {}",
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S%.3f"),
|
||||
record.level(),
|
||||
record.target(),
|
||||
message
|
||||
))
|
||||
})
|
||||
.chain(fern::log_file(format!("{}/app.log", log_dir))?),
|
||||
)
|
||||
.level(log_level)
|
||||
.apply()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#![feature(async_fn_traits)]
|
||||
|
||||
use crate::commands::connect::config::manage_configuration;
|
||||
use crate::{
|
||||
cli::{Cli, Commands},
|
||||
commands::connect::config::Config,
|
||||
commands::upload,
|
||||
};
|
||||
use clap::Parser;
|
||||
mod cli;
|
||||
mod commands;
|
||||
mod logging;
|
||||
mod manifest;
|
||||
mod operator_builder;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
crate::logging::configure_logging()?;
|
||||
|
||||
let cli = Cli::parse();
|
||||
|
||||
let mut config = Config::read();
|
||||
match cli.command {
|
||||
Commands::Connect { name, option } => {
|
||||
manage_configuration(&mut config, name, option).await?
|
||||
}
|
||||
Commands::Upload { info, name } => {
|
||||
let info = info.interactive_configure();
|
||||
upload::interface::upload(&info, config, &name).await?;
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
use std::{collections::HashMap, path::Path};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use droplet_rs::manifest::{Manifest, ManifestWriterFactory, generate_manifest_rusty};
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use log::info;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::io::AsyncWrite;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct DepotManifest {
|
||||
content: HashMap<String, DepotManifestGameData>,
|
||||
}
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct DepotManifestGameData {
|
||||
version_id: String,
|
||||
compression: CompressionOption,
|
||||
}
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum CompressionOption {
|
||||
None,
|
||||
Gzip,
|
||||
Zstd,
|
||||
}
|
||||
impl DepotManifest {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
content: HashMap::new(),
|
||||
}
|
||||
}
|
||||
pub fn append(&mut self, game_id: String, version_id: String, compression: CompressionOption) {
|
||||
self.content.insert(
|
||||
game_id,
|
||||
DepotManifestGameData {
|
||||
version_id,
|
||||
compression,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ClosureFactory<Writer, Factory, Closer>
|
||||
where
|
||||
Writer: AsyncWrite + Unpin,
|
||||
Factory: AsyncFn(String) -> Writer,
|
||||
Closer: AsyncFn(Writer),
|
||||
{
|
||||
writer: Factory,
|
||||
closer: Closer,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<
|
||||
W: AsyncWrite + Unpin + Send + Sync,
|
||||
F: AsyncFn(String) -> W + Send + Sync + 'static,
|
||||
C: AsyncFn(W) + Send + Sync,
|
||||
> ManifestWriterFactory for ClosureFactory<W, F, C>
|
||||
where
|
||||
for<'a> F::CallRefFuture<'a>: Send,
|
||||
for<'b> C::CallRefFuture<'b>: Send,
|
||||
{
|
||||
type Writer = W;
|
||||
|
||||
async fn create(&self, id: String) -> anyhow::Result<Self::Writer> {
|
||||
let func = &self.writer;
|
||||
let output = func(id).await;
|
||||
Ok(output)
|
||||
}
|
||||
async fn close(&self, writer: Self::Writer) -> anyhow::Result<()> {
|
||||
let func = &self.closer;
|
||||
func(writer).await;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<
|
||||
W: AsyncWrite + Unpin + Send + Sync,
|
||||
F: AsyncFn(String) -> W + Send + Sync + 'static,
|
||||
C: AsyncFn(W) + Sync,
|
||||
> ClosureFactory<W, F, C>
|
||||
where
|
||||
for<'a> F::CallRefFuture<'a>: Send,
|
||||
for<'b> C::CallRefFuture<'b>: Send,
|
||||
{
|
||||
pub fn new(f: F, c: C) -> Self {
|
||||
Self {
|
||||
writer: f,
|
||||
closer: c,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn generate_v2_manifest<Factory>(dir: &Path, factory: Factory) -> anyhow::Result<Manifest>
|
||||
where
|
||||
Factory: ManifestWriterFactory,
|
||||
{
|
||||
let progress_bar = ProgressBar::new(10_000).with_style(
|
||||
ProgressStyle::default_bar()
|
||||
.template("[{elapsed_precise}] [ETA {eta}] {bar} {percent_precise}%")
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
generate_manifest_rusty(
|
||||
dir,
|
||||
|progress| {
|
||||
let progress_int = (progress * 100f32).round() as u64;
|
||||
progress_bar.set_position(progress_int);
|
||||
},
|
||||
|log| progress_bar.suspend(|| info!("{}", log)),
|
||||
Some(&factory),
|
||||
None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
use opendal::Operator;
|
||||
|
||||
pub trait OperatorBuilder {
|
||||
fn build(&self) -> anyhow::Result<Operator>;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<div class="inline-flex divide-x divide-zinc-900">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex justify-center items-center gap-x-2 rounded-l-md aspect-[7/2] px-3 py-2 bg-blue-600 grow text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
|
||||
>
|
||||
Add to Library
|
||||
<PlusIcon class="-mr-0.5 size-6" aria-hidden="true" />
|
||||
</button>
|
||||
<Menu as="div" class="relative inline-block text-left grow">
|
||||
<div class="h-full">
|
||||
<MenuButton
|
||||
class="inline-flex h-full w-full justify-center items-center rounded-r-md bg-blue-600 p-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
|
||||
>
|
||||
<ChevronDownIcon
|
||||
class="size-5"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</MenuButton>
|
||||
</div>
|
||||
|
||||
<transition
|
||||
enter-active-class="transition ease-out duration-100"
|
||||
enter-from-class="transform opacity-0 scale-95"
|
||||
enter-to-class="transform opacity-100 scale-100"
|
||||
leave-active-class="transition ease-in duration-75"
|
||||
leave-from-class="transform opacity-100 scale-100"
|
||||
leave-to-class="transform opacity-0 scale-95"
|
||||
>
|
||||
<MenuItems
|
||||
class="absolute right-0 z-10 mt-2 w-56 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black/5 focus:outline-none"
|
||||
>
|
||||
<div class="py-1">
|
||||
<MenuItem v-slot="{ active }">
|
||||
<a
|
||||
href="#"
|
||||
:class="[
|
||||
active
|
||||
? 'bg-gray-100 text-gray-900 outline-none'
|
||||
: 'text-gray-700',
|
||||
'block px-4 py-2 text-sm',
|
||||
]"
|
||||
>Account settings</a
|
||||
>
|
||||
</MenuItem>
|
||||
<MenuItem v-slot="{ active }">
|
||||
<a
|
||||
href="#"
|
||||
:class="[
|
||||
active
|
||||
? 'bg-gray-100 text-gray-900 outline-none'
|
||||
: 'text-gray-700',
|
||||
'block px-4 py-2 text-sm',
|
||||
]"
|
||||
>Support</a
|
||||
>
|
||||
</MenuItem>
|
||||
<MenuItem v-slot="{ active }">
|
||||
<a
|
||||
href="#"
|
||||
:class="[
|
||||
active
|
||||
? 'bg-gray-100 text-gray-900 outline-none'
|
||||
: 'text-gray-700',
|
||||
'block px-4 py-2 text-sm',
|
||||
]"
|
||||
>License</a
|
||||
>
|
||||
</MenuItem>
|
||||
<form method="POST" action="#">
|
||||
<MenuItem v-slot="{ active }">
|
||||
<button
|
||||
type="submit"
|
||||
:class="[
|
||||
active
|
||||
? 'bg-gray-100 text-gray-900 outline-none'
|
||||
: 'text-gray-700',
|
||||
'block w-full px-4 py-2 text-left text-sm',
|
||||
]"
|
||||
>
|
||||
Sign out
|
||||
</button>
|
||||
</MenuItem>
|
||||
</form>
|
||||
</div>
|
||||
</MenuItems>
|
||||
</transition>
|
||||
</Menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
||||
import { ChevronDownIcon, PlusIcon } from "@heroicons/vue/20/solid";
|
||||
</script>
|
||||
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div class="flex flex-row flex-wrap gap-2 justify-center">
|
||||
<button
|
||||
v-for="(_, i) in amount"
|
||||
@click="() => slideTo(i)"
|
||||
:class="[
|
||||
currentSlide == i ? 'bg-blue-600 w-6' : 'bg-zinc-700 w-3',
|
||||
'transition-all cursor-pointer h-2 rounded-full',
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const maxSlide = inject("maxSlide", ref(1));
|
||||
const minSlide = inject("minSlide", ref(1));
|
||||
const currentSlide = inject("currentSlide", ref(1));
|
||||
const nav: { slideTo?: (index: number) => any } = inject("nav", {});
|
||||
|
||||
const amount = computed(() => maxSlide.value - minSlide.value + 1);
|
||||
|
||||
function slideTo(index: number) {
|
||||
if (!nav.slideTo) return console.warn(`error moving slide: nav not defined`);
|
||||
const offsetIndex = index + minSlide.value;
|
||||
nav.slideTo(offsetIndex);
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="user"
|
||||
class="flex grow flex-col gap-y-5 overflow-y-auto bg-zinc-900 px-6 pb-4 ring-1 ring-white/10"
|
||||
>
|
||||
<div class="flex h-16 shrink-0 items-center">
|
||||
<Wordmark />
|
||||
</div>
|
||||
|
||||
<nav class="flex flex-1 flex-col">
|
||||
<ul role="list" class="flex flex-1 flex-col gap-y-7">
|
||||
<li>
|
||||
<ul role="list" class="-mx-2 space-y-1">
|
||||
<DocsSidebarNavItem
|
||||
v-for="item in unwrappedNavigation ?? navigation"
|
||||
:key="item.name"
|
||||
:nav="item"
|
||||
/>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="mt-auto flex items-center">
|
||||
<div class="inline-flex items-center w-full text-zinc-300">
|
||||
<img
|
||||
:src="useObject(user.profilePicture)"
|
||||
class="w-5 h-5 rounded-sm"
|
||||
/>
|
||||
<span class="ml-3 text-sm font-bold">{{
|
||||
user.displayName
|
||||
}}</span>
|
||||
</div>
|
||||
<NuxtLink
|
||||
href="/"
|
||||
class="ml-auto rounded bg-blue-600 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
|
||||
>
|
||||
← Home
|
||||
</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchContentNavigation, useObject, useUser } from "#imports";
|
||||
|
||||
const user = useUser();
|
||||
|
||||
const navigation = await fetchContentNavigation();
|
||||
const unwrappedNavigation = navigation[0]?.children;
|
||||
</script>
|
||||
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<NuxtLink
|
||||
:href="props.nav._path"
|
||||
:class="[
|
||||
current
|
||||
? 'text-zinc-100'
|
||||
: 'text-zinc-400 hover:text-zinc-100 hover:bg-zinc-900',
|
||||
' group flex gap-x-3 rounded-md px-2 text-sm font-semibold leading-6',
|
||||
]"
|
||||
>
|
||||
{{ props.nav.title }}
|
||||
</NuxtLink>
|
||||
<ul class="pl-3 flex flex-col" v-if="children">
|
||||
<li v-for="child in children" class="inline-flex items-center">
|
||||
<ChevronDownIcon class="w-4 h-4 text-zinc-600 rotate-45" />
|
||||
<DocsSidebarNavItem :nav="child" :key="child._path" />
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ChevronDownIcon } from "@heroicons/vue/24/solid";
|
||||
|
||||
type NavItem = { title: string; _path: string; children?: NavItem[] };
|
||||
const props = defineProps<{ nav: NavItem }>();
|
||||
const children = props.nav.children?.filter((e) => e._path != props.nav._path);
|
||||
|
||||
const route = useRoute();
|
||||
const current = computed(() => route.path.trim() == props.nav._path.trim());
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<ClientOnly>
|
||||
<VueCarousel :itemsToShow="moveAmount" :itemsToScroll="moveAmount / 2">
|
||||
<VueSlide
|
||||
class="justify-start"
|
||||
v-for="(game, gameIdx) in games"
|
||||
:key="gameIdx"
|
||||
>
|
||||
<GamePanel :game="game" />
|
||||
</VueSlide>
|
||||
|
||||
<template #addons>
|
||||
<VueNavigation />
|
||||
</template>
|
||||
</VueCarousel>
|
||||
</ClientOnly>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Game } from "@prisma/client";
|
||||
import type { SerializeObject } from "nitropack";
|
||||
|
||||
const props = defineProps<{
|
||||
items: Array<SerializeObject<Game>>;
|
||||
min?: number;
|
||||
}>();
|
||||
|
||||
const min = computed(() => Math.max(props.min ?? 8, props.items.length));
|
||||
const games: Ref<Array<SerializeObject<Game> | undefined>> = computed(() =>
|
||||
Array(min.value)
|
||||
.fill(0)
|
||||
.map((_, i) => props.items[i])
|
||||
);
|
||||
|
||||
const moveAmount = ref(1);
|
||||
const moveFactor = 1.8 / 400;
|
||||
|
||||
onMounted(() => {
|
||||
moveAmount.value = moveFactor * window.innerWidth;
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<NuxtLink
|
||||
v-if="game"
|
||||
:href="`/store/${game.id}`"
|
||||
class="rounded overflow-hidden w-48 h-64 group relative transition-all duration-300 text-left"
|
||||
>
|
||||
<img :src="useObject(game.mCoverId)" class="w-full h-full object-cover" />
|
||||
<div
|
||||
class="absolute inset-0 bg-gradient-to-b from-transparent to-[100%] to-zinc-950/50"
|
||||
/>
|
||||
<div class="absolute bottom-0 left-0 px-2 py-1.5">
|
||||
<h1 class="text-zinc-100 text-sm font-bold font-display">
|
||||
{{ game.mName }}
|
||||
</h1>
|
||||
<p class="text-zinc-400 text-xs line-clamp-2">
|
||||
{{ game.mShortDescription }}
|
||||
</p>
|
||||
</div>
|
||||
</NuxtLink>
|
||||
<div
|
||||
v-else
|
||||
class="rounded w-48 h-64 bg-zinc-800 flex items-center justify-center"
|
||||
>
|
||||
<p class="text-zinc-700 text-sm font-semibold font-display uppercase">
|
||||
no game
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { SerializeObject } from "nitropack";
|
||||
|
||||
const props = defineProps<{
|
||||
game?: SerializeObject<{
|
||||
id: string;
|
||||
mCoverId: string;
|
||||
mName: string;
|
||||
mShortDescription: string;
|
||||
}>;
|
||||
}>();
|
||||
</script>
|
||||
+3
-7
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-row items-center gap-x-2">
|
||||
<img
|
||||
:src="rawIcon ? game.icon : useObject(game.icon)"
|
||||
class="w-12 h-12 rounded-sm object-cover"
|
||||
/>
|
||||
<img :src="game.icon" class="w-12 h-12 rounded-sm object-cover" />
|
||||
<div class="flex flex-col items-left">
|
||||
<h1 class="font-semibold font-display text-lg text-zinc-100">
|
||||
{{ game.name }}
|
||||
@@ -21,8 +18,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { GameMetadataSearchResult } from "~/server/internal/metadata/types";
|
||||
|
||||
const { game, rawIcon = true } = defineProps<{
|
||||
game: Omit<GameMetadataSearchResult, "year"> & { sourceName?: string };
|
||||
rawIcon?: boolean;
|
||||
const props = defineProps<{
|
||||
game: GameMetadataSearchResult & { sourceName?: string };
|
||||
}>();
|
||||
</script>
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M20.992 20.163c-1.511-0.099-2.699-1.349-2.699-2.877 0-0.051 0.001-0.102 0.004-0.153l-0 0.007c-0.003-0.048-0.005-0.104-0.005-0.161 0-1.525 1.19-2.771 2.692-2.862l0.008-0c1.509 0.082 2.701 1.325 2.701 2.847 0 0.062-0.002 0.123-0.006 0.184l0-0.008c0.003 0.050 0.005 0.109 0.005 0.168 0 1.523-1.191 2.768-2.693 2.854l-0.008 0zM11.026 20.163c-1.511-0.099-2.699-1.349-2.699-2.877 0-0.051 0.001-0.102 0.004-0.153l-0 0.007c-0.003-0.048-0.005-0.104-0.005-0.161 0-1.525 1.19-2.771 2.692-2.862l0.008-0c1.509 0.082 2.701 1.325 2.701 2.847 0 0.062-0.002 0.123-0.006 0.184l0-0.008c0.003 0.048 0.005 0.104 0.005 0.161 0 1.525-1.19 2.771-2.692 2.862l-0.008 0zM26.393 6.465c-1.763-0.832-3.811-1.49-5.955-1.871l-0.149-0.022c-0.005-0.001-0.011-0.002-0.017-0.002-0.035 0-0.065 0.019-0.081 0.047l-0 0c-0.234 0.411-0.488 0.924-0.717 1.45l-0.043 0.111c-1.030-0.165-2.218-0.259-3.428-0.259s-2.398 0.094-3.557 0.275l0.129-0.017c-0.27-0.63-0.528-1.142-0.813-1.638l0.041 0.077c-0.017-0.029-0.048-0.047-0.083-0.047-0.005 0-0.011 0-0.016 0.001l0.001-0c-2.293 0.403-4.342 1.060-6.256 1.957l0.151-0.064c-0.017 0.007-0.031 0.019-0.040 0.034l-0 0c-2.854 4.041-4.562 9.069-4.562 14.496 0 0.907 0.048 1.802 0.141 2.684l-0.009-0.11c0.003 0.029 0.018 0.053 0.039 0.070l0 0c2.14 1.601 4.628 2.891 7.313 3.738l0.176 0.048c0.008 0.003 0.018 0.004 0.028 0.004 0.032 0 0.060-0.015 0.077-0.038l0-0c0.535-0.72 1.044-1.536 1.485-2.392l0.047-0.1c0.006-0.012 0.010-0.027 0.010-0.043 0-0.041-0.026-0.075-0.062-0.089l-0.001-0c-0.912-0.352-1.683-0.727-2.417-1.157l0.077 0.042c-0.029-0.017-0.048-0.048-0.048-0.083 0-0.031 0.015-0.059 0.038-0.076l0-0c0.157-0.118 0.315-0.24 0.465-0.364 0.016-0.013 0.037-0.021 0.059-0.021 0.014 0 0.027 0.003 0.038 0.008l-0.001-0c2.208 1.061 4.8 1.681 7.536 1.681s5.329-0.62 7.643-1.727l-0.107 0.046c0.012-0.006 0.025-0.009 0.040-0.009 0.022 0 0.043 0.008 0.059 0.021l-0-0c0.15 0.124 0.307 0.248 0.466 0.365 0.023 0.018 0.038 0.046 0.038 0.077 0 0.035-0.019 0.065-0.046 0.082l-0 0c-0.661 0.395-1.432 0.769-2.235 1.078l-0.105 0.036c-0.036 0.014-0.062 0.049-0.062 0.089 0 0.016 0.004 0.031 0.011 0.044l-0-0.001c0.501 0.96 1.009 1.775 1.571 2.548l-0.040-0.057c0.017 0.024 0.046 0.040 0.077 0.040 0.010 0 0.020-0.002 0.029-0.004l-0.001 0c2.865-0.892 5.358-2.182 7.566-3.832l-0.065 0.047c0.022-0.016 0.036-0.041 0.039-0.069l0-0c0.087-0.784 0.136-1.694 0.136-2.615 0-5.415-1.712-10.43-4.623-14.534l0.052 0.078c-0.008-0.016-0.022-0.029-0.038-0.036l-0-0z">
|
||||
</path>
|
||||
</svg>
|
||||
</template>
|
||||
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Dribbble-Light-Preview" transform="translate(-140.000000, -7559.000000)" fill="currentColor">
|
||||
<g id="icons" transform="translate(56.000000, 160.000000)">
|
||||
<path
|
||||
d="M94,7399 C99.523,7399 104,7403.59 104,7409.253 C104,7413.782 101.138,7417.624 97.167,7418.981 C96.66,7419.082 96.48,7418.762 96.48,7418.489 C96.48,7418.151 96.492,7417.047 96.492,7415.675 C96.492,7414.719 96.172,7414.095 95.813,7413.777 C98.04,7413.523 100.38,7412.656 100.38,7408.718 C100.38,7407.598 99.992,7406.684 99.35,7405.966 C99.454,7405.707 99.797,7404.664 99.252,7403.252 C99.252,7403.252 98.414,7402.977 96.505,7404.303 C95.706,7404.076 94.85,7403.962 94,7403.958 C93.15,7403.962 92.295,7404.076 91.497,7404.303 C89.586,7402.977 88.746,7403.252 88.746,7403.252 C88.203,7404.664 88.546,7405.707 88.649,7405.966 C88.01,7406.684 87.619,7407.598 87.619,7408.718 C87.619,7412.646 89.954,7413.526 92.175,7413.785 C91.889,7414.041 91.63,7414.493 91.54,7415.156 C90.97,7415.418 89.522,7415.871 88.63,7414.304 C88.63,7414.304 88.101,7413.319 87.097,7413.247 C87.097,7413.247 86.122,7413.234 87.029,7413.87 C87.029,7413.87 87.684,7414.185 88.139,7415.37 C88.139,7415.37 88.726,7417.2 91.508,7416.58 C91.513,7417.437 91.522,7418.245 91.522,7418.489 C91.522,7418.76 91.338,7419.077 90.839,7418.982 C86.865,7417.627 84,7413.783 84,7409.253 C84,7403.59 88.478,7399 94,7399"
|
||||
id="github-[#142]">
|
||||
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M4.53918 2.40715C4.82145 1.0075 6.06066 0 7.49996 0C8.93926 0 10.1785 1.0075 10.4607 2.40715L10.798 4.07944C10.9743 4.9539 11.3217 5.78562 11.8205 6.52763L12.4009 7.39103C12.7631 7.92978 12.9999 8.5385 13.0979 9.17323C13.6747 9.22167 14.1803 9.58851 14.398 10.1283L14.8897 11.3474C15.1376 11.962 14.9583 12.665 14.4455 13.0887L12.5614 14.6458C12.0128 15.0992 11.2219 15.1193 10.6506 14.6944L9.89192 14.1301C9.88189 14.1227 9.87197 14.1151 9.86216 14.1074C9.48973 14.2075 9.09793 14.261 8.69355 14.261H6.30637C5.90201 14.261 5.51023 14.2076 5.13782 14.1074C5.12802 14.1151 5.11811 14.1227 5.10808 14.1301L4.34942 14.6944C3.77811 15.1193 2.98725 15.0992 2.43863 14.6458L0.55446 13.0887C0.0417175 12.665 -0.1376 11.962 0.110281 11.3474L0.602025 10.1283C0.819715 9.58854 1.32527 9.2217 1.90198 9.17324C2 8.5385 2.2368 7.92978 2.59897 7.39103L3.17938 6.52763C3.67818 5.78562 4.02557 4.9539 4.20193 4.07944L4.53918 2.40715ZM10.8445 9.47585C10.6345 9.63293 10.4642 9.84382 10.3561 10.0938L9.58799 11.8713C9.20026 12.0979 8.75209 12.2237 8.28465 12.2237H6.7153C6.24789 12.2237 5.79975 12.0979 5.41203 11.8714L4.64386 10.0938C4.53581 9.8438 4.36552 9.6329 4.15546 9.47582C4.18121 9.15355 4.2689 8.83503 4.41853 8.53826L5.67678 6.04259L5.68433 6.05007C6.68715 7.04458 8.31304 7.04458 9.31585 6.05007L9.32324 6.04274L10.5814 8.53825C10.7311 8.83504 10.8187 9.15357 10.8445 9.47585ZM9.04068 4.26906V3.05592H8.01353V3.85713C8.23151 3.90123 8.44506 3.97371 8.64848 4.07458L9.04068 4.26906ZM6.98638 3.85718V3.05592H5.95923V4.26919L6.3517 4.07458C6.55504 3.97375 6.7685 3.90129 6.98638 3.85718ZM2.03255 10.1864C1.82255 10.1864 1.6337 10.3132 1.55571 10.5066L1.06397 11.7257C0.981339 11.9306 1.04111 12.1649 1.21203 12.3062L3.0962 13.8633C3.27907 14.0144 3.54269 14.0211 3.73313 13.8795L4.49179 13.3152C4.6813 13.1743 4.74901 12.923 4.6557 12.7071L3.69976 10.4951C3.61884 10.3078 3.43316 10.1864 3.22771 10.1864H2.03255ZM13.4443 10.5066C13.3663 10.3132 13.1775 10.1864 12.9674 10.1864H11.7723C11.5668 10.1864 11.3812 10.3078 11.3002 10.4951L10.3443 12.7071C10.251 12.923 10.3187 13.1743 10.5082 13.3152L11.2669 13.8795C11.4573 14.0211 11.7209 14.0144 11.9038 13.8633L13.788 12.3062C13.9589 12.1649 14.0187 11.9306 13.936 11.7257L13.4443 10.5066ZM6.81106 4.98568C7.24481 4.7706 7.75537 4.7706 8.18912 4.98568L8.68739 5.23275L8.58955 5.32978C7.98786 5.92649 7.01232 5.92649 6.41063 5.32978L6.31279 5.23275L6.81106 4.98568Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
<template>
|
||||
<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M4.53918 2.40715C4.82145 1.0075 6.06066 0 7.49996 0C8.93926 0 10.1785 1.0075 10.4607 2.40715L10.798 4.07944C10.9743 4.9539 11.3217 5.78562 11.8205 6.52763L12.4009 7.39103C12.7631 7.92978 12.9999 8.5385 13.0979 9.17323C13.6747 9.22167 14.1803 9.58851 14.398 10.1283L14.8897 11.3474C15.1376 11.962 14.9583 12.665 14.4455 13.0887L12.5614 14.6458C12.0128 15.0992 11.2219 15.1193 10.6506 14.6944L9.89192 14.1301C9.88189 14.1227 9.87197 14.1151 9.86216 14.1074C9.48973 14.2075 9.09793 14.261 8.69355 14.261H6.30637C5.90201 14.261 5.51023 14.2076 5.13782 14.1074C5.12802 14.1151 5.11811 14.1227 5.10808 14.1301L4.34942 14.6944C3.77811 15.1193 2.98725 15.0992 2.43863 14.6458L0.55446 13.0887C0.0417175 12.665 -0.1376 11.962 0.110281 11.3474L0.602025 10.1283C0.819715 9.58854 1.32527 9.2217 1.90198 9.17324C2 8.5385 2.2368 7.92978 2.59897 7.39103L3.17938 6.52763C3.67818 5.78562 4.02557 4.9539 4.20193 4.07944L4.53918 2.40715ZM10.8445 9.47585C10.6345 9.63293 10.4642 9.84382 10.3561 10.0938L9.58799 11.8713C9.20026 12.0979 8.75209 12.2237 8.28465 12.2237H6.7153C6.24789 12.2237 5.79975 12.0979 5.41203 11.8714L4.64386 10.0938C4.53581 9.8438 4.36552 9.6329 4.15546 9.47582C4.18121 9.15355 4.2689 8.83503 4.41853 8.53826L5.67678 6.04259L5.68433 6.05007C6.68715 7.04458 8.31304 7.04458 9.31585 6.05007L9.32324 6.04274L10.5814 8.53825C10.7311 8.83504 10.8187 9.15357 10.8445 9.47585ZM9.04068 4.26906V3.05592H8.01353V3.85713C8.23151 3.90123 8.44506 3.97371 8.64848 4.07458L9.04068 4.26906ZM6.98638 3.85718V3.05592H5.95923V4.26919L6.3517 4.07458C6.55504 3.97375 6.7685 3.90129 6.98638 3.85718ZM2.03255 10.1864C1.82255 10.1864 1.6337 10.3132 1.55571 10.5066L1.06397 11.7257C0.981339 11.9306 1.04111 12.1649 1.21203 12.3062L3.0962 13.8633C3.27907 14.0144 3.54269 14.0211 3.73313 13.8795L4.49179 13.3152C4.6813 13.1743 4.74901 12.923 4.6557 12.7071L3.69976 10.4951C3.61884 10.3078 3.43316 10.1864 3.22771 10.1864H2.03255ZM13.4443 10.5066C13.3663 10.3132 13.1775 10.1864 12.9674 10.1864H11.7723C11.5668 10.1864 11.3812 10.3078 11.3002 10.4951L10.3443 12.7071C10.251 12.923 10.3187 13.1743 10.5082 13.3152L11.2669 13.8795C11.4573 14.0211 11.7209 14.0144 11.9038 13.8633L13.788 12.3062C13.9589 12.1649 14.0187 11.9306 13.936 11.7257L13.4443 10.5066ZM6.81106 4.98568C7.24481 4.7706 7.75537 4.7706 8.18912 4.98568L8.68739 5.23275L8.58955 5.32978C7.98786 5.92649 7.01232 5.92649 6.41063 5.32978L6.31279 5.23275L6.81106 4.98568Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
+11
-11
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M15 9H15.01M15 15C18.3137 15 21 12.3137 21 9C21 5.68629 18.3137 3 15 3C11.6863 3 9 5.68629 9 9C9 9.27368 9.01832 9.54308 9.05381 9.80704C9.11218 10.2412 9.14136 10.4583 9.12172 10.5956C9.10125 10.7387 9.0752 10.8157 9.00469 10.9419C8.937 11.063 8.81771 11.1823 8.57913 11.4209L3.46863 16.5314C3.29568 16.7043 3.2092 16.7908 3.14736 16.8917C3.09253 16.9812 3.05213 17.0787 3.02763 17.1808C3 17.2959 3 17.4182 3 17.6627V19.4C3 19.9601 3 20.2401 3.10899 20.454C3.20487 20.6422 3.35785 20.7951 3.54601 20.891C3.75992 21 4.03995 21 4.6 21H6.33726C6.58185 21 6.70414 21 6.81923 20.9724C6.92127 20.9479 7.01881 20.9075 7.10828 20.8526C7.2092 20.7908 7.29568 20.7043 7.46863 20.5314L12.5791 15.4209C12.8177 15.1823 12.937 15.063 13.0581 14.9953C13.1843 14.9248 13.2613 14.8987 13.4044 14.8783C13.5417 14.8586 13.7588 14.8878 14.193 14.9462C14.4569 14.9817 14.7263 15 15 15Z"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
<template>
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M15 9H15.01M15 15C18.3137 15 21 12.3137 21 9C21 5.68629 18.3137 3 15 3C11.6863 3 9 5.68629 9 9C9 9.27368 9.01832 9.54308 9.05381 9.80704C9.11218 10.2412 9.14136 10.4583 9.12172 10.5956C9.10125 10.7387 9.0752 10.8157 9.00469 10.9419C8.937 11.063 8.81771 11.1823 8.57913 11.4209L3.46863 16.5314C3.29568 16.7043 3.2092 16.7908 3.14736 16.8917C3.09253 16.9812 3.05213 17.0787 3.02763 17.1808C3 17.2959 3 17.4182 3 17.6627V19.4C3 19.9601 3 20.2401 3.10899 20.454C3.20487 20.6422 3.35785 20.7951 3.54601 20.891C3.75992 21 4.03995 21 4.6 21H6.33726C6.58185 21 6.70414 21 6.81923 20.9724C6.92127 20.9479 7.01881 20.9075 7.10828 20.8526C7.2092 20.7908 7.29568 20.7043 7.46863 20.5314L12.5791 15.4209C12.8177 15.1823 12.937 15.063 13.0581 14.9953C13.1843 14.9248 13.2613 14.8987 13.4044 14.8783C13.5417 14.8586 13.7588 14.8878 14.193 14.9462C14.4569 14.9817 14.7263 15 15 15Z"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
viewBox="0 0 1920 1920"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M1863.53 1016.437c31.171 0 56.47 25.299 56.47 56.47v790.589c0 16.376-7.115 31.849-19.313 42.465-10.39 9.149-23.605 14.005-37.158 14.005-2.484 0-5.082-.113-7.567-.452l-903.53-123.331c-28.008-3.84-48.903-27.784-48.903-56.02v-667.256c0-31.171 25.3-56.47 56.471-56.47Zm-1129.412 0c31.171 0 56.47 25.299 56.47 56.47v634.504c0 16.376-7.115 31.85-19.426 42.579-10.39 9.035-23.491 13.891-37.044 13.891-2.485 0-5.196-.113-7.68-.564L48.79 1669.35C20.78 1665.51 0 1641.68 0 1613.444v-540.537c0-31.171 25.299-56.47 56.47-56.47Zm-7.726-859.855c16.151-2.372 32.415 2.597 44.725 13.327 12.424 10.73 19.426 26.315 19.426 42.579V846.99c0 31.285-25.186 56.47-56.47 56.47H56.424c-31.171 0-56.47-25.185-56.47-56.47V306.455c0-28.123 20.781-52.066 48.79-55.906ZM1855.974.474c16.15-2.033 32.414 2.71 44.724 13.44 12.198 10.73 19.313 26.203 19.313 42.466v790.588c0 31.285-25.299 56.471-56.47 56.471H960.01c-31.171 0-56.47-25.186-56.47-56.47V179.711c0-28.235 20.78-52.066 48.903-55.906Z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
<template>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
viewBox="0 0 1920 1920"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M1863.53 1016.437c31.171 0 56.47 25.299 56.47 56.47v790.589c0 16.376-7.115 31.849-19.313 42.465-10.39 9.149-23.605 14.005-37.158 14.005-2.484 0-5.082-.113-7.567-.452l-903.53-123.331c-28.008-3.84-48.903-27.784-48.903-56.02v-667.256c0-31.171 25.3-56.47 56.471-56.47Zm-1129.412 0c31.171 0 56.47 25.299 56.47 56.47v634.504c0 16.376-7.115 31.85-19.426 42.579-10.39 9.035-23.491 13.891-37.044 13.891-2.485 0-5.196-.113-7.68-.564L48.79 1669.35C20.78 1665.51 0 1641.68 0 1613.444v-540.537c0-31.171 25.299-56.47 56.47-56.47Zm-7.726-859.855c16.151-2.372 32.415 2.597 44.725 13.327 12.424 10.73 19.426 26.315 19.426 42.579V846.99c0 31.285-25.186 56.47-56.47 56.47H56.424c-31.171 0-56.47-25.185-56.47-56.47V306.455c0-28.123 20.781-52.066 48.79-55.906ZM1855.974.474c16.15-2.033 32.414 2.71 44.724 13.44 12.198 10.73 19.313 26.203 19.313 42.466v790.588c0 31.285-25.299 56.471-56.47 56.471H960.01c-31.171 0-56.47-25.186-56.47-56.47V179.711c0-28.235 20.78-52.066 48.903-55.906Z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
@@ -13,26 +13,22 @@
|
||||
v-if="notification.actions.length > 0"
|
||||
class="mt-3 flex space-x-7"
|
||||
>
|
||||
<NuxtLink
|
||||
v-for="[name, link] in notification.actions.map((e) =>
|
||||
e.split('|'),
|
||||
)"
|
||||
:key="name"
|
||||
<button
|
||||
type="button"
|
||||
:href="link"
|
||||
class="rounded-md text-sm font-medium text-blue-600 hover:text-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
|
||||
class="rounded-md bg-white text-sm font-medium text-blue-600 hover:text-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
|
||||
>
|
||||
{{ name }}
|
||||
</NuxtLink>
|
||||
Undo
|
||||
</button>
|
||||
<!-- todo -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-4 flex shrink-0">
|
||||
<button
|
||||
@click="() => deleteMe()"
|
||||
type="button"
|
||||
class="inline-flex rounded-md text-zinc-400 hover:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
|
||||
@click="() => deleteMe()"
|
||||
>
|
||||
<span class="sr-only">{{ $t("common.close") }}</span>
|
||||
<span class="sr-only">Close</span>
|
||||
<XMarkIcon class="size-5" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
@@ -43,23 +39,17 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { XMarkIcon } from "@heroicons/vue/24/solid";
|
||||
import type { SerializeObject } from "nitropack";
|
||||
import type { NotificationModel } from "~/prisma/client/models";
|
||||
import type { Notification } from "@prisma/client";
|
||||
|
||||
const props = defineProps<{
|
||||
notification: SerializeObject<NotificationModel>;
|
||||
}>();
|
||||
const props = defineProps<{ notification: Notification }>();
|
||||
|
||||
async function deleteMe() {
|
||||
await $dropFetch(`/api/v1/notifications/:id`, {
|
||||
await $fetch(`/api/v1/notifications/${props.notification.id}`, {
|
||||
method: "DELETE",
|
||||
params: {
|
||||
id: props.notification.id,
|
||||
},
|
||||
});
|
||||
const notifications = useNotifications();
|
||||
const indexOfMe = notifications.value.findIndex(
|
||||
(e) => e.id === props.notification.id,
|
||||
(e) => e.id === props.notification.id
|
||||
);
|
||||
// Delete me
|
||||
notifications.value.splice(indexOfMe, 1);
|
||||
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div class="flex rounded px-2 py-2 bg-zinc-900 text-zinc-600">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Listbox v-model="typedModel" as="div">
|
||||
<Listbox as="div" v-model="model">
|
||||
<ListboxLabel class="block text-sm font-medium leading-6 text-zinc-100"
|
||||
><slot
|
||||
/></ListboxLabel>
|
||||
@@ -7,15 +7,15 @@
|
||||
<ListboxButton
|
||||
class="relative w-full cursor-default rounded-md bg-zinc-950 py-1.5 pl-3 pr-10 text-left text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-800 focus:outline-none focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6"
|
||||
>
|
||||
<span v-if="model" class="flex items-center">
|
||||
<span v-if="model && values[model]" class="flex items-center">
|
||||
<component
|
||||
:is="PLATFORM_ICONS[model]"
|
||||
:is="values[model].icon"
|
||||
alt=""
|
||||
class="h-5 w-5 flex-shrink-0 text-blue-600"
|
||||
/>
|
||||
<span class="ml-3 block truncate">{{ model }}</span>
|
||||
<span class="ml-3 block truncate">{{ values[model].name }}</span>
|
||||
</span>
|
||||
<span v-else>{{ $t("library.admin.import.selectPlatform") }}</span>
|
||||
<span v-else>Please select a platform...</span>
|
||||
<span
|
||||
class="pointer-events-none absolute inset-y-0 right-0 ml-3 flex items-center pr-2"
|
||||
>
|
||||
@@ -32,11 +32,11 @@
|
||||
class="absolute z-10 mt-1 max-h-56 w-full overflow-auto rounded-md bg-zinc-900 py-1 text-base shadow-lg ring-1 ring-zinc-950 ring-opacity-5 focus:outline-none sm:text-sm"
|
||||
>
|
||||
<ListboxOption
|
||||
v-for="[name, value] in values"
|
||||
:key="value"
|
||||
v-slot="{ active, selected }"
|
||||
as="template"
|
||||
v-for="[value, options] in Object.entries(values)"
|
||||
:key="value"
|
||||
:value="value"
|
||||
v-slot="{ active, selected }"
|
||||
>
|
||||
<li
|
||||
:class="[
|
||||
@@ -46,14 +46,14 @@
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<component
|
||||
:is="PLATFORM_ICONS[value]"
|
||||
:is="options.icon"
|
||||
alt=""
|
||||
:class="[
|
||||
active ? 'text-zinc-100' : 'text-blue-600',
|
||||
'h-5 w-5 flex-shrink-0',
|
||||
]"
|
||||
/>
|
||||
<span class="ml-3 block truncate">{{ name }}</span>
|
||||
<span class="ml-3 block truncate">{{ options.name }}</span>
|
||||
</div>
|
||||
|
||||
<span
|
||||
@@ -74,6 +74,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { IconsLinuxLogo, IconsWindowsLogo } from "#components";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
@@ -82,19 +83,18 @@ import {
|
||||
ListboxOptions,
|
||||
} from "@headlessui/vue";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import { Platform } from "~/prisma/client/enums";
|
||||
import type { Component } from "vue";
|
||||
|
||||
const model = defineModel<Platform | undefined>();
|
||||
const model = defineModel<string>();
|
||||
|
||||
const typedModel = computed<Platform | null>({
|
||||
get() {
|
||||
return model.value || null;
|
||||
const values: { [key: string]: { name: string; icon: Component } } = {
|
||||
Linux: {
|
||||
name: "Linux",
|
||||
icon: IconsLinuxLogo,
|
||||
},
|
||||
set(v) {
|
||||
if (v === null) return (model.value = undefined);
|
||||
model.value = v;
|
||||
Windows: {
|
||||
name: "Windows",
|
||||
icon: IconsWindowsLogo,
|
||||
},
|
||||
});
|
||||
|
||||
const values = Object.entries(Platform);
|
||||
};
|
||||
</script>
|
||||
@@ -49,46 +49,41 @@
|
||||
/>
|
||||
<span
|
||||
class="transition mt-2 block text-sm font-semibold text-zinc-400 group-hover:text-zinc-500"
|
||||
>{{ $t("uploadFile") }}</span
|
||||
>Upload file</span
|
||||
>
|
||||
<div v-if="currentFileList">
|
||||
<p
|
||||
v-for="currentFile in currentFileList"
|
||||
:key="currentFile"
|
||||
class="mt-1 text-[10px] text-zinc-500 whitespace-nowrap"
|
||||
>
|
||||
{{ currentFile }}
|
||||
</p>
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-zinc-400" v-if="currentFile">
|
||||
{{ currentFile.name }}
|
||||
</p>
|
||||
</label>
|
||||
<input
|
||||
id="file-upload"
|
||||
:accept="props.accept"
|
||||
@change="(e) => file = (e.target as any)?.files"
|
||||
class="hidden"
|
||||
type="file"
|
||||
:multiple="props.multiple"
|
||||
@change="(e: Event) => (file = (e.target as any)?.files)"
|
||||
id="file-upload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
|
||||
<LoadingButton
|
||||
:disabled="currentFiles == undefined"
|
||||
:disabled="currentFile == undefined"
|
||||
type="button"
|
||||
:loading="uploadLoading"
|
||||
:class="['inline-flex w-full shadow-sm sm:ml-3 sm:w-auto']"
|
||||
@click="() => uploadFile_wrapper()"
|
||||
:class="[
|
||||
'inline-flex w-full shadow-sm sm:ml-3 sm:w-auto',
|
||||
]"
|
||||
>
|
||||
{{ $t("upload") }}
|
||||
Upload
|
||||
</LoadingButton>
|
||||
<button
|
||||
ref="cancelButtonRef"
|
||||
type="button"
|
||||
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-800 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-800 hover:bg-zinc-900 sm:mt-0 sm:w-auto"
|
||||
@click="open = false"
|
||||
ref="cancelButtonRef"
|
||||
>
|
||||
{{ $t("cancel") }}
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="uploadError" class="mt-3 rounded-md bg-red-600/10 p-4">
|
||||
@@ -119,31 +114,20 @@ import { ref } from "vue";
|
||||
import {
|
||||
Dialog,
|
||||
DialogPanel,
|
||||
DialogTitle,
|
||||
TransitionChild,
|
||||
TransitionRoot,
|
||||
} from "@headlessui/vue";
|
||||
import { ArrowUpTrayIcon } from "@heroicons/vue/20/solid";
|
||||
import { XCircleIcon } from "@heroicons/vue/24/solid";
|
||||
|
||||
const open = defineModel<boolean>({
|
||||
required: true,
|
||||
});
|
||||
const open = defineModel<boolean>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const file = ref<FileList | undefined>();
|
||||
const currentFiles = computed(() => file.value);
|
||||
const currentFileList = computed(() => {
|
||||
if (!currentFiles.value) return undefined;
|
||||
const list = [];
|
||||
for (const file of currentFiles.value) {
|
||||
list.push(file.name);
|
||||
}
|
||||
return list;
|
||||
});
|
||||
const currentFile = computed(() => file.value?.item(0));
|
||||
const props = defineProps<{
|
||||
endpoint: string;
|
||||
accept: string;
|
||||
multiple?: boolean;
|
||||
options?: { [key: string]: string };
|
||||
}>();
|
||||
const emit = defineEmits(["upload"]);
|
||||
@@ -151,12 +135,10 @@ const emit = defineEmits(["upload"]);
|
||||
const uploadLoading = ref(false);
|
||||
const uploadError = ref<string | undefined>();
|
||||
async function uploadFile() {
|
||||
if (!currentFiles.value) return;
|
||||
if (!currentFile.value) return;
|
||||
|
||||
const form = new FormData();
|
||||
for (const file of currentFiles.value) {
|
||||
form.append(file.name, file);
|
||||
}
|
||||
form.append("file", currentFile.value);
|
||||
|
||||
if (props.options) {
|
||||
for (const [key, value] of Object.entries(props.options)) {
|
||||
@@ -164,10 +146,7 @@ async function uploadFile() {
|
||||
}
|
||||
}
|
||||
|
||||
const result = await $dropFetch(props.endpoint, {
|
||||
method: "POST",
|
||||
body: form,
|
||||
});
|
||||
const result = await $fetch(props.endpoint, { method: "POST", body: form });
|
||||
open.value = false;
|
||||
file.value = undefined;
|
||||
emit("upload", result);
|
||||
@@ -177,7 +156,7 @@ function uploadFile_wrapper() {
|
||||
uploadLoading.value = true;
|
||||
uploadFile()
|
||||
.catch((error) => {
|
||||
uploadError.value = error.statusMessage ?? t("errors.unknown");
|
||||
uploadError.value = error.statusMessage ?? "An unknown error occurred.";
|
||||
})
|
||||
.finally(() => {
|
||||
uploadLoading.value = false;
|
||||
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<footer class="bg-zinc-950" aria-labelledby="footer-heading">
|
||||
<h2 id="footer-heading" class="sr-only">Footer</h2>
|
||||
<div class="mx-auto max-w-7xl px-6 py-16 sm:py-24 lg:px-8 ">
|
||||
<div class="xl:grid xl:grid-cols-3 xl:gap-8">
|
||||
<div class="space-y-8">
|
||||
<Wordmark class="h-10" />
|
||||
<p class="text-sm leading-6 text-zinc-300">An open-source game distribution platform built for
|
||||
speed, flexibility and beauty.</p>
|
||||
<div class="flex space-x-6">
|
||||
<a v-for="item in navigation.social" :key="item.name" :href="item.href" target="_blank"
|
||||
class="text-zinc-400 hover:text-zinc-400">
|
||||
<span class="sr-only">{{ item.name }}</span>
|
||||
<component :is="item.icon" class="h-6 w-6" aria-hidden="true" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-16 grid grid-cols-2 gap-8 xl:col-span-2 xl:mt-0">
|
||||
<div class="md:grid md:grid-cols-2 md:gap-8">
|
||||
<div>
|
||||
<h3 class="text-sm font-semibold leading-6 text-white">Games</h3>
|
||||
<ul role="list" class="mt-6 space-y-4">
|
||||
<li v-for="item in navigation.games" :key="item.name">
|
||||
<a :href="item.href" class="text-sm leading-6 text-zinc-300 hover:text-white">{{
|
||||
item.name }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="mt-10 md:mt-0">
|
||||
<h3 class="text-sm font-semibold leading-6 text-white">Community</h3>
|
||||
<ul role="list" class="mt-6 space-y-4">
|
||||
<li v-for="item in navigation.community" :key="item.name">
|
||||
<a :href="item.href" class="text-sm leading-6 text-zinc-300 hover:text-white">{{
|
||||
item.name }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:grid md:grid-cols-2 md:gap-8">
|
||||
<div>
|
||||
<h3 class="text-sm font-semibold leading-6 text-white">Documentation</h3>
|
||||
<ul role="list" class="mt-6 space-y-4">
|
||||
<li v-for="item in navigation.documentation" :key="item.name">
|
||||
<a :href="item.href" class="text-sm leading-6 text-zinc-300 hover:text-white">{{
|
||||
item.name }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="mt-10 md:mt-0">
|
||||
<h3 class="text-sm font-semibold leading-6 text-white">About</h3>
|
||||
<ul role="list" class="mt-6 space-y-4">
|
||||
<li v-for="item in navigation.about" :key="item.name">
|
||||
<a :href="item.href" class="text-sm leading-6 text-zinc-300 hover:text-white">{{
|
||||
item.name }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { IconsDiscordLogo, IconsGithubLogo } from '#components';
|
||||
|
||||
const navigation = {
|
||||
games: [
|
||||
{ name: 'Newly Added', href: '#' },
|
||||
{ name: 'New Releases', href: '#' },
|
||||
{ name: 'Top Sellers', href: '#' },
|
||||
{ name: 'Find a Game', href: '#' },
|
||||
],
|
||||
community: [
|
||||
{ name: 'Friends', href: '#' },
|
||||
{ name: 'Groups', href: '#' },
|
||||
{ name: 'Servers', href: '#' },
|
||||
],
|
||||
documentation: [
|
||||
{ name: 'API', href: '#' },
|
||||
{ name: 'Server Docs', href: '#' },
|
||||
{ name: 'Client Docs', href: '#' },
|
||||
],
|
||||
about: [
|
||||
{ name: 'About Drop', href: '#' },
|
||||
{ name: 'Features', href: '#' },
|
||||
{ name: 'FAQ', href: '#' },
|
||||
],
|
||||
social: [
|
||||
{
|
||||
name: 'GitHub',
|
||||
href: 'https://github.com/Drop-OSS',
|
||||
icon: IconsGithubLogo,
|
||||
},
|
||||
{
|
||||
name: "Discord",
|
||||
href: "https://discord.gg/NHx46XKJWA",
|
||||
icon: IconsDiscordLogo
|
||||
}
|
||||
],
|
||||
}
|
||||
</script>
|
||||
@@ -1,14 +1,13 @@
|
||||
<template>
|
||||
<div class="hidden lg:flex bg-zinc-950 flex-row px-12 xl:px-48 py-5">
|
||||
<div class="grow inline-flex items-center gap-x-20">
|
||||
<NuxtLink :to="homepageURL">
|
||||
<DropWordmark class="h-8" />
|
||||
<NuxtLink to="/">
|
||||
<Wordmark class="h-8" />
|
||||
</NuxtLink>
|
||||
<nav class="inline-flex items-center">
|
||||
<ol class="inline-flex items-center gap-x-12">
|
||||
<NuxtLink
|
||||
v-for="(nav, navIdx) in navigation"
|
||||
:key="navIdx"
|
||||
:href="nav.route"
|
||||
:class="[
|
||||
'transition hover:text-zinc-200 uppercase font-display font-semibold text-md',
|
||||
@@ -62,10 +61,7 @@
|
||||
<div
|
||||
class="sticky lg:hidden top-0 z-40 flex h-16 justify-between items-center gap-x-4 border-b border-zinc-700 bg-zinc-950 px-4 shadow-sm sm:gap-x-6 sm:px-6 lg:px-8"
|
||||
>
|
||||
<NuxtLink :to="homepageURL">
|
||||
<DropWordmark class="mb-0.5" />
|
||||
</NuxtLink>
|
||||
|
||||
<Wordmark class="mb-0.5" />
|
||||
<div class="flex gap-x-4 lg:gap-x-6">
|
||||
<div class="flex items-center gap-x-3">
|
||||
<!-- Profile dropdown -->
|
||||
@@ -76,7 +72,7 @@
|
||||
class="-m-2.5 p-2.5 text-zinc-400 lg:hidden"
|
||||
@click="sidebarOpen = true"
|
||||
>
|
||||
<span class="sr-only">{{ $t("header.openSidebar") }}</span>
|
||||
<span class="sr-only">Open sidebar</span>
|
||||
<Bars3Icon class="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
@@ -125,9 +121,7 @@
|
||||
class="-m-2.5 p-2.5"
|
||||
@click="sidebarOpen = false"
|
||||
>
|
||||
<span class="sr-only">{{
|
||||
$t("userHeader.closeSidebar")
|
||||
}}</span>
|
||||
<span class="sr-only">Close sidebar</span>
|
||||
<XMarkIcon class="h-6 w-6 text-zinc-400" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
@@ -137,8 +131,8 @@
|
||||
class="flex grow flex-col gap-y-5 overflow-y-auto bg-zinc-950 px-6 pb-4"
|
||||
>
|
||||
<div class="flex shrink-0 h-16 items-center justify-between">
|
||||
<NuxtLink :to="homepageURL">
|
||||
<ApplicationLogo class="h-8 w-auto" />
|
||||
<NuxtLink to="/">
|
||||
<Logo class="h-8 w-auto" />
|
||||
</NuxtLink>
|
||||
|
||||
<UserHeaderUserWidget />
|
||||
@@ -147,7 +141,6 @@
|
||||
<ol class="flex flex-col gap-y-3">
|
||||
<NuxtLink
|
||||
v-for="(nav, navIdx) in navigation"
|
||||
:key="navIdx"
|
||||
:href="nav.route"
|
||||
:class="[
|
||||
'transition hover:text-zinc-200 uppercase font-display font-semibold text-md',
|
||||
@@ -174,9 +167,6 @@
|
||||
<BellIcon class="h-5" />
|
||||
</UserHeaderWidget>
|
||||
</li>
|
||||
<li class="w-full">
|
||||
<UserHeaderWidget class="w-full" />
|
||||
</li>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -203,37 +193,35 @@ import { Bars3Icon } from "@heroicons/vue/24/outline";
|
||||
import { XMarkIcon } from "@heroicons/vue/24/solid";
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
const homepageURL = "/store";
|
||||
const navigation: Ref<Array<NavigationItem>> = computed(() => [
|
||||
const navigation: Array<NavigationItem> = [
|
||||
{
|
||||
prefix: "/store",
|
||||
route: "/store",
|
||||
label: t("store.title"),
|
||||
label: "Store",
|
||||
},
|
||||
{
|
||||
prefix: "/library",
|
||||
route: "/library",
|
||||
label: t("userHeader.links.library"),
|
||||
label: "Library",
|
||||
},
|
||||
{
|
||||
prefix: "/community",
|
||||
route: "/community",
|
||||
label: t("userHeader.links.community"),
|
||||
label: "Community",
|
||||
},
|
||||
{
|
||||
prefix: "/news",
|
||||
route: "/news",
|
||||
label: t("userHeader.links.news"),
|
||||
label: "News",
|
||||
},
|
||||
]);
|
||||
];
|
||||
|
||||
const currentPageIndex = useCurrentNavigationIndex(navigation.value);
|
||||
const currentPageIndex = useCurrentNavigationIndex(navigation);
|
||||
|
||||
const notifications = useNotifications();
|
||||
const unreadNotifications = computed(() =>
|
||||
notifications.value.filter((e) => !e.read),
|
||||
notifications.value.filter((e) => !e.read)
|
||||
);
|
||||
|
||||
const sidebarOpen = ref(false);
|
||||
+6
-18
@@ -6,7 +6,7 @@
|
||||
>
|
||||
<div class="ml-4 mt-2">
|
||||
<h3 class="text-base font-semibold text-zinc-100 text-sm">
|
||||
{{ $t("account.notifications.unread") }}
|
||||
Unread notifications
|
||||
</h3>
|
||||
</div>
|
||||
<div class="ml-4 mt-2 shrink-0">
|
||||
@@ -15,24 +15,15 @@
|
||||
type="button"
|
||||
class="text-sm text-zinc-400"
|
||||
>
|
||||
<i18n-t
|
||||
keypath="account.notifications.all"
|
||||
tag="span"
|
||||
scope="global"
|
||||
>
|
||||
<template #arrow>
|
||||
<span aria-hidden="true">{{ $t("chars.arrow") }}</span>
|
||||
</template>
|
||||
</i18n-t>
|
||||
View all →
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-y-2 max-h-[300px] overflow-y-scroll">
|
||||
<NotificationItem
|
||||
<Notification
|
||||
v-for="notification in props.notifications"
|
||||
:key="notification.id"
|
||||
:notification="notification"
|
||||
/>
|
||||
</div>
|
||||
@@ -40,16 +31,13 @@
|
||||
v-if="props.notifications.length == 0"
|
||||
class="text-sm text-zinc-400 p-3 text-center w-full"
|
||||
>
|
||||
{{ $t("account.notifications.none") }}
|
||||
No notifications
|
||||
</div>
|
||||
</PanelWidget>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { SerializeObject } from "nitropack";
|
||||
import type { NotificationModel } from "~/prisma/client/models";
|
||||
import type { Notification } from "@prisma/client";
|
||||
|
||||
const props = defineProps<{
|
||||
notifications: Array<SerializeObject<NotificationModel>>;
|
||||
}>();
|
||||
const props = defineProps<{ notifications: Array<Notification> }>();
|
||||
</script>
|
||||
+25
-48
@@ -4,7 +4,7 @@
|
||||
<UserHeaderWidget>
|
||||
<div class="inline-flex items-center text-zinc-300 hover:text-white">
|
||||
<img
|
||||
:src="useObject(user.profilePictureObjectId)"
|
||||
:src="useObject(user.profilePicture)"
|
||||
class="w-5 h-5 rounded-sm"
|
||||
/>
|
||||
<span class="ml-2 text-sm font-bold">{{ user.displayName }}</span>
|
||||
@@ -31,7 +31,7 @@
|
||||
>
|
||||
<div class="inline-flex items-center text-zinc-300">
|
||||
<img
|
||||
:src="useObject(user.profilePictureObjectId)"
|
||||
:src="useObject(user.profilePicture)"
|
||||
class="w-5 h-5 rounded-sm"
|
||||
/>
|
||||
<span class="ml-2 text-sm font-bold">{{ user.displayName }}</span>
|
||||
@@ -39,37 +39,16 @@
|
||||
</NuxtLink>
|
||||
<div class="h-0.5 rounded-full w-full bg-zinc-800" />
|
||||
<div class="flex flex-col">
|
||||
<MenuItem
|
||||
v-for="(nav, navIdx) in navigation"
|
||||
:key="navIdx"
|
||||
v-slot="{ active, close }"
|
||||
hydrate-on-visible
|
||||
as="div"
|
||||
>
|
||||
<MenuItem v-for="(nav, navIdx) in navigation" v-slot="{ active }">
|
||||
<NuxtLink
|
||||
:to="nav.route"
|
||||
:href="nav.route"
|
||||
:class="[
|
||||
active ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400',
|
||||
'w-full text-left transition block px-4 py-2 text-sm',
|
||||
'transition block px-4 py-2 text-sm',
|
||||
]"
|
||||
@click="close"
|
||||
>
|
||||
{{ nav.label }}
|
||||
</NuxtLink>
|
||||
</MenuItem>
|
||||
<MenuItem v-slot="{ active, close }" hydrate-on-visible as="div">
|
||||
<NuxtLink
|
||||
to="/auth/signout"
|
||||
:class="[
|
||||
active ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400',
|
||||
'w-full text-left transition block px-4 py-2 text-sm',
|
||||
]"
|
||||
:data-comment="'external=true is required because we implemented the signout as a route on the server for performance'"
|
||||
:external="true"
|
||||
@click="close"
|
||||
{{ nav.label }}</NuxtLink
|
||||
>
|
||||
{{ $t("auth.signout") }}
|
||||
</NuxtLink>
|
||||
</MenuItem>
|
||||
</div>
|
||||
</PanelWidget>
|
||||
@@ -86,25 +65,23 @@ import type { NavigationItem } from "~/composables/types";
|
||||
|
||||
const user = useUser();
|
||||
|
||||
const navigation = computed<NavigationItem[]>(() =>
|
||||
[
|
||||
user.value?.admin
|
||||
? {
|
||||
label: $t("userHeader.profile.admin"),
|
||||
route: "/admin",
|
||||
prefix: "",
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
label: $t("userHeader.profile.settings"),
|
||||
route: "/account",
|
||||
prefix: "",
|
||||
},
|
||||
{
|
||||
label: "Authorize client",
|
||||
route: "/client/code",
|
||||
prefix: "",
|
||||
},
|
||||
].filter((e) => e !== undefined),
|
||||
);
|
||||
const navigation: NavigationItem[] = [
|
||||
user.value?.admin
|
||||
? {
|
||||
label: "Admin Dashboard",
|
||||
route: "/admin",
|
||||
prefix: "",
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
label: "Account settings",
|
||||
route: "/account",
|
||||
prefix: "",
|
||||
},
|
||||
{
|
||||
label: "Sign out",
|
||||
route: "/signout",
|
||||
prefix: "",
|
||||
},
|
||||
].filter((e) => e !== undefined);
|
||||
</script>
|
||||
@@ -1,14 +1,13 @@
|
||||
import type { RouteLocationNormalized } from "vue-router";
|
||||
import type { NavigationItem } from "./types";
|
||||
|
||||
export const useCurrentNavigationIndex = (
|
||||
navigation: Array<NavigationItem>,
|
||||
) => {
|
||||
export const useCurrentNavigationIndex = (navigation: Array<NavigationItem>) => {
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const currentNavigation = ref(-1);
|
||||
|
||||
function calculateCurrentNavIndex(to: typeof route) {
|
||||
function calculateCurrentNavIndex(to: RouteLocationNormalized) {
|
||||
const validOptions = navigation
|
||||
.map((e, i) => ({ ...e, index: i }))
|
||||
.filter((e) => to.fullPath.startsWith(e.prefix));
|
||||
@@ -0,0 +1,6 @@
|
||||
import { IconsLinuxLogo, IconsWindowsLogo } from "#components";
|
||||
|
||||
export const PLATFORM_ICONS = {
|
||||
[PlatformClient.Linux]: IconsLinuxLogo,
|
||||
[PlatformClient.Windows]: IconsWindowsLogo,
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { Notification } from "@prisma/client";
|
||||
|
||||
const ws = new WebSocketHandler("/api/v1/notifications/ws");
|
||||
|
||||
export const useNotifications = () =>
|
||||
useState<Array<Notification>>("notifications", () => []);
|
||||
|
||||
ws.listen((e) => {
|
||||
const notification = JSON.parse(e) as Notification;
|
||||
const notifications = useNotifications();
|
||||
notifications.value.push(notification);
|
||||
});
|
||||
@@ -2,12 +2,11 @@ import type { TaskMessage } from "~/server/internal/tasks";
|
||||
import { WebSocketHandler } from "./ws";
|
||||
|
||||
const websocketHandler = new WebSocketHandler("/api/v1/task");
|
||||
// const taskStates: { [key: string]: } = {};
|
||||
const taskStates = new Map<string, Ref<TaskMessage | undefined>>();
|
||||
const taskStates: { [key: string]: Ref<TaskMessage | undefined> } = {};
|
||||
|
||||
function handleUpdateMessage(msg: TaskMessage) {
|
||||
const taskStates = useTaskStates();
|
||||
const state = taskStates.get(msg.id);
|
||||
const state = taskStates[msg.id];
|
||||
if (!state) return;
|
||||
if (!state.value || msg.reset) {
|
||||
state.value = msg;
|
||||
@@ -30,33 +29,27 @@ websocketHandler.listen((message) => {
|
||||
const [action, ...data] = message.split("/");
|
||||
|
||||
switch (action) {
|
||||
case "connect": {
|
||||
case "connect":
|
||||
const taskReady = useTaskReady();
|
||||
taskReady.value = true;
|
||||
break;
|
||||
}
|
||||
case "disconnect": {
|
||||
case "disconnect":
|
||||
const disconnectTaskId = data[0];
|
||||
taskStates.delete(disconnectTaskId);
|
||||
delete taskStates[disconnectTaskId];
|
||||
console.log(`disconnected from ${disconnectTaskId}`);
|
||||
break;
|
||||
}
|
||||
case "error": {
|
||||
case "error":
|
||||
const [taskId, title, description] = data;
|
||||
const state = taskStates.get(taskId);
|
||||
if (!state) break;
|
||||
state.value ??= {
|
||||
taskStates[taskId].value ??= {
|
||||
id: taskId,
|
||||
name: "Unknown task",
|
||||
success: false,
|
||||
progress: 0,
|
||||
error: undefined,
|
||||
log: [],
|
||||
actions: [],
|
||||
};
|
||||
state.value.error = { title, description };
|
||||
taskStates[taskId].value.error = { title, description };
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -68,12 +61,15 @@ export const useTaskReady = () => useState("taskready", () => false);
|
||||
export const useTask = (taskId: string): Ref<TaskMessage | undefined> => {
|
||||
if (import.meta.server) return ref(undefined);
|
||||
const taskStates = useTaskStates();
|
||||
const task = taskStates.get(taskId);
|
||||
if (task && task.value && !task.value.error) return task;
|
||||
if (
|
||||
taskStates[taskId] &&
|
||||
taskStates[taskId].value &&
|
||||
!taskStates[taskId].value.error
|
||||
)
|
||||
return taskStates[taskId];
|
||||
|
||||
taskStates.set(taskId, ref(undefined));
|
||||
taskStates[taskId] = ref(undefined);
|
||||
console.log("connecting to " + taskId);
|
||||
websocketHandler.send(`connect/${taskId}`);
|
||||
// TODO: this may have changed behavior
|
||||
return taskStates.get(taskId) ?? ref(undefined);
|
||||
return taskStates[taskId];
|
||||
};
|
||||
@@ -11,3 +11,8 @@ export type QuickActionNav = {
|
||||
notifications?: Ref<number>;
|
||||
action: () => Promise<void>;
|
||||
};
|
||||
|
||||
export enum PlatformClient {
|
||||
Windows = "Windows",
|
||||
Linux = "Linux",
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { User } from "@prisma/client";
|
||||
|
||||
// undefined = haven't check
|
||||
// null = check, no user
|
||||
// {} = check, user
|
||||
|
||||
export const useUser = () => useState<User | undefined | null>(undefined);
|
||||
export const updateUser = async () => {
|
||||
const headers = useRequestHeaders(["cookie"]);
|
||||
|
||||
const user = useUser();
|
||||
if (user.value === null) return;
|
||||
|
||||
// SSR calls have to be after uses
|
||||
user.value = await $fetch<User | null>("/api/v1/user", { headers });
|
||||
};
|
||||
@@ -30,7 +30,7 @@ export class WebSocketHandler {
|
||||
this.ws.onmessage = (e) => {
|
||||
const message = e.data;
|
||||
switch (message) {
|
||||
case "unauthenticated": {
|
||||
case "unauthenticated":
|
||||
const error = createError({
|
||||
statusCode: 403,
|
||||
statusMessage: "Unable to connect to websocket - unauthenticated",
|
||||
@@ -40,7 +40,6 @@ export class WebSocketHandler {
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.listeners.length == 0) {
|
||||
this.inQueue.push(message);
|
||||
@@ -1,7 +1,8 @@
|
||||
services:
|
||||
postgres:
|
||||
# using alpine image to reduce image size
|
||||
image: postgres:alpine
|
||||
image: postgres:14-alpine
|
||||
ports:
|
||||
- 5432:5432
|
||||
healthcheck:
|
||||
test: pg_isready -d drop -U drop
|
||||
interval: 30s
|
||||
@@ -15,10 +16,7 @@ services:
|
||||
- POSTGRES_USER=drop
|
||||
- POSTGRES_DB=drop
|
||||
drop:
|
||||
image: ghcr.io/drop-oss/drop:nightly
|
||||
stdin_open: true
|
||||
tty: true
|
||||
init: true
|
||||
image: registry.deepcore.dev/drop-oss/drop/main:latest
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
@@ -26,6 +24,11 @@ services:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- ./library:/library
|
||||
- ./data:/data
|
||||
- ./certs:/certs
|
||||
- ./objects:/objects
|
||||
environment:
|
||||
- DATABASE_URL=postgres://drop:drop@postgres:5432/drop
|
||||
- FS_BACKEND_PATH=/objects
|
||||
- CLIENT_CERTIFICATES=/certs
|
||||
- LIBRARY=/library
|
||||
- GIANT_BOMB_API_KEY=REPLACE_WITH_YOUR_KEY
|
||||
@@ -1,34 +0,0 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
.nuxt
|
||||
.output
|
||||
|
||||
src-tauri/flamegraph.svg
|
||||
src-tauri/perf*
|
||||
|
||||
/*.AppImage
|
||||
/squashfs-root
|
||||
|
||||
/target/
|
||||
@@ -1,31 +0,0 @@
|
||||
stages:
|
||||
- build
|
||||
|
||||
build-linux:
|
||||
stage: build
|
||||
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/rustlang/rust:nightly
|
||||
script:
|
||||
- apt-get update -y
|
||||
- apt-get install yarnpkg libsoup-3.0-0 libsoup-3.0-dev libatk-adaptor libgtk-3-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev -y
|
||||
- yarnpkg
|
||||
- export
|
||||
- export RUST_LOG=warn
|
||||
- yarnpkg tauri build
|
||||
- cp src-tauri/target/release/bundle/deb/*.deb .
|
||||
- cp src-tauri/target/release/bundle/rpm/*.rpm .
|
||||
- cp src-tauri/target/release/bundle/appimage/*.AppImage .
|
||||
artifacts:
|
||||
paths:
|
||||
- "*.{deb,rpm,AppImage}"
|
||||
|
||||
build-windows:
|
||||
stage: build
|
||||
tags:
|
||||
- windows
|
||||
script:
|
||||
- yarn
|
||||
- yarn tauri build
|
||||
- cp src-tauri/target/release/bundle/nsis/*.exe .
|
||||
artifacts:
|
||||
paths:
|
||||
- "*.exe"
|
||||
@@ -1 +0,0 @@
|
||||
23
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"Vue.volar",
|
||||
"tauri-apps.tauri-vscode",
|
||||
"rust-lang.rust-analyzer"
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# How to create Flamegraph
|
||||
|
||||
Run this in `src-tauri`:
|
||||
```
|
||||
WEBKIT_DISABLE_DMABUF_RENDERER=1 CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --release
|
||||
```
|
||||
|
||||
You can leave out `WEBKIT_DISABLE_DMABUF_RENDERER=1` if you're not on NVIDIA/Linux
|
||||
|
||||
And then run this in the root dir:
|
||||
```
|
||||
yarn dev --port 1432
|
||||
```
|
||||
|
||||
And then do what you want, and it'll create the flamegraph for you
|
||||
@@ -1,3 +0,0 @@
|
||||
# Desktop
|
||||
|
||||
The official desktop client for Drop.
|
||||
@@ -1,48 +0,0 @@
|
||||
import fs from "fs";
|
||||
import process from "process";
|
||||
import childProcess from "child_process";
|
||||
import createLogger from "pino";
|
||||
|
||||
const OUTPUT = "./.output";
|
||||
const logger = createLogger({ transport: { target: "pino-pretty" } });
|
||||
|
||||
async function spawn(exec, opts) {
|
||||
const output = childProcess.spawn(exec, { ...opts, shell: true });
|
||||
output.stdout.on("data", (data) => {
|
||||
process.stdout.write(data);
|
||||
});
|
||||
output.stderr.on("data", (data) => {
|
||||
process.stderr.write(data);
|
||||
});
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
output.on("error", (err) => reject(err));
|
||||
output.on("exit", () => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
const views = fs.readdirSync(".").filter((view) => {
|
||||
const expectedPath = `./${view}/package.json`;
|
||||
return fs.existsSync(expectedPath);
|
||||
});
|
||||
|
||||
fs.mkdirSync(OUTPUT, { recursive: true });
|
||||
|
||||
for (const view of views) {
|
||||
const loggerChild = logger.child({});
|
||||
process.chdir(`./${view}`);
|
||||
|
||||
loggerChild.info(`Install deps for "${view}"`);
|
||||
await spawn("pnpm install");
|
||||
|
||||
loggerChild.info(`Building "${view}"`);
|
||||
await spawn("pnpm run build", {
|
||||
env: { ...process.env, NUXT_APP_BASE_URL: `/${view}/` },
|
||||
});
|
||||
|
||||
process.chdir("..");
|
||||
|
||||
fs.cpSync(`./${view}/.output/public`, `${OUTPUT}/${view}`, {
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
@@ -1,463 +0,0 @@
|
||||
|
||||
|
||||
## Release 0.2.0-beta
|
||||
|
||||
### Fixes
|
||||
- Re-enabled killing games #005bab2
|
||||
- fixed queue manipulation and waiting for downloads #01260f0
|
||||
- fix logic error in detecting dir #04368ff
|
||||
- absolute executable invoke #17759c4
|
||||
- don't crash download manager if multiple errors come in #21204de
|
||||
- clear stale data before requesting new #327628b
|
||||
- fixed completed indexes #39f2ebd
|
||||
- add file & line to console logs #4d8eadc
|
||||
- Games not launching due to string semantics #4ef49cc
|
||||
- Added error handling for chunk request errors #4fc0855
|
||||
- Chunk counting logic error #5ba151f
|
||||
- modal stack doesn't cover whole app #5db9ae5
|
||||
- use set_file_name instead of pushing to strings #60d0a48
|
||||
- use of completed signal, and pause/resuming #64d7f64
|
||||
- add message about nonce expiration #6a8d0af
|
||||
- Added "LIbrary Failed to Update" content to recover from library load fail #76bae3d
|
||||
- Restored RUST_LOG env functionality #7a0cf4f
|
||||
- initialise doesn't recreate default install dir #7a3841b
|
||||
- update routes for new server #7ab53f3
|
||||
- use vendored flag #7c8089e
|
||||
- fix poorly designed parsing for executables with spaces #7c90d2b
|
||||
- assorted fixes #89ea34c
|
||||
- Added Settings component #8aad64f
|
||||
- windows build #8d9234f
|
||||
- fix ugly scrollbars on edge webview #95f2174
|
||||
- windows shadow #9a8cc59
|
||||
- add better error message #9af0d08
|
||||
- Broken command invoke logic in settings/downloads.vue #9e29aa7
|
||||
- Accidentally was attempting to lock onto something that was already in scope #9e82a0b
|
||||
- fix incorrect error assumptions & update types #a17311a
|
||||
- Re-enabled uninstalling apps #a56ee25
|
||||
- types #af056c0
|
||||
- fix other metadata endpoints #c2f54c1
|
||||
- Re-enabled deep links #c3f6222
|
||||
- added console as an appender #d12bf15
|
||||
- remove unnecessary unstable feature #d5ac1b0
|
||||
- fix install button #d7b0302
|
||||
- stop loading on error #d83aae6
|
||||
- use unix timestamp to avoid invalid characters in filename #dafce24
|
||||
- Renamed game_id to id #dceaa56
|
||||
- use chrono library to generate timestamps #e22e6d8
|
||||
- clear stale data before requesting new #e72662c
|
||||
- fix scrollbars on edge webview #f09605a
|
||||
- update readme instructions #f0c47d8
|
||||
- Adding usize to completed_contexts_lock instead of &usize #f508186
|
||||
|
||||
|
||||
### Features
|
||||
- Game kill tauri command #01e6162
|
||||
- add debug page #02f8591
|
||||
- Add signout functionality (#16) #0a0d9d6
|
||||
- queue and library UIs #0a20139
|
||||
- add note about more install dirs #139bc0c
|
||||
- Using SerializeDisplay for better error management with Result #170fde5
|
||||
- add pre-launch log to file #17f8d76
|
||||
- Added option to change root directory #1aa52c0
|
||||
- add speed and time remaining information #1f899ec
|
||||
- lockless tracking of downloaded chunks #2183585
|
||||
- quit button #239b8d5
|
||||
- use shift or DEBUG RUST_LOG to show Debug Info #245a84d
|
||||
- Added database corruption dialog #25ba200
|
||||
- only allow downloads for supported platforms #269dcbb
|
||||
- add installed ui in the library menu #2c8164e
|
||||
- added file-based logging #2d4a7e8
|
||||
- automatically fetch remote data if not available #2dedfbb
|
||||
- Added database recovery #32ae7d5
|
||||
- ability to add more download dirs #384f7a5
|
||||
- re-enable checksums #3ca87fc
|
||||
- background processes and close/open menu #3d60fd5
|
||||
- launch games with log files #3f71149
|
||||
- Download cancelling #450bca9
|
||||
- refactoring and error message #469a2d6
|
||||
- Added UI to change download threads #4e93eb4
|
||||
- Made save button include user feedback & only allow numeric characters #53234d2
|
||||
- download widget and queue fix #532d13e
|
||||
- Pausing and resuming game downloads #55b7921
|
||||
- Allow settings to update UI using fetch_settings command #5bb04da
|
||||
- temporary queue ui and flamegraph instructions #5cbeb3b
|
||||
- Added DownloadThreadControl struct #5e05e68
|
||||
- Added max_download_threads setting and separated settings from db #5ea47d7
|
||||
- Added generic download manager #6159319
|
||||
- Added AgentInterfaceData to get information about all downloads in queue #63c3cc1
|
||||
- debug queue interface #671d45f
|
||||
- reduce scope of download agent #6a38ea3
|
||||
- Added multi-argument game launch and setup support #6ad3837
|
||||
- shared child with stop command #6b96e40
|
||||
- Added function to take and set any game state #6bc6482
|
||||
- Added line numbers to file logging and highlighting to console #7c3140e
|
||||
- Separated chunk updates into individual counters #7d3c601
|
||||
- Ensure that any database issues are resolved by standalone functions #7d4651d
|
||||
- ui to install games #8670bca
|
||||
- Implemented spawning with umu (using umu-wrapper-lib) #88b2505
|
||||
- offer manual signin #949acfc
|
||||
- better process management, including running state #a135b13
|
||||
- Added Download Manager #a1ada07
|
||||
- retry connnection on server unavailable #a53d838
|
||||
- finish download dir CRUD interface #a580a46
|
||||
- better download manager errors + modal #ad92dbe
|
||||
- syncs state to disk to persist across reboots #b556842
|
||||
- prevent default context menu and emit event on elements #c560656
|
||||
- initial creation and logo update #d9a51cf
|
||||
- Added manifest.json utility for persistent download progress #d9d0122
|
||||
- game uninstalling & partial compat #dd7f567
|
||||
- combined db and download interface improvements #de52dac
|
||||
- update db state with ui and emit events #e4df4eb
|
||||
- Generic function to set download state #f10d92d
|
||||
- Convert DownloadThreadControlFlag to AtomicBool #f25bfed
|
||||
- add note about more install dirs #f4ac1c8
|
||||
- Added rolling progress window #fd30b3e
|
||||
|
||||
|
||||
### Other Changes
|
||||
- quexeky <git@quexeky.dev>
|
||||
- Convert DATA_ROOT_DIR to Mutex #00b7179
|
||||
- Converting DB access to a trait #01b092c
|
||||
- Updated changelog #022330b
|
||||
- Progress on cleanup and exit #0381b8b
|
||||
- library ui #03fa364
|
||||
- Scoping changes and removing qualifications #046ba64
|
||||
- Moved all files relevant to game downloads to their own directory #06d1e9e
|
||||
- SLowly integrating game_download into the FE. Started with using the manifest minimal example in the server (#1) #07379b2
|
||||
- Ran cargo clippy & moved DownloadManagerInterface #075d6ec
|
||||
- Made logging systems match #0a1dddf
|
||||
- Some easy cleanup of the download manager #0a2ac25
|
||||
- client now fetches user information from Drop server #0c0cfeb
|
||||
- Included in AppStatus (Also trying to link to Issue #1)
|
||||
- Accidentally serialized AppStatus and broke everything :/ #10791ed
|
||||
- Removed debugging statements #10c8344
|
||||
- Wrappers are the bane of my existence. Also here's the download cancelling logic. #13df631
|
||||
- Merge branch 'error-handling' #1520471
|
||||
- Updated README.md #165a967
|
||||
- Removed unnecessary dependencies #1724449
|
||||
- merge(download-manager) -> 'main' #172d6b0
|
||||
- More refactoring and renaming camelCase struct definitions to snake_case #1742793
|
||||
- General cleanup #182361e
|
||||
- Delete pages/library.vue #1861659
|
||||
- progress on more precise download control #18b9149
|
||||
- Allowing some dead code features because they are there for future use (potentially) #191e62c
|
||||
- Ensure that Downloadable is also send and sync #1a89135
|
||||
- I think that download queuing is working #1ab61c8
|
||||
- auth initiate, database and more #22b1aee
|
||||
- Update .gitlab-ci.yml" #2307704
|
||||
- More fleshing out on how specifically game downloads will work (#1) #23137dd
|
||||
- Removed utils.rs #270bc8b
|
||||
- Fixing some references to "id" vs "game_id" #27e5a8e
|
||||
- More cleanup after cargo clippy #2822b7a
|
||||
- Updated contributing link #2aa5b9c
|
||||
- More fleshing out on how specifically game downloads will work #2b90de9
|
||||
- Cleaning up downloads playing and pausing #2c7b5fb
|
||||
- fixed multi-chunk downloads #2ec351f
|
||||
- Clippy refactoring #2efe304
|
||||
- remove unpacker mod statement #32067c0
|
||||
- Progress on adding tools #3299c71
|
||||
- Fixed bug with bad initial loading into store instead of auth #3923acf
|
||||
- add nvm rc #3ccd444
|
||||
- partial download manager #3dbf5ab
|
||||
- Update .gitlab-ci.yml with artifacts #3e10f17
|
||||
- Removed tools/ #3eda979
|
||||
- Downloads should be fixed now #403ca65
|
||||
- transient vs synced state now defined #42c0198
|
||||
- added adenmgb's autostart feature #472eb1d
|
||||
- better download defaults #4779383
|
||||
- Progress on downloads. Currently working on parsing functions to be run asynchronously #496c6a5
|
||||
- Ran cargo clippy & cargo fmt #4983b25
|
||||
- handshakes #4bb33c8
|
||||
- Convert DOWNLOAD_MAX_THREADS to const #4fc13a1
|
||||
- Merge branch 'downloads' #50ed841
|
||||
- Moved generateGameMeta.ts to composables, using PathBuf instead of String for install_dirs #50f37fd
|
||||
- Added time debugging and fixed logging formatting #5243694
|
||||
- Clippy changes #553bc37
|
||||
- Queue is running game downloads sequentially now #5564d23
|
||||
- migrate to new droplet ca system #556898f
|
||||
- Add LICENSE #57a5737
|
||||
- ran cargo clippy & cargo fmt #5e3d26b
|
||||
- my own take on some BASED design decisions #5ed0833
|
||||
- cleanup and game UI beginnings #5ef6b8e
|
||||
- Progress on terminator #5f5cbd0
|
||||
- Implement better error system and segregate errors and commands (#23) #604d5b5
|
||||
- moved to completed index arr to help serialization #64ebc19
|
||||
- Ran cargo clippy & cargo fmt #653717e
|
||||
- Removed all references to anything outside of the DownloadManager #6568faa
|
||||
- Merge remote-tracking branch 'origin/main' #68ca4a7
|
||||
- swap file name and to binary encoding #694f2fd
|
||||
- chore(polish & cleanup) #6cc0c67
|
||||
- Update .gitlab-ci.yml #6d7630e
|
||||
- Moved some variable declarations outside of the spawned download thread #6ea4cf2
|
||||
- Encoding game IDs and versions #6ef444e
|
||||
- restructing and renaming #7049673
|
||||
- Converted to md5 #706f525
|
||||
- Merge branch 'main' into downloads #714b968
|
||||
- Semantic naming changes #725f16b
|
||||
- Abstracted queue system #76b0975
|
||||
- Moved manifest and stored_manifest to download_manager" #78149bb
|
||||
- README update #78fc668
|
||||
- Ensured everything is serializing/deserializing to camelCase #7a95b7f
|
||||
- fixed some of quexeky's BASED design decisions #7e3da04
|
||||
- Progress checker works #7fec00d
|
||||
- Progress on refactoring and abiding by cargo clippy #816b427
|
||||
- Added GAME_PAUSE_CHECK_INTERVAL value #8204795
|
||||
- Ran cargo clippy & fmt #82804eb
|
||||
- update metadata #85a0899
|
||||
- Renamed most instances of "game" outside of actual game downloads #881fcc6
|
||||
- Debugging & starting work on parsing manifest #89d2814
|
||||
- slight ui/ux fixes and updates to auth protocol #8a2d23d
|
||||
- Removed Arc requirement for DownloadableMetadata #8be1dd4
|
||||
- compliant with new APIs #8f6f184
|
||||
- Ran cargo clippy & cargo fmt #9272970
|
||||
- Added rolling_progress_updates.rs #9369ff1
|
||||
- Add files via upload #93b8b83
|
||||
- More refining info!() statements #94cf678
|
||||
- fixed windows issues #959dad3
|
||||
- Starting p2p progress #97bb1fa
|
||||
- Game downloads from the client are working (multithreaded) by parsing in gameID, GameVersion, and maxThreads from FE (#1) #984472e
|
||||
- Version bump & appimage build #9897698
|
||||
- Some progress on thread terminations #99beca4
|
||||
- rename files to what they contain #99c8b39
|
||||
- Created separate function to generate requests #9a184a8
|
||||
- cleanup of lib and toml #9b1cfa7
|
||||
- refactor for generic way to implement cross platform launchers #9ea2aa4
|
||||
- Updated logging format #a213765
|
||||
- fix(windows build) #a24cc8a
|
||||
- Added ToolDownloadAgent #a2e63aa
|
||||
- copy direct to disk #a628fc1
|
||||
- Moved manifest and stored_manifest to download_manager #a846eed
|
||||
- adds nvm rc! #a881d8e
|
||||
- Reordered DownloadThreadControlFlag to agree with From<bool> #ab606e8
|
||||
- ci/cd and patches for windows builds #ac1c3b6
|
||||
- patch for not draggable windows during setup #ac66b20
|
||||
- another stage of client authentication #ae4c65b
|
||||
- Renamed GameDonwloadError to ApplicationDownloadError and moved #aed58e4
|
||||
- Progress on write speeds & added debug statements #b065e10
|
||||
- Updated logging #b3963b6
|
||||
- Created file settings.rs #b47b7ea
|
||||
- Added Downloadable trait and replaced references to GameDownloadAgent #b4d70a3
|
||||
- Update .gitlab-ci.yml #b6a54c0
|
||||
- Moved download manager to separate directory #b6c64e5
|
||||
- Ran cargo fmt #b8cf44c
|
||||
- Imported appropriate logging macros #b99ff67
|
||||
- Merge branch 'main' into download-manager #bb60942
|
||||
- Ran cargo clippy & cargo fmt #bd3deac
|
||||
- beginnings of game state management #bf46dec
|
||||
- Update Cargo.toml #c1fb39e
|
||||
- migrated unpacking to rust zstd to conform with droplet #c46c54b
|
||||
- More progress on checksums #c51e761
|
||||
- Delete pages/library.vue #c722a54
|
||||
- Merge branch 'downloads' (again) #c748aec
|
||||
- migrate to nuxt and groundwork #c957744
|
||||
- More debugging because apparently checksums are the bane of my existence. But it works and I was just an idiot #c9d9d2e
|
||||
- Fully separate & generic download manager #cac612b
|
||||
- Progress on rolling progress window #cf19477
|
||||
- Ensured that all logs start with lowercase capital and have no trailing punctuation #cfc9d13
|
||||
- Validated that loading data works #d21b1d2
|
||||
- Mostly finished with checksums. Just merging main in at the same time #d39e7cb
|
||||
- Ran cargo clippy #dcb1564
|
||||
- Add files via upload #dcb2c0f
|
||||
- Theoretically adding queue support and optimistic manifest downloading (#1). Needs tests when actual functions are implemented #dcd8fa8
|
||||
- Merge remote-tracking branch 'origin/downloads' into downloads #dd23ca8
|
||||
- Debugging line #ddc585d
|
||||
- Re-enabled closing the window and some more renaming #defba51
|
||||
- drop no longer freaks out if server is unavailable on startup #df88395
|
||||
- Apply stashed changes #e0ea8c9
|
||||
- Merge remote-tracking branch 'origin/downloads' into downloads #e4e605b
|
||||
- convert to more sensible permission schema #e504c00
|
||||
- Update on GameDownload #e71e4cf
|
||||
- reorganisation, cleanup and new nonce protocol #e828bca
|
||||
- rustix fs feature #e9805a8
|
||||
- Added manage_go_signal command #ea70ec9
|
||||
- Drop will no longer crash when the server goes down #eb3311a
|
||||
- Made all errors type-based #ec2f414
|
||||
- Added description on how the DownloadManager works #f029cbf
|
||||
- Using more appropriate logging statements #f183a9d
|
||||
- remove unnecessary compat code (#20) #f1c8bbf
|
||||
- Manifests are now being parsed successfully #f28c880
|
||||
- Removed tests/ #f29e989
|
||||
- I think that downloads are working. Need to test and set decent file locations now #f388237
|
||||
- Just debugging tauri's damn Sync command features #f60ca2b
|
||||
- fixes and patches for merged changes #f6476bc
|
||||
- Added manage_queue_signal #f64782e
|
||||
- initial commit #f6cd7c3
|
||||
- Update .gitlab-ci.yml #fc6bab9
|
||||
|
||||
|
||||
_changelog generated by_ [go-conventional-commits](https://github.com/joselitofilho/go-conventional-commits)
|
||||
|
||||
## Release 0.1.0-beta
|
||||
|
||||
### Fixes
|
||||
- fixed queue manipulation and waiting for downloads #01260f0
|
||||
- fix logic error in detecting dir #04368ff
|
||||
- absolute executable invoke #17759c4
|
||||
- Chunk counting logic error #5ba151f
|
||||
- use of completed signal, and pause/resuming #64d7f64
|
||||
- initialise doesn't recreate default install dir #7a3841b
|
||||
- use vendored flag #7c8089e
|
||||
- windows build #8d9234f
|
||||
- windows shadow #9a8cc59
|
||||
- types #af056c0
|
||||
- added console as an appender #d12bf15
|
||||
- remove unnecessary unstable feature #d5ac1b0
|
||||
- use unix timestamp to avoid invalid characters in filename #dafce24
|
||||
- use chrono library to generate timestamps #e22e6d8
|
||||
- fix scrollbars on edge webview #f09605a
|
||||
- update readme instructions #f0c47d8
|
||||
|
||||
|
||||
### Features
|
||||
- queue and library UIs #0a20139
|
||||
- add pre-launch log to file #17f8d76
|
||||
- Added option to change root directory #1aa52c0
|
||||
- quit button #239b8d5
|
||||
- only allow downloads for supported platforms #269dcbb
|
||||
- added file-based logging #2d4a7e8
|
||||
- automatically fetch remote data if not available #2dedfbb
|
||||
- ability to add more download dirs #384f7a5
|
||||
- background processes and close/open menu #3d60fd5
|
||||
- launch games with log files #3f71149
|
||||
- Download cancelling #450bca9
|
||||
- refactoring and error message #469a2d6
|
||||
- download widget and queue fix #532d13e
|
||||
- Pausing and resuming game downloads #55b7921
|
||||
- temporary queue ui and flamegraph instructions #5cbeb3b
|
||||
- Added DownloadThreadControl struct #5e05e68
|
||||
- Added AgentInterfaceData to get information about all downloads in queue #63c3cc1
|
||||
- debug queue interface #671d45f
|
||||
- reduce scope of download agent #6a38ea3
|
||||
- Added function to take and set any game state #6bc6482
|
||||
- Separated chunk updates into individual counters #7d3c601
|
||||
- ui to install games #8670bca
|
||||
- Added Download Manager #a1ada07
|
||||
- retry connnection on server unavailable #a53d838
|
||||
- finish download dir CRUD interface #a580a46
|
||||
- syncs state to disk to persist across reboots #b556842
|
||||
- prevent default context menu and emit event on elements #c560656
|
||||
- initial creation and logo update #d9a51cf
|
||||
- Added manifest.json utility for persistent download progress #d9d0122
|
||||
- combined db and download interface improvements #de52dac
|
||||
- update db state with ui and emit events #e4df4eb
|
||||
- Generic function to set download state #f10d92d
|
||||
- Convert DownloadThreadControlFlag to AtomicBool #f25bfed
|
||||
|
||||
|
||||
### Other Changes
|
||||
- quexeky <git@quexeky.dev>
|
||||
- Convert DATA_ROOT_DIR to Mutex #00b7179
|
||||
- Converting DB access to a trait #01b092c
|
||||
- Scoping changes and removing qualifications #046ba64
|
||||
- SLowly integrating game_download into the FE. Started with using the manifest minimal example in the server (#1) #07379b2
|
||||
- Ran cargo clippy & moved DownloadManagerInterface #075d6ec
|
||||
- Made logging systems match #0a1dddf
|
||||
- client now fetches user information from Drop server #0c0cfeb
|
||||
- Included in AppStatus (Also trying to link to Issue #1)
|
||||
- Accidentally serialized AppStatus and broke everything :/ #10791ed
|
||||
- Removed debugging statements #10c8344
|
||||
- Wrappers are the bane of my existence. Also here's the download cancelling logic. #13df631
|
||||
- Merge branch 'error-handling' #1520471
|
||||
- Removed unnecessary dependencies #1724449
|
||||
- merge(download-manager) -> 'main' #172d6b0
|
||||
- More refactoring and renaming camelCase struct definitions to snake_case #1742793
|
||||
- progress on more precise download control #18b9149
|
||||
- Allowing some dead code features because they are there for future use (potentially) #191e62c
|
||||
- I think that download queuing is working #1ab61c8
|
||||
- auth initiate, database and more #22b1aee
|
||||
- More fleshing out on how specifically game downloads will work (#1) #23137dd
|
||||
- Removed utils.rs #270bc8b
|
||||
- Fixing some references to "id" vs "game_id" #27e5a8e
|
||||
- Updated contributing link #2aa5b9c
|
||||
- More fleshing out on how specifically game downloads will work #2b90de9
|
||||
- Cleaning up downloads playing and pausing #2c7b5fb
|
||||
- fixed multi-chunk downloads #2ec351f
|
||||
- Clippy refactoring #2efe304
|
||||
- remove unpacker mod statement #32067c0
|
||||
- Fixed bug with bad initial loading into store instead of auth #3923acf
|
||||
- partial download manager #3dbf5ab
|
||||
- Downloads should be fixed now #403ca65
|
||||
- transient vs synced state now defined #42c0198
|
||||
- better download defaults #4779383
|
||||
- Progress on downloads. Currently working on parsing functions to be run asynchronously #496c6a5
|
||||
- Ran cargo clippy & cargo fmt #4983b25
|
||||
- handshakes #4bb33c8
|
||||
- Convert DOWNLOAD_MAX_THREADS to const #4fc13a1
|
||||
- Merge branch 'downloads' #50ed841
|
||||
- Added time debugging and fixed logging formatting #5243694
|
||||
- Clippy changes #553bc37
|
||||
- Queue is running game downloads sequentially now #5564d23
|
||||
- migrate to new droplet ca system #556898f
|
||||
- Add LICENSE #57a5737
|
||||
- ran cargo clippy & cargo fmt #5e3d26b
|
||||
- my own take on some BASED design decisions #5ed0833
|
||||
- cleanup and game UI beginnings #5ef6b8e
|
||||
- moved to completed index arr to help serialization #64ebc19
|
||||
- Ran cargo clippy & cargo fmt #653717e
|
||||
- Merge remote-tracking branch 'origin/main' #68ca4a7
|
||||
- swap file name and to binary encoding #694f2fd
|
||||
- chore(polish & cleanup) #6cc0c67
|
||||
- Encoding game IDs and versions #6ef444e
|
||||
- restructing and renaming #7049673
|
||||
- Converted to md5 #706f525
|
||||
- Merge branch 'main' into downloads #714b968
|
||||
- Semantic naming changes #725f16b
|
||||
- Abstracted queue system #76b0975
|
||||
- README update #78fc668
|
||||
- Ensured everything is serializing/deserializing to camelCase #7a95b7f
|
||||
- fixed some of quexeky's BASED design decisions #7e3da04
|
||||
- Progress checker works #7fec00d
|
||||
- Progress on refactoring and abiding by cargo clippy #816b427
|
||||
- Added GAME_PAUSE_CHECK_INTERVAL value #8204795
|
||||
- Debugging & starting work on parsing manifest #89d2814
|
||||
- slight ui/ux fixes and updates to auth protocol #8a2d23d
|
||||
- compliant with new APIs #8f6f184
|
||||
- fixed windows issues #959dad3
|
||||
- Starting p2p progress #97bb1fa
|
||||
- Game downloads from the client are working (multithreaded) by parsing in gameID, GameVersion, and maxThreads from FE (#1) #984472e
|
||||
- Some progress on thread terminations #99beca4
|
||||
- rename files to what they contain #99c8b39
|
||||
- cleanup of lib and toml #9b1cfa7
|
||||
- Updated logging format #a213765
|
||||
- fix(windows build) #a24cc8a
|
||||
- copy direct to disk #a628fc1
|
||||
- Reordered DownloadThreadControlFlag to agree with From<bool> #ab606e8
|
||||
- ci/cd and patches for windows builds #ac1c3b6
|
||||
- patch for not draggable windows during setup #ac66b20
|
||||
- another stage of client authentication #ae4c65b
|
||||
- Progress on write speeds & added debug statements #b065e10
|
||||
- Updated logging #b3963b6
|
||||
- Created file settings.rs #b47b7ea
|
||||
- Ran cargo fmt #b8cf44c
|
||||
- Merge branch 'main' into download-manager #bb60942
|
||||
- Ran cargo clippy & cargo fmt #bd3deac
|
||||
- beginnings of game state management #bf46dec
|
||||
- Update Cargo.toml #c1fb39e
|
||||
- migrated unpacking to rust zstd to conform with droplet #c46c54b
|
||||
- More progress on checksums #c51e761
|
||||
- Merge branch 'downloads' (again) #c748aec
|
||||
- migrate to nuxt and groundwork #c957744
|
||||
- More debugging because apparently checksums are the bane of my existence. But it works and I was just an idiot #c9d9d2e
|
||||
- Validated that loading data works #d21b1d2
|
||||
- Mostly finished with checksums. Just merging main in at the same time #d39e7cb
|
||||
- Theoretically adding queue support and optimistic manifest downloading (#1). Needs tests when actual functions are implemented #dcd8fa8
|
||||
- Merge remote-tracking branch 'origin/downloads' into downloads #dd23ca8
|
||||
- Debugging line #ddc585d
|
||||
- Re-enabled closing the window and some more renaming #defba51
|
||||
- drop no longer freaks out if server is unavailable on startup #df88395
|
||||
- Merge remote-tracking branch 'origin/downloads' into downloads #e4e605b
|
||||
- convert to more sensible permission schema #e504c00
|
||||
- Update on GameDownload #e71e4cf
|
||||
- reorganisation, cleanup and new nonce protocol #e828bca
|
||||
- rustix fs feature #e9805a8
|
||||
- Drop will no longer crash when the server goes down #eb3311a
|
||||
- Made all errors type-based #ec2f414
|
||||
- Added description on how the DownloadManager works #f029cbf
|
||||
- Manifests are now being parsed successfully #f28c880
|
||||
- I think that downloads are working. Need to test and set decent file locations now #f388237
|
||||
- Just debugging tauri's damn Sync command features #f60ca2b
|
||||
- fixes and patches for merged changes #f6476bc
|
||||
- initial commit #f6cd7c3
|
||||
|
||||
|
||||
_changelog generated by_ [go-conventional-commits](https://github.com/joselitofilho/go-conventional-commits)
|
||||
@@ -1,5 +0,0 @@
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M4 13.5C4 11.0008 5.38798 8.76189 7.00766 7C8.43926 5.44272 10.0519 4.25811 11.0471 3.5959C11.6287 3.20893 12.3713 3.20893 12.9529 3.5959C13.9481 4.25811 15.5607 5.44272 16.9923 7C18.612 8.76189 20 11.0008 20 13.5C20 17.9183 16.4183 21.5 12 21.5C7.58172 21.5 4 17.9183 4 13.5Z"
|
||||
stroke="#60a5fa" stroke-width="2" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 440 B |
@@ -1,72 +0,0 @@
|
||||
import Foundation
|
||||
import Security
|
||||
|
||||
enum SecurityError: Error {
|
||||
case generalError
|
||||
}
|
||||
|
||||
func deleteCertificateFromKeyChain(_ certificateLabel: String) -> Bool {
|
||||
let delQuery: [NSString: Any] = [
|
||||
kSecClass: kSecClassCertificate,
|
||||
kSecAttrLabel: certificateLabel,
|
||||
]
|
||||
let delStatus: OSStatus = SecItemDelete(delQuery as CFDictionary)
|
||||
|
||||
return delStatus == errSecSuccess
|
||||
}
|
||||
|
||||
func saveCertificateToKeyChain(_ certificate: SecCertificate, certificateLabel: String) throws {
|
||||
SecKeychainSetPreferenceDomain(SecPreferencesDomain.system)
|
||||
deleteCertificateFromKeyChain(certificateLabel)
|
||||
|
||||
let setQuery: [NSString: AnyObject] = [
|
||||
kSecClass: kSecClassCertificate,
|
||||
kSecValueRef: certificate,
|
||||
kSecAttrLabel: certificateLabel as AnyObject,
|
||||
kSecAttrAccessible: kSecAttrAccessibleWhenUnlocked,
|
||||
kSecAttrCanSign: true as AnyObject,
|
||||
]
|
||||
let addStatus: OSStatus = SecItemAdd(setQuery as CFDictionary, nil)
|
||||
|
||||
guard addStatus == errSecSuccess else {
|
||||
throw SecurityError.generalError
|
||||
}
|
||||
|
||||
var status = SecTrustSettingsSetTrustSettings(certificate, SecTrustSettingsDomain.admin, nil)
|
||||
}
|
||||
|
||||
func getCertificateFromString(stringData: String) throws -> SecCertificate {
|
||||
if let data = NSData(base64Encoded: stringData, options: NSData.Base64DecodingOptions.ignoreUnknownCharacters) {
|
||||
if let certificate = SecCertificateCreateWithData(kCFAllocatorDefault, data) {
|
||||
return certificate
|
||||
}
|
||||
}
|
||||
throw SecurityError.generalError
|
||||
}
|
||||
|
||||
if CommandLine.arguments.count != 2 {
|
||||
print("Usage: \(CommandLine.arguments[0]) [cert.file]")
|
||||
print("Usage: \(CommandLine.arguments[0]) --version")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if (CommandLine.arguments[1] == "--version") {
|
||||
let version = "dev"
|
||||
print(version)
|
||||
exit(0)
|
||||
} else {
|
||||
let fileURL = URL(fileURLWithPath: CommandLine.arguments[1])
|
||||
do {
|
||||
let certData = try Data(contentsOf: fileURL)
|
||||
let certificate = SecCertificateCreateWithData(nil, certData as CFData)
|
||||
if certificate != nil {
|
||||
try? saveCertificateToKeyChain(certificate!, certificateLabel: "DropOSS")
|
||||
exit(0)
|
||||
} else {
|
||||
print("ERROR: Unknown error while reading the \(CommandLine.arguments[1]) file.")
|
||||
}
|
||||
} catch {
|
||||
print("ERROR: Unexpected error while reading the \(CommandLine.arguments[1]) file. \(error)")
|
||||
}
|
||||
}
|
||||
exit(1)
|
||||
@@ -1,51 +0,0 @@
|
||||
<template>
|
||||
<NuxtLoadingIndicator color="#2563eb" />
|
||||
<NuxtLayout class="select-none w-screen h-screen">
|
||||
<NuxtPage />
|
||||
<ModalStack />
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import "~/composables/downloads.js";
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { useAppState } from "./composables/app-state.js";
|
||||
import {
|
||||
initialNavigation,
|
||||
setupHooks,
|
||||
} from "./composables/state-navigation.js";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import type { AppState } from "./types.js";
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const state = useAppState();
|
||||
|
||||
async function fetchState() {
|
||||
try {
|
||||
state.value = JSON.parse(await invoke("fetch_state"));
|
||||
if (!state.value)
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
statusMessage: `App state is: ${state.value}`,
|
||||
fatal: true,
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("failed to parse state", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
await fetchState();
|
||||
|
||||
listen("update_state", (event) => {
|
||||
state.value = event.payload as AppState;
|
||||
});
|
||||
|
||||
setupHooks();
|
||||
initialNavigation(state);
|
||||
|
||||
useHead({
|
||||
title: "Drop",
|
||||
});
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user