Compare commits

...

4 Commits

Author SHA1 Message Date
fallenbagel
95980dc7c2 refactor(i8n): changes the i8n message to use Jellyseerr for future ease of extraction 2024-05-13 20:43:10 +05:00
fallenbagel
82c252df31 refactor(auth): error message for a more consistent format 2024-05-13 20:37:40 +05:00
fallenbagel
9576bc2edf refactor(i8n): extract translation keys 2024-05-13 20:30:44 +05:00
fallenbagel
88a5c7f1dc fix(logging): handle media server connection refused error/toast
Properly log as connection refused if the jellyfin/emby server is unreachable. Previously it used to
throw a credentials error which lead to a lot of confusion
2024-05-13 20:21:38 +05:00
5 changed files with 32 additions and 8 deletions

View File

@@ -131,7 +131,11 @@ class JellyfinAPI {
);
return account.data;
} catch (e) {
throw new Error('Unauthorized');
if (e.code === 'ECONNREFUSED') {
throw new Error('Connection_refused');
} else {
throw new Error('Unauthorized');
}
}
}

View File

@@ -443,6 +443,20 @@ authRoutes.post('/jellyfin', async (req, res, next) => {
status: 406,
message: 'CREDENTIAL_ERROR_NO_SERVER_TYPE',
});
} else if (e.message === 'Connection_refused') {
logger.error(
`Unable to connect to ${
process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin'
} server`,
{
label: 'Auth',
hostname: body.hostname,
}
);
return next({
status: 503,
message: 'CONNECTION_REFUSED',
});
} else {
logger.error(e.message, { label: 'Auth' });
return next({

View File

@@ -26,6 +26,7 @@ const messages = defineMessages({
loginerror: 'Something went wrong while trying to sign in.',
adminerror: 'You must use an admin account to sign in.',
credentialerror: 'The username or password is incorrect.',
connectionrefusederror: 'Unable to connect to {mediaServerName} server.',
signingin: 'Signing in…',
signin: 'Sign In',
initialsigningin: 'Connecting…',
@@ -97,7 +98,10 @@ const JellyfinLogin: React.FC<JellyfinLoginProps> = ({
? messages.credentialerror
: e.message == 'Request failed with status code 403'
? messages.adminerror
: messages.loginerror
: e.message == 'Request failed with status code 503'
? messages.connectionrefusederror
: messages.loginerror,
mediaServerFormatValues
),
{
autoDismiss: true,

View File

@@ -28,7 +28,7 @@ const messages = defineMessages({
plex: 'Plex',
plexsettings: 'Plex Settings',
plexsettingsDescription:
'Configure the settings for your Plex server. Overseerr scans your Plex libraries to determine content availability.',
'Configure the settings for your Plex server. Jellyseerr scans your Plex libraries to determine content availability.',
serverpreset: 'Server',
serverLocal: 'local',
serverRemote: 'remote',

View File

@@ -219,8 +219,9 @@
"components.Layout.VersionStatus.outofdate": "Out of Date",
"components.Layout.VersionStatus.streamdevelop": "Jellyseerr Develop",
"components.Layout.VersionStatus.streamstable": "Jellyseerr Stable",
"components.Login.credentialerror": "The username or password is incorrect.",
"components.Login.adminerror": "You must use an admin account to sign in.",
"components.Login.connectionrefusederror": "Unable to connect to {mediaServerName} server.",
"components.Login.credentialerror": "The username or password is incorrect.",
"components.Login.description": "Since this is your first time logging into {applicationName}, you are required to add a valid email address.",
"components.Login.email": "Email Address",
"components.Login.emailtooltip": "Address does not need to be associated with your {mediaServerName} instance.",
@@ -752,8 +753,8 @@
"components.Settings.SettingsAbout.overseerrinformation": "About Jellyseerr",
"components.Settings.SettingsAbout.preferredmethod": "Preferred",
"components.Settings.SettingsAbout.runningDevelop": "You are running the <code>develop</code> branch of Jellyseerr, which is only recommended for those contributing to development or assisting with bleeding-edge testing.",
"components.Settings.SettingsAbout.supportoverseerr": "Support Overseerr",
"components.Settings.SettingsAbout.supportjellyseerr": "Support Jellyseerr",
"components.Settings.SettingsAbout.supportoverseerr": "Support Overseerr",
"components.Settings.SettingsAbout.timezone": "Time Zone",
"components.Settings.SettingsAbout.totalmedia": "Total Media",
"components.Settings.SettingsAbout.totalrequests": "Total Requests",
@@ -938,17 +939,18 @@
"components.Settings.hostname": "Hostname or IP Address",
"components.Settings.internalUrl": "Internal URL",
"components.Settings.is4k": "4K",
"components.Settings.jellyfinForgotPasswordUrl": "Forgot Password URL",
"components.Settings.jellyfinSettings": "{mediaServerName} Settings",
"components.Settings.jellyfinSettingsDescription": "Optionally configure the internal and external endpoints for your {mediaServerName} server. In most cases, the external URL is different to the internal URL. A custom password reset URL can also be set for {mediaServerName} login, in case you would like to redirect to a different password reset page.",
"components.Settings.jellyfinSettingsFailure": "Something went wrong while saving {mediaServerName} settings.",
"components.Settings.jellyfinSettingsSuccess": "{mediaServerName} settings saved successfully!",
"components.Settings.jellyfinSyncFailedAutomaticGroupedFolders": "Custom authentication with Automatic Library Grouping not supported",
"components.Settings.jellyfinSyncFailedGenericError": "Something went wrong while syncing libraries",
"components.Settings.jellyfinSyncFailedNoLibrariesFound": "No libraries were found",
"components.Settings.jellyfinlibraries": "{mediaServerName} Libraries",
"components.Settings.jellyfinlibrariesDescription": "The libraries {mediaServerName} scans for titles. Click the button below if no libraries are listed.",
"components.Settings.jellyfinsettings": "{mediaServerName} Settings",
"components.Settings.jellyfinsettingsDescription": "Configure the settings for your {mediaServerName} server. {mediaServerName} scans your {mediaServerName} libraries to see what content is available.",
"components.Settings.jellyfinSyncFailedNoLibrariesFound": "No libraries were found",
"components.Settings.jellyfinSyncFailedAutomaticGroupedFolders": "Custom authentication with Automatic Library Grouping not supported",
"components.Settings.jellyfinSyncFailedGenericError": "Something went wrong while syncing libraries",
"components.Settings.librariesRemaining": "Libraries Remaining: {count}",
"components.Settings.manualscan": "Manual Library Scan",
"components.Settings.manualscanDescription": "Normally, this will only be run once every 24 hours. Jellyseerr will check your Plex server's recently added more aggressively. If this is your first time configuring Plex, a one-time full manual library scan is recommended!",