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 |
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
changelog:
|
||||||
|
categories:
|
||||||
|
- title: 🏕 Features
|
||||||
|
labels:
|
||||||
|
- '*'
|
||||||
|
exclude:
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
|
- title: 👒 Dependencies
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform: [macos-latest, ubuntu-22.04, windows-latest]
|
platform: [macos-latest, ubuntu-22.04, windows-latest, windows-11-arm]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
environment: TAURI
|
environment: TAURI
|
||||||
steps:
|
steps:
|
||||||
@@ -134,126 +134,40 @@ jobs:
|
|||||||
contents: write # Required for creating/updating releases
|
contents: write # Required for creating/updating releases
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v6.0.1
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v4.3.0
|
uses: actions/download-artifact@v7.0.0
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Prepare assets
|
||||||
run: npm install mime-types
|
|
||||||
|
|
||||||
- name: Get commit details
|
|
||||||
id: commit-details
|
|
||||||
run: |
|
run: |
|
||||||
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
|
mkdir -p release_assets
|
||||||
- name: Create or update nightly release
|
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
|
||||||
uses: actions/github-script@v7.0.1
|
# 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:
|
env:
|
||||||
COMMIT_MESSAGE: ${{ steps.commit-details.outputs.message }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create nightly release
|
||||||
|
uses: softprops/action-gh-release@v2.5.0
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
tag_name: nightly
|
||||||
script: |
|
name: Nightly Build (${{ github.sha }})
|
||||||
const fs = require('fs');
|
body: |
|
||||||
const path = require('path');
|
Nightly build from the latest main branch.
|
||||||
|
|
||||||
// Get today's date in YYYY-MM-DD format
|
**Last commit:** ${{ github.event.head_commit.message }}
|
||||||
const today = new Date().toISOString().split('T')[0];
|
**SHA:** ${{ github.sha }}
|
||||||
const releaseTag = 'nightly';
|
prerelease: true
|
||||||
const releaseName = `Nightly Build (${today})`;
|
files: release_assets/*
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
|
||||||
// Check if nightly release already exists
|
|
||||||
console.log("Checking for existing nightly release...");
|
|
||||||
let release;
|
|
||||||
try {
|
|
||||||
release = await github.rest.repos.getReleaseByTag({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
tag: releaseTag
|
|
||||||
});
|
|
||||||
console.log("Found existing nightly release");
|
|
||||||
} catch (error) {
|
|
||||||
if (error.status === 404) {
|
|
||||||
console.log("No existing nightly release found, creating one...");
|
|
||||||
release = await github.rest.repos.createRelease({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
tag_name: releaseTag,
|
|
||||||
name: releaseName,
|
|
||||||
body: `Nightly build created on ${today} from the latest main branch\nLast commit: ${context.sha}\nCommit message: ${process.env.COMMIT_MESSAGE || "No commit message available"}`,
|
|
||||||
prerelease: true
|
|
||||||
});
|
|
||||||
release = release.data;
|
|
||||||
} else {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Handle the case where we have an existing release
|
|
||||||
// The release object structure differs depending on whether it came from getReleaseByTag or createRelease
|
|
||||||
const releaseId = release.data ? release.data.id : release.id;
|
|
||||||
|
|
||||||
if (releaseId) {
|
|
||||||
// Update existing release
|
|
||||||
console.log("Updating existing nightly release...");
|
|
||||||
const updateResult = await github.rest.repos.updateRelease({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
release_id: releaseId,
|
|
||||||
name: releaseName,
|
|
||||||
body: `Nightly build updated on ${today} from the latest main branch.\nLast commit: ${context.sha}\nCommit message: ${process.env.COMMIT_MESSAGE || "No commit message available"}`,
|
|
||||||
prerelease: true
|
|
||||||
});
|
|
||||||
release = updateResult.data;
|
|
||||||
}
|
|
||||||
// Delete existing assets to replace them with new ones
|
|
||||||
if (release.assets && release.assets.length > 0) {
|
|
||||||
console.log("Deleting existing release assets...");
|
|
||||||
for (const asset of release.assets) {
|
|
||||||
await github.rest.repos.deleteReleaseAsset({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
asset_id: asset.id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Upload new artifacts
|
|
||||||
console.log("Uploading new artifacts...");
|
|
||||||
const artifactsDir = 'artifacts';
|
|
||||||
const platforms = ['macos-latest', 'ubuntu-22.04', 'windows-latest'];
|
|
||||||
const mime = require('mime-types');
|
|
||||||
|
|
||||||
for (const platform of platforms) {
|
|
||||||
const platformDir = path.join(artifactsDir, `Blink-${platform}-dev${context.sha}`);
|
|
||||||
|
|
||||||
if (!fs.existsSync(platformDir)) {
|
|
||||||
console.log(`No artifacts found for ${platform}`);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const files = fs.readdirSync(platformDir, { recursive: true });
|
|
||||||
for (const file of files) {
|
|
||||||
if (typeof file === 'string' && !fs.statSync(path.join(platformDir, file)).isDirectory()) {
|
|
||||||
const filePath = path.join(platformDir, file);
|
|
||||||
const fileName = path.basename(filePath);
|
|
||||||
const contentType = mime.lookup(fileName) || 'application/octet-stream';
|
|
||||||
|
|
||||||
console.log(`Uploading ${fileName} from ${platform}...`);
|
|
||||||
|
|
||||||
// Use Octokit's uploadReleaseAsset with proper content type for binary data
|
|
||||||
await github.rest.repos.uploadReleaseAsset({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
release_id: release.id,
|
|
||||||
name: `${platform.replace(/-/g, '_')}-${fileName}`,
|
|
||||||
data: fs.readFileSync(filePath),
|
|
||||||
headers: {
|
|
||||||
'content-type': contentType,
|
|
||||||
'content-length': fs.statSync(filePath).size
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Nightly release updated successfully!");
|
|
||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform: [macos-latest, ubuntu-22.04, windows-latest]
|
platform: [macos-latest, ubuntu-22.04, windows-latest, windows-11-arm]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
environment: TAURI
|
environment: TAURI
|
||||||
steps:
|
steps:
|
||||||
@@ -67,7 +67,7 @@ jobs:
|
|||||||
run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm.
|
run: pnpm install --no-frozen-lockfile && pnpm run build # Change this to npm, yarn or pnpm.
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
uses: tauri-apps/tauri-action@dev
|
uses: tauri-apps/tauri-action@v0
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -75,10 +75,6 @@ jobs:
|
|||||||
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
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
|
|
||||||
with:
|
with:
|
||||||
tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
|
tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
|
||||||
releaseName: "App Name v__VERSION__" # tauri-action replaces \_\_VERSION\_\_ with the app version.
|
releaseName: "App Name v__VERSION__" # tauri-action replaces \_\_VERSION\_\_ with the app version.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: contains(github.event.release.tag_name, '-alpha')
|
if: contains(github.event.release.tag_name, '-alpha')
|
||||||
steps:
|
steps:
|
||||||
- uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
|
- uses: vedantmgoyal9/winget-releaser@main
|
||||||
with:
|
with:
|
||||||
identifier: prayag17.Blink.Alpha
|
identifier: prayag17.Blink.Alpha
|
||||||
version: ${{ github.event.release.tag_name }}
|
version: ${{ github.event.release.tag_name }}
|
||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: "!contains(github.event.release.tag_name, '-alpha')"
|
if: "!contains(github.event.release.tag_name, '-alpha')"
|
||||||
steps:
|
steps:
|
||||||
- uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
|
- uses: vedantmgoyal9/winget-releaser@main
|
||||||
with:
|
with:
|
||||||
identifier: prayag17.Blink
|
identifier: prayag17.Blink
|
||||||
version: ${{ github.event.release.tag_name }}
|
version: ${{ github.event.release.tag_name }}
|
||||||
|
|||||||
@@ -42,3 +42,9 @@ target/
|
|||||||
generateBanner
|
generateBanner
|
||||||
# Million Lint
|
# Million Lint
|
||||||
.million
|
.million
|
||||||
|
|
||||||
|
# TypeScript incremental build cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# local multi-client test profiles
|
||||||
|
.clients/
|
||||||
@@ -60,19 +60,25 @@
|
|||||||
- Sort/Filter library items
|
- Sort/Filter library items
|
||||||
- Queue playback support
|
- Queue playback support
|
||||||
- Intro Skip button using [jumoog/Intro-Skipper](https://github.com/jumoog/intro-skipper) plugin
|
- Intro Skip button using [jumoog/Intro-Skipper](https://github.com/jumoog/intro-skipper) plugin
|
||||||
|
- Mediasegment support
|
||||||
|
|
||||||
## 📷 Screenshots
|
## 📷 Screenshots
|
||||||
|
|
||||||
- Home
|
- Home
|
||||||

|
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212208" src="https://github.com/user-attachments/assets/036c2339-e8f1-4c8d-a908-af0ece9bb1f3" />
|
||||||
- Title Page - Movie
|
- Library
|
||||||

|
<img width="2560" height="1600" alt="Screenshot 2026-02-10 212723" src="https://github.com/user-attachments/assets/6520a325-3cf3-47a0-9056-b27aded4bb8c" />
|
||||||
- Title Page - Show
|
- 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" />
|
||||||
- Episode List
|
- 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
|
- Video Player
|
||||||

|
<img width="2560" height="1600" alt="Screenshot 2026-02-10 213049" src="https://github.com/user-attachments/assets/effcca22-3650-46e1-9a86-b3b434851f2f" />
|
||||||
|
|
||||||
|
|
||||||
## 📃 Roadmap
|
## 📃 Roadmap
|
||||||
|
|
||||||
@@ -84,3 +90,4 @@
|
|||||||
- [@ferferga](https://github.com/ferferga) for helping in development behind the scenes.
|
- [@ferferga](https://github.com/ferferga) for helping in development behind the scenes.
|
||||||
- All contributors of [jellyfin/jellyfin-vue](https://github.com/jellyfin/jellyfin-vue).
|
- All contributors of [jellyfin/jellyfin-vue](https://github.com/jellyfin/jellyfin-vue).
|
||||||
- And also [@jellyfin](https://github.com/jellyfin/) for creating the main service
|
- And also [@jellyfin](https://github.com/jellyfin/) for creating the main service
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
|
||||||
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": 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>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="ru">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||||
<!-- <script src="http://localhost:8097"></script> -->
|
<!-- <script src="http://localhost:8097"></script> -->
|
||||||
<title>Blink</title>
|
<title>Blink</title>
|
||||||
<style>
|
<style>
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
background: #08001f;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.app-loading {
|
.app-loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%,-50%);
|
transform: translate(-50%, -50%);
|
||||||
width: 10em;
|
|
||||||
height: 10em;
|
|
||||||
background: rgb(180 180 180);
|
|
||||||
z-index: 100000;
|
z-index: 100000;
|
||||||
mask-image: url("./src/assets/icon-outline.png");
|
display: flex;
|
||||||
mask-size: contain;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-loading.hidden {
|
.app-loading.hidden {
|
||||||
display: none;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app-loading-logo {
|
||||||
.app-loading-anim{
|
display: block;
|
||||||
width: 150%;
|
width: min(230px, 62vw);
|
||||||
height: 100%;
|
height: auto;
|
||||||
position: absolute;
|
filter: drop-shadow(0 10px 30px rgb(0 0 0 / 0.35));
|
||||||
top: 0;
|
animation: splashPulse 1.4s ease-in-out infinite;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes loading {
|
@keyframes splashPulse {
|
||||||
0%{
|
0%,
|
||||||
transform: translate(-100%);
|
100% {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
50%{
|
50% {
|
||||||
transform: translate(0%);
|
opacity: 0.62;
|
||||||
}
|
}
|
||||||
100%{
|
}
|
||||||
transform: translate(100%);
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.app-loading-logo {
|
||||||
|
animation: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="app-loading">
|
<div class="app-loading" role="status" aria-label="Загрузка Blink">
|
||||||
<!-- <img src="./src/assets/icon-outline.svg" class="app-loading-logo" /> -->
|
<img
|
||||||
<div class="app-loading-anim"></div>
|
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>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
<svg style="width: 0; height: 0; position: absolute" aria-hidden="true" focusable="false">
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "blink",
|
"name": "blink",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0-alpha.3",
|
"version": "1.0.0-alpha.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --force && tsr watch",
|
"dev": "vite && tsr watch",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri",
|
"tauri": "tauri",
|
||||||
|
"tauri:dev:mcp": "tauri dev -c src-tauri/tauri.mcp.conf.json -- --features mcp-bridge",
|
||||||
"lint": "biome check src/**/*",
|
"lint": "biome check src/**/*",
|
||||||
"lint:fix": "biome check --apply src/**/*",
|
"lint:fix": "biome check --apply src/**/*",
|
||||||
"tanstack-router-dev": "tsr watch"
|
"tanstack-router-dev": "tsr watch"
|
||||||
@@ -19,77 +20,82 @@
|
|||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@emotion/react": "^11.14.0",
|
"@emotion/react": "^11.14.0",
|
||||||
"@emotion/styled": "^11.14.1",
|
"@emotion/styled": "^11.14.1",
|
||||||
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
"@fontsource-variable/caveat": "^5.3.0",
|
||||||
"@fontsource-variable/noto-sans": "^5.2.10",
|
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
||||||
"@fontsource-variable/plus-jakarta-sans": "^5.2.8",
|
"@fontsource-variable/noto-sans": "^5.3.0",
|
||||||
"@fontsource-variable/space-grotesk": "^5.2.10",
|
"@fontsource-variable/plus-jakarta-sans": "^5.3.0",
|
||||||
"@jellyfin/sdk": "0.13.0",
|
"@fontsource-variable/space-grotesk": "^5.3.0",
|
||||||
"@mui/lab": "7.0.1-beta.20",
|
"@jellyfin/sdk": "1.0.1",
|
||||||
"@mui/material": "7.3.6",
|
"@mui/lab": "9.0.0-beta.10",
|
||||||
|
"@mui/material": "9.5.0",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"@react-spring/web": "^10.0.3",
|
"@react-spring/web": "^10.1.2",
|
||||||
"@tanem/react-nprogress": "^5.0.56",
|
"@tanem/react-nprogress": "^7.1.7",
|
||||||
"@tanstack/react-form": "^1.27.5",
|
"@tanstack/react-form": "^1.33.5",
|
||||||
"@tanstack/react-query": "^5.90.12",
|
"@tanstack/react-query": "^5.104.4",
|
||||||
"@tanstack/react-query-devtools": "^5.91.1",
|
"@tanstack/react-router": "^1.170.45",
|
||||||
"@tanstack/react-router": "^1.141.8",
|
"@tanstack/react-virtual": "^3.14.21",
|
||||||
"@tanstack/react-router-devtools": "^1.141.8",
|
"@tauri-apps/api": "2.12.4",
|
||||||
"@tanstack/react-virtual": "^3.13.13",
|
"@tauri-apps/plugin-clipboard-manager": "2.5.0",
|
||||||
"@tauri-apps/api": "2.9.1",
|
"@tauri-apps/plugin-deep-link": "2.6.3",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.3.2",
|
"@tauri-apps/plugin-dialog": "2.8.3",
|
||||||
"@tauri-apps/plugin-dialog": "2.4.2",
|
"@tauri-apps/plugin-global-shortcut": "~2.4.1",
|
||||||
"@tauri-apps/plugin-notification": "2.3.3",
|
"@tauri-apps/plugin-notification": "2.7.0",
|
||||||
"@tauri-apps/plugin-process": "2.3.1",
|
"@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-store": "github:tauri-apps/tauri-plugin-store#v2",
|
||||||
"@tauri-apps/plugin-updater": "2.9.0",
|
"@tauri-apps/plugin-updater": "2.14.0",
|
||||||
"@tauri-apps/plugin-upload": "2.3.2",
|
"@tauri-apps/plugin-upload": "2.5.0",
|
||||||
"@tauri-apps/plugin-window-state": "~2.4.1",
|
"@tauri-apps/plugin-websocket": "2.5.0",
|
||||||
"@types/node": "^25.0.3",
|
"@tauri-apps/plugin-window-state": "~2.5.0",
|
||||||
"@types/react": "^19.2.7",
|
"@types/node": "^26.6.5",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react": "^19.3.0",
|
||||||
"axios": "^1.13.2",
|
"@types/react-dom": "^19.3.0",
|
||||||
|
"axios": "^1.20.0",
|
||||||
"axios-tauri-api-adapter": "^2.0.6",
|
"axios-tauri-api-adapter": "^2.0.6",
|
||||||
"blurhash": "^2.0.5",
|
"blurhash": "^2.0.5",
|
||||||
"blurhash-wasm": "^0.2.0",
|
"blurhash-wasm": "^0.2.0",
|
||||||
"immer": "^11.1.0",
|
"immer": "^11.1.21",
|
||||||
"jassub": "^1.8.6",
|
"jassub": "^2.5.22",
|
||||||
"libpgs": "^0.8.1",
|
"libpgs": "^0.9.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.18.1",
|
||||||
"material-symbols": "^0.40.2",
|
"material-symbols": "^0.48.0",
|
||||||
"motion": "^12.23.26",
|
"motion": "^14.4.0",
|
||||||
"notistack": "^3.0.2",
|
"notistack": "^3.0.2",
|
||||||
"react": "^19.2.3",
|
"qrcode": "^1.5.4",
|
||||||
|
"react": "^19.3.1",
|
||||||
"react-blurhash": "^0.3.0",
|
"react-blurhash": "^0.3.0",
|
||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dom": "^19.2.3",
|
"react-dom": "^19.3.1",
|
||||||
"react-error-boundary": "^6.0.0",
|
"react-error-boundary": "^6.1.6",
|
||||||
"react-intersection-observer": "^10.0.0",
|
"react-intersection-observer": "^11.0.1",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-multi-carousel": "^2.8.6",
|
"react-multi-carousel": "^2.8.6",
|
||||||
"react-player": "^3.4.0",
|
"react-player": "^3.4.0",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^7.0.2",
|
||||||
"vite-plugin-svgr": "^4.5.0",
|
"vite-plugin-svgr": "^5.2.0",
|
||||||
"wavesurfer.js": "^7.12.1",
|
"vite-plugin-top-level-await": "^1.6.0",
|
||||||
"zod": "^4.2.1",
|
"wavesurfer.js": "^8.0.3",
|
||||||
"zustand": "5.0.9"
|
"zod": "^4.6.7",
|
||||||
|
"zustand": "5.0.15"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-optional-chaining-assign": "^7.27.1",
|
"@babel/plugin-proposal-optional-chaining-assign": "^8.0.1",
|
||||||
"@biomejs/biome": "^2.3.10",
|
"@biomejs/biome": "^2.5.15",
|
||||||
"@tanstack/router-cli": "^1.142.0",
|
"@tanstack/router-cli": "^1.167.45",
|
||||||
"@tanstack/router-devtools": "^1.141.8",
|
"@tanstack/router-vite-plugin": "^1.167.47",
|
||||||
"@tanstack/router-vite-plugin": "^1.142.0",
|
"@tauri-apps/cli": "2.12.3",
|
||||||
"@tauri-apps/cli": "2.9.6",
|
"@types/lodash": "^4.17.26",
|
||||||
"@types/lodash": "^4.17.21",
|
"@types/qrcode": "^1.5.6",
|
||||||
"@vitejs/plugin-react": "^5.1.2",
|
"@vitejs/plugin-react": "^6.1.2",
|
||||||
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
||||||
"eslint-plugin-react-hooks": "7.0.1",
|
"eslint-plugin-react-hooks": "7.1.1",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"sass": "^1.97.1",
|
"sass": "^1.105.2",
|
||||||
"vite": "^7.3.0",
|
"vite": "^8.3.4",
|
||||||
"vite-plugin-wasm": "^3.5.0"
|
"vite-plugin-wasm": "^3.6.0"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-only"
|
"license": "GPL-3.0-only"
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
onlyBuiltDependencies:
|
allowBuilds:
|
||||||
- '@parcel/watcher'
|
'@parcel/watcher': true
|
||||||
- core-js
|
'@swc/core': true
|
||||||
- esbuild
|
core-js: true
|
||||||
|
lfa-ponyfill: true
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "blink"
|
name = "blink"
|
||||||
version = "1.0.0-alpha.3"
|
version = "1.0.0-alpha.4"
|
||||||
description = "A Modern Jellyfin Client"
|
description = "A Modern Jellyfin Client"
|
||||||
authors = ["prayag17", "Blink contributors (https://github.com/prayag17/Blink/graphs/contributors)"]
|
authors = ["prayag17", "Blink contributors (https://github.com/prayag17/Blink/graphs/contributors)"]
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
@@ -12,13 +12,17 @@ rust-version = "1.59"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[build-dependencies]
|
[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]
|
[dependencies]
|
||||||
log = "^0.4.21"
|
log = "^0.4.21"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
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-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-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-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2", features = ["colored"] }
|
||||||
@@ -29,14 +33,42 @@ tauri-plugin-clipboard-manager = "2.1.0-beta.6"
|
|||||||
tauri-plugin-notification = "2.0.0-rc.1"
|
tauri-plugin-notification = "2.0.0-rc.1"
|
||||||
tauri-plugin-upload = "2.0.0"
|
tauri-plugin-upload = "2.0.0"
|
||||||
tauri-plugin-dialog = "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]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# 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
|
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||||
default = [ "custom-protocol" ]
|
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
|
# this feature is used for production builds where `devPath` points to the filesystem
|
||||||
# DO NOT remove this
|
# DO NOT remove this
|
||||||
custom-protocol = [ "tauri/custom-protocol" ]
|
custom-protocol = [ "tauri/custom-protocol" ]
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
|
tauri-plugin-global-shortcut = "2"
|
||||||
tauri-plugin-window-state = "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",
|
||||||
|
] }
|
||||||
@@ -9,6 +9,12 @@
|
|||||||
"main"
|
"main"
|
||||||
],
|
],
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"window-state:default"
|
"window-state:default",
|
||||||
|
"global-shortcut:default",
|
||||||
|
"global-shortcut:allow-is-registered",
|
||||||
|
"global-shortcut:allow-register",
|
||||||
|
"global-shortcut:allow-unregister",
|
||||||
|
"websocket:default",
|
||||||
|
"shell:default"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -13,10 +13,24 @@
|
|||||||
"store:allow-load",
|
"store:allow-load",
|
||||||
"updater:allow-check",
|
"updater:allow-check",
|
||||||
"updater:allow-download-and-install",
|
"updater:allow-download-and-install",
|
||||||
|
"updater:allow-download",
|
||||||
|
"updater:allow-install",
|
||||||
"notification:default",
|
"notification:default",
|
||||||
"core:webview:allow-internal-toggle-devtools",
|
"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",
|
"dialog:default",
|
||||||
"upload:allow-download",
|
"upload:allow-download",
|
||||||
"clipboard-manager:allow-write-text"
|
"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",
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
"identifier": "migrated",
|
"identifier": "migrated",
|
||||||
"description": "permissions that were migrated from v1",
|
"description": "permissions that were migrated from v1",
|
||||||
"local": true,
|
"local": true,
|
||||||
"windows": ["main"],
|
"windows": [
|
||||||
"permissions": [
|
"main"
|
||||||
"core:path:default",
|
],
|
||||||
"core:event:default",
|
"permissions": [
|
||||||
"core:window:default",
|
"core:path:default",
|
||||||
"core:app:default",
|
"core:event:default",
|
||||||
"core:resources:default",
|
"core:window:default",
|
||||||
"core:menu:default",
|
"core:app:default",
|
||||||
"core:tray:default",
|
"core:resources:default",
|
||||||
"core:window:allow-set-fullscreen"
|
"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.","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"]},"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-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.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener commLine 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 @@
|
|||||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state: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","notification:default","core:webview:allow-internal-toggle-devtools","dialog:default","upload:allow-download","clipboard-manager:allow-write-text"]},"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"]}}
|
||||||
@@ -134,6 +134,216 @@
|
|||||||
"description": "Reference a permission or permission set by identifier and extends its scope.",
|
"description": "Reference a permission or permission set by identifier and extends its scope.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
|
{
|
||||||
|
"if": {
|
||||||
|
"properties": {
|
||||||
|
"identifier": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:default",
|
||||||
|
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-execute",
|
||||||
|
"markdownDescription": "Enables the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-kill",
|
||||||
|
"markdownDescription": "Enables the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-open",
|
||||||
|
"markdownDescription": "Enables the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-spawn",
|
||||||
|
"markdownDescription": "Enables the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-stdin-write",
|
||||||
|
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-execute",
|
||||||
|
"markdownDescription": "Denies the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-kill",
|
||||||
|
"markdownDescription": "Denies the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-open",
|
||||||
|
"markdownDescription": "Denies the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-spawn",
|
||||||
|
"markdownDescription": "Denies the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-stdin-write",
|
||||||
|
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"then": {
|
||||||
|
"properties": {
|
||||||
|
"allow": {
|
||||||
|
"items": {
|
||||||
|
"title": "ShellScopeEntry",
|
||||||
|
"description": "Shell scope entry.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cmd",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cmd": {
|
||||||
|
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"sidecar"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"sidecar": {
|
||||||
|
"description": "If this command is a sidecar command.",
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deny": {
|
||||||
|
"items": {
|
||||||
|
"title": "ShellScopeEntry",
|
||||||
|
"description": "Shell scope entry.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cmd",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cmd": {
|
||||||
|
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"sidecar"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"sidecar": {
|
||||||
|
"description": "If this command is a sidecar command.",
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"identifier": {
|
||||||
|
"description": "Identifier of the permission or permission set.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/Identifier"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"identifier": {
|
"identifier": {
|
||||||
@@ -212,6 +422,12 @@
|
|||||||
"const": "clipboard-manager:allow-write-image",
|
"const": "clipboard-manager:allow-write-image",
|
||||||
"markdownDescription": "Enables the write_image command without any pre-configured scope."
|
"markdownDescription": "Enables the write_image command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the write_secret command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "clipboard-manager:allow-write-secret",
|
||||||
|
"markdownDescription": "Enables the write_secret command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the write_text command without any pre-configured scope.",
|
"description": "Enables the write_text command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -248,6 +464,12 @@
|
|||||||
"const": "clipboard-manager:deny-write-image",
|
"const": "clipboard-manager:deny-write-image",
|
||||||
"markdownDescription": "Denies the write_image command without any pre-configured scope."
|
"markdownDescription": "Denies the write_image command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the write_secret command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "clipboard-manager:deny-write-secret",
|
||||||
|
"markdownDescription": "Denies the write_secret command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the write_text command without any pre-configured scope.",
|
"description": "Denies the write_text command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -261,10 +483,10 @@
|
|||||||
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\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`"
|
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\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`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
|
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "core:app:default",
|
"const": "core:app:default",
|
||||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
|
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the app_hide command without any pre-configured scope.",
|
"description": "Enables the app_hide command without any pre-configured scope.",
|
||||||
@@ -290,6 +512,12 @@
|
|||||||
"const": "core:app:allow-default-window-icon",
|
"const": "core:app:allow-default-window-icon",
|
||||||
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
|
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the exit command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:allow-exit",
|
||||||
|
"markdownDescription": "Enables the exit command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
|
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -338,6 +566,12 @@
|
|||||||
"const": "core:app:allow-set-dock-visibility",
|
"const": "core:app:allow-set-dock-visibility",
|
||||||
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
|
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the supports_multiple_windows command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:allow-supports-multiple-windows",
|
||||||
|
"markdownDescription": "Enables the supports_multiple_windows command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the tauri_version command without any pre-configured scope.",
|
"description": "Enables the tauri_version command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -374,6 +608,12 @@
|
|||||||
"const": "core:app:deny-default-window-icon",
|
"const": "core:app:deny-default-window-icon",
|
||||||
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
|
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the exit command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:deny-exit",
|
||||||
|
"markdownDescription": "Denies the exit command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
|
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -422,6 +662,12 @@
|
|||||||
"const": "core:app:deny-set-dock-visibility",
|
"const": "core:app:deny-set-dock-visibility",
|
||||||
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
|
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the supports_multiple_windows command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:deny-supports-multiple-windows",
|
||||||
|
"markdownDescription": "Denies the supports_multiple_windows command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the tauri_version command without any pre-configured scope.",
|
"description": "Denies the tauri_version command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -945,10 +1191,10 @@
|
|||||||
"markdownDescription": "Denies the close command without any pre-configured scope."
|
"markdownDescription": "Denies the close command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`",
|
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "core:tray:default",
|
"const": "core:tray:default",
|
||||||
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`"
|
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the get_by_id command without any pre-configured scope.",
|
"description": "Enables the get_by_id command without any pre-configured scope.",
|
||||||
@@ -980,6 +1226,12 @@
|
|||||||
"const": "core:tray:allow-set-icon-as-template",
|
"const": "core:tray:allow-set-icon-as-template",
|
||||||
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
|
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_icon_with_as_template command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:tray:allow-set-icon-with-as-template",
|
||||||
|
"markdownDescription": "Enables the set_icon_with_as_template command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the set_menu command without any pre-configured scope.",
|
"description": "Enables the set_menu command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1046,6 +1298,12 @@
|
|||||||
"const": "core:tray:deny-set-icon-as-template",
|
"const": "core:tray:deny-set-icon-as-template",
|
||||||
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
|
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_icon_with_as_template command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:tray:deny-set-icon-with-as-template",
|
||||||
|
"markdownDescription": "Denies the set_icon_with_as_template command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the set_menu command without any pre-configured scope.",
|
"description": "Denies the set_menu command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1305,10 +1563,16 @@
|
|||||||
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
|
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`",
|
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "core:window:default",
|
"const": "core:window:default",
|
||||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`"
|
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the activity_name command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:allow-activity-name",
|
||||||
|
"markdownDescription": "Enables the activity_name command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the available_monitors command without any pre-configured scope.",
|
"description": "Enables the available_monitors command without any pre-configured scope.",
|
||||||
@@ -1502,6 +1766,12 @@
|
|||||||
"const": "core:window:allow-scale-factor",
|
"const": "core:window:allow-scale-factor",
|
||||||
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
|
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the scene_identifier command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:allow-scene-identifier",
|
||||||
|
"markdownDescription": "Enables the scene_identifier command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
|
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1604,6 +1874,12 @@
|
|||||||
"const": "core:window:allow-set-fullscreen",
|
"const": "core:window:allow-set-fullscreen",
|
||||||
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
|
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:allow-set-fullscreen-on-monitor",
|
||||||
|
"markdownDescription": "Enables the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the set_icon command without any pre-configured scope.",
|
"description": "Enables the set_icon command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1766,6 +2042,12 @@
|
|||||||
"const": "core:window:allow-unminimize",
|
"const": "core:window:allow-unminimize",
|
||||||
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
|
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the activity_name command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:deny-activity-name",
|
||||||
|
"markdownDescription": "Denies the activity_name command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the available_monitors command without any pre-configured scope.",
|
"description": "Denies the available_monitors command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1958,6 +2240,12 @@
|
|||||||
"const": "core:window:deny-scale-factor",
|
"const": "core:window:deny-scale-factor",
|
||||||
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
|
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the scene_identifier command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:deny-scene-identifier",
|
||||||
|
"markdownDescription": "Denies the scene_identifier command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
|
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2060,6 +2348,12 @@
|
|||||||
"const": "core:window:deny-set-fullscreen",
|
"const": "core:window:deny-set-fullscreen",
|
||||||
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
|
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:deny-set-fullscreen-on-monitor",
|
||||||
|
"markdownDescription": "Denies the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the set_icon command without any pre-configured scope.",
|
"description": "Denies the set_icon command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2223,22 +2517,76 @@
|
|||||||
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
|
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
"description": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:default",
|
||||||
|
"markdownDescription": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_current command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-get-current",
|
||||||
|
"markdownDescription": "Enables the get_current command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-is-registered",
|
||||||
|
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-register",
|
||||||
|
"markdownDescription": "Enables the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-unregister",
|
||||||
|
"markdownDescription": "Enables the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_current command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-get-current",
|
||||||
|
"markdownDescription": "Denies the get_current command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-is-registered",
|
||||||
|
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-register",
|
||||||
|
"markdownDescription": "Denies the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-unregister",
|
||||||
|
"markdownDescription": "Denies the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:default",
|
"const": "dialog:default",
|
||||||
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the ask command without any pre-configured scope.",
|
"description": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:allow-ask",
|
"const": "dialog:allow-ask",
|
||||||
"markdownDescription": "Enables the ask command without any pre-configured scope."
|
"markdownDescription": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the confirm command without any pre-configured scope.",
|
"description": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:allow-confirm",
|
"const": "dialog:allow-confirm",
|
||||||
"markdownDescription": "Enables the confirm command without any pre-configured scope."
|
"markdownDescription": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the message command without any pre-configured scope.",
|
"description": "Enables the message command without any pre-configured scope.",
|
||||||
@@ -2259,16 +2607,16 @@
|
|||||||
"markdownDescription": "Enables the save command without any pre-configured scope."
|
"markdownDescription": "Enables the save command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the ask command without any pre-configured scope.",
|
"description": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:deny-ask",
|
"const": "dialog:deny-ask",
|
||||||
"markdownDescription": "Denies the ask command without any pre-configured scope."
|
"markdownDescription": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the confirm command without any pre-configured scope.",
|
"description": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:deny-confirm",
|
"const": "dialog:deny-confirm",
|
||||||
"markdownDescription": "Denies the confirm command without any pre-configured scope."
|
"markdownDescription": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the message command without any pre-configured scope.",
|
"description": "Denies the message command without any pre-configured scope.",
|
||||||
@@ -2288,6 +2636,72 @@
|
|||||||
"const": "dialog:deny-save",
|
"const": "dialog:deny-save",
|
||||||
"markdownDescription": "Denies the save command without any pre-configured scope."
|
"markdownDescription": "Denies the save command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:default",
|
||||||
|
"markdownDescription": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-is-registered",
|
||||||
|
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-register",
|
||||||
|
"markdownDescription": "Enables the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the register_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-register-all",
|
||||||
|
"markdownDescription": "Enables the register_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-unregister",
|
||||||
|
"markdownDescription": "Enables the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unregister_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-unregister-all",
|
||||||
|
"markdownDescription": "Enables the unregister_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-is-registered",
|
||||||
|
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-register",
|
||||||
|
"markdownDescription": "Denies the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the register_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-register-all",
|
||||||
|
"markdownDescription": "Denies the register_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-unregister",
|
||||||
|
"markdownDescription": "Denies the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unregister_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-unregister-all",
|
||||||
|
"markdownDescription": "Denies the unregister_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`",
|
"description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2307,10 +2721,10 @@
|
|||||||
"markdownDescription": "Denies the log command without any pre-configured scope."
|
"markdownDescription": "Denies the log command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "notification:default",
|
"const": "notification:default",
|
||||||
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the batch command without any pre-configured scope.",
|
"description": "Enables the batch command without any pre-configured scope.",
|
||||||
@@ -2396,6 +2810,12 @@
|
|||||||
"const": "notification:allow-remove-active",
|
"const": "notification:allow-remove-active",
|
||||||
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
|
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the remove_listener command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "notification:allow-remove-listener",
|
||||||
|
"markdownDescription": "Enables the remove_listener command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the request_permission command without any pre-configured scope.",
|
"description": "Enables the request_permission command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2492,6 +2912,12 @@
|
|||||||
"const": "notification:deny-remove-active",
|
"const": "notification:deny-remove-active",
|
||||||
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
|
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the remove_listener command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "notification:deny-remove-listener",
|
||||||
|
"markdownDescription": "Denies the remove_listener command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the request_permission command without any pre-configured scope.",
|
"description": "Denies the request_permission command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2534,6 +2960,72 @@
|
|||||||
"const": "process:deny-restart",
|
"const": "process:deny-restart",
|
||||||
"markdownDescription": "Denies the restart command without any pre-configured scope."
|
"markdownDescription": "Denies the restart command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:default",
|
||||||
|
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-execute",
|
||||||
|
"markdownDescription": "Enables the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-kill",
|
||||||
|
"markdownDescription": "Enables the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-open",
|
||||||
|
"markdownDescription": "Enables the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-spawn",
|
||||||
|
"markdownDescription": "Enables the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-stdin-write",
|
||||||
|
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-execute",
|
||||||
|
"markdownDescription": "Denies the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-kill",
|
||||||
|
"markdownDescription": "Denies the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-open",
|
||||||
|
"markdownDescription": "Denies the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-spawn",
|
||||||
|
"markdownDescription": "Denies the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-stdin-write",
|
||||||
|
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`",
|
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2792,6 +3284,36 @@
|
|||||||
"const": "upload:deny-upload",
|
"const": "upload:deny-upload",
|
||||||
"markdownDescription": "Denies the upload command without any pre-configured scope."
|
"markdownDescription": "Denies the upload command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:default",
|
||||||
|
"markdownDescription": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the connect command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:allow-connect",
|
||||||
|
"markdownDescription": "Enables the connect command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the send command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:allow-send",
|
||||||
|
"markdownDescription": "Enables the send command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the connect command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:deny-connect",
|
||||||
|
"markdownDescription": "Denies the connect command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the send command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:deny-send",
|
||||||
|
"markdownDescription": "Denies the send command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`",
|
"description": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2929,6 +3451,50 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"ShellScopeEntryAllowedArg": {
|
||||||
|
"description": "A command argument allowed to be executed by the webview API.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"description": "A non-configurable argument that is passed to the command in the order it was specified.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A variable that is set while calling the command from the webview API.",
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"validator"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"raw": {
|
||||||
|
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
|
||||||
|
"default": false,
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"validator": {
|
||||||
|
"description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\nThe regex string is by default surrounded by `^...$` to match the full string. For example the `https?://\\w+` regex would be registered as `^https?://\\w+$`.\n\n[regex]: <https://docs.rs/regex/latest/regex/#syntax>",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ShellScopeEntryAllowedArgs": {
|
||||||
|
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,6 +134,216 @@
|
|||||||
"description": "Reference a permission or permission set by identifier and extends its scope.",
|
"description": "Reference a permission or permission set by identifier and extends its scope.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
|
{
|
||||||
|
"if": {
|
||||||
|
"properties": {
|
||||||
|
"identifier": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:default",
|
||||||
|
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-execute",
|
||||||
|
"markdownDescription": "Enables the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-kill",
|
||||||
|
"markdownDescription": "Enables the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-open",
|
||||||
|
"markdownDescription": "Enables the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-spawn",
|
||||||
|
"markdownDescription": "Enables the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-stdin-write",
|
||||||
|
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-execute",
|
||||||
|
"markdownDescription": "Denies the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-kill",
|
||||||
|
"markdownDescription": "Denies the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-open",
|
||||||
|
"markdownDescription": "Denies the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-spawn",
|
||||||
|
"markdownDescription": "Denies the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-stdin-write",
|
||||||
|
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"then": {
|
||||||
|
"properties": {
|
||||||
|
"allow": {
|
||||||
|
"items": {
|
||||||
|
"title": "ShellScopeEntry",
|
||||||
|
"description": "Shell scope entry.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cmd",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cmd": {
|
||||||
|
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"sidecar"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"sidecar": {
|
||||||
|
"description": "If this command is a sidecar command.",
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deny": {
|
||||||
|
"items": {
|
||||||
|
"title": "ShellScopeEntry",
|
||||||
|
"description": "Shell scope entry.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"cmd",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cmd": {
|
||||||
|
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"sidecar"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"args": {
|
||||||
|
"description": "The allowed arguments for the command execution.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"sidecar": {
|
||||||
|
"description": "If this command is a sidecar command.",
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"identifier": {
|
||||||
|
"description": "Identifier of the permission or permission set.",
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/Identifier"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"identifier": {
|
"identifier": {
|
||||||
@@ -212,6 +422,12 @@
|
|||||||
"const": "clipboard-manager:allow-write-image",
|
"const": "clipboard-manager:allow-write-image",
|
||||||
"markdownDescription": "Enables the write_image command without any pre-configured scope."
|
"markdownDescription": "Enables the write_image command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the write_secret command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "clipboard-manager:allow-write-secret",
|
||||||
|
"markdownDescription": "Enables the write_secret command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the write_text command without any pre-configured scope.",
|
"description": "Enables the write_text command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -248,6 +464,12 @@
|
|||||||
"const": "clipboard-manager:deny-write-image",
|
"const": "clipboard-manager:deny-write-image",
|
||||||
"markdownDescription": "Denies the write_image command without any pre-configured scope."
|
"markdownDescription": "Denies the write_image command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the write_secret command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "clipboard-manager:deny-write-secret",
|
||||||
|
"markdownDescription": "Denies the write_secret command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the write_text command without any pre-configured scope.",
|
"description": "Denies the write_text command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -261,10 +483,10 @@
|
|||||||
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\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`"
|
"markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\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`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
|
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "core:app:default",
|
"const": "core:app:default",
|
||||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
|
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-supports-multiple-windows`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the app_hide command without any pre-configured scope.",
|
"description": "Enables the app_hide command without any pre-configured scope.",
|
||||||
@@ -290,6 +512,12 @@
|
|||||||
"const": "core:app:allow-default-window-icon",
|
"const": "core:app:allow-default-window-icon",
|
||||||
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
|
"markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the exit command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:allow-exit",
|
||||||
|
"markdownDescription": "Enables the exit command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
|
"description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -338,6 +566,12 @@
|
|||||||
"const": "core:app:allow-set-dock-visibility",
|
"const": "core:app:allow-set-dock-visibility",
|
||||||
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
|
"markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the supports_multiple_windows command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:allow-supports-multiple-windows",
|
||||||
|
"markdownDescription": "Enables the supports_multiple_windows command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the tauri_version command without any pre-configured scope.",
|
"description": "Enables the tauri_version command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -374,6 +608,12 @@
|
|||||||
"const": "core:app:deny-default-window-icon",
|
"const": "core:app:deny-default-window-icon",
|
||||||
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
|
"markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the exit command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:deny-exit",
|
||||||
|
"markdownDescription": "Denies the exit command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
|
"description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -422,6 +662,12 @@
|
|||||||
"const": "core:app:deny-set-dock-visibility",
|
"const": "core:app:deny-set-dock-visibility",
|
||||||
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
|
"markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the supports_multiple_windows command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:app:deny-supports-multiple-windows",
|
||||||
|
"markdownDescription": "Denies the supports_multiple_windows command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the tauri_version command without any pre-configured scope.",
|
"description": "Denies the tauri_version command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -945,10 +1191,10 @@
|
|||||||
"markdownDescription": "Denies the close command without any pre-configured scope."
|
"markdownDescription": "Denies the close command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`",
|
"description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "core:tray:default",
|
"const": "core:tray:default",
|
||||||
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`"
|
"markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-icon-with-as-template`\n- `allow-set-show-menu-on-left-click`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the get_by_id command without any pre-configured scope.",
|
"description": "Enables the get_by_id command without any pre-configured scope.",
|
||||||
@@ -980,6 +1226,12 @@
|
|||||||
"const": "core:tray:allow-set-icon-as-template",
|
"const": "core:tray:allow-set-icon-as-template",
|
||||||
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
|
"markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_icon_with_as_template command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:tray:allow-set-icon-with-as-template",
|
||||||
|
"markdownDescription": "Enables the set_icon_with_as_template command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the set_menu command without any pre-configured scope.",
|
"description": "Enables the set_menu command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1046,6 +1298,12 @@
|
|||||||
"const": "core:tray:deny-set-icon-as-template",
|
"const": "core:tray:deny-set-icon-as-template",
|
||||||
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
|
"markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_icon_with_as_template command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:tray:deny-set-icon-with-as-template",
|
||||||
|
"markdownDescription": "Denies the set_icon_with_as_template command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the set_menu command without any pre-configured scope.",
|
"description": "Denies the set_menu command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1305,10 +1563,16 @@
|
|||||||
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
|
"markdownDescription": "Denies the webview_size command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`",
|
"description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "core:window:default",
|
"const": "core:window:default",
|
||||||
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`"
|
"markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-activity-name`\n- `allow-scene-identifier`\n- `allow-internal-toggle-maximize`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the activity_name command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:allow-activity-name",
|
||||||
|
"markdownDescription": "Enables the activity_name command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the available_monitors command without any pre-configured scope.",
|
"description": "Enables the available_monitors command without any pre-configured scope.",
|
||||||
@@ -1502,6 +1766,12 @@
|
|||||||
"const": "core:window:allow-scale-factor",
|
"const": "core:window:allow-scale-factor",
|
||||||
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
|
"markdownDescription": "Enables the scale_factor command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the scene_identifier command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:allow-scene-identifier",
|
||||||
|
"markdownDescription": "Enables the scene_identifier command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
|
"description": "Enables the set_always_on_bottom command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1604,6 +1874,12 @@
|
|||||||
"const": "core:window:allow-set-fullscreen",
|
"const": "core:window:allow-set-fullscreen",
|
||||||
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
|
"markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:allow-set-fullscreen-on-monitor",
|
||||||
|
"markdownDescription": "Enables the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the set_icon command without any pre-configured scope.",
|
"description": "Enables the set_icon command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1766,6 +2042,12 @@
|
|||||||
"const": "core:window:allow-unminimize",
|
"const": "core:window:allow-unminimize",
|
||||||
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
|
"markdownDescription": "Enables the unminimize command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the activity_name command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:deny-activity-name",
|
||||||
|
"markdownDescription": "Denies the activity_name command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the available_monitors command without any pre-configured scope.",
|
"description": "Denies the available_monitors command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -1958,6 +2240,12 @@
|
|||||||
"const": "core:window:deny-scale-factor",
|
"const": "core:window:deny-scale-factor",
|
||||||
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
|
"markdownDescription": "Denies the scale_factor command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the scene_identifier command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:deny-scene-identifier",
|
||||||
|
"markdownDescription": "Denies the scene_identifier command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
|
"description": "Denies the set_always_on_bottom command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2060,6 +2348,12 @@
|
|||||||
"const": "core:window:deny-set-fullscreen",
|
"const": "core:window:deny-set-fullscreen",
|
||||||
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
|
"markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_fullscreen_on_monitor command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "core:window:deny-set-fullscreen-on-monitor",
|
||||||
|
"markdownDescription": "Denies the set_fullscreen_on_monitor command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the set_icon command without any pre-configured scope.",
|
"description": "Denies the set_icon command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2223,22 +2517,76 @@
|
|||||||
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
|
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
"description": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:default",
|
||||||
|
"markdownDescription": "Allows reading the opened deep link via the get_current command\n#### This default permission set includes:\n\n- `allow-get-current`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_current command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-get-current",
|
||||||
|
"markdownDescription": "Enables the get_current command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-is-registered",
|
||||||
|
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-register",
|
||||||
|
"markdownDescription": "Enables the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:allow-unregister",
|
||||||
|
"markdownDescription": "Enables the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_current command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-get-current",
|
||||||
|
"markdownDescription": "Denies the get_current command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-is-registered",
|
||||||
|
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-register",
|
||||||
|
"markdownDescription": "Denies the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deep-link:deny-unregister",
|
||||||
|
"markdownDescription": "Denies the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:default",
|
"const": "dialog:default",
|
||||||
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-ask`\n- `allow-confirm`\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
"markdownDescription": "This permission set configures the types of dialogs\navailable from the dialog plugin.\n\n#### Granted Permissions\n\nAll dialog types are enabled.\n\n\n\n#### This default permission set includes:\n\n- `allow-message`\n- `allow-save`\n- `allow-open`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the ask command without any pre-configured scope.",
|
"description": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:allow-ask",
|
"const": "dialog:allow-ask",
|
||||||
"markdownDescription": "Enables the ask command without any pre-configured scope."
|
"markdownDescription": "Enables the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the confirm command without any pre-configured scope.",
|
"description": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:allow-confirm",
|
"const": "dialog:allow-confirm",
|
||||||
"markdownDescription": "Enables the confirm command without any pre-configured scope."
|
"markdownDescription": "Enables the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `allow-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the message command without any pre-configured scope.",
|
"description": "Enables the message command without any pre-configured scope.",
|
||||||
@@ -2259,16 +2607,16 @@
|
|||||||
"markdownDescription": "Enables the save command without any pre-configured scope."
|
"markdownDescription": "Enables the save command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the ask command without any pre-configured scope.",
|
"description": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:deny-ask",
|
"const": "dialog:deny-ask",
|
||||||
"markdownDescription": "Denies the ask command without any pre-configured scope."
|
"markdownDescription": "Denies the ask command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the confirm command without any pre-configured scope.",
|
"description": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "dialog:deny-confirm",
|
"const": "dialog:deny-confirm",
|
||||||
"markdownDescription": "Denies the confirm command without any pre-configured scope."
|
"markdownDescription": "Denies the confirm command without any pre-configured scope. (**DEPRECATED**: This is now an alias to `deny-message` and will be removed in v3)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the message command without any pre-configured scope.",
|
"description": "Denies the message command without any pre-configured scope.",
|
||||||
@@ -2288,6 +2636,72 @@
|
|||||||
"const": "dialog:deny-save",
|
"const": "dialog:deny-save",
|
||||||
"markdownDescription": "Denies the save command without any pre-configured scope."
|
"markdownDescription": "Denies the save command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:default",
|
||||||
|
"markdownDescription": "No features are enabled by default, as we believe\nthe shortcuts can be inherently dangerous and it is\napplication specific if specific shortcuts should be\nregistered or unregistered.\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-is-registered",
|
||||||
|
"markdownDescription": "Enables the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-register",
|
||||||
|
"markdownDescription": "Enables the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the register_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-register-all",
|
||||||
|
"markdownDescription": "Enables the register_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-unregister",
|
||||||
|
"markdownDescription": "Enables the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unregister_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:allow-unregister-all",
|
||||||
|
"markdownDescription": "Enables the unregister_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the is_registered command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-is-registered",
|
||||||
|
"markdownDescription": "Denies the is_registered command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the register command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-register",
|
||||||
|
"markdownDescription": "Denies the register command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the register_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-register-all",
|
||||||
|
"markdownDescription": "Denies the register_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unregister command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-unregister",
|
||||||
|
"markdownDescription": "Denies the unregister command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unregister_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "global-shortcut:deny-unregister-all",
|
||||||
|
"markdownDescription": "Denies the unregister_all command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`",
|
"description": "Allows the log command\n#### This default permission set includes:\n\n- `allow-log`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2307,10 +2721,10 @@
|
|||||||
"markdownDescription": "Denies the log command without any pre-configured scope."
|
"markdownDescription": "Denies the log command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "notification:default",
|
"const": "notification:default",
|
||||||
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the batch command without any pre-configured scope.",
|
"description": "Enables the batch command without any pre-configured scope.",
|
||||||
@@ -2396,6 +2810,12 @@
|
|||||||
"const": "notification:allow-remove-active",
|
"const": "notification:allow-remove-active",
|
||||||
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
|
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the remove_listener command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "notification:allow-remove-listener",
|
||||||
|
"markdownDescription": "Enables the remove_listener command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the request_permission command without any pre-configured scope.",
|
"description": "Enables the request_permission command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2492,6 +2912,12 @@
|
|||||||
"const": "notification:deny-remove-active",
|
"const": "notification:deny-remove-active",
|
||||||
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
|
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the remove_listener command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "notification:deny-remove-listener",
|
||||||
|
"markdownDescription": "Denies the remove_listener command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Denies the request_permission command without any pre-configured scope.",
|
"description": "Denies the request_permission command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2534,6 +2960,72 @@
|
|||||||
"const": "process:deny-restart",
|
"const": "process:deny-restart",
|
||||||
"markdownDescription": "Denies the restart command without any pre-configured scope."
|
"markdownDescription": "Denies the restart command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:default",
|
||||||
|
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-execute",
|
||||||
|
"markdownDescription": "Enables the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-kill",
|
||||||
|
"markdownDescription": "Enables the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-open",
|
||||||
|
"markdownDescription": "Enables the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-spawn",
|
||||||
|
"markdownDescription": "Enables the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:allow-stdin-write",
|
||||||
|
"markdownDescription": "Enables the stdin_write command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the execute command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-execute",
|
||||||
|
"markdownDescription": "Denies the execute command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the kill command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-kill",
|
||||||
|
"markdownDescription": "Denies the kill command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the open command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-open",
|
||||||
|
"markdownDescription": "Denies the open command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the spawn command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-spawn",
|
||||||
|
"markdownDescription": "Denies the spawn command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "shell:deny-stdin-write",
|
||||||
|
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`",
|
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-load`\n- `allow-get-store`\n- `allow-set`\n- `allow-get`\n- `allow-has`\n- `allow-delete`\n- `allow-clear`\n- `allow-reset`\n- `allow-keys`\n- `allow-values`\n- `allow-entries`\n- `allow-length`\n- `allow-reload`\n- `allow-save`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2792,6 +3284,36 @@
|
|||||||
"const": "upload:deny-upload",
|
"const": "upload:deny-upload",
|
||||||
"markdownDescription": "Denies the upload command without any pre-configured scope."
|
"markdownDescription": "Denies the upload command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:default",
|
||||||
|
"markdownDescription": "Allows connecting and sending data to a WebSocket server\n#### This default permission set includes:\n\n- `allow-connect`\n- `allow-send`"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the connect command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:allow-connect",
|
||||||
|
"markdownDescription": "Enables the connect command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the send command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:allow-send",
|
||||||
|
"markdownDescription": "Enables the send command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the connect command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:deny-connect",
|
||||||
|
"markdownDescription": "Denies the connect command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the send command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "websocket:deny-send",
|
||||||
|
"markdownDescription": "Denies the send command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`",
|
"description": "This permission set configures what kind of\noperations are available from the window state plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n\n#### This default permission set includes:\n\n- `allow-filename`\n- `allow-restore-state`\n- `allow-save-window-state`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -2929,6 +3451,50 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"ShellScopeEntryAllowedArg": {
|
||||||
|
"description": "A command argument allowed to be executed by the webview API.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"description": "A non-configurable argument that is passed to the command in the order it was specified.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A variable that is set while calling the command from the webview API.",
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"validator"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"raw": {
|
||||||
|
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
|
||||||
|
"default": false,
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"validator": {
|
||||||
|
"description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\nThe regex string is by default surrounded by `^...$` to match the full string. For example the `https?://\\w+` regex would be registered as `^https?://\\w+$`.\n\n[regex]: <https://docs.rs/regex/latest/regex/#syntax>",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ShellScopeEntryAllowedArgs": {
|
||||||
|
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/ShellScopeEntryAllowedArg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,23 +1,5 @@
|
|||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
use tauri_plugin_log::{fern::colors::ColoredLevelConfig, Target, TargetKind};
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
blink_lib::run();
|
||||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
|
||||||
.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 Blink");
|
|
||||||
}
|
}
|
||||||
@@ -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>,
|
||||||
|
}
|
||||||
@@ -54,6 +54,11 @@
|
|||||||
"version": "../package.json",
|
"version": "../package.json",
|
||||||
"identifier": "com.blink.prayag17",
|
"identifier": "com.blink.prayag17",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
|
"deep-link": {
|
||||||
|
"desktop": {
|
||||||
|
"schemes": ["blink"]
|
||||||
|
}
|
||||||
|
},
|
||||||
"updater": {
|
"updater": {
|
||||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZBOTJGNzM3REU2Q0JEMEYKUldRUHZXemVOL2VTK2k2andMWTZYbEN6SnIwV0V0L2Z3NlA4RzFabThPaXRqSFRMc004WGhCb2kK",
|
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZBOTJGNzM3REU2Q0JEMEYKUldRUHZXemVOL2VTK2k2andMWTZYbEN6SnIwV0V0L2Z3NlA4RzFabThPaXRqSFRMc004WGhCb2kK",
|
||||||
"endpoints": [
|
"endpoints": [
|
||||||
@@ -77,11 +82,19 @@
|
|||||||
"label": "main",
|
"label": "main",
|
||||||
"dragDropEnabled": false,
|
"dragDropEnabled": false,
|
||||||
"backgroundColor": "#08001f",
|
"backgroundColor": "#08001f",
|
||||||
"transparent": false
|
"transparent": false,
|
||||||
|
"titleBarStyle": "Overlay",
|
||||||
|
"hiddenTitle": true,
|
||||||
|
"trafficLightPosition": { "x": 18, "y": 31 }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"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`
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import { setServer } from "@/utils/storage/servers";
|
|
||||||
import { jellyfin } from "@/utils/store/api";
|
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { LoadingButton } from "@mui/lab";
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
InputBase,
|
||||||
DialogContent,
|
Stack,
|
||||||
DialogTitle,
|
Typography,
|
||||||
TextField,
|
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import { setServer } from "@/utils/storage/servers";
|
||||||
|
import { jellyfin } from "@/utils/store/api";
|
||||||
|
|
||||||
type AddServerDialogProps = {
|
type AddServerDialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -37,7 +37,7 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
|||||||
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
||||||
setAddServerDialog(false);
|
setAddServerDialog(false);
|
||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
"Client added successfully. You might need to refresh client list.",
|
"Сервер добавлен. Возможно, потребуется обновить список серверов.",
|
||||||
{
|
{
|
||||||
variant: "success",
|
variant: "success",
|
||||||
},
|
},
|
||||||
@@ -50,11 +50,11 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
|||||||
onError: (err) => {
|
onError: (err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
enqueueSnackbar(`${err}`, { variant: "error" });
|
enqueueSnackbar(`${err}`, { variant: "error" });
|
||||||
enqueueSnackbar("Something went wrong", { variant: "error" });
|
enqueueSnackbar("Что-то пошло не так", { variant: "error" });
|
||||||
},
|
},
|
||||||
onSettled: async (bestServer) => {
|
onSettled: async (bestServer) => {
|
||||||
if (!bestServer) {
|
if (!bestServer) {
|
||||||
enqueueSnackbar("Provided server address is not a Jellyfin server.", {
|
enqueueSnackbar("Указанный адрес не является сервером Jellyfin.", {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -64,72 +64,130 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
|||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
|
onClose={() => setAddServerDialog(false)}
|
||||||
hideBackdrop={Boolean(hideBackdrop)}
|
hideBackdrop={Boolean(hideBackdrop)}
|
||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
disableScrollLock={true}
|
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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<DialogTitle variant="h4" align="center" mb={1}>
|
<Stack
|
||||||
Add Server
|
spacing={3}
|
||||||
</DialogTitle>
|
sx={{
|
||||||
<DialogContent className="settings-server-add">
|
p: 4,
|
||||||
<TextField
|
|
||||||
variant="filled"
|
|
||||||
label="Address"
|
|
||||||
fullWidth
|
|
||||||
onChange={(e) => setServerIp(e.target.value)}
|
|
||||||
/>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions
|
|
||||||
style={{
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
padding: "1em",
|
|
||||||
gap: "1em",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button
|
<Stack
|
||||||
variant="contained"
|
spacing={1}
|
||||||
startIcon={
|
sx={{
|
||||||
<span
|
alignItems: "center",
|
||||||
className="material-symbols-rounded"
|
}}
|
||||||
style={{
|
|
||||||
marginRight: "0.25em",
|
|
||||||
fontVariationSettings:
|
|
||||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
cancel
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
color="error"
|
|
||||||
onClick={() => setAddServerDialog(false)}
|
|
||||||
>
|
>
|
||||||
Close
|
<span
|
||||||
</Button>
|
className="material-symbols-rounded"
|
||||||
{/* @ts-ignore */}
|
style={{
|
||||||
<LoadingButton
|
fontSize: "48px",
|
||||||
startIcon={
|
color: "var(--mui-palette-primary-main)",
|
||||||
<span
|
}}
|
||||||
className="material-symbols-rounded"
|
>
|
||||||
style={{
|
add_to_queue
|
||||||
marginRight: "0.25em",
|
</span>
|
||||||
fontVariationSettings:
|
<Typography
|
||||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
variant="h5"
|
||||||
}}
|
sx={{
|
||||||
>
|
fontWeight: "bold",
|
||||||
add_circle
|
textAlign: "center",
|
||||||
</span>
|
}}
|
||||||
}
|
>
|
||||||
variant="contained"
|
Подключиться к серверу
|
||||||
loading={addServer.isPending}
|
</Typography>
|
||||||
loadingPosition="start"
|
<Typography
|
||||||
onClick={addServer.mutate}
|
variant="body2"
|
||||||
color="success"
|
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",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Add
|
<span className="material-symbols-rounded" style={{ opacity: 0.5 }}>
|
||||||
</LoadingButton>
|
dns
|
||||||
</DialogActions>
|
</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>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,60 +1,111 @@
|
|||||||
.item-info-track{
|
.album-track {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 3em 60% 6em 1fr;
|
grid-template-columns: 2.4em minmax(0, 1fr) 4.5em 2.6em;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
padding: 1em;
|
align-items: center;
|
||||||
align-items: center;
|
padding: 0.5em 1em;
|
||||||
cursor: pointer;
|
border-radius: 8px;
|
||||||
border-radius: $border-radius-default;
|
cursor: pointer;
|
||||||
transition: background $transition-time-fast;
|
transition: background $transition-time-fast;
|
||||||
&.header {
|
|
||||||
border-bottom: 1px solid rgb(255 255 255 / 0.2);
|
&-index {
|
||||||
color: rgb(255 255 255 / 0.7);
|
position: relative;
|
||||||
border-radius: 0 !important;
|
display: grid;
|
||||||
}
|
place-items: center;
|
||||||
.index-container {
|
}
|
||||||
justify-self: center;
|
|
||||||
position: relative;
|
&-number {
|
||||||
.material-symbols-rounded {
|
font-size: 0.8rem;
|
||||||
position: absolute;
|
color: rgb(255 255 255 / 0.4);
|
||||||
top: 50%;
|
font-variant-numeric: tabular-nums;
|
||||||
left: 50%;
|
}
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
font-size: 2em !important;
|
&-play {
|
||||||
opacity: 0;
|
position: absolute;
|
||||||
transition: none !important;
|
top: 50%;
|
||||||
color: $clr-accent-default;
|
left: 50%;
|
||||||
}
|
transform: translate(-50%, -50%) scale(0.9);
|
||||||
}
|
opacity: 0;
|
||||||
&-info {
|
font-size: 1.4rem;
|
||||||
display: flex;
|
color: #fff;
|
||||||
flex-direction: column;
|
transition: opacity $transition-time-fast, transform $transition-time-fast;
|
||||||
gap: 0.1em
|
}
|
||||||
}
|
|
||||||
&:hover {
|
&-info {
|
||||||
background: rgb(255 255 255 / 0.1) !important;
|
display: flex;
|
||||||
.index-container {
|
flex-direction: column;
|
||||||
// font-size: 0em;
|
gap: 0.15em;
|
||||||
.index {
|
min-width: 0;
|
||||||
opacity: 0;
|
}
|
||||||
transition: opacity 0;
|
|
||||||
}
|
&-name {
|
||||||
.material-symbols-rounded {
|
font-size: 0.95rem;
|
||||||
opacity: 1;
|
color: rgb(255 255 255 / 0.92);
|
||||||
font-size: 2.2em !important;
|
white-space: nowrap;
|
||||||
}
|
overflow: hidden;
|
||||||
}
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
&.playing {
|
|
||||||
background: rgb(0 0 0 / 0.4) !important;
|
&-artist {
|
||||||
.item-info-track-info-name, .index {
|
display: flex;
|
||||||
color: $clr-accent-default;
|
align-items: center;
|
||||||
font-weight: 600;
|
gap: 0.5em;
|
||||||
}
|
font-size: 0.78rem;
|
||||||
}
|
color: rgb(255 255 255 / 0.45);
|
||||||
&-container {
|
|
||||||
display: flex;
|
img {
|
||||||
flex-direction: column;
|
width: 1em;
|
||||||
gap: 0.4em
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,19 @@
|
|||||||
|
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 {
|
import {
|
||||||
generateAudioStreamUrl,
|
generateAudioStreamUrl,
|
||||||
playAudio,
|
playAudio,
|
||||||
useAudioPlayback,
|
useAudioPlayback,
|
||||||
} from "@/utils/store/audioPlayback";
|
} from "@/utils/store/audioPlayback";
|
||||||
import type {
|
|
||||||
BaseItemDto,
|
|
||||||
BaseItemDtoQueryResult,
|
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { Typography } from "@mui/material";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
import { getRuntimeMusic } from "@/utils/date/time";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { setQueue } from "@/utils/store/queue";
|
import { setQueue } from "@/utils/store/queue";
|
||||||
import { useSnackbar } from "notistack";
|
|
||||||
import lyricsIcon from "../../assets/icons/lyrics.svg";
|
|
||||||
import LikeButton from "../buttons/likeButton";
|
import LikeButton from "../buttons/likeButton";
|
||||||
|
|
||||||
import "./albumMusicTrack.scss";
|
import "./albumMusicTrack.scss";
|
||||||
@@ -45,7 +43,7 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
|
|||||||
) => {
|
) => {
|
||||||
if (!user?.Id || !api) {
|
if (!user?.Id || !api) {
|
||||||
console.error("User not logged in");
|
console.error("User not logged in");
|
||||||
enqueueSnackbar("You need to be logged in to play music", {
|
enqueueSnackbar("Войдите, чтобы слушать музыку", {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -62,44 +60,53 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
|
|||||||
setQueue(queue, index);
|
setQueue(queue, index);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isPlaying = currentPlayingItem?.Id === track.Id;
|
||||||
|
const artists = track.Artists?.filter(Boolean) ?? [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={
|
className={isPlaying ? "album-track is-playing" : "album-track"}
|
||||||
currentPlayingItem?.Id === track.Id
|
|
||||||
? "item-info-track playing"
|
|
||||||
: "item-info-track"
|
|
||||||
}
|
|
||||||
key={track.Id}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (musicTracks?.Items) {
|
if (musicTracks?.Items) {
|
||||||
handlePlayback(trackIndex, track, 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="index-container">
|
<div className="album-track-index">
|
||||||
<span className="material-symbols-rounded fill ">play_arrow</span>
|
<span className="material-symbols-rounded album-track-play">
|
||||||
<Typography className="index">{track.IndexNumber ?? "-"}</Typography>
|
play_arrow
|
||||||
|
</span>
|
||||||
|
<span className="album-track-number">
|
||||||
|
{track.IndexNumber ?? "–"}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="item-info-track-info">
|
<div className="album-track-info">
|
||||||
<Typography className="item-info-track-info-name">
|
<span className="album-track-name">{track.Name}</span>
|
||||||
{track.Name}
|
{(artists.length > 0 || track.HasLyrics) && (
|
||||||
</Typography>
|
<span className="album-track-artist">
|
||||||
<Typography
|
{track.HasLyrics && (
|
||||||
variant="subtitle2"
|
<img src={lyricsIcon} alt="Есть текст песни" />
|
||||||
style={{
|
)}
|
||||||
opacity: 0.6,
|
{artists.join(", ")}
|
||||||
display: "flex",
|
</span>
|
||||||
alignItems: "center",
|
)}
|
||||||
gap: "0.6em",
|
|
||||||
}}
|
|
||||||
fontWeight={300}
|
|
||||||
>
|
|
||||||
{track.HasLyrics && <img src={lyricsIcon} alt="lyrics" />}
|
|
||||||
{track.Artists?.join(", ")}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
</div>
|
||||||
<Typography>{getRuntimeMusic(track.RunTimeTicks ?? 0)}</Typography>
|
<span className="album-track-duration">
|
||||||
<div className="flex flex-align-center">
|
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||||
|
</span>
|
||||||
|
<div className="album-track-like" onClick={(e) => e.stopPropagation()}>
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemId={track.Id}
|
itemId={track.Id}
|
||||||
isFavorite={track.UserData?.IsFavorite}
|
isFavorite={track.UserData?.IsFavorite}
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ export const AlphaSelector = React.memo(function AlphaSelector() {
|
|||||||
const arr = Array.from({ length: 26 }, (_, i) =>
|
const arr = Array.from({ length: 26 }, (_, i) =>
|
||||||
String.fromCharCode(65 + i),
|
String.fromCharCode(65 + i),
|
||||||
);
|
);
|
||||||
return ["All", ...arr];
|
return ["Все", ...arr];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleSelect = (letter: string) => {
|
const handleSelect = (letter: string) => {
|
||||||
const value = letter === "All" ? undefined : letter;
|
const value = letter === "Все" ? undefined : letter;
|
||||||
if (currentLibraryId)
|
if (currentLibraryId)
|
||||||
updateLibrary(currentLibraryId, { nameStartsWith: value });
|
updateLibrary(currentLibraryId, { nameStartsWith: value });
|
||||||
};
|
};
|
||||||
@@ -31,13 +31,13 @@ export const AlphaSelector = React.memo(function AlphaSelector() {
|
|||||||
return (
|
return (
|
||||||
<div className="alpha-selector">
|
<div className="alpha-selector">
|
||||||
{letters.map((l) => {
|
{letters.map((l) => {
|
||||||
const active = (nameStartsWith || "All") === l;
|
const active = (nameStartsWith || "Все") === l;
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={l}
|
key={l}
|
||||||
className={active ? "alpha-letter active" : "alpha-letter"}
|
className={active ? "alpha-letter active" : "alpha-letter"}
|
||||||
onClick={() => handleSelect(l)}
|
onClick={() => handleSelect(l)}
|
||||||
aria-label={`Filter by ${l}`}
|
aria-label={`Фильтр по букве ${l}`}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
{l}
|
{l}
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
|
|
||||||
.appBar {
|
|
||||||
// Limit transitions to cheaper properties; avoid animating box-shadow directly
|
|
||||||
transition: background-color $transition-time-fast;
|
|
||||||
padding: 0.8em ($page-margin - 1.7em);
|
|
||||||
z-index: 999 !important;
|
|
||||||
.flex {
|
|
||||||
// Avoid animating padding; it causes layout reflow on each frame.
|
|
||||||
transition: background-color $transition-time-fast;
|
|
||||||
// Avoid using will-change: scroll-position; it can degrade performance when misused
|
|
||||||
// will-change: opacity, transform;
|
|
||||||
border-radius: 1000px;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
// Pseudo-element handles elevation shadow; we animate its opacity
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
backdrop-filter: blur(40px);
|
|
||||||
inset: -0.35em;
|
|
||||||
pointer-events: none;
|
|
||||||
border-radius: inherit;
|
|
||||||
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
|
|
||||||
background: rgb(0 0 0 / 0.4);
|
|
||||||
opacity: 0;
|
|
||||||
z-index: -1;
|
|
||||||
transition: opacity $transition-time-fast;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inner content wrapper that we can scale without causing layout reflow
|
|
||||||
.flex-inner {
|
|
||||||
transform-origin: top center;
|
|
||||||
transition: transform $transition-time-fast;
|
|
||||||
}
|
|
||||||
&.elevated{
|
|
||||||
.flex {
|
|
||||||
&::after {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply a subtle scale to simulate shrink without layout changes
|
|
||||||
.flex-inner {
|
|
||||||
transform: scaleY(0.95);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-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,246 +0,0 @@
|
|||||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
|
||||||
import MuiAppBar from "@mui/material/AppBar";
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import { useLocation, useNavigate } from "@tanstack/react-router";
|
|
||||||
import React, { useCallback, useMemo, useState } from "react";
|
|
||||||
|
|
||||||
import "./appBar.scss";
|
|
||||||
|
|
||||||
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
|
|
||||||
import { useShallow } from "zustand/shallow";
|
|
||||||
// removed search placeholder; library state now managed via zustand
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
|
||||||
import useHeaderStore from "@/utils/store/header";
|
|
||||||
import {
|
|
||||||
setSettingsDialogOpen,
|
|
||||||
setSettingsTabValue,
|
|
||||||
} from "@/utils/store/settings";
|
|
||||||
import BackButton from "../buttons/backButton";
|
|
||||||
import ListItemLink from "../listItemLink";
|
|
||||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
|
||||||
|
|
||||||
const MemoizeBackButton = React.memo(BackButton);
|
|
||||||
|
|
||||||
const HIDDEN_PATHS = [
|
|
||||||
"/login",
|
|
||||||
"/setup",
|
|
||||||
"/server",
|
|
||||||
"/player",
|
|
||||||
"/error",
|
|
||||||
"/settings",
|
|
||||||
"/library",
|
|
||||||
];
|
|
||||||
|
|
||||||
export const AppBar = () => {
|
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const location = useLocation();
|
|
||||||
|
|
||||||
const display = !HIDDEN_PATHS.some(
|
|
||||||
(path) => location.pathname.startsWith(path) || location.pathname === "/",
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
const [user] = useCentralStore((s) => [s.currentUser]);
|
|
||||||
const libraries = useQuery({
|
|
||||||
queryKey: ["libraries"],
|
|
||||||
queryFn: async () => {
|
|
||||||
if (!user?.Id || !api?.accessToken) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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 [showDrawer, setShowDrawer] = useState(false);
|
|
||||||
|
|
||||||
const appBarStyling = useMemo(() => {
|
|
||||||
return {
|
|
||||||
backgroundColor: "transparent",
|
|
||||||
paddingRight: "0 !important",
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
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" });
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useHeaderStore(useShallow((s) => ({ pageTitle: s.pageTitle })));
|
|
||||||
|
|
||||||
if (!display) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
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>
|
|
||||||
<UserAvatarMenu />
|
|
||||||
</div>
|
|
||||||
</MuiAppBar>
|
|
||||||
<Drawer
|
|
||||||
open={showDrawer}
|
|
||||||
slotProps={{ paper: 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
|
|
||||||
className="library-drawer-item"
|
|
||||||
to="/home"
|
|
||||||
icon="home"
|
|
||||||
primary="Home"
|
|
||||||
/>
|
|
||||||
{libraries.isSuccess &&
|
|
||||||
libraries.data?.Items?.map((library) => (
|
|
||||||
<ListItemLink
|
|
||||||
className="library-drawer-item"
|
|
||||||
key={library.Id}
|
|
||||||
to="/library/$id"
|
|
||||||
params={{ id: 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ import { useLocation, useRouter } from "@tanstack/react-router";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import QuickConnectButton from "../buttons/quickConnectButton";
|
import QuickConnectButton from "../buttons/quickConnectButton";
|
||||||
|
|
||||||
|
import "./backOnly.scss";
|
||||||
|
|
||||||
export default function AppBarBackOnly() {
|
export default function AppBarBackOnly() {
|
||||||
const { history } = useRouter();
|
const { history } = useRouter();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@@ -16,14 +18,19 @@ export default function AppBarBackOnly() {
|
|||||||
const hideQuickConnect = location.pathname === "/setup/server/list";
|
const hideQuickConnect = location.pathname === "/setup/server/list";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar elevation={0} color="transparent" position="fixed">
|
<AppBar
|
||||||
|
className="back-only-bar"
|
||||||
|
elevation={0}
|
||||||
|
color="transparent"
|
||||||
|
position="fixed"
|
||||||
|
>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<IconButton
|
<IconButton
|
||||||
size="large"
|
size="large"
|
||||||
edge="start"
|
edge="start"
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
color="white"
|
color="white"
|
||||||
aria-label="back"
|
aria-label="Назад"
|
||||||
disabled={history.length <= 1}
|
disabled={history.length <= 1}
|
||||||
onClick={handleBack}
|
onClick={handleBack}
|
||||||
sx={{ mr: 2 }}
|
sx={{ mr: 2 }}
|
||||||
@@ -43,4 +50,4 @@ export default function AppBarBackOnly() {
|
|||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</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;
|
||||||
|
};
|
||||||
@@ -5,15 +5,20 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
|||||||
import BlurhashCanvas from "../blurhash-canvas";
|
import BlurhashCanvas from "../blurhash-canvas";
|
||||||
|
|
||||||
export default function Backdrop() {
|
export default function Backdrop() {
|
||||||
// const [backdropLoading, setBackdropLoading] = useState(true);
|
|
||||||
|
|
||||||
const { backdropHash } = useBackdropStore(
|
const { backdropHash } = useBackdropStore(
|
||||||
useShallow((state) => ({
|
useShallow((state) => ({
|
||||||
backdropHash: state.backdropHash,
|
backdropHash: state.backdropHash,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!backdropHash) {
|
// Routes clear the backdrop when they mount ("") and some set it later.
|
||||||
|
// Keep the last non-empty hash so the app background never blanks out
|
||||||
|
// (which looked like a flash on every page open).
|
||||||
|
const lastHash = React.useRef<string | undefined>(undefined);
|
||||||
|
if (backdropHash) lastHash.current = backdropHash;
|
||||||
|
const hash = backdropHash || lastHash.current;
|
||||||
|
|
||||||
|
if (!hash) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,16 +27,16 @@ export default function Backdrop() {
|
|||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0 }}
|
initial={{ opacity: 0 }}
|
||||||
animate={{ opacity: 1 }}
|
animate={{ opacity: 1 }}
|
||||||
key={backdropHash}
|
key={hash}
|
||||||
exit={{ opacity: 0 }}
|
exit={{ opacity: 0 }}
|
||||||
transition={{
|
transition={{
|
||||||
duration: 2,
|
duration: 0.45,
|
||||||
ease: "easeInOut",
|
ease: "easeInOut",
|
||||||
}}
|
}}
|
||||||
className="app-backdrop-container"
|
className="app-backdrop-container"
|
||||||
>
|
>
|
||||||
<BlurhashCanvas
|
<BlurhashCanvas
|
||||||
blurhashString={backdropHash}
|
blurhashString={hash}
|
||||||
width={300}
|
width={300}
|
||||||
height={150}
|
height={150}
|
||||||
canvasProps={{
|
canvasProps={{
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ export default function BackButton() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton onClick={handleClick} disabled={history.length === 0}>
|
<IconButton
|
||||||
|
onClick={handleClick}
|
||||||
|
disabled={history.length === 0}
|
||||||
|
aria-label="Назад"
|
||||||
|
title="Назад"
|
||||||
|
>
|
||||||
<span className="material-symbols-rounded">arrow_back</span>
|
<span className="material-symbols-rounded">arrow_back</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import React from "react";
|
||||||
|
import useRemoteControlStore, {
|
||||||
|
type RemoteTransfer,
|
||||||
|
} from "@/utils/store/remoteControl";
|
||||||
|
|
||||||
|
type CastButtonProps = {
|
||||||
|
item?: BaseItemDto | null;
|
||||||
|
transfer?: RemoteTransfer;
|
||||||
|
/** Computed on click so playback position/queue are current. */
|
||||||
|
getTransfer?: () => RemoteTransfer | null;
|
||||||
|
size?: "small" | "medium" | "large";
|
||||||
|
};
|
||||||
|
|
||||||
|
const CastButton = ({
|
||||||
|
item,
|
||||||
|
transfer,
|
||||||
|
getTransfer,
|
||||||
|
size = "medium",
|
||||||
|
}: CastButtonProps) => {
|
||||||
|
const openDialog = useRemoteControlStore((s) => s.openDialog);
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
title={
|
||||||
|
item
|
||||||
|
? "Передать текущее медиа на устройство"
|
||||||
|
: "Удалённое управление"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<IconButton
|
||||||
|
size={size}
|
||||||
|
aria-label={
|
||||||
|
item
|
||||||
|
? "Передать текущее медиа на устройство"
|
||||||
|
: "Удалённое управление"
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
const computed = getTransfer ? getTransfer() : transfer;
|
||||||
|
const resolvedItem = item ?? computed?.item ?? null;
|
||||||
|
openDialog({
|
||||||
|
...(computed ?? {}),
|
||||||
|
item: resolvedItem,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">cast</span>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CastButton;
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import { useSnackbar } from "notistack";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { startInstantMix } from "@/utils/methods/instantMix";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
|
||||||
|
type InstantMixButtonProps = {
|
||||||
|
item?: BaseItemDto | null;
|
||||||
|
/** Render a text button instead of an icon (e.g. on the album page). */
|
||||||
|
withLabel?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
const InstantMixButton = ({ item, withLabel = false }: InstantMixButtonProps) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
|
||||||
|
const handleClick = async () => {
|
||||||
|
if (!api || !user?.Id || !item) return;
|
||||||
|
setBusy(true);
|
||||||
|
try {
|
||||||
|
const { count } = await startInstantMix(api, user.Id, item);
|
||||||
|
if (count === 0) {
|
||||||
|
enqueueSnackbar("Треки для микса не найдены", {
|
||||||
|
variant: "warning",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
enqueueSnackbar(`Микс: ${count} треков`, {
|
||||||
|
variant: "success",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Instant Mix failed", error);
|
||||||
|
enqueueSnackbar("Не удалось запустить микс", { variant: "error" });
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tooltip title="Микс">
|
||||||
|
<span>
|
||||||
|
{withLabel ? (
|
||||||
|
<IconButton
|
||||||
|
aria-label="Микс"
|
||||||
|
onClick={handleClick}
|
||||||
|
disabled={busy || !item}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">radio</span>
|
||||||
|
</IconButton>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
aria-label="Микс"
|
||||||
|
onClick={handleClick}
|
||||||
|
disabled={busy || !item}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">radio</span>
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default InstantMixButton;
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserDataApi } from "@jellyfin/sdk/lib/utils/api/user-data-api";
|
||||||
import { pink } from "@mui/material/colors";
|
import { pink } from "@mui/material/colors";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
|
import React from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
export default function LikeButton({
|
export default function LikeButton({
|
||||||
itemId,
|
itemId,
|
||||||
@@ -34,14 +32,14 @@ export default function LikeButton({
|
|||||||
if (!itemName) return;
|
if (!itemName) return;
|
||||||
if (isFavorite) {
|
if (isFavorite) {
|
||||||
result = (
|
result = (
|
||||||
await getUserLibraryApi(api).unmarkFavoriteItem({
|
await getUserDataApi(api).unmarkFavoriteItem({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
itemId: itemId,
|
itemId: itemId,
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
} else if (!isFavorite) {
|
} else if (!isFavorite) {
|
||||||
result = (
|
result = (
|
||||||
await getUserLibraryApi(api).markFavoriteItem({
|
await getUserDataApi(api).markFavoriteItem({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
itemId: itemId,
|
itemId: itemId,
|
||||||
})
|
})
|
||||||
@@ -52,7 +50,7 @@ export default function LikeButton({
|
|||||||
const mutation = useMutation({
|
const mutation = useMutation({
|
||||||
mutationFn: handleLiking,
|
mutationFn: handleLiking,
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
enqueueSnackbar(`An error occured while updating "${itemName}"`, {
|
enqueueSnackbar(`Не удалось обновить «${itemName}»`, {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -78,24 +76,22 @@ export default function LikeButton({
|
|||||||
transition: "opacity 250ms",
|
transition: "opacity 250ms",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
style={
|
style={
|
||||||
isFavorite
|
isFavorite
|
||||||
? {
|
? ({
|
||||||
//@ts-ignore
|
|
||||||
"--fill": mutation.isPending ? 0 : 1,
|
"--fill": mutation.isPending ? 0 : 1,
|
||||||
color: mutation.isPending ? "white" : pink.A700,
|
color: mutation.isPending ? "white" : pink.A700,
|
||||||
}
|
} as React.CSSProperties)
|
||||||
: {
|
: ({
|
||||||
//@ts-ignore
|
|
||||||
"--fill": mutation.isPending ? 1 : 0,
|
"--fill": mutation.isPending ? 1 : 0,
|
||||||
color: mutation.isPending ? pink.A700 : "white",
|
color: mutation.isPending ? pink.A700 : "white",
|
||||||
}
|
} as React.CSSProperties)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
favorite
|
favorite
|
||||||
</div>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ import { green } from "@mui/material/colors";
|
|||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
import { getUserDataApi } from "@jellyfin/sdk/lib/utils/api/user-data-api";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
|
|
||||||
export default function MarkPlayedButton({
|
export default function MarkPlayedButton({
|
||||||
@@ -36,12 +36,12 @@ export default function MarkPlayedButton({
|
|||||||
if (!itemName) return;
|
if (!itemName) return;
|
||||||
|
|
||||||
if (!isPlayed) {
|
if (!isPlayed) {
|
||||||
result = await getPlaystateApi(api).markPlayedItem({
|
result = await getUserDataApi(api).markPlayedItem({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
itemId: itemId,
|
itemId: itemId,
|
||||||
});
|
});
|
||||||
} else if (isPlayed) {
|
} else if (isPlayed) {
|
||||||
result = await getPlaystateApi(api).markUnplayedItem({
|
result = await getUserDataApi(api).markUnplayedItem({
|
||||||
userId: userId,
|
userId: userId,
|
||||||
itemId: itemId,
|
itemId: itemId,
|
||||||
});
|
});
|
||||||
@@ -54,7 +54,7 @@ export default function MarkPlayedButton({
|
|||||||
enqueueSnackbar(`${error}`, {
|
enqueueSnackbar(`${error}`, {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
enqueueSnackbar(`An error occured while updating "${itemName}"`, {
|
enqueueSnackbar(`Не удалось обновить «${itemName}»`, {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
|
ItemFields,
|
||||||
|
SortOrder,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
|
import { getShowApi } from "@jellyfin/sdk/lib/utils/api/show-api";
|
||||||
import type { SxProps } from "@mui/material";
|
import type { SxProps } from "@mui/material";
|
||||||
import Button, { type ButtonProps } from "@mui/material/Button";
|
import Button, { type ButtonProps } from "@mui/material/Button";
|
||||||
import Fab from "@mui/material/Fab";
|
import Fab from "@mui/material/Fab";
|
||||||
@@ -14,13 +17,11 @@ import { useSnackbar } from "notistack";
|
|||||||
import React, { type MouseEvent, memo } from "react"; // Import memo
|
import React, { type MouseEvent, memo } from "react"; // Import memo
|
||||||
import type PlayResult from "@//utils/types/playResult";
|
import type PlayResult from "@//utils/types/playResult";
|
||||||
import { getRuntimeCompact } from "@/utils/date/time";
|
import { getRuntimeCompact } from "@/utils/date/time";
|
||||||
import getSubtitle from "@/utils/methods/getSubtitles";
|
|
||||||
import { getNextEpisode, getPlaybackInfo } from "@/utils/methods/playback";
|
import { getNextEpisode, getPlaybackInfo } from "@/utils/methods/playback";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
|
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
|
||||||
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
import { usePhotosPlayback } from "@/utils/store/photosPlayback";
|
||||||
import { playItem } from "@/utils/store/playback";
|
import { initializePlayback } from "@/utils/store/playback";
|
||||||
import { setQueue } from "@/utils/store/queue";
|
import { setQueue } from "@/utils/store/queue";
|
||||||
|
|
||||||
type PlayButtonProps = {
|
type PlayButtonProps = {
|
||||||
@@ -85,7 +86,6 @@ const PlayButton = ({
|
|||||||
// (state) => state.setisPending,
|
// (state) => state.setisPending,
|
||||||
// );
|
// );
|
||||||
const playPhotos = usePhotosPlayback((s) => s.playPhotos);
|
const playPhotos = usePhotosPlayback((s) => s.playPhotos);
|
||||||
const currentUser = useCentralStore((s) => s.currentUser);
|
|
||||||
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
@@ -93,13 +93,13 @@ const PlayButton = ({
|
|||||||
mutationKey: ["playButton", item?.Id, userId],
|
mutationKey: ["playButton", item?.Id, userId],
|
||||||
mutationFn: async (currentEpisodeId?: string) => {
|
mutationFn: async (currentEpisodeId?: string) => {
|
||||||
if (!api) {
|
if (!api) {
|
||||||
throw new Error("API is not available");
|
throw new Error("API недоступно");
|
||||||
}
|
}
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("User ID is not available");
|
throw new Error("Не указан пользователь");
|
||||||
}
|
}
|
||||||
if (!item.Id) {
|
if (!item.Id) {
|
||||||
throw new Error("Item ID is not available");
|
throw new Error("Не найден идентификатор элемента");
|
||||||
}
|
}
|
||||||
|
|
||||||
return await getPlaybackInfo(api, userId, item, {
|
return await getPlaybackInfo(api, userId, item, {
|
||||||
@@ -112,28 +112,29 @@ const PlayButton = ({
|
|||||||
},
|
},
|
||||||
onSuccess: async (result: PlayResult | null) => {
|
onSuccess: async (result: PlayResult | null) => {
|
||||||
if (!api) {
|
if (!api) {
|
||||||
console.error("API is not available");
|
console.error("API недоступно");
|
||||||
enqueueSnackbar("API is not available", { variant: "error" });
|
enqueueSnackbar("API недоступно", { variant: "error" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
console.error("User ID is not available");
|
console.error("Не указан пользователь");
|
||||||
enqueueSnackbar("User ID is not available", { variant: "error" });
|
enqueueSnackbar("Не указан пользователь", { variant: "error" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!result?.item?.Items?.length) {
|
if (!result?.item?.Items?.length) {
|
||||||
console.error("No items found");
|
console.error("Ничего не найдено");
|
||||||
enqueueSnackbar("No items found", { variant: "error" });
|
enqueueSnackbar("Ничего не найдено", { variant: "error" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!result?.item?.Items?.[0]?.Id) {
|
if (!result?.item?.Items?.[0]?.Id) {
|
||||||
console.error("No item ID found");
|
console.error("Не найден идентификатор элемента");
|
||||||
enqueueSnackbar("No item ID found", { variant: "error" });
|
enqueueSnackbar("Не найден идентификатор элемента", { variant: "error" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audio) {
|
if (audio) {
|
||||||
// Album/Individual audio track playback
|
// Album/Individual audio track playback
|
||||||
|
const playedItem = result?.item?.Items?.[0];
|
||||||
const playbackUrl = generateAudioStreamUrl(
|
const playbackUrl = generateAudioStreamUrl(
|
||||||
result?.item?.Items?.[0].Id,
|
result?.item?.Items?.[0].Id,
|
||||||
userId,
|
userId,
|
||||||
@@ -142,7 +143,68 @@ const PlayButton = ({
|
|||||||
api.accessToken,
|
api.accessToken,
|
||||||
);
|
);
|
||||||
playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
|
playAudio(playbackUrl, result?.item?.Items?.[0], undefined);
|
||||||
setQueue(result?.item?.Items ?? [], 0);
|
|
||||||
|
if (
|
||||||
|
playedItem?.Type === BaseItemKind.Audio &&
|
||||||
|
(result?.item?.Items?.length ?? 0) <= 1
|
||||||
|
) {
|
||||||
|
// A single track has no queue of its own. Queue the record it
|
||||||
|
// belongs to; when the server does not expose AlbumId, fall
|
||||||
|
// back to the artist's songs so "Очередь" is never empty.
|
||||||
|
const loadQueue = async (): Promise<{
|
||||||
|
items: BaseItemDto[];
|
||||||
|
index: number;
|
||||||
|
}> => {
|
||||||
|
if (playedItem.AlbumId) {
|
||||||
|
const albumTracks = await getLibraryApi(api).getItems({
|
||||||
|
parentId: playedItem.AlbumId,
|
||||||
|
userId,
|
||||||
|
sortOrder: [SortOrder.Ascending],
|
||||||
|
sortBy: ["IndexNumber"],
|
||||||
|
fields: [ItemFields.MediaSources],
|
||||||
|
});
|
||||||
|
const items = albumTracks.data.Items ?? [];
|
||||||
|
if (items.length > 0) {
|
||||||
|
return {
|
||||||
|
items,
|
||||||
|
index: Math.max(
|
||||||
|
items.findIndex((t) => t.Id === playedItem.Id),
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const artistName =
|
||||||
|
playedItem.Artists?.[0] ?? playedItem.AlbumArtists?.[0]?.Name;
|
||||||
|
if (artistName) {
|
||||||
|
const artistTracks = await getLibraryApi(api).getItems({
|
||||||
|
userId,
|
||||||
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
|
artists: [artistName],
|
||||||
|
recursive: true,
|
||||||
|
sortBy: ["SortName"],
|
||||||
|
sortOrder: [SortOrder.Ascending],
|
||||||
|
fields: [ItemFields.MediaSources],
|
||||||
|
});
|
||||||
|
const items = artistTracks.data.Items ?? [];
|
||||||
|
const index = items.findIndex((t) => t.Id === playedItem.Id);
|
||||||
|
if (items.length > 1 && index >= 0) {
|
||||||
|
return { items, index };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { items: [playedItem], index: 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const nextQueue = await loadQueue();
|
||||||
|
setQueue(nextQueue.items, nextQueue.index);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Could not build the audio queue", error);
|
||||||
|
setQueue([playedItem], 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setQueue(result?.item?.Items ?? [], 0);
|
||||||
|
}
|
||||||
} else if (item.Type === "Photo") {
|
} else if (item.Type === "Photo") {
|
||||||
const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id);
|
const index = result?.item?.Items?.map((i) => i.Id).indexOf(item.Id);
|
||||||
if (result?.item?.Items && index) {
|
if (result?.item?.Items && index) {
|
||||||
@@ -151,149 +213,38 @@ const PlayButton = ({
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!result?.mediaSource?.MediaSources?.[0]?.Id) {
|
if (!result?.mediaSource?.MediaSources?.[0]?.Id) {
|
||||||
console.error("No media source ID found");
|
console.error("Не найден источник медиа");
|
||||||
enqueueSnackbar("No media source ID found", { variant: "error" });
|
enqueueSnackbar("Не найден источник медиа", { variant: "error" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const episodeIndex = result.episodeIndex;
|
const episodeIndex = result.episodeIndex;
|
||||||
|
const queue = result?.item?.Items ?? [];
|
||||||
|
|
||||||
// Creates a queue containing all Episodes for a particular season(series) or collection of movies
|
let playItemValue = queue[episodeIndex];
|
||||||
const queue = result?.item?.Items;
|
|
||||||
|
|
||||||
let itemName = item.Name;
|
|
||||||
let episodeTitle = "";
|
|
||||||
if (result?.item?.Items?.[episodeIndex].SeriesId) {
|
|
||||||
itemName = result?.item.Items[episodeIndex].SeriesName;
|
|
||||||
episodeTitle = `S${result?.item.Items[episodeIndex].ParentIndexNumber ?? 0}:E${
|
|
||||||
result?.item.Items[episodeIndex].IndexNumber ?? 0
|
|
||||||
} ${result?.item.Items[episodeIndex].Name}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemType === "BoxSet") {
|
|
||||||
itemName = result.item.Items[0].Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subtitle
|
|
||||||
const userSubtitleLanguagePreference =
|
|
||||||
currentUser?.Configuration?.SubtitleLanguagePreference;
|
|
||||||
// Get all subtitle streams
|
|
||||||
const allSubtitles =
|
|
||||||
result?.mediaSource?.MediaSources?.[0]?.MediaStreams?.filter(
|
|
||||||
(stream) => stream.Type === "Subtitle",
|
|
||||||
);
|
|
||||||
// Find preferred subtitle based on user's language preference
|
|
||||||
const preferredSubtitle =
|
|
||||||
allSubtitles?.find(
|
|
||||||
(sub) => sub.Language === userSubtitleLanguagePreference,
|
|
||||||
) || null;
|
|
||||||
|
|
||||||
const subtitle = getSubtitle(
|
|
||||||
preferredSubtitle?.Index ??
|
|
||||||
result.mediaSource.MediaSources?.[0].DefaultSubtitleStreamIndex ??
|
|
||||||
-1,
|
|
||||||
result?.mediaSource?.MediaSources?.[0]?.MediaStreams,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Audio
|
|
||||||
const userAudioLanguagePreference =
|
|
||||||
currentUser?.Configuration?.AudioLanguagePreference;
|
|
||||||
// Get all audio streams
|
|
||||||
const allAudioTracks =
|
|
||||||
result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
|
|
||||||
(value) => value.Type === "Audio",
|
|
||||||
);
|
|
||||||
// Find preferred audio track based on user's language preference
|
|
||||||
const preferredAudioTrack =
|
|
||||||
allAudioTracks?.find(
|
|
||||||
(track) => track.Language === userAudioLanguagePreference,
|
|
||||||
) ||
|
|
||||||
allAudioTracks?.find((track) => track.IsDefault) ||
|
|
||||||
allAudioTracks?.[0];
|
|
||||||
|
|
||||||
const audio = {
|
|
||||||
track:
|
|
||||||
preferredAudioTrack?.Index ??
|
|
||||||
result.mediaSource.MediaSources?.[0].DefaultAudioStreamIndex ??
|
|
||||||
0,
|
|
||||||
allTracks: allAudioTracks,
|
|
||||||
};
|
|
||||||
|
|
||||||
// URL generation
|
|
||||||
const urlOptions: URLSearchParams = {
|
|
||||||
//@ts-expect-error
|
|
||||||
Static: true,
|
|
||||||
tag: result?.mediaSource.MediaSources?.[0].ETag,
|
|
||||||
mediaSourceId: result?.mediaSource.MediaSources?.[0].Id,
|
|
||||||
deviceId: api?.deviceInfo.id,
|
|
||||||
api_key: api?.accessToken,
|
|
||||||
};
|
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
|
||||||
let playbackUrl = `${api?.basePath}/Videos/${result?.mediaSource.MediaSources?.[0].Id}/stream.${result?.mediaSource.MediaSources?.[0].Container}?${urlParams}`;
|
|
||||||
if (
|
|
||||||
result?.mediaSource.MediaSources?.[0].SupportsTranscoding &&
|
|
||||||
result?.mediaSource.MediaSources?.[0].TranscodingUrl
|
|
||||||
) {
|
|
||||||
playbackUrl = `${api.basePath}${result.mediaSource.MediaSources[0].TranscodingUrl}`;
|
|
||||||
}
|
|
||||||
let playItemValue = result?.item?.Items?.[episodeIndex];
|
|
||||||
if (itemType === BaseItemKind.Movie) {
|
if (itemType === BaseItemKind.Movie) {
|
||||||
playItemValue = result?.item?.Items?.[0];
|
playItemValue = queue[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const startPosition =
|
if (!playItemValue) {
|
||||||
result?.item?.Items?.[episodeIndex].UserData?.PlaybackPositionTicks;
|
console.error("No item to play found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const videoTrack =
|
const startPosition = playItemValue.UserData?.PlaybackPositionTicks;
|
||||||
result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
|
|
||||||
(value) => value.Type === "Video",
|
|
||||||
);
|
|
||||||
|
|
||||||
const isDirectPlay =
|
initializePlayback({
|
||||||
!result.mediaSource.MediaSources?.[0].SupportsTranscoding ||
|
api,
|
||||||
!result.mediaSource.MediaSources?.[0].TranscodingUrl;
|
|
||||||
|
|
||||||
playItem({
|
|
||||||
metadata: {
|
|
||||||
itemName: itemName ?? "",
|
|
||||||
episodeTitle: episodeTitle,
|
|
||||||
isEpisode: !!item.SeriesId,
|
|
||||||
itemDuration: playItemValue?.RunTimeTicks ?? item.RunTimeTicks ?? 0,
|
|
||||||
item: playItemValue ?? item,
|
|
||||||
mediaSegments: result.mediaSegments,
|
|
||||||
userDataLastPlayedPositionTicks: startPosition ?? 0,
|
|
||||||
},
|
|
||||||
mediaSource: {
|
|
||||||
videoTrack: videoTrack?.[0]?.Index ?? 0,
|
|
||||||
audioTrack: audio.track,
|
|
||||||
container: result.mediaSource.MediaSources?.[0].Container ?? "",
|
|
||||||
id: result.mediaSource.MediaSources?.[0]?.Id,
|
|
||||||
subtitle: {
|
|
||||||
url: subtitle?.url,
|
|
||||||
track: subtitle?.track ?? -1,
|
|
||||||
format: subtitle?.format ?? "nosub",
|
|
||||||
allTracks:
|
|
||||||
result.mediaSource.MediaSources?.[0].MediaStreams?.filter(
|
|
||||||
(value) => value.Type === "Subtitle",
|
|
||||||
),
|
|
||||||
enable: subtitle?.enable ?? false,
|
|
||||||
},
|
|
||||||
audio: audio,
|
|
||||||
bitrate: result.mediaSource.MediaSources?.[0].Bitrate ?? 0,
|
|
||||||
videoCodec: videoTrack?.[0]?.Codec ?? "",
|
|
||||||
audioCodec:
|
|
||||||
audio.allTracks?.find((t) => t.Index === audio.track)?.Codec ??
|
|
||||||
"",
|
|
||||||
isDirectPlay: isDirectPlay,
|
|
||||||
transcodingUrl:
|
|
||||||
result.mediaSource.MediaSources?.[0].TranscodingUrl ?? "",
|
|
||||||
},
|
|
||||||
playbackStream: playbackUrl,
|
|
||||||
playsessionId: result.mediaSource.PlaySessionId,
|
|
||||||
userDataPlayedPositionTicks:
|
|
||||||
item.UserData?.PlaybackPositionTicks ?? 0,
|
|
||||||
userId,
|
userId,
|
||||||
queueItems: queue ?? [],
|
item: playItemValue,
|
||||||
queueItemIndex: episodeIndex,
|
mediaSource: result.mediaSource,
|
||||||
|
mediaSegments: result.mediaSegments,
|
||||||
|
queueItems: queue,
|
||||||
|
queueIndex: episodeIndex,
|
||||||
|
startPositionTicks: startPosition,
|
||||||
|
audioStreamIndex:
|
||||||
|
currentAudioTrack === "auto" ? undefined : currentAudioTrack,
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
});
|
});
|
||||||
navigate({ to: "/player" });
|
navigate({ to: "/player" });
|
||||||
}
|
}
|
||||||
@@ -309,7 +260,7 @@ const PlayButton = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const handleClick = (
|
const handleClick = (
|
||||||
e: MouseEvent<HTMLAnchorElement | MouseEvent>,
|
e: MouseEvent<HTMLElement>,
|
||||||
currentEpisodeId?: string | undefined,
|
currentEpisodeId?: string | undefined,
|
||||||
) => {
|
) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -319,15 +270,15 @@ const PlayButton = ({
|
|||||||
queryKey: ["playButton", "currentEpisode", item?.Id],
|
queryKey: ["playButton", "currentEpisode", item?.Id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!api) {
|
if (!api) {
|
||||||
throw new Error("API is not available");
|
throw new Error("API недоступно");
|
||||||
}
|
}
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("User ID is not available");
|
throw new Error("Не указан пользователь");
|
||||||
}
|
}
|
||||||
if (!item.Id) {
|
if (!item.Id) {
|
||||||
throw new Error("Item ID is not available");
|
throw new Error("Не найден идентификатор элемента");
|
||||||
}
|
}
|
||||||
const seasons = await getTvShowsApi(api).getSeasons({
|
const seasons = await getShowApi(api).getSeasons({
|
||||||
seriesId: item.Id,
|
seriesId: item.Id,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
@@ -351,12 +302,26 @@ const PlayButton = ({
|
|||||||
enabled: itemType === BaseItemKind.Series,
|
enabled: itemType === BaseItemKind.Series,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isAudioItem =
|
||||||
|
item?.Type === "MusicAlbum" ||
|
||||||
|
item?.Type === "Audio" ||
|
||||||
|
item?.Type === "AudioBook" ||
|
||||||
|
item?.Type === "Playlist" ||
|
||||||
|
audio;
|
||||||
|
const playLabel = item.UserData?.PlaybackPositionTicks
|
||||||
|
? isAudioItem
|
||||||
|
? "Продолжить прослушивание"
|
||||||
|
: "Продолжить просмотр"
|
||||||
|
: isAudioItem
|
||||||
|
? "Слушать"
|
||||||
|
: "Смотреть";
|
||||||
|
|
||||||
if (iconOnly) {
|
if (iconOnly) {
|
||||||
return (
|
return (
|
||||||
//@ts-expect-error
|
//@ts-expect-error
|
||||||
<Fab
|
<Fab
|
||||||
color="primary"
|
color="primary"
|
||||||
aria-label="Play"
|
aria-label={isAudioItem ? "Слушать" : "Смотреть"}
|
||||||
className={className}
|
className={className}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (item.Type === "Episode") {
|
if (item.Type === "Episode") {
|
||||||
@@ -377,14 +342,14 @@ const PlayButton = ({
|
|||||||
}
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded em-4 fill"
|
className="material-symbols-rounded em-4 fill"
|
||||||
style={{
|
style={{
|
||||||
fontSize: "3em",
|
fontSize: "3em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
</Fab>
|
</Fab>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -409,7 +374,7 @@ const PlayButton = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
startIcon={
|
startIcon={
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded fill"
|
className="material-symbols-rounded fill"
|
||||||
style={{
|
style={{
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
@@ -417,7 +382,7 @@ const PlayButton = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
}
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
sx={{
|
sx={{
|
||||||
@@ -436,14 +401,14 @@ const PlayButton = ({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{currentEpisode.isPending ? (
|
{currentEpisode.isPending ? (
|
||||||
"Loading..."
|
"Загрузка..."
|
||||||
) : !currentEpisode.data ||
|
) : !currentEpisode.data ||
|
||||||
!currentEpisode.data.Items ||
|
!currentEpisode.data.Items ||
|
||||||
currentEpisode.data.Items.length === 0 ? (
|
currentEpisode.data.Items.length === 0 ? (
|
||||||
"No episodes to watch found"
|
"Нет серий для просмотра"
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
Watch S{currentEpisode.data.Items[0].ParentIndexNumber ?? 1}E
|
Смотреть S{currentEpisode.data.Items[0].ParentIndexNumber ?? 1}E
|
||||||
{currentEpisode.data.Items[0]?.IndexNumber ?? 1}
|
{currentEpisode.data.Items[0]?.IndexNumber ?? 1}
|
||||||
<MemoizedLinearProgress
|
<MemoizedLinearProgress
|
||||||
//@ts-expect-error
|
//@ts-expect-error
|
||||||
@@ -477,7 +442,7 @@ const PlayButton = ({
|
|||||||
(currentEpisode.data?.Items?.[0]?.UserData
|
(currentEpisode.data?.Items?.[0]?.UserData
|
||||||
?.PlaybackPositionTicks ?? 0),
|
?.PlaybackPositionTicks ?? 0),
|
||||||
)}{" "}
|
)}{" "}
|
||||||
left
|
осталось
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -498,7 +463,7 @@ const PlayButton = ({
|
|||||||
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
||||||
}
|
}
|
||||||
startIcon={
|
startIcon={
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded fill"
|
className="material-symbols-rounded fill"
|
||||||
style={{
|
style={{
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
@@ -506,7 +471,7 @@ const PlayButton = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
}
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
sx={{
|
sx={{
|
||||||
@@ -517,15 +482,7 @@ const PlayButton = ({
|
|||||||
color="white"
|
color="white"
|
||||||
size={size}
|
size={size}
|
||||||
>
|
>
|
||||||
{item.UserData?.PlaybackPositionTicks
|
{playLabel}
|
||||||
? "Continue Watching"
|
|
||||||
: item?.Type === "MusicAlbum" ||
|
|
||||||
item?.Type === "Audio" ||
|
|
||||||
item?.Type === "AudioBook" ||
|
|
||||||
item?.Type === "Playlist" ||
|
|
||||||
audio
|
|
||||||
? "Play Now"
|
|
||||||
: "Watch Now"}
|
|
||||||
<MemoizedLinearProgress
|
<MemoizedLinearProgress
|
||||||
//@ts-expect-error
|
//@ts-expect-error
|
||||||
value={
|
value={
|
||||||
@@ -551,7 +508,7 @@ const PlayButton = ({
|
|||||||
(item.RunTimeTicks ?? 0) -
|
(item.RunTimeTicks ?? 0) -
|
||||||
(item.UserData?.PlaybackPositionTicks ?? 0),
|
(item.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
)}{" "}
|
)}{" "}
|
||||||
left
|
осталось
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { playItemFromQueue } from "@/utils/store/playback";
|
|
||||||
import useQueue from "@/utils/store/queue";
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { IconButton } from "@mui/material";
|
import { IconButton } from "@mui/material";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { playItemFromQueue } from "@/utils/store/playback";
|
||||||
|
import useQueue, { getNextTrackIndex } from "@/utils/store/queue";
|
||||||
|
|
||||||
const PlayNextButton = () => {
|
const PlayNextButton = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
@@ -19,18 +19,18 @@ const PlayNextButton = () => {
|
|||||||
});
|
});
|
||||||
const handlePlayNext = useMutation({
|
const handlePlayNext = useMutation({
|
||||||
mutationKey: ["playNextButton"],
|
mutationKey: ["playNextButton"],
|
||||||
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
mutationFn: async () => {
|
||||||
|
const nextIndex = getNextTrackIndex();
|
||||||
|
if (nextIndex === undefined) return;
|
||||||
|
return playItemFromQueue(nextIndex, user.data?.Id, api);
|
||||||
|
},
|
||||||
onError: (error) => console.error(error),
|
onError: (error) => console.error(error),
|
||||||
});
|
});
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
// Re-render when the queue position or repeat mode changes.
|
||||||
state.tracks,
|
useQueue((state) => [state.tracks, state.currentItemIndex, state.repeatMode]);
|
||||||
state.currentItemIndex,
|
const hasNext = getNextTrackIndex() !== undefined;
|
||||||
]);
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton disabled={!hasNext} onClick={() => handlePlayNext.mutate()}>
|
||||||
disabled={queueItems?.length === currentItemIndex + 1}
|
|
||||||
onClick={() => handlePlayNext.mutate()}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded">skip_next</span>
|
<span className="material-symbols-rounded">skip_next</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
$image-size: 5em;
|
|
||||||
|
|
||||||
.queue{
|
.queue{
|
||||||
&-item{
|
&-item{
|
||||||
|
--image-size: 5em;
|
||||||
|
&.episode {
|
||||||
|
--image-size: 8em !important;
|
||||||
|
}
|
||||||
width: 32em;
|
width: 32em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
height: 5em;
|
height: 5em;
|
||||||
grid-template-columns: 3em $image-size 1fr;
|
grid-template-columns: 3em var(--image-size) 1fr;
|
||||||
justify-items: center;
|
justify-items: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
&-image{
|
&-image{
|
||||||
@@ -25,6 +27,7 @@ $image-size: 5em;
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: var(--image-size);
|
||||||
}
|
}
|
||||||
&-icon {
|
&-icon {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -52,4 +55,5 @@ $image-size: 5em;
|
|||||||
opacity: 0.5 !important;
|
opacity: 0.5 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,286 +1,31 @@
|
|||||||
import { playItemFromQueue } from "@/utils/store/playback";
|
import Drawer from "@mui/material/Drawer";
|
||||||
import useQueue from "@/utils/store/queue";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import {
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
IconButton,
|
|
||||||
Menu,
|
|
||||||
MenuItem,
|
|
||||||
MenuList,
|
|
||||||
Typography,
|
|
||||||
} from "@mui/material";
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import QueueView from "@/components/queue/queueView";
|
||||||
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
/** Opens the play queue in a side drawer. */
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
||||||
import "./queueButton.scss";
|
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
const QueueButton = () => {
|
const QueueButton = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const [queueItems, currentItemIndex] = useQueue((state) => [
|
|
||||||
state.tracks,
|
|
||||||
state.currentItemIndex,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const user = useQuery({
|
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
if (!api) return;
|
|
||||||
const result = await getUserApi(api).getCurrentUser();
|
|
||||||
return result.data;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);
|
|
||||||
|
|
||||||
const handlePlay = useMutation({
|
|
||||||
mutationKey: ["handlePlayIndex"],
|
|
||||||
mutationFn: async ({ index }: { index: number }) => {
|
|
||||||
const result = playItemFromQueue(index, user.data?.Id, api);
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
onSuccess: () => {
|
|
||||||
setButtonEl(null);
|
|
||||||
},
|
|
||||||
onError: (error) => {
|
|
||||||
console.error(error);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Menu
|
<Tooltip title="Очередь">
|
||||||
open={Boolean(buttonEl)}
|
<IconButton onClick={() => setOpen(true)} aria-label="Открыть очередь">
|
||||||
onClose={() => setButtonEl(null)}
|
<span className="material-symbols-rounded">queue_music</span>
|
||||||
anchorEl={buttonEl}
|
</IconButton>
|
||||||
anchorOrigin={{
|
</Tooltip>
|
||||||
vertical: "top",
|
<Drawer
|
||||||
horizontal: "center",
|
anchor="right"
|
||||||
}}
|
open={open}
|
||||||
transformOrigin={{
|
onClose={() => setOpen(false)}
|
||||||
vertical: "bottom",
|
|
||||||
horizontal: "center",
|
|
||||||
}}
|
|
||||||
slotProps={{
|
slotProps={{
|
||||||
paper: {
|
backdrop: { sx: { backgroundColor: "rgb(0 0 0 / 0.3)" } },
|
||||||
style: {
|
paper: { className: "queue-drawer-paper" },
|
||||||
maxHeight: "30em",
|
|
||||||
overflowX: "hidden",
|
|
||||||
overflowY: "auto",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MenuList
|
<QueueView variant="drawer" onClose={() => setOpen(false)} />
|
||||||
style={{
|
</Drawer>
|
||||||
height: "fit-content",
|
|
||||||
width: " 32em",
|
|
||||||
position: "relative",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{queueItems?.[currentItemIndex]?.Id && (
|
|
||||||
<>
|
|
||||||
<Typography px="1em" mb={2} variant="h5" fontWeight={300}>
|
|
||||||
Currently Playing:
|
|
||||||
</Typography>
|
|
||||||
<MenuItem
|
|
||||||
className="queue-item"
|
|
||||||
disabled
|
|
||||||
key={queueItems[currentItemIndex].Id}
|
|
||||||
>
|
|
||||||
<Typography variant="subtitle2">
|
|
||||||
{queueItems[currentItemIndex]?.Type === "Audio"
|
|
||||||
? currentItemIndex + 1
|
|
||||||
: queueItems[currentItemIndex].IndexNumberEnd
|
|
||||||
? `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber} / ${queueItems[currentItemIndex].IndexNumberEnd}`
|
|
||||||
: `S${queueItems[currentItemIndex].ParentIndexNumber}:E${queueItems[currentItemIndex].IndexNumber}`}
|
|
||||||
</Typography>
|
|
||||||
<div className="queue-item-image-container">
|
|
||||||
{queueItems[currentItemIndex].ImageTags?.Primary ? (
|
|
||||||
<img
|
|
||||||
className="queue-item-image"
|
|
||||||
src={
|
|
||||||
api &&
|
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
queueItems[currentItemIndex]?.Id,
|
|
||||||
"Primary",
|
|
||||||
{
|
|
||||||
tag: queueItems[currentItemIndex].ImageTags
|
|
||||||
?.Primary,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
alt={queueItems[currentItemIndex].Name ?? "image"}
|
|
||||||
/>
|
|
||||||
) : (queueItems[currentItemIndex].AlbumPrimaryImageTag
|
|
||||||
?.length ?? -1) > 0 ? (
|
|
||||||
<img
|
|
||||||
className="queue-item-image"
|
|
||||||
src={
|
|
||||||
api &&
|
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
queueItems?.[currentItemIndex]?.AlbumId ?? "",
|
|
||||||
"Primary",
|
|
||||||
{
|
|
||||||
tag: queueItems?.[currentItemIndex]
|
|
||||||
.AlbumPrimaryImageTag?.[0],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
alt={queueItems[currentItemIndex].Name ?? "image"}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="queue-item-image-icon">
|
|
||||||
{queueItems[currentItemIndex].Type &&
|
|
||||||
getTypeIcon(queueItems[currentItemIndex].Type)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
top: "50%",
|
|
||||||
left: "50%",
|
|
||||||
transform: "translate(-50%,-50%)",
|
|
||||||
fontSize: "2em",
|
|
||||||
//@ts-ignore
|
|
||||||
"--wght": "100",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
equalizer
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div className="queue-item-info">
|
|
||||||
{queueItems[currentItemIndex].SeriesName ? (
|
|
||||||
<>
|
|
||||||
<Typography variant="subtitle1" width="100%">
|
|
||||||
{queueItems[currentItemIndex].SeriesName}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
width="100%"
|
|
||||||
style={{ opacity: 0.6 }}
|
|
||||||
>
|
|
||||||
{queueItems[currentItemIndex].Name}
|
|
||||||
</Typography>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Typography variant="subtitle1" width="100%">
|
|
||||||
{queueItems[currentItemIndex].Name}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</MenuItem>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{queueItems &&
|
|
||||||
queueItems.slice(currentItemIndex + 1, queueItems.length - 1)
|
|
||||||
.length > 0 && (
|
|
||||||
<Typography px="1em" my={2} variant="h5" fontWeight={300}>
|
|
||||||
Queue:
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
{queueItems
|
|
||||||
?.slice(currentItemIndex + 1, queueItems.length - 1)
|
|
||||||
.map((item, index) => {
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
className="queue-item"
|
|
||||||
onClick={() =>
|
|
||||||
handlePlay.mutate({ index: index + currentItemIndex })
|
|
||||||
}
|
|
||||||
key={item.Id}
|
|
||||||
>
|
|
||||||
<Typography variant="subtitle2">
|
|
||||||
{item.Type === "Audio"
|
|
||||||
? index + 1
|
|
||||||
: item.IndexNumberEnd
|
|
||||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
|
|
||||||
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
|
|
||||||
</Typography>
|
|
||||||
<div className="queue-item-image-container">
|
|
||||||
{item.ImageTags?.Primary ? (
|
|
||||||
<img
|
|
||||||
className="queue-item-image"
|
|
||||||
src={
|
|
||||||
api &&
|
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
item?.Id ?? "",
|
|
||||||
"Primary",
|
|
||||||
{
|
|
||||||
tag: item.ImageTags?.Primary,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
alt={item.Name ?? "image"}
|
|
||||||
/>
|
|
||||||
) : (item.AlbumPrimaryImageTag?.length ?? -1) > 0 ? (
|
|
||||||
<img
|
|
||||||
className="queue-item-image"
|
|
||||||
src={
|
|
||||||
api &&
|
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
item?.AlbumId ?? "",
|
|
||||||
"Primary",
|
|
||||||
{
|
|
||||||
tag: item.AlbumPrimaryImageTag?.[0],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
alt={item.Name ?? "image"}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="queue-item-image-icon">
|
|
||||||
{item.Type && getTypeIcon(item.Type)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="queue-item-info">
|
|
||||||
{item.SeriesName ? (
|
|
||||||
<>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
width="100%"
|
|
||||||
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
|
||||||
>
|
|
||||||
{item.SeriesName}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
width="100%"
|
|
||||||
style={{ opacity: 0.6 }}
|
|
||||||
>
|
|
||||||
{item.Name}
|
|
||||||
</Typography>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
width="100%"
|
|
||||||
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
|
||||||
>
|
|
||||||
{item.Name}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
width="100%"
|
|
||||||
style={{ opacity: 0.6 }}
|
|
||||||
sx={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
|
||||||
>
|
|
||||||
{item.Artists?.join(", ")}
|
|
||||||
</Typography>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</MenuList>
|
|
||||||
</Menu>
|
|
||||||
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
|
|
||||||
<span className="material-symbols-rounded">playlist_play</span>
|
|
||||||
</IconButton>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||