mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 12:21:13 +00:00
Adding https flag. Fixes #7
This commit is contained in:
parent
89d15c9d09
commit
8dd3697d38
1 changed files with 9 additions and 22 deletions
|
@ -11,36 +11,23 @@ export const externalHost = isBrowser()
|
||||||
}`
|
}`
|
||||||
: process.env.LEMMY_EXTERNAL_HOST || testHost;
|
: process.env.LEMMY_EXTERNAL_HOST || testHost;
|
||||||
|
|
||||||
// ? window.location.port == '1234' || window.location.port == '1235'
|
const secure = isBrowser()
|
||||||
const secure = isBrowser() && window.location.protocol == 'https:' ? 's' : '';
|
? window.location.protocol == 'https:'
|
||||||
|
? 's'
|
||||||
|
: ''
|
||||||
|
: process.env.LEMMY_HTTPS == 'true'
|
||||||
|
? 's'
|
||||||
|
: '';
|
||||||
|
|
||||||
const host = isBrowser() ? externalHost : internalHost;
|
const host = isBrowser() ? externalHost : internalHost;
|
||||||
|
|
||||||
const httpBase = `http${secure}://${host}`;
|
const httpBase = `http${secure}://${host}`;
|
||||||
export const wsUri = `ws${secure}://${host}/api/v1/ws`;
|
export const wsUri = `ws${secure}://${host}/api/v1/ws`;
|
||||||
export const httpUri = `${httpBase}/api/v1`;
|
export const httpUri = `${httpBase}/api/v1`;
|
||||||
const httpExternalUri = `http${secure}://${externalHost}`;
|
|
||||||
export const pictrsUri = `${httpBase}/pictrs/image`;
|
export const pictrsUri = `${httpBase}/pictrs/image`;
|
||||||
|
|
||||||
console.log(`Internal host: ${internalHost}`);
|
// This is for html tags, don't include port
|
||||||
console.log(`External host: ${externalHost}`);
|
const httpExternalUri = `http${secure}://${externalHost.split(':')[0]}`;
|
||||||
|
|
||||||
export function httpExternalPath(path: string) {
|
export function httpExternalPath(path: string) {
|
||||||
return `${httpExternalUri}${path}`;
|
return `${httpExternalUri}${path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export const httpUri = `http${secure}://${endpoint}/api/v1`;
|
|
||||||
// export const pictrsUri = `http${secure}://${endpoint}/pictrs/image`;
|
|
||||||
|
|
||||||
// const host = isBrowser() ? window.location.hostname : localHostname;
|
|
||||||
// const secure = isBrowser() && window.location.protocol == 'https:' ? 's' : '';
|
|
||||||
// const port = isBrowser()
|
|
||||||
// ? window.location.port == '1234' || window.location.port == '1235'
|
|
||||||
// ? 8536
|
|
||||||
// : window.location.port
|
|
||||||
// : 8536;
|
|
||||||
// const endpoint = `${host}:${port}`;
|
|
||||||
//
|
|
||||||
// export const wsUri = `ws${secure}://${endpoint}/api/v1/ws`;
|
|
||||||
// export const httpUri = `http${secure}://${endpoint}/api/v1`;
|
|
||||||
// export const pictrsUri = `http${secure}://${endpoint}/pictrs/image`;
|
|
||||||
|
|
Loading…
Reference in a new issue