mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-18 03:40:23 +01:00
Merge pull request #315 from herrrta/fix/more-jellyseerr-logs
More logs on failed jellyseerr status test
This commit is contained in:
@@ -160,6 +160,9 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
|
|||||||
setJellyseerrUser(user);
|
setJellyseerrUser(user);
|
||||||
updateSettings({jellyseerrServerUrl})
|
updateSettings({jellyseerrServerUrl})
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
toast.error("Failed to login to jellyseerr!")
|
||||||
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setJellyseerrPassword(undefined);
|
setJellyseerrPassword(undefined);
|
||||||
})
|
})
|
||||||
@@ -725,6 +728,8 @@ export const SettingToggles: React.FC<Props> = ({ ...props }) => {
|
|||||||
<Text className="text-xs opacity-50">
|
<Text className="text-xs opacity-50">
|
||||||
Set the URL for your jellyseerr instance.
|
Set the URL for your jellyseerr instance.
|
||||||
</Text>
|
</Text>
|
||||||
|
<Text className="text-xs text-gray-600">Example: http(s)://your-host.url</Text>
|
||||||
|
<Text className="text-xs text-gray-600 mb-1">(add port if required)</Text>
|
||||||
<Text className="text-xs text-red-600">This integration is in its early stages. Expect things to change.</Text>
|
<Text className="text-xs text-red-600">This integration is in its early stages. Expect things to change.</Text>
|
||||||
</View>
|
</View>
|
||||||
<Input
|
<Input
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {SeasonWithEpisodes, TvDetails} from "@/utils/jellyseerr/server/models/Tv
|
|||||||
import {IssueStatus, IssueType} from "@/utils/jellyseerr/server/constants/issue";
|
import {IssueStatus, IssueType} from "@/utils/jellyseerr/server/constants/issue";
|
||||||
import Issue from "@/utils/jellyseerr/server/entity/Issue";
|
import Issue from "@/utils/jellyseerr/server/entity/Issue";
|
||||||
import {RTRating} from "@/utils/jellyseerr/server/api/rating/rottentomatoes";
|
import {RTRating} from "@/utils/jellyseerr/server/api/rating/rottentomatoes";
|
||||||
|
import {writeErrorLog} from "@/utils/log";
|
||||||
|
|
||||||
interface SearchParams {
|
interface SearchParams {
|
||||||
query: string,
|
query: string,
|
||||||
@@ -102,6 +103,12 @@ export class JellyseerrApi {
|
|||||||
requiresPass: true
|
requiresPass: true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
toast.error(`Jellyseerr test failed. Please try again.`);
|
||||||
|
writeErrorLog(
|
||||||
|
`Jellyseerr returned a ${status} for url:\n` +
|
||||||
|
response.config.url + '\n' +
|
||||||
|
JSON.stringify(response.data)
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
isValid: false,
|
isValid: false,
|
||||||
requiresPass: false
|
requiresPass: false
|
||||||
@@ -122,7 +129,9 @@ export class JellyseerrApi {
|
|||||||
password,
|
password,
|
||||||
email: username
|
email: username
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
const user = response.data;
|
const user = response?.data;
|
||||||
|
if (!user)
|
||||||
|
throw Error("Login failed")
|
||||||
storage.setAny(JELLYSEERR_USER, user);
|
storage.setAny(JELLYSEERR_USER, user);
|
||||||
return user
|
return user
|
||||||
})
|
})
|
||||||
@@ -186,6 +195,27 @@ export class JellyseerrApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setInterceptors() {
|
private setInterceptors() {
|
||||||
|
this.axios.interceptors.response.use(
|
||||||
|
async (response) => {
|
||||||
|
const cookies = response.headers["set-cookie"];
|
||||||
|
if (cookies) {
|
||||||
|
storage.setAny(JELLYSEERR_COOKIES, response.headers["set-cookie"]?.flatMap(c => c.split("; ")));
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
(error: AxiosError) => {
|
||||||
|
const errorMsg = "Jellyseerr response error:";
|
||||||
|
console.error(errorMsg, error, error.response?.data);
|
||||||
|
writeErrorLog(
|
||||||
|
errorMsg + ` ${error.toString()}\n` +
|
||||||
|
JSON.stringify(error.response?.data)
|
||||||
|
);
|
||||||
|
if (error.status === 403) {
|
||||||
|
clearJellyseerrStorageData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.axios.interceptors.request.use(
|
this.axios.interceptors.request.use(
|
||||||
async (config) => {
|
async (config) => {
|
||||||
const cookies = storage.get<string[]>(JELLYSEERR_COOKIES);
|
const cookies = storage.get<string[]>(JELLYSEERR_COOKIES);
|
||||||
@@ -204,22 +234,6 @@ export class JellyseerrApi {
|
|||||||
console.error("Jellyseerr request error", error)
|
console.error("Jellyseerr request error", error)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.axios.interceptors.response.use(
|
|
||||||
async (response) => {
|
|
||||||
const cookies = response.headers["set-cookie"];
|
|
||||||
if (cookies) {
|
|
||||||
storage.setAny(JELLYSEERR_COOKIES, response.headers["set-cookie"]?.flatMap(c => c.split("; ")));
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
},
|
|
||||||
(error: AxiosError) => {
|
|
||||||
console.error("Jellyseerr response error:", error,error.response?.data)
|
|
||||||
if (error.status === 403) {
|
|
||||||
clearJellyseerrStorageData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user