mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 15:48:11 +00:00
feat: WIP element Chat intergration
This commit is contained in:
9
infrastructure/matrix/element/Dockerfile
Normal file
9
infrastructure/matrix/element/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
#
|
||||
# EDR internal chat web client. Unmodified upstream Element Web + our public,
|
||||
# non-secret config (homeserver URL, branding) and the SSO handoff page.
|
||||
# Pin the tag; never float on `latest`.
|
||||
FROM ghcr.io/element-hq/element-web:v1.11.108
|
||||
|
||||
COPY config.json /app/config.json
|
||||
COPY sso.html /app/sso.html
|
||||
17
infrastructure/matrix/element/config.json
Normal file
17
infrastructure/matrix/element/config.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": "https://matrix.edr.et",
|
||||
"server_name": "matrix.edr.et"
|
||||
}
|
||||
},
|
||||
"brand": "EDR Chat",
|
||||
"permalink_prefix": "https://chat.edr.et",
|
||||
"disable_guests": true,
|
||||
"disable_3pid_login": true,
|
||||
"disable_custom_urls": true,
|
||||
"default_theme": "light",
|
||||
"settingDefaults": {
|
||||
"UIFeature.registration": false
|
||||
}
|
||||
}
|
||||
36
infrastructure/matrix/element/sso.html
Normal file
36
infrastructure/matrix/element/sso.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Element only honours a `?loginToken=` on `/` if `mx_sso_hs_url` is already
|
||||
in localStorage (element-web apps/web/src/Lifecycle.ts attemptTokenLogin,
|
||||
key defined in apps/web/src/BasePlatform.ts). Normally that key is written
|
||||
by Element itself at the start of an SSO redirect; freight-api's SSO
|
||||
handoff skips that redirect (it already knows the homeserver), so this
|
||||
page seeds the key by hand and forwards straight to the login-token URL.
|
||||
|
||||
freight-api's chat-sso.service.ts links here as
|
||||
https://chat.edr.et/sso.html?t=<login_token>&hs=<homeserver base_url>.
|
||||
`hs` is passed rather than hardcoded so this file doesn't need to change if
|
||||
MATRIX_PUBLIC_BASEURL ever does.
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Signing in to EDR Chat…</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var params = new URLSearchParams(window.location.search);
|
||||
var token = params.get("t");
|
||||
var homeserver = params.get("hs");
|
||||
if (token && homeserver) {
|
||||
localStorage.setItem("mx_sso_hs_url", homeserver);
|
||||
window.location.replace(
|
||||
"/?loginToken=" + encodeURIComponent(token),
|
||||
);
|
||||
} else {
|
||||
document.body.textContent =
|
||||
"Missing sign-in token. Go back to the EDR backoffice and click Chat again.";
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user