Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbb750a413 | ||
|
|
7fb3d6cfa4 | ||
|
|
c15742ff2a | ||
|
|
336dbefe74 | ||
|
|
5c773841f7 | ||
|
|
94decd674c | ||
|
|
72909fd3b2 | ||
|
|
785f64a72e | ||
|
|
daa1c3f007 | ||
|
|
87315d9679 | ||
|
|
fe30c4f1f9 | ||
|
|
ae1f312e84 | ||
|
|
ed91735b2b | ||
|
|
5776b7c0d2 | ||
|
|
2e099ecafa | ||
|
|
d80db29a02 | ||
|
|
8e9e5eeff2 | ||
|
|
4b67c94494 | ||
|
|
f20578a552 | ||
|
|
ae1e81d8d8 | ||
|
|
4d85f09003 | ||
|
|
6bd2106f3d | ||
|
|
5f5803c9f8 | ||
|
|
04ab9f767b | ||
|
|
e93de2beea | ||
|
|
9f314582c0 | ||
|
|
fcf61012db | ||
|
|
d9bce4de04 | ||
|
|
5784036eb1 | ||
|
|
e89932fc7d | ||
|
|
31826f1098 | ||
|
|
5746bf35a5 | ||
|
|
cb5ee9b672 | ||
|
|
7c5fa8f869 | ||
|
|
b592680006 | ||
|
|
e5f1ff34ed | ||
|
|
6a1467e864 | ||
|
|
205b655d00 | ||
|
|
b1d9b40def | ||
|
|
610a7e4dbf | ||
|
|
0d2edcab3d | ||
|
|
5b4efd20c0 | ||
|
|
67c69208c4 | ||
|
|
23cdfb010d | ||
|
|
3cfa52ffc9 | ||
|
|
75b4ddd598 | ||
|
|
ae5a2133fa | ||
|
|
6675a55957 | ||
|
|
4bdd0139bf | ||
|
|
df392eb647 | ||
|
|
5aaa3435da | ||
|
|
0f80d4db4e | ||
|
|
4a0cb46734 | ||
|
|
d5c1bfac64 | ||
|
|
affbd00157 | ||
|
|
e39a5c70c0 | ||
|
|
c80d13744d | ||
|
|
5994b94406 | ||
|
|
a1af85dd72 | ||
|
|
ffdedc7b9b | ||
|
|
289ac4958d | ||
|
|
a07ae9b264 | ||
|
|
dd0bf8b493 | ||
|
|
5ca4694c2b | ||
|
|
89581e1ba8 | ||
|
|
2aa3e4106c | ||
|
|
08f0ca0df1 | ||
|
|
fa29331c1c | ||
|
|
a98663691d | ||
|
|
cc1391bb7d | ||
|
|
b00f93d262 | ||
|
|
4c9dd86962 | ||
|
|
3131c1f905 | ||
|
|
c560f8ae1b | ||
|
|
cf5fb43377 | ||
|
|
5a9b3ad273 | ||
|
|
1c499f42ec | ||
|
|
61ebc66127 | ||
|
|
c232c1bf12 | ||
|
|
2d5f49c32e | ||
|
|
0c50acddd9 | ||
|
|
56ba65d23e | ||
|
|
b8f544b483 | ||
|
|
690cfb398c | ||
|
|
45dbfbb7ec | ||
|
|
e5171b7bb8 | ||
|
|
9211faabf0 | ||
|
|
422b1d6aa4 | ||
|
|
7f7866b28d | ||
|
|
1defb53945 | ||
|
|
73e3b865ab | ||
|
|
691df70aff | ||
|
|
6f2d5a5627 | ||
|
|
7804ab2b86 | ||
|
|
4ade92bccc | ||
|
|
ab1aa23725 | ||
|
|
0131a23dc2 | ||
|
|
72ca2fb4f3 | ||
|
|
b39a15449d | ||
|
|
cb83b05c7a | ||
|
|
32f5b3b3cf | ||
|
|
94e6a03e87 | ||
|
|
690070207b | ||
|
|
79c70e6d46 | ||
|
|
cf1f3c772d | ||
|
|
b870a119e5 | ||
|
|
0883cb0fe1 | ||
|
|
8519c12c45 | ||
|
|
d6c1b0992e | ||
|
|
9c3cc53278 | ||
|
|
abc7d68016 | ||
|
|
ad8d8545e9 | ||
|
|
1c8c048df0 | ||
|
|
c0402fe8cf | ||
|
|
ce6e4b681b | ||
|
|
6bf7f434b5 | ||
|
|
4834a31cb5 | ||
|
|
b49f187098 | ||
|
|
e41b5b3085 | ||
|
|
c19198e706 | ||
|
|
78c4b7a206 | ||
|
|
5579d5e5e8 | ||
|
|
e50ae60216 | ||
|
|
4bc6044ca2 | ||
|
|
7d55810f08 | ||
|
|
40651fd3d6 | ||
|
|
fdf43aba18 | ||
|
|
03bd7c027b | ||
|
|
995d75dbec | ||
|
|
4952d8842b | ||
|
|
f527d97912 | ||
|
|
ef8dfbc23a | ||
|
|
6576bfe5f3 | ||
|
|
3000146e66 | ||
|
|
81e0c3b9a8 | ||
|
|
27d8e04b0f | ||
|
|
50de0b7b51 | ||
|
|
64c5b7570b | ||
|
|
d46e143262 | ||
|
|
6542ed9487 | ||
|
|
d39c064600 | ||
|
|
d254d3033d | ||
|
|
3abf27724f | ||
|
|
120e283e3d | ||
|
|
706fb7b890 | ||
|
|
11b4a878ac | ||
|
|
6695bdc6ee | ||
|
|
17922127dd | ||
|
|
a135d1be5f | ||
|
|
88c42d8110 | ||
|
|
8e667a2253 | ||
|
|
e08eaea1d1 | ||
|
|
937e9385f2 | ||
|
|
bb2c0272a2 | ||
|
|
6b4d6ed0d3 | ||
|
|
374cba8f63 | ||
|
|
07522b50c5 | ||
|
|
257ff8e552 | ||
|
|
37e898e4cf | ||
|
|
65e5370dbf | ||
|
|
2d4b0d66b4 | ||
|
|
54d0b07666 | ||
|
|
9ac556d001 | ||
|
|
333fe09f45 | ||
|
|
a8ee9c190c | ||
|
|
0cf87da218 | ||
|
|
f919162dfc | ||
|
|
c9d16f4669 | ||
|
|
53311a1728 | ||
|
|
c4073f1368 | ||
|
|
c69a547379 | ||
|
|
7b0b22b611 | ||
|
|
47a486a3ad | ||
|
|
0f5482627a | ||
|
|
4ca90e713d | ||
|
|
093e40a929 | ||
|
|
797d0600c3 | ||
|
|
18d55a4af6 | ||
|
|
d7f3317913 | ||
|
|
52b73f7475 | ||
|
|
0c8b282469 | ||
|
|
25479b2278 | ||
|
|
dfb8eeee12 | ||
|
|
790f3f163b | ||
|
|
db74b4f58b | ||
|
|
18ebe4ef1e | ||
|
|
f0c8458dc4 | ||
|
|
80080e841a | ||
|
|
d60cb2b5fb | ||
|
|
7086892843 | ||
|
|
951cf61a89 | ||
|
|
ceee9311aa | ||
|
|
21a6e492f4 | ||
|
|
b916560c6a | ||
|
|
d3d5c5ac54 | ||
|
|
3f5e764cd7 | ||
|
|
4381b6e28e | ||
|
|
83c96cf65c | ||
|
|
4ff422ae61 | ||
|
|
c0d7d4e03d | ||
|
|
cd768a088b | ||
|
|
2f12fe0862 | ||
|
|
f6c0963f48 | ||
|
|
4ae8a087ed | ||
|
|
412e54fd82 | ||
|
|
51848a39ae | ||
|
|
295b8da8eb | ||
|
|
6d1c55dda5 | ||
|
|
0c47660501 | ||
|
|
e9b37d99aa | ||
|
|
f19ffb4361 | ||
|
|
ce533dde4b | ||
|
|
6d2448ef36 | ||
|
|
c572cb35cb | ||
|
|
f57e78b244 | ||
|
|
af8dec5844 | ||
|
|
7d2659f32b | ||
|
|
06015d7702 | ||
|
|
0847c2b2ef | ||
|
|
bc6d39b004 | ||
|
|
9f7fde2173 | ||
|
|
7410c8f3e3 | ||
|
|
fcf18c01e8 | ||
|
|
620b4ce253 | ||
|
|
9dbe11ce23 | ||
|
|
5d5f127525 | ||
|
|
d7f3892ff3 | ||
|
|
dc72f381e8 | ||
|
|
d238aeff1f | ||
|
|
1c38893c68 | ||
|
|
000e62873a | ||
|
|
5b322d49e6 | ||
|
|
232aad5e8a | ||
|
|
7aceb89e11 | ||
|
|
42c154f17a | ||
|
|
27cc14c1f5 | ||
|
|
cf8c5d4490 | ||
|
|
97526e29b4 | ||
|
|
e049ce9ad6 | ||
|
|
561daa7d81 | ||
|
|
2ad920af9d | ||
|
|
907753b041 | ||
|
|
591fce7e5c | ||
|
|
9d96667d60 | ||
|
|
5c8624a73c | ||
|
|
0319d9711e | ||
|
|
70da3b3754 | ||
|
|
98078585d6 | ||
|
|
cf66b8d20c | ||
|
|
a198e09864 | ||
|
|
25d9702283 | ||
|
|
0790f0afd5 | ||
|
|
240ed3b365 | ||
|
|
5cd9b57e1f | ||
|
|
88b016f6f5 | ||
|
|
8a459f588d | ||
|
|
6c5335648d | ||
|
|
fc9abf6c5b | ||
|
|
a53224f802 | ||
|
|
865c42b419 | ||
|
|
12f963d718 | ||
|
|
8917dd240a | ||
|
|
685ef4b2fc | ||
|
|
f141ddbaf3 | ||
|
|
6e55a287eb | ||
|
|
9c110ea8fa | ||
|
|
ebbe686a57 | ||
|
|
2cb10aa342 | ||
|
|
a64f5876f2 | ||
|
|
95a180e968 | ||
|
|
99ec17501d | ||
|
|
a7eab72639 | ||
|
|
81695a583d | ||
|
|
c6b5d6a4a2 | ||
|
|
7ef8e33669 | ||
|
|
9be02b6392 | ||
|
|
dd16f3a204 | ||
|
|
7e7f44ce94 | ||
|
|
61fa734629 | ||
|
|
45f67aac40 | ||
|
|
19343b4ea3 | ||
|
|
0dde74ab70 |
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [prayag17] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||
thanks_dev: # Replace with a single thanks.dev username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1,11 @@
|
||||
changelog:
|
||||
categories:
|
||||
- title: 🏕 Features
|
||||
labels:
|
||||
- '*'
|
||||
exclude:
|
||||
labels:
|
||||
- dependencies
|
||||
- title: 👒 Dependencies
|
||||
labels:
|
||||
- dependencies
|
||||
@@ -13,12 +13,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- uses: pnpm/action-setup@v3
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 7
|
||||
version: 10
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
- uses: actions/cache@v5
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Sync node version and setup cache
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
cache: "pnpm"
|
||||
@@ -56,12 +56,12 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [macos-latest, ubuntu-22.04, windows-latest]
|
||||
platform: [macos-latest, ubuntu-22.04, windows-latest, windows-11-arm]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
environment: TAURI
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04'
|
||||
@@ -78,10 +78,10 @@ jobs:
|
||||
with:
|
||||
workspaces: "./src-tauri -> target"
|
||||
|
||||
- uses: pnpm/action-setup@v3
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 7
|
||||
version: 10
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
@@ -89,7 +89,7 @@ jobs:
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
- uses: actions/cache@v5
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Sync node version and setup cache
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
cache: "pnpm"
|
||||
@@ -107,7 +107,7 @@ jobs:
|
||||
run: pnpm install --no-frozen-lockfile
|
||||
|
||||
- name: Build app
|
||||
run: pnpm run tauri build
|
||||
run: pnpm run tauri build --debug
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||
@@ -115,8 +115,59 @@ jobs:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
|
||||
# TODO: Remove the below command after upstream issue is fixed
|
||||
# Related issue: https://github.com/tauri-apps/tauri/issues/10702
|
||||
WEBKIT_DISABLE_DMABUF_RENDERER: 1 # Disable DMABUF renderer on Wayland
|
||||
|
||||
- name: Upload build Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: Blink-${{ matrix.platform }}-dev${{ github.sha }}
|
||||
path: src-tauri/target/release/bundle/*
|
||||
path: src-tauri/target/debug/bundle/*
|
||||
|
||||
# Create or update nightly release
|
||||
nightly_release:
|
||||
needs: build
|
||||
if: github.repository == 'prayag17/Blink' && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # Required for creating/updating releases
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6.0.1
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v7.0.0
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Prepare assets
|
||||
run: |
|
||||
mkdir -p release_assets
|
||||
find artifacts -type f \( -name "*.exe" -o -name "*.msi" -o -name "*.dmg" -o -name "*.deb" -o -name "*.AppImage" -o -name "*.rpm" -o -name "*.tar.gz" \) | while read -r file; do
|
||||
# Extract platform from artifact name (e.g. Blink-ubuntu-22.04-devSHA)
|
||||
artifact_name=$(echo "$file" | cut -d'/' -f2)
|
||||
platform=$(echo "$artifact_name" | sed -E 's/Blink-(.*)-dev.*/\1/' | sed 's/-/_/g')
|
||||
filename=$(basename "$file")
|
||||
cp "$file" "release_assets/${platform}-${filename}"
|
||||
done
|
||||
|
||||
- name: Delete old nightly release
|
||||
run: gh release delete nightly --yes --repo ${{ github.repository }} || true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create nightly release
|
||||
uses: softprops/action-gh-release@v2.5.0
|
||||
with:
|
||||
tag_name: nightly
|
||||
name: Nightly Build (${{ github.sha }})
|
||||
body: |
|
||||
Nightly build from the latest main branch.
|
||||
|
||||
**Last commit:** ${{ github.event.head_commit.message }}
|
||||
**SHA:** ${{ github.sha }}
|
||||
prerelease: true
|
||||
files: release_assets/*
|
||||
fail_on_unmatched_files: true
|
||||
|
||||
@@ -12,12 +12,12 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [macos-latest, ubuntu-22.04, windows-latest]
|
||||
platform: [macos-latest, ubuntu-22.04, windows-latest, windows-11-arm]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
environment: TAURI
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04'
|
||||
@@ -28,16 +28,19 @@ jobs:
|
||||
|
||||
- name: Rust setup
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
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-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "./src-tauri -> target"
|
||||
|
||||
- uses: pnpm/action-setup@v3
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 7
|
||||
version: 10
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
@@ -45,7 +48,7 @@ jobs:
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
- uses: actions/cache@v5
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
@@ -54,7 +57,7 @@ jobs:
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Sync node version and setup cache
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
cache: "pnpm" # Set this to npm, yarn or pnpm.
|
||||
@@ -64,7 +67,7 @@ jobs:
|
||||
run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm.
|
||||
|
||||
- name: Build the app
|
||||
uses: tauri-apps/tauri-action@dev
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -78,3 +81,4 @@ jobs:
|
||||
releaseBody: "See the assets to download and install this version."
|
||||
releaseDraft: true
|
||||
prerelease: false
|
||||
args: ${{ matrix.platform == 'macos-latest' && '--target universal-apple-darwin' || '' }}
|
||||
@@ -0,0 +1,26 @@
|
||||
name: Publish Releases to WinGet
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
jobs:
|
||||
publish-alpha:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.release.tag_name, '-alpha')
|
||||
steps:
|
||||
- uses: vedantmgoyal9/winget-releaser@main
|
||||
with:
|
||||
identifier: prayag17.Blink.Alpha
|
||||
version: ${{ github.event.release.tag_name }}
|
||||
installers-regex: '\.exe$'
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
|
||||
publish-stable:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.release.tag_name, '-alpha')"
|
||||
steps:
|
||||
- uses: vedantmgoyal9/winget-releaser@main
|
||||
with:
|
||||
identifier: prayag17.Blink
|
||||
version: ${{ github.event.release.tag_name }}
|
||||
installers-regex: '\.exe$'
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
@@ -37,4 +37,14 @@ target/
|
||||
**/*.rs.bk
|
||||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
*.pdb
|
||||
|
||||
generateBanner
|
||||
# Million Lint
|
||||
.million
|
||||
|
||||
# TypeScript incremental build cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# local multi-client test profiles
|
||||
.clients/
|
||||
@@ -1 +0,0 @@
|
||||
{"encodings":["src\\main.tsx","ProviderWrapper",[52,0,71,1],[53,39,57,3],[53,8,53,11],[53,13,53,22],[53,24,53,35],[58,34,61,3],[58,8,58,12],[58,14,58,30],[66,2,69,4],"src\\components\\notices\\errorNotice\\errorNotice.tsx","ErrorNotice",[6,27,54,1],[6,28,6,56],[9,2,52,8],[20,3,31,9],[32,3,34,16],[35,3,51,16],"src\\utils\\store\\api.tsx","ApiProvider",[50,27,67,1],[50,28,50,65],[51,17,65,2],[66,8,66,75],"useApiInContext",[69,7,75,1],[70,15,70,37],[74,8,74,57],"src\\utils\\store\\central.tsx","CentralProvider",[48,31,71,1],[48,32,48,69],[49,17,67,2],[69,2,69,77],"useCentralStore",[73,7,79,1],[74,15,74,41],[78,8,78,57],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[88,0,918,1],[89,13,89,42],[90,21,90,32],[90,9,90,16],[91,39,91,54],[92,16,92,48],[94,14,94,51],[106,5,116,3],[97,2,97,16],[98,2,98,6],[99,2,99,10],[100,2,100,14],[101,2,101,15],[102,2,102,14],[103,2,103,13],[104,2,104,15],[105,2,105,11],[117,40,120,3],[117,8,117,29],[117,31,117,36],[122,31,122,45],[123,41,125,2],[127,51,127,66],[130,31,130,46],[131,31,131,45],[132,35,132,50],[133,45,133,68],[134,33,134,56],[135,43,135,58],[137,29,137,40],[138,27,138,42],[140,1,140,41],[142,41,142,72],[219,24,257,7],[259,1,267,21],[267,5,267,19],[269,1,287,7],[289,1,292,15],[292,5,292,13],[294,41,311,62],[311,5,311,31],[311,33,311,60],[313,1,334,3],[331,2,331,28],[332,2,332,29],[333,2,333,37],[336,29,344,15],[344,5,344,13],[346,24,364,25],[364,5,364,13],[364,15,364,23],[366,25,370,15],[370,5,370,13],[372,49,372,64],[373,27,375,7],[376,1,376,56],[376,46,376,54],[378,22,384,21],[384,5,384,19],[464,5,481,11],[465,6,474,8],[475,6,477,19],[478,6,480,19],[485,4,499,10],[486,5,495,7],[496,5,498,18],[504,4,511,10],[505,5,507,18],[508,5,510,18],[515,3,519,9],[516,4,518,17],[523,51,523,66],[524,1,530,13],[530,5,530,11],[542,2,916,8],[543,3,566,21],[545,5,564,18],[563,6,563,52],[568,4,582,13],[585,4,585,55],[587,3,605,21],[589,5,603,18],[595,6,597,12],[598,6,602,8],[606,3,883,16],[642,4,696,10],[643,5,645,18],[644,6,644,66],[646,5,648,18],[647,6,647,64],[649,5,695,12],[670,6,694,18],[686,7,688,18],[690,8,692,19],[698,5,881,11],[699,6,706,19],[702,8,704,21],[707,6,880,12],[708,7,763,13],[709,8,756,10],[757,8,762,14],[758,9,760,22],[761,9,761,62],[764,7,879,13],[765,8,800,14],[766,9,766,31],[767,9,777,22],[774,10,776,17],[778,9,782,22],[779,10,781,17],[783,9,793,22],[790,10,792,17],[794,9,794,27],[795,9,799,22],[801,8,878,14],[802,9,840,22],[824,10,826,23],[827,10,839,12],[841,9,854,22],[847,10,853,17],[855,9,855,24],[856,9,865,22],[860,10,864,17],[866,9,877,22],[874,10,876,17],[884,3,915,5],"sliderDisplayFormat",[386,29,521,2],"src\\routes\\_api\\home\\index.tsx","Home",[40,0,400,1],[41,13,41,42],[42,14,42,51],[44,19,54,3],[56,21,80,3],[82,26,96,3],[98,26,111,3],[113,21,130,3],[132,47,134,6],[136,18,136,31],[138,21,138,59],[140,24,142,2],[144,1,157,26],[157,5,157,24],[161,3,397,10],[168,4,208,20],[170,6,170,26],[173,7,205,9],[210,4,245,20],[212,6,214,12],[213,7,213,51],[218,6,218,23],[220,6,243,21],[224,10,240,12],[246,4,301,20],[248,6,250,12],[249,7,249,52],[254,6,254,23],[258,6,299,21],[261,9,296,11],[302,4,354,20],[304,6,306,12],[305,7,305,59],[310,6,310,23],[315,6,352,21],[318,9,349,11],[355,4,385,20],[357,6,359,12],[358,7,358,59],[363,6,363,23],[368,6,383,21],[371,9,380,11],[386,4,396,20],[388,6,390,12],[389,7,389,62],[394,13,394,69],"src\\routes\\_api\\search\\index.jsx","SearchPage",[32,0,386,1],[33,13,33,36],[35,18,35,31],[36,19,36,36],[36,9,36,14],[38,37,38,49],[41,14,41,51],[45,16,58,3],[59,16,72,3],[73,20,86,3],[87,15,100,3],[101,14,114,3],[115,22,128,3],[129,16,140,3],[141,18,153,3],[155,23,155,71],[155,8,155,19],[157,1,160,7],[162,2,384,8],[172,3,203,9],[173,4,194,6],[195,4,202,10],[201,5,201,61],[204,3,358,9],[210,5,229,20],[212,7,227,9],[232,5,257,20],[234,7,255,9],[260,5,274,20],[263,8,271,10],[277,5,290,20],[279,7,288,9],[293,5,307,20],[295,7,305,9],[310,5,324,20],[312,7,322,9],[327,5,340,20],[329,7,338,9],[343,5,356,20],[345,7,354,9],[375,5,381,11],[380,6,380,68],[383,3,383,13],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[21,0,297,1],[22,13,22,36],[23,23,23,71],[23,8,23,19],[25,14,25,51],[27,16,38,3],[40,16,51,3],[53,20,64,3],[66,15,77,3],[79,14,90,3],[92,22,103,3],[105,16,116,3],[118,1,120,3],[123,2,295,9],[134,4,153,19],[136,6,151,8],[156,4,181,19],[158,6,179,8],[184,4,203,19],[186,6,201,8],[206,4,226,19],[208,6,224,8],[229,4,249,19],[231,6,247,8],[252,4,271,19],[254,6,269,8],[274,4,293,19],[276,6,291,8],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,206,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[31,9,31,24],[33,19,33,54],[35,21,35,37],[37,17,40,3],[42,23,45,3],[47,28,65,3],[90,1,92,7],[95,2,204,8],[96,3,96,21],[97,3,117,9],[106,4,108,17],[109,4,116,17],[115,5,115,56],[118,3,203,11],[121,6,201,12],[122,7,124,13],[125,7,173,13],[126,8,154,21],[136,10,152,12],[138,12,144,25],[155,8,163,21],[164,8,172,21],[174,7,200,13],[175,8,186,21],[185,9,185,62],[187,8,199,21],[198,9,198,71],"src\\routes\\setup\\server.add.tsx","ServerSetup",Line truncated
|
||||
@@ -1,3 +1,79 @@
|
||||
- # Alpha 3 (11/12/2024)
|
||||
- refactor: prepare for alpha 3
|
||||
- refactor: cleanup
|
||||
- refactor: remove unused imports
|
||||
- fix: series page not fetching correct season
|
||||
- feat: add key binding for macos users #435
|
||||
- refactor: remove jellyPlayer naming from code #460
|
||||
- feat: add playlist playback support
|
||||
- refactor: improve server add process
|
||||
- feat: show current time while scrubbing video progress #339
|
||||
- style: increase the sharpness of card images
|
||||
- feat: add skip recap button
|
||||
- refactor: cleanup video player
|
||||
- feat: add chapter navigation buttons to video player #457
|
||||
- feat: allow changing audio track from video player
|
||||
- feat: allow changing chapters from a chapter list #457
|
||||
- refactor: cleanup search route
|
||||
- refactor: cleanup some components
|
||||
- refactor: unmount card image if not inView
|
||||
- refactor: cleanup person route
|
||||
- style: replace noto-sans with plus-jakarta-sans
|
||||
- refactor: cleanup login routes
|
||||
- fix: library items not of same size #380
|
||||
- refactor: cleanup item.tsx
|
||||
- fix: series page breaking if season is not loaded
|
||||
- fix: do not display missing items in series
|
||||
- refactor: move more files to ts
|
||||
- refactor: move more files to ts
|
||||
- refactor: move more files to ts
|
||||
- refactor: move more files to typescript
|
||||
- refactor: move more components to ts
|
||||
- refactore: cleanup __root.tsx
|
||||
- chore(deps): update dependencies
|
||||
- fix: collections page not rendering #447
|
||||
- fix: quick connect not working #445
|
||||
- fix: playback error if subtitle is not set
|
||||
- fix: index not being assigned proper value #420
|
||||
- fix: synced lyrics not working
|
||||
- Merge pull request #446 from prayag17/renovate/node-22.x-lockfile
|
||||
- refactor: use saved lyrics
|
||||
- refactor: change GenreView to genreFilter
|
||||
- fix(deps): update dependency @types/node to v22.10.1
|
||||
- Merge pull request #393 from prayag17/renovate/tanstack-router-monorepo
|
||||
- Merge pull request #424 from prayag17/renovate/tanstack-query-monorepo
|
||||
- fix(deps): update tanstack-router monorepo
|
||||
- Merge pull request #426 from prayag17/renovate/node-22.x-lockfile
|
||||
- fix(deps): update dependency @types/node to v22.10.0
|
||||
- Merge pull request #437 from prayag17/dependabot/cargo/src-tauri/rustls-0.23.18
|
||||
- fix(deps): update tanstack-query monorepo to v5.61.4
|
||||
- Merge pull request #438 from prayag17/renovate/axios-1.x-lockfile
|
||||
- Merge pull request #439 from prayag17/renovate/vitejs-plugin-react-4.x-lockfile
|
||||
- chore(deps): update dependency @vitejs/plugin-react to v4.3.4
|
||||
- refactore: move more components to typescript
|
||||
- fix: episode and series not playing if episode is not present in nextUp and continueWatching
|
||||
- feat: show current episode in PlayButton
|
||||
- fix: episode indexing for absolute numbering indexNumbers in PlayButton
|
||||
- fix: unable to read Id of undefined in PlayButton
|
||||
- fix(deps): update dependency axios to v1.7.8
|
||||
- chore(deps): bump rustls from 0.23.16 to 0.23.18 in /src-tauri
|
||||
- fix(ci): not uploading debug builds
|
||||
- refactor(ci): build debug builds in CI
|
||||
- Merge pull request #425 from prayag17/renovate/serde_json-1.x-lockfile
|
||||
- Merge pull request #436 from sambartik/macos-universal-dmg
|
||||
- chore(deps): update dependencies
|
||||
- refactor: convert more files to typescript
|
||||
- fix: improper handling of undefined api leading to crashes
|
||||
- refactor: move all buttons to tsx #338
|
||||
- Add universal dmg for macOS in release job
|
||||
- fix: audio queue not moving after 2 changes #182
|
||||
- fix: playing track from album not updating the queue #182
|
||||
- refactor: use MediaSegments api for intro/outro skipping
|
||||
- fix: trickplay images not showing up
|
||||
- refactor: improve login page UI #338 #202
|
||||
- chore(release): update latest.json
|
||||
- fix(deps): update rust crate serde_json to v1.0.133
|
||||
|
||||
- # 0.0.7-dev (20/11/2024)
|
||||
- chore(deps): update dependencies
|
||||
- refactor: change UI of login/list and fix Api not being defined in context
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||

|
||||
<div align="center">
|
||||
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/prayag17/JellyPlayer?sort=date&display_name=tag&style=for-the-badge&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iODc4IiBoZWlnaHQ9IjEwMTIiIHZpZXdCb3g9IjAgMCA4NzggMTAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00MzguODA5IDUwNkwzNS40MDQ4IDczOC45MDZMNDM4LjgwOSA5NzEuODEyTDg0Mi4yMTQgNzM4LjkwNlYyNzMuMDk0TDQzOC44MDkgNDAuMTg4NUwzNS40MDQ4IDI3My4wOTRMNDM4LjgwOSA1MDZaTTQzOC44MDkgMEw4NzcuMDE4IDI1M1Y3NTlMNDM4LjgwOSAxMDEyTDAuNjAwNTg2IDc1OVY3MTguODEyVjI5My4xODhWMjUzTDQzOC44MDkgMFoiIGZpbGw9IndoaXRlIi8%2BCjwvc3ZnPgo%3D&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%2FJellyPlayer%2Freleases%2Flatest">
|
||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/prayag17/JellyPlayer?style=for-the-badge&logo=github&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%2FJellyPlayer%2Fstargazers">
|
||||
<img alt="GitHub License" src="https://img.shields.io/github/license/prayag17/JellyPlayer?style=for-the-badge&labelColor=000">
|
||||
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/prayag17/JellyPlayer/continuous-integration.yml?style=for-the-badge&logo=github&label=CI&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%2FJellyPlayer%2Factions%2Fworkflows%2Fcontinuous-integration.yml">
|
||||
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/prayag17/Blink?sort=date&display_name=tag&style=for-the-badge&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iODc4IiBoZWlnaHQ9IjEwMTIiIHZpZXdCb3g9IjAgMCA4NzggMTAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00MzguODA5IDUwNkwzNS40MDQ4IDczOC45MDZMNDM4LjgwOSA5NzEuODEyTDg0Mi4yMTQgNzM4LjkwNlYyNzMuMDk0TDQzOC44MDkgNDAuMTg4NUwzNS40MDQ4IDI3My4wOTRMNDM4LjgwOSA1MDZaTTQzOC44MDkgMEw4NzcuMDE4IDI1M1Y3NTlMNDM4LjgwOSAxMDEyTDAuNjAwNTg2IDc1OVY3MTguODEyVjI5My4xODhWMjUzTDQzOC44MDkgMFoiIGZpbGw9IndoaXRlIi8%2BCjwvc3ZnPgo%3D&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%Blink%2Freleases%2Flatest">
|
||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/prayag17/Blink?style=for-the-badge&logo=github&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%Blink%2Fstargazers">
|
||||
<img alt="GitHub License" src="https://img.shields.io/github/license/prayag17/Blink?style=for-the-badge&labelColor=000">
|
||||
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/prayag17/Blink/continuous-integration.yml?style=for-the-badge&logo=github&label=CI&labelColor=000&link=https%3A%2F%2Fgithub.com%2Fprayag17%Blink%2Factions%2Fworkflows%2Fcontinuous-integration.yml">
|
||||
</div>
|
||||
|
||||
###
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
## 📝 Prerequisites
|
||||
|
||||
- Nodejs (≥19.1.0)
|
||||
- Rust (≥1.76.0)
|
||||
- Nodejs (22.14.0)
|
||||
- Rust (>=1.85.0)
|
||||
- Visual Studio C++ Build tools
|
||||
- [pnpm](https://pnpm.io/)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
pnpm run tauri build
|
||||
```
|
||||
|
||||
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json)
|
||||
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/Blink/blob/main/package.json)
|
||||
|
||||
## 💻 Contribution
|
||||
|
||||
@@ -60,21 +60,25 @@
|
||||
- Sort/Filter library items
|
||||
- Queue playback support
|
||||
- Intro Skip button using [jumoog/Intro-Skipper](https://github.com/jumoog/intro-skipper) plugin
|
||||
- Mediasegment support
|
||||
|
||||
## 📷 Screenshots
|
||||
|
||||
- Home
|
||||

|
||||
- Title Page - Movie
|
||||

|
||||
- Title Page - Show
|
||||

|
||||
- Episode List
|
||||

|
||||
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212208" src="https://github.com/user-attachments/assets/036c2339-e8f1-4c8d-a908-af0ece9bb1f3" />
|
||||
- Library
|
||||
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212723" src="https://github.com/user-attachments/assets/6520a325-3cf3-47a0-9056-b27aded4bb8c" />
|
||||
- Music Player Detailed
|
||||
<img width="2560" height="1600" alt="Screenshot 2026-02-10 213017" src="https://github.com/user-attachments/assets/00a89efa-0a4c-4272-868e-f52c9fcfeaac" />
|
||||
- Item Page
|
||||
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212653" src="https://github.com/user-attachments/assets/5d281f8c-48ba-4787-b8ca-a4b86ccab5c1" />
|
||||
- Album / Music Player
|
||||
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212949" src="https://github.com/user-attachments/assets/d99aaea5-e242-4b3d-a5c5-d2868313728b" />
|
||||
- Search Dialog
|
||||
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212749" src="https://github.com/user-attachments/assets/4ad87072-86ad-4510-95a4-567d6d11e997" />
|
||||
- Video Player
|
||||

|
||||
- About Dialog
|
||||

|
||||
<img width="2560" height="1600" alt="Screenshot 2026-02-10 213049" src="https://github.com/user-attachments/assets/effcca22-3650-46e1-9a86-b3b434851f2f" />
|
||||
|
||||
|
||||
## 📃 Roadmap
|
||||
|
||||
@@ -86,3 +90,4 @@
|
||||
- [@ferferga](https://github.com/ferferga) for helping in development behind the scenes.
|
||||
- All contributors of [jellyfin/jellyfin-vue](https://github.com/jellyfin/jellyfin-vue).
|
||||
- And also [@jellyfin](https://github.com/jellyfin/) for creating the main service
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
|
||||
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"style": {
|
||||
"noNonNullAssertion": "off",
|
||||
"useEnumInitializers": "off"
|
||||
"useEnumInitializers": "off",
|
||||
"noParameterAssign": "error",
|
||||
"useAsConstAssertion": "error",
|
||||
"useDefaultParameterLast": "error",
|
||||
"useSelfClosingElements": "error",
|
||||
"useSingleVarDeclarator": "error",
|
||||
"noUnusedTemplateLiteral": "error",
|
||||
"useNumberNamespace": "error",
|
||||
"noInferrableTypes": "error",
|
||||
"noUselessElse": "error"
|
||||
},
|
||||
"a11y": {
|
||||
"useKeyWithClickEvents": "off",
|
||||
"useMediaCaption": "off"
|
||||
"useMediaCaption": "off",
|
||||
"noStaticElementInteractions": "off"
|
||||
},
|
||||
"correctness": {
|
||||
"useExhaustiveDependencies": "off",
|
||||
@@ -21,17 +29,18 @@
|
||||
},
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off"
|
||||
}
|
||||
},
|
||||
"nursery": {}
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.jsx",
|
||||
"src/**/*.js",
|
||||
"*.json",
|
||||
"*.scss"
|
||||
"includes": [
|
||||
"**/src/**/*.ts",
|
||||
"**/src/**/*.tsx",
|
||||
"**/src/**/*.jsx",
|
||||
"**/src/**/*.js",
|
||||
"**/*.json",
|
||||
"**/*.scss"
|
||||
],
|
||||
"ignoreUnknown": true
|
||||
},
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
# Blink Remote Control + SyncPlay Plan
|
||||
|
||||
## Goal
|
||||
|
||||
логин root пароль 12345
|
||||
сервер https://jel.midns.ru
|
||||
|
||||
Make remote control and SyncPlay predictable for Blink clients only:
|
||||
|
||||
- Remote control lists only `Client = Blink` sessions, with readable device names.
|
||||
- Quick transfer of the current media to any selected Blink device.
|
||||
- Media takeover cards for taking playback from another Blink device.
|
||||
- SyncPlay groups are Blink groups; add an auto-group for all running Blink clients.
|
||||
- Keep group playback as close to frame-accurate as the Jellyfin SyncPlay protocol allows.
|
||||
- Redesign all remote/session cards with a glass surface, clear hierarchy and motion.
|
||||
|
||||
## Constraints
|
||||
|
||||
- Do not expose non-Blink Jellyfin sessions in remote control or SyncPlay UI.
|
||||
- Do not rely on `GroupInfoDto.Participants` for device names: the server stores
|
||||
distinct user names there, not device names or sessions.
|
||||
- Device identity must be stable per installation and readable by humans.
|
||||
- Multi-client testing should use the same Jellyfin user, like a household setup.
|
||||
|
||||
## Workstreams
|
||||
|
||||
### 1. Blink identity and shared session utilities
|
||||
|
||||
- Add a device identity helper: stable id, readable name
|
||||
(`Blink · Windows · 4F2A`), optional local override.
|
||||
- Set `deviceInfo.name` from that helper so Jellyfin reports a useful
|
||||
`DeviceName` for every Blink client.
|
||||
- Add a local "device name" field in Settings → Preferences.
|
||||
- Add shared helpers:
|
||||
- `isBlinkSession`
|
||||
- `getBlinkSessions(sessions, { userId, selfDeviceId })`
|
||||
- `getBlinkDeviceName`
|
||||
- `getBlinkDeviceKind`
|
||||
- Blink group marker/prefix and predicate.
|
||||
|
||||
### 2. Remote control: Blink only + quick transfer
|
||||
|
||||
- Shared `useBlinkSessions` hook: realtime WebSocket snapshot first, API poll as
|
||||
fallback. Filters by `Client=Blink`, same user, excludes the local device.
|
||||
- Use the shared filter in:
|
||||
- titlebar cast dialog
|
||||
- remote page
|
||||
- audio player device menu / remote bar
|
||||
- FollowMe takeover prompt
|
||||
- legacy playback sync
|
||||
- `CastButton` without explicit media uses the current local media
|
||||
(video/audio item, queue, position, paused state).
|
||||
- Redesign the cast dialog:
|
||||
- "Сейчас играет" media preview.
|
||||
- Blink device cards.
|
||||
- One-click "Отправить сюда".
|
||||
- "Забрать сюда" when the target is playing.
|
||||
- "Открыть пульт" for full control.
|
||||
|
||||
### 3. Remote page: full control
|
||||
|
||||
- Blink-only device list with proper names.
|
||||
- Glass session cards: device, status, now playing, progress.
|
||||
- Add actions missing today:
|
||||
- take remote playback here
|
||||
- send current local media to the selected device
|
||||
- stop remote playback
|
||||
- audio track selection (alongside subtitles)
|
||||
- volume/mute, seek, play/pause, next/prev, fullscreen
|
||||
- open SyncPlay group controls from the remote page
|
||||
- Motion: card lift, progress animation, active-device glow.
|
||||
|
||||
### 4. SyncPlay: Blink groups + auto-group
|
||||
|
||||
- Group name prefix `Blink ·`; only prefixed groups are listed and joinable.
|
||||
- Create groups with the prefix hidden from the visible name.
|
||||
- Auto-group:
|
||||
- name `Blink · Автогруппа`
|
||||
- host can create/join with one click
|
||||
- other Blink clients auto-join when the setting is enabled (default on)
|
||||
- host can optionally share the current queue at the same time
|
||||
- SyncPlay dialog shows online Blink devices by name and uses Blink-only
|
||||
groups.
|
||||
- `GroupInfoDto.Participants` is shown as users, never as devices.
|
||||
- Avoid the old "participants <= 1 => force resume" shortcut when other Blink
|
||||
devices are online; let the server's group-wait complete.
|
||||
|
||||
### 5. Maximum SyncPlay synchronization
|
||||
|
||||
- Measure real ping (EMA of SyncPlay ping round-trip) instead of a fixed 50 ms.
|
||||
- Only report `Ready` once local playback is actually ready (video ready and not
|
||||
buffering; audio element has enough data).
|
||||
- Reduce drift tolerance to the server's practical sync window (~500 ms) and
|
||||
keep seek throttling.
|
||||
- Keep assistant controllers: pings every 3 s, ready retry only while waiting.
|
||||
- Do not auto-resume a group before other online Blink clients are ready.
|
||||
|
||||
### 6. Glass takeover cards + animations
|
||||
|
||||
- Shared `SessionCard` component for remote dialog, remote page and device
|
||||
lists.
|
||||
- Glass surface: translucent gradient, 1 px highlight border, blur, depth
|
||||
shadow, poster-driven accent.
|
||||
- States: selected, playing, paused, idle, unsupported.
|
||||
- Motion: entrance stagger, hover lift, press scale, progress transition,
|
||||
active pulse.
|
||||
- FollowMe takeover prompt uses the same glass language.
|
||||
|
||||
### 7. Testing with 2-3 clients
|
||||
|
||||
- Launch the current dev build as 2 extra WebView2 profiles, each with its own
|
||||
localStorage device id; share the same Jellyfin user/token.
|
||||
- Verify:
|
||||
1. all three appear as `Client=Blink` with distinct readable names
|
||||
2. remote dialog lists only Blink devices
|
||||
3. screenshot/internal API check of the glass cards
|
||||
4. send current media from client 1 to client 2; verify client 2 starts at
|
||||
the same position and client 1 stops
|
||||
5. take media back to client 1; verify client 2 stops
|
||||
6. create auto-group from client 1; clients 2/3 join automatically
|
||||
7. share queue; all three play the same item; compare positions/drift
|
||||
8. pause/resume/seek from client 1; verify clients 2/3 follow
|
||||
9. verify non-Blink sessions/groups are not shown
|
||||
- Record results in the final report.
|
||||
|
||||
## Definition of done
|
||||
|
||||
- `tsc --noEmit` and `pnpm build` pass.
|
||||
- No non-Blink session or group appears in remote/SyncPlay UI.
|
||||
- Three-device test passes for transfer, takeover, auto-group and
|
||||
pause/resume/seek synchronization.
|
||||
- Final short report with issue count and serious fixes.
|
||||
|
||||
## Verification results (2026-12-02)
|
||||
|
||||
Stand: three Blink clients on one Windows machine (`2346`, `5A33`, `1959`),
|
||||
one Jellyfin user, dev build, server `https://jel.midns.ru`.
|
||||
|
||||
| Scenario | Result |
|
||||
| --- | --- |
|
||||
| Blink-only filters and names | Jellyfin Web / other sessions never shown; devices appear as `Blink · Windows · XXXX` |
|
||||
| Send current media to another client | Target starts at the same position with the shared queue; source stops |
|
||||
| Take playback back | Target stops, initiator resumes at the transferred position |
|
||||
| Auto-group with all three clients | Clients join in 1–3 s; no 30 s `Waiting` timeout |
|
||||
| Group queue start | `Playing` within ~1 s, positions 0.00/0.00/0.00 (spread ≤ 0.02 s) |
|
||||
| Pause | `Paused` within ~1 s, all at the same position (spread 0.00 s) |
|
||||
| Resume | Server schedules the unpause by ping (≈2 s in this setup), spread 0.01 s |
|
||||
| Seek to 05:00 | `Waiting → Playing`, final spread 0.02–0.03 s at 306.3 s |
|
||||
| Non-Blink groups | Not listed, not joinable |
|
||||
|
||||
### Serious fixes found by the three-client test
|
||||
|
||||
1. **Buffer end was reported as another Buffer request.** The Jellyfin server
|
||||
treats any Buffer request as “this session is buffering”, so every client
|
||||
that finished buffering was marked buffering again. Buffer end now sends
|
||||
`Ready`, as jellyfin-web does.
|
||||
2. **Parking tolerance was 30 ms instead of 400 ms.** While waiting for a new
|
||||
queue, clients seeked every second against a 30 ms threshold and never sent
|
||||
`Ready`; the group only started via the server’s 30 s timeout. The threshold
|
||||
is now 400 ms, below the server’s 500 ms acceptance window.
|
||||
3. **Paused position was read from a stale store value.** `playerState.currentTime`
|
||||
only updates on `timeupdate`, which can stand still while paused, so seeks
|
||||
looked unapplied. Position now comes from the `<video>` element directly.
|
||||
4. **Seek was extrapolated as if playing.** After a group seek the server stays
|
||||
in `Waiting` at the seek position; the client kept adding elapsed time,
|
||||
making the server chase a moving target. A Seek now freezes the timeline at
|
||||
the target and pauses locally until the group unpause.
|
||||
5. **State updates resumed/paused clients immediately.** That bypassed the
|
||||
server’s scheduled `When`, so each client started at a different instant.
|
||||
Only Pause/Unpause/Seek commands drive playback now; the state update is
|
||||
informational.
|
||||
6. **Local parking echoed Pause/Seek/Buffer requests.** Pausing a client to
|
||||
park it looked like a user request and flipped the group to `Paused` or
|
||||
restarted the wait. Parking is guarded, and pause/resume/seek/buffer reports
|
||||
are suppressed while the group is parking.
|
||||
7. **Readiness waited for `HAVE_CURRENT_DATA`/`onReady`.** A player parked
|
||||
before its first frame could stay at metadata only, so it never reported
|
||||
ready and the group waited 30 s. Readiness now accepts loaded metadata
|
||||
(`readyState >= 1`), which is enough to start in sync.
|
||||
8. **Command timeline.** Pause/Unpause/Seek positions are now anchored to the
|
||||
server’s `When` + `PositionTicks` and reset on every play-queue update,
|
||||
instead of extrapolating from a stale queue snapshot.
|
||||
9. **Auto-group start window.** Auto-join polling is 2 s and, when other Blink
|
||||
devices are online, sharing the queue waits 2.2 s so they join before the
|
||||
first unpause instead of joining mid-playback.
|
||||
|
||||
`pnpm exec tsc --noEmit` and `pnpm build` pass after these changes.
|
||||
|
||||
## Audio, transfers and group edge cases (2026-12-02, follow-up)
|
||||
|
||||
### Additional fixes
|
||||
|
||||
1. **Audio playback was invisible to Jellyfin.** The `<audio>` element played
|
||||
locally but never sent `reportPlaybackStart/Progress/Stopped`. As a result
|
||||
`/Sessions` stayed empty, so audio could not be cast, taken over, followed or
|
||||
synchronised. Audio now reports start, progress (10 s), pause and stop; the
|
||||
session shows the track and position like a video.
|
||||
2. **A group was moving unrelated local music.** Group `Seek`/`Pause`/`Unpause`
|
||||
commands and drift correction were applied to whatever media the client was
|
||||
playing. Starting music while a group video was running made the server seek
|
||||
the track to the video position: the song jumped to its end, ended and
|
||||
restarted every couple of seconds. Commands now only touch the group's
|
||||
current item; other local media is ignored.
|
||||
3. **Starting media echoed a Pause into the group.** Pausing the old video when
|
||||
music starts looked like a user Pause request. A short media-switch guard
|
||||
suppresses Pause/Seek/Buffer reports while audio and video swap.
|
||||
4. **A client playing local media held the whole group.** Such a client is now
|
||||
marked with `IgnoreWait` on the server, and the mark is cleared when it
|
||||
returns to the group item. The group no longer waits 30 s for a member that
|
||||
deliberately switched to music; its own playback is unaffected.
|
||||
5. **Transfers stopped the source before the target had started.** `playOnSession`
|
||||
now waits until the target session reports the requested item (up to two
|
||||
attempts), then corrects its position. If the target never starts, the
|
||||
mutation fails and the source keeps playing instead of stopping everywhere.
|
||||
6. **Audio transfers always looked unsuccessful.** Because audio was never
|
||||
reported, the source could not verify the target. With audio reporting the
|
||||
same confirmation works for music and video.
|
||||
7. **Follow-me card was hidden by an idle audio player.** It used to hide
|
||||
whenever the audio bar had an item, even when paused. It now hides only while
|
||||
audio is actually playing, so “Продолжить здесь” appears over an open but
|
||||
idle audio player.
|
||||
8. **Audio/video mixing.** Starting one medium stops the other; the group item
|
||||
guard prevents cross-media seeks; media-switch guards prevent old-player
|
||||
events from being sent as group commands.
|
||||
9. **Two-second loop at the start of a group video.** Late auto-joins each put
|
||||
the group back into Waiting and re-parked everyone at the first seconds.
|
||||
Auto-join polls every 1 s, the host waits 3 s before sharing the queue when
|
||||
other Blink clients are online, and the old “solo force resume” was removed.
|
||||
Three clients now start together in about 1 s with no loop.
|
||||
10. **Back from the player.** The group is not left. The player exit no longer
|
||||
reports a Pause, and after ~3 s without local media the client is marked
|
||||
`IgnoreWait`, so the group keeps playing while the user browses.
|
||||
11. **Audio autoplay overrode SyncPlay parking.** The `<audio autoPlay>` element
|
||||
started even when the group had parked it, so clients played ~3 s and the
|
||||
server then seeked everyone back to 0. The element no longer autoplays:
|
||||
playback follows the shared store flag, and parking pauses it before the
|
||||
element even mounts.
|
||||
|
||||
### Follow-up verification
|
||||
|
||||
| Scenario | Result |
|
||||
| --- | --- |
|
||||
| Audio session visibility | `/Sessions` shows the track, type Audio, live position |
|
||||
| Audio send, one client to another | Target starts at the transferred position; source stops only after confirmation |
|
||||
| Follow-me with the audio player open | Card appears over the paused/ended audio player; takeover works for audio and video |
|
||||
| Music during a group video | Group stays Playing; music advances 31→35 s while video 5→10 s |
|
||||
| Group pause while one client plays music | State `Paused` in 1 s; video pauses, music keeps playing |
|
||||
| Music vs. group seek | Group seek to 05:00 does not move the music (33→44 s) |
|
||||
| Three-client group start | `Playing` in ~1 s, positions identical, no 2 s loop |
|
||||
| Group audio start | Parks at 0, no 3 s restart; pause 8.6/8.7/8.6 → resume 9.8/9.8/9.8 |
|
||||
| Group audio seek to 01:00 | All at 60–61 s, then advance together, no end loop |
|
||||
| Back from the group player | Group remains; other clients continue; Pause reaches `Paused` in 1 s with the browsing client ignored |
|
||||
| `tsc --noEmit` / `pnpm build` | Pass |
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,605 @@
|
||||
# Интеграция qBittorrent в Blink — план
|
||||
|
||||
> Статус: **реализовано** (Rust-клиент, страница «Загрузки», настройки).
|
||||
> Проверено на qBittorrent 5.3.0 / WebAPI 2.16.2; совместимость с 4.x
|
||||
> заложена в клиент, но на живой 4.x не прогонялась.
|
||||
|
||||
## 0. Заметки по реализации
|
||||
|
||||
- qBittorrent 5.x принимает параметр `stopped` при добавлении раздачи, 4.x —
|
||||
`paused`. Клиент отправляет оба: каждая версия читает свой и игнорирует
|
||||
чужой.
|
||||
- `sync/maindata` **не повторяет `hash` внутри объекта торрента** — хеш является
|
||||
ключом словаря. Без подстановки ключа строки получали пустой hash, ломая
|
||||
действия; в `QbTorrentRaw::from_value` хеш берётся из ключа.
|
||||
- Для API-ключа заголовок `Authorization: Bearer …` нужно добавлять и к
|
||||
multipart-запросу `torrents/add`; без него qB отвечает `403` (при этом
|
||||
обычные GET/POST-формы работают).
|
||||
- Секрет хранится в системном keyring (`blink-qbittorrent` / `default`) либо
|
||||
только в памяти до закрытия приложения; в `qbittorrent.json` его нет.
|
||||
|
||||
## 1. Цель и рамки
|
||||
|
||||
Добавить в Blink страницу загрузок qBittorrent:
|
||||
|
||||
1. Добавление раздачи по **magnet-ссылке**.
|
||||
2. Добавление **.torrent файла**.
|
||||
3. Выбор **категории** qBittorrent (у категории может быть своя папка).
|
||||
4. Список позиций со **статусом скачивания**: прогресс, скорость, ETA, состояние,
|
||||
категория, размер; действия пауза/продолжить/удалить.
|
||||
5. Настройки подключения к qBittorrent и проверка соединения.
|
||||
|
||||
Вне рамок этого этапа: поиск раздач, RSS, автозагрузка, интеграция с
|
||||
Radarr/Sonarr/Seerr, несколько qB-серверов одновременно, поддержка Usenet.
|
||||
|
||||
## 2. Пользовательские сценарии
|
||||
|
||||
### 2.1. Добавить магнит
|
||||
|
||||
1. «Загрузки» → кнопка «Добавить» (или «+» в шапке страницы).
|
||||
2. Вкладка «Магнит»: вставить `magnet:?xt=urn:btih:…`.
|
||||
3. Категория выбирается из списка, полученного из qB; рядом показывается
|
||||
`savePath` категории (или «папка по умолчанию»).
|
||||
4. «Добавить» → тост «Раздача добавлена» → строка сразу появляется в списке
|
||||
со статусом «Получение метаданных» / «В очереди».
|
||||
5. Если qB вернул дубликат — сообщение «Такая раздача уже есть».
|
||||
|
||||
### 2.2. Добавить .torrent
|
||||
|
||||
1. Вкладка «Файл»: выбор файла через диалог Tauri (`.torrent`).
|
||||
2. Тот же выбор категории и кнопка «Добавить».
|
||||
3. Файл отправляется в qB как multipart (`torrents`).
|
||||
|
||||
### 2.3. Статус загрузки
|
||||
|
||||
Список обновляется опросом `/sync/maindata`:
|
||||
имя, категория, размер, прогресс (%, полоса), скорость ↓/↑, ETA, состояние.
|
||||
|
||||
Состояния в UI:
|
||||
|
||||
| Состояние qB | Подпись в Blink |
|
||||
| --- | --- |
|
||||
| `metaDL` | Получение метаданных |
|
||||
| `queuedDL`, `queuedUP` | В очереди |
|
||||
| `downloading`, `forcedDL`, `stalledDL` | Скачивается |
|
||||
| `checkingDL`, `checkingUP`, `checkingResumeData` | Проверка |
|
||||
| `moving` | Перемещение |
|
||||
| `uploading`, `forcedUP`, `stalledUP` | Раздаётся |
|
||||
| `pausedDL`, `stoppedDL` | Пауза |
|
||||
| `pausedUP`, `stoppedUP` | Завершено |
|
||||
| `error`, `missingFiles` | Ошибка |
|
||||
| `unknown` | Неизвестно |
|
||||
|
||||
«Добавленные из Blink» помечаются локально: хеши, полученные при добавлении,
|
||||
хранятся в store; фильтр «Все / Добавленные из Blink».
|
||||
|
||||
### 2.4. Настройки
|
||||
|
||||
Новый раздел «Настройки → Загрузки» (или отдельная страница настроек
|
||||
интеграции):
|
||||
|
||||
| Поле | Обязательное | Описание |
|
||||
| --- | --- | --- |
|
||||
| Адрес WebUI | да | `http://192.168.1.10:8080` — без `/api/v2` |
|
||||
| Способ входа | да | «Логин и пароль» / «API-ключ» (qB 5.3+, WebAPI 2.17+) |
|
||||
| Логин | для пароля | пользователь WebUI |
|
||||
| Пароль | для пароля | системное хранилище секретов (см. 4.2) или ввод при запуске |
|
||||
| API-ключ | для ключа | там же |
|
||||
| Разрешить самоподписанный TLS | нет | только для HTTPS, с предупреждением |
|
||||
| Категория по умолчанию | нет | подставляется в диалоге |
|
||||
| Добавлять на паузе | нет | параметр `paused` |
|
||||
| Автоуправление (autoTMM) | нет | параметр `autoTMM`; по умолчанию `true`, чтобы работала папка категории |
|
||||
| Обновлять Jellyfin после завершения | нет | `POST /Library/Refresh` |
|
||||
| Интервал опроса | нет | по умолчанию 2000 мс, минимум 1000 |
|
||||
|
||||
Кнопка «Проверить соединение»: логин → `/app/version` → `/app/webapiVersion` →
|
||||
`/app/defaultSavePath`; показывает версию qB и WebAPI.
|
||||
|
||||
## 3. qBittorrent WebUI API
|
||||
|
||||
База: `{baseUrl}/api/v2`. Все методы — `GET` или `POST`; мутации только `POST`.
|
||||
Авторизация — cookie-сессия (логин/пароль) или API-ключ.
|
||||
|
||||
### 3.1. Версии и совместимость
|
||||
|
||||
| qBittorrent | WebAPI | Особенности |
|
||||
| --- | --- | --- |
|
||||
| 4.1–4.6 | 2.0–2.8 | базовые методы; логин `200` при успехе и неудаче (тело `Ok.` / `Fails.`) |
|
||||
| 5.0–5.2 | 2.9–2.14 | cookie может называться `QBT_SID_<port>`; `torrents/add` в 2.14+ отвечает JSON |
|
||||
| 5.2+ | 2.14+ | логин `204`/`401`; `torrents/add`: `200`, `202` (есть pending), `409` (ничего не добавлено) |
|
||||
| 5.3+ | 2.17+ | API-ключ (`Authorization: Bearer …` / `X-API-Key`); `torrents/add` без `skip_checking` с 2.16 |
|
||||
|
||||
Минимальная поддерживаемая версия — **qBittorrent 4.1 / WebAPI 2.0**.
|
||||
Версию определять через `/app/webapiVersion` при проверке соединения.
|
||||
|
||||
### 3.2. Авторизация
|
||||
|
||||
`POST /api/v2/auth/login`
|
||||
|
||||
| Параметр | Тип | Описание |
|
||||
| --- | --- | --- |
|
||||
| `username` | string | логин WebUI |
|
||||
| `password` | string | пароль WebUI |
|
||||
|
||||
Заголовки:
|
||||
|
||||
- `Referer: {baseUrl}` и `Origin: {baseUrl}` обязательны — иначе qB отклоняет
|
||||
запрос. Хост и порт должны совпадать с `Host`.
|
||||
- `Content-Type: application/x-www-form-urlencoded`.
|
||||
|
||||
Ответы:
|
||||
|
||||
| Код | Значение |
|
||||
| --- | --- |
|
||||
| `200` | до 5.2: успех/неудача в теле (`Ok.` / `Fails.`) |
|
||||
| `204` | 5.2+: успех, тела нет |
|
||||
| `401` | 5.2+: неверные учётные данные |
|
||||
| `403` | IP забанен после N неудачных попыток |
|
||||
|
||||
Cookie: имя брать из `Set-Cookie` (`SID` или `QBT_SID_<port>`), не хардкодить.
|
||||
Сессия живёт `web_ui_session_timeout` (по умолчанию 3600 с); при `401/403`
|
||||
нужно один раз повторить логин и запрос.
|
||||
|
||||
API-ключ (WebAPI 2.17+): заголовок `Authorization: Bearer <key>`; логин не
|
||||
нужен. В настройках qB ключ создаётся в «WebUI → API».
|
||||
|
||||
`POST /api/v2/auth/logout` — завершение сессии (использовать при смене
|
||||
настроек/выходе).
|
||||
|
||||
### 3.3. Служебные методы
|
||||
|
||||
| Метод | Параметры | Ответ |
|
||||
| --- | --- | --- |
|
||||
| `GET /app/version` | — | строка, например `v5.0.3` |
|
||||
| `GET /app/webapiVersion` | — | строка, например `2.11` |
|
||||
| `GET /app/defaultSavePath` | — | путь по умолчанию |
|
||||
| `GET /app/preferences` | — | объект; нужны `save_path`, `auto_tmm_enabled` |
|
||||
| `POST /app/setPreferences` | `json` | не используется в этом этапе |
|
||||
|
||||
### 3.4. Категории
|
||||
|
||||
| Метод | Параметры | Ответ |
|
||||
| --- | --- | --- |
|
||||
| `GET /torrents/categories` | — | объект `{ "movies": { "name": "movies", "savePath": "D:/Media/Movies", "downloadPath": … } }` |
|
||||
| `POST /torrents/createCategory` | `category`, `savePath` | `200` / `409` (уже есть) |
|
||||
| `POST /torrents/editCategory` | `category`, `savePath` | `200` |
|
||||
| `POST /torrents/removeCategories` | `categories` (по `\n`) | `200` |
|
||||
|
||||
`savePath` может быть пустым — тогда используется общий путь qB.
|
||||
`downloadPath` в ответе может быть `null`.
|
||||
|
||||
В UI: выпадающий список из `GET /torrents/categories` + пункт «Без категории».
|
||||
Под списком — подсказка с `savePath` выбранной категории. Создание категории
|
||||
из Blink — опционально (фаза 4), с полем пути.
|
||||
|
||||
### 3.5. Добавление раздачи
|
||||
|
||||
`POST /api/v2/torrents/add` — **multipart/form-data** (обязательно; для магнита
|
||||
тоже можно multipart с полем `urls`).
|
||||
|
||||
| Поле | Тип | Обязательное | Описание |
|
||||
| --- | --- | --- | --- |
|
||||
| `urls` | string | да для магнита | ссылки через `\n` (`magnet:`, `http(s)://…`) |
|
||||
| `torrents` | file | да для файла | содержимое `.torrent`; поле можно повторять |
|
||||
| `savepath` | string | нет | папка; при `autoTMM=true` игнорируется/переопределяется категорией |
|
||||
| `category` | string | нет | имя категории |
|
||||
| `tags` | string | нет | теги через запятую |
|
||||
| `paused` | bool | нет | добавить на паузе |
|
||||
| `autoTMM` | bool | нет | автоуправление категорией |
|
||||
| `sequentialDownload` | bool | нет | последовательная загрузка |
|
||||
| `firstLastPiecePrio` | bool | нет | приоритет первых/последних кусков |
|
||||
| `skip_checking` | bool | нет | **удалён в WebAPI 2.16**; не отправлять при новых версиях |
|
||||
| `root_folder` | bool | нет | создавать корневую папку |
|
||||
| `rename` | string | нет | переименовать раздачу |
|
||||
| `upLimit`, `dlLimit` | int | нет | лимиты, байт/с |
|
||||
| `ratioLimit`, `seedingTimeLimit` | float/int | нет | лимиты раздачи |
|
||||
|
||||
Ответы:
|
||||
|
||||
| Код | Значение |
|
||||
| --- | --- |
|
||||
| `200` | успех (до 5.2 — все сценарии, тело `Ok.` / `Fails.`) |
|
||||
| `202` | 5.2+: часть добавлена, часть в обработке (`pending_count > 0`) |
|
||||
| `409` | 5.2+: ничего не добавлено (дубликаты/ошибки) |
|
||||
| `415` | `.torrent` невалиден |
|
||||
|
||||
С WebAPI 2.14 тело ответа — JSON:
|
||||
`{ "success_count": 1, "pending_count": 0, "failure_count": 0, "added_torrent_ids": ["…"] }`.
|
||||
Для старых версий тело — текст; дубликат определяется по `Fails.` и/или
|
||||
сравнением списка торрентов после добавления.
|
||||
|
||||
### 3.6. Список и прогресс
|
||||
|
||||
`GET /api/v2/torrents/info` — полный снимок.
|
||||
|
||||
Параметры: `filter` (`all`, `downloading`, `seeding`, `completed`, `stopped`,
|
||||
`active`, `inactive`, `running`, `stalled`, `errored`), `category`, `tag`,
|
||||
`sort`, `reverse`, `limit`, `offset`, `hashes` (через `|`).
|
||||
|
||||
Поля, которые нужны UI:
|
||||
|
||||
| Поле | Назначение |
|
||||
| --- | --- |
|
||||
| `hash` | ключ строки |
|
||||
| `name` | название |
|
||||
| `category` | категория |
|
||||
| `size`, `completed`, `downloaded` | размер и прогресс |
|
||||
| `progress` | 0..1 |
|
||||
| `dlspeed`, `upspeed` | скорости, байт/с |
|
||||
| `eta` | секунды (8640000 = бесконечно) |
|
||||
| `state` | состояние (см. таблицу выше) |
|
||||
| `save_path`, `content_path` | куда скачалось |
|
||||
| `added_on`, `completion_on` | время |
|
||||
| `ratio` | раздача |
|
||||
| `num_seeds`, `num_leechs` | пиры |
|
||||
| `error` | причина ошибки (WebAPI 2.17+) |
|
||||
|
||||
`GET /api/v2/sync/maindata?rid=N` — инкрементально, для опроса:
|
||||
|
||||
| Поле | Значение |
|
||||
| --- | --- |
|
||||
| `rid` | новый идентификатор; передавать в следующий запрос |
|
||||
| `full_update` | `true` — заменить всё локальное состояние |
|
||||
| `torrents` | изменения по хешам (те же поля, что в `torrents/info`) |
|
||||
| `torrents_removed` | массив удалённых хешей |
|
||||
| `categories` | новые/изменённые категории |
|
||||
| `server_state` | общая скорость, свободное место и т.п. |
|
||||
|
||||
Алгоритм: хранить `rid` и `Map<hash, QbTorrent>`; при `full_update` очищать
|
||||
Map; удалять `torrents_removed`; мержить `torrents`.
|
||||
|
||||
### 3.7. Управление
|
||||
|
||||
| Метод | Параметры | Примечание |
|
||||
| --- | --- | --- |
|
||||
| `POST /torrents/pause` | `hashes` (`all` или `a\|b`) | в 5.x остаётся |
|
||||
| `POST /torrents/resume` | `hashes` | |
|
||||
| `POST /torrents/delete` | `hashes`, `deleteFiles=true/false` | удаление с файлами — подтверждение |
|
||||
| `POST /torrents/setCategory` | `hashes`, `category` | смена категории на лету |
|
||||
| `GET /transfer/info` | — | глобальная скорость (для шапки) |
|
||||
|
||||
### 3.8. Ошибки и их разбор
|
||||
|
||||
| Ситуация | Признак | Что показать |
|
||||
| --- | --- | --- |
|
||||
| qB недоступен | connect timeout / connection refused | «qBittorrent недоступен» + адрес |
|
||||
| Неверный логин | `401` / `Fails.` | «Проверьте логин и пароль» |
|
||||
| Бан IP | `403` на логине | «qB заблокировал IP, подождите» |
|
||||
| Нет категории | `409` при createCategory | «Категория уже существует» |
|
||||
| Дубликат | `409` / `Fails.` | «Раздача уже добавлена» |
|
||||
| Битый .torrent | `415` | «Файл не является торрентом» |
|
||||
| Сессия истекла | `403` на обычном запросе | повторный логин один раз |
|
||||
| Self-signed TLS | ошибка сертификата | подсказка включить «Разрешить самоподписанный TLS» |
|
||||
|
||||
## 4. Архитектура в Blink
|
||||
|
||||
### 4.1. Rust-бэкенд (почему не fetch из webview)
|
||||
|
||||
qBittorrent WebUI **не отдаёт CORS-заголовки**, а также требует совпадения
|
||||
`Referer`/`Host`. Поэтому запросы делает Rust через `reqwest` с cookie-jar.
|
||||
Webview вызывает только Tauri-команды.
|
||||
|
||||
Новый модуль: `src-tauri/src/qbittorrent/mod.rs` (+ `client.rs`, `types.rs`,
|
||||
`commands.rs`). Зависимости в `Cargo.toml`:
|
||||
|
||||
- `reqwest` с `cookies`, `json`, `multipart`, `rustls-tls` (без OpenSSL — важно
|
||||
для Linux-пакетов);
|
||||
- `keyring` 3 с платформенными бэкендами (`windows-native`, `apple-native`,
|
||||
`sync-secret-service`);
|
||||
- `thiserror`/`serde` — уже есть в проекте;
|
||||
- `tokio` — уже есть через Tauri.
|
||||
|
||||
Состояние: `QbState { client: Mutex<Option<Client>>, config_hash }` — клиент
|
||||
пересоздаётся при изменении настроек.
|
||||
|
||||
Команды:
|
||||
|
||||
| Команда | Вход | Выход |
|
||||
| --- | --- | --- |
|
||||
| `qb_test_connection` | `{ baseUrl, auth }` | `{ appVersion, apiVersion, defaultSavePath }` |
|
||||
| `qb_categories` | — | `QbCategory[]` |
|
||||
| `qb_create_category` | `{ name, savePath }` | `()` |
|
||||
| `qb_add_magnet` | `{ magnet, category?, paused?, autoTMM? }` | `QbAddResult` |
|
||||
| `qb_add_torrent_file` | `{ fileName, bytesBase64, category?, … }` | `QbAddResult` |
|
||||
| `qb_torrents` | — | `QbTorrent[]` (полный снимок) |
|
||||
| `qb_sync` | `{ rid }` | `QbSyncResponse` (diff) |
|
||||
| `qb_pause` / `qb_resume` | `{ hashes }` | `()` |
|
||||
| `qb_delete` | `{ hashes, deleteFiles }` | `()` |
|
||||
| `qb_set_category` | `{ hashes, category }` | `()` |
|
||||
|
||||
Типы (TS/Rust):
|
||||
|
||||
```ts
|
||||
type QbCategory = { name: string; savePath: string };
|
||||
type QbTorrent = {
|
||||
hash: string; name: string; category: string;
|
||||
size: number; completed: number; progress: number;
|
||||
dlspeed: number; upspeed: number; eta: number;
|
||||
state: string; savePath: string; addedOn: number;
|
||||
ratio: number; numSeeds: number; numLeeches: number;
|
||||
error?: string;
|
||||
};
|
||||
type QbAddResult = {
|
||||
status: "added" | "pending" | "duplicate" | "invalid";
|
||||
addedHashes: string[];
|
||||
message?: string;
|
||||
};
|
||||
```
|
||||
|
||||
Ошибки: единый `QbError { kind: "unreachable" | "auth" | "banned" | "api" |
|
||||
"torrent" | "duplicate" | "tls" | "http"; message: string; status?: number }`.
|
||||
|
||||
Таймауты: connect 5 с, чтение 15 с; добавление файла — 60 с.
|
||||
|
||||
### 4.2. Хранение настроек и секретов (все ОС)
|
||||
|
||||
- Не секреты (`baseUrl`, категория по умолчанию, флаги, таймаут) — через
|
||||
`tauri-plugin-store` (как `.user.dat`), файл `qbittorrent.json` в app-data
|
||||
каталоге ОС (Windows `%APPDATA%`, macOS `~/Library/Application Support`,
|
||||
Linux `~/.local/share`).
|
||||
- Пароль и API-ключ — через `keyring` 3 в системное хранилище:
|
||||
- **Windows** — Credential Manager (DPAPI);
|
||||
- **macOS** — Keychain (при первом обращении система покажет свой запрос —
|
||||
это нормально);
|
||||
- **Linux** — Secret Service через DBus (GNOME Keyring / KWallet).
|
||||
`service = "blink-qbittorrent"`, `user = baseUrl`.
|
||||
- **Linux без Secret Service** (сервер, минимальный дистрибутив, нет
|
||||
keyring-демона): `keyring` вернёт ошибку. Приложение **не** пишет пароль в
|
||||
открытый файл. По умолчанию пароль запрашивается при запуске (session-only).
|
||||
Опционально, с явным предупреждением, — шифрованный vault (age/scrypt) в
|
||||
app-data; решение принять на этапе 1.
|
||||
- В store хранится только флаг «секрет сохранён» и способ входа.
|
||||
- Никогда не логировать пароль, cookie и `Authorization`.
|
||||
|
||||
### 4.3. Фронтенд
|
||||
|
||||
Новые файлы (ориентировочно):
|
||||
|
||||
- `src/routes/_api/downloads.tsx` и `downloads.scss` — страница списка.
|
||||
- `src/components/downloads/addTorrentDialog.tsx` — магнит/файл + категория.
|
||||
- `src/components/downloads/torrentRow.tsx` — строка списка.
|
||||
- `src/components/downloads/downloadsEmpty.tsx`.
|
||||
- `src/utils/store/qbittorrent.ts` — настройки и локальный список добавленных
|
||||
хешей (zustand + tauri store).
|
||||
- `src/utils/queries/qbittorrent.ts` — React Query хуки.
|
||||
- Настройки: секция в `src/routes/_api/settings/preferences.tsx` или отдельный
|
||||
маршрут `settings/downloads.tsx`.
|
||||
|
||||
Доступ к странице: иконка `download` в верхней панели и пункт в боковом меню
|
||||
(рядом с «Пультом»).
|
||||
|
||||
Опрос: React Query с `refetchInterval: 2000`, `refetchIntervalInBackground:
|
||||
false`; внутри — `qb_sync` с `rid`, а не полный `torrents/info`.
|
||||
Мутации инвалидируют запрос и показывают тост.
|
||||
|
||||
### 4.4. Локальная память добавленного
|
||||
|
||||
qB не хранит «кто добавил». Чтобы показать «Добавленные из Blink»:
|
||||
|
||||
- после успешного `qb_add_*` сохранить хеши в store;
|
||||
- для старых qB (без `added_torrent_ids`) — найти торрент по имени/магниту
|
||||
после первого sync и сохранить его хеш;
|
||||
- список хешей чистить при удалении и по кнопке «Забыть».
|
||||
|
||||
Альтернатива (проще): показывать все торренты qB — это и есть «статус каждой
|
||||
добавленной позиции», а фильтр «из Blink» сделать опционально в фазе 5.
|
||||
|
||||
### 4.5. Кроссплатформенность
|
||||
|
||||
Функционал обязан работать на **Windows, macOS и Linux**. qBittorrent при этом
|
||||
может быть установлен на любой ОС и даже на другой машине — Blink общается с
|
||||
ним только по HTTP(S).
|
||||
|
||||
| Слой | Требование |
|
||||
| --- | --- |
|
||||
| HTTP/TLS | `reqwest` + `rustls`, без OpenSSL; поддержка IPv4/IPv6/localhost; флаг «самоподписанный сертификат» |
|
||||
| Секреты | `keyring` (Credential Manager / Keychain / Secret Service); при недоступности — session-only, без plaintext |
|
||||
| Пути | `savePath`/`contentPath` из qB — непрозрачные строки в ОС **сервера qB**; показывать как есть, не склеивать с локальными путями и не проверять их существование |
|
||||
| Файлы | нативный диалог `tauri-plugin-dialog` с фильтром `.torrent`; без shell-команд `open`/`explorer` |
|
||||
| Уведомления | `tauri-plugin-notification`; на macOS запросить разрешение, на Linux — libnotify (если нет — тихо пропустить) |
|
||||
| Заголовок окна | страница использует общий titlebar приложения: macOS — отступ под traffic lights, Windows/Linux — штатные кнопки окна; своих кнопок не рисовать |
|
||||
| Адаптивность | следовать мобильным правилам из `feat(mobile)`: ≤900 px — одна колонка, ≤640 px — компактные строки, крупные touch-цели |
|
||||
| Хранение | `tauri-plugin-store` в app-data каждой ОС; никаких путей, зашитых под Windows |
|
||||
| Сборка | Windows NSIS/MSI, macOS dmg/app (arm64 и x86_64), Linux AppImage/deb; без новых системных зависимостей, кроме Secret Service на Linux |
|
||||
|
||||
Отдельно: категория в qB может иметь путь вида `D:/Media/Movies` (Windows) или
|
||||
`/mnt/media/movies` (Linux) — это путь на машине qB. UI только показывает его
|
||||
и при создании категории подсказывает, что путь вводится для сервера qB.
|
||||
|
||||
## 5. Макеты экранов
|
||||
|
||||
### 5.1. Страница «Загрузки»
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────┐
|
||||
│ Загрузки [Обновить] [+ Добавить] │
|
||||
│ ▼ 12 ГБ/с ▲ 3 ГБ/с Свободно: 120 ГБ │
|
||||
├──────────────────────────────────────────────────────────────┤
|
||||
│ [Все] [Скачиваются] [Завершённые] [Из Blink] │
|
||||
│ │
|
||||
│ 🎬 Interstellar.2014.1080p Скачивается │
|
||||
│ movies · 8.4 ГБ из 14 ГБ · 72% · 6.2 МБ/с · 18 мин │
|
||||
│ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░ [⏸] [🗑] │
|
||||
│ │
|
||||
│ 📺 Series.S01.1080p Завершено │
|
||||
│ series · 22 ГБ · 100% · раздаётся 1.4× [⏸] [🗑] │
|
||||
└──────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 5.2. Диалог «Добавить»
|
||||
|
||||
- Табы: **Магнит** | **Файл**.
|
||||
- Магнит: textarea, вставка из буфера, валидация `magnet:?xt=urn:btih:`.
|
||||
- Файл: кнопка выбора `.torrent`, имя файла, размер.
|
||||
- Категория: select из qB + «Без категории»; подсказка `savePath`.
|
||||
- Дополнительно (свернуть): «на паузе», «autoTMM», «последовательная
|
||||
загрузка».
|
||||
- Кнопки: «Отмена», «Добавить».
|
||||
|
||||
### 5.3. Пустые и ошибочные состояния
|
||||
|
||||
- Не настроено подключение → карточка «Подключите qBittorrent» + кнопка в
|
||||
настройки.
|
||||
- qB недоступен → «qBittorrent не отвечает» + «Повторить».
|
||||
- Нет раздач → «Пока ничего не скачивается» + «Добавить раздачу».
|
||||
|
||||
### 5.4. Адаптивность
|
||||
|
||||
- ≥1200 px: список во всю ширину, панель итогов сверху.
|
||||
- 900–1200 px: те же строки, меньше второстепенных данных (сиды/раздача
|
||||
скрываются в «…»).
|
||||
- ≤900 px: одна колонка, диалог добавления на всю ширину, действия строки —
|
||||
иконки в ряд.
|
||||
- ≤640 px: компактные строки в две линии (имя + состояние; прогресс + размер),
|
||||
крупные touch-цели ≥40 px, фильтры — горизонтальный скролл.
|
||||
- Учитывать titlebar каждой ОС: на macOS — отступ под traffic lights, на
|
||||
Windows/Linux — место под кнопки окна (общий заголовок приложения, не свой).
|
||||
Правила — как в мобильном коммите `2e099ec`.
|
||||
|
||||
## 6. Полинг и производительность
|
||||
|
||||
- Пока страница открыта — `sync/maindata` каждые 2 с; при скрытом окне — стоп.
|
||||
- После действия (добавление/пауза) — внеочередной sync через 300 мс.
|
||||
- Ошибки сети — экспоненциальный backoff до 15 с, без спама тостами.
|
||||
- Полный снимок `torrents/info` — только при первом открытии и `full_update`.
|
||||
- Не держать больше одного запроса в полёте; отменять предыдущий при уходе
|
||||
со страницы.
|
||||
|
||||
## 7. Краевые случаи
|
||||
|
||||
1. **Дубликат**: `409`/`Fails.` → не ошибка, а «Уже добавлено»; подсветить
|
||||
существующую строку.
|
||||
2. **Категория удалена в qB**, пока Blink открыт → при добавлении `409`;
|
||||
обновить категории и предложить другую.
|
||||
3. **Категория без savePath** и `autoTMM=false` → скачается в общий путь;
|
||||
показать предупреждение.
|
||||
4. **magnet без `dn`** — имя появится после метаданных; строка «Получение
|
||||
метаданных».
|
||||
5. **qB 4.x**: нет JSON-ответа на add, cookie `SID`, `skip_checking` допустим.
|
||||
6. **qB 5.2+**: `202` значит «в процессе»; `409` — отказ; `skip_checking`
|
||||
убран с 2.16.
|
||||
7. **HTTPS self-signed**: отдельный флаг «Разрешить самоподписанный TLS»;
|
||||
по умолчанию выключен.
|
||||
8. **Пароль изменён в qB** → `401`; сбросить сессию, показать настройки.
|
||||
9. **Удаление с файлами** — только после подтверждения; по умолчанию
|
||||
`deleteFiles=false`.
|
||||
10. **Большой .torrent** — ограничить 10 МБ, ошибка до отправки.
|
||||
11. **Переименование/перемещение** торрента в qB — статус `moving`;
|
||||
UI не ломается.
|
||||
12. **Остановка qB** — статус «недоступен», список сохраняется до следующего
|
||||
успешного sync.
|
||||
|
||||
## 8. Безопасность
|
||||
|
||||
- Пароль/ключ — только в системном keyring (Windows/macOS/Linux) или
|
||||
session-only; в конфиге и логах их нет, plaintext-файла нет.
|
||||
- qB WebUI не должен быть открыт в интернет; интеграция рассчитана на LAN/VPN.
|
||||
- TLS: предпочтителен `https`; самоподписанный сертификат — осознанный флаг.
|
||||
- В логах — метод, URL без query-секретов, код ответа; без тел с кредами.
|
||||
- Никаких прямых запросов из webview (обходим CORS и Referer-проверку в Rust).
|
||||
- Учётные данные не передаются в Jellyfin и обратно.
|
||||
|
||||
## 9. Jellyfin: обновление библиотеки (опционально)
|
||||
|
||||
После перехода торрента в `pausedUP`/`stoppedUP` (или `progress === 1`):
|
||||
|
||||
- `POST {jellyfin}/Library/Refresh` с токеном текущего пользователя
|
||||
(`Authorization: MediaBrowser Token="…"`);
|
||||
- только если пользователь админ (иначе `403`) — показать подсказку;
|
||||
- дебаунс: не чаще одного раза в 30 с;
|
||||
- альтернатива без кода: qB «Run external program on torrent finished» с
|
||||
`curl` на Jellyfin — описать в документации.
|
||||
|
||||
## 10. Тестирование
|
||||
|
||||
### Rust
|
||||
|
||||
- Юнит-тесты клиента на mock-сервере (`wiremock`): логин, категории, add
|
||||
(магнит и файл), 202/409/415, sync-diff, истёкшая сессия.
|
||||
- Тест сборки multipart для файла.
|
||||
- Тест парсинга состояний и ETA.
|
||||
|
||||
### UI
|
||||
|
||||
- Пустое состояние, ошибка подключения, успешное добавление, дубликат.
|
||||
- Список: скачивание, пауза, завершение, ошибка, удаление.
|
||||
- Смена категории и удаление с файлами (подтверждение).
|
||||
- Опрос останавливается при скрытом окне.
|
||||
|
||||
### Ручной чек-лист
|
||||
|
||||
- qB 4.6 и qB 5.x (если доступны);
|
||||
- магнит и .torrent;
|
||||
- категория с путём и без;
|
||||
- неверный пароль, остановленный qB, self-signed HTTPS;
|
||||
- перезапуск Blink при активной загрузке.
|
||||
|
||||
### Кроссплатформенная матрица
|
||||
|
||||
| Проверка | Windows 10/11 | macOS (arm64) | Linux (AppImage/deb) |
|
||||
| --- | --- | --- | --- |
|
||||
| Логин и категории | + | + | + |
|
||||
| Добавление магнита | + | + | + |
|
||||
| Добавление `.torrent` через диалог | + | + | + |
|
||||
| Список, прогресс, действия | + | + | + |
|
||||
| Сохранение пароля в keyring | Credential Manager | Keychain | Secret Service |
|
||||
| Работа без keyring (Linux) | — | — | пароль спрашивается при запуске |
|
||||
| Self-signed HTTPS | + | + | + |
|
||||
| Уведомление о завершении | + | + (разрешение) | + (libnotify) |
|
||||
| Мобильная ширина окна | + | + | + |
|
||||
|
||||
Проверять минимум одну сборку на каждой ОС; Linux — GNOME и KDE (Secret
|
||||
Service), а также окружение без keyring-демона.
|
||||
|
||||
## 11. Этапы
|
||||
|
||||
| Этап | Что входит | Результат |
|
||||
| --- | --- | --- |
|
||||
| 1. Rust-клиент | login, версия, категории, тест соединения, ошибки | настройки сохраняются, «Проверить» работает |
|
||||
| 2. Добавление магнита | диалог, категории, `torrents/add`, тосты | магнит добавляется, дубликат обрабатывается |
|
||||
| 3. Список и статус | страница, sync-поллинг, строки, действия | прогресс/скорость/ETA по каждой позиции |
|
||||
| 4. Файл и опции | `.torrent` через диалог, пауза/autoTMM/sequential, создание категории | полный сценарий из ТЗ |
|
||||
| 5. Полировка | уведомления о завершении, Jellyfin refresh, фильтр «из Blink» | готово к использованию |
|
||||
| 6. Тесты | mock-сервер, ручной чек-лист, совместимость | приёмка |
|
||||
|
||||
Оценка после получения нового кода: этап 1 — 0.5–1 день (включая keyring на
|
||||
трёх ОС и fallback), этап 2 — 1 день, этап 3 — 1–1.5 дня, этап 4 — 0.5–1 день,
|
||||
этап 5–6 — 1–1.5 дня (сборка и проверка на Windows/macOS/Linux). Итого ~5–6
|
||||
рабочих дней без учёта незнакомых изменений в новом коде.
|
||||
|
||||
## 12. Критерии приёмки
|
||||
|
||||
1. Магнит добавляется в qB с выбранной категорией; категория видна в qB.
|
||||
2. `.torrent` добавляется тем же способом.
|
||||
3. Дубликат не создаёт вторую раздачу и понятно объясняется.
|
||||
4. На странице загрузок у каждой позиции есть имя, категория, размер,
|
||||
прогресс, скорость, ETA и состояние.
|
||||
5. Пауза/продолжить/удаление работают и отражаются в qB.
|
||||
6. Ошибки qB (недоступен, неверный пароль, бан) показываются человеческим
|
||||
текстом.
|
||||
7. Пароль не хранится в открытом виде.
|
||||
8. Опрос не нагружает qB при скрытом окне.
|
||||
9. Работает на Windows, macOS и Linux; на Linux без keyring-демона пароль
|
||||
запрашивается при запуске, plaintext-файла не появляется.
|
||||
10. Страница корректна на мобильной ширине и не конфликтует с кнопками окна
|
||||
каждой ОС.
|
||||
|
||||
## 13. Открытые вопросы
|
||||
|
||||
- Показывать все торренты qB или только добавленные из Blink? (план:
|
||||
все + фильтр).
|
||||
- Нужны ли уведомления о завершении в системный трей?
|
||||
- Нужен ли автозапуск Jellyfin-скана или достаточно real-time monitoring?
|
||||
- Создавать категории из Blink или только выбирать существующие?
|
||||
- Поддержка API-ключа qB 5.3+ — включать сразу или во втором релизе?
|
||||
- Linux без Secret Service: session-only по умолчанию (план) или шифрованный
|
||||
vault с паролем-мастером?
|
||||
|
||||
## 14. Ссылки
|
||||
|
||||
- [qBittorrent WebUI API 4.1](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1))
|
||||
- [qBittorrent WebUI API 5.0](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-5.0))
|
||||
- [WebAPI changelog](https://github.com/qbittorrent/qBittorrent/blob/master/WebAPI_Changelog.md)
|
||||
- [qBittorrent: Run external program](https://github.com/qbittorrent/qBittorrent/wiki/How-to-use-the-external-program-feature)
|
||||
- [Tauri store plugin](https://v2.tauri.app/plugin/store/)
|
||||
- [Tauri dialog plugin](https://v2.tauri.app/plugin/dialog/)
|
||||
@@ -1,60 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="ru">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script src="http://localhost:8097"></script>
|
||||
<title>Jellyplayer</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<!-- <script src="http://localhost:8097"></script> -->
|
||||
<title>Blink</title>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
background: #08001f;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.app-loading {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
width: 10em;
|
||||
height: 10em;
|
||||
background: rgb(180 180 180);
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 100000;
|
||||
mask-image: url("./src/assets/icon-outline.png");
|
||||
mask-size: contain;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.app-loading.hidden {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
|
||||
.app-loading-anim{
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: linear-gradient(to right,transparent,rgb(255 255 255),transparent);
|
||||
transform: scaleX(0);
|
||||
animation: loading 0.75s linear infinite both;
|
||||
transform-origin: left;
|
||||
.app-loading-logo {
|
||||
display: block;
|
||||
width: min(230px, 62vw);
|
||||
height: auto;
|
||||
filter: drop-shadow(0 10px 30px rgb(0 0 0 / 0.35));
|
||||
animation: splashPulse 1.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
0%{
|
||||
transform: translate(-100%);
|
||||
@keyframes splashPulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50%{
|
||||
transform: translate(0%);
|
||||
50% {
|
||||
opacity: 0.62;
|
||||
}
|
||||
100%{
|
||||
transform: translate(100%);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.app-loading-logo {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="app-loading">
|
||||
<!-- <img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> -->
|
||||
<div class="app-loading-anim"></div>
|
||||
<div class="app-loading" role="status" aria-label="Загрузка Blink">
|
||||
<img
|
||||
class="app-loading-logo"
|
||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX8AAACqCAYAAABFwE9PAAAAAXNSR0IArs4c6QAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAABf6ADAAQAAAABAAAAqgAAAAAX35FHAAA3E0lEQVR4Ae2dB/wcRfn/CSGEGgi9hNB7b9IhQAhFQHqTjhRFQRB/gAiIggIK/hWkozQhRIr03nsvIiWUQCD03kNJ/u9PuPt6ue/e3c7sM3u7d/O8Xs/3dmdnPk+Z2Wdnp+y3zySRGnpg/Pjxfbk4KzwQnq7C/fn9HP64wh/y+2afPn3G8RspeiB6IHqgFB7oUwotc1KSYD8Fos6BB8FzwXPCegC0orFkeBEeCT9fw8/xUHiD80jRA9ED0QOF8kBXBX+C+0J4fw14PlgBfnJYPXcF/QHwyvAcsCW9ANgN8I3wbTwMPrEEj1jRA9ED0QM+Hujo4E+w74dT1oO3rfzO7uMkwzJfg3UfrAfBCB4EekuIlMID1KXaKi6Lw2sp3BWzlNgDtHV1SteE1RmdDdbQ85Swhprfgx+Ab+ZeeJPfSFUP4LhJ4SHw6fC7cFFpHIpdDevhFKnGA/hkefhgeAT8CPwO/C38MjxPTdZ4GD3QMR6gbU8GHwZ/ArcixY/jYHVwu5twwvfgE+ExcNnovyi8NzxVt9Yitg+CFfBvhptRfAB0ayPpYLtp8Oq0XtWs4Te4diXpaeYlO8t7GD0APgB+Hu4Eeg8j9oQ7ejiuvhVi7+rw23Baig+AeifG81J7gIZ/fNrGn5Dv9FIb76o8DvgZrGDZiXQHRi3s6pMy5sfOGWCXwF+tbz0A5i6jzVHn6IFaD9CO14Y1jJOFtqrF7NhjPKTecafTlxh4BKzJn44l7MvS43mB8lqOGyl6oJQeoP1OA6sjk5XeAsBp/H/SUnpskkkGl1RvF7W1mewo+FEqtZN7uKu7OKUu7/yc34J/tBoiUvRAGT1wJEpb3N+zgLOMiwPKGvy1VLJbaHEM1TDQPB1qsOzLQhoe0yTxTFlAYtnogbw9QJtdApk/N5S7ggtWWYP/3Rj5uouhJc+rnoEeANqc1jFUsUeb67KSbqIzs4LE8tEDOXvgb8ibzFDmNy5YpQz+bG4Yj5FXuBjaAXk11HU7AVNDHZ1CQwwN2QzfrGuIF6GiB4J5gLaqjadrGgt4zgWvlMG/YuBx/L7rYmwH5NX3hvQAmL4DbJEJGxjbsb8xXoSLHjD3APevdusebwysXv9TLpilDf70/l/BUH03p9toEAYfUXajuQG0MmGYsR0a/okUPVB0DxyEgnqTt6QriYnvuwCWejMRAWQMxlp/iM3Ff+3Kq28ELUllO73mtUvZJLnU3VDSb0q6liFNw4FT4ZcvM2DEotEDwTxAu9fS5JGw9W7+YbR7p/uptD1/nKghkG4M/GqY6jWfqIMS02aBdNcDIFL0QFE98AcUsw78GgG52dXg0gZ/DF3f1dgOy78RD8ANy2gTeqvdbRFA99fo/YwNgBshowcye4B2vzwgO2YG6g3wO9q9c6enzMF/694+6LqUY0pq8WroPXsA3dUDihQ9UFQPnIBi1kPtj4F5vo/BlmtMfeR7leEJqt1seS3rew1Z+n62+GH4LVgTK+JxsHaXKpCJF4KHwFrCNQAOTcvii8E89UeHFmSMH+rBHYO/cUVFOBsPcJ9uCtJaNmgToRzk0+ufCKFMJzjyIDgkvQ/4ybBe05yJcn1hfWL6LPgrOCTt7axgGwvgiD7wa4Ec8n9tNC2Kjh5I9ABtXd/pfyZAm78mUWCnJuJABY+RARwpyG/gk2CzdfRgzVXBDPUQKNVmN3yxGhyKNu/Udh/tKq8HaOz7BGjw+udGi5XXKx6aY/A6ARxZhdzBQ6VURRCwPpzmP/RUdUn7+ykZS/PlT3T9S1rDHPPpK6h5DLWlqu+YKXpAHqBN6qudbzq25TTZR3Sdh/HKFWk845HHa9LEpQLQaXlYn161Jq2ZLzxhtP5b0evWxlfwLiu8A6KCXecB2uZvArX35bI6s1SrfXDi/Bi8cVajG5S/vkG6WTITM48ApiWO35qBfgc0xBgvFJz0DLHKR/oO159I0QNF8QDxSotBfhFAn5uIJY9mxS1V8MfYn8GhdH4yqzPTlKfS7iGf9RLNsmx22z6Njzzy6BtPpZr78LAxFimfB45E5WkCqK3/89E9xFNUY2cfwSFIkyf98/ImsjT7/x9DQ67KS3dfOdjaD9YqqhB0rK9esVz0QAgP0MgXhL8O0Ngvt9I3VC/aSr9anF04CTWh9yI98rG1wkIeI+sb8G80lDGzIVYoKO3IHhgAXHstTguAGyGjB7J4QG/31vuovgLz4CxK1Za1Vq4W2+yYp6d2xf3UDLA30Dm9k4Kn3G8ooQzBP9SQz7U8TF/29SVtSw+kTWHNJ+l+GA0/A99TeUhzGCl6IL0HaFMrknvr9CVS5zyONjkyde5OyIgzh8KhSMsvZ8jbT8hcwdCgj/PW30UedmrITktSQ5DXSicU6Q8fCzfS6x2unQ7P62JrzBs9QJu5FbYm7W3KbWi6MLWI0aGWd6qCNImcOyF3Twk3pMI2DGzcxdDOWqgnfCsOkHNqgZoca//A7+EQE3e+6sdyBfUA7UT7eUJQXp+zKY5n8eK8sCZkQ5D+L25b5j2Qe6GxQbMVp9Ym1gQ7Q/SE5D7NAzkT5bZQYUfS/oSdnYXFAl3jAdqHvj7wiGO7SpP9oq5xYq2heOaPabzjkWcMZdoSMJE7PfyZh87NirTFltq6SjpG4cHwuGaKe17T94H6JclslkaZaeE3PGWq2GHN8OO17vUAbWOrDO2qUVENS+ofwJhTW3q9aa3AaP3Tgz3S5nfM92cmT950LGOVfTeALP+hw0fg6WujRaSdUEoT9tb0/6i/rz1A96NMlgfl0bTLUG3Sw5xYpAgeoE30RY+jA+jye9r5mAC4xYbEodbj4kBOII3jzt0O65HbD35xghZ2f25phy1pZGLic3Zm9iB9yJHzsl/KqNf/Xg+K/4E+ALhJGvtjnu7wAO1hd//m1LDkK1yZIpQHC93zx+hQk7FH8TR9JZRTW+D+iOvztcjjevkh1wJ55Kfhrowc/Y8DazqV+vNZ4aT2ZLGyS728M7BPv5G63AO0Ay220G5ea/oV7fxLa9DC4+HQtWBrGg3glXBbHnrInQoO8WGzrYpYodh6CmxNemtzHrahjFWvv9Yer2WmRayrqJO/B2gQ+9U2CqPjB8EJMVzaY2hbgmCP9OYHIXr92lm7A09T7QptBx2AUOsPm30B5s3tMKaZTBquekPbNcvjee1c6s9nrsaq11+r9g61J/G4+zxAO9ewzCEBLD+Kdj4+AG6xIXHoXLDGVa3p1HZZjiFzw9YrfOSfv7fLpmZy0SvEyge1iQWayU26RpkQvX5gx8d/G5nk8C5Kow3sr4ZgTC+BF7xjHlyAZzv4CeWsx1P1XYzjPPWxKPYXQCxX+FR1Oq16ULDfEGvi/0VvyCfghuj1y92DuEmDvpoXrE6jOjUeoO7V6zf71k4N9MG083aNTtSokfOhHAq/C1vTCTmb0iMOQza2NqaC90iPkAIdoNsscIgvGi7taiZ6hOr1V6pgwjfbXdWK+TvAAzSAEGP9ub3JF7Hnrw+AzWjcNt4G77fGmKngaCAa+1avPwQVtdevsfDJjA3WB9ye8MAM1euvqmKxeqiKFX9L4gHua/3r1F8aq7srbXx3Y8zywOHUx2Br2q1dHsCQg62NqeDpw2NTt8uuZnLR69EANq/ZTGbSNXQI3euXmdYT+EmmxLSCeYB630uVb0jayWs91F0wrzVRB+NXN3RmFeoRDtoyLovcWeGPq4oY/+7fxJVtu4SNSxrbKbgHfQyi3DEBdKmF1GcrrN9wfEyNZXL0AHWujZqjYEsy+yctaV1RtGGfEN/s/wWvUu1aMvV7KmLatJXhkG8Uedu2cqmFnru2uO5z+U+uhbgr16JMiMm4WlWeoW1p+XCk7vKAFjPMY2zyxcZ45YHjZp0d/sryUQrWte3yALKXg0N9jbSQ68uxd3L4bdiStOzN6XWY/DPC+vBbaDq8Xe0rym2PB2hQk8HWn2d5C0zNIeRKRer5743lzl9pbOGto1tcD3KZipwS4PPgEP59FNyLgiieHVT/Ecv6v4rpA27fOqqmJb1BvoRYp8fwuvN42vke0MbF+YzNPJs2rqXo3UcES42hWX/24LZ2eRJbzoRD0dB22dVKLgZfb2y0/uG786Q2ZZ4w1iMJrpDfU2pVR/F6Ng/QEPTZBUvS6MDc2bTyKx2iZ+qjyZYUsl41cayPIlnLUJHbgvGjrDgNyl9ND6Fwn3KQrtg9mJ/1Gujtm3wa9n7mUVibb0LT+aEFRPxieYA2vgoarWis1XW08VeMMVPBFSX4W0/0Pof1N6bygGEmGodeB88whKyF+oiTfWoTCnas5bSW7UmvwSd52vi+Z7m0xZ4kY1En3NPaEPO5eyDECrvT3dWwKWF5s3ppRMBchoKreRVuXOhknqbjG1+2v4Id+r68lmvpNwQdiE2F/KcO2K52tLux0Rdg7xuemArOoUire7QZx+cfyYTSKeIG9gBtXHNIGqGwpFcBa9uilLYHf4y37vV/Aua5ljXUCouGoZn6y+ClWuX1vH4DwSa3bd8eOmq4R8M+VjQOoCzfYbrPSpEEnGOoi8cS0mNSZ3tA3xuz3tNxFm3JdTFDZ3iZoDkQ/hy2pFDDLolOR3H90+YLLA2ow9ImsbkShRckEf0urdM562mmNc8Inwb+JKsSCeUfJ816RVpBajGq0cgD1Lm+N6Yd9Zakb1/N0UhmHunt7vnvgZFaFmlJZ1uCpcD6A3l+mCKfb5aD6B3o9bCQRAOeDcU2MVbu+Cx4+OtTyl+YBSOh7Aek7Qh2HO5JcE6HJ+2AfTMZ2ziCtvS6MWY54Agak8LWmyWeytN69N8XDklX5WmPjyLine truncated
|
||||
alt="Blink"
|
||||
width="383"
|
||||
height="170"
|
||||
/>
|
||||
</div>
|
||||
<div id="root"></div>
|
||||
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"version": "0.0.6-dev",
|
||||
"notes": "- feat: add video player slider bubble theming #337\n- feat: add trickplay support #338 #337\n- fix(ci): update env variables\n- fix(ci): fix ubuntu build failing\n- chore(deps): update js and rust deps\n- feat: add chapter markers #337\n- feat: add subtitle support #337\n- fix(ci): invalid tauri build command\n- fix(ci):workflow repo name\n- feat: remember last search query\n- feat: add new audioPlayer route and allow reordering queue\n- chore(deps): update deps\n- chore(deps): cleanup unused dependencies and update dependencies\n- refactor: replace wavesurfer with html audio player\n- feat: add new album page\n- fix: quick connect not working\n- chore: change tauri updater signing keys\n- feat: show upNext card for episode items in player\n- fix: login page not working\n- Merge pull request #332 from pypp/feat/double-click-fullscreen\n- Merge pull request #333 from pypp/feat/scrollwheel-volume-control\n- fix: removed subtitleRenderer state that was added while merging\n- fix: fixed bug caused by merge econflicts\n- Merge remote-tracking branch 'upstream/main' into feat/scrollwheel-volume-control\n- fix: fixed fucntion to use the new API\n- Merge remote-tracking branch 'upstream/main' into feat/double-click-fullscreen\n- Merge branch 'main' of https://github.com/pypp/JellyPlayer into feat/double-click-fullscreen\n- fix(deps): update dependency babel-plugin-react-compiler to v0.0.0\n- fix(deps): update tauri monorepo\n- chore(deps): update dependencies\n- feat: allow toggling subtitles on and off from player\n- fix: playNext and playPrevious logic\n- feat: add intro-skipper\n- refactor: cleanup unused variables in playbackStore\n- chore(deps): update packages\n- refactor: support vtt and ass subtitles\n- refactor: add sorting options to library page for Series and BoxSets\n- style: update hero-carousel styling\n- chore(deps): update deps\n- fix(deps): update dependency framer-motion to v11.2.9\n- refactor: move most routing logic to tanstack\n- refactor: implement new login logic and verify context.api status\n- chore(deps): update dependencies\n- refactor: move to tanstack router\n- fix: videoPlayer not restoring playback position when queueItem is updated\n- fix: Slight UI regression when changing servers on latest version #288\n- fix: eac3 codec support\n- refactor: queueItem playback\n- fix(deps): update rust crate tauri to 1.6.2 (#298)\n- fix: episode playback\n- feat: add queueButton\n- Merge branch 'main' of https://github.com/prayag17/JellyPlayer\n- chore(deps): fix vite 5.2 bundle\n- fix(deps): update dependency @types/react to v18.3.1 (#295)\n- fix: scrollTrigger in libraryView\n- style: improve styling\n- fix: backdrop flashing\n- feat: use tanstack virtual for rendering library items\n- style: improve login notice ui\n- refactor: fetch mediaSource for series\n- refactor: implement new playback method for playbutton (wip)\n- ui: improve glass texture\n- ui: implement new appBar #284\n- feat: display sdr and hdr only videoRange\n- style: improve hdr10 logo spacing\n- chore: update title-movie screenshot in README.md\n- chore: update title-movie.png\n- fix: hdr10 icon height not matching\n- style: update mediainfo icons\n- style: update mediainfo icons\n- fix: no subtitle option not selecting\n- feat: use brand logo for hdr10plus\n- fix: default subtitle not being selected properly\n- style: display backdrops in boxset\n- fix: videoPlayer not exiting if subtitles are disabled\n- chore: add kitsu icon to iconLink\n- fix: carousel not rendering\n- chore: update readme\n- chore: update screenshots\n- fix: improve hdr10+ detection\n- feat: add quality and audio brand labels\n- style: improve page-margin\n- fix(player): unable to play media without subtitles\n- fix: album not displaying if no parent backdrop is found\n- chore: add screenshots and some features of JellyPlayer #242\n- chore: upload screenshots\n- fix(nsis): nsis setup images not displaying correctly\n- style: Improve titlePage styling\n- style: change cardText styling\n- style: Improve overall app component paddings and margins and rollback vite to 5.1.6\n- chore(deps): update dependency vite to v5.2.6 (#286)\n- fix(deps): update material-ui monorepo (#270)\n- fix(deps): update dependency @types/node to v20.11.29 (#292)\n- fix(deps): update dependency @types/react to v18.2.67 (#293)\n- fix(deps): update tanstack-query monorepo to v5.28.6 (#271)\n- fix(deps): update dependency @types/react to v18.2.67 (#272)\n- fix(deps): update dependency @types/node to v20.11.29 (#274)\n- fix(deps): update dependency framer-motion to v11.0.15 (#278)\n- fix(deps): update dependency typescript to v5.4.3 (#287)\n- fix(deps): update dependency material-symbols to v0.17.1 (#289)\n- chore(deps): update dependency @biomejs/biome to v1.6.2 (#290)\n- fix(deps): update rust crate log to ^0.4.21 (#276)\n- chore: update latest.json",
|
||||
"pub_date": "2024-09-06T20:40:35.324Z",
|
||||
"version": "0.0.7-dev",
|
||||
"notes": "\n- chore(deps): update dependencies\n- refactor: change UI of login/list and fix Api not being defined in context\n- fix: player/audio route not able to interact with audioPlayer\n- fix: audio player info not visible\n- fix: audio player not playing audio\n- fix: toggling ssubtitles not working\n- fix: subtitles not being rendered #401\n- fix: hero carousel indicators not scrolling\n- fix: vite build error for safari13\n- fix: blink not launching or rendering on opening\n- Merge branch 'main' of https://github.com/prayag17/JellyPlayer\n- chore(deps): update dependencies\n- Merge pull request #410 from prayag17/renovate/tauri-plugin-notification-2.x-lockfile\n- Merge pull request #409 from Blackspirits/patch-1\n- chore(deps): update dependencies\n- fix(deps): update rust crate tauri-plugin-notification to v2.0.1\n- feat: allow downloading images from ImageViewer\n- Update index.tsx\n- feat: implement basic image viewer #338 #240\n- fix: react infinite depth error\n- fix: vite config\n- refactor: remove @million/js and @million/lint\n- refactor: remove Cargo.lock from .gitignore #400\n- chore(deps): update dependencies\n- refactor: code cleanup\n- fix: bug_report showing extra fields\n- refactor: remove redundant calls for getCurrentUser\n- feat: show queue item from currently playing item in queueButton\n- chore(deps): update dependencies\n- feat: remember library filters #192\n- Merge pull request #370 from prayag17/renovate/tauri-apps-plugin-clipboard-manager-2.x\n- fix(deps): update dependency @tauri-apps/plugin-clipboard-manager to v2.1.0-beta.6\n- Merge pull request #381 from prayag17/renovate/wavesurfer.js-7.x-lockfile\n- Merge pull request #342 from prayag17/renovate/tanstack-router-monorepo\n- Merge pull request #368 from prayag17/renovate/tauri-monorepo\n- chore(release): update latest.json",
|
||||
"pub_date": "2024-11-20T07:04:53.965Z",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1VsZ01leXRhMXFrek9ENWZCWHZPR3Y1Ky9SZ3BOc2hEeFlMU0pVR1gzL1NNdytOL1hGTzU5enpZNVRlY01JaDNjaTN3azdDMU9BcVVUWEg5RzdOY1FvPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU0NzUzCWZpbGU6QmxpbmsuYXBwLnRhci5negphcUh0QXFNUnBEWUFGZGU3V0pzQXN5eXhzSmNOdzNoSDFLV3BlbHNGKzFvWXpJR0V4UmJoYTNNV0tZZ0VKcHdDbERxWFpEYk5kUVVxZWFnWnIrSThBUT09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_aarch64.app.tar.gz"
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL2RHaC9wc3VMQzJxeFRYaHVVN0xEZW91WWgwZkluYkYrdW5hUWl2UFlSeEUyRk93dm13WUdmQVZETWhmNW9MZ2lPUFdOdERzbGFibkpPNHJWMU1BYlFrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg1ODYyCWZpbGU6QmxpbmsuYXBwLnRhci5negpjK0VIaW9oVzlrUU92UWZudzcvRGlZNExwM0NOdmpHVGd1QUc2WWZ0bnRkU2NsWkdqQUJrR01ucVVRTktvR0RaV0l0L09KQ2luZHNUdjMvTGVlM2RCUT09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_aarch64.app.tar.gz"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1JtYjlPdWJ2WngrU21iV1ZSd3BCWjBSdDVxT0VGcSs5VFZ0YUs1eFlIbnNlUnN1VzJLOUg4K25sdVRWUzhkR0VJWDBIa081R01aUyt4S3VQZHlSQ3d3PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU1MTAxCWZpbGU6QmxpbmtfMC4wLjYtZGV2X2FtZDY0LkFwcEltYWdlLnRhci5nego4ZllLcnRyWW5FM0JRY0dZUkJocFdsNlRzdjdnY3dDUFpGSENNSVNwdkRMZStvZWZTSlFLL25IR1A3a2pzdTlBUjNveVJ5VDFqYkxJdWF5MWFFeWxDdz09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_0.0.6-dev_amd64.AppImage.tar.gz"
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1hKZGoxZFUvZzl5SmNnUEFRTGQ2TmFNMlphK25lTU9MTjJEM0JYQWt0Sy91Um9yRmk4QTl6dEtUSmRuRmFNODRwajJ2YW4rTGJzYVZjcmhFb1IxZkFnPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg2MTQxCWZpbGU6QmxpbmtfMC4wLjctZGV2X2FtZDY0LkFwcEltYWdlCndKZURUdjF0bkNna1VCVDNEMFNodEZBZGkzZFBKVWx2cThSNE5najBmd2U5Rzh5SDFIbUxqRHlKOWdxMnY2QU9NdTRiQmtWY2VVaVlhNjRrNDVHMUFRPT0K",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_0.0.7-dev_amd64.AppImage"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL2F4bGtQUmxDVjZadzRuNHk0RTd5RmRJbmVsOEwxaTV1U3FzZHAveEhiU0xmcGx2N0toaUR4alRiS2lmTTU0QStHc2JzT2diR1JjRm5VZU1SUWFuS0F3PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzI1NjU1MjMyCWZpbGU6QmxpbmtfMC4wLjYtZGV2X3g2NC1zZXR1cC5uc2lzLnppcApPdk5zQ0NFcFQySXNjck8zTEM4SitwdTV6UXRKYnpPKzBJQnVJRDkxWjdqWGgwaXBSb1k0aGMvVEhwWWhBTEJzZHRhVy9KU0lCbjl2bG45WUJxOUlBZz09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.6-dev/Blink_0.0.6-dev_x64-setup.nsis.zip"
|
||||
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSNkxEL1dFMElZL1MwRVJ0UXBUUEYvd01JbXhBalFwQ0w5bEdkZkdlblZNeW1EMXQxajhYeVd0cERWcnhWOWFOaXV4Q0hDU1VRTEhabXF1ekFIbzB0KzRmL0pxdEIzMEFrPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzMyMDg2Mjg5CWZpbGU6QmxpbmtfMC4wLjctZGV2X3g2NC1zZXR1cC5uc2lzLnppcApJMmRORUFhV3NKV3BCTTliQkIwcWtSZStKTzEwY002QndCWmxKb0ZRd2p2K0cvek90dmdsbmQ0MHhNOVJsWnE3Y29qQmNDckdxdUNabWpTWjJ3d0xBUT09Cg==",
|
||||
"url": "https://github.com/prayag17/Blink/releases/download/v0.0.7-dev/Blink_0.0.7-dev_x64-setup.nsis.zip"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +1,101 @@
|
||||
{
|
||||
"name": "blink",
|
||||
"private": true,
|
||||
"version": "0.0.7-dev",
|
||||
"version": "1.0.0-alpha.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --force && tsr watch",
|
||||
"dev": "vite && tsr watch",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri",
|
||||
"tauri:dev:mcp": "tauri dev -c src-tauri/tauri.mcp.conf.json -- --features mcp-bridge",
|
||||
"lint": "biome check src/**/*",
|
||||
"lint:fix": "biome check --apply src/**/*",
|
||||
"tanstack-router-dev": "tsr watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.1.0",
|
||||
"@dnd-kit/modifiers": "^7.0.0",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@emotion/react": "^11.13.3",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.1.1",
|
||||
"@fontsource-variable/noto-sans": "^5.1.0",
|
||||
"@jellyfin/sdk": "0.11.0",
|
||||
"@million/lint": "^1.0.12",
|
||||
"@mui/lab": "6.0.0-beta.15",
|
||||
"@mui/material": "6.1.7",
|
||||
"@react-spring/web": "^9.7.5",
|
||||
"@tanem/react-nprogress": "^5.0.53",
|
||||
"@tanstack/react-query": "^5.60.6",
|
||||
"@tanstack/react-query-devtools": "^5.60.6",
|
||||
"@tanstack/react-router": "^1.82.1",
|
||||
"@tanstack/react-virtual": "^3.10.9",
|
||||
"@tauri-apps/api": "2.1.1",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.6",
|
||||
"@tauri-apps/plugin-dialog": "2.0.1",
|
||||
"@tauri-apps/plugin-notification": "2.0.0",
|
||||
"@tauri-apps/plugin-process": "2.0.0",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
"@fontsource-variable/caveat": "^5.3.0",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
||||
"@fontsource-variable/noto-sans": "^5.3.0",
|
||||
"@fontsource-variable/plus-jakarta-sans": "^5.3.0",
|
||||
"@fontsource-variable/space-grotesk": "^5.3.0",
|
||||
"@jellyfin/sdk": "1.0.1",
|
||||
"@mui/lab": "9.0.0-beta.10",
|
||||
"@mui/material": "9.5.0",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@react-spring/web": "^10.1.2",
|
||||
"@tanem/react-nprogress": "^7.1.7",
|
||||
"@tanstack/react-form": "^1.33.5",
|
||||
"@tanstack/react-query": "^5.104.4",
|
||||
"@tanstack/react-router": "^1.170.45",
|
||||
"@tanstack/react-virtual": "^3.14.21",
|
||||
"@tauri-apps/api": "2.12.4",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.5.0",
|
||||
"@tauri-apps/plugin-deep-link": "2.6.3",
|
||||
"@tauri-apps/plugin-dialog": "2.8.3",
|
||||
"@tauri-apps/plugin-global-shortcut": "~2.4.1",
|
||||
"@tauri-apps/plugin-notification": "2.7.0",
|
||||
"@tauri-apps/plugin-process": "2.4.0",
|
||||
"@tauri-apps/plugin-shell": "~2.5.0",
|
||||
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
|
||||
"@tauri-apps/plugin-updater": "2.0.0",
|
||||
"@tauri-apps/plugin-upload": "2.1.0",
|
||||
"@types/node": "^22.9.1",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"axios": "^1.7.7",
|
||||
"axios-tauri-api-adapter": "^2.0.3",
|
||||
"@tauri-apps/plugin-updater": "2.14.0",
|
||||
"@tauri-apps/plugin-upload": "2.5.0",
|
||||
"@tauri-apps/plugin-websocket": "2.5.0",
|
||||
"@tauri-apps/plugin-window-state": "~2.5.0",
|
||||
"@types/node": "^26.6.5",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"axios": "^1.20.0",
|
||||
"axios-tauri-api-adapter": "^2.0.6",
|
||||
"blurhash": "^2.0.5",
|
||||
"framer-motion": "^11.11.17",
|
||||
"immer": "^10.1.1",
|
||||
"jassub": "^1.7.17",
|
||||
"lodash": "^4.17.21",
|
||||
"material-symbols": "^0.27.0",
|
||||
"million": "^3.1.11",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "18.3.1",
|
||||
"blurhash-wasm": "^0.2.0",
|
||||
"immer": "^11.1.21",
|
||||
"jassub": "^2.5.22",
|
||||
"libpgs": "^0.9.0",
|
||||
"lodash": "^4.18.1",
|
||||
"material-symbols": "^0.48.0",
|
||||
"motion": "^14.4.0",
|
||||
"notistack": "^3.0.2",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "^19.3.1",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-dnd": "^16.0.1",
|
||||
"react-dnd-html5-backend": "^16.0.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-error-boundary": "^4.1.2",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-multi-carousel": "^2.8.5",
|
||||
"react-player": "^2.16.0",
|
||||
"react-use-konami": "^1.1.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"typescript": "^5.6.3",
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"wavesurfer.js": "^7.8.8",
|
||||
"zustand": "5.0.1"
|
||||
"react-dom": "^19.3.1",
|
||||
"react-error-boundary": "^6.1.6",
|
||||
"react-intersection-observer": "^11.0.1",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react-multi-carousel": "^2.8.6",
|
||||
"react-player": "^3.4.0",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"typescript": "^7.0.2",
|
||||
"vite-plugin-svgr": "^5.2.0",
|
||||
"vite-plugin-top-level-await": "^1.6.0",
|
||||
"wavesurfer.js": "^8.0.3",
|
||||
"zod": "^4.6.7",
|
||||
"zustand": "5.0.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.25.9",
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@tanstack/router-cli": "^1.81.9",
|
||||
"@tanstack/router-devtools": "^1.82.1",
|
||||
"@tanstack/router-vite-plugin": "^1.81.9",
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"@types/lodash": "^4.17.13",
|
||||
"@vitejs/plugin-react": "^4.3.3",
|
||||
"@babel/plugin-proposal-optional-chaining-assign": "^8.0.1",
|
||||
"@biomejs/biome": "^2.5.15",
|
||||
"@tanstack/router-cli": "^1.167.45",
|
||||
"@tanstack/router-vite-plugin": "^1.167.47",
|
||||
"@tauri-apps/cli": "2.12.3",
|
||||
"@types/lodash": "^4.17.26",
|
||||
"@types/qrcode": "^1.5.6",
|
||||
"@vitejs/plugin-react": "^6.1.2",
|
||||
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
||||
"eslint-plugin-react-hooks": "7.1.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"sass": "^1.81.0",
|
||||
"vite": "^5.4.11"
|
||||
"sass": "^1.105.2",
|
||||
"vite": "^8.3.4",
|
||||
"vite-plugin-wasm": "^3.6.0"
|
||||
},
|
||||
"license": "GPL-3.0-only"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
allowBuilds:
|
||||
'@parcel/watcher': true
|
||||
'@swc/core': true
|
||||
core-js: true
|
||||
lfa-ponyfill: true
|
||||
@@ -1,10 +1,10 @@
|
||||
[package]
|
||||
name = "blink"
|
||||
version = "0.0.7-dev"
|
||||
version = "1.0.0-alpha.4"
|
||||
description = "A Modern Jellyfin Client"
|
||||
authors = ["prayag17", "JellyPlayer contributors (https://github.com/prayag17/JellyPlayer/graphs/contributors)"]
|
||||
authors = ["prayag17", "Blink contributors (https://github.com/prayag17/Blink/graphs/contributors)"]
|
||||
license = "GPL-3.0-only"
|
||||
repository = "https://github.com/prayag17/JellyPlayer/"
|
||||
repository = "https://github.com/prayag17/Blink/"
|
||||
default-run = "blink"
|
||||
edition = "2021"
|
||||
rust-version = "1.59"
|
||||
@@ -12,17 +12,20 @@ rust-version = "1.59"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.0.0-beta", features = [] }
|
||||
tauri-build = { version = "2.5.4", features = [] }
|
||||
|
||||
[lib]
|
||||
name = "blink_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
log = "^0.4.21"
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "2.0.0-beta", features = [ "devtools"] }
|
||||
tauri = { version = "2.10.1", features = [ "devtools"] }
|
||||
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2", features = ["colored"] }
|
||||
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
portpicker = "0.1" # used in the example to pick a random free port
|
||||
tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
@@ -30,11 +33,42 @@ tauri-plugin-clipboard-manager = "2.1.0-beta.6"
|
||||
tauri-plugin-notification = "2.0.0-rc.1"
|
||||
tauri-plugin-upload = "2.0.0"
|
||||
tauri-plugin-dialog = "2.0.0"
|
||||
tauri-plugin-shell = "2.3.5"
|
||||
tauri-plugin-websocket = "2.5.0"
|
||||
tauri-plugin-deep-link = "2.6.3"
|
||||
tauri-plugin-mcp-bridge = { version = "0.13.2", optional = true }
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||
default = [ "custom-protocol" ]
|
||||
# Dev-only MCP bridge for UI automation: `pnpm tauri dev -- --features mcp-bridge`
|
||||
mcp-bridge = ["dep:tauri-plugin-mcp-bridge"]
|
||||
# this feature is used for production builds where `devPath` points to the filesystem
|
||||
# DO NOT remove this
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-global-shortcut = "2"
|
||||
tauri-plugin-window-state = "2"
|
||||
reqwest = { version = "0.12", default-features = false, features = [
|
||||
"cookies",
|
||||
"json",
|
||||
"multipart",
|
||||
"gzip",
|
||||
"rustls-tls",
|
||||
] }
|
||||
|
||||
# Keep each OS on its native secret store without pulling the others' system
|
||||
# libraries into every build.
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
keyring = { version = "3", default-features = false, features = ["windows-native"] }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
keyring = { version = "3", default-features = false, features = ["apple-native"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
keyring = { version = "3", default-features = false, features = [
|
||||
"sync-secret-service",
|
||||
"crypto-rust",
|
||||
] }
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"identifier": "desktop-capability",
|
||||
"platforms": [
|
||||
"macOS",
|
||||
"windows",
|
||||
"linux"
|
||||
],
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"window-state:default",
|
||||
"global-shortcut:default",
|
||||
"global-shortcut:allow-is-registered",
|
||||
"global-shortcut:allow-register",
|
||||
"global-shortcut:allow-unregister",
|
||||
"websocket:default",
|
||||
"shell:default"
|
||||
]
|
||||
}
|
||||
@@ -13,9 +13,24 @@
|
||||
"store:allow-load",
|
||||
"updater:allow-check",
|
||||
"updater:allow-download-and-install",
|
||||
"updater:allow-download",
|
||||
"updater:allow-install",
|
||||
"notification:default",
|
||||
"core:webview:allow-internal-toggle-devtools",
|
||||
"core:window:allow-start-dragging",
|
||||
"core:window:allow-start-resize-dragging",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-maximize",
|
||||
"core:window:allow-unmaximize",
|
||||
"core:window:allow-toggle-maximize",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-is-maximized",
|
||||
"dialog:default",
|
||||
"upload:allow-download"
|
||||
"upload:allow-download",
|
||||
"clipboard-manager:allow-write-text",
|
||||
"websocket:default",
|
||||
"deep-link:default",
|
||||
"shell:default",
|
||||
"shell:allow-open"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "mcp-bridge-capability",
|
||||
"description": "Dev-only permissions for the Tauri MCP bridge (AI debugging). Enabled only by tauri.mcp.conf.json.",
|
||||
"windows": ["main"],
|
||||
"permissions": ["mcp-bridge:default"]
|
||||
}
|
||||
@@ -1,17 +1,20 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "migrated",
|
||||
"description": "permissions that were migrated from v1",
|
||||
"local": true,
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:path:default",
|
||||
"core:event:default",
|
||||
"core:window:default",
|
||||
"core:app:default",
|
||||
"core:resources:default",
|
||||
"core:menu:default",
|
||||
"core:tray:default",
|
||||
"core:window:allow-set-fullscreen"
|
||||
]
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "migrated",
|
||||
"description": "permissions that were migrated from v1",
|
||||
"local": true,
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"core:path:default",
|
||||
"core:event:default",
|
||||
"core:window:default",
|
||||
"core:app:default",
|
||||
"core:resources:default",
|
||||
"core:menu:default",
|
||||
"core:tray:default",
|
||||
"core:window:allow-set-fullscreen",
|
||||
"shell:default"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
||||
@@ -0,0 +1,20 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
key.properties
|
||||
keystore.properties
|
||||
|
||||
/.tauri
|
||||
/tauri.settings.gradle
|
||||
@@ -0,0 +1,6 @@
|
||||
/src/main/**/generated
|
||||
/src/main/jniLibs/**/*.so
|
||||
/src/main/assets/tauri.conf.json
|
||||
/tauri.build.gradle.kts
|
||||
/proguard-tauri.pro
|
||||
/tauri.properties
|
||||
@@ -0,0 +1,105 @@
|
||||
import java.util.Properties
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("rust")
|
||||
}
|
||||
|
||||
val tauriProperties = Properties().apply {
|
||||
val propFile = file("tauri.properties")
|
||||
if (propFile.exists()) {
|
||||
propFile.inputStream().use { load(it) }
|
||||
}
|
||||
}
|
||||
|
||||
val keystoreProperties = Properties().apply {
|
||||
val propFile = rootProject.file("keystore.properties")
|
||||
if (propFile.exists()) {
|
||||
propFile.inputStream().use { load(it) }
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = 37
|
||||
namespace = "com.blink.prayag17"
|
||||
signingConfigs {
|
||||
if (keystoreProperties.getProperty("storeFile") != null) {
|
||||
create("release") {
|
||||
storeFile = file(keystoreProperties.getProperty("storeFile"))
|
||||
storePassword = keystoreProperties.getProperty("storePassword")
|
||||
keyAlias = keystoreProperties.getProperty("keyAlias")
|
||||
keyPassword = keystoreProperties.getProperty("keyPassword")
|
||||
}
|
||||
}
|
||||
}
|
||||
defaultConfig {
|
||||
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
||||
applicationId = "com.blink.prayag17"
|
||||
minSdk = 24
|
||||
targetSdk = 37
|
||||
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
|
||||
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
|
||||
}
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
||||
isDebuggable = true
|
||||
isJniDebuggable = true
|
||||
isMinifyEnabled = false
|
||||
packaging {
|
||||
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
|
||||
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
|
||||
jniLibs.keepDebugSymbols.add("*/x86/*.so")
|
||||
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
|
||||
}
|
||||
}
|
||||
getByName("release") {
|
||||
signingConfig = if (keystoreProperties.getProperty("storeFile") != null) {
|
||||
signingConfigs.getByName("release")
|
||||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
optimization {
|
||||
enable = true
|
||||
}
|
||||
proguardFiles(
|
||||
*fileTree(".") {
|
||||
include("**/*.pro")
|
||||
exclude("build/**")
|
||||
}.files.toTypedArray()
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = JvmTarget.JVM_1_8
|
||||
}
|
||||
}
|
||||
|
||||
rust {
|
||||
rootDirRel = "../../../"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.webkit:webkit:1.14.0")
|
||||
implementation("androidx.appcompat:appcompat:1.7.1")
|
||||
implementation("androidx.activity:activity-ktx:1.10.1")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.lifecycle:lifecycle-process:2.10.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.4")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
|
||||
}
|
||||
|
||||
apply(from = file("tauri.build.gradle.kts"))
|
||||
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<!-- AndroidTV support -->
|
||||
<uses-feature android:name="android.software.leanback" android:required="false" />
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.blink"
|
||||
android:usesCleartextTraffic="${usesCleartextTraffic}">
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||
android:launchMode="singleTask"
|
||||
android:label="@string/main_activity_title"
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<!-- AndroidTV support -->
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||
</intent-filter>
|
||||
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
|
||||
|
||||
<!-- DEEP LINK PLUGIN. AUTO-GENERATED. DO NOT REMOVE. -->
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.blink.prayag17
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
|
||||
class MainActivity : TauriActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.blink" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">"Blink"</string>
|
||||
<string name="main_activity_title">"Blink"</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.blink" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-path name="my_images" path="." />
|
||||
<cache-path name="my_cache_images" path="." />
|
||||
</paths>
|
||||
@@ -0,0 +1,22 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:9.3.1")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.10")
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("clean").configure {
|
||||
delete("build")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("pluginsForCoolKids") {
|
||||
id = "rust"
|
||||
implementationClass = "RustPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(gradleApi())
|
||||
implementation("com.android.tools.build:gradle:9.3.1")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import java.io.File
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import javax.inject.Inject
|
||||
import org.gradle.process.ExecOperations
|
||||
|
||||
abstract class BuildTask : DefaultTask() {
|
||||
@get:Inject
|
||||
abstract val execOperations: ExecOperations
|
||||
|
||||
@Input
|
||||
var rootDirRel: String? = null
|
||||
@Input
|
||||
var projectDir: String? = null
|
||||
@Input
|
||||
var target: String? = null
|
||||
@Input
|
||||
var release: Boolean? = null
|
||||
|
||||
@TaskAction
|
||||
fun assemble() {
|
||||
val executable = """pnpm""";
|
||||
try {
|
||||
runTauriCli(executable)
|
||||
} catch (e: Exception) {
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
// Try different Windows-specific extensions
|
||||
val fallbacks = listOf(
|
||||
"$executable.exe",
|
||||
"$executable.cmd",
|
||||
"$executable.bat",
|
||||
)
|
||||
|
||||
var lastException: Exception = e
|
||||
for (fallback in fallbacks) {
|
||||
try {
|
||||
runTauriCli(fallback)
|
||||
return
|
||||
} catch (fallbackException: Exception) {
|
||||
lastException = fallbackException
|
||||
}
|
||||
}
|
||||
throw lastException
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun runTauriCli(executable: String) {
|
||||
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
|
||||
val target = target ?: throw GradleException("target cannot be null")
|
||||
val release = release ?: throw GradleException("release cannot be null")
|
||||
val args = listOf("tauri", "android", "android-studio-script");
|
||||
|
||||
execOperations.exec {
|
||||
workingDir(File(projectDir, rootDirRel))
|
||||
executable(executable)
|
||||
args(args)
|
||||
if (logger.isEnabled(LogLevel.DEBUG)) {
|
||||
args("-vv")
|
||||
} else if (logger.isEnabled(LogLevel.INFO)) {
|
||||
args("-v")
|
||||
}
|
||||
if (release) {
|
||||
args("--release")
|
||||
}
|
||||
args(listOf("--target", target))
|
||||
}.assertNormalExitValue()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.get
|
||||
|
||||
const val TASK_GROUP = "rust"
|
||||
|
||||
open class Config {
|
||||
lateinit var rootDirRel: String
|
||||
}
|
||||
|
||||
open class RustPlugin : Plugin<Project> {
|
||||
private lateinit var config: Config
|
||||
|
||||
override fun apply(project: Project) = with(project) {
|
||||
config = extensions.create("rust", Config::class.java)
|
||||
|
||||
val defaultAbiList = listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64");
|
||||
val abiList = (findProperty("abiList") as? String)?.split(',') ?: defaultAbiList
|
||||
|
||||
val defaultArchList = listOf("arm64", "arm", "x86", "x86_64");
|
||||
val archList = (findProperty("archList") as? String)?.split(',') ?: defaultArchList
|
||||
|
||||
val targetsList = (findProperty("targetList") as? String)?.split(',') ?: listOf("aarch64", "armv7", "i686", "x86_64")
|
||||
|
||||
extensions.configure<ApplicationExtension> {
|
||||
@Suppress("UnstableApiUsage")
|
||||
flavorDimensions.add("abi")
|
||||
productFlavors {
|
||||
create("universal") {
|
||||
dimension = "abi"
|
||||
ndk {
|
||||
abiFilters += abiList
|
||||
}
|
||||
}
|
||||
defaultArchList.forEachIndexed { index, arch ->
|
||||
create(arch) {
|
||||
dimension = "abi"
|
||||
ndk {
|
||||
abiFilters.add(defaultAbiList[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
for (profile in listOf("debug", "release")) {
|
||||
val profileCapitalized = profile.replaceFirstChar { it.uppercase() }
|
||||
val buildTask = tasks.maybeCreate(
|
||||
"rustBuildUniversal$profileCapitalized",
|
||||
DefaultTask::class.java
|
||||
).apply {
|
||||
group = TASK_GROUP
|
||||
description = "Build dynamic library in $profile mode for all targets"
|
||||
}
|
||||
|
||||
tasks["mergeUniversal${profileCapitalized}JniLibFolders"].dependsOn(buildTask)
|
||||
|
||||
for (targetPair in targetsList.withIndex()) {
|
||||
val targetName = targetPair.value
|
||||
val targetArch = archList[targetPair.index]
|
||||
val targetArchCapitalized = targetArch.replaceFirstChar { it.uppercase() }
|
||||
val targetBuildTask = project.tasks.register(
|
||||
"rustBuild$targetArchCapitalized$profileCapitalized",
|
||||
BuildTask::class.java
|
||||
) {
|
||||
group = TASK_GROUP
|
||||
description = "Build dynamic library in $profile mode for $targetArch"
|
||||
rootDirRel = config.rootDirRel
|
||||
projectDir = project.projectDir.path
|
||||
target = targetName
|
||||
release = profile == "release"
|
||||
}
|
||||
|
||||
buildTask.dependsOn(targetBuildTask)
|
||||
tasks["merge$targetArchCapitalized${profileCapitalized}JniLibFolders"].dependsOn(
|
||||
targetBuildTask
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
org.gradle.configuration-cache=true
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
|
||||
# Our old plugin template had a bug that caused missing `consumer-rules.pro` files
|
||||
# so we have to disable it for now.
|
||||
# See https://github.com/tauri-apps/tauri/pull/15828#issuecomment-5199937796
|
||||
android.proguard.failOnMissingFiles=false
|
||||
|
||||
# Keeping Gradle 9 compatible with current plugins
|
||||
# TODO: Remove this in v3
|
||||
android.builtInKotlin=false
|
||||
android.newDsl=false
|
||||
@@ -0,0 +1,6 @@
|
||||
#Tue May 10 19:22:52 CST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -0,0 +1,82 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
@@ -0,0 +1,3 @@
|
||||
include ':app'
|
||||
|
||||
apply from: 'tauri.settings.gradle'
|
||||
@@ -1 +1 @@
|
||||
{"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core":{"default_permission":{"identifier":"default","description":"Default core plugins set which includes:\n- 'core:path:default'\n- 'core:event:default'\n- 'core:window:default'\n- 'core:webview:default'\n- 'core:app:default'\n- 'core:image:default'\n- 'core:resources:default'\n- 'core:menu:default'\n- 'core:tray:default'\n","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-set-app-theme":{"identifier":"allow-set-app-theme","description":"Enables the set_app_theme command without any pre-configured scope.","commands":{"allow":["set_app_theme"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_winLine truncated
|
||||
{"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-secret":{"identifier":"allow-write-secret","description":"Enables the write_secret command without any pre-configured scope.","commands":{"allow":["write_secret"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-secret":{"identifier":"deny-write-secret","description":"Denies the write_secret command without any pre-configured scope.","commands":{"allow":[],"deny":["write_secret"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener","allow-supports-multiple-windows"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","coLine truncated
|
||||
@@ -1 +1 @@
|
||||
{"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","notification:default","core:webview:allow-internal-toggle-devtools","dialog:default","upload:allow-download"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","websocket:default","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","core:window:allow-start-dragging","core:window:allow-start-resize-dragging","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-close","core:window:allow-is-maximized","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","websocket:default","deep-link:default","shell:default","shell:allow-open"]},"mcp-bridge-capability":{"identifier":"mcp-bridge-capability","description":"Dev-only permissions for the Tauri MCP bridge (AI debugging). Enabled only by tauri.mcp.conf.json.","local":true,"windows":["main"],"permissions":["mcp-bridge:default"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}}
|
||||
@@ -0,0 +1,74 @@
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
mod qbittorrent;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
let builder = tauri::Builder::default();
|
||||
|
||||
// Dev-only MCP bridge: `pnpm tauri dev -- --features mcp-bridge`.
|
||||
#[cfg(all(debug_assertions, feature = "mcp-bridge"))]
|
||||
let builder = builder.plugin(
|
||||
tauri_plugin_mcp_bridge::Builder::new()
|
||||
.bind_address("127.0.0.1")
|
||||
.build(),
|
||||
);
|
||||
|
||||
// Desktop-only integrations. The Android/iOS build has no qBittorrent
|
||||
// commands, global shortcuts, window state or in-app updater.
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
let builder = builder
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
qbittorrent::qb_get_settings,
|
||||
qbittorrent::qb_save_settings,
|
||||
qbittorrent::qb_forget_secret,
|
||||
qbittorrent::qb_test_connection,
|
||||
qbittorrent::qb_categories,
|
||||
qbittorrent::qb_add_torrent,
|
||||
qbittorrent::qb_poll,
|
||||
qbittorrent::qb_pause,
|
||||
qbittorrent::qb_resume,
|
||||
qbittorrent::qb_delete,
|
||||
qbittorrent::qb_set_category,
|
||||
])
|
||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||
.plugin(tauri_plugin_updater::Builder::default().build());
|
||||
|
||||
builder
|
||||
.setup(|app| {
|
||||
#[cfg(not(any(
|
||||
target_os = "android",
|
||||
target_os = "ios",
|
||||
target_os = "macos"
|
||||
)))]
|
||||
{
|
||||
app.manage(qbittorrent::QbState::load(app.handle()));
|
||||
|
||||
// Frameless window outside macOS. macOS uses the native overlay
|
||||
// titlebar with its traffic lights.
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
window.set_decorations(false)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_upload::init())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(tauri_plugin_websocket::init())
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
.plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
.targets([Target::new(TargetKind::Webview)])
|
||||
.with_colors(ColoredLevelConfig::default())
|
||||
.build(),
|
||||
)
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running Blink");
|
||||
}
|
||||
@@ -1,22 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_upload::init())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
.targets([Target::new(TargetKind::Webview)])
|
||||
.with_colors(ColoredLevelConfig::default())
|
||||
.build(),
|
||||
)
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.plugin(tauri_plugin_updater::Builder::default().build())
|
||||
// .plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running JellyPlayer");
|
||||
blink_lib::run();
|
||||
}
|
||||
@@ -0,0 +1,496 @@
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
use reqwest::header::{ORIGIN, REFERER};
|
||||
use reqwest::multipart::{Form, Part};
|
||||
use reqwest::{Client, RequestBuilder, Response, StatusCode};
|
||||
use serde_json::Value;
|
||||
|
||||
use super::types::{QbAddResponse, QbAddResult, QbCategory, QbConnectionInfo, QbError, QbSettings};
|
||||
|
||||
const CONNECT_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
const REQUEST_TIMEOUT: Duration = Duration::from_secs(20);
|
||||
const UPLOAD_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
|
||||
pub struct AddTorrentInput {
|
||||
pub magnet: Option<String>,
|
||||
pub file_name: Option<String>,
|
||||
pub file_bytes: Option<Vec<u8>>,
|
||||
pub category: Option<String>,
|
||||
pub paused: bool,
|
||||
pub auto_tmm: bool,
|
||||
}
|
||||
|
||||
/// Trim, validate and normalise a WebUI address.
|
||||
///
|
||||
/// Accepts `host:port`, `http(s)://host:port`, a trailing slash, and a pasted
|
||||
/// `.../api/v2` URL, because those are the shapes users actually copy around.
|
||||
pub fn normalize_base_url(raw: &str) -> Result<String, QbError> {
|
||||
let mut url = raw.trim().trim_end_matches('/').to_string();
|
||||
if url.is_empty() {
|
||||
return Err(QbError::config("Укажите адрес qBittorrent WebUI"));
|
||||
}
|
||||
if !url.starts_with("http://") && !url.starts_with("https://") {
|
||||
url = format!("http://{url}");
|
||||
}
|
||||
if let Some(stripped) = url.strip_suffix("/api/v2") {
|
||||
url = stripped.trim_end_matches('/').to_string();
|
||||
}
|
||||
if url.is_empty() {
|
||||
return Err(QbError::config("Укажите адрес qBittorrent WebUI"));
|
||||
}
|
||||
|
||||
let parsed = reqwest::Url::parse(&url)
|
||||
.map_err(|_| QbError::config("Некорректный адрес qBittorrent WebUI"))?;
|
||||
if parsed.scheme() != "http" && parsed.scheme() != "https" {
|
||||
return Err(QbError::config(
|
||||
"Адрес qBittorrent должен начинаться с http:// или https://",
|
||||
));
|
||||
}
|
||||
if parsed.host_str().is_none() {
|
||||
return Err(QbError::config("В адресе qBittorrent нет имени хоста"));
|
||||
}
|
||||
|
||||
Ok(url)
|
||||
}
|
||||
|
||||
fn map_reqwest(err: reqwest::Error) -> QbError {
|
||||
let text = err.to_string();
|
||||
let lower = text.to_lowercase();
|
||||
|
||||
if lower.contains("certificate") || lower.contains("tls") || lower.contains("ssl") {
|
||||
return QbError::new(
|
||||
"tls",
|
||||
"Сертификат qBittorrent не принят. Если используется самоподписанный \
|
||||
сертификат, включите соответствующую настройку.",
|
||||
);
|
||||
}
|
||||
if err.is_timeout() {
|
||||
return QbError::new("unreachable", "qBittorrent не ответил вовремя");
|
||||
}
|
||||
if err.is_connect() || lower.contains("connection refused") {
|
||||
return QbError::new(
|
||||
"unreachable",
|
||||
"Не удалось подключиться к qBittorrent. Проверьте адрес и что WebUI запущен.",
|
||||
);
|
||||
}
|
||||
|
||||
QbError::new("http", text)
|
||||
}
|
||||
|
||||
fn http_error(status: StatusCode) -> QbError {
|
||||
let code = status.as_u16();
|
||||
match code {
|
||||
401 => QbError::with_status(
|
||||
"auth",
|
||||
"qBittorrent отклонил сессию. Проверьте логин и пароль.",
|
||||
code,
|
||||
),
|
||||
403 => QbError::with_status(
|
||||
"auth",
|
||||
"qBittorrent запретил запрос (403). Проверьте вход и адрес WebUI; \
|
||||
после нескольких неудачных попыток qBittorrent временно блокирует IP.",
|
||||
code,
|
||||
),
|
||||
404 => QbError::with_status(
|
||||
"http",
|
||||
"Метод qBittorrent не найден (404). Возможно, версия qBittorrent слишком старая.",
|
||||
code,
|
||||
),
|
||||
415 => QbError::with_status("torrent", "qBittorrent не принял файл торрента", code),
|
||||
_ => QbError::with_status("http", format!("qBittorrent вернул ошибку {code}"), code),
|
||||
}
|
||||
}
|
||||
|
||||
fn join_hashes(hashes: &[String]) -> String {
|
||||
if hashes.is_empty() {
|
||||
"all".to_string()
|
||||
} else {
|
||||
hashes.join("|")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct QbClient {
|
||||
pub http: Client,
|
||||
pub base_url: String,
|
||||
username: String,
|
||||
secret: String,
|
||||
use_api_key: bool,
|
||||
/// Minor part of the WebAPI version (`2.11` -> `11`); 0 until connected.
|
||||
pub api_minor: u32,
|
||||
}
|
||||
|
||||
impl QbClient {
|
||||
pub fn new(settings: &QbSettings, secret: &str) -> Result<Self, QbError> {
|
||||
let base_url = normalize_base_url(&settings.base_url)?;
|
||||
let http = Client::builder()
|
||||
.cookie_store(true)
|
||||
.connect_timeout(CONNECT_TIMEOUT)
|
||||
.timeout(REQUEST_TIMEOUT)
|
||||
.user_agent(concat!("Blink/", env!("CARGO_PKG_VERSION")))
|
||||
.danger_accept_invalid_certs(settings.allow_invalid_certs)
|
||||
.build()
|
||||
.map_err(map_reqwest)?;
|
||||
|
||||
Ok(Self {
|
||||
http,
|
||||
base_url,
|
||||
username: settings.username.trim().to_string(),
|
||||
secret: secret.to_string(),
|
||||
use_api_key: settings.use_api_key,
|
||||
api_minor: 0,
|
||||
})
|
||||
}
|
||||
|
||||
/// Create a client, authenticate it and read its WebAPI version.
|
||||
pub async fn connect(settings: &QbSettings, secret: &str) -> Result<Self, QbError> {
|
||||
let mut client = Self::new(settings, secret)?;
|
||||
if !client.use_api_key {
|
||||
client.login().await?;
|
||||
}
|
||||
let version = client.get_text("/api/v2/app/webapiVersion").await?;
|
||||
client.api_minor = version
|
||||
.trim()
|
||||
.split('.')
|
||||
.nth(1)
|
||||
.and_then(|minor| minor.parse().ok())
|
||||
.unwrap_or(0);
|
||||
Ok(client)
|
||||
}
|
||||
|
||||
fn url(&self, path: &str) -> String {
|
||||
format!("{}{}", self.base_url, path)
|
||||
}
|
||||
|
||||
fn decorate(&self, request: RequestBuilder) -> RequestBuilder {
|
||||
let request = request
|
||||
.header(REFERER, &self.base_url)
|
||||
.header(ORIGIN, &self.base_url);
|
||||
if self.use_api_key {
|
||||
request.bearer_auth(&self.secret)
|
||||
} else {
|
||||
request
|
||||
}
|
||||
}
|
||||
|
||||
async fn send<F>(&self, build: F) -> Result<Response, QbError>
|
||||
where
|
||||
F: Fn() -> RequestBuilder,
|
||||
{
|
||||
let first = self.decorate(build()).send().await.map_err(map_reqwest)?;
|
||||
|
||||
// The WebUI session can expire while the app is open. Re-login once
|
||||
// and repeat the request instead of surfacing a spurious auth error.
|
||||
if matches!(first.status().as_u16(), 401 | 403) && !self.use_api_key {
|
||||
drop(first);
|
||||
self.login().await?;
|
||||
return self.decorate(build()).send().await.map_err(map_reqwest);
|
||||
}
|
||||
|
||||
Ok(first)
|
||||
}
|
||||
|
||||
async fn login(&self) -> Result<(), QbError> {
|
||||
let response = self
|
||||
.http
|
||||
.post(self.url("/api/v2/auth/login"))
|
||||
.header(REFERER, &self.base_url)
|
||||
.header(ORIGIN, &self.base_url)
|
||||
.form(&[
|
||||
("username", self.username.as_str()),
|
||||
("password", self.secret.as_str()),
|
||||
])
|
||||
.send()
|
||||
.await
|
||||
.map_err(map_reqwest)?;
|
||||
|
||||
let status = response.status();
|
||||
match status.as_u16() {
|
||||
200 => {
|
||||
let body = response.text().await.unwrap_or_default();
|
||||
if body.trim().eq_ignore_ascii_case("Fails.") {
|
||||
Err(QbError::with_status(
|
||||
"auth",
|
||||
"Неверный логин или пароль qBittorrent",
|
||||
200,
|
||||
))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
204 => Ok(()),
|
||||
401 => Err(QbError::with_status(
|
||||
"auth",
|
||||
"Неверный логин или пароль qBittorrent",
|
||||
401,
|
||||
)),
|
||||
403 => Err(QbError::with_status(
|
||||
"banned",
|
||||
"qBittorrent заблокировал вход с этого IP. Подождите и попробуйте снова.",
|
||||
403,
|
||||
)),
|
||||
_ => Err(http_error(status)),
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_text(&self, path: &str) -> Result<String, QbError> {
|
||||
let url = self.url(path);
|
||||
let response = self.send(|| self.http.get(&url)).await?;
|
||||
let status = response.status();
|
||||
if !status.is_success() {
|
||||
return Err(http_error(status));
|
||||
}
|
||||
response.text().await.map_err(map_reqwest)
|
||||
}
|
||||
|
||||
async fn get_json<T>(&self, path: &str) -> Result<T, QbError>
|
||||
where
|
||||
T: serde::de::DeserializeOwned,
|
||||
{
|
||||
let text = self.get_text(path).await?;
|
||||
serde_json::from_str(&text)
|
||||
.map_err(|err| QbError::new("http", format!("Некорректный ответ qBittorrent: {err}")))
|
||||
}
|
||||
|
||||
async fn post_form(&self, path: &str, form: Vec<(String, String)>) -> Result<(), QbError> {
|
||||
let url = self.url(path);
|
||||
let response = self
|
||||
.send(|| self.http.post(&url).form(&form))
|
||||
.await
|
||||
.map_err(|err| err)?;
|
||||
let status = response.status();
|
||||
if status.is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(http_error(status))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn connection_info(&self) -> Result<QbConnectionInfo, QbError> {
|
||||
let app_version = self.get_text("/api/v2/app/version").await?;
|
||||
let api_version = self.get_text("/api/v2/app/webapiVersion").await?;
|
||||
let default_save_path = self.get_text("/api/v2/app/defaultSavePath").await?;
|
||||
|
||||
Ok(QbConnectionInfo {
|
||||
app_version: app_version.trim().to_string(),
|
||||
api_version: api_version.trim().to_string(),
|
||||
default_save_path: default_save_path.trim().to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn categories(&self) -> Result<Vec<QbCategory>, QbError> {
|
||||
let categories: HashMap<String, QbCategory> =
|
||||
self.get_json("/api/v2/torrents/categories").await?;
|
||||
|
||||
let mut list: Vec<QbCategory> = categories
|
||||
.into_iter()
|
||||
.map(|(name, mut category)| {
|
||||
if category.name.is_empty() {
|
||||
category.name = name;
|
||||
}
|
||||
category
|
||||
})
|
||||
.collect();
|
||||
list.sort_by_key(|category| category.name.to_lowercase());
|
||||
Ok(list)
|
||||
}
|
||||
|
||||
pub async fn add_torrent(&self, input: AddTorrentInput) -> Result<QbAddResult, QbError> {
|
||||
let url = self.url("/api/v2/torrents/add");
|
||||
let magnet = input.magnet.clone();
|
||||
let file_name = input.file_name.clone();
|
||||
let file_bytes = input.file_bytes.clone();
|
||||
let category = input.category.clone();
|
||||
let paused = input.paused;
|
||||
let auto_tmm = input.auto_tmm;
|
||||
|
||||
// Build the multipart body on every attempt: a Form cannot be cloned,
|
||||
// and send() may retry once after re-login.
|
||||
let build_form = || {
|
||||
let mut form = Form::new()
|
||||
// qBittorrent 4.x spells this `paused`, 5.x `stopped`; both
|
||||
// ignore the other key, so sending both keeps every version.
|
||||
.text("paused", if paused { "true" } else { "false" })
|
||||
.text("stopped", if paused { "true" } else { "false" })
|
||||
.text("autoTMM", if auto_tmm { "true" } else { "false" });
|
||||
|
||||
if let Some(category) = category.as_ref().filter(|value| !value.is_empty()) {
|
||||
form = form.text("category", category.clone());
|
||||
}
|
||||
if let Some(magnet) = magnet.as_ref().filter(|value| !value.is_empty()) {
|
||||
form = form.text("urls", magnet.clone());
|
||||
}
|
||||
if let (Some(name), Some(bytes)) = (file_name.as_ref(), file_bytes.as_ref()) {
|
||||
let part = Part::bytes(bytes.clone())
|
||||
.file_name(name.clone())
|
||||
.mime_str("application/x-bittorrent")
|
||||
.unwrap_or_else(|_| Part::bytes(bytes.clone()));
|
||||
form = form.part("torrents", part);
|
||||
}
|
||||
form
|
||||
};
|
||||
|
||||
let response = self
|
||||
.decorate(
|
||||
self.http
|
||||
.post(&url)
|
||||
.timeout(UPLOAD_TIMEOUT)
|
||||
.multipart(build_form()),
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.map_err(map_reqwest)?;
|
||||
|
||||
if matches!(response.status().as_u16(), 401 | 403) && !self.use_api_key {
|
||||
self.login().await?;
|
||||
let retry = self
|
||||
.decorate(
|
||||
self.http
|
||||
.post(&url)
|
||||
.timeout(UPLOAD_TIMEOUT)
|
||||
.multipart(build_form()),
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.map_err(map_reqwest)?;
|
||||
return parse_add_response(retry).await;
|
||||
}
|
||||
|
||||
parse_add_response(response).await
|
||||
}
|
||||
|
||||
pub async fn stop(&self, hashes: &[String]) -> Result<(), QbError> {
|
||||
self.control(hashes, true).await
|
||||
}
|
||||
|
||||
pub async fn start(&self, hashes: &[String]) -> Result<(), QbError> {
|
||||
self.control(hashes, false).await
|
||||
}
|
||||
|
||||
async fn control(&self, hashes: &[String], stop: bool) -> Result<(), QbError> {
|
||||
let action = if stop { "stop" } else { "start" };
|
||||
let fallback = if stop { "pause" } else { "resume" };
|
||||
let form = vec![("hashes".to_string(), join_hashes(hashes))];
|
||||
|
||||
let result = self
|
||||
.post_form(&format!("/api/v2/torrents/{action}"), form.clone())
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Ok(()) => Ok(()),
|
||||
// qBittorrent 5.0 renamed pause/resume to stop/start (WebAPI
|
||||
// 2.11). If the server is older than reported, fall back once.
|
||||
Err(err) if err.status == Some(404) => {
|
||||
self.post_form(&format!("/api/v2/torrents/{fallback}"), form)
|
||||
.await
|
||||
}
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn delete(&self, hashes: &[String], delete_files: bool) -> Result<(), QbError> {
|
||||
let form = vec![
|
||||
("hashes".to_string(), join_hashes(hashes)),
|
||||
(
|
||||
"deleteFiles".to_string(),
|
||||
if delete_files { "true" } else { "false" }.to_string(),
|
||||
),
|
||||
];
|
||||
self.post_form("/api/v2/torrents/delete", form).await
|
||||
}
|
||||
|
||||
pub async fn set_category(&self, hashes: &[String], category: &str) -> Result<(), QbError> {
|
||||
let form = vec![
|
||||
("hashes".to_string(), join_hashes(hashes)),
|
||||
("category".to_string(), category.to_string()),
|
||||
];
|
||||
self.post_form("/api/v2/torrents/setCategory", form).await
|
||||
}
|
||||
|
||||
pub async fn sync(&self, rid: i64) -> Result<Value, QbError> {
|
||||
self.get_json(&format!("/api/v2/sync/maindata?rid={rid}"))
|
||||
.await
|
||||
}
|
||||
|
||||
/// Read a local `.torrent` file for upload.
|
||||
pub fn read_torrent_file(path: &str) -> Result<(String, Vec<u8>), QbError> {
|
||||
let path = Path::new(path);
|
||||
let name = path
|
||||
.file_name()
|
||||
.and_then(|name| name.to_str())
|
||||
.unwrap_or("torrent.torrent")
|
||||
.to_string();
|
||||
let metadata = std::fs::metadata(path)
|
||||
.map_err(|err| QbError::new("torrent", format!("Не удалось открыть файл: {err}")))?;
|
||||
if metadata.len() > 10 * 1024 * 1024 {
|
||||
return Err(QbError::new(
|
||||
"torrent",
|
||||
"Файл торрента больше 10 МБ — это не похоже на обычный .torrent",
|
||||
));
|
||||
}
|
||||
let bytes = std::fs::read(path)
|
||||
.map_err(|err| QbError::new("torrent", format!("Не удалось прочитать файл: {err}")))?;
|
||||
Ok((name, bytes))
|
||||
}
|
||||
}
|
||||
|
||||
async fn parse_add_response(response: Response) -> Result<QbAddResult, QbError> {
|
||||
let status = response.status();
|
||||
let text = response.text().await.unwrap_or_default();
|
||||
let trimmed = text.trim();
|
||||
|
||||
if status == StatusCode::UNSUPPORTED_MEDIA_TYPE {
|
||||
return Ok(QbAddResult::new(
|
||||
"invalid",
|
||||
Vec::new(),
|
||||
Some("qBittorrent не принял файл: это не корректный .torrent".to_string()),
|
||||
));
|
||||
}
|
||||
if status == StatusCode::CONFLICT {
|
||||
return Ok(QbAddResult::new(
|
||||
"duplicate",
|
||||
Vec::new(),
|
||||
Some("qBittorrent не добавил раздачу: она уже есть или отклонена".to_string()),
|
||||
));
|
||||
}
|
||||
if !status.is_success() {
|
||||
return Err(http_error(status));
|
||||
}
|
||||
|
||||
if trimmed.starts_with('{') {
|
||||
if let Ok(parsed) = serde_json::from_str::<QbAddResponse>(trimmed) {
|
||||
let hashes = parsed.added_torrent_ids.clone();
|
||||
if parsed.success_count > 0 {
|
||||
return Ok(QbAddResult::new("added", hashes, None));
|
||||
}
|
||||
if parsed.pending_count > 0 {
|
||||
return Ok(QbAddResult::new(
|
||||
"pending",
|
||||
hashes,
|
||||
Some("qBittorrent обрабатывает раздачу".to_string()),
|
||||
));
|
||||
}
|
||||
let message = if parsed.failure_count > 0 {
|
||||
format!(
|
||||
"qBittorrent не добавил раздачу (ошибок: {})",
|
||||
parsed.failure_count
|
||||
)
|
||||
} else {
|
||||
"qBittorrent не добавил раздачу: она уже есть или отклонена".to_string()
|
||||
};
|
||||
return Ok(QbAddResult::new("duplicate", hashes, Some(message)));
|
||||
}
|
||||
}
|
||||
|
||||
if trimmed.eq_ignore_ascii_case("Fails.") {
|
||||
return Ok(QbAddResult::new(
|
||||
"duplicate",
|
||||
Vec::new(),
|
||||
Some("qBittorrent не добавил раздачу: она уже есть или отклонена".to_string()),
|
||||
));
|
||||
}
|
||||
|
||||
Ok(QbAddResult::new("added", Vec::new(), None))
|
||||
}
|
||||
@@ -0,0 +1,546 @@
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
use serde_json::{Map, Value};
|
||||
use tauri::{AppHandle, Manager, State};
|
||||
|
||||
pub mod client;
|
||||
pub mod types;
|
||||
|
||||
use client::{normalize_base_url, AddTorrentInput, QbClient};
|
||||
use types::{
|
||||
QbAddRequest, QbAddResult, QbCategory, QbConnectionInfo, QbError, QbServerState,
|
||||
QbServerStateRaw, QbSettings, QbSnapshot, QbTorrent, QbTorrentRaw,
|
||||
};
|
||||
|
||||
const KEYRING_SERVICE: &str = "blink-qbittorrent";
|
||||
const KEYRING_USER: &str = "default";
|
||||
const SETTINGS_FILE: &str = "qbittorrent.json";
|
||||
|
||||
struct Inner {
|
||||
settings: QbSettings,
|
||||
/// Password or API key, kept in memory for this run even when the user
|
||||
/// chose not to write it to the OS keyring.
|
||||
secret: Option<String>,
|
||||
secret_saved: bool,
|
||||
/// Whether the OS keyring has already been queried in this run.
|
||||
secret_checked: bool,
|
||||
client: Option<QbClient>,
|
||||
torrents: HashMap<String, Value>,
|
||||
server_state: Value,
|
||||
rid: i64,
|
||||
synced: bool,
|
||||
}
|
||||
|
||||
impl Default for Inner {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
settings: QbSettings::default(),
|
||||
secret: None,
|
||||
secret_saved: false,
|
||||
secret_checked: false,
|
||||
client: None,
|
||||
torrents: HashMap::new(),
|
||||
server_state: Value::Null,
|
||||
rid: 0,
|
||||
synced: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct QbState {
|
||||
inner: Mutex<Inner>,
|
||||
}
|
||||
|
||||
impl QbState {
|
||||
pub fn load(app: &AppHandle) -> Self {
|
||||
// The OS keyring is intentionally not touched here: setup runs on the
|
||||
// main thread, and a slow Credential Manager/Keychain call must not
|
||||
// delay (or freeze) the window. The secret is loaded lazily by
|
||||
// `qb_get_settings` on the async runtime.
|
||||
Self {
|
||||
inner: Mutex::new(Inner {
|
||||
settings: read_settings(app),
|
||||
..Inner::default()
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
fn lock(&self) -> Result<MutexGuard<'_, Inner>, QbError> {
|
||||
self.inner
|
||||
.lock()
|
||||
.map_err(|_| QbError::new("internal", "Внутреннее состояние qBittorrent повреждено"))
|
||||
}
|
||||
}
|
||||
|
||||
fn keyring_entry() -> Result<keyring::Entry, QbError> {
|
||||
keyring::Entry::new(KEYRING_SERVICE, KEYRING_USER).map_err(|err| {
|
||||
QbError::new(
|
||||
"config",
|
||||
format!("Системное хранилище секретов недоступно: {err}"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn keyring_read() -> Option<String> {
|
||||
keyring_entry()
|
||||
.ok()
|
||||
.and_then(|entry| entry.get_password().ok())
|
||||
.filter(|secret| !secret.is_empty())
|
||||
}
|
||||
|
||||
fn keyring_write(secret: &str) -> bool {
|
||||
keyring_entry()
|
||||
.and_then(|entry| {
|
||||
entry.set_password(secret).map_err(|err| {
|
||||
QbError::new("config", format!("Не удалось сохранить секрет: {err}"))
|
||||
})
|
||||
})
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
fn keyring_delete() {
|
||||
if let Ok(entry) = keyring_entry() {
|
||||
let _ = entry.delete_credential();
|
||||
}
|
||||
}
|
||||
|
||||
fn settings_path(app: &AppHandle) -> Result<PathBuf, QbError> {
|
||||
let directory = app.path().app_config_dir().map_err(|err| {
|
||||
QbError::new(
|
||||
"config",
|
||||
format!("Не удалось определить каталог настроек: {err}"),
|
||||
)
|
||||
})?;
|
||||
std::fs::create_dir_all(&directory).map_err(|err| {
|
||||
QbError::new(
|
||||
"config",
|
||||
format!("Не удалось создать каталог настроек: {err}"),
|
||||
)
|
||||
})?;
|
||||
Ok(directory.join(SETTINGS_FILE))
|
||||
}
|
||||
|
||||
fn read_settings(app: &AppHandle) -> QbSettings {
|
||||
let Ok(path) = settings_path(app) else {
|
||||
return QbSettings::default();
|
||||
};
|
||||
let Ok(text) = std::fs::read_to_string(path) else {
|
||||
return QbSettings::default();
|
||||
};
|
||||
serde_json::from_str(&text).unwrap_or_default()
|
||||
}
|
||||
|
||||
fn write_settings(app: &AppHandle, settings: &QbSettings) -> Result<(), QbError> {
|
||||
let path = settings_path(app)?;
|
||||
let mut persisted = settings.clone();
|
||||
persisted.secret_saved = false;
|
||||
persisted.has_secret = false;
|
||||
let json = serde_json::to_string_pretty(&persisted)
|
||||
.map_err(|err| QbError::new("config", format!("Не удалось сохранить настройки: {err}")))?;
|
||||
std::fs::write(path, json)
|
||||
.map_err(|err| QbError::new("config", format!("Не удалось сохранить настройки: {err}")))
|
||||
}
|
||||
|
||||
fn public_settings(inner: &Inner) -> QbSettings {
|
||||
let mut settings = inner.settings.clone();
|
||||
settings.secret_saved = inner.secret_saved;
|
||||
settings.has_secret = inner.secret.is_some();
|
||||
settings
|
||||
}
|
||||
|
||||
fn reset_session(inner: &mut Inner) {
|
||||
inner.client = None;
|
||||
inner.torrents.clear();
|
||||
inner.server_state = Value::Null;
|
||||
inner.rid = 0;
|
||||
inner.synced = false;
|
||||
}
|
||||
|
||||
fn merge_json(base: &mut Value, patch: &Value) {
|
||||
if let (Some(base), Some(patch)) = (base.as_object_mut(), patch.as_object()) {
|
||||
for (key, value) in patch {
|
||||
base.insert(key.clone(), value.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_sync(inner: &mut Inner, data: &Value) {
|
||||
let full_update = data
|
||||
.get("full_update")
|
||||
.and_then(Value::as_bool)
|
||||
.unwrap_or(false);
|
||||
if full_update {
|
||||
inner.torrents.clear();
|
||||
inner.server_state = Value::Null;
|
||||
}
|
||||
|
||||
if let Some(torrents) = data.get("torrents").and_then(Value::as_object) {
|
||||
for (hash, patch) in torrents {
|
||||
if !patch.is_object() {
|
||||
continue;
|
||||
}
|
||||
let entry = inner
|
||||
.torrents
|
||||
.entry(hash.clone())
|
||||
.or_insert_with(|| Value::Object(Map::new()));
|
||||
merge_json(entry, patch);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(removed) = data.get("torrents_removed").and_then(Value::as_array) {
|
||||
for hash in removed {
|
||||
if let Some(hash) = hash.as_str() {
|
||||
inner.torrents.remove(hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(server_state) = data.get("server_state") {
|
||||
if server_state.is_object() {
|
||||
if inner.server_state.is_null() {
|
||||
inner.server_state = Value::Object(Map::new());
|
||||
}
|
||||
merge_json(&mut inner.server_state, server_state);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(rid) = data.get("rid").and_then(Value::as_i64) {
|
||||
inner.rid = rid;
|
||||
}
|
||||
inner.synced = true;
|
||||
}
|
||||
|
||||
fn snapshot(inner: &Inner) -> QbSnapshot {
|
||||
let mut torrents: Vec<QbTorrent> = inner
|
||||
.torrents
|
||||
.iter()
|
||||
.filter(|(_, value)| value.is_object())
|
||||
.map(|(hash, value)| QbTorrent::from(QbTorrentRaw::from_value(value, hash)))
|
||||
.collect();
|
||||
// Newest first; the UI groups by state on top of that.
|
||||
torrents.sort_by(|left, right| right.added_on.cmp(&left.added_on));
|
||||
|
||||
let server_state = QbServerState::from(QbServerStateRaw::from_value(&inner.server_state));
|
||||
QbSnapshot {
|
||||
torrents,
|
||||
server_state,
|
||||
synced: inner.synced,
|
||||
}
|
||||
}
|
||||
|
||||
async fn client_and_settings(state: &QbState) -> Result<(QbClient, QbSettings), QbError> {
|
||||
let (settings, secret, cached) = {
|
||||
let inner = state.lock()?;
|
||||
(
|
||||
inner.settings.clone(),
|
||||
inner.secret.clone(),
|
||||
inner.client.clone(),
|
||||
)
|
||||
};
|
||||
|
||||
if let Some(client) = cached {
|
||||
return Ok((client, settings));
|
||||
}
|
||||
|
||||
let secret = secret.ok_or_else(|| {
|
||||
QbError::new(
|
||||
"auth",
|
||||
"Пароль qBittorrent не задан. Откройте «Настройки → Загрузки».",
|
||||
)
|
||||
})?;
|
||||
|
||||
let client = QbClient::connect(&settings, &secret).await?;
|
||||
{
|
||||
let mut inner = state.lock()?;
|
||||
// Another command may have connected while this one awaited.
|
||||
if inner.client.is_none() {
|
||||
inner.client = Some(client.clone());
|
||||
}
|
||||
}
|
||||
Ok((client, settings))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_get_settings(state: State<'_, QbState>) -> Result<QbSettings, QbError> {
|
||||
let should_read = {
|
||||
let inner = state.lock()?;
|
||||
inner.secret.is_none() && inner.settings.remember_secret && !inner.secret_checked
|
||||
};
|
||||
|
||||
if should_read {
|
||||
{
|
||||
let mut inner = state.lock()?;
|
||||
inner.secret_checked = true;
|
||||
}
|
||||
let stored = tauri::async_runtime::spawn_blocking(keyring_read)
|
||||
.await
|
||||
.unwrap_or(None);
|
||||
if let Some(secret) = stored {
|
||||
let mut inner = state.lock()?;
|
||||
if inner.secret.is_none() {
|
||||
inner.secret = Some(secret);
|
||||
inner.secret_saved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let inner = state.lock()?;
|
||||
Ok(public_settings(&inner))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_save_settings(
|
||||
app: AppHandle,
|
||||
state: State<'_, QbState>,
|
||||
mut settings: QbSettings,
|
||||
secret: Option<String>,
|
||||
) -> Result<QbSettings, QbError> {
|
||||
settings.base_url = normalize_base_url(&settings.base_url)?;
|
||||
settings.username = settings.username.trim().to_string();
|
||||
settings.poll_interval_ms = settings.poll_interval_ms.clamp(1000, 60_000);
|
||||
settings.default_category = settings.default_category.trim().to_string();
|
||||
|
||||
let new_secret = secret.and_then(|value| {
|
||||
let value = value.trim().to_string();
|
||||
if value.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(value)
|
||||
}
|
||||
});
|
||||
let secret_changed = new_secret.is_some();
|
||||
let remember_secret = settings.remember_secret;
|
||||
|
||||
// Never call the OS keyring (or write files) while holding the state
|
||||
// mutex: Credential Manager can block for seconds or show a system prompt,
|
||||
// and every other qB command would queue behind it.
|
||||
let secret_for_keyring = {
|
||||
let mut inner = state.lock()?;
|
||||
inner.secret_checked = true;
|
||||
if let Some(secret) = new_secret {
|
||||
inner.secret = Some(secret);
|
||||
}
|
||||
|
||||
let connection_changed = inner.settings.base_url != settings.base_url
|
||||
|| inner.settings.username != settings.username
|
||||
|| inner.settings.use_api_key != settings.use_api_key
|
||||
|| inner.settings.allow_invalid_certs != settings.allow_invalid_certs;
|
||||
|
||||
inner.settings = settings.clone();
|
||||
if connection_changed || secret_changed {
|
||||
reset_session(&mut inner);
|
||||
}
|
||||
inner.secret.clone()
|
||||
};
|
||||
|
||||
let keyring_result = tauri::async_runtime::spawn_blocking(move || {
|
||||
if remember_secret {
|
||||
secret_for_keyring
|
||||
.as_deref()
|
||||
.map(keyring_write)
|
||||
.unwrap_or(false)
|
||||
} else {
|
||||
keyring_delete();
|
||||
false
|
||||
}
|
||||
})
|
||||
.await
|
||||
.map_err(|err| {
|
||||
QbError::new(
|
||||
"internal",
|
||||
format!("Не удалось выполнить операцию с секретом: {err}"),
|
||||
)
|
||||
})?;
|
||||
|
||||
{
|
||||
let mut inner = state.lock()?;
|
||||
inner.secret_saved = keyring_result;
|
||||
}
|
||||
|
||||
write_settings(&app, &settings)?;
|
||||
let inner = state.lock()?;
|
||||
Ok(public_settings(&inner))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_forget_secret(
|
||||
app: AppHandle,
|
||||
state: State<'_, QbState>,
|
||||
) -> Result<QbSettings, QbError> {
|
||||
let settings = {
|
||||
let mut inner = state.lock()?;
|
||||
inner.secret = None;
|
||||
inner.secret_saved = false;
|
||||
inner.secret_checked = true;
|
||||
reset_session(&mut inner);
|
||||
inner.settings.clone()
|
||||
};
|
||||
|
||||
tauri::async_runtime::spawn_blocking(keyring_delete)
|
||||
.await
|
||||
.map_err(|err| {
|
||||
QbError::new(
|
||||
"internal",
|
||||
format!("Не удалось удалить сохранённый секрет: {err}"),
|
||||
)
|
||||
})?;
|
||||
|
||||
write_settings(&app, &settings)?;
|
||||
let inner = state.lock()?;
|
||||
Ok(public_settings(&inner))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_test_connection(
|
||||
state: State<'_, QbState>,
|
||||
mut settings: QbSettings,
|
||||
secret: Option<String>,
|
||||
) -> Result<QbConnectionInfo, QbError> {
|
||||
settings.base_url = normalize_base_url(&settings.base_url)?;
|
||||
|
||||
let provided = secret.and_then(|value| {
|
||||
let value = value.trim().to_string();
|
||||
if value.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(value)
|
||||
}
|
||||
});
|
||||
let secret = match provided {
|
||||
Some(secret) => secret,
|
||||
None => state.lock()?.secret.clone().ok_or_else(|| {
|
||||
QbError::new(
|
||||
"auth",
|
||||
"Введите пароль qBittorrent (или API-ключ), чтобы проверить соединение",
|
||||
)
|
||||
})?,
|
||||
};
|
||||
|
||||
let client = QbClient::connect(&settings, &secret).await?;
|
||||
client.connection_info().await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_categories(state: State<'_, QbState>) -> Result<Vec<QbCategory>, QbError> {
|
||||
let (client, _settings) = client_and_settings(&state).await?;
|
||||
client.categories().await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_add_torrent(
|
||||
state: State<'_, QbState>,
|
||||
request: QbAddRequest,
|
||||
) -> Result<QbAddResult, QbError> {
|
||||
let magnet = request
|
||||
.magnet
|
||||
.map(|value| value.trim().to_string())
|
||||
.filter(|value| !value.is_empty());
|
||||
let file_path = request
|
||||
.file_path
|
||||
.map(|value| value.trim().to_string())
|
||||
.filter(|value| !value.is_empty());
|
||||
|
||||
if magnet.is_some() && file_path.is_some() {
|
||||
return Err(QbError::config(
|
||||
"Выберите что-то одно: magnet-ссылку или .torrent файл",
|
||||
));
|
||||
}
|
||||
if magnet.is_none() && file_path.is_none() {
|
||||
return Err(QbError::config(
|
||||
"Вставьте magnet-ссылку или выберите .torrent",
|
||||
));
|
||||
}
|
||||
if let Some(magnet) = magnet.as_deref() {
|
||||
if !magnet.starts_with("magnet:?") {
|
||||
return Err(QbError::config("Ссылка не похожа на magnet-ссылку"));
|
||||
}
|
||||
}
|
||||
|
||||
let (file_name, file_bytes) = match file_path.as_deref() {
|
||||
Some(path) => {
|
||||
let (name, bytes) = QbClient::read_torrent_file(path)?;
|
||||
(Some(name), Some(bytes))
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
||||
let (client, settings) = client_and_settings(&state).await?;
|
||||
let category = request
|
||||
.category
|
||||
.map(|value| value.trim().to_string())
|
||||
.filter(|value| !value.is_empty())
|
||||
.or_else(|| {
|
||||
let default = settings.default_category.trim().to_string();
|
||||
if default.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(default)
|
||||
}
|
||||
});
|
||||
|
||||
let result = client
|
||||
.add_torrent(AddTorrentInput {
|
||||
magnet,
|
||||
file_name,
|
||||
file_bytes,
|
||||
category,
|
||||
paused: request.paused.unwrap_or(settings.add_paused),
|
||||
auto_tmm: request.auto_tmm.unwrap_or(settings.auto_tmm),
|
||||
})
|
||||
.await?;
|
||||
|
||||
// The torrent list is now stale; the next poll would receive an empty diff
|
||||
// if we kept the old rid. Force a full update.
|
||||
if result.status == "added" || result.status == "pending" {
|
||||
let mut inner = state.lock()?;
|
||||
inner.rid = 0;
|
||||
inner.synced = false;
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_poll(state: State<'_, QbState>) -> Result<QbSnapshot, QbError> {
|
||||
let (client, _settings) = client_and_settings(&state).await?;
|
||||
let rid = state.lock()?.rid;
|
||||
let data = client.sync(rid).await?;
|
||||
|
||||
let mut inner = state.lock()?;
|
||||
apply_sync(&mut inner, &data);
|
||||
Ok(snapshot(&inner))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_pause(state: State<'_, QbState>, hashes: Vec<String>) -> Result<(), QbError> {
|
||||
let (client, _settings) = client_and_settings(&state).await?;
|
||||
client.stop(&hashes).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_resume(state: State<'_, QbState>, hashes: Vec<String>) -> Result<(), QbError> {
|
||||
let (client, _settings) = client_and_settings(&state).await?;
|
||||
client.start(&hashes).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_delete(
|
||||
state: State<'_, QbState>,
|
||||
hashes: Vec<String>,
|
||||
delete_files: bool,
|
||||
) -> Result<(), QbError> {
|
||||
let (client, _settings) = client_and_settings(&state).await?;
|
||||
client.delete(&hashes, delete_files).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn qb_set_category(
|
||||
state: State<'_, QbState>,
|
||||
hashes: Vec<String>,
|
||||
category: String,
|
||||
) -> Result<(), QbError> {
|
||||
let (client, _settings) = client_and_settings(&state).await?;
|
||||
client.set_category(&hashes, category.trim()).await
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// qBittorrent connection settings.
|
||||
///
|
||||
/// Stored as `qbittorrent.json` in the app config directory. The password (or
|
||||
/// API key) is never part of this struct: it lives in the OS secret store and
|
||||
/// only its presence is reported back to the UI.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct QbSettings {
|
||||
pub base_url: String,
|
||||
pub username: String,
|
||||
/// `true` when the secret is a qBittorrent API key (WebAPI 2.17+) instead
|
||||
/// of the WebUI password.
|
||||
pub use_api_key: bool,
|
||||
/// Persist the secret in the OS keyring.
|
||||
pub remember_secret: bool,
|
||||
pub default_category: String,
|
||||
/// Pass `autoTMM=true` when adding a torrent, so the category save path is
|
||||
/// honoured.
|
||||
pub auto_tmm: bool,
|
||||
pub add_paused: bool,
|
||||
pub allow_invalid_certs: bool,
|
||||
pub refresh_jellyfin: bool,
|
||||
pub notify_on_complete: bool,
|
||||
pub poll_interval_ms: u64,
|
||||
/// Read-only flags for the UI; recomputed on every load/save.
|
||||
#[serde(default)]
|
||||
pub secret_saved: bool,
|
||||
#[serde(default)]
|
||||
pub has_secret: bool,
|
||||
}
|
||||
|
||||
impl Default for QbSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
base_url: "http://127.0.0.1:8080".to_string(),
|
||||
username: "admin".to_string(),
|
||||
use_api_key: false,
|
||||
remember_secret: false,
|
||||
default_category: String::new(),
|
||||
auto_tmm: true,
|
||||
add_paused: false,
|
||||
allow_invalid_certs: false,
|
||||
refresh_jellyfin: false,
|
||||
notify_on_complete: true,
|
||||
poll_interval_ms: 2000,
|
||||
secret_saved: false,
|
||||
has_secret: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct QbCategory {
|
||||
pub name: String,
|
||||
pub save_path: String,
|
||||
pub download_path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct QbTorrentRaw {
|
||||
pub hash: String,
|
||||
pub name: String,
|
||||
pub category: String,
|
||||
pub size: i64,
|
||||
pub completed: i64,
|
||||
pub downloaded: i64,
|
||||
pub progress: f64,
|
||||
pub dlspeed: i64,
|
||||
pub upspeed: i64,
|
||||
pub eta: i64,
|
||||
pub state: String,
|
||||
pub save_path: String,
|
||||
pub content_path: String,
|
||||
pub added_on: i64,
|
||||
pub completion_on: i64,
|
||||
pub ratio: f64,
|
||||
pub num_seeds: i64,
|
||||
pub num_leechs: i64,
|
||||
pub error: Option<String>,
|
||||
pub tags: String,
|
||||
pub seeding_time: i64,
|
||||
pub time_active: i64,
|
||||
pub amount_left: i64,
|
||||
pub tracker: String,
|
||||
}
|
||||
|
||||
impl QbTorrentRaw {
|
||||
/// `hash` is the key of the `sync/maindata` torrents map; qBittorrent does
|
||||
/// not repeat it inside the value.
|
||||
pub fn from_value(value: &serde_json::Value, hash: &str) -> Self {
|
||||
let text = |key: &str| -> String {
|
||||
value
|
||||
.get(key)
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.unwrap_or_default()
|
||||
.to_string()
|
||||
};
|
||||
let number = |key: &str| -> i64 {
|
||||
value
|
||||
.get(key)
|
||||
.and_then(serde_json::Value::as_i64)
|
||||
.unwrap_or_default()
|
||||
};
|
||||
let float = |key: &str| -> f64 {
|
||||
value
|
||||
.get(key)
|
||||
.and_then(serde_json::Value::as_f64)
|
||||
.unwrap_or_default()
|
||||
};
|
||||
|
||||
Self {
|
||||
hash: hash.to_string(),
|
||||
name: text("name"),
|
||||
category: text("category"),
|
||||
size: number("size"),
|
||||
completed: number("completed"),
|
||||
downloaded: number("downloaded"),
|
||||
progress: float("progress"),
|
||||
dlspeed: number("dlspeed"),
|
||||
upspeed: number("upspeed"),
|
||||
eta: number("eta"),
|
||||
state: text("state"),
|
||||
save_path: text("save_path"),
|
||||
content_path: text("content_path"),
|
||||
added_on: number("added_on"),
|
||||
completion_on: number("completion_on"),
|
||||
ratio: float("ratio"),
|
||||
num_seeds: number("num_seeds"),
|
||||
num_leechs: number("num_leechs"),
|
||||
error: value
|
||||
.get("error")
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.filter(|message| !message.is_empty())
|
||||
.map(str::to_string),
|
||||
tags: text("tags"),
|
||||
seeding_time: number("seeding_time"),
|
||||
time_active: number("time_active"),
|
||||
amount_left: number("amount_left"),
|
||||
tracker: text("tracker"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QbTorrent {
|
||||
pub hash: String,
|
||||
pub name: String,
|
||||
pub category: String,
|
||||
pub size: i64,
|
||||
pub completed: i64,
|
||||
pub downloaded: i64,
|
||||
pub progress: f64,
|
||||
pub dlspeed: i64,
|
||||
pub upspeed: i64,
|
||||
pub eta: i64,
|
||||
pub state: String,
|
||||
pub save_path: String,
|
||||
pub content_path: String,
|
||||
pub added_on: i64,
|
||||
pub completion_on: i64,
|
||||
pub ratio: f64,
|
||||
pub num_seeds: i64,
|
||||
pub num_leechs: i64,
|
||||
pub error: Option<String>,
|
||||
pub tags: String,
|
||||
pub seeding_time: i64,
|
||||
pub time_active: i64,
|
||||
pub amount_left: i64,
|
||||
pub tracker: String,
|
||||
}
|
||||
|
||||
impl From<QbTorrentRaw> for QbTorrent {
|
||||
fn from(raw: QbTorrentRaw) -> Self {
|
||||
Self {
|
||||
hash: raw.hash,
|
||||
name: raw.name,
|
||||
category: raw.category,
|
||||
size: raw.size,
|
||||
completed: raw.completed,
|
||||
downloaded: raw.downloaded,
|
||||
progress: raw.progress,
|
||||
dlspeed: raw.dlspeed,
|
||||
upspeed: raw.upspeed,
|
||||
eta: raw.eta,
|
||||
state: raw.state,
|
||||
save_path: raw.save_path,
|
||||
content_path: raw.content_path,
|
||||
added_on: raw.added_on,
|
||||
completion_on: raw.completion_on,
|
||||
ratio: raw.ratio,
|
||||
num_seeds: raw.num_seeds,
|
||||
num_leechs: raw.num_leechs,
|
||||
error: raw.error,
|
||||
tags: raw.tags,
|
||||
seeding_time: raw.seeding_time,
|
||||
time_active: raw.time_active,
|
||||
amount_left: raw.amount_left,
|
||||
tracker: raw.tracker,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct QbServerStateRaw {
|
||||
pub dl_info_speed: i64,
|
||||
pub up_info_speed: i64,
|
||||
pub dl_info_data: i64,
|
||||
pub up_info_data: i64,
|
||||
pub free_space_on_disk: i64,
|
||||
pub connection_status: String,
|
||||
pub queueing: bool,
|
||||
pub dht_nodes: i64,
|
||||
}
|
||||
|
||||
impl QbServerStateRaw {
|
||||
pub fn from_value(value: &serde_json::Value) -> Self {
|
||||
let number = |key: &str| -> i64 {
|
||||
value
|
||||
.get(key)
|
||||
.and_then(serde_json::Value::as_i64)
|
||||
.unwrap_or_default()
|
||||
};
|
||||
let text = |key: &str| -> String {
|
||||
value
|
||||
.get(key)
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.unwrap_or_default()
|
||||
.to_string()
|
||||
};
|
||||
|
||||
Self {
|
||||
dl_info_speed: number("dl_info_speed"),
|
||||
up_info_speed: number("up_info_speed"),
|
||||
dl_info_data: number("dl_info_data"),
|
||||
up_info_data: number("up_info_data"),
|
||||
free_space_on_disk: number("free_space_on_disk"),
|
||||
connection_status: text("connection_status"),
|
||||
queueing: value
|
||||
.get("queueing")
|
||||
.and_then(serde_json::Value::as_bool)
|
||||
.unwrap_or_default(),
|
||||
dht_nodes: number("dht_nodes"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QbServerState {
|
||||
pub dl_info_speed: i64,
|
||||
pub up_info_speed: i64,
|
||||
pub dl_info_data: i64,
|
||||
pub up_info_data: i64,
|
||||
pub free_space_on_disk: i64,
|
||||
pub connection_status: String,
|
||||
pub queueing: bool,
|
||||
pub dht_nodes: i64,
|
||||
}
|
||||
|
||||
impl From<QbServerStateRaw> for QbServerState {
|
||||
fn from(raw: QbServerStateRaw) -> Self {
|
||||
Self {
|
||||
dl_info_speed: raw.dl_info_speed,
|
||||
up_info_speed: raw.up_info_speed,
|
||||
dl_info_data: raw.dl_info_data,
|
||||
up_info_data: raw.up_info_data,
|
||||
free_space_on_disk: raw.free_space_on_disk,
|
||||
connection_status: raw.connection_status,
|
||||
queueing: raw.queueing,
|
||||
dht_nodes: raw.dht_nodes,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QbSnapshot {
|
||||
pub torrents: Vec<QbTorrent>,
|
||||
pub server_state: QbServerState,
|
||||
pub synced: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QbAddResult {
|
||||
/// `added`, `pending`, `duplicate` or `invalid`.
|
||||
pub status: String,
|
||||
pub added_hashes: Vec<String>,
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
impl QbAddResult {
|
||||
pub fn new(status: &str, added_hashes: Vec<String>, message: Option<String>) -> Self {
|
||||
Self {
|
||||
status: status.to_string(),
|
||||
added_hashes,
|
||||
message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QbConnectionInfo {
|
||||
pub app_version: String,
|
||||
pub api_version: String,
|
||||
pub default_save_path: String,
|
||||
}
|
||||
|
||||
/// Error returned by every qBittorrent command.
|
||||
///
|
||||
/// `kind` is a stable machine-readable value:
|
||||
/// `unreachable`, `auth`, `banned`, `tls`, `duplicate`, `torrent`, `http`,
|
||||
/// `config` or `internal`.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QbError {
|
||||
pub kind: String,
|
||||
pub message: String,
|
||||
pub status: Option<u16>,
|
||||
}
|
||||
|
||||
impl QbError {
|
||||
pub fn new(kind: &str, message: impl Into<String>) -> Self {
|
||||
Self {
|
||||
kind: kind.to_string(),
|
||||
message: message.into(),
|
||||
status: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_status(kind: &str, message: impl Into<String>, status: u16) -> Self {
|
||||
Self {
|
||||
kind: kind.to_string(),
|
||||
message: message.into(),
|
||||
status: Some(status),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn config(message: impl Into<String>) -> Self {
|
||||
Self::new("config", message)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QbAddRequest {
|
||||
pub magnet: Option<String>,
|
||||
pub file_path: Option<String>,
|
||||
pub category: Option<String>,
|
||||
pub paused: Option<bool>,
|
||||
pub auto_tmm: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Default)]
|
||||
pub struct QbAddResponse {
|
||||
#[serde(default)]
|
||||
pub success_count: i64,
|
||||
#[serde(default)]
|
||||
pub pending_count: i64,
|
||||
#[serde(default)]
|
||||
pub failure_count: i64,
|
||||
#[serde(default)]
|
||||
pub added_torrent_ids: Vec<String>,
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"build": {
|
||||
"beforeBuildCommand": "pnpm run build",
|
||||
"beforeDevCommand": "pnpm run dev",
|
||||
@@ -55,11 +54,19 @@
|
||||
"version": "../package.json",
|
||||
"identifier": "com.blink.prayag17",
|
||||
"plugins": {
|
||||
"deep-link": {
|
||||
"desktop": {
|
||||
"schemes": ["blink"]
|
||||
}
|
||||
},
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEMTg0MjEzRDYzRjJDN0EKUldSNkxEL1dFMElZL1dxbHA0V2lyVDFEdGpOZXkxMG9XdHVLVnRpVVV5c1Z0OFNRUE45dkpxbFAK",
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZBOTJGNzM3REU2Q0JEMEYKUldRUHZXemVOL2VTK2k2andMWTZYbEN6SnIwV0V0L2Z3NlA4RzFabThPaXRqSFRMc004WGhCb2kK",
|
||||
"endpoints": [
|
||||
"https://rawcdn.githack.com/prayag17/Blink/refs/heads/main/latest.json"
|
||||
]
|
||||
],
|
||||
"windows": {
|
||||
"installMode": "passive"
|
||||
}
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
@@ -74,11 +81,20 @@
|
||||
"center": true,
|
||||
"label": "main",
|
||||
"dragDropEnabled": false,
|
||||
"backgroundColor": "#08001f"
|
||||
"backgroundColor": "#08001f",
|
||||
"transparent": false,
|
||||
"titleBarStyle": "Overlay",
|
||||
"hiddenTitle": true,
|
||||
"trafficLightPosition": { "x": 18, "y": 31 }
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
"csp": null,
|
||||
"capabilities": [
|
||||
"desktop-capability",
|
||||
"main-capabilities",
|
||||
"migrated"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"app": {
|
||||
"withGlobalTauri": true,
|
||||
"security": {
|
||||
"capabilities": [
|
||||
"desktop-capability",
|
||||
"main-capabilities",
|
||||
"migrated",
|
||||
"mcp-bridge-capability"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
Copyright 2026 The Medeo Project Authors (https://github.com/DNFDEVS/medeo-font)
|
||||
Copyright 2024-2026 The Geist Project Authors (https://github.com/vercel/geist-font)
|
||||
Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||
Copyright (c) 2010, ParaType Ltd. (http://www.paratype.com/public),
|
||||
with Reserved Font Names "PT Sans", "PT Serif" and "ParaType".
|
||||
Copyright 2012 Google Inc. (Noto Serif Display)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Medeo
|
||||
|
||||
Local copy of the Medeo variable web fonts used throughout Blink.
|
||||
|
||||
- Source: https://github.com/DNFDEVS/medeo-font
|
||||
- Version: 1.1.0 (font version 1.100)
|
||||
- Sans: `MedeoSansVariable.woff2`, `MedeoSansVariable-Italic.woff2`
|
||||
- Mono: `MedeoMonoVariable.woff2`, `MedeoMonoVariable-Italic.woff2`
|
||||
- License: SIL Open Font License 1.1, see `OFL.txt`
|
||||
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
Before Width: | Height: | Size: 89 KiB |
@@ -0,0 +1,193 @@
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Dialog,
|
||||
InputBase,
|
||||
Stack,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { enqueueSnackbar } from "notistack";
|
||||
import React, { useState } from "react";
|
||||
import { setServer } from "@/utils/storage/servers";
|
||||
import { jellyfin } from "@/utils/store/api";
|
||||
|
||||
type AddServerDialogProps = {
|
||||
open: boolean;
|
||||
setAddServerDialog: (value: boolean) => void;
|
||||
sideEffect?: () => Promise<unknown>;
|
||||
hideBackdrop?: boolean;
|
||||
};
|
||||
|
||||
export default function AddServerDialog(props: AddServerDialogProps) {
|
||||
const { open, setAddServerDialog, sideEffect, hideBackdrop } = props;
|
||||
|
||||
const [serverIp, setServerIp] = useState("");
|
||||
const addServer = useMutation({
|
||||
mutationKey: ["add-server"],
|
||||
mutationFn: async () => {
|
||||
const servers =
|
||||
await jellyfin.discovery.getRecommendedServerCandidates(serverIp);
|
||||
const bestServer = jellyfin.discovery.findBestServer(servers);
|
||||
return bestServer;
|
||||
},
|
||||
onSuccess: async (bestServer) => {
|
||||
if (bestServer) {
|
||||
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
||||
setAddServerDialog(false);
|
||||
enqueueSnackbar(
|
||||
"Сервер добавлен. Возможно, потребуется обновить список серверов.",
|
||||
{
|
||||
variant: "success",
|
||||
},
|
||||
);
|
||||
if (sideEffect) {
|
||||
await sideEffect();
|
||||
}
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
console.error(err);
|
||||
enqueueSnackbar(`${err}`, { variant: "error" });
|
||||
enqueueSnackbar("Что-то пошло не так", { variant: "error" });
|
||||
},
|
||||
onSettled: async (bestServer) => {
|
||||
if (!bestServer) {
|
||||
enqueueSnackbar("Указанный адрес не является сервером Jellyfin.", {
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
onClose={() => setAddServerDialog(false)}
|
||||
hideBackdrop={Boolean(hideBackdrop)}
|
||||
fullWidth
|
||||
maxWidth="sm"
|
||||
disableScrollLock={true}
|
||||
slotProps={{
|
||||
paper: {
|
||||
sx: {
|
||||
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
||||
backdropFilter: "blur(24px) saturate(180%)",
|
||||
backgroundImage:
|
||||
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
||||
border: "1px solid rgba(255, 255, 255, 0.08)",
|
||||
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
||||
borderRadius: 4,
|
||||
overflow: "hidden",
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
spacing={3}
|
||||
sx={{
|
||||
p: 4,
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
spacing={1}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
fontSize: "48px",
|
||||
color: "var(--mui-palette-primary-main)",
|
||||
}}
|
||||
>
|
||||
add_to_queue
|
||||
</span>
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{
|
||||
fontWeight: "bold",
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
Подключиться к серверу
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="body2"
|
||||
sx={{
|
||||
color: "text.secondary",
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
Введите адрес сервера Jellyfin, чтобы продолжить
|
||||
</Typography>
|
||||
</Stack>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
p: "2px 16px",
|
||||
bgcolor: "rgba(0,0,0,0.2)",
|
||||
borderRadius: 2,
|
||||
border: "1px solid",
|
||||
borderColor: "rgba(255,255,255,0.05)",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 2,
|
||||
"&:focus-within": {
|
||||
borderColor: "var(--mui-palette-primary-main)",
|
||||
bgcolor: "rgba(0,0,0,0.3)",
|
||||
},
|
||||
transition: "border-color 0.2s, background-color 0.2s",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded" style={{ opacity: 0.5 }}>
|
||||
dns
|
||||
</span>
|
||||
<InputBase
|
||||
placeholder="https://jellyfin.example.com"
|
||||
fullWidth
|
||||
value={serverIp}
|
||||
onChange={(e) => setServerIp(e.target.value)}
|
||||
sx={{ py: 1.5 }}
|
||||
autoFocus
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
addServer.mutate();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={2}
|
||||
sx={{
|
||||
justifyContent: "flex-end",
|
||||
pt: 1,
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
onClick={() => setAddServerDialog(false)}
|
||||
color="inherit"
|
||||
variant="text"
|
||||
sx={{ borderRadius: 2 }}
|
||||
>
|
||||
Отмена
|
||||
</Button>
|
||||
<LoadingButton
|
||||
loading={addServer.isPending}
|
||||
onClick={() => addServer.mutate()}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
sx={{ borderRadius: 2, px: 3 }}
|
||||
disabled={!serverIp}
|
||||
>
|
||||
Подключиться
|
||||
</LoadingButton>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
.album-track {
|
||||
display: grid;
|
||||
grid-template-columns: 2.4em minmax(0, 1fr) 4.5em 2.6em;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding: 0.5em 1em;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background $transition-time-fast;
|
||||
|
||||
&-index {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
&-number {
|
||||
font-size: 0.8rem;
|
||||
color: rgb(255 255 255 / 0.4);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&-play {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(0.9);
|
||||
opacity: 0;
|
||||
font-size: 1.4rem;
|
||||
color: #fff;
|
||||
transition: opacity $transition-time-fast, transform $transition-time-fast;
|
||||
}
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15em;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-name {
|
||||
font-size: 0.95rem;
|
||||
color: rgb(255 255 255 / 0.92);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-artist {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
font-size: 0.78rem;
|
||||
color: rgb(255 255 255 / 0.45);
|
||||
|
||||
img {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
&-duration {
|
||||
text-align: right;
|
||||
font-size: 0.8rem;
|
||||
color: rgb(255 255 255 / 0.45);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&-like {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-fast;
|
||||
|
||||
.MuiIconButton-root {
|
||||
padding: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
|
||||
.album-track-number {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.album-track-play {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
|
||||
.album-track-like {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-playing {
|
||||
background: rgb(245 25 107 / 0.1);
|
||||
|
||||
.album-track-name,
|
||||
.album-track-number,
|
||||
.album-track-duration {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
|
||||
.album-track-like {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
import type {
|
||||
BaseItemDto,
|
||||
BaseItemDtoQueryResult,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import React from "react";
|
||||
import { useSnackbar } from "notistack";
|
||||
import lyricsIcon from "../../assets/icons/lyrics.svg";
|
||||
import { getRuntimeMusic } from "@/utils/date/time";
|
||||
import {
|
||||
generateAudioStreamUrl,
|
||||
playAudio,
|
||||
useAudioPlayback,
|
||||
} from "@/utils/store/audioPlayback";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { setQueue } from "@/utils/store/queue";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
|
||||
import "./albumMusicTrack.scss";
|
||||
|
||||
type AlbumMusicTrackProps = {
|
||||
track: BaseItemDto;
|
||||
/**
|
||||
* This is the index of the track in the musicTracks array (not to be confused with IndexNumber property of the track)
|
||||
*/
|
||||
trackIndex: number;
|
||||
musicTracks: BaseItemDtoQueryResult | null;
|
||||
};
|
||||
|
||||
export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
|
||||
const { track, musicTracks, trackIndex } = props;
|
||||
const [currentPlayingItem] = useAudioPlayback((state) => [state.item]);
|
||||
|
||||
const user = useCentralStore((state) => state.currentUser);
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const handlePlayback = (
|
||||
index: number,
|
||||
item: BaseItemDto,
|
||||
queue: BaseItemDto[],
|
||||
) => {
|
||||
if (!user?.Id || !api) {
|
||||
console.error("User not logged in");
|
||||
enqueueSnackbar("Войдите, чтобы слушать музыку", {
|
||||
variant: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (item.Id) {
|
||||
const url = generateAudioStreamUrl(
|
||||
item.Id,
|
||||
user.Id,
|
||||
api.deviceInfo.id,
|
||||
api.basePath,
|
||||
api.accessToken,
|
||||
);
|
||||
playAudio(url, item);
|
||||
setQueue(queue, index);
|
||||
}
|
||||
};
|
||||
|
||||
const isPlaying = currentPlayingItem?.Id === track.Id;
|
||||
const artists = track.Artists?.filter(Boolean) ?? [];
|
||||
|
||||
return (
|
||||
<div
|
||||
className={isPlaying ? "album-track is-playing" : "album-track"}
|
||||
onClick={() => {
|
||||
if (musicTracks?.Items) {
|
||||
handlePlayback(trackIndex, track, musicTracks.Items);
|
||||
}
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
if (musicTracks?.Items) {
|
||||
handlePlayback(trackIndex, track, musicTracks.Items);
|
||||
}
|
||||
}
|
||||
}}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-label={track.Name ?? "Трек"}
|
||||
>
|
||||
<div className="album-track-index">
|
||||
<span className="material-symbols-rounded album-track-play">
|
||||
play_arrow
|
||||
</span>
|
||||
<span className="album-track-number">
|
||||
{track.IndexNumber ?? "–"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="album-track-info">
|
||||
<span className="album-track-name">{track.Name}</span>
|
||||
{(artists.length > 0 || track.HasLyrics) && (
|
||||
<span className="album-track-artist">
|
||||
{track.HasLyrics && (
|
||||
<img src={lyricsIcon} alt="Есть текст песни" />
|
||||
)}
|
||||
{artists.join(", ")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<span className="album-track-duration">
|
||||
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||
</span>
|
||||
<div className="album-track-like" onClick={(e) => e.stopPropagation()}>
|
||||
<LikeButton
|
||||
itemId={track.Id}
|
||||
isFavorite={track.UserData?.IsFavorite}
|
||||
queryKey={["item", "musicTracks"]}
|
||||
userId={user?.Id}
|
||||
itemName={track.Name}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
.alpha-selector {
|
||||
position: sticky;
|
||||
top: 80px;
|
||||
right: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
margin-left: auto;
|
||||
user-select: none;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.alpha-letter {
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
padding: 6px 8px;
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
color: rgba(255,255,255,0.7);
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.alpha-letter.active {
|
||||
background: rgba(255,255,255,0.12);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.alpha-letter:hover {
|
||||
background: rgba(255,255,255,0.08);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { getRouteApi } from "@tanstack/react-router";
|
||||
import React, { useMemo } from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||
import "./alphaSelector.scss";
|
||||
|
||||
const libraryRoute = getRouteApi("/_api/library/$id");
|
||||
|
||||
export const AlphaSelector = React.memo(function AlphaSelector() {
|
||||
const { id: currentLibraryId } = libraryRoute.useParams();
|
||||
const { nameStartsWith } = useLibraryStateStore(
|
||||
useShallow((s) => ({
|
||||
nameStartsWith: s.libraries[currentLibraryId || ""]?.nameStartsWith,
|
||||
})),
|
||||
);
|
||||
const updateLibrary = useLibraryStateStore((s) => s.updateLibrary);
|
||||
|
||||
const letters = useMemo(() => {
|
||||
const arr = Array.from({ length: 26 }, (_, i) =>
|
||||
String.fromCharCode(65 + i),
|
||||
);
|
||||
return ["Все", ...arr];
|
||||
}, []);
|
||||
|
||||
const handleSelect = (letter: string) => {
|
||||
const value = letter === "Все" ? undefined : letter;
|
||||
if (currentLibraryId)
|
||||
updateLibrary(currentLibraryId, { nameStartsWith: value });
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="alpha-selector">
|
||||
{letters.map((l) => {
|
||||
const active = (nameStartsWith || "Все") === l;
|
||||
return (
|
||||
<button
|
||||
key={l}
|
||||
className={active ? "alpha-letter active" : "alpha-letter"}
|
||||
onClick={() => handleSelect(l)}
|
||||
aria-label={`Фильтр по букве ${l}`}
|
||||
type="button"
|
||||
>
|
||||
{l}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default AlphaSelector;
|
||||
@@ -1,113 +0,0 @@
|
||||
|
||||
.appBar {
|
||||
transition: background-color $transition-time-fast,
|
||||
backdrop-filter $transition-time-fast,
|
||||
box-shadow $transition-time-default !important;
|
||||
padding: 0.8em ($page-margin - 1.7em);
|
||||
z-index: 999 !important;
|
||||
.flex {
|
||||
transition: $transition-time-fast;
|
||||
border-radius: 1000px;
|
||||
}
|
||||
&.elevated{
|
||||
.flex {
|
||||
padding: 0.5em;
|
||||
background: rgb(0 0 0 / 0.4);
|
||||
backdrop-filter: blur(40px);
|
||||
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
|
||||
}
|
||||
}
|
||||
&-avatar {
|
||||
background: rgb(255 255 255 / 0.1) !important;
|
||||
&-icon {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
&-text {
|
||||
opacity: 0.7;
|
||||
transition: opacity $transition-time-fast;
|
||||
position: relative;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
&::after {
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 1.2px;
|
||||
background: white;
|
||||
opacity: 0.7;
|
||||
position: absolute;
|
||||
bottom: 4.6px;
|
||||
left: 0;
|
||||
transform: scaleX(0);
|
||||
transition: transform $transition-time-fast,
|
||||
background $transition-time-fast,
|
||||
opacity $transition-time-fast;
|
||||
}
|
||||
&:hover {
|
||||
opacity: 0.8;
|
||||
&::after {
|
||||
transform: scaleX(0.25);
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
&.active {
|
||||
opacity: 1;
|
||||
color: $clr-accent-default;
|
||||
&::after {
|
||||
transform: scaleX(0.5);
|
||||
opacity: 1;
|
||||
background: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.library-drawer{
|
||||
width: 20em;
|
||||
margin: 1.4em;
|
||||
height: calc(100vh - 2.8em) !important;
|
||||
border-radius: 20px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
.library-drawer-item{
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 1000px;
|
||||
> div::before{
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: transparent;
|
||||
transition: $transition-time-default;
|
||||
z-index: -1;
|
||||
border-radius: 100px;
|
||||
}
|
||||
}
|
||||
.active.library-drawer-item {
|
||||
.material-symbols-rounded{
|
||||
--fill: 1;
|
||||
}
|
||||
&> div::before {
|
||||
background: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
// Magic scrollbar
|
||||
&::-webkit-scrollbar {
|
||||
&-thumb {
|
||||
height: 150px;
|
||||
max-height: 33%;
|
||||
}
|
||||
&-track {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
background: transparent !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.appLoading {
|
||||
opacity: 0;
|
||||
}
|
||||
@@ -1,370 +0,0 @@
|
||||
import React, { useCallback, useMemo, type ReactNode } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import Avatar from "@mui/material/Avatar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
|
||||
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
||||
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import "./appBar.scss";
|
||||
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "@/utils/store/settings";
|
||||
import {
|
||||
Divider,
|
||||
Drawer,
|
||||
List,
|
||||
ListItem,
|
||||
ListItemButton,
|
||||
ListItemText,
|
||||
} from "@mui/material";
|
||||
import BackButton from "../buttons/backButton";
|
||||
|
||||
interface ListItemLinkProps {
|
||||
icon?: ReactNode;
|
||||
primary: string;
|
||||
to: string;
|
||||
}
|
||||
|
||||
function ListItemLink(props: ListItemLinkProps) {
|
||||
const { icon, primary, to } = props;
|
||||
|
||||
return (
|
||||
<li>
|
||||
{/* @ts-ignore */}
|
||||
<ListItem
|
||||
component={Link}
|
||||
activeClassName="active"
|
||||
className="library-drawer-item"
|
||||
to={to}
|
||||
>
|
||||
<ListItemButton
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
color: "white",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
<div className="material-symbols-rounded">{icon}</div>
|
||||
<ListItemText primary={primary} />
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
const MemoizeBackButton = React.memo(BackButton);
|
||||
|
||||
export const AppBar = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
userId: user?.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user?.Id && !!api.accessToken,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 20,
|
||||
});
|
||||
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
const openMenu = Boolean(anchorEl);
|
||||
const handleMenuOpen = useCallback((event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
}, []);
|
||||
const handleMenuClose = useCallback(() => {
|
||||
setAnchorEl(null);
|
||||
}, []);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
await api.logout();
|
||||
delUser();
|
||||
sessionStorage.removeItem("accessToken");
|
||||
queryClient.clear();
|
||||
setAnchorEl(null);
|
||||
navigate({ to: "/login" });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
location.pathname.includes("setup") ||
|
||||
location.pathname.includes("server") ||
|
||||
location.pathname === "/player" ||
|
||||
location.pathname.includes("error") ||
|
||||
location.pathname === "/"
|
||||
) {
|
||||
setDisplay(false);
|
||||
} else {
|
||||
setDisplay(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const [showDrawer, setShowDrawer] = useState(false);
|
||||
|
||||
const appBarStyling = useMemo(() => {
|
||||
return {
|
||||
backgroundColor: "transparent",
|
||||
paddingRight: "0 !important",
|
||||
};
|
||||
}, []);
|
||||
const menuStyle = useMemo(() => {
|
||||
return { mt: 2 };
|
||||
}, []);
|
||||
|
||||
const drawerPaperProps = useMemo(() => {
|
||||
return {
|
||||
className: "glass library-drawer",
|
||||
elevation: 6,
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleNavigateToSearch = useCallback(
|
||||
() => navigate({ to: "/search", search: { query: "" } }),
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const handleDrawerClose = useCallback(() => {
|
||||
setShowDrawer(false);
|
||||
}, []);
|
||||
|
||||
const handleDrawerOpen = useCallback(() => {
|
||||
setShowDrawer(true);
|
||||
}, []);
|
||||
|
||||
const handleNavigateToHome = useCallback(() => navigate({ to: "/home" }), []);
|
||||
const handleNavigateToFavorite = useCallback(() => {
|
||||
navigate({ to: "/favorite" });
|
||||
}, []);
|
||||
|
||||
const menuButtonSx = useMemo(() => ({ p: 0 }), []);
|
||||
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
if (display) {
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
style={appBarStyling}
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
: "appBar flex flex-row flex-justify-spaced-between"
|
||||
}
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<div className="material-symbols-rounded">menu</div>
|
||||
</IconButton>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome}>
|
||||
<div
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
? "material-symbols-rounded fill"
|
||||
: "material-symbols-rounded"
|
||||
}
|
||||
>
|
||||
home
|
||||
</div>
|
||||
</IconButton>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleNavigateToSearch}>
|
||||
<div className="material-symbols-rounded">search</div>
|
||||
</IconButton>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<div className="material-symbols-rounded">favorite</div>
|
||||
</IconButton>
|
||||
<IconButton sx={menuButtonSx} onClick={handleMenuOpen}>
|
||||
{!!user?.Id &&
|
||||
(user?.PrimaryImageTag === undefined ? (
|
||||
<Avatar className="appBar-avatar" alt={user?.Name ?? "image"}>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
</span>
|
||||
</Avatar>
|
||||
) : (
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
src={`${api.basePath}/Users/${user?.Id}/Images/Primary`}
|
||||
alt={user?.Name ?? "image"}
|
||||
>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
</span>
|
||||
</Avatar>
|
||||
))}
|
||||
</IconButton>
|
||||
<Menu
|
||||
anchorEl={anchorEl}
|
||||
open={openMenu}
|
||||
onClose={handleMenuClose}
|
||||
sx={menuStyle}
|
||||
disableScrollLock
|
||||
>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
handleLogout();
|
||||
handleMenuClose();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<div className="material-symbols-rounded">logout</div>
|
||||
</ListItemIcon>
|
||||
Logout
|
||||
</MenuItem>
|
||||
<Divider />
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setSettingsDialogOpen(true);
|
||||
setSettingsTabValue(1);
|
||||
handleMenuClose();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<div className="material-symbols-rounded">settings</div>
|
||||
</ListItemIcon>
|
||||
Settings
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setSettingsDialogOpen(true);
|
||||
setSettingsTabValue(10);
|
||||
handleMenuClose();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<div className="material-symbols-rounded">info</div>
|
||||
</ListItemIcon>
|
||||
About
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</div>
|
||||
</MuiAppBar>
|
||||
<Drawer
|
||||
open={showDrawer}
|
||||
PaperProps={drawerPaperProps}
|
||||
className="library-drawer"
|
||||
onClose={handleDrawerClose}
|
||||
>
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={handleDrawerClose}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">menu_open</span>
|
||||
Close
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Divider variant="middle" />
|
||||
<List>
|
||||
<ListItemLink to="/home" icon="home" primary="Home" />
|
||||
{libraries.isSuccess &&
|
||||
libraries.data.Items?.map((library) => (
|
||||
<ListItemLink
|
||||
key={library.Id}
|
||||
to={`/library/${library.Id}`}
|
||||
icon={
|
||||
library.CollectionType &&
|
||||
getTypeIcon(library.CollectionType)
|
||||
}
|
||||
primary={library.Name ?? "Library"}
|
||||
/>
|
||||
))}
|
||||
</List>
|
||||
<Divider variant="middle" />
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={() => {
|
||||
setSettingsDialogOpen(true);
|
||||
setSettingsTabValue(1);
|
||||
}}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">settings</span>
|
||||
Settings
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={() => {
|
||||
setSettingsDialogOpen(true);
|
||||
setSettingsTabValue(2);
|
||||
}}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">dns</span>
|
||||
Change Server
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={() => {
|
||||
setSettingsDialogOpen(true);
|
||||
setSettingsTabValue(10);
|
||||
}}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">info</span>
|
||||
About
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</List>
|
||||
</Drawer>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
.back-only-bar {
|
||||
padding-top: var(--safe-top);
|
||||
|
||||
html.is-macos & {
|
||||
padding-left: 76px;
|
||||
}
|
||||
}
|
||||
|
||||
.qc-label-short {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.qc-label-full {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qc-label-short {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.back-only-bar .MuiButton-root {
|
||||
height: 38px;
|
||||
min-height: 38px;
|
||||
padding: 0 0.85rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.72rem;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,53 @@
|
||||
import AppBar from "@mui/material/AppBar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import { useRouter } from "@tanstack/react-router";
|
||||
import { useLocation, useRouter } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import QuickConnectButton from "../buttons/quickConnectButton";
|
||||
|
||||
export const AppBarBackOnly = () => {
|
||||
import "./backOnly.scss";
|
||||
|
||||
export default function AppBarBackOnly() {
|
||||
const { history } = useRouter();
|
||||
const location = useLocation();
|
||||
|
||||
const handleBack = () => {
|
||||
history.go(-1);
|
||||
};
|
||||
|
||||
const hideQuickConnect = location.pathname === "/setup/server/list";
|
||||
|
||||
return (
|
||||
<AppBar elevation={0} color="transparent" position="fixed">
|
||||
<AppBar
|
||||
className="back-only-bar"
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
position="fixed"
|
||||
>
|
||||
<Toolbar>
|
||||
<IconButton
|
||||
size="large"
|
||||
edge="start"
|
||||
//@ts-ignore
|
||||
//@ts-expect-error
|
||||
color="white"
|
||||
aria-label="back"
|
||||
aria-label="Назад"
|
||||
disabled={history.length <= 1}
|
||||
onClick={handleBack}
|
||||
sx={{ mr: 2 }}
|
||||
>
|
||||
<span className="material-symbols-rounded">arrow_back</span>
|
||||
</IconButton>
|
||||
<QuickConnectButton
|
||||
sx={{
|
||||
marginLeft: "auto",
|
||||
flex: "none !important",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
color="secondary"
|
||||
/>
|
||||
{!hideQuickConnect && (
|
||||
<QuickConnectButton
|
||||
sx={{
|
||||
marginLeft: "auto",
|
||||
flex: "none !important",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
color="secondary"
|
||||
/>
|
||||
)}
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
:root {
|
||||
--app-titlebar-height: 64px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
:root {
|
||||
--app-titlebar-height: calc(96px + var(--safe-top));
|
||||
}
|
||||
}
|
||||
|
||||
html:not(.has-app-titlebar) {
|
||||
--app-titlebar-height: 0px;
|
||||
}
|
||||
|
||||
/* One titlebar for the whole app: brand and sections on the left, utilities
|
||||
and window buttons on the right. It floats above the page; page content
|
||||
insets itself by `--app-titlebar-height`, so route roots all start at y=0
|
||||
and transitions never shift the page vertically. */
|
||||
.app-titlebar {
|
||||
position: fixed;
|
||||
inset: 0 0 auto;
|
||||
z-index: 1000;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
||||
grid-template-areas: "start nav actions";
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
height: var(--app-titlebar-height);
|
||||
padding: 0 clamp(1.1rem, 2.4vw, 2.4rem);
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
isolation: isolate;
|
||||
|
||||
/* Two layers that cross-fade: the glass surface and the soft gradient used
|
||||
while the titlebar floats over the home hero. No hard border between the
|
||||
bar and the page. */
|
||||
&::before,
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: -1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&::before {
|
||||
inset: 0 0 -14px;
|
||||
background: rgb(12 13 18 / 0.74);
|
||||
backdrop-filter: blur(24px) saturate(170%);
|
||||
mask-image: linear-gradient(
|
||||
to bottom,
|
||||
#000 calc(100% - 14px),
|
||||
transparent 100%
|
||||
);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to bottom,
|
||||
#000 calc(100% - 14px),
|
||||
transparent 100%
|
||||
);
|
||||
opacity: 1;
|
||||
transition: opacity 360ms cubic-bezier(0.33, 1, 0.68, 1);
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
&::after {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgb(0 0 0 / 0.58) 0%,
|
||||
rgb(0 0 0 / 0.24) 62%,
|
||||
transparent 100%
|
||||
);
|
||||
opacity: 0;
|
||||
transition: opacity 360ms cubic-bezier(0.33, 1, 0.68, 1);
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
html.is-macos & {
|
||||
padding-left: calc(clamp(1.1rem, 2.4vw, 2.4rem) + 72px);
|
||||
}
|
||||
|
||||
/* Home: transparent over the hero until the page starts scrolling. */
|
||||
&--overlay {
|
||||
&::before {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&::after {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.MuiIconButton-root {
|
||||
width: 2.35rem;
|
||||
height: 2.35rem;
|
||||
color: rgb(255 255 255 / 0.76);
|
||||
transition:
|
||||
color 150ms ease,
|
||||
background-color 150ms ease;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.MuiIconButton-root.Mui-disabled {
|
||||
color: rgb(255 255 255 / 0.25);
|
||||
}
|
||||
|
||||
.window-controls {
|
||||
margin-left: 0.4rem;
|
||||
background: rgb(255 255 255 / 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-top {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.app-titlebar-start {
|
||||
grid-area: start;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.app-titlebar-brand {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
min-width: 0;
|
||||
padding: 0.2rem 0.35rem 0.2rem 0.15rem;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-family: "Medeo Sans", system-ui, sans-serif;
|
||||
font-size: 1.45rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1;
|
||||
text-decoration: none;
|
||||
user-select: none;
|
||||
|
||||
&-mark {
|
||||
width: 2rem;
|
||||
height: 1.6rem;
|
||||
flex: 0 0 auto;
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-nav {
|
||||
grid-area: nav;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.1rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.app-titlebar-nav-link {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 2.4rem;
|
||||
padding: 0 0.95rem;
|
||||
border-radius: 999px;
|
||||
color: rgb(255 255 255 / 0.64);
|
||||
font-size: 0.92rem;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
transition:
|
||||
color 150ms ease,
|
||||
background-color 150ms ease;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.07);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.09);
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 0.28rem;
|
||||
width: 1.35rem;
|
||||
height: 2px;
|
||||
border-radius: 2px;
|
||||
background: $clr-accent-default;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-actions {
|
||||
grid-area: actions;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 0.1rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.app-titlebar-icon-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.35rem;
|
||||
height: 2.35rem;
|
||||
border-radius: 50%;
|
||||
color: rgb(255 255 255 / 0.76);
|
||||
text-decoration: none;
|
||||
transition:
|
||||
color 150ms ease,
|
||||
background-color 150ms ease;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.35rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.app-titlebar-cast {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
html.is-android .app-titlebar-downloads {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.app-titlebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
padding: calc(var(--safe-top) + 0.3rem) 0.6rem 0.35rem;
|
||||
|
||||
.MuiIconButton-root {
|
||||
width: 2.15rem;
|
||||
height: 2.15rem;
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
.app-titlebar-start {
|
||||
min-width: 0;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
|
||||
.app-titlebar-brand {
|
||||
gap: 0.4rem;
|
||||
font-size: 1.18rem;
|
||||
|
||||
&-mark {
|
||||
width: 1.55rem;
|
||||
height: 1.28rem;
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-nav {
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
height: 38px;
|
||||
gap: 0.05rem;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
scrollbar-width: none;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-nav-link {
|
||||
height: 32px;
|
||||
padding: 0 0.72rem;
|
||||
font-size: 0.84rem;
|
||||
|
||||
&.is-active::after {
|
||||
bottom: 0.18rem;
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-actions {
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.app-titlebar-icon-link {
|
||||
width: 2.15rem;
|
||||
height: 2.15rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.app-titlebar {
|
||||
html.is-macos & {
|
||||
padding-left: 0.6rem;
|
||||
}
|
||||
|
||||
.window-controls {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.app-titlebar-cast,
|
||||
.app-titlebar-downloads {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
import { IconButton, Tooltip, useScrollTrigger } from "@mui/material";
|
||||
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
||||
import React, { useEffect, useLayoutEffect, useRef } from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import BackButton from "@/components/buttons/backButton";
|
||||
import CastButton from "@/components/buttons/castButton";
|
||||
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
||||
import WindowControls from "@/components/windowControls";
|
||||
import {
|
||||
getLocalMediaTransfer,
|
||||
useCurrentMediaItem,
|
||||
} from "@/utils/methods/localTransfer";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
import { shouldShowTitlebar } from "./routeVisibility";
|
||||
import { type AppNavItem, useAppNavigation } from "./useAppNavigation";
|
||||
|
||||
import "./appTitlebar.scss";
|
||||
|
||||
const BlinkMark = () => (
|
||||
<svg
|
||||
className="app-titlebar-brand-mark"
|
||||
viewBox="0 0 40 32"
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<g
|
||||
stroke="currentColor"
|
||||
strokeWidth="2.2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<path d="M8.5 7.6 4.7 4.2" />
|
||||
<path d="M14.2 5.4 13.4 1.4" />
|
||||
<path d="M20.4 5.2 21.1 1.3" />
|
||||
<path d="M5.2 18.4c3.7-5.9 10.5-8.3 16.6-5.7 4.2 1.8 7.6 5 9.8 8.2-4.8 4.7-12.4 6.1-18.2 3.5-3.7-1.7-6.4-3.7-8.2-6Z" />
|
||||
<path
|
||||
d="M18.7 18.5a2.9 2.9 0 1 0 0-5.8 2.9 2.9 0 0 0 0 5.8Z"
|
||||
fill="currentColor"
|
||||
stroke="none"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
|
||||
const isItemActive = (item: AppNavItem, pathname: string) =>
|
||||
item.kind === "home"
|
||||
? pathname === "/home"
|
||||
: pathname === `/library/${item.libraryId}` ||
|
||||
(item.key === "music" && pathname.startsWith("/music/"));
|
||||
|
||||
const NavItem = ({ item, active }: { item: AppNavItem; active: boolean }) => {
|
||||
const className = `app-titlebar-nav-link${active ? " is-active" : ""}`;
|
||||
if (item.kind === "home") {
|
||||
return (
|
||||
<Link
|
||||
to="/home"
|
||||
className={className}
|
||||
aria-current={active ? "page" : undefined}
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Link
|
||||
to="/library/$id"
|
||||
params={{ id: item.libraryId }}
|
||||
className={className}
|
||||
aria-current={active ? "page" : undefined}
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
export const AppTitlebar = () => {
|
||||
const { pathname } = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const visible = shouldShowTitlebar(pathname);
|
||||
const isHome = pathname === "/home";
|
||||
const scrolled = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 20,
|
||||
});
|
||||
const navigation = useAppNavigation(visible);
|
||||
const navRef = useRef<HTMLElement | null>(null);
|
||||
const currentMedia = useCurrentMediaItem();
|
||||
|
||||
const toggleSearchDialog = useSearchStore(
|
||||
useShallow((s) => s.toggleSearchDialog),
|
||||
);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
document.documentElement.classList.toggle("has-app-titlebar", visible);
|
||||
}, [visible]);
|
||||
|
||||
useEffect(() => {
|
||||
const active = navRef.current?.querySelector<HTMLElement>(
|
||||
".app-titlebar-nav-link.is-active",
|
||||
);
|
||||
active?.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "nearest",
|
||||
inline: "center",
|
||||
});
|
||||
}, [pathname, navigation.length]);
|
||||
|
||||
if (!visible) return null;
|
||||
|
||||
const overlay = isHome && !scrolled;
|
||||
|
||||
return (
|
||||
<>
|
||||
<header
|
||||
className={`app-titlebar${overlay ? " app-titlebar--overlay" : ""}`}
|
||||
data-tauri-drag-region
|
||||
>
|
||||
<div className="app-titlebar-top">
|
||||
<div className="app-titlebar-start" data-tauri-drag-region>
|
||||
<BackButton />
|
||||
<Link
|
||||
to="/home"
|
||||
className="app-titlebar-brand"
|
||||
aria-label="Blink — на главную"
|
||||
>
|
||||
<BlinkMark />
|
||||
<span>Blink</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="app-titlebar-actions" data-tauri-drag-region>
|
||||
<span className="app-titlebar-cast">
|
||||
<CastButton
|
||||
item={currentMedia}
|
||||
getTransfer={getLocalMediaTransfer}
|
||||
/>
|
||||
</span>
|
||||
<Tooltip title="Поиск">
|
||||
<IconButton onClick={toggleSearchDialog} aria-label="Поиск">
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Загрузки">
|
||||
<IconButton
|
||||
className="app-titlebar-downloads"
|
||||
onClick={() => navigate({ to: "/downloads" })}
|
||||
aria-label="Загрузки"
|
||||
>
|
||||
<span className="material-symbols-rounded">download</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Настройки">
|
||||
<Link
|
||||
to="/settings/preferences"
|
||||
className="app-titlebar-icon-link"
|
||||
aria-label="Настройки"
|
||||
>
|
||||
<span className="material-symbols-rounded">settings</span>
|
||||
</Link>
|
||||
</Tooltip>
|
||||
<UserAvatarMenu />
|
||||
<WindowControls />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav
|
||||
ref={navRef}
|
||||
className="app-titlebar-nav"
|
||||
aria-label="Основная навигация"
|
||||
>
|
||||
{navigation.map((item) => (
|
||||
<NavItem
|
||||
key={item.key}
|
||||
item={item}
|
||||
active={isItemActive(item, pathname)}
|
||||
/>
|
||||
))}
|
||||
</nav>
|
||||
</header>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
const HIDDEN_PREFIXES = ["/login", "/setup", "/server", "/error", "/player"];
|
||||
|
||||
/** Routes that keep the global titlebar. Auth, setup and players do not. */
|
||||
export const shouldShowTitlebar = (pathname: string) =>
|
||||
pathname !== "/" &&
|
||||
!HIDDEN_PREFIXES.some(
|
||||
(prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`),
|
||||
);
|
||||
@@ -0,0 +1,72 @@
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserViewApi } from "@jellyfin/sdk/lib/utils/api/user-view-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useMemo } from "react";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export type AppNavItem =
|
||||
| {
|
||||
kind: "home";
|
||||
key: "home";
|
||||
label: string;
|
||||
}
|
||||
| {
|
||||
kind: "library";
|
||||
key: "movies" | "tvshows" | "music";
|
||||
label: string;
|
||||
libraryId: string;
|
||||
};
|
||||
|
||||
const LIBRARY_NAV = [
|
||||
{ key: "movies", collectionType: "movies", label: "Фильмы" },
|
||||
{ key: "tvshows", collectionType: "tvshows", label: "Сериалы" },
|
||||
{ key: "music", collectionType: "music", label: "Музыка" },
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* The four permanent sections of the app titlebar. Library items are resolved
|
||||
* from the same cached `getUserViews` query the home page already loads.
|
||||
*/
|
||||
export const useAppNavigation = (enabled: boolean) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
if (!api?.accessToken || !user?.Id) return undefined;
|
||||
const response = await getUserViewApi(api).getUserViews({
|
||||
userId: user.Id,
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
enabled: enabled && !!api?.accessToken && !!user?.Id,
|
||||
staleTime: 5 * 60 * 1000,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const items = useMemo<AppNavItem[]>(() => {
|
||||
const list: AppNavItem[] = [
|
||||
{ kind: "home", key: "home", label: "Главная" },
|
||||
];
|
||||
const views: BaseItemDto[] = libraries.data?.Items ?? [];
|
||||
|
||||
for (const entry of LIBRARY_NAV) {
|
||||
const library = views.find(
|
||||
(view) => view.Id && view.CollectionType === entry.collectionType,
|
||||
);
|
||||
if (!library?.Id) continue;
|
||||
list.push({
|
||||
kind: "library",
|
||||
key: entry.key,
|
||||
label: entry.label,
|
||||
libraryId: library.Id,
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}, [libraries.data]);
|
||||
|
||||
return items;
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
|
||||
import "./avatar.module.scss";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
export const AvatarImage = ({ userId }) => {
|
||||
const api = useRouteContext({ from: "/_api" }).api;
|
||||
return (
|
||||
<Box className="avatar-image-container">
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage: `url('${api.basePath}/Users/${userId}/Images/Primary')`,
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="avatar-image-icon-container">
|
||||
<span className="material-symbols-rounded avatar-image-icon">
|
||||
account_circle
|
||||
</span>
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
AvatarImage.propType = {
|
||||
userId: PropTypes.string.isRequired,
|
||||
userImageTags: PropTypes.any,
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
import React from "react";
|
||||
|
||||
import "./avatar.module.scss";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
export const AvatarImage = ({ userId }: { userId: string }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
if (!api) return null;
|
||||
|
||||
return (
|
||||
<div className="avatar-image-container">
|
||||
<div
|
||||
className="avatar-image"
|
||||
style={{
|
||||
backgroundImage: `url('${api.basePath}/Users/${userId}/Images/Primary')`,
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="avatar-image-icon-container">
|
||||
<span className="material-symbols-rounded avatar-image-icon">
|
||||
account_circle
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||