Compare commits

...
Author SHA1 Message Date
Prayag Prajapati e81f4f6c56 Add remove server 2023-07-06 15:33:06 +05:30
Prayag Prajapati fea68f8cab Update packages 2023-07-06 15:19:40 +05:30
Prayag Prajapati ce4b635d78 Complete open sidemenu #11 2023-07-06 15:14:11 +05:30
Prayag Prajapati 83ebd5de7e Create a drawer component #11 2023-07-04 14:03:13 +05:30
dependabot[bot] 3f44e5fc96 chore(package-update) NPM: bump semver from 6.3.0 to 7.5.3 (#108)
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 7.5.3.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v7.5.3)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-29 12:02:54 +05:30
Prayag Prajapati 39ad113573 Merge branch 'main' of https://github.com/prayag17/JellyPlayer 2023-06-29 11:38:28 +05:30
Prayag Prajapati 9ff7482aea Fix dependabot security alert 2023-06-29 11:38:11 +05:30
dependabot[bot] 36e3d2a7cb chore(package-update) NPM: bump @tanstack/react-query-devtools (#107)
Bumps [@tanstack/react-query-devtools](https://github.com/tanstack/query) from 4.29.12 to 4.29.19.
- [Release notes](https://github.com/tanstack/query/releases)
- [Commits](https://github.com/tanstack/query/compare/v4.29.12...v4.29.19)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query-devtools"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-29 11:28:07 +05:30
dependabot[bot] 691d5e0157 chore(package-update) NPM: bump react-router-dom from 6.12.1 to 6.14.0 (#106)
Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.12.1 to 6.14.0.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/react-router-dom@6.14.0/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.14.0/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 17:27:01 +05:30
dependabot[bot] 94986db688 chore(package-update) NPM: bump @types/react-dom from 18.2.4 to 18.2.6 (#105)
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 18.2.4 to 18.2.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

---
updated-dependencies:
- dependency-name: "@types/react-dom"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 17:21:29 +05:30
dependabot[bot] 9bf0b25662 chore(package-update) NPM: bump @mui/lab (#101)
Bumps [@mui/lab](https://github.com/mui/material-ui/tree/HEAD/packages/mui-lab) from 5.0.0-alpha.133 to 5.0.0-alpha.134.
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/HEAD/packages/mui-lab)

---
updated-dependencies:
- dependency-name: "@mui/lab"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 17:06:48 +05:30
dependabot[bot] 42ca912ca7 chore(package-update) NPM: bump @tauri-apps/api from 1.3.0 to 1.4.0 (#99)
Bumps [@tauri-apps/api](https://github.com/tauri-apps/tauri) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/tauri-apps/tauri/releases)
- [Commits](https://github.com/tauri-apps/tauri/compare/api-v1.3...@tauri-apps/api-v1.4)

---
updated-dependencies:
- dependency-name: "@tauri-apps/api"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 17:06:39 +05:30
Prayag Prajapati 6ac3383f6e disable play button on series 2023-06-25 00:09:34 +05:30
Prayag Prajapati 922d956565 Display Series info in player #10 2023-06-24 23:59:06 +05:30
dependabot[bot] ca527548d1 chore(package-update) NPM: bump @emotion/react from 11.11.0 to 11.11.1 (#95)
Bumps [@emotion/react](https://github.com/emotion-js/emotion) from 11.11.0 to 11.11.1.
- [Release notes](https://github.com/emotion-js/emotion/releases)
- [Changelog](https://github.com/emotion-js/emotion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emotion-js/emotion/compare/@emotion/react@11.11.0...@emotion/react@11.11.1)

---
updated-dependencies:
- dependency-name: "@emotion/react"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:52:09 +05:30
dependabot[bot] e16a6c2415 chore(package-update) NPM: bump @types/react from 18.2.8 to 18.2.11 (#94)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.2.8 to 18.2.11.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:51:55 +05:30
dependabot[bot] c60b1e416e chore(package-update) NPM: bump react-router-dom from 6.11.2 to 6.12.1 (#96)
Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.11.2 to 6.12.1.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.12.1/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:47:30 +05:30
dependabot[bot] df7994b4b2 chore(package-update) NPM: bump sass from 1.62.1 to 1.63.3 (#98)
Bumps [sass](https://github.com/sass/dart-sass) from 1.62.1 to 1.63.3.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.62.1...1.63.3)

---
updated-dependencies:
- dependency-name: sass
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:47:02 +05:30
dependabot[bot] 03e72d81da chore(package-update) NPM: bump @fontsource/open-sans (#97)
Bumps [@fontsource/open-sans](https://github.com/fontsource/font-files/tree/HEAD/fonts/google/open-sans) from 5.0.2 to 5.0.3.
- [Changelog](https://github.com/fontsource/font-files/blob/main/fonts/google/open-sans/CHANGELOG.md)
- [Commits](https://github.com/fontsource/font-files/commits/HEAD/fonts/google/open-sans)

---
updated-dependencies:
- dependency-name: "@fontsource/open-sans"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:46:45 +05:30
Prayag Prajapati c8a7f8a632 Choose subtitle track from title page 2023-06-10 17:49:48 +05:30
Prayag Prajapati d9644f325c Revert "Merge branch 'main' of https://github.com/prayag17/JellyPlayer"
This reverts commit 38dde2a63d, reversing
changes made to 8aef2fc22d.
2023-06-10 11:25:29 +05:30
prayag17 38dde2a63d Merge branch 'main' of https://github.com/prayag17/JellyPlayer 2023-06-10 11:23:07 +05:30
prayag17anddependabot[bot] 8aef2fc22d Revert UI changes in @e4ade56
Update deps (npm)

chore(package-update) NPM: bump @fontsource/open-sans (#92)

Bumps [@fontsource/open-sans](https://github.com/fontsource/font-files/tree/HEAD/fonts/google/open-sans) from 4.5.14 to 5.0.2.
- [Changelog](https://github.com/fontsource/font-files/blob/main/fonts/google/open-sans/CHANGELOG.md)
- [Commits](https://github.com/fontsource/font-files/commits/HEAD/fonts/google/open-sans)

---
updated-dependencies:
- dependency-name: "@fontsource/open-sans"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-10 11:22:44 +05:30
prayag17 458890ba35 Merge branch 'main' of https://github.com/prayag17/JellyPlayer 2023-06-10 11:17:44 +05:30
prayag17 8d9d38fa39 Revert UI changes in @e4ade56 2023-06-10 11:17:38 +05:30
dependabot[bot] 957f9b53bb chore(package-update) NPM: bump @fontsource/open-sans (#92)
Bumps [@fontsource/open-sans](https://github.com/fontsource/font-files/tree/HEAD/fonts/google/open-sans) from 4.5.14 to 5.0.2.
- [Changelog](https://github.com/fontsource/font-files/blob/main/fonts/google/open-sans/CHANGELOG.md)
- [Commits](https://github.com/fontsource/font-files/commits/HEAD/fonts/google/open-sans)

---
updated-dependencies:
- dependency-name: "@fontsource/open-sans"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-06 14:30:33 +05:30
prayag17 02d412a9b6 Update deps (npm) 2023-06-06 14:14:29 +05:30
prayag17 e4ade5659c Update ItemPage ui and more... 2023-06-06 14:04:23 +05:30
prayag17 19ff2af29b More updates to player and fixed some ui stuff 2023-05-26 15:16:30 +05:30
prayag17 3c058928cb Show endsAt and fix mouseOver in player #10 2023-05-16 12:45:51 +05:30
prayag17 25ac859efd Allow changing volume #10 2023-05-15 14:04:35 +05:30
dependabot[bot] 5b2968b5bf chore(package-update) NPM: bump @mui/material from 5.12.3 to 5.13.0 (#81)
Bumps [@mui/material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material) from 5.12.3 to 5.13.0.
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.13.0/packages/mui-material)

---
updated-dependencies:
- dependency-name: "@mui/material"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 09:58:48 +05:30
dependabot[bot] 6cccd12a41 chore(package-update) NPM: bump framer-motion from 10.12.8 to 10.12.10 (#80)
Bumps [framer-motion](https://github.com/framer/motion) from 10.12.8 to 10.12.10.
- [Changelog](https://github.com/framer/motion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/framer/motion/compare/v10.12.8...v10.12.10)

---
updated-dependencies:
- dependency-name: framer-motion
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 09:58:40 +05:30
dependabot[bot] 3ea75c8308 chore(package-update) NPM: bump @tauri-apps/cli from 1.3.0 to 1.3.1 (#79)
Bumps [@tauri-apps/cli](https://github.com/tauri-apps/tauri) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/tauri-apps/tauri/releases)
- [Commits](https://github.com/tauri-apps/tauri/compare/api-v1.3...cli.js-v1.3.1)

---
updated-dependencies:
- dependency-name: "@tauri-apps/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 09:58:33 +05:30
dependabot[bot] 2ce1cd688d chore(package-update) NPM: bump @tanstack/react-query-devtools (#78)
Bumps [@tanstack/react-query-devtools](https://github.com/tanstack/query) from 4.29.6 to 4.29.7.
- [Release notes](https://github.com/tanstack/query/releases)
- [Commits](https://github.com/tanstack/query/compare/v4.29.6...v4.29.7)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query-devtools"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 09:58:24 +05:30
prayag17 756d8d7f4b Allow fullscreen and display time 2023-05-14 18:45:16 +05:30
prayag17 3738d81fab Fix server validation on app startup #74 2023-05-14 17:31:59 +05:30
prayag17 9f4c2f990a Fix Add Server menu does not recognize servers not using HTTPS or using the :8096 port. #74 2023-05-13 22:18:42 +05:30
prayag17 027cf93492 Add slider to videoPlayer #10 2023-05-11 18:56:04 +05:30
prayag17 092a1c74ab Fix Add Server menu does not recognize servers not using HTTPS or using the :8096 port. Fix #74 2023-05-11 14:47:22 +05:30
prayag17 fb7c86631d Fix Login page does not show each accounts profile picture, showing placeholder instead. Fix #75 2023-05-11 13:00:13 +05:30
41 changed files with 1933 additions and 1315 deletions

No files matched your search

+471 -758
View File
File diff suppressed because it is too large. Load diff
+13 -14
View File
@@ -10,20 +10,20 @@
"tauri": "tauri" "tauri": "tauri"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.10.5", "@emotion/react": "^11.11.1",
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@fontsource/open-sans": "^4.5.13", "@fontsource/open-sans": "^5.0.3",
"@jellyfin/sdk": "^0.8.2", "@jellyfin/sdk": "^0.8.2",
"@mdi/js": "^7.2.96", "@mdi/js": "^7.2.96",
"@mui/lab": "^5.0.0-alpha.128", "@mui/lab": "^5.0.0-alpha.134",
"@mui/material": "^5.11.16", "@mui/material": "^5.13.0",
"@tanstack/react-query": "^4.26.1", "@tanstack/react-query": "^4.26.1",
"@tanstack/react-query-devtools": "^4.29.3", "@tanstack/react-query-devtools": "^4.29.19",
"@tauri-apps/api": "^1.2.0", "@tauri-apps/api": "^1.4.0",
"@videojs/http-streaming": "^3.0.2", "axios": "^1.4.0",
"blurhash": "^2.0.5", "blurhash": "^2.0.5",
"events": "^3.3.0", "events": "^3.3.0",
"framer-motion": "^10.12.4", "framer-motion": "^10.12.10",
"notistack": "^3.0.1", "notistack": "^3.0.1",
"react": "^18.2.0", "react": "^18.2.0",
"react-blurhash": "^0.3.0", "react-blurhash": "^0.3.0",
@@ -32,19 +32,18 @@
"react-material-ui-carousel": "^3.4.2", "react-material-ui-carousel": "^3.4.2",
"react-multi-carousel": "^2.8.3", "react-multi-carousel": "^2.8.3",
"react-player": "^2.12.0", "react-player": "^2.12.0",
"react-router-dom": "^6.11.0", "react-router-dom": "^6.14.0",
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store", "tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
"uuid": "^9.0.0", "uuid": "^9.0.0",
"vite-plugin-svgr": "^3.2.0", "vite-plugin-svgr": "^3.2.0",
"zustand": "^4.3.8" "zustand": "^4.3.8"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^1.2.2", "@tauri-apps/cli": "^1.3.1",
"@types/react": "^18.2.0", "@types/react": "^18.2.11",
"@types/react-dom": "^18.2.1", "@types/react-dom": "^18.2.6",
"@vitejs/plugin-react": "^4.0.0", "@vitejs/plugin-react": "^4.0.0",
"sass": "^1.62.1", "sass": "^1.63.3",
"video.js": "^8.3.0",
"vite": "^4.3.1" "vite": "^4.3.1"
}, },
"license": "GPL-3.0-only" "license": "GPL-3.0-only"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 KiB

After

Width:  |  Height:  |  Size: 632 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

-5
View File
@@ -90,11 +90,6 @@
transform: scaleX(1) translateX(100%); transform: scaleX(1) translateX(100%);
transform-origin: left; transform-origin: left;
} }
/* 100% {
transform: scaleX(0) translateX(-100%);
transform-origin: left;
} */
} }
</style> </style>
</body> </body>
+3 -1
View File
@@ -17,8 +17,10 @@ tauri-build = { version = "1.2.1", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2.2", features = ["process-exit", "process-relaunch", "shell-all", "window-set-fullscreen"] } tauri = { version = "1.2.2", features = ["devtools", "http-all", "process-exit", "process-relaunch", "shell-all", "window-set-fullscreen"] }
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
portpicker = "0.1" # used in the example to pick a random free port
[features] [features]
# by default Tauri runs in production mode # by default Tauri runs in production mode
+34 -2
View File
@@ -2,6 +2,8 @@
use tauri::Manager; use tauri::Manager;
use tauri::{utils::config::AppUrl, WindowUrl};
// Create the command: // Create the command:
// This command must be async so that it doesn't run on the main thread. // This command must be async so that it doesn't run on the main thread.
#[tauri::command] #[tauri::command]
@@ -14,10 +16,40 @@ async fn close_splashscreen(window: tauri::Window) {
window.get_window("main").unwrap().show().unwrap(); window.get_window("main").unwrap().show().unwrap();
} }
// Tauri by default uses HTTPS, so use the localhost plugin to downgrade back to
// HTTP. However, when running tauri dev, we already have a localhost server
// provided by vite, so don't enable it
#[cfg(debug_assertions)]
const USE_LOCALHOST_SERVER: bool = false;
#[cfg(not(debug_assertions))]
const USE_LOCALHOST_SERVER: bool = true;
fn main() { fn main() {
tauri::Builder::default() let port = portpicker::pick_unused_port().expect("failed to find unused port");
let window_url = if USE_LOCALHOST_SERVER {
WindowUrl::External(format!("http://localhost:{}", port).parse().unwrap())
} else {
WindowUrl::App("index.html".into())
};
let mut context = tauri::generate_context!();
let mut builder = tauri::Builder::default();
if USE_LOCALHOST_SERVER {
// rewrite the config so the IPC is enabled on this URL
context.config_mut().build.dist_dir = AppUrl::Url(window_url.clone());
context.config_mut().build.dev_path = AppUrl::Url(window_url.clone());
builder = builder.plugin(tauri_plugin_localhost::Builder::new(port).build());
}
builder
.invoke_handler(tauri::generate_handler![close_splashscreen]) .invoke_handler(tauri::generate_handler![close_splashscreen])
.plugin(tauri_plugin_store::Builder::default().build()) .plugin(tauri_plugin_store::Builder::default().build())
.run(tauri::generate_context!()) .run(context)
.expect("error while running tauri application"); .expect("error while running tauri application");
// tauri::Builder::default()
// .run(tauri::generate_context!())
// .expect("error while running tauri application");
} }
+3 -1
View File
@@ -12,7 +12,6 @@
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {
"all": false,
"process": { "process": {
"all": false, "all": false,
"exit": true, "exit": true,
@@ -24,6 +23,9 @@
}, },
"shell": { "shell": {
"all": true "all": true
},
"http": {
"all": true
} }
}, },
"bundle": { "bundle": {
-41
View File
@@ -1,41 +0,0 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}
+36 -48
View File
@@ -1,13 +1,15 @@
/** @format */ /** @format */
import React, { useState } from "react"; import React, { useState, useEffect } from "react";
import { appWindow } from "@tauri-apps/api/window";
import Konami from "react-konami-code"; import Konami from "react-konami-code";
// @ts-ignore // @ts-ignore
const Kon = Konami.default ? Konami.default : Konami; const Kon = Konami.default ? Konami.default : Konami;
import { ThemeProvider } from "@mui/material/styles"; import { ThemeProvider } from "@mui/material/styles";
import { SnackbarProvider } from "notistack"; import { SnackbarProvider, useSnackbar } from "notistack";
import { import {
Routes, Routes,
Route, Route,
@@ -59,12 +61,18 @@ import { AppBar } from "./components/appBar/appBar.jsx";
import "@fontsource/open-sans"; import "@fontsource/open-sans";
// Jellyfin SDK TypeScript // Jellyfin SDK TypeScript
import { Jellyfin } from "@jellyfin/sdk"; import {
Jellyfin,
VersionOutdatedIssue,
VersionUnsupportedIssue,
} from "@jellyfin/sdk";
import { version as appVer } from "../package.json"; import { version as appVer } from "../package.json";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { delServer, getServer } from "./utils/storage/servers.js"; import { delServer, getServer } from "./utils/storage/servers.js";
import { delUser, getUser } from "./utils/storage/user.js"; import { delUser, getUser } from "./utils/storage/user.js";
import axios from "axios";
const jellyfin = new Jellyfin({ const jellyfin = new Jellyfin({
clientInfo: { clientInfo: {
name: "JellyPlayer", name: "JellyPlayer",
@@ -123,7 +131,8 @@ function App() {
const navigate = useNavigate(); const navigate = useNavigate();
const [serverReachable, setServerReachable] = useState(true); const [serverReachable, setServerReachable] = useState(true);
const [checkingServer, setChecking] = useState(false);
const { enqueueSnackbar } = useSnackbar();
const createApi = async () => { const createApi = async () => {
const server = await getServer(); const server = await getServer();
@@ -158,33 +167,25 @@ function App() {
} }
}; };
const pingServer = () => { const pingServer = async () => {
setChecking(true); const server = await getServer();
let data; try {
fetch(`${window.api.basePath}/System/Ping`, { const result = await axios.get(
body: JSON.stringify(data), new URL(`${server.Ip}/System/Ping`).href,
}) );
.then((res) => res.json()) if (result.data == "Jellyfin Server") {
.then((data) => { event.emit("create-jellyfin-api", server.Ip);
if (data == "Jellyfin Server") { setServerReachable(true);
setServerReachable(true); } else {
setChecking(false);
} else {
enqueueSnackbar(
"The server address does not seem be a jellyfin server",
{ variant: "error" },
);
setServerReachable(false);
setChecking(false);
}
})
.catch((error) => {
enqueueSnackbar("Unable to reach server", {
variant: "error",
});
setServerReachable(false); setServerReachable(false);
setChecking(false); }
} catch (error) {
setServerReachable(false);
enqueueSnackbar("Unable to verfiy server address.", {
variant: "error",
}); });
console.error(error);
}
}; };
const userLogin = async () => { const userLogin = async () => {
@@ -227,7 +228,6 @@ function App() {
}); });
} else { } else {
navigate("/setup/server"); navigate("/setup/server");
setChecking(false);
} }
}); });
}; };
@@ -246,13 +246,13 @@ function App() {
if (reason && reason == "backdropClick") { if (reason && reason == "backdropClick") {
return; return;
} }
let result = await relaunch(); await relaunch();
}; };
const handleRemoveServer = async () => { const handleRemoveServer = async () => {
await delServer(); await delServer();
await delUser(); await delUser();
let result = await relaunch(); await relaunch();
}; };
const location = useLocation(); const location = useLocation();
@@ -274,23 +274,13 @@ function App() {
setEasterEgg(true); setEasterEgg(true);
}; };
useEffect(() => {
appWindow.setFullscreen(false);
}, [location]);
return ( return (
<SnackbarProvider maxSnack={5}> <SnackbarProvider maxSnack={5}>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
{checkingServer && (
<Box
sx={{
display: "flex",
width: "100%",
height: "100vh",
justifyContent: "center",
alignItems: "center",
}}
>
<CircularProgress />
</Box>
)}
<Kon resetDelay={1000} action={sixtyNine}></Kon> <Kon resetDelay={1000} action={sixtyNine}></Kon>
<Dialog <Dialog
open={easterEgg} open={easterEgg}
@@ -309,7 +299,6 @@ function App() {
<Dialog <Dialog
open={!serverReachable} open={!serverReachable}
onClose={handleRelaunch} onClose={handleRelaunch}
disableBa
aria-labelledby="alert-dialog-text" aria-labelledby="alert-dialog-text"
aria-describedby="alert-dialog-desc" aria-describedby="alert-dialog-desc"
maxWidth="md" maxWidth="md"
@@ -408,7 +397,6 @@ function App() {
</Routes> </Routes>
</div> </div>
</AnimatePresence> </AnimatePresence>
<ReactQueryDevtools />
</ThemeProvider> </ThemeProvider>
</SnackbarProvider> </SnackbarProvider>
); );
+40 -2
View File
@@ -1,6 +1,8 @@
/** @format */ /** @format */
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { relaunch } from "@tauri-apps/api/process";
import MuiAppBar from "@mui/material/AppBar"; import MuiAppBar from "@mui/material/AppBar";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
@@ -26,6 +28,11 @@ import { MdiHeartOutline } from "../icons/mdiHeartOutline";
import { MdiArrowLeft } from "../icons/mdiArrowLeft"; import { MdiArrowLeft } from "../icons/mdiArrowLeft";
import { MdiCog } from "../icons/mdiCog"; import { MdiCog } from "../icons/mdiCog";
import { MdiInformation } from "../icons/mdiInformation"; import { MdiInformation } from "../icons/mdiInformation";
import { MdiMenu } from "../icons/mdiMenu";
import { useDrawerStore } from "../../utils/store/drawer";
import { delServer } from "../../utils/storage/servers";
import { delUser } from "../../utils/storage/user";
import { MdiDelete } from "../icons/mdiDelete";
export const AppBar = () => { export const AppBar = () => {
const navigate = useNavigate(); const navigate = useNavigate();
@@ -59,6 +66,12 @@ export const AppBar = () => {
setAnchorEl(null); setAnchorEl(null);
}; };
const [setDrawerOpen] = useDrawerStore((state) => [state.setOpen]);
const handleDrawerOpen = () => {
setDrawerOpen(true);
};
useEffect(() => { useEffect(() => {
if ( if (
location.pathname.includes("login") || location.pathname.includes("login") ||
@@ -87,13 +100,18 @@ export const AppBar = () => {
return ( return (
<MuiAppBar <MuiAppBar
sx={{ sx={{
width: `calc(100vw - ${theme.spacing(7)})`,
backgroundColor: "transparent", backgroundColor: "transparent",
paddingRight: "0 !important",
}} }}
className={trigger ? "appBar backdropVisible" : "appBar"} className={trigger ? "appBar backdropVisible" : "appBar"}
elevation={0} elevation={0}
> >
<Toolbar sx={{ justifyContent: "space-between" }}> <Toolbar
sx={{
justifyContent: "space-between",
paddingLeft: "12px !important",
}}
>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@@ -101,6 +119,13 @@ export const AppBar = () => {
alignItems: "center", alignItems: "center",
}} }}
> >
<IconButton
color="inherit"
aria-label="open drawer"
onClick={handleDrawerOpen}
>
<MdiMenu />
</IconButton>
<IconButton <IconButton
onClick={() => navigate(-1)} onClick={() => navigate(-1)}
sx={{ sx={{
@@ -109,6 +134,7 @@ export const AppBar = () => {
? "scale(1)" ? "scale(1)"
: "scale(0)", : "scale(0)",
transformOrigin: "left", transformOrigin: "left",
ml: 2,
}} }}
> >
<MdiArrowLeft /> <MdiArrowLeft />
@@ -175,6 +201,18 @@ export const AppBar = () => {
</ListItemIcon> </ListItemIcon>
About About
</MenuItem> </MenuItem>
<MenuItem
onClick={async () => {
await delServer();
await delUser();
await relaunch();
}}
>
<ListItemIcon>
<MdiDelete />
</ListItemIcon>
Remove Server
</MenuItem>
</Menu> </Menu>
</Box> </Box>
</Toolbar> </Toolbar>
+11 -13
View File
@@ -10,19 +10,17 @@ import "./avatar.module.scss";
export const AvatarImage = ({ userId, userImageTags }) => { export const AvatarImage = ({ userId, userImageTags }) => {
return ( return (
<Box className="avatar-image-container"> <Box className="avatar-image-container">
{!!userImageTags && ( <div
<div className="avatar-image"
className="avatar-image" style={{
style={{ backgroundImage:
backgroundImage: "url('" +
"url('" + window.api.basePath +
window.api.basePath + "/Users/" +
"/Users/" + userId +
userId + "/Images/Primary')",
"/Images/Primary')", }}
}} ></div>
></div>
)}
<div className="avatar-image-icon-container"> <div className="avatar-image-icon-container">
<MdiAccount className="avatar-image-icon" /> <MdiAccount className="avatar-image-icon" />
+71 -52
View File
@@ -48,6 +48,7 @@ export const Card = ({
blurhash, blurhash,
currentUser, currentUser,
favourite, favourite,
disableOverlay,
}) => { }) => {
const navigate = useNavigate(); const navigate = useNavigate();
const [imgLoading, setImgLoading] = useState(true); const [imgLoading, setImgLoading] = useState(true);
@@ -175,6 +176,7 @@ export const Card = ({
<div <div
className="card-media-image-container" className="card-media-image-container"
style={{ opacity: imgLoading ? 0 : 1 }} style={{ opacity: imgLoading ? 0 : 1 }}
// style={{ opacity: 1 }}
> >
{imageTags && {imageTags &&
(cardType == "thumb" ? ( (cardType == "thumb" ? (
@@ -210,10 +212,17 @@ export const Card = ({
<CardMedia <CardMedia
component="img" component="img"
image={ image={
window.api.basePath + iconType == "User"
"/Items/" + ? window.api
itemId + .basePath +
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96" "/Users/" +
itemId +
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
: window.api
.basePath +
"/Items/" +
itemId +
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
} }
alt={itemName} alt={itemName}
sx={{ sx={{
@@ -275,56 +284,66 @@ export const Card = ({
/> />
)} )}
</> </>
<Box {!disableOverlay && (
className="card-media-overlay" <Box
sx={{ className="card-media-overlay"
display: "flex", sx={{
alignItems: "flex-end", display: "flex",
justifyContent: "flex-end", alignItems: "flex-end",
p: 1, justifyContent: "flex-end",
}} p: 1,
> }}
<ButtonGroup> >
{availableMarkButtonTypes.includes( <ButtonGroup>
iconType, {availableMarkButtonTypes.includes(
) && ( iconType,
<IconButton ) && (
onClick={(e) => { <IconButton
e.preventDefault(); onClick={(e) => {
e.stopPropagation(); e.preventDefault();
handleMarkAsPlayOrUnMarkAsPlay(); e.stopPropagation();
}} handleMarkAsPlayOrUnMarkAsPlay();
onFocus={(e) => e.stopPropagation}
>
<MdiCheck
sx={{
color: isWatched
? green[400]
: "white",
}} }}
/> onFocus={(e) =>
</IconButton> e.stopPropagation
)} }
{allowedLikeButton.includes(iconType) && ( >
<IconButton <MdiCheck
onClick={(e) => { sx={{
e.preventDefault(); color: isWatched
e.stopPropagation(); ? green[400]
handleLiking(); : "white",
}} }}
onFocus={(e) => e.stopPropagation}
>
{isFavorite ? (
<MdiHeart
sx={{ color: pink[700] }}
/> />
) : ( </IconButton>
<MdiHeartOutline /> )}
)} {allowedLikeButton.includes(
</IconButton> iconType,
)} ) && (
</ButtonGroup> <IconButton
</Box> onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleLiking();
}}
onFocus={(e) =>
e.stopPropagation
}
>
{isFavorite ? (
<MdiHeart
sx={{
color: pink[700],
}}
/>
) : (
<MdiHeartOutline />
)}
</IconButton>
)}
</ButtonGroup>
</Box>
)}
</Box> </Box>
<CardContent <CardContent
+4 -4
View File
@@ -31,19 +31,19 @@ export const CardScroller = ({
slidesToSlide: displayCards + 1, slidesToSlide: displayCards + 1,
}, },
desktop: { desktop: {
breakpoint: { max: 3000, min: 1025 }, breakpoint: { max: 3000, min: 625 },
items: displayCards, items: displayCards,
slidesToSlide: displayCards, // optional, default to 1. slidesToSlide: displayCards, // optional, default to 1.
}, },
tablet: { tablet: {
breakpoint: { max: 1024, min: 464 }, breakpoint: { max: 624, min: 464 },
items: displayCards - 2, items: displayCards - 2,
slidesToSlide: displayCards - 2, // optional, default to 1. slidesToSlide: displayCards - 2, // optional, default to 1.
}, },
mobile: { mobile: {
breakpoint: { max: 464, min: 0 }, breakpoint: { max: 464, min: 0 },
items: displayCards - 3, items: displayCards - 5,
slidesToSlide: displayCards - 3, // optional, default to 1. slidesToSlide: displayCards - 5, // optional, default to 1.
}, },
}; };
+12
View File
@@ -0,0 +1,12 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiBackburger } from "@mdi/js";
export const MdiBackburger = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiBackburger}></path>
</SvgIcon>
);
};
+12
View File
@@ -0,0 +1,12 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiClose } from "@mdi/js";
export const MdiClose = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiClose}></path>
</SvgIcon>
);
};
+12
View File
@@ -0,0 +1,12 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiDelete } from "@mdi/js";
export const MdiDelete = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiDelete}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFullscreen } from "@mdi/js";
export const MdiFullscreen = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiFullscreen}></path>
</SvgIcon>
);
};
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFullscreenExit } from "@mdi/js";
export const MdiFullscreenExit = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiFullscreenExit}></path>
</SvgIcon>
);
};
@@ -0,0 +1,12 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiPictureInPictureBottomRight } from "@mdi/js";
export const MdiPictureInPictureBottomRight = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiPictureInPictureBottomRight}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiPlaySpeed } from "@mdi/js";
export const MdiPlaySpeed = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiPlaySpeed}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiVolumeHigh } from "@mdi/js";
export const MdiVolumeHigh = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiVolumeHigh}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiVolumeOff } from "@mdi/js";
export const MdiVolumeOff = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiVolumeOff}></path>
</SvgIcon>
);
};
@@ -19,8 +19,11 @@ import { Link } from "react-router-dom";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
import { MdiClockOutline } from "../../icons/mdiClockOutline"; import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
import { getRuntimeMusic } from "../../../utils/date/time"; import { getRuntimeMusic } from "../../../utils/date/time";
import { MdiClockOutline } from "../../icons/mdiClockOutline";
import { MdiHeart } from "../../icons/mdiHeart"; import { MdiHeart } from "../../icons/mdiHeart";
import { MdiHeartOutline } from "../../icons/mdiHeartOutline"; import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
import { MdiAlbum } from "../../icons/mdiAlbum"; import { MdiAlbum } from "../../icons/mdiAlbum";
@@ -44,12 +47,12 @@ export const ArtistAlbum = ({ user, album, boxProps }) => {
let result; let result;
if (track.UserData.IsFavorite) { if (track.UserData.IsFavorite) {
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({ result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
userId: user.data.Id, userId: user.Id,
itemId: track.Id, itemId: track.Id,
}); });
} else if (!track.UserData.IsFavorite) { } else if (!track.UserData.IsFavorite) {
result = await getUserLibraryApi(window.api).markFavoriteItem({ result = await getUserLibraryApi(window.api).markFavoriteItem({
userId: user.data.Id, userId: user.Id,
itemId: track.Id, itemId: track.Id,
}); });
} }
+320 -145
View File
@@ -20,8 +20,9 @@ import ListItemButton from "@mui/material/ListItemButton";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import Divider from "@mui/material/Divider"; import Divider from "@mui/material/Divider";
import MuiDrawer from "@mui/material/Drawer"; import MuiDrawer from "@mui/material/Drawer";
import ListItemText from "@mui/material/ListItemText";
import { MdiMenu } from "../icons/mdiMenu"; import { MdiClose } from "../icons/mdiClose";
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant"; import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx"; import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
@@ -31,6 +32,7 @@ import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
import { EventEmitter as event } from "../../eventEmitter.js"; import { EventEmitter as event } from "../../eventEmitter.js";
import "./sidemenu.module.scss"; import "./sidemenu.module.scss";
import { useDrawerStore } from "../../utils/store/drawer";
const drawerWidth = 320; const drawerWidth = 320;
@@ -78,7 +80,6 @@ export const SideMenu = ({}) => {
enabled: !!user.data, enabled: !!user.data,
networkMode: "always", networkMode: "always",
}); });
const handleDrawerOpen = () => {};
const handleLogout = async () => { const handleLogout = async () => {
console.log("Logging out user..."); console.log("Logging out user...");
@@ -102,177 +103,351 @@ export const SideMenu = ({}) => {
} }
}, [location]); }, [location]);
const [open, setDrawerOpen] = useDrawerStore((state) => [
state.open,
state.setOpen,
]);
if (!display) { if (!display) {
return <></>; return <></>;
} }
if (display) { if (display) {
return ( return (
<MiniDrawer <>
variant="permanent" <MiniDrawer
open={false} variant="permanent"
PaperProps={{ open={false}
sx: { PaperProps={{
backgroundColor: "inherit", sx: {
border: "none", backgroundColor: "inherit",
width: `calc(${theme.spacing(7)} + 10px)`, border: "none",
height: "100vh", width: `calc(${theme.spacing(7)} + 10px)`,
// display: visible ? "block" : "none", height: "100vh",
}, zIndex: "1",
}} // display: visible ? "block" : "none",
sx={{ },
width: `calc(${theme.spacing(7)} + 10px)`, }}
background: theme.palette.background.paper,
}}
>
<DrawerHeader
className="Mui-DrawerHeader"
sx={{ sx={{
justifyContent: "center", width: `calc(${theme.spacing(7)} + 10px)`,
background: theme.palette.background.paper,
}} }}
> >
{/* <div> <DrawerHeader
<Avatar src={""}/> className="Mui-DrawerHeader"
<Typography variant="h3"> sx={{
{user["Name"]} justifyContent: "center",
</Typography> }}
</div> */} ></DrawerHeader>
<IconButton <Divider />
color="inherit" {libraries.isLoading ? (
aria-label="open drawer" <>
onClick={handleDrawerOpen} <Skeleton
> height="100%"
<MdiMenu /> variant="rounded"
</IconButton> width="calc(100% - 10px )"
</DrawerHeader> sx={{ margin: "5px" }}
<Divider /> ></Skeleton>
{libraries.isLoading ? ( </>
<> ) : (
<Skeleton <>
height="100%" <List sx={{ border: "none" }}>
variant="rounded" {libraries.data.Items.map(
width="calc(100% - 10px )" (library, index) => {
sx={{ margin: "5px" }} return (
></Skeleton> <Tooltip
</> title={library.Name}
) : ( placement="right"
<> arrow
<List sx={{ border: "none" }}> followCursor
{libraries.data.Items.map( key={index}
(library, index) => {
return (
<Tooltip
title={library.Name}
placement="right"
arrow
followCursor
key={index}
>
<ListItem
className="sidemenu-item-container"
disablePadding
> >
<ListItemButton <ListItem
component={ className="sidemenu-item-container"
NavLink disablePadding
}
to={
"/library/" +
library.Id
}
className="sidemenu-item"
sx={{
minHeight: 48,
justifyContent:
"center",
px: 2.5,
}}
> >
<ListItemIcon <ListItemButton
component={
NavLink
}
to={
"/library/" +
library.Id
}
className="sidemenu-item"
sx={{ sx={{
minWidth: 0, minHeight: 48,
justifyContent: justifyContent:
"center", "center",
px: 2.5,
display: "flex",
flexDirection:
"column",
}} }}
> >
{ <ListItemIcon
MediaCollectionTypeIconCollection[ sx={{
library minWidth: 0,
.CollectionType justifyContent:
] "center",
} }}
</ListItemIcon> >
</ListItemButton> {
</ListItem> MediaCollectionTypeIconCollection[
</Tooltip> library
); .CollectionType
}, ]
)} }
</List> </ListItemIcon>
<List sx={{ marginTop: "auto" }}> </ListItemButton>
<Tooltip </ListItem>
title="Home" </Tooltip>
placement="right" );
followCursor },
arrow )}
> </List>
<ListItem <List sx={{ marginTop: "auto" }}>
className="sidemenu-item-container" <Divider />
disablePadding <Tooltip
title="Home"
placement="right"
followCursor
arrow
> >
<ListItemButton <ListItem
component={NavLink} className="sidemenu-item-container"
to="/home" disablePadding
className="sidemenu-item"
sx={{
minHeight: 48,
justifyContent: "center",
px: 2.5,
}}
> >
<ListItemIcon <ListItemButton
component={NavLink}
to="/home"
className="sidemenu-item"
sx={{ sx={{
minWidth: 0, minHeight: 48,
justifyContent: justifyContent:
"center", "center",
px: 2.5,
display: "flex",
flexDirection:
"column",
}} }}
> >
<MdiHomeVariantOutline /> <ListItemIcon
</ListItemIcon> sx={{
</ListItemButton> minWidth: 0,
</ListItem> justifyContent:
</Tooltip> "center",
<Tooltip }}
title="Logout" >
placement="right" <MdiHomeVariantOutline />
followCursor </ListItemIcon>
arrow </ListItemButton>
> </ListItem>
<ListItem disablePadding> </Tooltip>
<ListItemButton <Tooltip
sx={{ title="Logout"
minHeight: 48, placement="right"
justifyContent: "center", followCursor
px: 2.5, arrow
}} >
onClick={handleLogout} <ListItem disablePadding>
> <ListItemButton
<ListItemIcon
sx={{ sx={{
minWidth: 0, minHeight: 48,
justifyContent: justifyContent:
"center", "center",
px: 2.5,
}}
onClick={handleLogout}
>
<ListItemIcon
sx={{
minWidth: 0,
justifyContent:
"center",
}}
>
<MdiLogoutVariant></MdiLogoutVariant>
</ListItemIcon>
</ListItemButton>
</ListItem>
</Tooltip>
</List>
</>
)}
</MiniDrawer>
<MuiDrawer
open={open}
variant="persistent"
onClose={() => setDrawerOpen(false)}
elevation={0}
PaperProps={{
sx: {
background: "rgb(0 0 0 / 0.5)",
backdropFilter: "blur(10px)",
boxShadow: "0 0 15px rgb(0 0 0 / 0.2)",
width: 260,
},
}}
className="sidemenu-open"
>
<DrawerHeader
className="Mui-DrawerHeader"
sx={{
justifyContent: "flex-start",
}}
>
<IconButton onClick={() => setDrawerOpen(false)}>
<MdiClose />
</IconButton>
</DrawerHeader>
<Divider />
{libraries.isLoading ? (
<>
<Skeleton
height="100%"
variant="rounded"
width="calc(100% - 10px )"
sx={{ margin: "5px" }}
></Skeleton>
</>
) : (
<>
<List sx={{ border: "none" }}>
{libraries.data.Items.map(
(library, index) => {
return (
<Tooltip
title={library.Name}
placement="right"
arrow
followCursor
key={index}
>
<ListItem
className="sidemenu-item-container"
disablePadding
>
<ListItemButton
component={
NavLink
}
to={
"/library/" +
library.Id
}
className="sidemenu-item"
sx={{
minHeight: 48,
justifyContent:
"center",
px: 2.5,
}}
>
<ListItemIcon
sx={{
minWidth: 0,
justifyContent:
"center",
mr: 2,
}}
>
{
MediaCollectionTypeIconCollection[
library
.CollectionType
]
}
</ListItemIcon>
<ListItemText>
{
library.Name
}
</ListItemText>
</ListItemButton>
</ListItem>
</Tooltip>
);
},
)}
</List>
<List sx={{ marginTop: "auto" }}>
<Divider />
<Tooltip
title="Home"
placement="right"
followCursor
arrow
>
<ListItem
className="sidemenu-item-container"
disablePadding
>
<ListItemButton
component={NavLink}
to="/home"
className="sidemenu-item"
sx={{
minHeight: 48,
justifyContent:
"center",
px: 2.5,
}} }}
> >
<MdiLogoutVariant></MdiLogoutVariant> <ListItemIcon
</ListItemIcon> sx={{
</ListItemButton> minWidth: 0,
</ListItem> justifyContent:
</Tooltip> "center",
</List> mr: 2,
</> }}
)} >
</MiniDrawer> <MdiHomeVariantOutline />
</ListItemIcon>
<ListItemText>
Home
</ListItemText>
</ListItemButton>
</ListItem>
</Tooltip>
<Tooltip
title="Logout"
placement="right"
followCursor
arrow
>
<ListItem disablePadding>
<ListItemButton
sx={{
minHeight: 48,
justifyContent:
"center",
px: 2.5,
}}
onClick={handleLogout}
>
<ListItemIcon
sx={{
minWidth: 0,
justifyContent:
"center",
mr: 2,
}}
>
<MdiLogoutVariant></MdiLogoutVariant>
</ListItemIcon>
<ListItemText>
Logout
</ListItemText>
</ListItemButton>
</ListItem>
</Tooltip>
</List>
</>
)}
</MuiDrawer>
</>
); );
} }
}; };
+8
View File
@@ -26,4 +26,12 @@
transform: translateX(0); transform: translateX(0);
} }
} }
&-open {
.sidemenu-item::before {
width: 100%;
inset: 0;
border-radius: 0;
z-index: -1;
}
}
} }
@@ -9,7 +9,7 @@ export const EmptyNotice = () => {
<Box <Box
sx={{ sx={{
width: "100%", width: "100%",
height: "100%", height: "100vh",
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
@@ -9,7 +9,7 @@ export const ErrorNotice = () => {
<Box <Box
sx={{ sx={{
width: "100%", width: "100%",
height: "100%", height: "100vh",
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
+4
View File
@@ -23,6 +23,7 @@ import { MdiAccountMusic } from "../icons/mdiAccountMusic";
import { MdiDramaMasks } from "../icons/mdiDramaMasks"; import { MdiDramaMasks } from "../icons/mdiDramaMasks";
import { MdiMusic } from "../icons/mdiMusic"; import { MdiMusic } from "../icons/mdiMusic";
import { MdiAccountTie } from "../icons/mdiAccountTie"; import { MdiAccountTie } from "../icons/mdiAccountTie";
import { MdiAccount } from "../icons/mdiAccount";
export const MediaCollectionTypeIconCollection = { export const MediaCollectionTypeIconCollection = {
universal: <MdiMultimedia />, universal: <MdiMultimedia />,
@@ -60,6 +61,8 @@ export const MediaTypeIconCollection = {
Audio: <MdiMicrophone className="hero-carousel-background-icon" />, Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
Photo: <MdiImage className="hero-carousel-background-icon" />, Photo: <MdiImage className="hero-carousel-background-icon" />,
Book: <MdiBook className="hero-carousel-background-icon" />, Book: <MdiBook className="hero-carousel-background-icon" />,
MusicAlbum: <MdiAlbum className="hero-carousel-background-icon" />,
AudioBook: <MdiBookMusic className="hero-carousel-background-icon" />,
}; };
export const TypeIconCollectionCard = { export const TypeIconCollectionCard = {
@@ -97,6 +100,7 @@ export const TypeIconCollectionCard = {
Trailer: <MdiYoutube className="card-image-icon" />, Trailer: <MdiYoutube className="card-image-icon" />,
TvChannel: <MdiTelevisionClassic className="card-image-icon" />, TvChannel: <MdiTelevisionClassic className="card-image-icon" />,
TvProgram: <MdiTelevisionClassic className="card-image-icon" />, TvProgram: <MdiTelevisionClassic className="card-image-icon" />,
User: <MdiAccount className="card-image-icon" />,
UserRootFolder: <MdiFolderOutline className="card-image-icon" />, UserRootFolder: <MdiFolderOutline className="card-image-icon" />,
UserView: <MdiMultimedia className="card-image-icon" />, UserView: <MdiMultimedia className="card-image-icon" />,
Video: <MdiFilmstrip className="card-image-icon" />, Video: <MdiFilmstrip className="card-image-icon" />,
+8 -2
View File
@@ -11,11 +11,17 @@ import App from "./App";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
const queryClient = new QueryClient(); const queryClient = new QueryClient({
defaultOptions: {
queries: {
networkMode: "always",
},
},
});
ReactDOM.createRoot(document.getElementById("root")).render( ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode> <React.StrictMode>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient} option>
<Router> <Router>
<App /> <App />
</Router> </Router>
+1 -1
View File
@@ -84,7 +84,7 @@
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
margin-bottom: 0.5em; margin-bottom: 0.5em;
&-logo { &-logo {
max-width: 10em; max-width: 12em;
height: 2em; height: 2em;
object-fit: contain; object-fit: contain;
object-position: bottom; object-position: bottom;
+13 -11
View File
@@ -96,7 +96,13 @@ const Home = () => {
{ {
userId: user.data.Id, userId: user.data.Id,
fields: [ItemFields.Overview, ItemFields.ParentId], fields: [ItemFields.Overview, ItemFields.ParentId],
includeItemTypes: [
BaseItemKind.Series,
BaseItemKind.Movie,
BaseItemKind.AudioBook,
],
enableUserData: true, enableUserData: true,
limit: 16,
}, },
); );
return media.data; return media.data;
@@ -111,7 +117,7 @@ const Home = () => {
const resumeItems = await getItemsApi(window.api).getResumeItems( const resumeItems = await getItemsApi(window.api).getResumeItems(
{ {
userId: user.data.Id, userId: user.data.Id,
limit: 16, limit: 10,
mediaTypes: ["Video"], mediaTypes: ["Video"],
enableUserData: true, enableUserData: true,
}, },
@@ -128,7 +134,7 @@ const Home = () => {
const resumeItems = await getItemsApi(window.api).getResumeItems( const resumeItems = await getItemsApi(window.api).getResumeItems(
{ {
userId: user.data.Id, userId: user.data.Id,
limit: 16, limit: 10,
mediaTypes: ["Audio"], mediaTypes: ["Audio"],
enableUserData: true, enableUserData: true,
}, },
@@ -144,7 +150,7 @@ const Home = () => {
queryFn: async () => { queryFn: async () => {
const upNext = await getTvShowsApi(window.api).getNextUp({ const upNext = await getTvShowsApi(window.api).getNextUp({
userId: user.data.Id, userId: user.data.Id,
limit: 16, limit: 10,
}); });
return upNext.data; return upNext.data;
}, },
@@ -240,7 +246,7 @@ const Home = () => {
<CarouselSkeleton /> <CarouselSkeleton />
) : ( ) : (
// <></> // <></>
latestMedia.data != null && latestMedia.data.length != 0 &&
latestMedia.data.map((item, index) => { latestMedia.data.map((item, index) => {
return ( return (
<Paper <Paper
@@ -254,12 +260,8 @@ const Home = () => {
> >
<div className="hero-carousel-background-container"> <div className="hero-carousel-background-container">
{item.Type == {item.Type ==
BaseItemKind.MusicAlbum || BaseItemKind.MusicAlbum ? (
item.Type == !!item.ParentBackdropItemId && (
BaseItemKind.Episode ? (
item
.ParentBackdropImageTags
.length != 0 && (
<> <>
<Blurhash <Blurhash
hash={ hash={
@@ -339,7 +341,7 @@ const Home = () => {
<div className="hero-carousel-background-icon-container"> <div className="hero-carousel-background-icon-container">
{ {
MediaTypeIconCollection[ MediaTypeIconCollection[
item.MediaType item.Type
] ]
} }
</div> </div>
+140 -86
View File
@@ -34,6 +34,7 @@ import { useParams, useNavigate, Link as RouterLink } from "react-router-dom";
import { import {
BaseItemKind, BaseItemKind,
ItemFields, ItemFields,
LocationType,
MediaStreamType, MediaStreamType,
SortOrder, SortOrder,
} from "@jellyfin/sdk/lib/generated-client"; } from "@jellyfin/sdk/lib/generated-client";
@@ -66,6 +67,7 @@ import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum"; import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
import { MdiMusic } from "../../components/icons/mdiMusic"; import { MdiMusic } from "../../components/icons/mdiMusic";
import { usePlaybackStore } from "../../utils/store/playback"; import { usePlaybackStore } from "../../utils/store/playback";
import { Tooltip } from "@mui/material";
function TabPanel(props) { function TabPanel(props) {
const { children, value, index, ...other } = props; const { children, value, index, ...other } = props;
@@ -168,6 +170,7 @@ const ItemDetail = () => {
queryFn: async () => { queryFn: async () => {
const result = await getTvShowsApi(window.api).getSeasons({ const result = await getTvShowsApi(window.api).getSeasons({
seriesId: item.data.Id, seriesId: item.data.Id,
isSpecialSeason: false,
}); });
return result.data; return result.data;
}, },
@@ -200,6 +203,7 @@ const ItemDetail = () => {
userId: user.data.Id, userId: user.data.Id,
parentId: seasons.data.Items[currentSeason].Id, parentId: seasons.data.Items[currentSeason].Id,
fields: [ItemFields.SeasonUserData, "Overview"], fields: [ItemFields.SeasonUserData, "Overview"],
excludeLocationTypes: [LocationType.Virtual],
}); });
return result.data; return result.data;
}, },
@@ -505,20 +509,29 @@ const ItemDetail = () => {
setAudioTracks(audios); setAudioTracks(audios);
setSubtitleTracks(subs); setSubtitleTracks(subs);
setCurrentVideoTrack(videos[0].DisplayTitle); setCurrentVideoTrack(videos[0]?.Index);
setCurrentAudioTrack(audios[0].DisplayTitle); setCurrentAudioTrack(audios[0]?.Index);
setCurrentSubTrack(subs[0].DisplayTitle); setCurrentSubTrack(subs[0]?.Index);
} }
}, [item.isSuccess]); }, [item.isSuccess]);
const [setUrl, setPosition, setItemId, setItemName] = usePlaybackStore( const [
(state) => [ setUrl,
state.setUrl, setPosition,
state.setPosition, setDuration,
state.setItemId, setItemId,
state.setItemName, setItemName,
], setSubtitleTracksStore,
); setSelectedSubtitleTrack,
] = usePlaybackStore((state) => [
state.setUrl,
state.setPosition,
state.setDuration,
state.setItemId,
state.setItemName,
state.setSubtitleTracks,
state.setSelectedSubtitleTrack,
]);
const [directors, setDirectors] = useState([]); const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]); const [writers, setWriters] = useState([]);
@@ -1004,82 +1017,121 @@ const ItemDetail = () => {
"Music", "Music",
) && ( ) && (
<> <>
<Button <Tooltip
variant="contained" title={
size="large" item.data
startIcon={ .Type ==
<MdiPlayOutline /> "Series"
? "Work in progress, meanwhile you can play individual episodes by clicking on episode card below"
: ""
} }
sx={{
position:
"relative",
overflow:
"hidden",
}}
onClick={() => {
if (
!!item
.data
.VideoType
) {
setUrl(
`${window.api.basePath}/Videos/${item.data.Id}/stream.${item.data.MediaSources[0].Container}?Static=true&mediaSourceId=${item.data.Id}&deviceId=${window.api.deviceInfo.id}&api_key=${window.api.accessToken}&Tag=${item.data.MediaSources[0].ETag}`,
);
setPosition(
item
.data
.UserData
.PlaybackPositionTicks,
);
setItemName(
item
.data
.Name,
);
setItemId(
item
.data
.Id,
);
}
navigate(
`/player`,
);
}}
> >
{!!item.data <span>
.UserData <Button
.PlayedPercentage && disabled={
item.data.UserData
.PlayedPercentage >
0
? "Resume"
: "Play"}
{!!item.data
.UserData
.PlayedPercentage && (
<LinearProgress
variant="determinate"
value={
item item
.data .data
.UserData .Type ==
.PlayedPercentage "Series"
? true
: false
}
variant="contained"
size="large"
startIcon={
<MdiPlayOutline />
} }
color="white"
sx={{ sx={{
position: position:
"absolute", "relative",
height: "100%", overflow:
width: "100%", "hidden",
background:
"transparent",
zIndex: "0",
opacity: 0.2,
}} }}
/> onClick={() => {
)} if (
</Button> !!item
.data
.VideoType
) {
setUrl(
`${window.api.basePath}/Videos/${item.data.Id}/stream.${item.data.MediaSources[0].Container}?Static=true&mediaSourceId=${item.data.Id}&deviceId=${window.api.deviceInfo.id}&api_key=${window.api.accessToken}&Tag=${item.data.MediaSources[0].ETag}&videoStreamIndex=${currentVideoTrack}&audioStreamIndex=${currentAudioTrack}`,
);
setPosition(
item
.data
.UserData
.PlaybackPositionTicks,
);
setItemName(
item
.data
.Type ==
"Episode"
? `${item.data.SeriesName} S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} ${item.data.Name}`
: item
.data
.Name,
);
setItemId(
item
.data
.Id,
);
setDuration(
item
.data
.RunTimeTicks,
);
setSubtitleTracksStore(
subtitleTracks,
);
setSelectedSubtitleTrack(
currentSubTrack,
);
}
navigate(
`/player`,
);
}}
>
{!!item
.data
.UserData
.PlayedPercentage &&
item.data
.UserData
.PlayedPercentage >
0
? "Resume"
: "Play"}
{!!item
.data
.UserData
.PlayedPercentage && (
<LinearProgress
variant="determinate"
value={
item
.data
.UserData
.PlayedPercentage
}
color="white"
sx={{
position:
"absolute",
height: "100%",
width: "100%",
background:
"transparent",
zIndex: "0",
opacity: 0.2,
}}
/>
)}
</Button>
</span>
</Tooltip>
<IconButton <IconButton
onClick={ onClick={
@@ -1489,7 +1541,8 @@ const ItemDetail = () => {
item.data.MediaStreams.length != item.data.MediaStreams.length !=
0 && ( 0 && (
<> <>
{videoTracks != [] && ( {videoTracks.length !=
0 && (
<TableRow <TableRow
sx={{ sx={{
"& td, & th": "& td, & th":
@@ -1549,7 +1602,7 @@ const ItemDetail = () => {
sindex sindex
} }
value={ value={
stream.DisplayTitle stream.Index
} }
> >
{ {
@@ -1563,7 +1616,8 @@ const ItemDetail = () => {
</TableCell> </TableCell>
</TableRow> </TableRow>
)} )}
{audioTracks != [] && ( {audioTracks.length !=
0 && (
<TableRow <TableRow
sx={{ sx={{
"& td, & th": "& td, & th":
@@ -1619,7 +1673,7 @@ const ItemDetail = () => {
sindex sindex
} }
value={ value={
stream.DisplayTitle stream.Index
} }
> >
{ {
@@ -1633,8 +1687,8 @@ const ItemDetail = () => {
</TableCell> </TableCell>
</TableRow> </TableRow>
)} )}
{subtitleTracks != {subtitleTracks.length !=
[] && ( 0 && (
<TableRow <TableRow
sx={{ sx={{
"& td, & th": "& td, & th":
@@ -1690,7 +1744,7 @@ const ItemDetail = () => {
sindex sindex
} }
value={ value={
stream.DisplayTitle stream.Index
} }
> >
{ {
+1
View File
@@ -76,6 +76,7 @@
&-title-logo { &-title-logo {
filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2)); filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2));
height: 100%; height: 100%;
max-height: 5em;
width: 45%; width: 45%;
object-fit: contain; object-fit: contain;
object-position: bottom; object-position: bottom;
+2 -2
View File
@@ -287,8 +287,8 @@ export const UserLogin = () => {
imageTags={ imageTags={
!!item.PrimaryImageTag !!item.PrimaryImageTag
} }
// cardType="sqaure" disableOverlay
iconType="Person" iconType="User"
cardOrientation="sqaure" cardOrientation="sqaure"
onClickEvent={() => onClickEvent={() =>
navigate( navigate(
+478 -53
View File
@@ -7,6 +7,14 @@ import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Slider from "@mui/material/Slider";
import CircularProgress from "@mui/material/CircularProgress";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import TextField from "@mui/material/TextField";
import ListItem from "@mui/material/ListItem";
import ListItemText from "@mui/material/ListItemText";
import Backdrop from "@mui/material/Backdrop";
import ReactPlayer from "react-player"; import ReactPlayer from "react-player";
@@ -14,8 +22,8 @@ import { usePlaybackStore } from "../../utils/store/playback";
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft"; import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
import { MdiPlay } from "../../components/icons/mdiPlay"; import { MdiPlay } from "../../components/icons/mdiPlay";
import { useNavigate } from "react-router-dom"; import { useLocation, useNavigate } from "react-router-dom";
import { useRef, useState, useCallback } from "react"; import { useRef, useState, useCallback, useEffect } from "react";
import { secToTicks, ticksToSec } from "../../utils/date/time"; import { secToTicks, ticksToSec } from "../../utils/date/time";
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api"; import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
@@ -24,73 +32,213 @@ import "./videoPlayer.module.scss";
import { MdiPause } from "../../components/icons/mdiPause"; import { MdiPause } from "../../components/icons/mdiPause";
import { MdiFastForward } from "../../components/icons/mdiFastForward"; import { MdiFastForward } from "../../components/icons/mdiFastForward";
import { MdiRewind } from "../../components/icons/mdiRewind"; import { MdiRewind } from "../../components/icons/mdiRewind";
import { MdiFullscreen } from "../../components/icons/mdiFullscreen";
import { MdiFullscreenExit } from "../../components/icons/mdiFullscreenExit";
import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight";
import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh";
import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff";
import { MdiPlaySpeed } from "../../components/icons/mdiPlaySpeed";
import { endsAt } from "../../utils/date/time";
import useKeyPress from "../../utils/hooks/useKeyPress";
import { MdiCog } from "../../components/icons/mdiCog";
export const VideoPlayer = () => { export const VideoPlayer = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const [settingsMenuEl, setSettingsMenuEl] = useState(null);
const settingsMenuState = Boolean(settingsMenuEl);
const [speedMenuEl, setSpeedMenuEl] = useState(null);
const [speed, setSpeed] = useState(3);
const speedMenuState = Boolean(speedMenuEl);
const availableSpeeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
const [
url,
startPosition,
itemDuration,
itemId,
itemName,
subtitleTracksStore,
selectedSubtitleTrack,
] = usePlaybackStore((state) => [
state.url,
state.startPosition,
state.duration,
state.itemId,
state.itemName,
state.subtitleTracks,
state.selectedSubtitleTrack,
]);
const [currentSubtrack, setCurrentSubtrack] = useState(
selectedSubtitleTrack,
);
const [showControls, setShowControls] = useState(false);
const playerRef = useRef(); const playerRef = useRef();
const [isSeeking, setIsSeeking] = useState(false);
const [isBuffering, setIsBuffering] = useState(true);
const [isPlaying, setIsPlaying] = useState(true); const [isPlaying, setIsPlaying] = useState(true);
const [isMuted, setIsMuted] = useState(false); const [isMuted, setIsMuted] = useState(false);
const [isReady, setIsReady] = useState(false); const [isReady, setIsReady] = useState(false);
const [isPIP, setIsPIP] = useState(false);
const [volume, setVolume] = useState(0.8);
const [showVolume, setShowVolume] = useState(false);
const [duration, setDuration] = useState(0);
const [progress, setProgress] = useState(0);
const [currentTime, setCurrentTime] = useState(startPosition);
const onReady = useCallback(() => { const onReady = useCallback(() => {
if (!isReady) { if (!isReady) {
const timeToStart = ticksToSec(startPosition); const timeToStart = ticksToSec(startPosition);
playerRef.current.seekTo(timeToStart, "seconds"); playerRef.current.seekTo(timeToStart, "seconds");
setDuration(playerRef.current.getDuration());
setIsReady(true); setIsReady(true);
const player = playerRef.current.getInternalPlayer();
console.log(player.config);
} }
}, [isReady]); }, [isReady]);
const onProgress = async (e) => { const onProgress = async (e) => {
console.log(e); if (!isSeeking) {
setProgress(e.played);
setCurrentTime(secToTicks(e.playedSeconds));
}
await getPlaystateApi(window.api).reportPlaybackProgress({ await getPlaystateApi(window.api).reportPlaybackProgress({
playbackProgressInfo: { playbackProgressInfo: {
ItemId: itemId, ItemId: itemId,
IsMuted: isMuted, IsMuted: isMuted,
PositionTicks: secToTicks(e.playedSeconds), PositionTicks: secToTicks(e.playedSeconds),
PlaybackStartTimeTicks: startPosition, PlaybackStartTimeTicks: startPosition,
VolumeLevel: volume * 100,
IsPaused: !isPlaying,
}, },
}); });
}; };
const [url, startPosition, itemId, itemName] = usePlaybackStore( const handleDisplayCurrentTime = () => {
(state) => [ let time = ticksToSec(progress * itemDuration);
state.url, let hr = Math.floor(time / 3600);
state.startPosition, time -= hr * 3600;
state.itemId, let min = Math.floor(time / 60);
state.itemName, time -= min * 60;
], return `${hr.toLocaleString([], {
); minimumIntegerDigits: 2,
maximumFractionDigits: 0,
})}:${min.toLocaleString([], {
minimumIntegerDigits: 2,
maximumFractionDigits: 0,
})}:${time.toLocaleString([], {
minimumIntegerDigits: 2,
maximumFractionDigits: 0,
})}`;
};
const handleDisplayTime = (ticks) => {
let time = ticksToSec(ticks);
let hr = Math.floor(time / 3600);
time -= hr * 3600;
let min = Math.floor(time / 60);
time -= min * 60;
return `${hr.toLocaleString([], {
minimumIntegerDigits: 2,
maximumFractionDigits: 0,
})}:${min.toLocaleString([], {
minimumIntegerDigits: 2,
maximumFractionDigits: 0,
})}:${time.toLocaleString([], {
minimumIntegerDigits: 2,
maximumFractionDigits: 0,
})}`;
};
const [appFullscreen, setAppFullScreen] = useState(false);
useEffect(() => {
let timeout = null;
if (showControls) {
window.clearTimeout(timeout);
timeout = setTimeout(() => {
setShowControls(false);
}, 5000);
}
}, [showControls]);
const handleKeyPress = useCallback((event) => {
switch (event.key) {
case "ArrowRight":
playerRef.current.seekTo(
playerRef.current.getCurrentTime() + 15,
);
break;
case "ArrowLeft":
playerRef.current.seekTo(
playerRef.current.getCurrentTime() - 15,
);
break;
case "p":
setIsPlaying(!isPlaying);
default:
console.log(event.key);
break;
}
}, []);
const [subs, setSubs] = useState([]);
useEffect(() => {
setSubs(
subtitleTracksStore.map((sub, index) => {
return {
kind: "subtitles",
src: `${window.api.basePath}/Videos/${itemId}/${itemId}/Subtitles/${sub.Index}/Stream.vtt?api_key=${window.api.accessToken}`,
srcLang: sub?.Language,
default: false,
mode:
sub.Index == currentSubtrack
? "showing"
: "hidden",
};
}),
);
}, [subtitleTracksStore]);
let timer;
return ( return (
<Box <Box
className="video" className="video"
sx={{ background: "black" }} sx={{ background: "black" }}
onMouseMove={(e) => { onMouseMove={() => {
let a = "he"; setShowControls(true);
clearTimeout(timer);
e.currentTarget.classList.add("video-osd-visible");
timer = setTimeout(() => {
document
.querySelector(".video")
.classList.remove("video-osd-visible");
}, 2000);
}} }}
> >
<Stack <Box
sx={{
position: "absolute",
inset: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
opacity: isBuffering ? 1 : 0,
transition: "opacity 250ms",
}}
>
<CircularProgress />
</Box>
<Backdrop
className="video-osd" className="video-osd"
sx={{ sx={{
position: "fixed", display: "flex",
top: 0, flexDirection: "column",
left: 0, zIndex: 100000,
right: 0, justifyContent: "space-between",
bottom: 0, background: "transparent",
}} }}
alignItems="center" open={showControls}
justifyContent="space-between"
direction="column"
zIndex="10000000"
> >
<AppBar <AppBar
position="static" position="static"
@@ -109,40 +257,317 @@ export const VideoPlayer = () => {
</Typography> </Typography>
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<Stack padding={2} direction="row"> <Stack
<IconButton direction="column"
onClick={() => padding={2}
playerRef.current.seekTo( width="100%"
playerRef.current.getCurrentTime() - 15, sx={{
) background:
} "linear-gradient(to top, rgb(0 0 0 / 0.75), transparent)",
}}
>
<Stack
width="100%"
direction="row"
alignItems="center"
justifyContent="center"
gap={2}
> >
<MdiRewind /> <Typography variant="h6">
</IconButton> {handleDisplayCurrentTime()}
<IconButton onClick={() => setIsPlaying(!isPlaying)}> </Typography>
{isPlaying ? <MdiPause /> : <MdiPlay />} <Slider
</IconButton> value={currentTime}
<IconButton step={0.01}
onClick={() => max={itemDuration}
playerRef.current.seekTo( onChange={(e, newVal) => {
playerRef.current.getCurrentTime() + 15, setIsSeeking(true);
) setCurrentTime(newVal);
} }}
onChangeCommitted={(e, newVal) => {
playerRef.current.seekTo(
ticksToSec(newVal),
);
setCurrentTime(newVal);
setIsSeeking(false);
}}
valueLabelDisplay="auto"
valueLabelFormat={(value) =>
handleDisplayTime(value)
}
sx={{
"& .MuiSlider-valueLabel": {
lineHeight: 1.2,
fontSize: 24,
background: "rgb(0 0 0 / 0.5)",
backdropFilter: "blur(5px)",
padding: 1,
borderRadius: "10px",
border: "1px solid rgb(255 255 255 / 0.15)",
boxShadow:
"0 0 10px rgb(0 0 0 / 0.4) ",
transform:
"translatey(-120%) scale(0)",
"&:before": { display: "none" },
"&.MuiSlider-valueLabelOpen": {
transform:
"translateY(-120%) scale(1)",
},
"& > *": {
transform: "rotate(0deg)",
},
},
}}
/>
<Typography variant="h6">
{handleDisplayTime(itemDuration)}
</Typography>
</Stack>
<Stack
direction="row"
justifyContent="space-between"
alignItems="center"
> >
<MdiFastForward /> <Stack
</IconButton> direction="row"
gap={1}
justifyContent="center"
alignItems="center"
>
<IconButton
onClick={() =>
playerRef.current.seekTo(
playerRef.current.getCurrentTime() -
15,
)
}
>
<MdiRewind />
</IconButton>
<IconButton
onClick={() => setIsPlaying(!isPlaying)}
>
{isPlaying ? <MdiPause /> : <MdiPlay />}
</IconButton>
<IconButton
onClick={() =>
playerRef.current.seekTo(
playerRef.current.getCurrentTime() +
15,
)
}
>
<MdiFastForward />
</IconButton>
<Typography variant="subtitle1">
{endsAt(itemDuration - currentTime)}
</Typography>
</Stack>
<Stack
direction="row"
gap={1}
alignItems="center"
justifyContent="center"
>
<Box>
<Menu
anchorEl={speedMenuEl}
open={speedMenuState}
onClose={() =>
setSpeedMenuEl(null)
}
MenuListProps={{
"aria-labelledby":
"lock-button",
role: "listbox",
}}
anchorOrigin={{
vertical: "bottom",
horizontal: "center",
}}
transformOrigin={{
vertical: "bottom",
horizontal: "center",
}}
sx={{
mb: 20,
}}
>
{availableSpeeds.map(
(sspeed, index) => {
return (
<MenuItem
key={sspeed}
selected={
index ===
speed
}
onClick={() => {
setSpeed(
index,
);
setSpeedMenuEl(
null,
);
}}
sx={{
width: 160,
}}
>
{sspeed}x
</MenuItem>
);
},
)}
</Menu>
<IconButton
onClick={(e) =>
setSpeedMenuEl(
e.currentTarget,
)
}
>
<MdiPlaySpeed />
</IconButton>
</Box>
<IconButton
sx={{
ml: 0.1,
}}
onClick={() => setIsMuted(!isMuted)}
>
{isMuted ? (
<MdiVolumeOff />
) : (
<MdiVolumeHigh />
)}
</IconButton>
<Slider
value={isMuted ? 0 : volume * 100}
step={1}
max={100}
onChange={(e, newVal) =>
setVolume(newVal / 100)
}
valueLabelDisplay="auto"
valueLabelFormat={(value) =>
Math.floor(value)
}
sx={{
mr: 1,
ml: 1,
width: "10em",
"& .MuiSlider-valueLabel": {
lineHeight: 1.2,
fontSize: 24,
background:
"rgb(0 0 0 / 0.5)",
backdropFilter: "blur(5px)",
padding: 1,
borderRadius: "10px",
border: "1px solid rgb(255 255 255 / 0.15)",
boxShadow:
"0 0 10px rgb(0 0 0 / 0.4) ",
transform:
"translatey(-120%) scale(0)",
"&:before": {
display: "none",
},
"&.MuiSlider-valueLabelOpen":
{
transform:
"translateY(-120%) scale(1)",
},
"& > *": {
transform:
"rotate(0deg)",
},
},
}}
/>
<Box>
<Menu
anchorEl={settingsMenuEl}
onClose={() => {
setSettingsMenuEl(null);
}}
open={settingsMenuState}
sx={{ padding: 2 }}
>
<Stack direction="row">
<Typography variant="h6">
Subtitle
</Typography>
</Stack>
</Menu>
<IconButton
onClick={(e) =>
setSettingsMenuEl(
e.currentTarget,
)
}
disabled
>
<MdiCog />
</IconButton>
</Box>
<IconButton
onClick={() => {
setIsPIP(!isPIP);
}}
>
<MdiPictureInPictureBottomRight />
</IconButton>
<IconButton
onClick={async () => {
let fstate =
await appWindow.isFullscreen();
setAppFullScreen(!fstate);
await appWindow.setFullscreen(
!fstate,
);
}}
>
{appFullscreen ? (
<MdiFullscreenExit />
) : (
<MdiFullscreen />
)}
</IconButton>
</Stack>
</Stack>
</Stack> </Stack>
</Stack> </Backdrop>
<ReactPlayer <ReactPlayer
ref={playerRef} ref={playerRef}
width="100vw" width="100vw"
height="100vh" height="100vh"
playing={isPlaying} playing={isPlaying}
url={url} url={url}
// controls={true}
onProgress={onProgress} onProgress={onProgress}
onReady={onReady} onReady={onReady}
muted={isMuted} muted={isMuted}
pip={isPIP}
volume={volume}
onBuffer={() => setIsBuffering(true)}
onBufferEnd={() => setIsBuffering(false)}
config={{
file: {
attributes: {
crossOrigin: "true",
},
tracks: [
{
kind: "subtitles",
src: `${window.api.basePath}/Videos/${itemId}/${itemId}/Subtitles/${currentSubtrack}/Stream.vtt?api_key=${window.api.accessToken}`,
srcLang: "",
default: true,
mode: "showing",
},
],
},
}}
playbackRate={availableSpeeds[speed]}
/> />
</Box> </Box>
); );
+13
View File
@@ -9,3 +9,16 @@
opacity: 1; opacity: 1;
} }
} }
video {
&::-webkit-media-text-track-display {
overflow: visible !important;
}
&::cue {
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
background: transparent;
}
&::cue(i) {
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
}
}
+87 -69
View File
@@ -2,6 +2,7 @@
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import axios from "axios";
import { EventEmitter as event } from "../../../eventEmitter.js"; import { EventEmitter as event } from "../../../eventEmitter.js";
import { setServer } from "../../../utils/storage/servers.js"; import { setServer } from "../../../utils/storage/servers.js";
@@ -20,8 +21,17 @@ import { mdiChevronRight } from "@mdi/js";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
import {
Jellyfin,
VersionOutdatedIssue,
VersionUnsupportedIssue,
} from "@jellyfin/sdk";
import { version as appVer } from "../../../../package.json";
import { v4 as uuidv4 } from "uuid";
// SCSS // SCSS
import "./server.module.scss"; import "./server.module.scss";
import { useQuery } from "@tanstack/react-query";
export const ServerList = () => { export const ServerList = () => {
const [renderServerList, setRenderServerList] = useState(false); const [renderServerList, setRenderServerList] = useState(false);
@@ -118,6 +128,17 @@ export const ServerList = () => {
}; };
export const ServerSetup = (props) => { export const ServerSetup = (props) => {
const sdk = new Jellyfin({
clientInfo: {
name: "JellyPlayer",
version: appVer,
},
deviceInfo: {
name: "JellyPlayer",
id: uuidv4(),
},
});
const [serverIp, setServerIp] = useState(""); const [serverIp, setServerIp] = useState("");
const [checkingServer, setServerCheckState] = useState(false); const [checkingServer, setServerCheckState] = useState(false);
@@ -127,15 +148,7 @@ export const ServerSetup = (props) => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const usersAvailable = async () => { const usersAvailable = async () => {};
const users = await getUserApi(window.api).getPublicUsers();
if (users.data.length >= 1) {
console.log("Users => ", users.data);
return true;
} else {
return false;
}
};
const addServer = async () => { const addServer = async () => {
event.emit("create-jellyfin-api", serverIp); event.emit("create-jellyfin-api", serverIp);
let sysInfo = await getSystemApi(window.api).getPublicSystemInfo(); let sysInfo = await getSystemApi(window.api).getPublicSystemInfo();
@@ -144,57 +157,75 @@ export const ServerSetup = (props) => {
// Set Server Config to Tauri store // Set Server Config to Tauri store
sysInfo.Ip = serverIp; sysInfo.Ip = serverIp;
setServer(sysInfo); setServer(sysInfo);
};
const usersAvailablity = await usersAvailable(); const checkServer = async () => {
if (usersAvailablity == true) { setServerCheckState(true);
console.log(usersAvailablity); try {
navigate("/login/users"); const result = await axios.get(`${serverIp}/System/Ping`);
} else { if (result.data == "Jellyfin Server") {
navigate("/login/manual"); event.emit("create-jellyfin-api", serverIp);
let sysInfo = await getSystemApi(
window.api,
).getPublicSystemInfo();
sysInfo = sysInfo.data;
sysInfo.Ip = serverIp;
setServer(sysInfo);
const users = await getUserApi(window.api).getPublicUsers();
if (users.data.length >= 1) {
navigate("/login/users");
} else {
navigate("/login/manual");
}
} else {
enqueueSnackbar(
"The provided ip address doesn't seem point to a Jellyfin server.",
{ variant: "error" },
);
}
} catch (error) {
enqueueSnackbar("Unable to verfiy server address.", {
variant: "error",
});
} }
setServerCheckState(false);
return "";
}; };
const handleAddServer = () => { const handleAddServer = () => {
setLoading(true); // setLoading(true);
let data; // let data;
fetch(`${serverIp}/System/Ping`, { // fetch(`${serverIp}/System/Ping`, {
body: JSON.stringify(data), // body: JSON.stringify(data),
}) // })
.then((res) => res.json()) // .then((res) => res.json())
.then((data) => { // .then((data) => {
if (data == "Jellyfin Server") { // if (data == "Jellyfin Server") {
addServer(); // addServer();
setLoading(false); // setLoading(false);
return true; // return true;
} else { // } else {
enqueueSnackbar( // enqueueSnackbar(
"The server address does not seem be a jellyfin server", // "The server address does not seem be a jellyfin server",
{ variant: "error" }, // { variant: "error" },
); // );
setLoading(false); // setLoading(false);
return false; // return false;
} // }
}) // })
.catch((error) => { // .catch((error) => {
setLoading(false); // setLoading(false);
enqueueSnackbar( // enqueueSnackbar(
"Unable to verify whether the give address is a valid Jellyfin server", // "Unable to verify whether the give address is a valid Jellyfin server",
{ variant: "error" }, // { variant: "error" },
); // );
console.error(error); // console.error(error);
}); // });
}; };
return ( return (
<> <>
<Container <Container maxWidth="sm" className={"centered serverContainer"}>
maxWidth="sm"
className={
checkingServer
? "centered serverContainer loading"
: "centered serverContainer"
}
>
<Grid <Grid
container container
spacing={2} spacing={2}
@@ -212,22 +243,9 @@ export const ServerSetup = (props) => {
variant="outlined" variant="outlined"
// inputRef={serverIp} // inputRef={serverIp}
onChange={(event) => { onChange={(event) => {
if ( setServerIp(event.target.value);
event.target.value.charAt(
event.target.value.length - 1,
) == "/"
) {
setServerIp(
event.target.value.slice(
0,
-1,
),
);
} else {
setServerIp(event.target.value);
}
}} }}
helperText="Add your server adddress with https:// or http://" helperText="Add your server adddress with https:// or http://. Eg: https://demo.jellyfin.org"
></TextField> ></TextField>
</Grid> </Grid>
<Grid item xl={5} md={6} sx={{ width: "100%" }}> <Grid item xl={5} md={6} sx={{ width: "100%" }}>
@@ -235,14 +253,14 @@ export const ServerSetup = (props) => {
variant="contained" variant="contained"
sx={{ width: "100%" }} sx={{ width: "100%" }}
size="large" size="large"
loading={loading} loading={checkingServer}
endIcon={ endIcon={
<SvgIcon> <SvgIcon>
<path d={mdiChevronRight}></path> <path d={mdiChevronRight}></path>
</SvgIcon> </SvgIcon>
} }
loadingPosition="end" loadingPosition="end"
onClick={handleAddServer} onClick={() => checkServer()}
> >
Add Server Add Server
</LoadingButton> </LoadingButton>
+32
View File
@@ -0,0 +1,32 @@
/** @format */
import { useState, useEffect } from "react";
const useKeyPress = (targetKey) => {
// State for keeping track of whether key is pressed
const [keyPressed, setKeyPressed] = useState(false);
// If pressed key is our target key then set to true
function downHandler({ key }) {
if (key === targetKey) {
setKeyPressed(true);
}
}
// If released key is our target key then set to false
const upHandler = ({ key }) => {
if (key === targetKey) {
setKeyPressed(false);
}
};
// Add event listeners
useEffect(() => {
window.addEventListener("keydown", downHandler);
window.addEventListener("keyup", upHandler);
// Remove event listeners on cleanup
return () => {
window.removeEventListener("keydown", downHandler);
window.removeEventListener("keyup", upHandler);
};
}, []); // Empty array ensures that effect is only run on mount and unmount
return keyPressed;
};
export default useKeyPress;
+8
View File
@@ -0,0 +1,8 @@
/** @format */
import { create } from "zustand";
export const useDrawerStore = create((set) => ({
open: false,
setOpen: (sopen) => set((state) => ({ ...state, open: sopen })),
}));
+11
View File
@@ -5,10 +5,21 @@ import { create } from "zustand";
export const usePlaybackStore = create((set) => ({ export const usePlaybackStore = create((set) => ({
url: "", url: "",
startPosition: 0, startPosition: 0,
duration: 0,
itemId: "", itemId: "",
itemName: "", itemName: "",
subtitleTracks: [],
selectedSubtitleTrack: 0,
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })), setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })), setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
setDuration: (adur) => set((state) => ({ ...state, duration: adur })),
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })), setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
setItemName: (anm) => set((state) => ({ ...state, itemName: anm })), setItemName: (anm) => set((state) => ({ ...state, itemName: anm })),
setSubtitleTracks: (asub) =>
set((state) => ({
...state,
subtitleTracks: asub,
})),
setSelectedSubtitleTrack: (asub) =>
set((state) => ({ ...state, selectedSubtitleTrack: asub })),
})); }));