Browse Source

added generator for xep-0156 discovery files

Dominik 1 year ago
parent
commit
91c43f3945
2 changed files with 32 additions and 0 deletions
  1. 2 0
      data/www/.well-known/.gitignore
  2. 30 0
      entrypoint.sh

+ 2 - 0
data/www/.well-known/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 30 - 0
entrypoint.sh

@@ -1,4 +1,6 @@
 #!/bin/sh
+
+# Generate configuration file with host-specific parameters
 cat << EOF > ~/env.yml
 define_macro:
   HOSTNAME: $HOSTNAME
@@ -12,5 +14,33 @@ define_macro:
 EOF
 cat ~/env.yml
 
+# Generate discovery file for XEP-0156 in XML format
+cat << EOF > ~/www/.well-known/host-meta
+<?xml version='1.0' encoding='utf-8'?>
+<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
+  <Link rel="urn:xmpp:alt-connections:xbosh"
+        href="https://$HOSTNAME:5443/bosh" />
+  <Link rel="urn:xmpp:alt-connections:websocket"
+        href="wss://$HOSTNAME:5443/ws" />
+</XRD>
+EOF
+
+# Generate discovery file for XEP-0156 in JSON format
+cat << EOF > ~/www/.well-known/host-meta.json
+{
+  "links": [
+    {
+      "rel": "urn:xmpp:alt-connections:xbosh",
+      "href": "https://$HOSTNAME:5443/bosh"
+    },
+    {
+      "rel": "urn:xmpp:alt-connections:websocket",
+      "href": "wss://$HOSTNAME:5443/ws"
+    }
+  ]
+}
+EOF
+
+
 # Run ejabberdctl as done in the original entrypoint from the dockerfile
 /home/ejabberd/bin/ejabberdctl "$@"