diff options
author | iwojim0 <iwo_jim0@protonmail.com> | 2024-03-09 14:37:54 +0000 |
---|---|---|
committer | iwojim0 <iwo_jim0@protonmail.com> | 2024-03-09 14:37:54 +0000 |
commit | 7312f4ce51100d4ed98988cb3af0ab06e4fba53c (patch) | |
tree | b9fe2c67d8d98605d5376bbad6ffe87ef29c1990 | |
parent | 951e6b23151d298d9babeec81bc9926c11bdb3b3 (diff) |
Ability to federate with hidden networks #93 (update for v2.49)
-rw-r--r-- | activitypub.c | 4 | ||||
-rw-r--r-- | data.c | 5 | ||||
-rw-r--r-- | html.c | 2 | ||||
-rw-r--r-- | http.c | 3 | ||||
-rw-r--r-- | mastoapi.c | 2 | ||||
-rw-r--r-- | webfinger.c | 9 |
6 files changed, 14 insertions, 11 deletions
diff --git a/activitypub.c b/activitypub.c index 1976012..73fbbc6 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1228,7 +1228,7 @@ xs_dict *msg_actor(snac *snac) xs *k2 = encode_html(k); xs *v2 = NULL; - if (xs_startswith(v, "https:")) { + if (xs_startswith(v, "http")) { xs *t = encode_html(v); v2 = xs_fmt("<a href=\"%s\" rel=\"me\">%s</a>", t, t); } @@ -1320,7 +1320,7 @@ xs_dict *msg_follow(snac *snac, const char *q) xs *url_or_uid = xs_strip_i(xs_str_new(q)); - if (xs_startswith(url_or_uid, "https:/")) + if (xs_startswith(url_or_uid, "http")) actor = xs_dup(url_or_uid); else if (!valid_status(webfinger_request(url_or_uid, &actor, NULL)) || actor == NULL) { @@ -67,7 +67,7 @@ int srv_open(char *basedir, int auto_upgrade) if (host == NULL || prefix == NULL) error = xs_str_new("ERROR: cannot get server data"); else { - srv_baseurl = xs_fmt("https://%s%s", host, prefix); + srv_baseurl = xs_fmt("http://%s%s", host, prefix); dbglevel = (int) xs_number_get(dbglvl); @@ -1944,7 +1944,8 @@ xs_list *inbox_list(void) xs_str *_instance_block_fn(const char *instance) { - xs *s1 = xs_replace(instance, "https:/" "/", ""); + xs *s = xs_replace(instance, "http:/" "/", ""); + xs *s1 = xs_replace(s, "https:/" "/", ""); xs *l = xs_split(s1, "/"); char *p = xs_list_get(l, 0); xs *md5 = xs_md5_hex(p, strlen(p)); @@ -783,7 +783,7 @@ static xs_html *html_user_body(snac *user, int read_only) while (xs_dict_next(metadata, &k, &v, &c)) { xs_html *value; - if (xs_startswith(v, "https:/" "/")) { + if (xs_startswith(v, "http")) { /* is this link validated? */ xs *verified_link = NULL; xs_number *val_time = xs_dict_get(val_links, v); @@ -32,7 +32,8 @@ xs_dict *http_signed_request_raw(const char *keyid, const char *seckey, date = xs_str_utctime(0, "%a, %d %b %Y %H:%M:%S GMT"); { - xs *s = xs_replace_n(url, "https:/" "/", "", 1); + xs *s1 = xs_replace_n(url, "http:/" "/", "", 1); + xs *s = xs_replace_n(s1, "https:/" "/", "", 1); l1 = xs_split_n(s, "/", 1); } @@ -156,7 +156,7 @@ const char *login_page = "" "</head>\n" "<body><h1>%s OAuth identify</h1>\n" "<div style=\"background-color: red; color: white\">%s</div>\n" -"<form method=\"post\" action=\"https:/" "/%s/%s\">\n" +"<form method=\"post\" action=\"http:/" "/%s/%s\">\n" "<p>Login: <input type=\"text\" name=\"login\"></p>\n" "<p>Password: <input type=\"password\" name=\"passwd\"></p>\n" "<input type=\"hidden\" name=\"redir\" value=\"%s\">\n" diff --git a/webfinger.c b/webfinger.c index a883d7f..331191b 100644 --- a/webfinger.c +++ b/webfinger.c @@ -19,9 +19,10 @@ int webfinger_request_signed(snac *snac, const char *qs, char **actor, char **us xs_str *host = NULL; xs *resource = NULL; - if (xs_startswith(qs, "https:/" "/")) { + if (xs_startswith(qs, "http")) { /* actor query: pick the host */ - xs *s = xs_replace_n(qs, "https:/" "/", "", 1); + xs *s1 = xs_replace_n(qs, "http:/" "/", "", 1); + xs *s = xs_replace_n(s1, "https:/" "/", "", 1); l = xs_split_n(s, "/", 1); @@ -69,7 +70,7 @@ int webfinger_request_signed(snac *snac, const char *qs, char **actor, char **us &payload, &p_size, &ctype); } else { - xs *url = xs_fmt("https:/" "/%s/.well-known/webfinger?resource=%s", host, resource); + xs *url = xs_fmt("http:/" "/%s/.well-known/webfinger?resource=%s", host, resource); if (snac == NULL) xs_http_request("GET", url, headers, NULL, 0, &status, &payload, &p_size, 0); @@ -139,7 +140,7 @@ int webfinger_get_handler(xs_dict *req, char *q_path, snac snac; int found = 0; - if (xs_startswith(resource, "https:/" "/")) { + if (xs_startswith(resource, "https")) { /* actor search: find a user with this actor */ xs *l = xs_split(resource, "/"); char *uid = xs_list_get(l, -1); |