From: Dessalines Date: Mon, 29 Mar 2021 17:20:22 +0000 (-0400) Subject: Updating to use api v3 lemmy-js-client. X-Git-Url: http://these/git/%22https:/www.exeterceilidhs.net/%22%7B%7D/%7B%7D/inbox?a=commitdiff_plain;h=9d8123eb7d77a6c45d5af9715f242c3792c44aa4;p=lemmy-ui.git Updating to use api v3 lemmy-js-client. --- diff --git a/package.json b/package.json index 0897de9..dbcd1c7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/server/index.tsx b/src/server/index.tsx index 1729f16..7873db3 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -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, }; diff --git a/src/shared/env.ts b/src/shared/env.ts index c99c000..0b094ce 100644 --- a/src/shared/env.ts +++ b/src/shared/env.ts @@ -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}`); diff --git a/yarn.lock b/yarn.lock index 9602631..b23cf79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"