mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
feat(config): ✨ Add support for HTTP proxies on outgoing requests
This commit is contained in:
parent
0ecb65de29
commit
b8b822e553
13 changed files with 225 additions and 136 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import type { ContentFormat } from "@lysand-org/federation/types";
|
||||
import { lookup } from "mime-types";
|
||||
import { config } from "~/packages/config-manager";
|
||||
|
||||
export const getBestContentType = (content?: ContentFormat) => {
|
||||
if (!content) {
|
||||
|
|
@ -51,9 +52,10 @@ export const mimeLookup = async (url: string) => {
|
|||
return naiveLookup;
|
||||
}
|
||||
|
||||
const fetchLookup = fetch(url, { method: "HEAD" }).then(
|
||||
(response) => response.headers.get("content-type") || "",
|
||||
);
|
||||
const fetchLookup = fetch(url, {
|
||||
method: "HEAD",
|
||||
proxy: config.http.proxy.address,
|
||||
}).then((response) => response.headers.get("content-type") || "");
|
||||
|
||||
return fetchLookup;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue