mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 07:41:13 +00:00
Updating to use api v3 lemmy-js-client.
This commit is contained in:
parent
1f9a721a67
commit
9d8123eb7d
4 changed files with 11 additions and 12 deletions
|
@ -68,7 +68,7 @@
|
||||||
"eslint-plugin-prettier": "^3.3.1",
|
"eslint-plugin-prettier": "^3.3.1",
|
||||||
"husky": "^5.1.0",
|
"husky": "^5.1.0",
|
||||||
"iso-639-1": "^2.1.9",
|
"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",
|
"lint-staged": "^10.5.4",
|
||||||
"mini-css-extract-plugin": "^1.3.8",
|
"mini-css-extract-plugin": "^1.3.8",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
|
|
@ -16,13 +16,13 @@ import { GetSite, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
|
||||||
import process from "process";
|
import process from "process";
|
||||||
import { Helmet } from "inferno-helmet";
|
import { Helmet } from "inferno-helmet";
|
||||||
import { initializeSite } from "../shared/initialize";
|
import { initializeSite } from "../shared/initialize";
|
||||||
import { httpUri } from "../shared/env";
|
import { httpBase } from "../shared/env";
|
||||||
import { IncomingHttpHeaders } from "http";
|
import { IncomingHttpHeaders } from "http";
|
||||||
import { setOptionalAuth } from "../shared/utils";
|
import { setOptionalAuth } from "../shared/utils";
|
||||||
|
|
||||||
const server = express();
|
const server = express();
|
||||||
const hostname = process.env['LEMMY_UI_HOST'] || 'localhost'
|
const hostname = process.env["LEMMY_UI_HOST"] || "localhost";
|
||||||
const port = process.env['LEMMY_UI_PORT'] || 1234;
|
const port = process.env["LEMMY_UI_PORT"] || 1234;
|
||||||
|
|
||||||
server.use(express.json());
|
server.use(express.json());
|
||||||
server.use(express.urlencoded({ extended: false }));
|
server.use(express.urlencoded({ extended: false }));
|
||||||
|
@ -43,7 +43,7 @@ server.get("/*", async (req, res) => {
|
||||||
let headers = setForwardedHeaders(req.headers);
|
let headers = setForwardedHeaders(req.headers);
|
||||||
|
|
||||||
let initialFetchReq: InitialFetchRequest = {
|
let initialFetchReq: InitialFetchRequest = {
|
||||||
client: new LemmyHttp(httpUri, headers),
|
client: new LemmyHttp(httpBase, headers),
|
||||||
auth,
|
auth,
|
||||||
path: req.path,
|
path: req.path,
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,9 +33,8 @@ if (isBrowser()) {
|
||||||
secure = process.env.LEMMY_HTTPS == "true" ? "s" : "";
|
secure = process.env.LEMMY_HTTPS == "true" ? "s" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpBase = `http://${host}`; // Don't use secure here
|
export const httpBase = `http://${host}`; // Don't use secure here
|
||||||
export const wsUri = `ws${secure}://${wsHost}/api/v2/ws`;
|
export const wsUri = `ws${secure}://${wsHost}/api/v3/ws`;
|
||||||
export const httpUri = `${httpBase}/api/v2`;
|
|
||||||
export const pictrsUri = `http${secure}://${host}/pictrs/image`;
|
export const pictrsUri = `http${secure}://${host}/pictrs/image`;
|
||||||
|
|
||||||
console.log(`httpbase: ${httpBase}`);
|
console.log(`httpbase: ${httpBase}`);
|
||||||
|
|
|
@ -5027,10 +5027,10 @@ lcid@^1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
invert-kv "^1.0.0"
|
invert-kv "^1.0.0"
|
||||||
|
|
||||||
lemmy-js-client@0.10.0-rc.12:
|
lemmy-js-client@0.10.0-rc.13:
|
||||||
version "0.10.0-rc.12"
|
version "0.10.0-rc.13"
|
||||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.10.0-rc.12.tgz#b00fc55f78e3544b2ecf35a363e4f6781c7acd1e"
|
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.10.0-rc.13.tgz#ea2e88857243374d7fbd49ee6b4bb94c34359d85"
|
||||||
integrity sha512-GKdSBsjSxiWe3bDPgJXiHU8WDWvTDAgYUtQah+2LSjbTxP6G1ARBoZZmIf1ZFIIEBVH6I3n5apkiECK5/veZdg==
|
integrity sha512-zodvYkwBYR7iP27ah6L/QPUphUUdq38kCH7QF2CUYBrsSAEkGmq2kdz+iusnQ1Ht7Ad80GtYycFprsZBveV5eQ==
|
||||||
|
|
||||||
levn@^0.4.1:
|
levn@^0.4.1:
|
||||||
version "0.4.1"
|
version "0.4.1"
|
||||||
|
|
Loading…
Reference in a new issue