mirror of
https://github.com/sct/overseerr.git
synced 2025-09-29 21:51:46 +02:00
When opening plex Oauth window, open an empty page then redirect to plex oauth (#127)
* feat(frontend): custom toast * refactor(frontend): move toast width styling to globals * feat(frontend): add loading spinner for browser popup
This commit is contained in:
@@ -55,7 +55,7 @@ const CoreApp: Omit<NextAppComponentType, 'origGetInitialProps'> = ({
|
|||||||
setCookie(null, 'locale', currentLocale, { path: '/' });
|
setCookie(null, 'locale', currentLocale, { path: '/' });
|
||||||
}, [currentLocale]);
|
}, [currentLocale]);
|
||||||
|
|
||||||
if (router.asPath === '/login') {
|
if (router.pathname.match(/(login|setup)/)) {
|
||||||
component = <Component {...pageProps} />;
|
component = <Component {...pageProps} />;
|
||||||
} else {
|
} else {
|
||||||
component = (
|
component = (
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { NextPage } from 'next';
|
import type { NextPage } from 'next';
|
||||||
import Login from '../components/Login';
|
import Login from '../../components/Login';
|
||||||
|
|
||||||
const LoginPage: NextPage = () => {
|
const LoginPage: NextPage = () => {
|
||||||
return <Login />;
|
return <Login />;
|
12
src/pages/login/plex/loading.tsx
Normal file
12
src/pages/login/plex/loading.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import LoadingSpinner from '../../../components/Common/LoadingSpinner';
|
||||||
|
|
||||||
|
const PlexLoading: React.FC = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<LoadingSpinner />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PlexLoading;
|
@@ -182,8 +182,10 @@ class PlexOAuth {
|
|||||||
: screen.height;
|
: screen.height;
|
||||||
const left = width / 2 - w / 2 + dualScreenLeft;
|
const left = width / 2 - w / 2 + dualScreenLeft;
|
||||||
const top = height / 2 - h / 2 + dualScreenTop;
|
const top = height / 2 - h / 2 + dualScreenTop;
|
||||||
|
|
||||||
|
//Set url to login/plex/loading so browser doesn't block popup
|
||||||
const newWindow = window.open(
|
const newWindow = window.open(
|
||||||
url,
|
'/login/plex/loading',
|
||||||
title,
|
title,
|
||||||
'scrollbars=yes, width=' +
|
'scrollbars=yes, width=' +
|
||||||
w +
|
w +
|
||||||
@@ -197,6 +199,9 @@ class PlexOAuth {
|
|||||||
if (newWindow) {
|
if (newWindow) {
|
||||||
newWindow.focus();
|
newWindow.focus();
|
||||||
this.popup = newWindow;
|
this.popup = newWindow;
|
||||||
|
setTimeout(() => {
|
||||||
|
newWindow.location.href = url;
|
||||||
|
}, 1500);
|
||||||
return this.popup;
|
return this.popup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user