matrix: serve the web client unconditionally; link it from the swarm domain
Removes services.hyperhive.deploy.matrix.gui.enable and its swarm.matrix.gui.enable alias; both are mkRemovedOptionModule stubs. A host running the homeserver serves fluffychat at gatewayHost's vhost, and the hive's /matrix/ redirect follows the same condition. The swarm-controller builds the Matrix quick link from swarm.matrix.gatewayHost, replacing hive-matrix.nix's per-host entry. HIVE_MATRIX_PUBLIC_URL is set on every hive with a gatewayHost, so `hivectl open matrix` resolves off the homeserver's host too. Drops HIVE_MATRIX_GUI_ENABLED and the dashboard's matrix_gui_enabled field; nothing in the frontend reads it. Refs #4885
This commit is contained in:
parent
8628e0ecdd
commit
f60f8af33b
10 changed files with 48 additions and 96 deletions
|
|
@ -537,22 +537,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
gui.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = deployCfg.matrix.enable;
|
||||
defaultText = lib.literalExpression "config.services.hyperhive.deploy.matrix.enable";
|
||||
description = ''
|
||||
Serve a matrix web client at `gatewayHost`'s vhost (`chat.<swarm-domain>`
|
||||
by default) and add the swarm UI's **Matrix** quick link to it
|
||||
(`services.hyperhive.swarm.controller.links`). Requires
|
||||
`gatewayHost != null`; the gateway itself always runs. See
|
||||
`docs/networking/gateway.md` for the discovery flow that lets clients
|
||||
auto-find the sub-domain. The client build itself is
|
||||
`deploy.matrix.gui.package` — which client, as opposed to whether
|
||||
this host serves it.
|
||||
'';
|
||||
};
|
||||
|
||||
gui.package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = fluffychat-web-fixed;
|
||||
|
|
@ -667,19 +651,6 @@ in
|
|||
# through the hive's dnsmasq whether or not the gateway fronts it.
|
||||
services.hyperhive.gateway.dns.enable = lib.mkDefault true;
|
||||
|
||||
# This swarm-ui quick-links entry. Gated on `gui.enable` too, not just
|
||||
# `gatewayHost != null`: `/` on that vhost only serves fluffychat
|
||||
# (below) when the GUI is on — otherwise the link would 404. See
|
||||
# docs/swarm/ui.md::Quick links and
|
||||
# `services.hyperhive.swarm.controller.links`'s description.
|
||||
services.hyperhive.swarm.controller.links =
|
||||
lib.optional (cfg.gatewayHost != null && deployCfg.matrix.gui.enable)
|
||||
{
|
||||
label = "Matrix";
|
||||
icon = "💬";
|
||||
url = "https://${cfg.gatewayHost}/";
|
||||
};
|
||||
|
||||
# Accept-header SPA map, used only by the `/` location below (see
|
||||
# docs/networking/gateway.md "SPA fallback"): text/html → index.html, else a
|
||||
# sentinel so `try_files` falls through to 404. `appendHttpConfig`
|
||||
|
|
@ -687,7 +658,7 @@ in
|
|||
# contributes instead of replacing it.
|
||||
#
|
||||
# The dashboard needs no equivalent — it routes by path.
|
||||
services.nginx.appendHttpConfig = lib.optionalString deployCfg.matrix.gui.enable ''
|
||||
services.nginx.appendHttpConfig = ''
|
||||
map $http_accept $matrix_spa_target {
|
||||
default "/__matrix_spa_no_html_fallback";
|
||||
"~*text/html" "/index.html";
|
||||
|
|
@ -695,8 +666,8 @@ in
|
|||
'';
|
||||
|
||||
# `server_name = gatewayHost`. `/_matrix/*` → tuwunel (CORS `*`, 50M
|
||||
# body cap, 1h long-poll timeout). `/` serves fluffychat, or 404
|
||||
# with the GUI off. nginx's longest-prefix rule puts `/_matrix/`
|
||||
# body cap, 1h long-poll timeout). `/` serves fluffychat. nginx's
|
||||
# longest-prefix rule puts `/_matrix/`
|
||||
# ahead of `/` with no ordering needed.
|
||||
#
|
||||
# ⚠️ The `.well-known/matrix/*` delegation is deliberately NOT here.
|
||||
|
|
@ -727,8 +698,6 @@ in
|
|||
add_header Access-Control-Allow-Origin *;
|
||||
'';
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs deployCfg.matrix.gui.enable {
|
||||
# fluffychat at sub-domain root, SPA-fallback via the
|
||||
# Accept-header `$matrix_spa_target` map above.
|
||||
"/" = {
|
||||
|
|
@ -746,11 +715,6 @@ in
|
|||
return 200 '{"defaultHomeserver":"${hyperhiveDomain}"}';
|
||||
'';
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs (!deployCfg.matrix.gui.enable) {
|
||||
"/" = {
|
||||
return = "404";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue