mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 06:36:17 +00:00
Adding https flag. Fixes #7
This commit is contained in:
parent
89d15c9d09
commit
8dd3697d38
|
@ -11,36 +11,23 @@ export const externalHost = isBrowser()
|
|||
}`
|
||||
: process.env.LEMMY_EXTERNAL_HOST || testHost;
|
||||
|
||||
// ? window.location.port == '1234' || window.location.port == '1235'
|
||||
const secure = isBrowser() && window.location.protocol == 'https:' ? 's' : '';
|
||||
const secure = isBrowser()
|
||||
? window.location.protocol == 'https:'
|
||||
? 's'
|
||||
: ''
|
||||
: process.env.LEMMY_HTTPS == 'true'
|
||||
? 's'
|
||||
: '';
|
||||
|
||||
const host = isBrowser() ? externalHost : internalHost;
|
||||
|
||||
const httpBase = `http${secure}://${host}`;
|
||||
export const wsUri = `ws${secure}://${host}/api/v1/ws`;
|
||||
export const httpUri = `${httpBase}/api/v1`;
|
||||
const httpExternalUri = `http${secure}://${externalHost}`;
|
||||
export const pictrsUri = `${httpBase}/pictrs/image`;
|
||||
|
||||
console.log(`Internal host: ${internalHost}`);
|
||||
console.log(`External host: ${externalHost}`);
|
||||
|
||||
// This is for html tags, don't include port
|
||||
const httpExternalUri = `http${secure}://${externalHost.split(':')[0]}`;
|
||||
export function httpExternalPath(path: string) {
|
||||
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