Browse Source

added host-meta endpoint for subwaytooter app

Paul Wilde 1 year ago
parent
commit
1060baa6ca
4 changed files with 69 additions and 0 deletions
  1. 13 0
      data/greeting.html
  2. 21 0
      data/server.json
  3. 27 0
      data/style.css
  4. 8 0
      httpd.c

+ 13 - 0
data/greeting.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html><head>
+<meta name="viewport" content="width=device-width, initial-scale=1"/>
+<title>Welcome to %host%</title>
+<body style="margin: auto; max-width: 50em">
+<p><b>%host%</b> is a <a href="https://en.wikipedia.org/wiki/Fediverse">Fediverse</a> instance that uses the <a href="https://en.wikipedia.org/wiki/ActivityPub">ActivityPub</a> protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.</p>
+<p>This server runs the <a href="https://comam.es/what-is-snac">snac</a> software and there is no automatic sign-up process.</p>
+<p>The following users are part of this community:</p>
+
+%userlist%
+
+<p>This site is powered by <abbr title="Social Networks Are Crap">snac</abbr>.</p>
+</body></html>

+ 21 - 0
data/server.json

@@ -0,0 +1,21 @@
+{
+    "prefix": "",
+    "port": 8001,
+    "dbglevel": 0,
+    "queue_retry_minutes": 2,
+    "queue_retry_max": 10,
+    "cssurls": [
+        ""
+    ],
+    "max_timeline_entries": 128,
+    "timeline_purge_days": 120,
+    "local_purge_days": 0,
+    "admin_account": "",
+    "title": "",
+    "short_description": "",
+    "fastcgi": false,
+    "layout": 2.7,
+    "address": "0.0.0.0",
+    "host": "snac.notnull.space",
+    "admin_email": "paul@notnull.space"
+}

+ 27 - 0
data/style.css

@@ -0,0 +1,27 @@
+body { max-width: 48em; margin: auto; line-height: 1.5; padding: 0.8em; word-wrap: break-word; }
+pre { overflow-x: scroll; }
+.snac-embedded-video, img { max-width: 100% }
+.snac-origin { font-size: 85% }
+.snac-score { float: right; font-size: 85% }
+.snac-top-user { text-align: center; padding-bottom: 2em }
+.snac-top-user-name { font-size: 200% }
+.snac-top-user-id { font-size: 150% }
+.snac-avatar { float: left; height: 2.5em; padding: 0.25em }
+.snac-author { font-size: 90%; text-decoration: none }
+.snac-author-tag { font-size: 80% }
+.snac-pubdate { color: #a0a0a0; font-size: 90% }
+.snac-top-controls { padding-bottom: 1.5em }
+.snac-post { border-top: 1px solid #a0a0a0; }
+.snac-children { padding-left: 2em; border-left: 1px solid #a0a0a0; }
+.snac-textarea { font-family: inherit; width: 100% }
+.snac-history { border: 1px solid #606060; border-radius: 3px; margin: 2.5em 0; padding: 0 2em }
+.snac-btn-mute { float: right; margin-left: 0.5em }
+.snac-btn-unmute { float: right; margin-left: 0.5em }
+.snac-btn-follow { float: right; margin-left: 0.5em }
+.snac-btn-unfollow { float: right; margin-left: 0.5em }
+.snac-btn-hide { float: right; margin-left: 0.5em }
+.snac-btn-delete { float: right; margin-left: 0.5em }
+.snac-btn-limit { float: right; margin-left: 0.5em }
+.snac-btn-unlimit { float: right; margin-left: 0.5em }
+.snac-footer { margin-top: 2em; font-size: 75% }
+.snac-poll-result { margin-left: auto; margin-right: auto; }

+ 8 - 0
httpd.c

@@ -235,6 +235,14 @@ int server_get_handler(xs_dict *req, const char *q_path,
         *body  = xs_str_new("User-agent: *\n"
                             "Disallow: /\n");
     }
+    else
+    if (strcmp(q_path, "/.well-known/host-meta") == 0) {
+        status = 200;
+        *ctype = "application/xrd+xml";
+        *body  = xs_str_new("<XRD>"
+                "<Link rel=\"lrdd\" type=\"application/xrd+xml\" template=\"%s/.well-known/webfinger?resource={uri}\"/>"
+                "</XRD>");
+    }
 
     if (status != 0)
         srv_debug(1, xs_fmt("server_get_handler serving '%s' %d", q_path, status));