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

feat(plex-login): use application name for plex product name on login #3811

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

jordanjones98
Copy link
Contributor

@jordanjones98 jordanjones98 commented Mar 13, 2024

Description

Update the Plex OAuth flow to include the application name. This allows for a tad more customization and authenticating users not being concerned about what "Overseerr" is. The plex product name shows on the plex login screen as shown in the screenshots below.

If the application name is the default Overseerr the plex product name will be Overseerr

If the application name is not the default it will be ${applicationName} - Overseerr.

Screenshot (if UI-related)

Default name of Overseerr
image

Application name of My Server
image

To-Dos

  • Successful build yarn build
  • Translation keys yarn i18n:extract
  • Database migration (if required)

@OwsleyJr
Copy link
Collaborator

The application title should probably just completely replace the default title of "Overseerr", without the dash. This is how we do it throughout the rest of the app.

Copy link
Contributor

@onedr0p onedr0p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of many ways to fix this up @OwsleyJr , if all looks good you should be able to accept my suggests and merge.

Comment on lines +33 to +35
const authToken = await plexOAuth.login(
settings.currentSettings.applicationTitle
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const authToken = await plexOAuth.login(
settings.currentSettings.applicationTitle
);
const authToken = await plexOAuth.login(
settings.currentSettings.applicationTitle || 'Overseerr'
);

@@ -40,8 +40,11 @@ class PlexOAuth {
private popup?: Window;

private authToken?: string;
private DEFAULT_APPLICATION_NAME = 'Overseerr';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private DEFAULT_APPLICATION_NAME = 'Overseerr';

Comment on lines +45 to +47
public initializeHeaders(
applicationName = this.DEFAULT_APPLICATION_NAME
): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public initializeHeaders(
applicationName = this.DEFAULT_APPLICATION_NAME
): void {
public initializeHeaders(applicationName): void {

Comment on lines +61 to +65
const plexProductName =
applicationName === this.DEFAULT_APPLICATION_NAME
? applicationName
: `${applicationName} - ${this.DEFAULT_APPLICATION_NAME}`;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const plexProductName =
applicationName === this.DEFAULT_APPLICATION_NAME
? applicationName
: `${applicationName} - ${this.DEFAULT_APPLICATION_NAME}`;

const browser = Bowser.getParser(window.navigator.userAgent);
this.plexHeaders = {
Accept: 'application/json',
'X-Plex-Product': 'Overseerr',
'X-Plex-Product': plexProductName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'X-Plex-Product': plexProductName,
'X-Plex-Product': applicationName,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants