Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows Jellyseerr to open jellyfin mobile app instead of website #447

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"react-ace": "10.1.0",
"react-animate-height": "2.1.2",
"react-aria": "3.23.0",
"react-device-detect": "^2.2.3",
"react-dom": "18.2.0",
"react-intersection-observer": "9.4.3",
"react-intl": "6.2.10",
Expand Down
10 changes: 8 additions & 2 deletions src/components/Common/PlayButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ const PlayButton = ({ links }: PlayButtonProps) => {
</>
}
onClick={() => {
window.open(links[0].url, '_blank');
window.open(
links[0].url,
links[0].url.startsWith('http') ? '_blank' : '_self'
);
}}
>
{links.length > 1 &&
Expand All @@ -34,7 +37,10 @@ const PlayButton = ({ links }: PlayButtonProps) => {
<ButtonWithDropdown.Item
key={`play-button-dropdown-item-${i}`}
onClick={() => {
window.open(link.url, '_blank');
window.open(
link.url,
link.url.startsWith('http') ? '_blank' : '_self'
);
}}
buttonType="ghost"
>
Expand Down
9 changes: 5 additions & 4 deletions src/components/MovieDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import globalMessages from '@app/i18n/globalMessages';
import Error from '@app/pages/_error';
import { sortCrewPriority } from '@app/utils/creditHelpers';
import { refreshIntervalHelper } from '@app/utils/refreshIntervalHelper';
import { urlLink } from '@app/utils/urlLink';
import {
ArrowRightCircleIcon,
CloudIcon,
Expand Down Expand Up @@ -167,7 +168,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
) {
mediaLinks.push({
text: getAvalaibleMediaServerName(),
url: plexUrl,
url: urlLink(plexUrl),
svg: <PlayIcon />,
});
}
Expand All @@ -181,7 +182,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
) {
mediaLinks.push({
text: getAvalaible4kMediaServerName(),
url: plexUrl4k,
url: urlLink(plexUrl4k),
svg: <PlayIcon />,
});
}
Expand Down Expand Up @@ -351,7 +352,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
inProgress={(data.mediaInfo?.downloadStatus ?? []).length > 0}
tmdbId={data.mediaInfo?.tmdbId}
mediaType="movie"
plexUrl={plexUrl}
plexUrl={urlLink(plexUrl)}
serviceUrl={data.mediaInfo?.serviceUrl}
/>
{settings.currentSettings.movie4kEnabled &&
Expand All @@ -375,7 +376,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
}
tmdbId={data.mediaInfo?.tmdbId}
mediaType="movie"
plexUrl={plexUrl4k}
plexUrl={urlLink(plexUrl4k)}
serviceUrl={data.mediaInfo?.serviceUrl4k}
/>
)}
Expand Down
9 changes: 9 additions & 0 deletions src/utils/urlLink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { isMobile } from 'react-device-detect';

const jellyfinIosUrl = 'org.jellyfin.expo://';

export const urlLink = (plexUrl: string | undefined): string => {
if (isMobile)
return jellyfinIosUrl + plexUrl?.replace(new RegExp('^.*(details\\?)'), '');
return `${plexUrl}`;
};
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11518,6 +11518,13 @@ [email protected]:
"@react-aria/utils" "^3.15.0"
"@react-aria/visually-hidden" "^3.7.0"

react-device-detect@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/react-device-detect/-/react-device-detect-2.2.3.tgz#97a7ae767cdd004e7c3578260f48cf70c036e7ca"
integrity sha512-buYY3qrCnQVlIFHrC5UcUoAj7iANs/+srdkwsnNjI7anr3Tt7UY6MqNxtMLlr0tMBied0O49UZVK8XKs3ZIiPw==
dependencies:
ua-parser-js "^1.0.33"

[email protected]:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d"
Expand Down Expand Up @@ -13273,6 +13280,11 @@ typescript@^4.0, typescript@^4.6.4, typescript@^4.7:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78"
integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==

ua-parser-js@^1.0.33:
version "1.0.35"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.35.tgz#c4ef44343bc3db0a3cbefdf21822f1b1fc1ab011"
integrity sha512-fKnGuqmTBnIE+/KXSzCn4db8RTigUzw1AN0DmdU6hJovUTbYJKyqj+8Mt1c4VfRDnOVJnENmfYkIPZ946UrSAA==

uc.micro@^1.0.1:
version "1.0.6"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
Expand Down