diff --git a/package.json b/package.json index 95a701c4..f9e613f9 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "clean-webpack-plugin": "^4.0.0", "cookie": "^0.6.0", "copy-webpack-plugin": "^11.0.0", - "cross-fetch": "^4.0.0", "css-loader": "^6.7.3", "date-fns": "^2.30.0", "emoji-mart": "^5.4.0", diff --git a/src/server/handlers/catch-all-handler.tsx b/src/server/handlers/catch-all-handler.tsx index aacbc21d..f4fd8a45 100644 --- a/src/server/handlers/catch-all-handler.tsx +++ b/src/server/handlers/catch-all-handler.tsx @@ -2,7 +2,6 @@ import { initializeSite, isAuthPath } from "@utils/app"; import { getHttpBaseInternal } from "@utils/env"; import { ErrorPageData } from "@utils/types"; import * as cookie from "cookie"; -import fetch from "cross-fetch"; import type { Request, Response } from "express"; import { StaticRouter, matchPath } from "inferno-router"; import { renderToString } from "inferno-server"; @@ -29,7 +28,7 @@ export default async (req: Request, res: Response) => { const headers = setForwardedHeaders(req.headers); const client = wrapClient( - new LemmyHttp(getHttpBaseInternal(), { fetchFunction: fetch, headers }), + new LemmyHttp(getHttpBaseInternal(), { headers }), ); const auth = req.headers.cookie @@ -37,7 +36,8 @@ export default async (req: Request, res: Response) => { : undefined; if (auth) { - client.setHeaders({ Authorization: `Bearer ${auth}` }); + headers["Authorization"] = `Bearer ${auth}`; + client.setHeaders(headers); } const { path, url, query } = req; diff --git a/src/server/handlers/manifest-handler.ts b/src/server/handlers/manifest-handler.ts index dfc1ad8e..fced7bd6 100644 --- a/src/server/handlers/manifest-handler.ts +++ b/src/server/handlers/manifest-handler.ts @@ -1,5 +1,4 @@ import { getHttpBaseExternal, getHttpBaseInternal } from "@utils/env"; -import fetch from "cross-fetch"; import type { Request, Response } from "express"; import { LemmyHttp } from "lemmy-js-client"; import { wrapClient } from "../../shared/services/HttpService"; @@ -13,7 +12,7 @@ export default async (req: Request, res: Response) => { if (!manifest || manifest.start_url !== getHttpBaseExternal()) { const headers = setForwardedHeaders(req.headers); const client = wrapClient( - new LemmyHttp(getHttpBaseInternal(), { fetchFunction: fetch, headers }), + new LemmyHttp(getHttpBaseInternal(), { headers }), ); const site = await client.getSite(); diff --git a/src/server/utils/fetch-icon-png.ts b/src/server/utils/fetch-icon-png.ts index 75497a21..12b09e70 100644 --- a/src/server/utils/fetch-icon-png.ts +++ b/src/server/utils/fetch-icon-png.ts @@ -1,5 +1,3 @@ -import fetch from "cross-fetch"; - export async function fetchIconPng(iconUrl: string) { return await fetch(iconUrl) .then(res => res.blob()) diff --git a/yarn.lock b/yarn.lock index eb88ecb1..c51cb2f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2985,13 +2985,6 @@ cross-fetch@^3.1.5: dependencies: node-fetch "^2.6.12" -cross-fetch@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.0.0.tgz#f037aef1580bb3a1a35164ea2a848ba81b445983" - integrity sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g== - dependencies: - node-fetch "^2.6.12" - cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"