hive-matrix: prefill the chat client with the server name, not the hive domain
This commit is contained in:
parent
2de07c4575
commit
1cc1cb804d
2 changed files with 21 additions and 9 deletions
|
|
@ -9,10 +9,6 @@ let
|
|||
networkCfg = config.services.hyperhive.network;
|
||||
tlsCfg = config.services.hyperhive.deploy.hive-controller.tls;
|
||||
gatewayCfg = config.services.hyperhive.gateway;
|
||||
# The hive's own domain; null on a homeserver host that runs no hive, where
|
||||
# the client is pointed at the server name instead.
|
||||
hyperhiveDomain = config.services.hyperhive.domain;
|
||||
|
||||
rootfsCheck = import ./lib/container-rootfs-check.nix { inherit config; };
|
||||
|
||||
# Same runtime→build-time bridge hive-forge and swarm-ci-runner cross:
|
||||
|
|
@ -554,14 +550,13 @@ in
|
|||
};
|
||||
# FluffyChat boot-config pre-fill so the client's
|
||||
# `.well-known/matrix/client` lookup hits the right delegation
|
||||
# endpoint. A hive host names its hive domain; a homeserver host
|
||||
# without a hive has none and names the server name.
|
||||
# endpoint. That lookup reads the server name, which the swarm apex
|
||||
# (or the hive vhost a pinned server name equals) answers for, not
|
||||
# the hive domain.
|
||||
"= /config.json" = {
|
||||
extraConfig = ''
|
||||
default_type application/json;
|
||||
return 200 '{"defaultHomeserver":"${
|
||||
if hyperhiveDomain != null then hyperhiveDomain else effectiveServerName
|
||||
}"}';
|
||||
return 200 '{"defaultHomeserver":"${effectiveServerName}"}';
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -63,6 +63,17 @@ let
|
|||
in
|
||||
lib.hasInfix "client_max_body_size 100048576;" c && !(lib.hasInfix "client_max_body_size 50M" c);
|
||||
}
|
||||
{
|
||||
# The chat client signs in against the server name, which for a default
|
||||
# swarm is the swarm domain; the hive domain (`h1.t.local`) is a vhost
|
||||
# that answers no discovery there, so a prefill of it is a dead end.
|
||||
name = "the chat client's homeserver prefill is the server name, not the hive domain";
|
||||
ok =
|
||||
let
|
||||
c = matrixBodyCap.services.nginx.virtualHosts."chat.t.local".locations."= /config.json".extraConfig;
|
||||
in
|
||||
lib.hasInfix ''{"defaultHomeserver":"t.local"}'' c && !(lib.hasInfix "h1.t.local" c);
|
||||
}
|
||||
{
|
||||
# Absence arm. A hive with no client identity gets no
|
||||
# store environment at all — the daemon reports a queue it cannot serve
|
||||
|
|
|
|||
Loading…
Reference in a new issue