Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
092a1c74ab | ||
|
|
fb7c86631d |
No files matched your search
Generated
+3
-11
@@ -20,6 +20,7 @@
|
|||||||
"@tanstack/react-query-devtools": "^4.29.3",
|
"@tanstack/react-query-devtools": "^4.29.3",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
"@videojs/http-streaming": "^3.0.2",
|
"@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.4",
|
||||||
@@ -1892,14 +1893,12 @@
|
|||||||
"node_modules/asynckit": {
|
"node_modules/asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
|
||||||
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
|
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.0",
|
"follow-redirects": "^1.15.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
@@ -2084,7 +2083,6 @@
|
|||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"delayed-stream": "~1.0.0"
|
"delayed-stream": "~1.0.0"
|
||||||
},
|
},
|
||||||
@@ -2164,7 +2162,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.4.0"
|
"node": ">=0.4.0"
|
||||||
}
|
}
|
||||||
@@ -2302,7 +2299,6 @@
|
|||||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.0"
|
"node": ">=4.0"
|
||||||
},
|
},
|
||||||
@@ -2316,7 +2312,6 @@
|
|||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"asynckit": "^0.4.0",
|
"asynckit": "^0.4.0",
|
||||||
"combined-stream": "^1.0.8",
|
"combined-stream": "^1.0.8",
|
||||||
@@ -2682,7 +2677,6 @@
|
|||||||
"version": "1.52.0",
|
"version": "1.52.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
@@ -2691,7 +2685,6 @@
|
|||||||
"version": "2.1.35",
|
"version": "2.1.35",
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mime-db": "1.52.0"
|
"mime-db": "1.52.0"
|
||||||
},
|
},
|
||||||
@@ -2948,8 +2941,7 @@
|
|||||||
"node_modules/proxy-from-env": {
|
"node_modules/proxy-from-env": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/react": {
|
"node_modules/react": {
|
||||||
"version": "18.2.0",
|
"version": "18.2.0",
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"@tanstack/react-query-devtools": "^4.29.3",
|
"@tanstack/react-query-devtools": "^4.29.3",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
"@videojs/http-streaming": "^3.0.2",
|
"@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.4",
|
||||||
|
|||||||
+62
-30
@@ -7,7 +7,7 @@ import Konami from "react-konami-code";
|
|||||||
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,11 +59,17 @@ 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 { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api.js";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
const jellyfin = new Jellyfin({
|
const jellyfin = new Jellyfin({
|
||||||
clientInfo: {
|
clientInfo: {
|
||||||
@@ -123,7 +129,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,34 +165,60 @@ function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const pingServer = () => {
|
const pingServer = useQuery({
|
||||||
setChecking(true);
|
queryKey: ["setup", "server"],
|
||||||
let data;
|
queryFn: async () => {
|
||||||
fetch(`${window.api.basePath}/System/Ping`, {
|
let serverUrl = window.api.basePath.replace(/\/$/, "").trim();
|
||||||
body: JSON.stringify(data),
|
const candidates =
|
||||||
})
|
await jellyfin.discovery.getRecommendedServerCandidates(
|
||||||
.then((res) => res.json())
|
serverUrl,
|
||||||
.then((data) => {
|
|
||||||
if (data == "Jellyfin Server") {
|
|
||||||
setServerReachable(true);
|
|
||||||
setChecking(false);
|
|
||||||
} else {
|
|
||||||
enqueueSnackbar(
|
|
||||||
"The server address does not seem be a jellyfin server",
|
|
||||||
{ variant: "error" },
|
|
||||||
);
|
);
|
||||||
|
const best = jellyfin.discovery.findBestServer(candidates);
|
||||||
|
if (best) {
|
||||||
|
const issues = candidates.flatMap((s) => s.issues);
|
||||||
|
if (
|
||||||
|
issues.some(
|
||||||
|
(i) =>
|
||||||
|
i instanceof VersionOutdatedIssue ||
|
||||||
|
i instanceof VersionUnsupportedIssue,
|
||||||
|
)
|
||||||
|
) {
|
||||||
setServerReachable(false);
|
setServerReachable(false);
|
||||||
setChecking(false);
|
enqueueSnackbar(
|
||||||
|
"Please Update your server to latest Jellyfin version to use this client",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
try {
|
||||||
.catch((error) => {
|
const api = sdk.createApi(best.address);
|
||||||
enqueueSnackbar("Unable to reach server", {
|
const { data } = await getSystemApi(
|
||||||
variant: "error",
|
api,
|
||||||
});
|
).getPublicSystemInfo();
|
||||||
setServerReachable(false);
|
delete data.LocalAddress;
|
||||||
setChecking(false);
|
const serv = {
|
||||||
});
|
...data,
|
||||||
|
PublicAddress: best.address,
|
||||||
|
isDefault: false,
|
||||||
};
|
};
|
||||||
|
if (serv.StartupWizardCompleted) {
|
||||||
|
setServerReachable(true);
|
||||||
|
} else {
|
||||||
|
setServerReachable(false);
|
||||||
|
enqueueSnackbar(
|
||||||
|
"Server setup not complete. Please complete your server setup.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setServerReachable(false);
|
||||||
|
enqueueSnackbar("Server not found.", { variant: "error" });
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
// enabled: false,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
});
|
||||||
|
|
||||||
const userLogin = async () => {
|
const userLogin = async () => {
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
@@ -201,7 +234,7 @@ function App() {
|
|||||||
serverAvailable().then(async (server) => {
|
serverAvailable().then(async (server) => {
|
||||||
if (server == true) {
|
if (server == true) {
|
||||||
createApi().then(() => {
|
createApi().then(() => {
|
||||||
pingServer();
|
pingServer.refetch();
|
||||||
if (serverReachable == true) {
|
if (serverReachable == true) {
|
||||||
userSaved().then((user_available) => {
|
userSaved().then((user_available) => {
|
||||||
if (user_available == true) {
|
if (user_available == true) {
|
||||||
@@ -227,7 +260,6 @@ function App() {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
navigate("/setup/server");
|
navigate("/setup/server");
|
||||||
setChecking(false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -277,7 +309,7 @@ function App() {
|
|||||||
return (
|
return (
|
||||||
<SnackbarProvider maxSnack={5}>
|
<SnackbarProvider maxSnack={5}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
{checkingServer && (
|
{pingServer.isLoading && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ 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={{
|
||||||
@@ -22,7 +21,6 @@ export const AvatarImage = ({ userId, userImageTags }) => {
|
|||||||
"/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" />
|
||||||
|
|||||||
@@ -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,7 +212,14 @@ export const Card = ({
|
|||||||
<CardMedia
|
<CardMedia
|
||||||
component="img"
|
component="img"
|
||||||
image={
|
image={
|
||||||
window.api.basePath +
|
iconType == "User"
|
||||||
|
? window.api
|
||||||
|
.basePath +
|
||||||
|
"/Users/" +
|
||||||
|
itemId +
|
||||||
|
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
|
||||||
|
: window.api
|
||||||
|
.basePath +
|
||||||
"/Items/" +
|
"/Items/" +
|
||||||
itemId +
|
itemId +
|
||||||
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
|
"/Images/Primary?fillHeight=532&fillWidth=300&quality=96"
|
||||||
@@ -275,6 +284,7 @@ export const Card = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
{!disableOverlay && (
|
||||||
<Box
|
<Box
|
||||||
className="card-media-overlay"
|
className="card-media-overlay"
|
||||||
sx={{
|
sx={{
|
||||||
@@ -294,7 +304,9 @@ export const Card = ({
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
handleMarkAsPlayOrUnMarkAsPlay();
|
handleMarkAsPlayOrUnMarkAsPlay();
|
||||||
}}
|
}}
|
||||||
onFocus={(e) => e.stopPropagation}
|
onFocus={(e) =>
|
||||||
|
e.stopPropagation
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<MdiCheck
|
<MdiCheck
|
||||||
sx={{
|
sx={{
|
||||||
@@ -305,18 +317,24 @@ export const Card = ({
|
|||||||
/>
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
{allowedLikeButton.includes(iconType) && (
|
{allowedLikeButton.includes(
|
||||||
|
iconType,
|
||||||
|
) && (
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
handleLiking();
|
handleLiking();
|
||||||
}}
|
}}
|
||||||
onFocus={(e) => e.stopPropagation}
|
onFocus={(e) =>
|
||||||
|
e.stopPropagation
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{isFavorite ? (
|
{isFavorite ? (
|
||||||
<MdiHeart
|
<MdiHeart
|
||||||
sx={{ color: pink[700] }}
|
sx={{
|
||||||
|
color: pink[700],
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<MdiHeartOutline />
|
<MdiHeartOutline />
|
||||||
@@ -325,6 +343,7 @@ export const Card = ({
|
|||||||
)}
|
)}
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<CardContent
|
<CardContent
|
||||||
|
|||||||
@@ -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 />,
|
||||||
@@ -97,6 +98,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
@@ -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>
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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,113 @@ 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();
|
|
||||||
if (usersAvailablity == true) {
|
|
||||||
console.log(usersAvailablity);
|
|
||||||
navigate("/login/users");
|
|
||||||
} else {
|
|
||||||
navigate("/login/manual");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddServer = () => {
|
const checkServer = useQuery({
|
||||||
setLoading(true);
|
queryKey: ["setup", "server"],
|
||||||
let data;
|
queryFn: async () => {
|
||||||
fetch(`${serverIp}/System/Ping`, {
|
let serverUrl = serverIp.replace(/\/$/, "").trim();
|
||||||
body: JSON.stringify(data),
|
const candidates =
|
||||||
})
|
await sdk.discovery.getRecommendedServerCandidates(
|
||||||
.then((res) => res.json())
|
serverUrl,
|
||||||
.then((data) => {
|
);
|
||||||
if (data == "Jellyfin Server") {
|
const best = sdk.discovery.findBestServer(candidates);
|
||||||
addServer();
|
if (best) {
|
||||||
setLoading(false);
|
const issues = candidates.flatMap((s) => s.issues);
|
||||||
|
if (
|
||||||
|
issues.some(
|
||||||
|
(i) =>
|
||||||
|
i instanceof VersionOutdatedIssue ||
|
||||||
|
i instanceof VersionUnsupportedIssue,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
enqueueSnackbar(
|
||||||
|
"Please Update your server to latest Jellyfin version to use this client",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const api = sdk.createApi(best.address);
|
||||||
|
const { data } = await getSystemApi(
|
||||||
|
api,
|
||||||
|
).getPublicSystemInfo();
|
||||||
|
delete data.LocalAddress;
|
||||||
|
const serv = {
|
||||||
|
...data,
|
||||||
|
PublicAddress: best.address,
|
||||||
|
isDefault: false,
|
||||||
|
};
|
||||||
|
if (serv.StartupWizardCompleted) {
|
||||||
|
event.emit("create-jellyfin-api", serverIp);
|
||||||
|
data.Ip = serverIp;
|
||||||
|
setServer(data);
|
||||||
|
const users = await getUserApi(
|
||||||
|
window.api,
|
||||||
|
).getPublicUsers();
|
||||||
|
if (users.data.length >= 1) {
|
||||||
|
navigate("/login/users");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
enqueueSnackbar(
|
navigate("/login/manual");
|
||||||
"The server address does not seem be a jellyfin server",
|
|
||||||
{ variant: "error" },
|
|
||||||
);
|
|
||||||
setLoading(false);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
.catch((error) => {
|
|
||||||
setLoading(false);
|
|
||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
"Unable to verify whether the give address is a valid Jellyfin server",
|
"Server setup not complete. Please complete your server setup.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
enqueueSnackbar("Something went wrong", {
|
||||||
|
variant: "error",
|
||||||
|
});
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
enqueueSnackbar(
|
||||||
|
"Server not found. Please check you entered address",
|
||||||
{ variant: "error" },
|
{ variant: "error" },
|
||||||
);
|
);
|
||||||
console.error(error);
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
enabled: false,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleAddServer = () => {
|
||||||
|
// setLoading(true);
|
||||||
|
// let data;
|
||||||
|
// fetch(`${serverIp}/System/Ping`, {
|
||||||
|
// body: JSON.stringify(data),
|
||||||
|
// })
|
||||||
|
// .then((res) => res.json())
|
||||||
|
// .then((data) => {
|
||||||
|
// if (data == "Jellyfin Server") {
|
||||||
|
// addServer();
|
||||||
|
// setLoading(false);
|
||||||
|
// return true;
|
||||||
|
// } else {
|
||||||
|
// enqueueSnackbar(
|
||||||
|
// "The server address does not seem be a jellyfin server",
|
||||||
|
// { variant: "error" },
|
||||||
|
// );
|
||||||
|
// setLoading(false);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((error) => {
|
||||||
|
// setLoading(false);
|
||||||
|
// enqueueSnackbar(
|
||||||
|
// "Unable to verify whether the give address is a valid Jellyfin server",
|
||||||
|
// { variant: "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 +281,9 @@ export const ServerSetup = (props) => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
// inputRef={serverIp}
|
// inputRef={serverIp}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
if (
|
|
||||||
event.target.value.charAt(
|
|
||||||
event.target.value.length - 1,
|
|
||||||
) == "/"
|
|
||||||
) {
|
|
||||||
setServerIp(
|
|
||||||
event.target.value.slice(
|
|
||||||
0,
|
|
||||||
-1,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
setServerIp(event.target.value);
|
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 +291,14 @@ export const ServerSetup = (props) => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
sx={{ width: "100%" }}
|
sx={{ width: "100%" }}
|
||||||
size="large"
|
size="large"
|
||||||
loading={loading}
|
loading={checkServer.isFetching}
|
||||||
endIcon={
|
endIcon={
|
||||||
<SvgIcon>
|
<SvgIcon>
|
||||||
<path d={mdiChevronRight}></path>
|
<path d={mdiChevronRight}></path>
|
||||||
</SvgIcon>
|
</SvgIcon>
|
||||||
}
|
}
|
||||||
loadingPosition="end"
|
loadingPosition="end"
|
||||||
onClick={handleAddServer}
|
onClick={() => checkServer.refetch()}
|
||||||
>
|
>
|
||||||
Add Server
|
Add Server
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
|
|||||||
Reference in new issue
Block a user