add MATRIX_PROTOCOL option

This commit is contained in:
hippoz 2022-10-10 18:55:28 +03:00
parent 7d0d29bb8b
commit 95eb80d6da
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -9,6 +9,7 @@ import sendMessage from "../../impl";
const router = express.Router(); const router = express.Router();
const matrixProtocol = process.env.MATRIX_PROTOCOL ? process.env.MATRIX_PROTOCOL : "http";
const matrixHomeserverBaseUrl = process.env.MATRIX_HOMESERVER_BASE_URL ? process.env.MATRIX_HOMESERVER_BASE_URL : "localhost:3000"; const matrixHomeserverBaseUrl = process.env.MATRIX_HOMESERVER_BASE_URL ? process.env.MATRIX_HOMESERVER_BASE_URL : "localhost:3000";
const matrixWaffleAppUrl = process.env.MATRIX_WAFFLE_APP_URL ? process.env.MATRIX_WAFFLE_APP_URL : "localhost:3000"; const matrixWaffleAppUrl = process.env.MATRIX_WAFFLE_APP_URL ? process.env.MATRIX_WAFFLE_APP_URL : "localhost:3000";
const matrixDeviceId = "xyz.hippoz.waffle.generic_matrix_client.device"; const matrixDeviceId = "xyz.hippoz.waffle.generic_matrix_client.device";
@ -155,7 +156,7 @@ router.use((_req, res, next) => {
router.get("/.well-known/matrix/client", (req, res) => { router.get("/.well-known/matrix/client", (req, res) => {
res.json({ res.json({
"m.homeserver": { "m.homeserver": {
"base_url": `http://${matrixHomeserverBaseUrl}` "base_url": `${matrixProtocol}://${matrixHomeserverBaseUrl}`
}, },
"xyz.hippoz.waffle": { "xyz.hippoz.waffle": {
"app_url": matrixWaffleAppUrl "app_url": matrixWaffleAppUrl