api-prox/fix: discovery for not logged in users

This commit is contained in:
Kentai Radiquum 2025-08-28 21:47:34 +05:00
parent 09ddb71e15
commit 88664a86d1
Signed by: Radiquum
GPG key ID: 858E8EE696525EED

View file

@ -226,7 +226,9 @@ app.get("/*path", async (req, res) => {
if ( if (
!apiResponse || !apiResponse ||
!apiResponse.ok || !apiResponse.ok ||
apiResponse.headers.get("content-type") != "application/json" (apiResponse.headers.get("content-type") != "application/json" &&
apiResponse.headers.get("content-type") !=
"application/json;charset=UTF-8")
) { ) {
logger.error( logger.error(
`Failed to fetch: '${url.protocol}//${url.hostname}${url.pathname}', Path probably doesn't exist` `Failed to fetch: '${url.protocol}//${url.hostname}${url.pathname}', Path probably doesn't exist`
@ -277,7 +279,7 @@ app.post("/*path", async (req, res) => {
"application/json", "application/json",
"application/x-www-form-urlencoded", "application/x-www-form-urlencoded",
"multipart/form-data", "multipart/form-data",
"x-unknown/unknown" "x-unknown/unknown",
]; ];
const isSupported = supportedContentTypes.includes( const isSupported = supportedContentTypes.includes(
@ -335,7 +337,9 @@ app.post("/*path", async (req, res) => {
if ( if (
!apiResponse || !apiResponse ||
!apiResponse.ok || !apiResponse.ok ||
apiResponse.headers.get("content-type") != "application/json" (apiResponse.headers.get("content-type") != "application/json" &&
apiResponse.headers.get("content-type") !=
"application/json;charset=UTF-8")
) { ) {
logger.error( logger.error(
`Failed to post: '${url.protocol}//${url.hostname}${url.pathname}', Path probably doesn't exist` `Failed to post: '${url.protocol}//${url.hostname}${url.pathname}', Path probably doesn't exist`