From f8695bf9a6d16f8f073381c6ab0750b770c0de1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Marseault?= <22910497+Larsluph@users.noreply.github.com> Date: Sat, 18 May 2024 10:26:02 +0200 Subject: [PATCH] feat(pages): Deploy mocked demo version (#1690) --- .github/workflows/build-release.yml | 57 +++++++++++++++++-------- .github/workflows/test.yml | 4 +- .github/workflows/translations.yml | 4 +- .gitignore | 1 + README.md | 30 +++++++------ package.json | 2 + src/components/Settings/Advanced.vue | 2 +- src/services/index.ts | 20 --------- src/services/{ => qbit}/IProvider.ts | 0 src/services/{ => qbit}/MockProvider.ts | 6 +-- src/services/{ => qbit}/QbitProvider.ts | 10 ++++- src/services/qbit/index.ts | 8 ++++ src/stores/app.ts | 2 +- src/stores/auth.ts | 2 +- src/stores/content.ts | 2 +- src/stores/logs.ts | 2 +- src/stores/maindata.ts | 2 +- src/stores/preferences.ts | 2 +- src/stores/rss.ts | 2 +- src/stores/searchEngine.ts | 2 +- src/stores/torrentDetail.ts | 2 +- src/stores/torrents.ts | 2 +- src/types/qbit/models/FeedRule.ts | 2 +- vite.config.ts | 2 +- 24 files changed, 98 insertions(+), 70 deletions(-) delete mode 100644 src/services/index.ts rename src/services/{ => qbit}/IProvider.ts (100%) rename src/services/{ => qbit}/MockProvider.ts (99%) rename src/services/{ => qbit}/QbitProvider.ts (98%) create mode 100644 src/services/qbit/index.ts diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index c8f5c5db..8303018f 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -14,24 +14,28 @@ jobs: permissions: contents: write pull-requests: write - actions: write - steps: - name: Run release please - uses: google-github-actions/release-please-action@v4 + uses: googleapis/release-please-action@v4 id: release with: - token: ${{ secrets.GITHUB_TOKEN }} config-file: release-please-config.json manifest-file: .release-please-manifest.json build-release: name: Build VueTorrent runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - actions: write + strategy: + matrix: + npm-step: [ 'build', 'build-demo' ] + include: + - npm-step: build + artifact-name: vuetorrent-build + artifact-path: ./vuetorrent + - npm-step: build-demo + artifact-name: vuetorrent-demo + artifact-path: ./vuetorrent-demo + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -45,7 +49,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}" restore-keys: ${{ runner.os }}-node- - name: Install dependencies @@ -63,13 +67,13 @@ jobs: tolgee_secret: ${{ secrets.TOLGEE_TOKEN }} - name: Build VueTorrent - run: npm run build + run: npm run ${{ matrix.npm-step }} - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: vuetorrent-build - path: ./vuetorrent + name: ${{ matrix.artifact-name }} + path: ${{ matrix.artifact-path }} retention-days: 1 push-nightly: @@ -94,9 +98,29 @@ jobs: branch: nightly-release folder: ./vuetorrent + push-demo: + name: Push to demo repo + runs-on: ubuntu-latest + needs: build-release + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: vuetorrent-demo + path: ./vuetorrent-demo + + - name: Push to demo repo + uses: JamesIves/github-pages-deploy-action@v4.6.0 + with: + folder: './vuetorrent-demo' + repository-name: 'VueTorrent/demo' + token: ${{ secrets.GH_PAT }} + upload-release: name: Upload release to GitHub - needs: [setup-release, build-release] + needs: [ setup-release, build-release ] if: needs.setup-release.outputs.release_created runs-on: ubuntu-latest steps: @@ -120,7 +144,7 @@ jobs: push-release: name: Push to latest branch - needs: [setup-release, build-release] + needs: [ setup-release, build-release ] if: needs.setup-release.outputs.release_created runs-on: ubuntu-latest steps: @@ -135,6 +159,5 @@ jobs: - name: Push to latest-release uses: JamesIves/github-pages-deploy-action@v4.6.0 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: latest-release - FOLDER: ./vuetorrent + branch: latest-release + folder: ./vuetorrent diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fd2482a1..ea848c98 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,8 +25,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-node- + key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}" + restore-keys: "${{ runner.os }}-node-" - name: Install dependencies run: npm ci diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index c45286ca..31d3d460 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -26,8 +26,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-node + key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}" + restore-keys: "${{ runner.os }}-node" - name: Install dependencies run: npm ci diff --git a/.gitignore b/.gitignore index 78223223..7390c413 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ coverage # Custom vuetorrent/** +vuetorrent-demo/** docker/** coverage/ config/ diff --git a/README.md b/README.md index 3b2e9bad..dc187459 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,15 @@ The sleekest looking WebUI for qBittorrent made with Vue.js! Screenshot Mobile Dashboard (Light Mode)

+## Demo + +A live demo **with mocked data** is available here: https://vuetorrent.github.io/demo + +> [!NOTE] +> This version isn't connected to a qBittorrent instance. +> +> Don't try to download torrents or change preferences, it won't work 😉 + ## Installation Checkout the [wiki](https://github.com/VueTorrent/VueTorrent/wiki/Installation)! @@ -50,9 +59,9 @@ Checkout the [wiki](https://github.com/VueTorrent/VueTorrent/wiki/Installation)! - `docker-compose up -d` (starts a qbittorrent docker, optional) - Open the WebUI on localhost with the default credentials - Default username is always `admin` - - Default password is `adminadmin` **on 4.6.0 and below**, and is generated on 4.6.1 and above -- Make sure "CSRF protection" and "Host header verification" is disabled on the target server! -- Edit `env.development` to tweak your dev environment (e.g. fake torrents) + - Default password is `adminadmin` **on 4.6.0 and below**, and is generated in logs on 4.6.1 and above +- Make sure "CSRF protection" and "Host header verification" is disabled in the qBittorrent preferences +- Edit `env.development` to tweak your dev environment (e.g. mocked data) ## Features @@ -89,7 +98,7 @@ Checkout the [wiki](https://github.com/VueTorrent/VueTorrent/wiki/Installation)! VueTorrent is a **WebUI** (think of it as a "visual skin") that uses qBittorrent's API, enabling compatibility with automation solutions like the Servarr stack. -Everything that is compatible with qBittorrent will work regardless of the WebUI you chose to use. +Everything that is compatible with the classic qBittorrent WebUI will work regardless of the WebUI you chose to use, whether its VueTorrent or another one. ## Contributing @@ -101,16 +110,13 @@ See the [Contributing Guidelines](https://github.com/VueTorrent/VueTorrent/blob/ ## Support -[![Discord](https://img.shields.io/discord/1170618192956243998?logo=discord)](https://discord.gg/KDQP7fR467) -[![Wiki](https://img.shields.io/badge/Wiki-blue)](https://github.com/VueTorrent/VueTorrent/wiki) -[![FAQ](https://img.shields.io/badge/FAQ-orange)](https://github.com/VueTorrent/VueTorrent/wiki/FAQ) +- [![Discord](https://img.shields.io/discord/1170618192956243998?logo=discord)](https://discord.gg/KDQP7fR467) +- [![Wiki](https://img.shields.io/badge/Wiki-blue)](https://github.com/VueTorrent/VueTorrent/wiki) +- [![FAQ](https://img.shields.io/badge/FAQ-orange)](https://github.com/VueTorrent/VueTorrent/wiki/FAQ) -Open up an issue 😛 +If any of the above didn't help, feel free to open an issue! -but before you do that: - -- confirm you're on the latest version of VueTorrent -- confirm there is no other issue mentioning the same problem +See the [Contributing Guidelines](https://github.com/VueTorrent/VueTorrent/blob/master/.github/CONTRIBUTING.md) for more information. ## Funding diff --git a/package.json b/package.json index f066de64..bc6cd1ee 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,10 @@ "dev": "vite", "build": "vue-tsc && vite build", "postbuild": "node write-version.cjs", + "build-demo": "vue-tsc && vite build -m demo", "check-build": "vue-tsc", "preview": "vite preview", + "preview-demo": "vite preview -m demo", "lint": "eslint --fix && prettier . -w -u", "test": "vitest run", "coverage": "vitest run --coverage" diff --git a/src/components/Settings/Advanced.vue b/src/components/Settings/Advanced.vue index fe15ccf3..66f98997 100644 --- a/src/components/Settings/Advanced.vue +++ b/src/components/Settings/Advanced.vue @@ -1,6 +1,6 @@