WIP: Add matrix-hookshot #34

Draft
axeman wants to merge 3 commits from feat/matrix-hookshot into main
Showing only changes of commit 63041ec805 - Show all commits

View file

@ -6,10 +6,10 @@ let
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
''; '';
clientConfig = import ./matrix/element-client-config.nix; clientConfig = import ./matrix/element-client-config.nix;
wellKnownClient = { wellKnownClient = domain: {
"m.homeserver".base_url = "https://matrix.pub.solar"; "m.homeserver".base_url = "https://matrix.${domain}";
"m.identity_server".base_url = "https://matrix.pub.solar"; "m.identity_server".base_url = "https://matrix.${domain}";
"org.matrix.msc3575.proxy".url = "https://matrix.pub.solar/sliding-sync"; "org.matrix.msc3575.proxy".url = "https://matrix.${domain}/sliding-sync";
"im.vector.riot.e2ee".default = true; "im.vector.riot.e2ee".default = true;
"io.element.e2ee" = { "io.element.e2ee" = {
default = true; default = true;
@ -19,21 +19,21 @@ let
"m.integrations" = { "m.integrations" = {
managers = [ managers = [
{ {
api_url = "https://dimension.pub.solar/api/v1/scalar"; api_url = "https://dimension.${domain}/api/v1/scalar";
ui_url = "https://dimension.pub.solar/element"; ui_url = "https://dimension.${domain}/element";
} }
]; ];
}; };
}; };
wellKnownServer."m.server" = "matrix.pub.solar:8448"; wellKnownServer = domain: { "m.server" = "${domain}:8448"; };
mkWellKnown = data: '' mkWellKnown = data: ''
add_header Content-Type application/json; add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON data}'; return 200 '${builtins.toJSON data}';
''; '';
wellKnownLocations = { wellKnownLocations = domain: {
"= /.well-known/matrix/server".extraConfig = mkWellKnown wellKnownServer; "= /.well-known/matrix/server".extraConfig = mkWellKnown (wellKnownServer domain);
"= /.well-known/matrix/client".extraConfig = mkWellKnown wellKnownClient; "= /.well-known/matrix/client".extraConfig = mkWellKnown (wellKnownClient domain);
}; };
in in
{ {
@ -44,7 +44,7 @@ in
##################################### #####################################
"pub.solar" = { "pub.solar" = {
locations = wellKnownLocations; locations = wellKnownLocations "pub.solar";
}; };
####################################### #######################################
@ -70,7 +70,7 @@ in
gzip on; gzip on;
gzip_types text/plain application/json; gzip_types text/plain application/json;
''; '';
locations = wellKnownLocations // { locations = (wellKnownLocations "test.pub.solar") // {
# TODO: Configure metrics # TODO: Configure metrics
# "/metrics" = { # "/metrics" = {
# }; # };