]> Untitled Git - lemmy-ui.git/blob - src/shared/env.ts
Upgrading deps, cleaning up package.json.
[lemmy-ui.git] / src / shared / env.ts
1 import { isBrowser } from './utils';
2
3 const host = isBrowser() ? window.location.hostname : 'localhost';
4 const secure = isBrowser() && window.location.protocol == 'https:' ? 's' : '';
5 const port = isBrowser()
6   ? window.location.port == '1234'
7     ? 8536
8     : window.location.port
9   : 8536;
10 const endpoint = `${host}:${port}`;
11
12 export const wsUri = `ws${secure}://${endpoint}/api/v1/ws`;
13 export const httpUri = `http${secure}://${endpoint}/api/v1`;