|
|
@ -2,6 +2,7 @@ import PlexLogo from '@app/assets/services/plex.svg';
|
|
|
|
import Button from '@app/components/Common/Button';
|
|
|
|
import Button from '@app/components/Common/Button';
|
|
|
|
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
|
|
|
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
|
|
|
import PageTitle from '@app/components/Common/PageTitle';
|
|
|
|
import PageTitle from '@app/components/Common/PageTitle';
|
|
|
|
|
|
|
|
import Tooltip from '@app/components/Common/Tooltip';
|
|
|
|
import LanguageSelector from '@app/components/LanguageSelector';
|
|
|
|
import LanguageSelector from '@app/components/LanguageSelector';
|
|
|
|
import QuotaSelector from '@app/components/QuotaSelector';
|
|
|
|
import QuotaSelector from '@app/components/QuotaSelector';
|
|
|
|
import RegionSelector from '@app/components/RegionSelector';
|
|
|
|
import RegionSelector from '@app/components/RegionSelector';
|
|
|
@ -61,6 +62,16 @@ const messages = defineMessages({
|
|
|
|
plexwatchlistsyncseries: 'Auto-Request Series',
|
|
|
|
plexwatchlistsyncseries: 'Auto-Request Series',
|
|
|
|
plexwatchlistsyncseriestip:
|
|
|
|
plexwatchlistsyncseriestip:
|
|
|
|
'Automatically request series on your <PlexWatchlistSupportLink>Plex Watchlist</PlexWatchlistSupportLink>',
|
|
|
|
'Automatically request series on your <PlexWatchlistSupportLink>Plex Watchlist</PlexWatchlistSupportLink>',
|
|
|
|
|
|
|
|
noconnectedavailable: 'No connected services available.',
|
|
|
|
|
|
|
|
onlyloggedinuseredit:
|
|
|
|
|
|
|
|
'Only the logged in user can edit their own connected accounts.',
|
|
|
|
|
|
|
|
connectplexaccount: 'Connect Plex Account',
|
|
|
|
|
|
|
|
refreshedtoken: 'Refreshed Plex Token.',
|
|
|
|
|
|
|
|
refreshtoken: 'Refresh Token',
|
|
|
|
|
|
|
|
mustsetpasswordplex: 'You must set a password before disconnecting Plex.',
|
|
|
|
|
|
|
|
disconnectPlex: 'Disconnect Plex',
|
|
|
|
|
|
|
|
plexdisconnectedsuccess: 'Plex account disconnected.',
|
|
|
|
|
|
|
|
plexdisconnectedfailure: 'Failed to disconnect Plex account.',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const UserGeneralSettings = () => {
|
|
|
|
const UserGeneralSettings = () => {
|
|
|
@ -106,13 +117,13 @@ const UserGeneralSettings = () => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await axios.get('/api/v1/auth/plex/unlink');
|
|
|
|
await axios.get('/api/v1/auth/plex/unlink');
|
|
|
|
|
|
|
|
|
|
|
|
addToast('Plex account is no longer connected.', {
|
|
|
|
addToast(intl.formatMessage(messages.plexdisconnectedsuccess), {
|
|
|
|
appearance: 'success',
|
|
|
|
appearance: 'success',
|
|
|
|
autoDismiss: true,
|
|
|
|
autoDismiss: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
revalidateUser();
|
|
|
|
revalidateUser();
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
addToast('Failed to disconnect Plex account.', {
|
|
|
|
addToast(intl.formatMessage(messages.plexdisconnectedfailure), {
|
|
|
|
appearance: 'error',
|
|
|
|
appearance: 'error',
|
|
|
|
autoDismiss: true,
|
|
|
|
autoDismiss: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -211,55 +222,94 @@ const UserGeneralSettings = () => {
|
|
|
|
<label className="text-label">
|
|
|
|
<label className="text-label">
|
|
|
|
{intl.formatMessage(messages.connectedaccounts)}
|
|
|
|
{intl.formatMessage(messages.connectedaccounts)}
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
<div className="flex items-center rounded sm:col-span-2">
|
|
|
|
{!currentSettings.plexLoginEnabled && user?.id !== 1 && (
|
|
|
|
<div className="mr-4 flex h-7 w-7 items-center justify-center rounded-full border border-gray-700 bg-gray-800">
|
|
|
|
<div className="mb-1 text-sm font-medium leading-5 text-gray-400 sm:mt-2">
|
|
|
|
<CheckCircleIcon
|
|
|
|
<div className="flex max-w-lg items-center">
|
|
|
|
className={`w-full ${
|
|
|
|
{intl.formatMessage(messages.noconnectedavailable)}
|
|
|
|
user?.isPlexUser ? 'text-green-500' : 'text-gray-700'
|
|
|
|
</div>
|
|
|
|
}`}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<PlexLogo className="h-8 border-r border-gray-700 pr-4" />
|
|
|
|
)}
|
|
|
|
{!user?.isPlexUser ? (
|
|
|
|
{(currentSettings.plexLoginEnabled || user?.id === 1) && (
|
|
|
|
<>
|
|
|
|
<div className="flex items-center rounded sm:col-span-2">
|
|
|
|
<div className="ml-4">
|
|
|
|
<div className="mr-4 flex h-7 w-7 items-center justify-center rounded-full border border-gray-700 bg-gray-800">
|
|
|
|
<LoginWithPlex
|
|
|
|
<CheckCircleIcon
|
|
|
|
onComplete={() => {
|
|
|
|
className={`h-full w-full ${
|
|
|
|
revalidateUser();
|
|
|
|
user?.isPlexUser ? 'text-green-500' : 'text-gray-700'
|
|
|
|
}}
|
|
|
|
}`}
|
|
|
|
textOverride="Connect Plex Account"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<PlexLogo className="h-8 border-r border-gray-700 pr-4" />
|
|
|
|
</>
|
|
|
|
{user?.id !== currentUser?.id ? (
|
|
|
|
) : (
|
|
|
|
<div className="ml-4 text-sm text-gray-400">
|
|
|
|
<>
|
|
|
|
{intl.formatMessage(messages.onlyloggedinuseredit)}
|
|
|
|
<div className="ml-4">
|
|
|
|
|
|
|
|
<LoginWithPlex
|
|
|
|
|
|
|
|
onComplete={() => {
|
|
|
|
|
|
|
|
addToast('Refreshed Plex token.', {
|
|
|
|
|
|
|
|
appearance: 'success',
|
|
|
|
|
|
|
|
autoDismiss: true,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
revalidateUser();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
svgIcon={<RefreshIcon />}
|
|
|
|
|
|
|
|
textOverride="Refresh Token"
|
|
|
|
|
|
|
|
buttonSize="sm"
|
|
|
|
|
|
|
|
buttonType="primary"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<Button
|
|
|
|
) : (
|
|
|
|
type="button"
|
|
|
|
<>
|
|
|
|
className="ml-4"
|
|
|
|
{!user?.isPlexUser ? (
|
|
|
|
buttonSize="sm"
|
|
|
|
<>
|
|
|
|
onClick={() => unlinkPlex()}
|
|
|
|
<div className="ml-4">
|
|
|
|
>
|
|
|
|
<LoginWithPlex
|
|
|
|
<XCircleIcon />
|
|
|
|
onComplete={() => {
|
|
|
|
<span>Disconnect Plex</span>
|
|
|
|
revalidateUser();
|
|
|
|
</Button>
|
|
|
|
}}
|
|
|
|
</>
|
|
|
|
textOverride={intl.formatMessage(
|
|
|
|
)}
|
|
|
|
messages.connectplexaccount
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<>
|
|
|
|
|
|
|
|
<div className="ml-4">
|
|
|
|
|
|
|
|
<LoginWithPlex
|
|
|
|
|
|
|
|
onComplete={() => {
|
|
|
|
|
|
|
|
addToast(
|
|
|
|
|
|
|
|
intl.formatMessage(messages.refreshedtoken),
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
appearance: 'success',
|
|
|
|
|
|
|
|
autoDismiss: true,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
revalidateUser();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
svgIcon={<RefreshIcon />}
|
|
|
|
|
|
|
|
textOverride={intl.formatMessage(
|
|
|
|
|
|
|
|
messages.refreshtoken
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
buttonSize="sm"
|
|
|
|
|
|
|
|
buttonType="primary"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<Tooltip
|
|
|
|
|
|
|
|
content={intl.formatMessage(
|
|
|
|
|
|
|
|
messages.mustsetpasswordplex
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
// We only want to show the tooltip if the user is not a local user
|
|
|
|
|
|
|
|
disabled={user?.isLocalUser}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<span>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
|
|
className="ml-4"
|
|
|
|
|
|
|
|
buttonSize="sm"
|
|
|
|
|
|
|
|
onClick={() => unlinkPlex()}
|
|
|
|
|
|
|
|
disabled={!user?.isLocalUser}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<XCircleIcon />
|
|
|
|
|
|
|
|
<span>
|
|
|
|
|
|
|
|
{intl.formatMessage(
|
|
|
|
|
|
|
|
messages.disconnectPlex
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="form-row">
|
|
|
|
<div className="form-row">
|
|
|
|
<label className="text-label">
|
|
|
|
<label className="text-label">
|
|
|
|