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 = {
|
gui = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = cfg.enable;
|
||||||
|
defaultText = lib.literalExpression "config.services.hyperhive.matrix.enable";
|
||||||
description = ''
|
description = ''
|
||||||
Mount a matrix web client (default `pkgs.fluffychat-web`) as
|
Mount a matrix web client (default `pkgs.fluffychat-web`) as
|
||||||
a static sibling of the dashboard at `/matrix/`, served by
|
a static sibling of the dashboard at `/matrix/`, served by
|
||||||
hive-c0re's own axum router via the `HIVE_MATRIX_GUI_DIR`
|
hive-c0re's own axum router via the `HIVE_MATRIX_GUI_DIR`
|
||||||
env var (#607 v0). Off by default; flip to `true` once the
|
env var (#607). Defaults to whatever
|
||||||
operator wants matrix chat one tab away from the dashboard
|
`services.hyperhive.matrix.enable` is — turning on the
|
||||||
without standing up a separate gateway.
|
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
|
Same-origin via hive-c0re is the simplest single-host
|
||||||
shape; the post-#15 nginx-front re-root (`https://matrix.''${services.hyperhive.domain}`)
|
shape; the post-#15 nginx-front re-root (`https://matrix.''${services.hyperhive.domain}`)
|
||||||
|
|
@ -178,15 +181,36 @@ in
|
||||||
|
|
||||||
package = lib.mkOption {
|
package = lib.mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
default = pkgs.fluffychat-web;
|
default = pkgs.fluffychat-web.overrideAttrs (old: {
|
||||||
defaultText = lib.literalExpression "pkgs.fluffychat-web";
|
# 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 = ''
|
description = ''
|
||||||
Static web client dist to serve at `/matrix/`. Defaults to
|
Static web client dist to serve at `/matrix/`. Defaults to
|
||||||
`pkgs.fluffychat-web` — first-class threads support, e2ee
|
`pkgs.fluffychat-web` (with the `<base href>` patched to
|
||||||
+ voice + spaces, full feature surface in the flutter→web
|
`/matrix/` so relative asset paths resolve under the
|
||||||
build. Override to swap for `hydrogen-web` (lightest),
|
sub-path mount, #634). Override to swap for `hydrogen-web`
|
||||||
`cinny` (no threads), `element-web` (heaviest, full
|
(lightest), `cinny` (no threads), `element-web` (heaviest,
|
||||||
features), or an out-of-tree client dist.
|
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