Updating to use api v3 lemmy-js-client.

This commit is contained in:
Dessalines 2021-03-29 13:20:22 -04:00
parent 1f9a721a67
commit 9d8123eb7d
4 changed files with 11 additions and 12 deletions

View file

@ -16,13 +16,13 @@ import { GetSite, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
import process from "process";
import { Helmet } from "inferno-helmet";
import { initializeSite } from "../shared/initialize";
import { httpUri } from "../shared/env";
import { httpBase } from "../shared/env";
import { IncomingHttpHeaders } from "http";
import { setOptionalAuth } from "../shared/utils";
const server = express();
const hostname = process.env['LEMMY_UI_HOST'] || 'localhost'
const port = process.env['LEMMY_UI_PORT'] || 1234;
const hostname = process.env["LEMMY_UI_HOST"] || "localhost";
const port = process.env["LEMMY_UI_PORT"] || 1234;
server.use(express.json());
server.use(express.urlencoded({ extended: false }));
@ -43,7 +43,7 @@ server.get("/*", async (req, res) => {
let headers = setForwardedHeaders(req.headers);
let initialFetchReq: InitialFetchRequest = {
client: new LemmyHttp(httpUri, headers),
client: new LemmyHttp(httpBase, headers),
auth,
path: req.path,
};

View file

@ -33,9 +33,8 @@ if (isBrowser()) {
secure = process.env.LEMMY_HTTPS == "true" ? "s" : "";
}
const httpBase = `http://${host}`; // Don't use secure here
export const wsUri = `ws${secure}://${wsHost}/api/v2/ws`;
export const httpUri = `${httpBase}/api/v2`;
export const httpBase = `http://${host}`; // Don't use secure here
export const wsUri = `ws${secure}://${wsHost}/api/v3/ws`;
export const pictrsUri = `http${secure}://${host}/pictrs/image`;
console.log(`httpbase: ${httpBase}`);