mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-22 19:01:26 +00:00
Co-authored-by: SleeplessOne1917 <insomnia_void@protonmail.com>
This commit is contained in:
parent
48ed65639a
commit
5ec9baa5a5
5 changed files with 4 additions and 15 deletions
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import fetch from "cross-fetch";
|
||||
|
||||
export async function fetchIconPng(iconUrl: string) {
|
||||
return await fetch(iconUrl)
|
||||
.then(res => res.blob())
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue