Replace entire codebase with homarr-labs/homarr

This commit is contained in:
Thomas Camlong
2026-01-15 21:54:44 +01:00
parent c5bc3b1559
commit 4fdd1fe351
4666 changed files with 409577 additions and 147434 deletions

25
packages/auth/redirect.ts Normal file
View File

@@ -0,0 +1,25 @@
import type { ReadonlyHeaders } from "next/dist/server/web/spec-extension/adapters/headers";
import { extractBaseUrlFromHeaders } from "@homarr/common";
/**
* The redirect_uri is constructed to work behind a reverse proxy. It is constructed from the headers x-forwarded-proto and x-forwarded-host.
* @param headers
* @param pathname
* @returns
*/
export const createRedirectUri = (
headers: ReadonlyHeaders | null,
pathname: string,
fallbackProtocol: "http" | "https" = "http",
) => {
if (!headers) {
return pathname;
}
const baseUrl = extractBaseUrlFromHeaders(headers, fallbackProtocol);
const path = pathname.startsWith("/") ? pathname : `/${pathname}`;
return `${baseUrl}${path}`;
};