matrix: default gui.enable to matrix.enable + patch fluffychat-web base href for /matrix/ subpath (#634)
This commit is contained in:
parent
f943976f14
commit
433c972db1
1 changed files with 35 additions and 11 deletions
|
|
@ -159,14 +159,17 @@ in
|
|||
gui = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
default = cfg.enable;
|
||||
defaultText = lib.literalExpression "config.services.hyperhive.matrix.enable";
|
||||
description = ''
|
||||
Mount a matrix web client (default `pkgs.fluffychat-web`) as
|
||||
a static sibling of the dashboard at `/matrix/`, served by
|
||||
hive-c0re's own axum router via the `HIVE_MATRIX_GUI_DIR`
|
||||
env var (#607 v0). Off by default; flip to `true` once the
|
||||
operator wants matrix chat one tab away from the dashboard
|
||||
without standing up a separate gateway.
|
||||
env var (#607). Defaults to whatever
|
||||
`services.hyperhive.matrix.enable` is — turning on the
|
||||
homeserver gives you the web client by default; set to
|
||||
`false` explicitly to opt out of the GUI while keeping
|
||||
the homeserver running for agents.
|
||||
|
||||
Same-origin via hive-c0re is the simplest single-host
|
||||
shape; the post-#15 nginx-front re-root (`https://matrix.''${services.hyperhive.domain}`)
|
||||
|
|
@ -178,15 +181,36 @@ in
|
|||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.fluffychat-web;
|
||||
defaultText = lib.literalExpression "pkgs.fluffychat-web";
|
||||
default = pkgs.fluffychat-web.overrideAttrs (old: {
|
||||
# fluffychat-web ships with `<base href="/">` baked into its
|
||||
# index.html — that's the placeholder flutter would replace
|
||||
# via `--base-href` at build time. Since hyperhive serves the
|
||||
# dist at `/matrix/` (not the document root), the literal
|
||||
# `<base href="/">` would resolve every relative asset path
|
||||
# (`Imaging.js`, `flutter.js`, `splash/*`, etc.) against the
|
||||
# ROOT of the origin, leading to 404s on every load (#634).
|
||||
# Patch the placeholder to `<base href="/matrix/">` at install
|
||||
# time so the SPA boots correctly under the sub-path mount.
|
||||
# If/when we move to subdomain routing (#609 −
|
||||
# `matrix.${hyperhiveDomain}`), drop this override and revert
|
||||
# to upstream `pkgs.fluffychat-web` — it'll be at the root
|
||||
# again.
|
||||
postInstall = (old.postInstall or "") + ''
|
||||
${pkgs.gnused}/bin/sed -i \
|
||||
's|<base href="/">|<base href="/matrix/">|' \
|
||||
$out/index.html
|
||||
'';
|
||||
});
|
||||
defaultText = lib.literalExpression "pkgs.fluffychat-web (patched for /matrix/ base href)";
|
||||
description = ''
|
||||
Static web client dist to serve at `/matrix/`. Defaults to
|
||||
`pkgs.fluffychat-web` — first-class threads support, e2ee
|
||||
+ voice + spaces, full feature surface in the flutter→web
|
||||
build. Override to swap for `hydrogen-web` (lightest),
|
||||
`cinny` (no threads), `element-web` (heaviest, full
|
||||
features), or an out-of-tree client dist.
|
||||
`pkgs.fluffychat-web` (with the `<base href>` patched to
|
||||
`/matrix/` so relative asset paths resolve under the
|
||||
sub-path mount, #634). Override to swap for `hydrogen-web`
|
||||
(lightest), `cinny` (no threads), `element-web` (heaviest,
|
||||
full features), or an out-of-tree client dist — any
|
||||
replacement also needs its `<base href>` aligned with the
|
||||
mount path.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue