]> Untitled Git - lemmy-ui.git/blob - src/shared/utils/env/get-external-host.ts
Merge remote-tracking branch 'origin/main' into feat/add-post-body-preview-to-desktop
[lemmy-ui.git] / src / shared / utils / env / get-external-host.ts
1 import { isBrowser } from "@utils/browser";
2 import { testHost } from "../../config";
3
4 export default function getExternalHost() {
5   return isBrowser()
6     ? `${window.location.hostname}${
7         ["1234", "1235"].includes(window.location.port)
8           ? ":8536"
9           : window.location.port == ""
10           ? ""
11           : `:${window.location.port}`
12       }`
13     : process.env.LEMMY_UI_LEMMY_EXTERNAL_HOST || testHost;
14 }