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

@ -68,7 +68,7 @@
"eslint-plugin-prettier": "^3.3.1",
"husky": "^5.1.0",
"iso-639-1": "^2.1.9",
"lemmy-js-client": "0.10.0-rc.12",
"lemmy-js-client": "0.10.0-rc.13",
"lint-staged": "^10.5.4",
"mini-css-extract-plugin": "^1.3.8",
"node-fetch": "^2.6.1",

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}`);

View file

@ -5027,10 +5027,10 @@ lcid@^1.0.0:
dependencies:
invert-kv "^1.0.0"
lemmy-js-client@0.10.0-rc.12:
version "0.10.0-rc.12"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.10.0-rc.12.tgz#b00fc55f78e3544b2ecf35a363e4f6781c7acd1e"
integrity sha512-GKdSBsjSxiWe3bDPgJXiHU8WDWvTDAgYUtQah+2LSjbTxP6G1ARBoZZmIf1ZFIIEBVH6I3n5apkiECK5/veZdg==
lemmy-js-client@0.10.0-rc.13:
version "0.10.0-rc.13"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.10.0-rc.13.tgz#ea2e88857243374d7fbd49ee6b4bb94c34359d85"
integrity sha512-zodvYkwBYR7iP27ah6L/QPUphUUdq38kCH7QF2CUYBrsSAEkGmq2kdz+iusnQ1Ht7Ad80GtYycFprsZBveV5eQ==
levn@^0.4.1:
version "0.4.1"