feat: add cross-device playback and remote control
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped

- native SyncPlay groups with shared queues, ready/buffering and local pause/seek reporting
- follow-me prompt that transfers another session's playback to this device
- auto-skip intros/recaps and skip-credits for final items
- blink:// deep links with timestamped scene sharing via QR
- Quick Connect approval and QR onboarding from a phone
- Rust WebSocket client with Authorization header for Jellyfin 12, capabilities advertising, live sessions and remote commands
This commit is contained in:
1xDed committed 2026-11-29 08:03:21 +03:00
1 parent cb5ee9b672
commit 5746bf35a5
39 files changed
+3235 -18

No files matched your search

+4
View File
@@ -36,6 +36,7 @@
"@tanstack/react-virtual": "^3.14.21",
"@tauri-apps/api": "2.12.4",
"@tauri-apps/plugin-clipboard-manager": "2.5.0",
"@tauri-apps/plugin-deep-link": "2.6.3",
"@tauri-apps/plugin-dialog": "2.8.3",
"@tauri-apps/plugin-global-shortcut": "~2.4.1",
"@tauri-apps/plugin-notification": "2.7.0",
@@ -44,6 +45,7 @@
"@tauri-apps/plugin-store": "github:tauri-apps/tauri-plugin-store#v2",
"@tauri-apps/plugin-updater": "2.14.0",
"@tauri-apps/plugin-upload": "2.5.0",
"@tauri-apps/plugin-websocket": "2.5.0",
"@tauri-apps/plugin-window-state": "~2.5.0",
"@types/node": "^26.6.5",
"@types/react": "^19.3.0",
@@ -59,6 +61,7 @@
"material-symbols": "^0.48.0",
"motion": "^14.4.0",
"notistack": "^3.0.2",
"qrcode": "^1.5.4",
"react": "^19.3.1",
"react-blurhash": "^0.3.0",
"react-dnd": "^16.0.1",
@@ -84,6 +87,7 @@
"@tanstack/router-vite-plugin": "^1.167.47",
"@tauri-apps/cli": "2.12.3",
"@types/lodash": "^4.17.26",
"@types/qrcode": "^1.5.6",
"@vitejs/plugin-react": "^6.1.2",
"babel-plugin-react-compiler": "19.1.0-rc.3",
"eslint-plugin-react-hooks": "7.1.1",
+240
View File
@@ -77,6 +77,9 @@ importers:
'@tauri-apps/plugin-clipboard-manager':
specifier: 2.5.0
version: 2.5.0
'@tauri-apps/plugin-deep-link':
specifier: 2.6.3
version: 2.6.3
'@tauri-apps/plugin-dialog':
specifier: 2.8.3
version: 2.8.3
@@ -101,6 +104,9 @@ importers:
'@tauri-apps/plugin-upload':
specifier: 2.5.0
version: 2.5.0
'@tauri-apps/plugin-websocket':
specifier: 2.5.0
version: 2.5.0
'@tauri-apps/plugin-window-state':
specifier: ~2.5.0
version: 2.5.0
@@ -146,6 +152,9 @@ importers:
notistack:
specifier: ^3.0.2
version: 3.0.2(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
qrcode:
specifier: ^1.5.4
version: 1.5.4
react:
specifier: ^19.3.1
version: 19.3.1
@@ -216,6 +225,9 @@ importers:
'@types/lodash':
specifier: ^4.17.26
version: 4.17.26
'@types/qrcode':
specifier: ^1.5.6
version: 1.5.6
'@vitejs/plugin-react':
specifier: ^6.1.2
version: 6.1.2(babel-plugin-react-compiler@19.1.0-rc.3)(vite@8.3.4(@types/node@26.6.5)(jiti@2.7.0)(sass@1.105.2))
@@ -1434,6 +1446,9 @@ packages:
'@tauri-apps/plugin-clipboard-manager@2.5.0':
resolution: {integrity: sha512-dibUy1nKURYDXRMvjNk4deAbTZ5jPQ8wCE4nolt5xniryWgXQ4sK2GkFXoXlHbRdPzfZptZj95BRLfalA7m/2Q==}
'@tauri-apps/plugin-deep-link@2.6.3':
resolution: {integrity: sha512-L+fjyGe5RPBtfh3VUSl1HslC0/xW7frDvdsZk37d9UdqOpKwD9P0PmblSk7Q/WCiAEHZ9J9Pn7VyiecBBdiy/A==}
'@tauri-apps/plugin-dialog@2.8.3':
resolution: {integrity: sha512-Hd/yBfk2R5v2MFrz/0VArSXeh8xKLLXGunqSiTtcHKn1zNZwaKujuA0VSwUvNfwC4hDoF1PveS+gBDNe3nHspw==}
@@ -1462,6 +1477,9 @@ packages:
'@tauri-apps/plugin-upload@2.5.0':
resolution: {integrity: sha512-5Yl1PM80Vwu5+Fi3V5mknJYOrHkkde5BVpfgquAmBWuZU9QwyXSjLpRW7qDy0sMHbo1pFqXQ0MykU84nWEha3w==}
'@tauri-apps/plugin-websocket@2.5.0':
resolution: {integrity: sha512-uy6skY9NgCNwRoFd2kueTR3Ygw+2sW0V5gfY3IHxwpTVbtRpH+0A1B94VBWBQ97Y3E4eo6C1zVVfXj1NAuR1Qg==}
'@tauri-apps/plugin-window-state@2.5.0':
resolution: {integrity: sha512-ySI/32fpC1ZTslIZ00/wf9HujyDnkG3OPL16uuLjG53y1hTgjIJ9G2VPuOL1IV8GVr3xeF6lnr6h2T73HuGXow==}
@@ -1510,6 +1528,9 @@ packages:
'@types/prop-types@15.7.15':
resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==}
'@types/qrcode@1.5.6':
resolution: {integrity: sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==}
'@types/react-dom@19.3.0':
resolution: {integrity: sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==}
peerDependencies:
@@ -1691,6 +1712,14 @@ packages:
ajv@6.15.0:
resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==}
ansi-regex@5.0.1:
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
ansi-styles@4.3.0:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
ansis@4.4.0:
resolution: {integrity: sha512-9k3v7xcHwgdO/DruxGIg4HtjvlAZlcnsX/mzqUb1t3NkYnl9kK2UJ+Gq0io+vQf7iT//BD/HB/NBkUR1LWxoeA==}
engines: {node: '>=14'}
@@ -1763,6 +1792,10 @@ packages:
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
engines: {node: '>=6'}
camelcase@5.3.1:
resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==}
engines: {node: '>=6'}
camelcase@6.3.0:
resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==}
engines: {node: '>=10'}
@@ -1797,6 +1830,9 @@ packages:
resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==}
engines: {node: '>= 20.19.0'}
cliui@6.0.0:
resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==}
cloudflare-video-element@1.3.5:
resolution: {integrity: sha512-zj9gjJa6xW8MNrfc4oKuwgGS0njRLpOlQjdifbuNxvy8k4Y3pKCyKCMG2XIsjd2iQGhgjS57b1P5VWdJlxcXBw==}
@@ -1811,6 +1847,13 @@ packages:
codem-isoboxer@0.3.10:
resolution: {integrity: sha512-eNk3TRV+xQMJ1PEj0FQGY8KD4m0GPxT487XJ+Iftm7mVa9WpPFDMWqPt+46buiP5j5Wzqe5oMIhqBcAeKfygSA==}
color-convert@2.0.1:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
combined-stream@1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
@@ -1869,6 +1912,10 @@ packages:
supports-color:
optional: true
decamelize@1.2.0:
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
engines: {node: '>=0.10.0'}
decode-named-character-reference@1.3.0:
resolution: {integrity: sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==}
@@ -1894,6 +1941,9 @@ packages:
resolution: {integrity: sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw==}
engines: {node: '>=0.3.1'}
dijkstrajs@1.0.3:
resolution: {integrity: sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==}
dnd-core@16.0.1:
resolution: {integrity: sha512-HK294sl7tbw6F6IeuK16YSBUoorvHpY8RHO+9yFfaJyCDVb6n7PRcezrOEOa2SBCqiYpemh5Jx20ZcjKdFAVng==}
@@ -1910,6 +1960,9 @@ packages:
electron-to-chromium@1.5.459:
resolution: {integrity: sha512-4SC9HHSFjO/liAhifpdOL5hG9b4BP7/5G3y3UPZVO8trlAXr1CaUEEJL0gWK3kOcYcZrOA5rkwG45Gra/lTIgg==}
emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
empathic@2.1.0:
resolution: {integrity: sha512-AnfC1ATldl49/cvZdLPDjBfrRNwbDO05aibiOtzQu3qtlbJtomNLhF30HEtn/7iBz50dlMECqATo3fG0LrdEgw==}
engines: {node: '>=14'}
@@ -2030,6 +2083,10 @@ packages:
find-root@1.1.0:
resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==}
find-up@4.1.0:
resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
engines: {node: '>=8'}
find-up@5.0.0:
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
engines: {node: '>=10'}
@@ -2080,6 +2137,10 @@ packages:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
get-caller-file@2.0.5:
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
engines: {node: 6.* || 8.* || >= 10.*}
get-intrinsic@1.3.0:
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
engines: {node: '>= 0.4'}
@@ -2211,6 +2272,10 @@ packages:
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
engines: {node: '>=0.10.0'}
is-fullwidth-code-point@3.0.0:
resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
engines: {node: '>=8'}
is-glob@4.0.3:
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
engines: {node: '>=0.10.0'}
@@ -2361,6 +2426,10 @@ packages:
localforage@1.10.0:
resolution: {integrity: sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==}
locate-path@5.0.0:
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
engines: {node: '>=8'}
locate-path@6.0.0:
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'}
@@ -2684,14 +2753,26 @@ packages:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
p-limit@2.3.0:
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
engines: {node: '>=6'}
p-limit@3.1.0:
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
engines: {node: '>=10'}
p-locate@4.1.0:
resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
engines: {node: '>=8'}
p-locate@5.0.0:
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
engines: {node: '>=10'}
p-try@2.2.0:
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
engines: {node: '>=6'}
parent-module@1.0.1:
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
engines: {node: '>=6'}
@@ -2734,6 +2815,10 @@ packages:
player.style@0.3.5:
resolution: {integrity: sha512-hknPiLjNtJP5zM0vCVXsl3Pef+uQnecYg8X/1vjd/Y3TdAgs/zxhck02SFTxRSckaObKemP5tUT8wTH7ByUmnw==}
pngjs@5.0.0:
resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==}
engines: {node: '>=10.13.0'}
postcss@8.5.31:
resolution: {integrity: sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==}
engines: {node: ^10 || ^12 || >=14}
@@ -2765,6 +2850,11 @@ packages:
resolution: {integrity: sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==}
engines: {node: '>=20'}
qrcode@1.5.4:
resolution: {integrity: sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==}
engines: {node: '>=10.13.0'}
hasBin: true
react-blurhash@0.3.0:
resolution: {integrity: sha512-XlKr4Ns1iYFRnk6DkAblNbAwN/bTJvxTVoxMvmTcURdc5oLoXZwqAF9N3LZUh/HT+QFlq5n6IS6VsDGsviYAiQ==}
peerDependencies:
@@ -2864,6 +2954,13 @@ packages:
remark-stringify@11.0.0:
resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==}
require-directory@2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'}
require-main-filename@2.0.0:
resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
resolve-from@4.0.0:
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
engines: {node: '>=4'}
@@ -2906,6 +3003,9 @@ packages:
resolution: {integrity: sha512-hpb6XnMCGN/A+79Uf8V7/iTGkyyyazNn5X0CoCAp7Uy9vT3RT8jZ9GLcnxGoVjg3P8AArbe4ZVHq6C8oT2a0kA==}
engines: {node: '>=10'}
set-blocking@2.0.0:
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
shebang-command@2.0.0:
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
engines: {node: '>=8'}
@@ -2931,9 +3031,17 @@ packages:
spotify-audio-element@1.0.4:
resolution: {integrity: sha512-QdKrJPkYCzaNwwz2vN2eDGyoW0KmQFmnwVprB41mpMzj4qujbqr6pegEchQeTn0b5PceKiLoVu0pp2QDpTcWnw==}
string-width@4.2.3:
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
engines: {node: '>=8'}
stringify-entities@4.0.4:
resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==}
strip-ansi@6.0.1:
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
engines: {node: '>=8'}
style-to-js@1.1.21:
resolution: {integrity: sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==}
@@ -3142,6 +3250,9 @@ packages:
webpack-virtual-modules@0.6.2:
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
which-module@2.0.1:
resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==}
which@2.0.2:
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'}
@@ -3154,6 +3265,13 @@ packages:
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
engines: {node: '>=0.10.0'}
wrap-ansi@6.2.0:
resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
engines: {node: '>=8'}
y18n@4.0.3:
resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==}
yallist@3.1.1:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
@@ -3161,6 +3279,14 @@ packages:
resolution: {integrity: sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==}
engines: {node: '>= 6'}
yargs-parser@18.1.3:
resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==}
engines: {node: '>=6'}
yargs@15.4.1:
resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==}
engines: {node: '>=8'}
yocto-queue@0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'}
@@ -4334,6 +4460,10 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.12.4
'@tauri-apps/plugin-deep-link@2.6.3':
dependencies:
'@tauri-apps/api': 2.12.4
'@tauri-apps/plugin-dialog@2.8.3':
dependencies:
'@tauri-apps/api': 2.12.4
@@ -4370,6 +4500,10 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.12.4
'@tauri-apps/plugin-websocket@2.5.0':
dependencies:
'@tauri-apps/api': 2.12.4
'@tauri-apps/plugin-window-state@2.5.0':
dependencies:
'@tauri-apps/api': 2.12.4
@@ -4414,6 +4548,10 @@ snapshots:
'@types/prop-types@15.7.15': {}
'@types/qrcode@1.5.6':
dependencies:
'@types/node': 26.6.5
'@types/react-dom@19.3.0(@types/react@19.3.0)':
dependencies:
'@types/react': 19.3.0
@@ -4525,6 +4663,12 @@ snapshots:
json-schema-traverse: 0.4.1
uri-js: 4.4.1
ansi-regex@5.0.1: {}
ansi-styles@4.3.0:
dependencies:
color-convert: 2.0.1
ansis@4.4.0: {}
argparse@2.0.1: {}
@@ -4610,6 +4754,8 @@ snapshots:
callsites@3.1.0: {}
camelcase@5.3.1: {}
camelcase@6.3.0: {}
caniuse-lite@1.0.30001816: {}
@@ -4636,6 +4782,12 @@ snapshots:
dependencies:
readdirp: 5.1.1
cliui@6.0.0:
dependencies:
string-width: 4.2.3
strip-ansi: 6.0.1
wrap-ansi: 6.2.0
cloudflare-video-element@1.3.5: {}
clsx@1.2.1: {}
@@ -4644,6 +4796,12 @@ snapshots:
codem-isoboxer@0.3.10: {}
color-convert@2.0.1:
dependencies:
color-name: 1.1.4
color-name@1.1.4: {}
combined-stream@1.0.8:
dependencies:
delayed-stream: 1.0.0
@@ -4720,6 +4878,8 @@ snapshots:
dependencies:
ms: 2.1.3
decamelize@1.2.0: {}
decode-named-character-reference@1.3.0:
dependencies:
character-entities: 2.0.2
@@ -4738,6 +4898,8 @@ snapshots:
diff@9.0.0: {}
dijkstrajs@1.0.3: {}
dnd-core@16.0.1:
dependencies:
'@react-dnd/asap': 5.0.2
@@ -4762,6 +4924,8 @@ snapshots:
electron-to-chromium@1.5.459: {}
emoji-regex@8.0.0: {}
empathic@2.1.0: {}
entities@4.5.0: {}
@@ -4890,6 +5054,11 @@ snapshots:
find-root@1.1.0: {}
find-up@4.1.0:
dependencies:
locate-path: 5.0.0
path-exists: 4.0.0
find-up@5.0.0:
dependencies:
locate-path: 6.0.0
@@ -4933,6 +5102,8 @@ snapshots:
gensync@1.0.0-beta.2: {}
get-caller-file@2.0.5: {}
get-intrinsic@1.3.0:
dependencies:
call-bind-apply-helpers: 1.0.2
@@ -5076,6 +5247,8 @@ snapshots:
is-extglob@2.1.1: {}
is-fullwidth-code-point@3.0.0: {}
is-glob@4.0.3:
dependencies:
is-extglob: 2.1.1
@@ -5187,6 +5360,10 @@ snapshots:
dependencies:
lie: 3.1.1
locate-path@5.0.0:
dependencies:
p-locate: 4.1.0
locate-path@6.0.0:
dependencies:
p-locate: 5.0.0
@@ -5646,14 +5823,24 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
p-limit@2.3.0:
dependencies:
p-try: 2.2.0
p-limit@3.1.0:
dependencies:
yocto-queue: 0.1.0
p-locate@4.1.0:
dependencies:
p-limit: 2.3.0
p-locate@5.0.0:
dependencies:
p-limit: 3.1.0
p-try@2.2.0: {}
parent-module@1.0.1:
dependencies:
callsites: 3.1.0
@@ -5697,6 +5884,8 @@ snapshots:
transitivePeerDependencies:
- react
pngjs@5.0.0: {}
postcss@8.5.31:
dependencies:
nanoid: 3.3.20
@@ -5723,6 +5912,12 @@ snapshots:
dependencies:
hookified: 2.2.0
qrcode@1.5.4:
dependencies:
dijkstrajs: 1.0.3
pngjs: 5.0.0
yargs: 15.4.1
react-blurhash@0.3.0(blurhash@2.0.5)(react@19.3.1):
dependencies:
blurhash: 2.0.5
@@ -5861,6 +6056,10 @@ snapshots:
mdast-util-to-markdown: 2.2.0
unified: 11.0.5
require-directory@2.1.1: {}
require-main-filename@2.0.0: {}
resolve-from@4.0.0: {}
resolve@1.22.13:
@@ -5913,6 +6112,8 @@ snapshots:
seroval@1.6.11: {}
set-blocking@2.0.0: {}
shebang-command@2.0.0:
dependencies:
shebang-regex: 3.0.0
@@ -5932,11 +6133,21 @@ snapshots:
spotify-audio-element@1.0.4: {}
string-width@4.2.3:
dependencies:
emoji-regex: 8.0.0
is-fullwidth-code-point: 3.0.0
strip-ansi: 6.0.1
stringify-entities@4.0.4:
dependencies:
character-entities-html4: 2.1.0
character-entities-legacy: 3.0.0
strip-ansi@6.0.1:
dependencies:
ansi-regex: 5.0.1
style-to-js@1.1.21:
dependencies:
style-to-object: 1.0.14
@@ -6119,6 +6330,8 @@ snapshots:
webpack-virtual-modules@0.6.2: {}
which-module@2.0.1: {}
which@2.0.2:
dependencies:
isexe: 2.0.0
@@ -6129,10 +6342,37 @@ snapshots:
word-wrap@1.2.5: {}
wrap-ansi@6.2.0:
dependencies:
ansi-styles: 4.3.0
string-width: 4.2.3
strip-ansi: 6.0.1
y18n@4.0.3: {}
yallist@3.1.1: {}
yaml@1.10.3: {}
yargs-parser@18.1.3:
dependencies:
camelcase: 5.3.1
decamelize: 1.2.0
yargs@15.4.1:
dependencies:
cliui: 6.0.0
decamelize: 1.2.0
find-up: 4.1.0
get-caller-file: 2.0.5
require-directory: 2.1.1
require-main-filename: 2.0.0
set-blocking: 2.0.0
string-width: 4.2.3
which-module: 2.0.1
y18n: 4.0.3
yargs-parser: 18.1.3
yocto-queue@0.1.0: {}
youtube-video-element@1.9.0:
+153 -4
View File
@@ -316,6 +316,7 @@ dependencies = [
"tauri",
"tauri-build",
"tauri-plugin-clipboard-manager",
"tauri-plugin-deep-link",
"tauri-plugin-dialog",
"tauri-plugin-global-shortcut",
"tauri-plugin-localhost",
@@ -327,6 +328,7 @@ dependencies = [
"tauri-plugin-store",
"tauri-plugin-updater",
"tauri-plugin-upload",
"tauri-plugin-websocket",
"tauri-plugin-window-state",
]
@@ -617,6 +619,25 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "const-random"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d38d4bb3e79c716fd0330d8da84171b0135e59e01076e99f22b75a64c56e952c"
dependencies = [
"const-random-macro",
]
[[package]]
name = "const-random-macro"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66bb491e9fc48cb3fed9d57df886880a751d540d645ebc86b6d9d35b8fa8457"
dependencies = [
"getrandom 0.4.3",
"tiny-keccak",
]
[[package]]
name = "cookie"
version = "0.18.2"
@@ -959,6 +980,15 @@ dependencies = [
"syn 2.0.119",
]
[[package]]
name = "dlv-list"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f"
dependencies = [
"const-random",
]
[[package]]
name = "dom_query"
version = "0.28.0"
@@ -1710,6 +1740,12 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]]
name = "hashbrown"
version = "0.15.5"
@@ -1836,7 +1872,7 @@ dependencies = [
"tokio",
"tokio-rustls",
"tower-service",
"webpki-roots",
"webpki-roots 1.0.10",
]
[[package]]
@@ -3075,6 +3111,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordered-multimap"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49203cdcae0030493bad186b28da2fa25645fa276a51b6fec8010d281e02ef79"
dependencies = [
"dlv-list",
"hashbrown 0.14.5",
]
[[package]]
name = "ordered-stream"
version = "0.2.0"
@@ -3740,7 +3786,7 @@ dependencies = [
"wasm-bindgen-futures",
"wasm-streams 0.4.2",
"web-sys",
"webpki-roots",
"webpki-roots 1.0.10",
]
[[package]]
@@ -3820,6 +3866,16 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "rust-ini"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "796e8d2b6696392a43bea58116b667fb4c29727dc5abd27d6acf338bb4f688c7"
dependencies = [
"cfg-if",
"ordered-multimap",
]
[[package]]
name = "rustc-hash"
version = "2.1.3"
@@ -4737,6 +4793,27 @@ dependencies = [
"thiserror 2.0.21",
]
[[package]]
name = "tauri-plugin-deep-link"
version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab551d9bec27bb79d1c7fe5ed38c5cfd1cebb86efa745acc65f5853f345f6e56"
dependencies = [
"dunce",
"plist",
"rust-ini",
"serde",
"serde_json",
"tauri",
"tauri-plugin",
"tauri-utils",
"thiserror 2.0.21",
"tracing",
"url",
"windows-registry",
"windows-result",
]
[[package]]
name = "tauri-plugin-dialog"
version = "2.8.3"
@@ -4852,7 +4929,7 @@ dependencies = [
"tauri-plugin",
"thiserror 1.0.69",
"tokio",
"tokio-tungstenite",
"tokio-tungstenite 0.28.0",
"uuid",
"webkit2gtk",
"webview2-com",
@@ -4979,6 +5056,26 @@ dependencies = [
"tokio-util",
]
[[package]]
name = "tauri-plugin-websocket"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe432106abc61677935462da4615f1c5c710747485e23d18ac8eb3631b3a0ddf"
dependencies = [
"futures-util",
"http",
"log",
"rand 0.9.5",
"rustls",
"serde",
"serde_json",
"tauri",
"tauri-plugin",
"thiserror 2.0.21",
"tokio",
"tokio-tungstenite 0.29.0",
]
[[package]]
name = "tauri-plugin-window-state"
version = "2.5.0"
@@ -5213,6 +5310,15 @@ dependencies = [
"time-core",
]
[[package]]
name = "tiny-keccak"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
dependencies = [
"crunchy",
]
[[package]]
name = "tiny_http"
version = "0.12.0"
@@ -5288,7 +5394,23 @@ dependencies = [
"futures-util",
"log",
"tokio",
"tungstenite",
"tungstenite 0.28.0",
]
[[package]]
name = "tokio-tungstenite"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f72a05e828585856dacd553fba484c242c46e391fb0e58917c942ee9202915c"
dependencies = [
"futures-util",
"log",
"rustls",
"rustls-pki-types",
"tokio",
"tokio-rustls",
"tungstenite 0.29.0",
"webpki-roots 0.26.11",
]
[[package]]
@@ -5533,6 +5655,24 @@ dependencies = [
"utf-8",
]
[[package]]
name = "tungstenite"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c01152af293afb9c7c2a57e4b559c5620b421f6d133261c60dd2d0cdb38e6b8"
dependencies = [
"bytes",
"data-encoding",
"http",
"httparse",
"log",
"rand 0.9.5",
"rustls",
"rustls-pki-types",
"sha1",
"thiserror 2.0.21",
]
[[package]]
name = "typed-path"
version = "0.12.4"
@@ -5932,6 +6072,15 @@ dependencies = [
"rustls-pki-types",
]
[[package]]
name = "webpki-roots"
version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
"webpki-roots 1.0.10",
]
[[package]]
name = "webpki-roots"
version = "1.0.10"
+2
View File
@@ -30,6 +30,8 @@ tauri-plugin-notification = "2.0.0-rc.1"
tauri-plugin-upload = "2.0.0"
tauri-plugin-dialog = "2.0.0"
tauri-plugin-shell = "2.3.5"
tauri-plugin-websocket = "2.5.0"
tauri-plugin-deep-link = "2.6.3"
tauri-plugin-mcp-bridge = { version = "0.13.2", optional = true }
[features]
+1
View File
@@ -14,6 +14,7 @@
"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister",
"websocket:default",
"shell:default"
]
}
+2
View File
@@ -28,6 +28,8 @@
"dialog:default",
"upload:allow-download",
"clipboard-manager:allow-write-text",
"websocket:default",
"deep-link:default",
"shell:default",
"shell:allow-open"
]
+1 -1
View File
@@ -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-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
{"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
View File
@@ -1 +1 @@
{"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","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","shell:default","shell:allow-open"]},"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"]}}
{"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"]},"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"]}}
+84
View File
@@ -2516,6 +2516,60 @@
"const": "core:window:deny-unminimize",
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
},
{
"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",
@@ -3392,6 +3446,36 @@
"const": "upload:deny-upload",
"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`",
"type": "string",
+2
View File
@@ -33,6 +33,8 @@ fn main() {
.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)])
+5
View File
@@ -54,6 +54,11 @@
"version": "../package.json",
"identifier": "com.blink.prayag17",
"plugins": {
"deep-link": {
"desktop": {
"schemes": ["blink"]
}
},
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZBOTJGNzM3REU2Q0JEMEYKUldRUHZXemVOL2VTK2k2andMWTZYbEN6SnIwV0V0L2Z3NlA4RzFabThPaXRqSFRMc004WGhCb2kK",
"endpoints": [
+9
View File
@@ -9,6 +9,7 @@ import React, { useCallback, useState } from "react";
import "./appBar.scss";
import { useShallow } from "zustand/shallow";
import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
import useHeaderStore from "@/utils/store/header";
import useSearchStore from "@/utils/store/search";
import BackButton from "../buttons/backButton";
@@ -131,6 +132,14 @@ const AppBarContent = () => {
data-tauri-drag-region
style={{ gap: "0.6em" }}
>
<Tooltip title="Watch together">
<IconButton
onClick={openSyncPlayDialog}
aria-label="Watch together"
>
<span className="material-symbols-rounded">groups</span>
</IconButton>
</Tooltip>
<CastButton />
<Tooltip title="Search">
<IconButton onClick={toggleSearchDialog} aria-label="Search">
@@ -18,6 +18,8 @@ import { useNavigate, useRouter } from "@tanstack/react-router";
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { useSnackbar } from "notistack";
import React, { useCallback, useState } from "react";
import QRCodeImage from "@/components/qrCode";
import { buildQuickConnectDeepLink } from "@/utils/deepLinks";
import useInterval from "@/utils/hooks/useInterval";
import { saveUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
@@ -244,6 +246,23 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
</Typography>
</Tooltip>
</div>
{quickConnectCode && (
<>
<Typography
variant="body2"
sx={{ mt: 2, opacity: 0.75, textAlign: "center" }}
>
Or scan this code with Blink on your phone to approve the
login.
</Typography>
<div style={{ marginTop: "1em", background: "#08001f", borderRadius: 12, padding: 8 }}>
<QRCodeImage
value={buildQuickConnectDeepLink(quickConnectCode)}
size={180}
/>
</div>
</>
)}
</DialogContent>
<DialogActions
className="flex flex-row"
+59
View File
@@ -0,0 +1,59 @@
import { useNavigate } from "@tanstack/react-router";
import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link";
import React, { useEffect } from "react";
import {
consumePendingDeepLink,
handleDeepLink,
} from "@/utils/methods/deepLinks";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
const DeepLinkHandler = () => {
const api = useApiInContext((state) => state.api);
const user = useCentralStore((state) => state.currentUser);
const navigate = useNavigate();
useEffect(() => {
let disposed = false;
let unlisten: (() => void) | undefined;
const process = async (urls: string[] | null | undefined) => {
for (const url of urls ?? []) {
try {
await handleDeepLink(url, { api, user, navigate });
} catch (error) {
console.error("Could not handle deep link", url, error);
}
}
};
getCurrent()
.then((urls) => {
if (!disposed) void process(urls);
})
.catch((error) => console.warn("Could not read deep links", error));
onOpenUrl((urls) => {
if (!disposed) void process(urls);
})
.then((stop) => {
if (disposed) stop();
else unlisten = stop;
})
.catch((error) => {
console.warn("Deep-link listener is unavailable", error);
});
const pending = consumePendingDeepLink();
if (pending) void process([pending]);
return () => {
disposed = true;
unlisten?.();
};
}, [api, user?.Id, navigate]);
return null;
};
export default React.memo(DeepLinkHandler);
+277
View File
@@ -0,0 +1,277 @@
import {
type BaseItemDto,
BaseItemKind,
type SessionInfoDto,
} from "@jellyfin/sdk/lib/generated-client";
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
import {
Box,
Button,
IconButton,
Paper,
Tooltip,
Typography,
} from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { useSnackbar } from "notistack";
import React, { useCallback, useMemo, useState } from "react";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { transferSessionToLocal } from "@/utils/methods/transferPlayback";
import { useApiInContext } from "@/utils/store/api";
import { useAudioPlayback } from "@/utils/store/audioPlayback";
import { useCentralStore } from "@/utils/store/central";
import { usePlaybackStore } from "@/utils/store/playback";
import useRealtimeStore from "@/utils/store/realtime";
const DISMISS_STORAGE_KEY = "blink:follow-me-dismissed";
const DISMISS_TTL_MS = 30 * 60 * 1000;
const MIN_POSITION_TICKS = 45 * 10_000_000;
type DismissedMap = Record<string, number>;
const readDismissed = (): DismissedMap => {
try {
const raw = sessionStorage.getItem(DISMISS_STORAGE_KEY);
const parsed = raw ? (JSON.parse(raw) as DismissedMap) : {};
const now = Date.now();
return Object.fromEntries(
Object.entries(parsed).filter(([, at]) => now - at < DISMISS_TTL_MS),
);
} catch {
return {};
}
};
const formatTime = (ticks: number) => {
const total = Math.max(0, Math.round(ticks / 10_000_000));
const hours = Math.floor(total / 3600);
const minutes = Math.floor((total % 3600) / 60);
const seconds = total % 60;
return hours > 0
? `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`
: `${minutes}:${String(seconds).padStart(2, "0")}`;
};
const deviceLabel = (session: SessionInfoDto) =>
session.DeviceName || session.Client || "another device";
const posterId = (item: BaseItemDto) =>
item.ImageTags?.Primary ? item.Id : (item.SeriesId ?? item.Id);
/**
* A Spotify-Connect style hand-off prompt. When another session of the same
* user is already watching something and this client is idle, offer to
* continue the same item here at its current position.
*/
const FollowMe = () => {
const api = useApiInContext((state) => state.api);
const user = useCentralStore((state) => state.currentUser);
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();
const localVideoActive = usePlaybackStore((state) =>
Boolean(state.playbackStream && state.metadata.item?.Id),
);
const localAudioActive = useAudioPlayback((state) =>
Boolean(state.display && state.item?.Id),
);
const localActive = localVideoActive || localAudioActive;
const realtimeSessions = useRealtimeStore((state) => state.sessions);
const sessionsQuery = useQuery({
queryKey: ["remoteSessions"],
queryFn: async () => {
if (!api || !user?.Id) return [];
return (await getSessionApi(api).getSessions()).data;
},
enabled: Boolean(api && user?.Id) && !localActive,
refetchInterval: localActive ? false : 15_000,
networkMode: "always",
});
const [dismissed, setDismissed] = useState<DismissedMap>(readDismissed);
const [transferring, setTransferring] = useState(false);
const candidate = useMemo(() => {
if (!api || !user?.Id || localActive) return undefined;
const sessions =
realtimeSessions.length > 0
? realtimeSessions
: (sessionsQuery.data ?? []);
const options = sessions.filter((session) => {
const item = session.NowPlayingItem;
const lastCheckIn = session.LastPlaybackCheckIn
? Date.parse(session.LastPlaybackCheckIn)
: 0;
const stale =
lastCheckIn > 0 && Date.now() - lastCheckIn > 15 * 60 * 1000;
return (
Boolean(session.Id && item?.Id) &&
!stale &&
session.DeviceId !== api.deviceInfo.id &&
session.UserId === user.Id &&
item?.Type !== BaseItemKind.Photo &&
(item?.Type === BaseItemKind.Audio ||
item?.Type === BaseItemKind.AudioBook ||
item?.Type === BaseItemKind.Episode ||
item?.Type === BaseItemKind.Movie ||
item?.Type === BaseItemKind.Video ||
Boolean(item?.MediaType === "Video")) &&
(session.PlayState?.PositionTicks ?? 0) >= MIN_POSITION_TICKS
);
});
if (options.length === 0) return undefined;
options.sort((a, b) => {
const aAt = a.LastPlaybackCheckIn ? Date.parse(a.LastPlaybackCheckIn) : 0;
const bAt = b.LastPlaybackCheckIn ? Date.parse(b.LastPlaybackCheckIn) : 0;
if (aAt !== bAt) return bAt - aAt;
return (
(b.PlayState?.PositionTicks ?? 0) - (a.PlayState?.PositionTicks ?? 0)
);
});
const session = options[0];
const item = session.NowPlayingItem;
if (!session.Id || !item?.Id) return undefined;
const position = session.PlayState?.PositionTicks ?? 0;
const key = `${session.Id}:${item.Id}`;
if (dismissed[key]) return undefined;
return { session, item, position, key };
}, [
api,
user?.Id,
localActive,
realtimeSessions,
sessionsQuery.data,
dismissed,
]);
const dismiss = useCallback((key: string) => {
setDismissed((current) => {
const next = { ...current, [key]: Date.now() };
sessionStorage.setItem(DISMISS_STORAGE_KEY, JSON.stringify(next));
return next;
});
}, []);
const handleContinue = useCallback(async () => {
if (!api || !user?.Id || !candidate) return;
setTransferring(true);
try {
const kind = await transferSessionToLocal(
api,
user.Id,
candidate.session,
);
dismiss(candidate.key);
if (kind === "video") navigate({ to: "/player" });
if (kind === "audio") navigate({ to: "/player/audio" });
if (kind !== "none") {
enqueueSnackbar(`Continuing from ${deviceLabel(candidate.session)}`, {
variant: "success",
});
}
} catch (error) {
console.error("Follow-me transfer failed", error);
enqueueSnackbar("Could not continue playback here", {
variant: "error",
});
} finally {
setTransferring(false);
}
}, [api, user?.Id, candidate, dismiss, enqueueSnackbar, navigate]);
if (!candidate || !api) return null;
const { item, session, position } = candidate;
const paused = Boolean(session.PlayState?.IsPaused);
const imageUrl = getImageUrlsApi(api).getItemImageUrlById(
posterId(item) ?? item.Id ?? "",
"Primary",
{ fillHeight: 168, fillWidth: 112, quality: 85 },
);
return (
<Paper
elevation={10}
sx={{
position: "fixed",
left: 24,
bottom: 24,
zIndex: 1300,
display: "flex",
gap: 1.5,
alignItems: "stretch",
width: "min(360px, calc(100vw - 48px))",
p: 1.25,
borderRadius: "18px",
background: "rgba(18, 16, 38, 0.94)",
border: "1px solid rgba(255, 255, 255, 0.1)",
backdropFilter: "blur(24px)",
boxShadow: "0 16px 48px rgba(0, 0, 0, 0.45)",
}}
>
<Box
component="img"
src={imageUrl}
alt=""
sx={{
width: 56,
height: 84,
flex: "0 0 auto",
objectFit: "cover",
borderRadius: "10px",
background: "rgba(255,255,255,0.06)",
}}
/>
<Box
sx={{ minWidth: 0, flex: 1, display: "flex", flexDirection: "column" }}
>
<Typography
variant="overline"
sx={{ lineHeight: 1.2, opacity: 0.65, letterSpacing: 0.8 }}
>
{paused ? "Paused on" : "Playing on"} {deviceLabel(session)}
</Typography>
<Typography variant="subtitle2" noWrap sx={{ fontWeight: 700 }}>
{item.SeriesName ?? item.Name ?? "Continue watching"}
</Typography>
<Typography variant="caption" noWrap sx={{ opacity: 0.65 }}>
{item.SeriesName && item.Name ? `${item.Name} · ` : ""}
{formatTime(position)}
</Typography>
<Box sx={{ display: "flex", gap: 0.5, mt: "auto", pt: 0.5 }}>
<Button
size="small"
variant="contained"
onClick={handleContinue}
disabled={transferring}
sx={{ textTransform: "none", borderRadius: "999px" }}
>
{transferring ? "Starting…" : "Continue here"}
</Button>
<Button
size="small"
onClick={() => dismiss(candidate.key)}
sx={{ textTransform: "none", borderRadius: "999px", opacity: 0.7 }}
>
Not now
</Button>
</Box>
</Box>
<Tooltip title="Dismiss">
<IconButton
size="small"
aria-label="Dismiss continue prompt"
onClick={() => dismiss(candidate.key)}
sx={{ alignSelf: "flex-start", opacity: 0.55 }}
>
<span className="material-symbols-rounded" style={{ fontSize: 18 }}>
close
</span>
</IconButton>
</Tooltip>
</Paper>
);
};
export default React.memo(FollowMe);
@@ -3,6 +3,7 @@ import { AnimatePresence, motion } from "motion/react";
import React from "react";
import { useShallow } from "zustand/shallow";
import { usePlaybackStore } from "@/utils/store/playback";
import useQueue from "@/utils/store/queue";
const SkipSegmentButton = () => {
const {
@@ -25,11 +26,16 @@ const SkipSegmentButton = () => {
})),
);
const hasNextItem = useQueue((state) =>
Boolean(state.tracks?.[state.currentItemIndex + 1]),
);
const segmentType = mediaSegments?.Items?.[currentSegmentIndex]?.Type;
const shouldShow =
mediaSegments?.Items?.length &&
currentSegmentIndex >= 0 &&
activeSegmentId &&
mediaSegments?.Items?.[currentSegmentIndex].Type !== "Outro";
(segmentType !== "Outro" || !hasNextItem);
const label = segmentType === "Outro" ? "Skip credits" : `Skip ${segmentType}`;
return (
<AnimatePresence>
@@ -81,7 +87,7 @@ const SkipSegmentButton = () => {
},
}}
>
Skip {mediaSegments?.Items?.[currentSegmentIndex].Type}
{label}
</Button>
</motion.div>
)}
@@ -15,8 +15,11 @@ import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueButton from "@/components/buttons/queueButton";
import BubbleSlider from "@/components/playback/videoPlayer/bubbleSlider";
import { secToTicks } from "@/utils/date/time";
import { secToTicks, ticksToSec } from "@/utils/date/time";
import { buildPlayDeepLink } from "@/utils/deepLinks";
import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
import { useApiInContext } from "@/utils/store/api";
import { useShareStore } from "@/utils/store/share";
import { usePlaybackStore } from "@/utils/store/playback";
import useSyncPlayback from "@/utils/store/syncPlayback";
import CaptionsButton from "./buttons/CaptionsButton";
@@ -87,6 +90,7 @@ const VideoPlayerControls = ({
decreaseVolumeByStep,
getCurrentTime,
isUserHovering,
currentTime,
} = usePlaybackStore(
useShallow((state) => ({
mediaSourceId: state.mediaSource.id,
@@ -110,6 +114,7 @@ const VideoPlayerControls = ({
decreaseVolumeByStep: state.decreaseVolumeByStep,
getCurrentTime: state.getCurrentTime,
isUserHovering: state.playerState.isUserHovering,
currentTime: state.playerState.currentTime,
})),
);
@@ -232,6 +237,30 @@ const VideoPlayerControls = ({
>
<span className="material-symbols-rounded">arrow_back</span>
</IconButton>
<IconButton
onClick={() =>
useShareStore
.getState()
.openShareDialog(
buildPlayDeepLink(
itemId ?? "",
currentTime > 0 ? ticksToSec(currentTime) : getCurrentTime(),
),
"Share this scene",
)
}
aria-label="Share scene"
title="Share scene"
>
<span className="material-symbols-rounded">share</span>
</IconButton>
<IconButton
onClick={openSyncPlayDialog}
aria-label="Watch together"
title="Watch together"
>
<span className="material-symbols-rounded">groups</span>
</IconButton>
<IconButton
onClick={(e) => setSettingsMenuRef(e.currentTarget)}
aria-label="Player settings"
@@ -10,10 +10,16 @@ import { toNumber } from "lodash";
import React, {
type ChangeEventHandler,
useCallback,
useEffect,
useMemo,
useState,
useTransition,
} from "react";
import { useShallow } from "zustand/shallow";
import {
getAutoSkipSegments,
setAutoSkipSegments,
} from "@/utils/storage/player";
import { useApiInContext } from "@/utils/store/api";
import {
changeAudioTrack,
@@ -67,6 +73,25 @@ const VideoPlayerSettingsMenu = ({
if (itemId) startSync({ itemId, sessionId: null });
};
const [autoSkip, setAutoSkip] = useState(false);
useEffect(() => {
let cancelled = false;
getAutoSkipSegments().then((enabled) => {
if (!cancelled) setAutoSkip(enabled);
});
return () => {
cancelled = true;
};
}, []);
const toggleAutoSkip = () => {
setAutoSkip((enabled) => {
const next = !enabled;
setAutoSkipSegments(next);
return next;
});
};
const [subtitleIsChanging, startSubtitleChange] = useTransition();
const handleSubtitleChange: ChangeEventHandler<
HTMLInputElement | HTMLTextAreaElement
@@ -188,6 +213,20 @@ const VideoPlayerSettingsMenu = ({
onChange={toggleSync}
/>
</MenuItem>
<MenuItem onClick={toggleAutoSkip}>
<Typography
sx={{
flexGrow: 1,
}}
>
Auto-skip intro &amp; recap
</Typography>
<Switch
checked={autoSkip}
onClick={(event) => event.stopPropagation()}
onChange={toggleAutoSkip}
/>
</MenuItem>
</MenuList>
</Popover>
);
+46
View File
@@ -0,0 +1,46 @@
import { CircularProgress } from "@mui/material";
import QRCode from "qrcode";
import React, { useEffect, useState } from "react";
const QRCodeImage = ({
value,
size = 220,
}: {
value: string;
size?: number;
}) => {
const [src, setSrc] = useState<string | null>(null);
useEffect(() => {
let cancelled = false;
setSrc(null);
QRCode.toDataURL(value, {
errorCorrectionLevel: "M",
margin: 1,
width: size,
color: { dark: "#ffffffff", light: "#00000000" },
})
.then((url) => {
if (!cancelled) setSrc(url);
})
.catch((error) => {
console.error("Could not create QR code", error);
});
return () => {
cancelled = true;
};
}, [value, size]);
if (!src) return <CircularProgress size={24} />;
return (
<img
src={src}
alt="QR code"
width={size}
height={size}
style={{ display: "block", borderRadius: 12 }}
/>
);
};
export default React.memo(QRCodeImage);
@@ -0,0 +1,133 @@
import { getAuthenticationApi } from "@jellyfin/sdk/lib/utils/api/authentication-api";
import {
Alert,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Stack,
TextField,
Typography,
} from "@mui/material";
import { useSnackbar } from "notistack";
import React, { useEffect, useState } from "react";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import useQuickConnectApprovalStore from "@/utils/store/quickConnectApproval";
const QuickConnectApprovalDialog = () => {
const open = useQuickConnectApprovalStore((state) => state.open);
const storeCode = useQuickConnectApprovalStore((state) => state.code);
const setStoreCode = useQuickConnectApprovalStore((state) => state.setCode);
const close = useQuickConnectApprovalStore(
(state) => state.closeQuickConnectApproval,
);
const api = useApiInContext((state) => state.api);
const user = useCentralStore((state) => state.currentUser);
const { enqueueSnackbar } = useSnackbar();
const [code, setCode] = useState(storeCode);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const [approved, setApproved] = useState(false);
useEffect(() => {
if (open) {
setCode(storeCode);
setError(null);
setApproved(false);
}
}, [open, storeCode]);
const approve = async () => {
if (!api || !user?.Id) {
setError("Sign in before approving another device");
return;
}
const trimmed = code.trim().toUpperCase();
if (!trimmed) {
setError("Enter the code shown on the other device");
return;
}
setBusy(true);
setError(null);
try {
const result = await getAuthenticationApi(api).authorizeQuickConnect({
code: trimmed,
userId: user.Id,
});
if (result.data) {
setApproved(true);
setStoreCode("");
enqueueSnackbar("Device approved", { variant: "success" });
setTimeout(close, 1200);
} else {
setError("This code is invalid or has expired");
}
} catch (reason) {
console.error("Quick Connect approval failed", reason);
setError("This code is invalid or has expired");
} finally {
setBusy(false);
}
};
return (
<Dialog
open={open}
onClose={close}
maxWidth="xs"
fullWidth
slotProps={{
paper: { className: "glass", sx: { borderRadius: "22px" } },
}}
>
<DialogTitle>Approve TV login</DialogTitle>
<DialogContent>
<Stack spacing={2}>
<Typography variant="body2" sx={{ opacity: 0.75 }}>
Enter the Quick Connect code shown on the TV or another device. This
signs that device in as {user?.Name ?? "your account"} without
typing a password on it.
</Typography>
<TextField
autoFocus
fullWidth
label="Quick Connect code"
value={code}
onChange={(event) =>
setCode(event.target.value.replace(/\s/g, "").toUpperCase())
}
onKeyDown={(event) => {
if (event.key === "Enter") void approve();
}}
slotProps={{
htmlInput: {
maxLength: 8,
style: {
letterSpacing: "0.25em",
fontWeight: 700,
textTransform: "uppercase",
},
},
}}
/>
{error && <Alert severity="error">{error}</Alert>}
{approved && <Alert severity="success">Device approved</Alert>}
</Stack>
</DialogContent>
<DialogActions>
<Button onClick={close}>Cancel</Button>
<Button
variant="contained"
onClick={approve}
disabled={busy || approved || !code.trim()}
>
{busy ? "Approving…" : "Approve"}
</Button>
</DialogActions>
</Dialog>
);
};
export default React.memo(QuickConnectApprovalDialog);
+421
View File
@@ -0,0 +1,421 @@
import {
GeneralCommandType,
MediaType,
PlayCommand,
PlaystateCommand,
} from "@jellyfin/sdk/lib/generated-client";
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
import { OutboundWebSocketMessageType } from "@jellyfin/sdk/lib/websocket";
import { useQueryClient } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import TauriWebSocket from "@tauri-apps/plugin-websocket";
import { useSnackbar } from "notistack";
import React, { useEffect, useRef } from "react";
import {
getLocalPlayback,
pauseLocalPlayback,
resumeLocalPlayback,
seekLocalPlayback,
setLocalMuted,
setLocalVolume,
stopLocalPlayback,
} from "@/utils/methods/localPlayback";
import { startPlaybackFromIds } from "@/utils/methods/startPlayback";
import {
handleSyncPlayCommand,
handleSyncPlayGroupUpdate,
} from "@/utils/methods/syncPlay";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { playItemFromQueue, usePlaybackStore } from "@/utils/store/playback";
import { clearQueue } from "@/utils/store/queue";
import useRealtimeStore from "@/utils/store/realtime";
const SUPPORTED_COMMANDS: GeneralCommandType[] = [
GeneralCommandType.VolumeUp,
GeneralCommandType.VolumeDown,
GeneralCommandType.Mute,
GeneralCommandType.Unmute,
GeneralCommandType.ToggleMute,
GeneralCommandType.SetVolume,
GeneralCommandType.ToggleFullscreen,
GeneralCommandType.ToggleStats,
GeneralCommandType.DisplayMessage,
GeneralCommandType.GoHome,
GeneralCommandType.GoToSearch,
GeneralCommandType.GoToSettings,
GeneralCommandType.SendString,
GeneralCommandType.SendKey,
GeneralCommandType.Back,
GeneralCommandType.SetSubtitleStreamIndex,
GeneralCommandType.SetAudioStreamIndex,
];
/**
* Keeps one WebSocket subscription alive for the session. Apart from live
* session lists it makes this client a controllable Jellyfin target and
* applies remote playstate/general commands locally.
*/
const RealtimeBridge = () => {
const api = useApiInContext((state) => state.api);
const user = useCentralStore((state) => state.currentUser);
const navigate = useNavigate();
const queryClient = useQueryClient();
const { enqueueSnackbar } = useSnackbar();
const invalidationTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
useEffect(() => {
if (!api?.accessToken) return;
const sessionApi = getSessionApi(api);
const userId = user?.Id;
const invalidate = () => {
if (invalidationTimer.current) clearTimeout(invalidationTimer.current);
invalidationTimer.current = setTimeout(() => {
for (const queryKey of [
["item"],
["home"],
["favorite"],
["library"],
["search"],
["playButton"],
]) {
queryClient.invalidateQueries({ queryKey });
}
}, 500);
};
const applyPlaystate = (
command?: PlaystateCommand,
seekTicks?: number | null,
) => {
if (!command) return;
if (command === PlaystateCommand.Seek) {
if (seekTicks != null) seekLocalPlayback(seekTicks);
return;
}
if (command === PlaystateCommand.Pause) {
pauseLocalPlayback();
return;
}
if (command === PlaystateCommand.Unpause) {
resumeLocalPlayback();
return;
}
if (command === PlaystateCommand.PlayPause) {
const local = getLocalPlayback();
if (local.paused) resumeLocalPlayback();
else pauseLocalPlayback();
return;
}
if (command === PlaystateCommand.Stop) {
const local = getLocalPlayback();
stopLocalPlayback();
if (local.kind === "video") {
usePlaybackStore.setState(usePlaybackStore.getInitialState());
clearQueue();
navigate({ to: "/home" });
}
return;
}
if (
command === PlaystateCommand.NextTrack ||
command === PlaystateCommand.PreviousTrack
) {
if (!userId) return;
const local = getLocalPlayback();
playItemFromQueue(
command === PlaystateCommand.NextTrack ? "next" : "previous",
userId,
api,
).then(() => {
if (local.kind === "video") navigate({ to: "/player" });
});
return;
}
if (
command === PlaystateCommand.Rewind ||
command === PlaystateCommand.FastForward
) {
const local = getLocalPlayback();
const delta =
(command === PlaystateCommand.Rewind ? -30 : 30) * 10_000_000;
seekLocalPlayback(Math.max(0, local.positionTicks + delta));
}
};
const applyGeneralCommand = (
name?: GeneralCommandType,
args?: { [key: string]: string },
) => {
if (!name) return;
const local = getLocalPlayback();
const video = usePlaybackStore.getState();
const volume = video.playerState.volume;
switch (name) {
case GeneralCommandType.VolumeUp:
setLocalVolume(volume + 0.05);
break;
case GeneralCommandType.VolumeDown:
setLocalVolume(volume - 0.05);
break;
case GeneralCommandType.SetVolume: {
const target = Number(args?.Volume);
if (Number.isFinite(target)) {
setLocalVolume(target > 1 ? target / 100 : target);
}
break;
}
case GeneralCommandType.Mute:
setLocalMuted(true);
break;
case GeneralCommandType.Unmute:
setLocalMuted(false);
break;
case GeneralCommandType.ToggleMute:
setLocalMuted(!video.playerState.isPlayerMuted);
break;
case GeneralCommandType.ToggleFullscreen:
if (local.kind === "video") {
try {
video.toggleIsPlayerFullscreen();
} catch (error) {
console.warn("Remote fullscreen failed", error);
}
}
break;
case GeneralCommandType.ToggleStats:
if (local.kind === "video") {
video.toggleShowStatsForNerds();
}
break;
case GeneralCommandType.DisplayMessage:
enqueueSnackbar(
[args?.Header, args?.Text].filter(Boolean).join(": ") ||
"Message from the server",
{
variant: "info",
autoHideDuration: Number(args?.TimeoutMs) || 5000,
},
);
break;
case GeneralCommandType.GoHome:
navigate({ to: "/home" });
break;
case GeneralCommandType.GoToSearch:
case GeneralCommandType.SendString:
navigate({
to: "/search",
search: { query: args?.String ?? "" },
});
break;
case GeneralCommandType.Back:
window.history.back();
break;
default:
console.info("Unhandled remote command", name, args);
}
};
const applyPlay = (play?: {
ItemIds?: string[] | null;
StartIndex?: number | null;
StartPositionTicks?: number | null;
AudioStreamIndex?: number | null;
SubtitleStreamIndex?: number | null;
PlayCommand?: PlayCommand;
}) => {
if (!play?.ItemIds?.length || !userId) return;
if (play.PlayCommand && play.PlayCommand !== PlayCommand.PlayNow) {
// PlayNext/PlayLast are uncommon from a remote; behave like PlayNow
// instead of silently ignoring the user's intent.
console.info("Remote play command", play.PlayCommand);
}
startPlaybackFromIds(api, userId, play.ItemIds, {
startIndex: play.StartIndex ?? 0,
startPositionTicks: play.StartPositionTicks ?? 0,
audioStreamIndex: play.AudioStreamIndex ?? undefined,
subtitleStreamIndex: play.SubtitleStreamIndex ?? undefined,
})
.then((result) => {
if (result.kind === "video") navigate({ to: "/player" });
if (result.kind === "audio") navigate({ to: "/player/audio" });
})
.catch((error) => {
console.error("Remote play failed", error);
enqueueSnackbar("Could not start remote playback", {
variant: "error",
});
});
};
const advertise = () => {
sessionApi
.postCapabilities({
playableMediaTypes: [
MediaType.Audio,
MediaType.Video,
MediaType.Photo,
],
supportedCommands: SUPPORTED_COMMANDS,
supportsMediaControl: true,
supportsPersistentIdentifier: true,
})
.catch((error) => {
console.warn(
"Could not advertise remote-control capabilities",
error,
);
});
};
advertise();
// Jellyfin 12 attaches the socket using the Authorization header sent
// by the Rust WebSocket client, so keep the token out of the URL.
const socketUrl = api.getUri("socket").replace(/^http/, "ws");
const handleMessage = (parsed: {
MessageType: OutboundWebSocketMessageType;
Data?: any;
}) => {
useRealtimeStore.getState().markMessage();
switch (parsed.MessageType) {
case OutboundWebSocketMessageType.Sessions:
useRealtimeStore.getState().setSessions(parsed.Data ?? []);
queryClient.setQueryData(["remoteSessions"], parsed.Data ?? []);
break;
case OutboundWebSocketMessageType.Playstate:
applyPlaystate(parsed.Data?.Command, parsed.Data?.SeekPositionTicks);
break;
case OutboundWebSocketMessageType.GeneralCommand:
applyGeneralCommand(parsed.Data?.Name, parsed.Data?.Arguments);
break;
case OutboundWebSocketMessageType.Play:
applyPlay(parsed.Data);
break;
case OutboundWebSocketMessageType.UserDataChanged:
case OutboundWebSocketMessageType.LibraryChanged:
invalidate();
break;
case OutboundWebSocketMessageType.SyncPlayGroupUpdate:
if (parsed.Data) {
void handleSyncPlayGroupUpdate(api, userId, parsed.Data);
}
break;
case OutboundWebSocketMessageType.SyncPlayCommand:
if (parsed.Data) handleSyncPlayCommand(parsed.Data);
break;
}
};
// Jellyfin 12 only attaches a socket to the session when the handshake
// carries the Authorization header, which a browser WebSocket cannot set.
// The Tauri plugin opens the socket from Rust, so pass the real header.
let disposed = false;
let socket: TauriWebSocket | null = null;
let keepAliveTimer: ReturnType<typeof setInterval> | null = null;
let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
let reconnectAttempts = 0;
const clearKeepAlive = () => {
if (keepAliveTimer) {
clearInterval(keepAliveTimer);
keepAliveTimer = null;
}
};
const scheduleReconnect = () => {
if (disposed || reconnectTimer) return;
useRealtimeStore.getState().setConnected(false);
const delay = Math.min(30_000, 1000 * 1.5 ** reconnectAttempts);
reconnectAttempts += 1;
reconnectTimer = setTimeout(() => {
reconnectTimer = null;
void connect();
}, delay);
};
const connect = async (): Promise<void> => {
if (disposed) return;
try {
const nextSocket = await TauriWebSocket.connect(socketUrl, {
headers: { Authorization: api.authorizationHeader },
});
if (disposed) {
await nextSocket.disconnect().catch(() => undefined);
return;
}
socket = nextSocket;
reconnectAttempts = 0;
useRealtimeStore.getState().setConnected(true);
advertise();
nextSocket.addListener((message) => {
if (message.type === "Close") {
clearKeepAlive();
socket = null;
scheduleReconnect();
return;
}
if (message.type !== "Text") return;
try {
const parsed = JSON.parse(message.data) as {
MessageType: OutboundWebSocketMessageType;
Data?: unknown;
};
if (
parsed.MessageType === OutboundWebSocketMessageType.ForceKeepAlive
) {
clearKeepAlive();
const seconds = Number(parsed.Data) || 60;
const sendKeepAlive = () => {
socket
?.send(JSON.stringify({ MessageType: "KeepAlive" }))
.catch(() => undefined);
};
sendKeepAlive();
keepAliveTimer = setInterval(
sendKeepAlive,
Math.max(1000, (seconds * 1000) / 2),
);
return;
}
handleMessage(parsed);
} catch (error) {
console.warn("Could not parse a WebSocket message", error);
}
});
await nextSocket.send(
JSON.stringify({
MessageType: "SessionsStart",
Data: "0,1000",
}),
);
} catch (error) {
console.warn("WebSocket connection failed", error);
scheduleReconnect();
}
};
void connect();
return () => {
disposed = true;
clearKeepAlive();
if (reconnectTimer) clearTimeout(reconnectTimer);
socket?.disconnect().catch(() => undefined);
socket = null;
useRealtimeStore.getState().setConnected(false);
if (invalidationTimer.current) {
clearTimeout(invalidationTimer.current);
invalidationTimer.current = null;
}
useRealtimeStore.getState().reset();
};
}, [api, user?.Id, navigate, queryClient, enqueueSnackbar]);
return null;
};
export default React.memo(RealtimeBridge);
+103
View File
@@ -0,0 +1,103 @@
import {
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Typography,
} from "@mui/material";
import { useNavigate } from "@tanstack/react-router";
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { useSnackbar } from "notistack";
import React from "react";
import QRCodeImage from "@/components/qrCode";
import { handleDeepLink } from "@/utils/methods/deepLinks";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import useShareStore from "@/utils/store/share";
const ShareDialog = () => {
const open = useShareStore((state) => state.open);
const link = useShareStore((state) => state.link);
const title = useShareStore((state) => state.title);
const close = useShareStore((state) => state.closeShareDialog);
const api = useApiInContext((state) => state.api);
const user = useCentralStore((state) => state.currentUser);
const navigate = useNavigate();
const { enqueueSnackbar } = useSnackbar();
const copy = async () => {
await writeText(link);
enqueueSnackbar("Link copied", { variant: "success" });
};
const openHere = async () => {
try {
await handleDeepLink(link, { api, user, navigate });
close();
} catch (error) {
console.error(error);
enqueueSnackbar("Could not open the link", { variant: "error" });
}
};
return (
<Dialog
open={open}
onClose={close}
maxWidth="xs"
fullWidth
slotProps={{
paper: { className: "glass", sx: { borderRadius: "22px" } },
}}
>
<DialogTitle>{title || "Share"}</DialogTitle>
<DialogContent>
<Box
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
gap: 2,
}}
>
<Box sx={{ p: 1, background: "#08001f", borderRadius: "14px" }}>
<QRCodeImage value={link} />
</Box>
<Typography
variant="body2"
sx={{ opacity: 0.7, textAlign: "center" }}
>
Scan with Blink on a phone or TV, or copy the link to open it on
another device.
</Typography>
<Box
sx={{
width: "100%",
px: 1.5,
py: 1,
borderRadius: "10px",
background: "rgba(255,255,255,0.06)",
fontFamily: "var(--font-mono, monospace)",
fontSize: "0.78rem",
wordBreak: "break-all",
userSelect: "all",
}}
>
{link}
</Box>
</Box>
</DialogContent>
<DialogActions>
<Button onClick={openHere}>Open here</Button>
<Button variant="contained" onClick={copy}>
Copy link
</Button>
<Button onClick={close}>Close</Button>
</DialogActions>
</Dialog>
);
};
export default React.memo(ShareDialog);
+49
View File
@@ -0,0 +1,49 @@
import { useNavigate } from "@tanstack/react-router";
import React, { useEffect } from "react";
import { getLocalPlayback } from "@/utils/methods/localPlayback";
import { reportSyncPlayReady } from "@/utils/methods/syncPlay";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import useSyncPlayStore from "@/utils/store/syncPlay";
/** Applies navigation requested by a group queue start. */
const SyncPlayController = () => {
const pendingNavigation = useSyncPlayStore(
(state) => state.pendingNavigation,
);
const setPendingNavigation = useSyncPlayStore(
(state) => state.setPendingNavigation,
);
const group = useSyncPlayStore((state) => state.group);
const queue = useSyncPlayStore((state) => state.queue);
const api = useApiInContext((state) => state.api);
const user = useCentralStore((state) => state.currentUser);
const navigate = useNavigate();
useEffect(() => {
if (!pendingNavigation) return;
setPendingNavigation(null);
navigate({
to: pendingNavigation === "audio" ? "/player/audio" : "/player",
});
}, [pendingNavigation, setPendingNavigation, navigate]);
// While a group is waiting, keep telling the server this player is ready.
// Some clients miss the one-shot Ready after a queue update; retrying is
// harmless and lets the server release the group as soon as it can.
useEffect(() => {
if (!api || !user?.Id || !group || group.State !== "Waiting") return;
if (!queue?.Playlist?.length) return;
const send = () => {
const local = getLocalPlayback();
reportSyncPlayReady(api, local.positionTicks, !local.paused);
};
send();
const timer = window.setInterval(send, 2000);
return () => window.clearInterval(timer);
}, [api, user?.Id, group?.GroupId, group?.State, queue]);
return null;
};
export default React.memo(SyncPlayController);
+354
View File
@@ -0,0 +1,354 @@
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { getSyncPlayApi } from "@jellyfin/sdk/lib/utils/api/sync-play-api";
import {
Alert,
Box,
Button,
Chip,
CircularProgress,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Divider,
List,
ListItem,
ListItemText,
Stack,
TextField,
Typography,
} from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import React, { useEffect, useMemo, useState } from "react";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import {
closeSyncPlayDialog,
createSyncPlayGroup,
joinSyncPlayGroup,
leaveSyncPlayGroup,
pauseSyncPlayGroup,
refreshSyncPlayGroups,
resumeSyncPlayGroup,
startSyncPlayQueue,
watchSyncPlayQueueHere,
} from "@/utils/methods/syncPlay";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import useQueue from "@/utils/store/queue";
import useSyncPlayStore from "@/utils/store/syncPlay";
const stateLabel = (state?: string) => {
switch (state) {
case "Waiting":
return "Waiting for everyone";
case "Paused":
return "Paused";
case "Playing":
return "Playing";
default:
return "Idle";
}
};
const SyncPlayDialog = () => {
const api = useApiInContext((state) => state.api);
const user = useCentralStore((state) => state.currentUser);
const open = useSyncPlayStore((state) => state.open);
const group = useSyncPlayStore((state) => state.group);
const groups = useSyncPlayStore((state) => state.groups);
const queue = useSyncPlayStore((state) => state.queue);
const loading = useSyncPlayStore((state) => state.loading);
const error = useSyncPlayStore((state) => state.error);
const localQueue = useQueue((state) => state.tracks ?? []);
const [groupName, setGroupName] = useState("");
const setGroups = useSyncPlayStore((state) => state.setGroups);
const setGroup = useSyncPlayStore((state) => state.setGroup);
const groupsQuery = useQuery({
queryKey: ["syncPlayGroups", open],
queryFn: async () => {
if (!api) return [];
return (await getSyncPlayApi(api).syncPlayGetGroups()).data ?? [];
},
enabled: open && Boolean(api),
refetchInterval: open && !group ? 3000 : false,
networkMode: "always",
});
useEffect(() => {
if (groupsQuery.data) setGroups(groupsQuery.data);
}, [groupsQuery.data, setGroups]);
useEffect(() => {
if (open && api) void refreshSyncPlayGroups(api);
}, [open, api]);
const groupQuery = useQuery({
queryKey: ["syncPlayGroup", group?.GroupId],
queryFn: async () => {
if (!api || !group?.GroupId) return undefined;
return (await getSyncPlayApi(api).syncPlayGetGroup({ id: group.GroupId }))
.data;
},
enabled: open && Boolean(api && group?.GroupId),
refetchInterval: open && group ? 3000 : false,
networkMode: "always",
});
useEffect(() => {
if (groupQuery.data) setGroup(groupQuery.data);
}, [groupQuery.data, setGroup]);
const queueItemIds = useMemo(
() =>
(queue?.Playlist ?? [])
.map((item) => item.ItemId)
.filter((id): id is string => Boolean(id)),
[queue],
);
const currentQueueIndex = Math.min(
Math.max(0, queue?.PlayingItemIndex ?? 0),
Math.max(0, queueItemIds.length - 1),
);
const currentItemId = queueItemIds[currentQueueIndex];
const currentItem = useQuery({
queryKey: ["syncPlayItem", currentItemId],
queryFn: async () => {
if (!api || !currentItemId) return undefined;
return (await getLibraryApi(api).getItem({ itemId: currentItemId })).data;
},
enabled: open && Boolean(api && currentItemId),
networkMode: "always",
});
const imageUrl =
api && currentItem.data?.Id && currentItem.data.ImageTags?.Primary
? getImageUrlsApi(api).getItemImageUrlById(
currentItem.data.Id,
"Primary",
{ fillWidth: 96, fillHeight: 144, quality: 85 },
)
: undefined;
const handleCreate = async () => {
if (!api) return;
const created = await createSyncPlayGroup(api, groupName);
if (created) setGroupName("");
};
const handleClose = () => closeSyncPlayDialog();
return (
<Dialog
open={open}
onClose={handleClose}
fullWidth
maxWidth="sm"
slotProps={{
paper: { className: "glass", sx: { borderRadius: "22px" } },
}}
>
<DialogTitle sx={{ display: "flex", alignItems: "center", gap: 1 }}>
<span className="material-symbols-rounded">groups</span>
Watch together
</DialogTitle>
<DialogContent>
{error && (
<Alert severity="warning" sx={{ mb: 2 }}>
{error}
</Alert>
)}
{group ? (
<Stack spacing={2}>
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
<Typography variant="h6" sx={{ flex: 1 }} noWrap>
{group.GroupName || "SyncPlay group"}
</Typography>
<Chip
size="small"
label={stateLabel(group.State)}
color={group.State === "Playing" ? "success" : "default"}
variant={group.State === "Playing" ? "filled" : "outlined"}
/>
</Box>
<Typography variant="body2" sx={{ opacity: 0.65 }}>
{group.Participants?.length
? `${group.Participants.length} device${
group.Participants.length === 1 ? "" : "s"
} connected: ${group.Participants.join(", ")}`
: "This is the first device in the group."}
</Typography>
<Divider />
<Box sx={{ display: "flex", gap: 2, alignItems: "center" }}>
{imageUrl ? (
<Box
component="img"
src={imageUrl}
alt=""
sx={{
width: 64,
height: 96,
objectFit: "cover",
borderRadius: "10px",
flex: "0 0 auto",
}}
/>
) : (
<Box
sx={{
width: 64,
height: 96,
borderRadius: "10px",
background: "rgba(255,255,255,0.07)",
display: "grid",
placeItems: "center",
flex: "0 0 auto",
}}
>
<span className="material-symbols-rounded">movie</span>
</Box>
)}
<Box sx={{ minWidth: 0 }}>
<Typography variant="overline" sx={{ opacity: 0.6 }}>
Group queue
</Typography>
<Typography variant="subtitle1" noWrap>
{currentItem.data?.Name ??
(queueItemIds.length
? "Loading item…"
: "Nothing queued yet")}
</Typography>
<Typography variant="caption" sx={{ opacity: 0.65 }}>
{queueItemIds.length
? `${queueItemIds.length} item${
queueItemIds.length === 1 ? "" : "s"
} · item ${currentQueueIndex + 1}`
: "Start a queue on the device that should lead."}
</Typography>
</Box>
</Box>
<Divider />
<Box sx={{ display: "flex", gap: 1, flexWrap: "wrap" }}>
<Button
variant="contained"
disabled={loading || localQueue.length === 0 || !user?.Id}
onClick={() => api && startSyncPlayQueue(api)}
>
{queueItemIds.length
? "Replace with my queue"
: "Share my queue"}
</Button>
{queueItemIds.length > 0 && user?.Id && (
<Button
variant="outlined"
disabled={loading}
onClick={() => {
if (api && user?.Id) {
void watchSyncPlayQueueHere(api, user.Id);
}
}}
>
Watch here
</Button>
)}
<Button
variant="outlined"
disabled={loading}
onClick={() =>
api &&
(group.State === "Playing"
? pauseSyncPlayGroup(api)
: resumeSyncPlayGroup(api))
}
>
{group.State === "Playing" ? "Pause everyone" : "Play everyone"}
</Button>
<Button
color="error"
disabled={loading}
onClick={() => api && leaveSyncPlayGroup(api)}
>
Leave group
</Button>
</Box>
{loading && <CircularProgress size={20} />}
</Stack>
) : (
<Stack spacing={2}>
<Typography variant="body2" sx={{ opacity: 0.75 }}>
Create a group and start the current queue, or join a group
created on another device. Every device that joins follows the
same timeline.
</Typography>
<Stack direction="row" spacing={1}>
<TextField
size="small"
fullWidth
label="Group name"
placeholder="Movie night"
value={groupName}
onChange={(event) => setGroupName(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Enter") void handleCreate();
}}
/>
<Button
variant="contained"
disabled={loading || !api}
onClick={handleCreate}
sx={{ flex: "0 0 auto" }}
>
Create
</Button>
</Stack>
<Divider />
<Typography variant="overline" sx={{ opacity: 0.65 }}>
Available groups
</Typography>
{groupsQuery.isPending ? (
<CircularProgress size={20} />
) : groups.length === 0 ? (
<Typography variant="body2" sx={{ opacity: 0.6 }}>
No groups yet. Create one above.
</Typography>
) : (
<List dense disablePadding>
{groups.map((entry) => (
<ListItem
key={entry.GroupId}
divider
secondaryAction={
<Button
size="small"
variant="outlined"
disabled={loading}
onClick={() => {
if (api && entry.GroupId) {
void joinSyncPlayGroup(api, entry.GroupId);
}
}}
>
Join
</Button>
}
>
<ListItemText
primary={entry.GroupName || "Watch together"}
secondary={`${stateLabel(entry.State)} · ${
entry.Participants?.length ?? 0
} device${(entry.Participants?.length ?? 0) === 1 ? "" : "s"}`}
/>
</ListItem>
))}
</List>
)}
</Stack>
)}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Close</Button>
</DialogActions>
</Dialog>
);
};
export default React.memo(SyncPlayDialog);
+14
View File
@@ -17,6 +17,7 @@ import React, {
import { delUser } from "@/utils/storage/user";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { useQuickConnectApprovalStore } from "@/utils/store/quickConnectApproval";
export const UserAvatarMenu = () => {
const api = useApiInContext((s) => s.api);
@@ -106,6 +107,19 @@ export const UserAvatarMenu = () => {
Logout
</MenuItem>
<Divider />
<MenuItem
onClick={() => {
useQuickConnectApprovalStore
.getState()
.openQuickConnectApproval();
handleMenuClose();
}}
>
<ListItemIcon>
<span className="material-symbols-rounded">qr_code_2</span>
</ListItemIcon>
Approve device login
</MenuItem>
<MenuItem
onClick={() => {
navigate({ to: "/settings/preferences" });
+14
View File
@@ -23,12 +23,19 @@ import type { QueryClient } from "@tanstack/react-query";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import Backdrop from "@/components/backdrop";
import DeepLinkHandler from "@/components/deepLinks";
import FollowMe from "@/components/followMe";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import QuickConnectApprovalDialog from "@/components/quickConnectApproval";
import ShareDialog from "@/components/share";
import OverlayScrollbar from "@/components/overlayScrollbar";
import PlaybackSync from "@/components/playback/PlaybackSync";
import RealtimeBridge from "@/components/realtime";
import SplashHider from "@/components/splash";
import RemoteControlDialog from "@/components/remoteControl";
import RouterLoading from "@/components/routerLoading";
import SyncPlayController from "@/components/syncPlay/controller";
import SyncPlayDialog from "@/components/syncPlay";
import Search from "@/components/search";
import Updater from "@/components/updater";
import WindowChrome from "@/components/windowControls/windowChrome";
@@ -60,12 +67,19 @@ export const Route = createRootRouteWithContext<ApiContext>()({
<Backdrop />
<Search />
<RemoteControlDialog />
<SyncPlayDialog />
<SyncPlayController />
<ShareDialog />
<QuickConnectApprovalDialog />
<DeepLinkHandler />
<AppBar />
<WindowChrome />
<WindowDrag />
<WindowResizeHandles />
<AudioPlayer />
<PlaybackSync />
<RealtimeBridge />
<FollowMe />
<OverlayScrollbar />
<Outlet />
</SnackbarProvider>
+8
View File
@@ -7,6 +7,7 @@ import { NavigationDrawer } from "@/components/appBar/navigationDrawer";
import CastButton from "@/components/buttons/castButton";
import { UserAvatarMenu } from "@/components/userAvatarMenu";
import WindowControls from "@/components/windowControls";
import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
import useSearchStore from "@/utils/store/search";
type HomeHeaderProps = {
@@ -102,6 +103,13 @@ const HomeHeader = ({ libraries, onNewAndPopular }: HomeHeaderProps) => {
</div>
<div className="home-header-right">
<IconButton
aria-label="Watch together"
title="Watch together"
onClick={openSyncPlayDialog}
>
<span className="material-symbols-rounded">groups</span>
</IconButton>
<IconButton aria-label="Search" onClick={toggleSearchDialog}>
<span className="material-symbols-rounded">search</span>
</IconButton>
+116 -8
View File
@@ -27,8 +27,18 @@ import StatsForNerds from "@/components/playback/videoPlayer/StatsForNerds";
import UpNextFlyout from "@/components/playback/videoPlayer/upNextFlyout";
import VolumeChangeOverlay from "@/components/playback/videoPlayer/VolumeChangeOverlay";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { getAutoSkipSegments } from "@/utils/storage/player";
import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop";
import {
inSyncPlayGroup,
nextSyncPlayItem,
reportSyncPlayBuffering,
reportSyncPlayPause,
reportSyncPlayReady,
reportSyncPlayResume,
reportSyncPlaySeek,
} from "@/utils/methods/syncPlay";
import { useCentralStore } from "@/utils/store/central";
import useQueue, { clearQueue } from "@/utils/store/queue";
import type subtitlePlaybackInfo from "@/utils/types/subtitlePlaybackInfo";
@@ -101,7 +111,9 @@ export function VideoPlayer() {
const {
itemId,
userDataLastPlayedPositionTicks,
// mediaSegments,
mediaSegments,
activeSegmentId,
skipSegment,
setCurrentTime,
volume,
isPlayerPlaying,
@@ -131,7 +143,9 @@ export function VideoPlayer() {
itemId: state.metadata.item?.Id,
userDataLastPlayedPositionTicks:
state.metadata.userDataLastPlayedPositionTicks,
// mediaSegments: state.metadata.mediaSegments,
mediaSegments: state.metadata.mediaSegments,
activeSegmentId: state.activeSegmentId,
skipSegment: state.skipSegment,
setCurrentTime: state.setCurrentTime,
volume: state.playerState.volume,
isPlayerPlaying: state.playerState.isPlayerPlaying,
@@ -170,6 +184,70 @@ export function VideoPlayer() {
]);
const [error, setError] = React.useState<any>(null);
const autoSkippedSegmentRef = useRef<string | null>(null);
// Deep links, transfers and resume all set a start position. Do not rely
// on a single `onReady` callback (HLS wrappers can fire it late or reset
// the media afterwards), keep enforcing it until the player settles.
useEffect(() => {
if (!playbackStream) return;
const target = ticksToSec(userDataLastPlayedPositionTicks ?? 0);
if (target <= 1) {
startSeekRef.current = null;
return;
}
startSeekRef.current = {
target,
expiresAt: Date.now() + 15000,
};
const seek = () => {
// A user seek clears the pending target; stop enforcing then.
if (!startSeekRef.current) return true;
const video = getVideoElement();
if (!video) return false;
if (Math.abs(video.currentTime - target) > 3) {
video.currentTime = target;
}
// HLS wrappers can report the new time and then reset to the
// manifest start; keep the target until the 15s window expires.
return false;
};
seek();
const timer = window.setInterval(() => {
if (seek() || Date.now() > (startSeekRef.current?.expiresAt ?? 0)) {
window.clearInterval(timer);
startSeekRef.current = null;
}
}, 500);
return () => window.clearInterval(timer);
}, [playbackStream, userDataLastPlayedPositionTicks, getVideoElement]);
useEffect(() => {
if (!activeSegmentId || !mediaSegments) return;
const segment = mediaSegments.Items?.find(
(entry) => entry.Id === activeSegmentId,
);
if (!segment?.Id) return;
if (
segment.Type !== "Intro" &&
segment.Type !== "Recap" &&
segment.Type !== "Commercial" &&
segment.Type !== "Preview"
) {
return;
}
const segmentId = segment.Id;
let cancelled = false;
getAutoSkipSegments().then((enabled) => {
if (!enabled || cancelled) return;
if (autoSkippedSegmentRef.current === segmentId) return;
autoSkippedSegmentRef.current = segmentId;
skipSegment();
});
return () => {
cancelled = true;
};
}, [activeSegmentId, mediaSegments, skipSegment]);
const setBackdrop = useBackdropStore(useShallow((s) => s.setBackdrop));
useEffect(() => setBackdrop(""), []);
@@ -281,6 +359,11 @@ export function VideoPlayer() {
VolumeLevel: Math.floor(volume * 100),
},
});
reportSyncPlayReady(
api,
secToTicks(getVideoElement()?.currentTime ?? 0),
true,
);
}
};
@@ -374,6 +457,7 @@ export function VideoPlayer() {
VolumeLevel: Math.floor(volume * 100),
},
});
reportSyncPlayPause(api);
}, [
setCurrentTime,
api,
@@ -547,13 +631,19 @@ export function VideoPlayer() {
]);
const handlePlaybackEnded = useCallback(() => {
if (queue?.length !== currentQueueItemIndex + 1) {
clearActiveSegment(); // Clear active segment when playback ends
if (api && inSyncPlayGroup()) {
// The group owns the queue while watching together; the server will
// broadcast the next item so every device moves on together.
void nextSyncPlayItem(api);
return;
}
if (queue?.length !== currentQueueItemIndex + 1) {
playItemFromQueue("next", user?.Id, api);
} else {
handleExitPlayer(); // Exit player if playback has finished and the queue is empty
}
}, []);
}, [api, queue?.length, currentQueueItemIndex, user?.Id]);
const idleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -590,10 +680,22 @@ export function VideoPlayer() {
const handleOnBuffer = useCallback(() => {
setIsBuffering(true);
}, [setIsBuffering]);
reportSyncPlayBuffering(
api,
true,
secToTicks(getVideoElement()?.currentTime ?? 0),
isPlayerPlaying,
);
}, [setIsBuffering, api, isPlayerPlaying]);
const handleOnBufferEnd = useCallback(() => {
setIsBuffering(false);
}, [setIsBuffering]);
reportSyncPlayBuffering(
api,
false,
secToTicks(getVideoElement()?.currentTime ?? 0),
true,
);
}, [setIsBuffering, api]);
const handleError = useCallback((e: any) => {
console.error("Video playback error:", e);
@@ -666,7 +768,10 @@ export function VideoPlayer() {
onReady={handleReady}
onTimeUpdate={handleTimeUpdate}
onPause={handlePause}
onPlay={handleTimeUpdate}
onPlay={() => {
handleTimeUpdate();
reportSyncPlayResume(api);
}}
onError={handleError}
onEnded={handlePlaybackEnded}
width="100vw"
@@ -678,7 +783,10 @@ export function VideoPlayer() {
volume={isPlayerMuted ? 0 : volume}
onWaiting={handleOnBuffer}
onPlaying={handleOnBufferEnd}
onSeeking={(e) => handleOnSeek(e.currentTarget.currentTime)}
onSeeking={(e) => {
handleOnSeek(e.currentTarget.currentTime);
reportSyncPlaySeek(api, secToTicks(e.currentTarget.currentTime));
}}
playsInline
crossOrigin="anonymous"
/>
+69
View File
@@ -0,0 +1,69 @@
export type ParsedDeepLink =
| { kind: "play"; itemId: string; seconds: number }
| { kind: "item"; itemId: string; seconds: number }
| { kind: "quickconnect"; code: string }
| { kind: "search"; query: string }
| { kind: "unknown"; url: string };
export const DEEP_LINK_SCHEME = "blink";
export const buildPlayDeepLink = (itemId: string, seconds = 0) => {
const start = Math.max(0, Math.floor(seconds));
return `${DEEP_LINK_SCHEME}://play/${encodeURIComponent(itemId)}${
start > 0 ? `?t=${start}` : ""
}`;
};
export const buildQuickConnectDeepLink = (code: string) =>
`${DEEP_LINK_SCHEME}://quickconnect?code=${encodeURIComponent(code)}`;
const toSeconds = (value: string | null) => {
const parsed = Number(value);
return Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
};
export const parseDeepLink = (input: string): ParsedDeepLink => {
let url: URL;
try {
url = new URL(input.trim());
} catch {
return { kind: "unknown", url: input };
}
if (url.protocol !== `${DEEP_LINK_SCHEME}:`) {
return { kind: "unknown", url: input };
}
const segments = [
url.hostname.toLowerCase(),
...url.pathname.split("/").filter(Boolean).map(decodeURIComponent),
].filter(Boolean);
const [head, value] = segments;
switch (head) {
case "play":
if (!value) return { kind: "unknown", url: input };
return {
kind: "play",
itemId: value,
seconds: toSeconds(url.searchParams.get("t")),
};
case "item":
if (!value) return { kind: "unknown", url: input };
return {
kind: "item",
itemId: value,
seconds: toSeconds(url.searchParams.get("t")),
};
case "quickconnect":
case "quick-connect":
return {
kind: "quickconnect",
code: (url.searchParams.get("code") ?? value ?? "").toUpperCase(),
};
case "search":
return {
kind: "search",
query: url.searchParams.get("q") ?? value ?? "",
};
default:
return { kind: "unknown", url: input };
}
};
+68
View File
@@ -0,0 +1,68 @@
import type { Api } from "@jellyfin/sdk";
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
import type { useNavigate } from "@tanstack/react-router";
import { parseDeepLink } from "@/utils/deepLinks";
import { startPlaybackFromIds } from "@/utils/methods/startPlayback";
import { useQuickConnectApprovalStore } from "@/utils/store/quickConnectApproval";
const PENDING_LINK_KEY = "blink:pending-deep-link";
type Navigate = ReturnType<typeof useNavigate>;
export const handleDeepLink = async (
url: string,
options: {
api: Api | undefined;
user: UserDto | null | undefined;
navigate: Navigate;
},
): Promise<"video" | "audio" | "quickconnect" | "item" | "search" | "none"> => {
const parsed = parseDeepLink(url);
if (parsed.kind === "quickconnect") {
useQuickConnectApprovalStore
.getState()
.openQuickConnectApproval(parsed.code);
return "quickconnect";
}
if (!options.api || !options.user?.Id) {
sessionStorage.setItem(PENDING_LINK_KEY, url);
return "none";
}
if (parsed.kind === "play") {
const result = await startPlaybackFromIds(
options.api,
options.user.Id,
[parsed.itemId],
{ startPositionTicks: Math.round(parsed.seconds * 10_000_000) },
);
if (result.kind === "video") options.navigate({ to: "/player" });
if (result.kind === "audio") options.navigate({ to: "/player/audio" });
return result.kind === "none" ? "none" : result.kind;
}
if (parsed.kind === "item") {
options.navigate({
to: "/item/$id",
params: { id: parsed.itemId },
});
return "item";
}
if (parsed.kind === "search") {
options.navigate({
to: "/search",
search: { query: parsed.query },
});
return "search";
}
return "none";
};
export const consumePendingDeepLink = () => {
const url = sessionStorage.getItem(PENDING_LINK_KEY);
if (url) sessionStorage.removeItem(PENDING_LINK_KEY);
return url;
};
+125
View File
@@ -0,0 +1,125 @@
import { secToTicks, ticksToSec } from "@/utils/date/time";
import {
setVolume as setAudioVolume,
setIsMuted,
stopPlayback,
useAudioPlayback,
} from "@/utils/store/audioPlayback";
import { usePlaybackStore } from "@/utils/store/playback";
export type LocalPlaybackSnapshot = {
kind: "video" | "audio" | "none";
itemId: string | null;
positionTicks: number;
paused: boolean;
};
const getVideoElement = () =>
document
.querySelector("hls-video")
?.shadowRoot?.querySelector("video") as HTMLVideoElement | null;
/** What this client is currently playing, if anything. */
export const getLocalPlayback = (): LocalPlaybackSnapshot => {
const video = usePlaybackStore.getState();
if (video.playbackStream && video.metadata.item?.Id) {
return {
kind: "video",
itemId: video.metadata.item.Id,
positionTicks: video.playerState.currentTime ?? 0,
paused: !video.playerState.isPlayerPlaying,
};
}
const audio = useAudioPlayback.getState();
if (audio.display && audio.item?.Id) {
const element = audio.player.ref?.current;
return {
kind: "audio",
itemId: audio.item.Id,
positionTicks: element
? secToTicks(element.currentTime)
: audio.player.currentTick,
paused: element ? element.paused : !audio.player.playing,
};
}
return { kind: "none", itemId: null, positionTicks: 0, paused: false };
};
export const pauseLocalPlayback = () => {
const video = usePlaybackStore.getState();
if (video.playbackStream && video.metadata.item?.Id) {
getVideoElement()?.pause();
video.setIsPlaying(false);
}
useAudioPlayback.getState().player.ref?.current?.pause();
};
export const resumeLocalPlayback = () => {
const video = usePlaybackStore.getState();
if (video.playbackStream && video.metadata.item?.Id) {
video.setIsPlaying(true);
getVideoElement()
?.play()
.catch(() => {
// The ReactPlayer `playing` prop retries once the media is ready.
});
}
const audio = useAudioPlayback.getState();
if (audio.display && audio.item?.Id) {
audio.player.ref?.current?.play().catch(() => undefined);
}
};
export const seekLocalPlayback = (positionTicks: number) => {
const ticks = Math.max(0, Math.round(positionTicks));
const video = usePlaybackStore.getState();
if (video.playbackStream && video.metadata.item?.Id) {
if (!video.playerState.isPlayerReady) {
usePlaybackStore.setState((state) => {
state.playerState.seekValue = ticks;
state.playerState.currentTime = ticks;
});
return;
}
video.seekTo(ticksToSec(ticks));
return;
}
const audio = useAudioPlayback.getState();
const element = audio.player.ref?.current;
if (element) {
element.currentTime = ticksToSec(ticks);
}
};
export const setLocalVolume = (volume: number) => {
const value = Math.min(1, Math.max(0, volume));
const video = usePlaybackStore.getState();
if (video.playbackStream && video.metadata.item?.Id) {
video.setVolume(value);
}
if (useAudioPlayback.getState().display) {
setAudioVolume(value);
}
};
export const setLocalMuted = (muted: boolean) => {
const video = usePlaybackStore.getState();
if (video.playbackStream && video.metadata.item?.Id) {
if (video.playerState.isPlayerMuted !== muted) {
video.toggleIsPlayerMuted();
}
}
if (useAudioPlayback.getState().display) {
setIsMuted(muted);
}
};
export const stopLocalPlayback = () => {
pauseLocalPlayback();
if (useAudioPlayback.getState().display) {
stopPlayback();
}
};
+146
View File
@@ -0,0 +1,146 @@
import type { Api } from "@jellyfin/sdk";
import {
type BaseItemDto,
BaseItemKind,
ItemFields,
} from "@jellyfin/sdk/lib/generated-client";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { getPlaybackInfo } from "@/utils/methods/playback";
import { generateAudioStreamUrl, playAudio } from "@/utils/store/audioPlayback";
import { initializePlayback } from "@/utils/store/playback";
import { setQueue } from "@/utils/store/queue";
const PLAYBACK_FIELDS = [
ItemFields.MediaSources,
ItemFields.MediaStreams,
ItemFields.Chapters,
ItemFields.Trickplay,
ItemFields.Overview,
];
export type StartedPlayback = {
kind: "audio" | "video" | "none";
itemId?: string;
queueLength: number;
};
type StartPlaybackOptions = {
startIndex?: number;
startPositionTicks?: number;
audioStreamIndex?: number;
subtitleStreamIndex?: number;
};
/**
* Start playback for a list of item ids (a SyncPlay queue, a remote Play
* command or a deep link). Returns the kind of playback that started; the
* caller owns navigation so this can be used outside React.
*/
export const startPlaybackFromIds = async (
api: Api,
userId: string,
itemIds: string[],
options: StartPlaybackOptions = {},
): Promise<StartedPlayback> => {
const ids = itemIds.filter((id): id is string => Boolean(id));
if (!api || !userId || ids.length === 0) {
return { kind: "none", queueLength: 0 };
}
const response = await getLibraryApi(api).getItems({
userId,
ids,
fields: PLAYBACK_FIELDS,
enableUserData: true,
});
const byId = new Map(
(response.data.Items ?? [])
.filter((item): item is BaseItemDto & { Id: string } => Boolean(item.Id))
.map((item) => [item.Id, item]),
);
const items = ids
.map((id) => byId.get(id))
.filter((item): item is BaseItemDto & { Id: string } => Boolean(item));
if (items.length === 0) {
return { kind: "none", queueLength: 0 };
}
const startIndex = Math.min(
Math.max(0, options.startIndex ?? 0),
items.length - 1,
);
const item = items[startIndex];
const startPositionTicks = Math.max(0, options.startPositionTicks ?? 0);
if (
item.Type === BaseItemKind.Audio ||
item.Type === BaseItemKind.AudioBook
) {
const url = generateAudioStreamUrl(
item.Id,
userId,
api.deviceInfo.id,
api.basePath,
api.accessToken,
);
playAudio(url, item, undefined, startPositionTicks);
setQueue(items, startIndex);
return { kind: "audio", itemId: item.Id, queueLength: items.length };
}
if (item.Type === BaseItemKind.Photo) {
return { kind: "none", queueLength: 0 };
}
const playback = await getPlaybackInfo(api, userId, item, {
startPositionTicks,
currentAudioTrack: options.audioStreamIndex ?? "auto",
currentSubTrack: options.subtitleStreamIndex,
});
if (!playback.mediaSource?.MediaSources?.[0]?.Id) {
throw new Error("No playable media source found");
}
const playbackItems: BaseItemDto[] = playback.item?.Items ?? [];
let queueItems: BaseItemDto[] =
items.length > 1 ? items : playbackItems.length > 0 ? playbackItems : items;
let queueIndex = queueItems.findIndex((entry) => entry.Id === item.Id);
if (queueIndex < 0) {
queueItems = items;
queueIndex = startIndex;
}
let playbackItem = queueItems[queueIndex];
if (item.Type === BaseItemKind.Series) {
playbackItem =
playbackItems[playback.episodeIndex ?? 0] ?? playbackItems[0] ?? item;
queueItems = playbackItems;
queueIndex = Math.max(
0,
queueItems.findIndex((entry) => entry.Id === playbackItem.Id),
);
}
if (!playbackItem) {
playbackItem = item;
}
await initializePlayback({
api,
userId,
item: playbackItem,
mediaSource: playback.mediaSource,
mediaSegments: playback.mediaSegments,
queueItems,
queueIndex,
startPositionTicks,
audioStreamIndex: options.audioStreamIndex,
subtitleStreamIndex: options.subtitleStreamIndex,
});
return {
kind: "video",
itemId: playbackItem.Id,
queueLength: queueItems.length,
};
};
+482
View File
@@ -0,0 +1,482 @@
import type { Api } from "@jellyfin/sdk";
import {
type GroupUpdate,
type PlayQueueUpdate,
type SendCommand,
SendCommandType,
} from "@jellyfin/sdk/lib/generated-client";
import { getSyncPlayApi } from "@jellyfin/sdk/lib/utils/api/sync-play-api";
import {
getLocalPlayback,
pauseLocalPlayback,
resumeLocalPlayback,
seekLocalPlayback,
} from "@/utils/methods/localPlayback";
import { startPlaybackFromIds } from "@/utils/methods/startPlayback";
import useQueue from "@/utils/store/queue";
import useSyncPlayStore from "@/utils/store/syncPlay";
const SEEK_REPORT_INTERVAL_MS = 300;
const PAUSE_REPORT_INTERVAL_MS = 400;
const AUTO_START_GUARD_MS = 5000;
const DRIFT_TOLERANCE_TICKS = 2 * 10_000_000;
let applyingRemoteUntil = 0;
let lastSeekReport = { at: 0, ticks: 0 };
let lastPauseReport = { at: 0, paused: false };
let lastAutoStart = { itemId: "", at: 0 };
const syncApi = (api: Api) => getSyncPlayApi(api);
const guardRemote = (ms = 1200) => {
applyingRemoteUntil = Date.now() + ms;
};
export const isApplyingSyncPlayRemote = () => Date.now() < applyingRemoteUntil;
export const inSyncPlayGroup = () => Boolean(useSyncPlayStore.getState().group);
const currentQueueItem = (queue: PlayQueueUpdate | null) => {
if (!queue?.Playlist?.length) return undefined;
return queue.Playlist[
Math.min(
Math.max(0, queue.PlayingItemIndex ?? 0),
queue.Playlist.length - 1,
)
];
};
export const refreshSyncPlayGroups = async (api: Api) => {
const store = useSyncPlayStore.getState();
try {
const groups = (await syncApi(api).syncPlayGetGroups()).data ?? [];
store.setGroups(groups);
} catch (error) {
console.warn("Could not load SyncPlay groups", error);
}
};
export const refreshSyncPlayGroup = async (api: Api) => {
const group = useSyncPlayStore.getState().group;
if (!group?.GroupId) return;
try {
const fresh = (await syncApi(api).syncPlayGetGroup({ id: group.GroupId }))
.data;
if (fresh) useSyncPlayStore.getState().setGroup(fresh);
} catch (error) {
console.warn("Could not refresh SyncPlay group", error);
}
};
export const openSyncPlayDialog = () => {
useSyncPlayStore.getState().setOpen(true);
useSyncPlayStore.getState().setError(null);
};
export const closeSyncPlayDialog = () =>
useSyncPlayStore.getState().setOpen(false);
export const createSyncPlayGroup = async (api: Api, name: string) => {
const store = useSyncPlayStore.getState();
store.setLoading(true);
store.setError(null);
try {
const group = (
await syncApi(api).syncPlayCreateGroup({
newGroupRequestDto: { GroupName: name.trim() || "Watch together" },
})
).data;
if (group) {
store.setGroup(group);
store.setGroups([
...store.groups.filter((g) => g.GroupId !== group.GroupId),
group,
]);
await refreshSyncPlayGroups(api);
}
return group;
} catch (error) {
console.error("Could not create SyncPlay group", error);
store.setError("Could not create a group");
return undefined;
} finally {
store.setLoading(false);
}
};
export const joinSyncPlayGroup = async (api: Api, groupId: string) => {
const store = useSyncPlayStore.getState();
store.setLoading(true);
store.setError(null);
try {
await syncApi(api).syncPlayJoinGroup({
joinGroupRequestDto: { GroupId: groupId },
});
try {
const group = (await syncApi(api).syncPlayGetGroup({ id: groupId })).data;
if (group) store.setGroup(group);
} catch {
const known = store.groups.find((g) => g.GroupId === groupId);
if (known) store.setGroup(known);
}
await refreshSyncPlayGroups(api);
} catch (error) {
console.error("Could not join SyncPlay group", error);
store.setError("Could not join this group");
} finally {
store.setLoading(false);
}
};
export const leaveSyncPlayGroup = async (api: Api) => {
const store = useSyncPlayStore.getState();
store.setLoading(true);
try {
await syncApi(api).syncPlayLeaveGroup();
} catch (error) {
console.warn("Could not leave SyncPlay group", error);
} finally {
store.setLoading(false);
store.reset();
store.setOpen(false);
lastAutoStart = { itemId: "", at: 0 };
applyingRemoteUntil = 0;
}
};
export const startSyncPlayQueue = async (api: Api) => {
const store = useSyncPlayStore.getState();
const queue = useQueue.getState();
const ids = (queue.tracks ?? [])
.map((item) => item.Id)
.filter((id): id is string => Boolean(id));
if (ids.length === 0) {
store.setError("Start something first, then share the queue");
return;
}
const position = getLocalPlayback();
store.setLoading(true);
store.setError(null);
try {
await syncApi(api).syncPlaySetNewQueue({
playRequestDto: {
PlayingQueue: ids,
PlayingItemPosition: queue.currentItemIndex,
StartPositionTicks: position.positionTicks,
},
});
// A lone host should not be stuck on "waiting for everyone".
if ((store.group?.Participants?.length ?? 0) <= 1) {
window.setTimeout(() => {
void resumeSyncPlayGroup(api);
}, 900);
}
} catch (error) {
console.error("Could not start SyncPlay queue", error);
store.setError("Could not start the group queue");
} finally {
store.setLoading(false);
}
};
export const watchSyncPlayQueueHere = async (api: Api, userId: string) => {
const store = useSyncPlayStore.getState();
const queue = store.queue;
const index = queue?.PlayingItemIndex ?? 0;
const ids = (queue?.Playlist ?? [])
.map((item) => item.ItemId)
.filter((id): id is string => Boolean(id));
if (ids.length === 0 || !userId) return;
guardRemote(4000);
store.setLoading(true);
try {
const result = await startPlaybackFromIds(api, userId, ids, {
startIndex: index,
startPositionTicks: queue?.StartPositionTicks ?? 0,
});
if (result.kind !== "none") {
store.setPendingNavigation(result.kind);
if (queue && !queue.IsPlaying) pauseLocalPlayback();
if ((store.group?.Participants?.length ?? 0) <= 1) {
window.setTimeout(() => {
void resumeSyncPlayGroup(api);
}, 900);
}
}
} catch (error) {
console.error("Could not start the group queue here", error);
store.setError("Could not start playback");
} finally {
store.setLoading(false);
}
};
export const pauseSyncPlayGroup = async (api: Api) => {
try {
await syncApi(api).syncPlayPause();
} catch (error) {
console.warn("Could not pause SyncPlay group", error);
}
};
export const resumeSyncPlayGroup = async (api: Api) => {
try {
await syncApi(api).syncPlayUnpause();
} catch (error) {
console.warn("Could not resume SyncPlay group", error);
}
};
export const seekSyncPlayGroup = async (api: Api, positionTicks: number) => {
try {
await syncApi(api).syncPlaySeek({
seekRequestDto: { PositionTicks: Math.max(0, Math.round(positionTicks)) },
});
} catch (error) {
console.warn("Could not seek SyncPlay group", error);
}
};
export const nextSyncPlayItem = async (api: Api) => {
const item = currentQueueItem(useSyncPlayStore.getState().queue);
try {
await syncApi(api).syncPlayNextItem({
nextItemRequestDto: { PlaylistItemId: item?.PlaylistItemId },
});
} catch (error) {
console.warn("Could not advance SyncPlay group", error);
}
};
export const previousSyncPlayItem = async (api: Api) => {
const item = currentQueueItem(useSyncPlayStore.getState().queue);
try {
await syncApi(api).syncPlayPreviousItem({
previousItemRequestDto: { PlaylistItemId: item?.PlaylistItemId },
});
} catch (error) {
console.warn("Could not rewind SyncPlay group", error);
}
};
const applyQueueUpdate = async (
api: Api,
userId: string | undefined,
queue: PlayQueueUpdate,
) => {
const store = useSyncPlayStore.getState();
const item = currentQueueItem(queue);
if (!item?.ItemId) return;
const local = getLocalPlayback();
const position = queue.StartPositionTicks ?? 0;
if (local.kind !== "none" && local.itemId === item.ItemId) {
guardRemote();
if (queue.IsPlaying) resumeLocalPlayback();
else pauseLocalPlayback();
if (Math.abs(local.positionTicks - position) > DRIFT_TOLERANCE_TICKS) {
seekLocalPlayback(position);
}
// A new group queue starts in Waiting until every device reports that
// it is ready. The host already has the item loaded.
reportSyncPlayReady(api, local.positionTicks, queue.IsPlaying ?? false);
return;
}
if (!userId) return;
if (
lastAutoStart.itemId === item.ItemId &&
Date.now() - lastAutoStart.at < AUTO_START_GUARD_MS
) {
return;
}
lastAutoStart = { itemId: item.ItemId, at: Date.now() };
const ids = (queue.Playlist ?? [])
.map((entry) => entry.ItemId)
.filter((id): id is string => Boolean(id));
guardRemote(5000);
try {
const result = await startPlaybackFromIds(api, userId, ids, {
startIndex: Math.max(0, queue.PlayingItemIndex ?? 0),
startPositionTicks: position,
});
if (result.kind !== "none") {
store.setPendingNavigation(result.kind);
if (!queue.IsPlaying) pauseLocalPlayback();
}
} catch (error) {
console.error("Could not follow the SyncPlay queue", error);
}
};
export const handleSyncPlayGroupUpdate = async (
api: Api,
userId: string | undefined,
update: GroupUpdate,
) => {
const store = useSyncPlayStore.getState();
switch (update.Type) {
case "GroupJoined":
if (update.Data) store.setGroup(update.Data);
await refreshSyncPlayGroups(api);
break;
case "PlayQueue":
if (update.Data) {
store.setQueue(update.Data);
await applyQueueUpdate(api, userId, update.Data);
}
break;
case "StateUpdate": {
const group = store.group;
if (group && update.Data?.State) {
store.setGroup({ ...group, State: update.Data.State });
}
if (update.Data?.State === "Paused") {
guardRemote();
pauseLocalPlayback();
}
break;
}
case "UserJoined":
case "UserLeft":
await refreshSyncPlayGroup(api);
await refreshSyncPlayGroups(api);
break;
case "GroupLeft":
case "NotInGroup":
case "GroupDoesNotExist":
store.reset();
store.setOpen(false);
lastAutoStart = { itemId: "", at: 0 };
applyingRemoteUntil = 0;
break;
case "LibraryAccessDenied":
useSyncPlayStore.getState().setError("No access to this group's library");
break;
}
};
export const handleSyncPlayCommand = (command: SendCommand) => {
const group = useSyncPlayStore.getState().group;
if (!group) return;
const apply = () => {
guardRemote(1500);
switch (command.Command) {
case SendCommandType.Pause:
case SendCommandType.Stop:
pauseLocalPlayback();
break;
case SendCommandType.Unpause:
resumeLocalPlayback();
break;
case SendCommandType.Seek:
if (command.PositionTicks != null) {
seekLocalPlayback(command.PositionTicks);
}
break;
}
};
const when = command.When ? Date.parse(command.When) : Number.NaN;
const delay = Number.isFinite(when)
? Math.min(10_000, Math.max(0, when - Date.now()))
: 0;
if (delay > 0) setTimeout(apply, delay);
else apply();
};
export const reportSyncPlayPause = (api: Api | undefined) => {
if (!api || !inSyncPlayGroup() || isApplyingSyncPlayRemote()) return;
const now = Date.now();
if (
lastPauseReport.paused &&
now - lastPauseReport.at < PAUSE_REPORT_INTERVAL_MS
) {
return;
}
lastPauseReport = { at: now, paused: true };
pauseSyncPlayGroup(api);
};
export const reportSyncPlayResume = (api: Api | undefined) => {
if (!api || !inSyncPlayGroup() || isApplyingSyncPlayRemote()) return;
const now = Date.now();
if (
!lastPauseReport.paused &&
now - lastPauseReport.at < PAUSE_REPORT_INTERVAL_MS
) {
return;
}
lastPauseReport = { at: now, paused: false };
resumeSyncPlayGroup(api);
};
export const reportSyncPlaySeek = (
api: Api | undefined,
positionTicks: number,
) => {
if (!api || !inSyncPlayGroup() || isApplyingSyncPlayRemote()) return;
const now = Date.now();
if (
now - lastSeekReport.at < SEEK_REPORT_INTERVAL_MS ||
Math.abs(positionTicks - lastSeekReport.ticks) < 10_000_000
) {
return;
}
lastSeekReport = { at: now, ticks: positionTicks };
seekSyncPlayGroup(api, positionTicks);
};
export const reportSyncPlayReady = (
api: Api | undefined,
positionTicks: number,
isPlaying: boolean,
) => {
if (!api || !inSyncPlayGroup()) return;
const queue = useSyncPlayStore.getState().queue;
const item = currentQueueItem(queue);
if (!item?.PlaylistItemId) return;
syncApi(api)
.syncPlayReady({
readyRequestDto: {
When: new Date().toISOString(),
PositionTicks: Math.max(0, Math.round(positionTicks)),
IsPlaying: isPlaying,
PlaylistItemId: item.PlaylistItemId,
},
})
.then(() => {
window.setTimeout(() => {
void refreshSyncPlayGroup(api);
}, 800);
// A solo host can begin immediately; with more devices the server
// waits for everyone, then sends the unpause command.
const participants =
useSyncPlayStore.getState().group?.Participants?.length ?? 0;
if (participants <= 1) {
void resumeSyncPlayGroup(api);
}
})
.catch((error) => console.warn("SyncPlay ready failed", error));
};
export const reportSyncPlayBuffering = (
api: Api | undefined,
isBuffering: boolean,
positionTicks: number,
isPlaying: boolean,
) => {
if (!api || !inSyncPlayGroup()) return;
const queue = useSyncPlayStore.getState().queue;
const item = currentQueueItem(queue);
if (!item?.PlaylistItemId) return;
syncApi(api)
.syncPlayBuffering({
bufferRequestDto: {
When: new Date().toISOString(),
PositionTicks: Math.max(0, Math.round(positionTicks)),
IsPlaying: isBuffering ? false : isPlaying,
PlaylistItemId: item.PlaylistItemId,
},
})
.catch((error) => console.warn("SyncPlay buffering failed", error));
};
+1 -1
View File
@@ -47,7 +47,7 @@ export const persistQueryCache = (
client: QueryClient,
getOwner: () => string | undefined,
) => {
let timer: ReturnType<typeof setTimeout> | undefined;
let timer: number | undefined;
const save = () => {
const owner = getOwner();
+10
View File
@@ -21,3 +21,13 @@ export const getPlayerMuted = async (type: "audio" | "video") => {
const value = await PlayerStore.get<boolean>(`${type}.muted`);
return value ?? false;
};
export const setAutoSkipSegments = async (enabled: boolean) => {
await PlayerStore.set("video.autoSkipSegments", enabled);
await PlayerStore.save();
};
export const getAutoSkipSegments = async () => {
const value = await PlayerStore.get<boolean>("video.autoSkipSegments");
return value ?? false;
};
+21
View File
@@ -0,0 +1,21 @@
import { create } from "zustand";
type QuickConnectApprovalState = {
open: boolean;
code: string;
openQuickConnectApproval: (code?: string) => void;
closeQuickConnectApproval: () => void;
setCode: (code: string) => void;
};
export const useQuickConnectApprovalStore = create<QuickConnectApprovalState>(
(set) => ({
open: false,
code: "",
openQuickConnectApproval: (code = "") => set({ open: true, code }),
closeQuickConnectApproval: () => set({ open: false, code: "" }),
setCode: (code) => set({ code }),
}),
);
export default useQuickConnectApprovalStore;
+48
View File
@@ -0,0 +1,48 @@
import type {
GroupUpdate,
SendCommand,
SessionInfoDto,
} from "@jellyfin/sdk/lib/generated-client";
import { create } from "zustand";
type Timed<T> = {
value: T;
at: number;
};
type RealtimeState = {
/** Latest session snapshot pushed by the server. */
sessions: SessionInfoDto[];
connected: boolean;
lastMessageAt: number;
lastGroupUpdate: Timed<GroupUpdate> | null;
lastSyncCommand: Timed<SendCommand> | null;
setConnected: (connected: boolean) => void;
setSessions: (sessions: SessionInfoDto[]) => void;
markMessage: () => void;
setGroupUpdate: (update: GroupUpdate) => void;
setSyncCommand: (command: SendCommand) => void;
reset: () => void;
};
const initialState = {
sessions: [] as SessionInfoDto[],
connected: false,
lastMessageAt: 0,
lastGroupUpdate: null as Timed<GroupUpdate> | null,
lastSyncCommand: null as Timed<SendCommand> | null,
};
export const useRealtimeStore = create<RealtimeState>((set) => ({
...initialState,
setConnected: (connected) => set({ connected }),
setSessions: (sessions) => set({ sessions, lastMessageAt: Date.now() }),
markMessage: () => set({ lastMessageAt: Date.now() }),
setGroupUpdate: (value) =>
set({ lastGroupUpdate: { value, at: Date.now() } }),
setSyncCommand: (value) =>
set({ lastSyncCommand: { value, at: Date.now() } }),
reset: () => set(initialState),
}));
export default useRealtimeStore;
+19
View File
@@ -0,0 +1,19 @@
import { create } from "zustand";
type ShareState = {
open: boolean;
link: string;
title: string;
openShareDialog: (link: string, title?: string) => void;
closeShareDialog: () => void;
};
export const useShareStore = create<ShareState>((set) => ({
open: false,
link: "",
title: "",
openShareDialog: (link, title = "Share") => set({ open: true, link, title }),
closeShareDialog: () => set({ open: false, link: "", title: "" }),
}));
export default useShareStore;
+52
View File
@@ -0,0 +1,52 @@
import type {
GroupInfoDto,
PlayQueueUpdate,
} from "@jellyfin/sdk/lib/generated-client";
import { create } from "zustand";
type SyncPlayState = {
open: boolean;
group: GroupInfoDto | null;
groups: GroupInfoDto[];
queue: PlayQueueUpdate | null;
loading: boolean;
error: string | null;
/** Navigation requested by a remote group start. */
pendingNavigation: "video" | "audio" | null;
setOpen: (open: boolean) => void;
setGroup: (group: GroupInfoDto | null) => void;
setGroups: (groups: GroupInfoDto[]) => void;
setQueue: (queue: PlayQueueUpdate | null) => void;
setLoading: (loading: boolean) => void;
setError: (error: string | null) => void;
setPendingNavigation: (kind: "video" | "audio" | null) => void;
reset: () => void;
};
const initialState = {
open: false,
group: null as GroupInfoDto | null,
groups: [] as GroupInfoDto[],
queue: null as PlayQueueUpdate | null,
loading: false,
error: null as string | null,
pendingNavigation: null as "video" | "audio" | null,
};
export const useSyncPlayStore = create<SyncPlayState>((set) => ({
...initialState,
setOpen: (open) => set({ open }),
setGroup: (group) => set({ group }),
setGroups: (groups) => set({ groups }),
setQueue: (queue) => set({ queue }),
setLoading: (loading) => set({ loading }),
setError: (error) => set({ error }),
setPendingNavigation: (pendingNavigation) => set({ pendingNavigation }),
reset: () =>
set((state) => ({
...initialState,
open: state.open,
})),
}));
export default useSyncPlayStore;