%host% is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.
+
This server runs the snac software and there is no automatic sign-up process.
+
The following users are part of this community:
+
+%userlist%
+
+
This site is powered by snac.
+
diff --git a/data/server.json b/data/server.json
new file mode 100644
index 0000000..901f377
--- /dev/null
+++ b/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"
+}
\ No newline at end of file
diff --git a/data/style.css b/data/style.css
new file mode 100644
index 0000000..24be520
--- /dev/null
+++ b/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; }
diff --git a/httpd.c b/httpd.c
index 0bdd9bc..b956dcb 100644
--- a/httpd.c
+++ b/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(""
+ ""
+ "");
+ }
if (status != 0)
srv_debug(1, xs_fmt("server_get_handler serving '%s' %d", q_path, status));
--
cgit v1.2.3
From 2965f1ede4d2765c208748f3054aa61df5c48da7 Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Fri, 26 Jan 2024 16:42:20 +0000
Subject: added host-meta endpoint for subwaytooter app
---
httpd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/httpd.c b/httpd.c
index 0bdd9bc..a20d692 100644
--- a/httpd.c
+++ b/httpd.c
@@ -223,6 +223,14 @@ int server_get_handler(xs_dict *req, const char *q_path,
srv_baseurl);
}
else
+ if (strcmp(q_path, "/.well-known/host-meta") == 0) {
+ status = 200;
+ *ctype = "application/xrd+xml";
+ *body = xs_str_new(""
+ ""
+ "");
+ }
+ else
if (strcmp(q_path, "/nodeinfo_2_0") == 0) {
status = 200;
*ctype = "application/json; charset=utf-8";
--
cgit v1.2.3
From 253e627ee067b1f2504dd11c7934ce51b0a2f5b2 Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Sun, 28 Jan 2024 20:55:43 +0000
Subject: make compatible with subway tooter app
---
mastoapi.c | 24 +++++++++++++++++++++++-
xs_formdata.h | 27 +++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 xs_formdata.h
diff --git a/mastoapi.c b/mastoapi.c
index d8ec3b3..6ed3835 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -359,6 +359,12 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
}
}
+ /* no code?
+ I'm not sure of the impacts of this right now, but Subway Tooter does not
+ provide a code so one must be generated */
+ if (xs_is_null(code)){
+ code = random_str();
+ }
if (gtype && code && cid && csec && ruri) {
xs *app = app_get(cid);
@@ -1408,7 +1414,6 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
const char *type = xs_dict_get(msg, "type");
if (!xs_match(type, "Note|Question|Page|Article"))
continue;
-
const char *from = NULL;
if (strcmp(type, "Page") == 0)
from = xs_dict_get(msg, "audience");
@@ -1622,6 +1627,15 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
status = 200;
}
else
+ if (strcmp(cmd, "/v2/filters") == 0) { /** **/
+ /* snac will never have filters
+ * but still, without a v2 endpoint a short delay is introduced
+ * in some apps */
+ *body = xs_dup("[]");
+ *ctype = "application/json";
+ status = 200;
+ }
+ else
if (strcmp(cmd, "/v1/favourites") == 0) { /** **/
/* snac will never support a list of favourites */
*body = xs_dup("[]");
@@ -1990,6 +2004,14 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
if (!xs_is_null(payload))
args = xs_json_loads(payload);
}
+ else if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded"))
+ {
+ // Some apps send form data instead of json so we should cater for those
+ if (!xs_is_null(payload)) {
+ xs *upl = xs_url_dec(payload);
+ args = xs_url_vars(upl);
+ }
+ }
else
args = xs_dup(xs_dict_get(req, "p_vars"));
diff --git a/xs_formdata.h b/xs_formdata.h
new file mode 100644
index 0000000..213bd3e
--- /dev/null
+++ b/xs_formdata.h
@@ -0,0 +1,27 @@
+/* copyright (c) 2022 - 2024 grunfink et al. / MIT license */
+#include "xs.h"
+
+#ifndef _XS_FORMDATA_H
+
+#define _XS_FORMDATA_H
+
+xs_val *xs_formdata_loads(const xs_str *formdata);
+
+#ifdef XS_IMPLEMENTATION
+
+/** IMPLEMENTATION **/
+
+xs_val *xs_formdata_loads(const xs_str *formdata)
+/* loads a string in formdata format and converts to a multiple data */
+{
+ xs_val *v = NULL;
+ xs_list *args = xs_split(formdata, "&");
+ int i = 0;
+ while (){}
+ printf("args: %s\r\n", args); fflush(stdout);
+ printf("data: %s\r\n", formdata); fflush(stdout);
+}
+
+#endif /* XS_IMPLEMENTATION */
+
+#endif /* _XS_FORMDATA_H */
--
cgit v1.2.3
From 4324b842fe57554e44b7535270042d9b2f4a0001 Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Sun, 28 Jan 2024 20:58:06 +0000
Subject: remove unused xs_formdata.h file
---
xs_formdata.h | 27 ---------------------------
1 file changed, 27 deletions(-)
delete mode 100644 xs_formdata.h
diff --git a/xs_formdata.h b/xs_formdata.h
deleted file mode 100644
index 213bd3e..0000000
--- a/xs_formdata.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* copyright (c) 2022 - 2024 grunfink et al. / MIT license */
-#include "xs.h"
-
-#ifndef _XS_FORMDATA_H
-
-#define _XS_FORMDATA_H
-
-xs_val *xs_formdata_loads(const xs_str *formdata);
-
-#ifdef XS_IMPLEMENTATION
-
-/** IMPLEMENTATION **/
-
-xs_val *xs_formdata_loads(const xs_str *formdata)
-/* loads a string in formdata format and converts to a multiple data */
-{
- xs_val *v = NULL;
- xs_list *args = xs_split(formdata, "&");
- int i = 0;
- while (){}
- printf("args: %s\r\n", args); fflush(stdout);
- printf("data: %s\r\n", formdata); fflush(stdout);
-}
-
-#endif /* XS_IMPLEMENTATION */
-
-#endif /* _XS_FORMDATA_H */
--
cgit v1.2.3
From 376d849e8b69196b27f4794f1e2ca8a7866a97b1 Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Sun, 28 Jan 2024 21:02:22 +0000
Subject: cleanup
---
data/greeting.html | 13 -------------
data/server.json | 21 ---------------------
data/style.css | 27 ---------------------------
3 files changed, 61 deletions(-)
delete mode 100644 data/greeting.html
delete mode 100644 data/server.json
delete mode 100644 data/style.css
diff --git a/data/greeting.html b/data/greeting.html
deleted file mode 100644
index b664538..0000000
--- a/data/greeting.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-Welcome to %host%
-
-
%host% is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.
-
This server runs the snac software and there is no automatic sign-up process.
-
The following users are part of this community:
-
-%userlist%
-
-
This site is powered by snac.
-
diff --git a/data/server.json b/data/server.json
deleted file mode 100644
index 901f377..0000000
--- a/data/server.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "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"
-}
\ No newline at end of file
diff --git a/data/style.css b/data/style.css
deleted file mode 100644
index 24be520..0000000
--- a/data/style.css
+++ /dev/null
@@ -1,27 +0,0 @@
-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; }
--
cgit v1.2.3
From 9568ec8bfede731d2ecdc5840e3a8a125fc31510 Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Sun, 28 Jan 2024 21:04:11 +0000
Subject: cleanup
---
httpd.c | 8 --------
mastoapi.c | 1 +
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/httpd.c b/httpd.c
index 3a39481..a20d692 100644
--- a/httpd.c
+++ b/httpd.c
@@ -243,14 +243,6 @@ 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(""
- ""
- "");
- }
if (status != 0)
srv_debug(1, xs_fmt("server_get_handler serving '%s' %d", q_path, status));
diff --git a/mastoapi.c b/mastoapi.c
index 6ed3835..8a48198 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1414,6 +1414,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
const char *type = xs_dict_get(msg, "type");
if (!xs_match(type, "Note|Question|Page|Article"))
continue;
+
const char *from = NULL;
if (strcmp(type, "Page") == 0)
from = xs_dict_get(msg, "audience");
--
cgit v1.2.3
From ddfd8aaca9c3d3cb0dccf40580337a65f44413ed Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Sun, 28 Jan 2024 21:06:36 +0000
Subject: cleanup
---
mastoapi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mastoapi.c b/mastoapi.c
index 8a48198..4c39854 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -363,7 +363,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
I'm not sure of the impacts of this right now, but Subway Tooter does not
provide a code so one must be generated */
if (xs_is_null(code)){
- code = random_str();
+ code = random_str();
}
if (gtype && code && cid && csec && ruri) {
xs *app = app_get(cid);
--
cgit v1.2.3
From f0c46a7c1f6a6ac8273197ec79617f6974a1bc7b Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Sun, 28 Jan 2024 21:07:31 +0000
Subject: cleanup
---
mastoapi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mastoapi.c b/mastoapi.c
index 4c39854..abeea94 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -2008,10 +2008,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
else if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded"))
{
// Some apps send form data instead of json so we should cater for those
- if (!xs_is_null(payload)) {
+ if (!xs_is_null(payload)) {
xs *upl = xs_url_dec(payload);
args = xs_url_vars(upl);
- }
+ }
}
else
args = xs_dup(xs_dict_get(req, "p_vars"));
--
cgit v1.2.3
From d7978621ed3756dd3d021631d7f735ef0d8f39d4 Mon Sep 17 00:00:00 2001
From: Paul Wilde
Date: Sun, 28 Jan 2024 21:14:46 +0000
Subject: formatting
---
mastoapi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mastoapi.c b/mastoapi.c
index abeea94..efcdae8 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -362,9 +362,9 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
/* no code?
I'm not sure of the impacts of this right now, but Subway Tooter does not
provide a code so one must be generated */
- if (xs_is_null(code)){
- code = random_str();
- }
+ if (xs_is_null(code)){
+ code = random_str();
+ }
if (gtype && code && cid && csec && ruri) {
xs *app = app_get(cid);
--
cgit v1.2.3