diff options
| author | 2024-03-09 14:37:54 +0000 | |
|---|---|---|
| committer | 2024-03-09 14:37:54 +0000 | |
| commit | 7312f4ce51100d4ed98988cb3af0ab06e4fba53c (patch) | |
| tree | b9fe2c67d8d98605d5376bbad6ffe87ef29c1990 | |
| parent | Replaced all xs_dict_iter() with xs_dict_next(). (diff) | |
| download | snac2-7312f4ce51100d4ed98988cb3af0ab06e4fba53c.tar.gz snac2-7312f4ce51100d4ed98988cb3af0ab06e4fba53c.tar.xz snac2-7312f4ce51100d4ed98988cb3af0ab06e4fba53c.zip | |
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) | |||
| 1228 | xs *k2 = encode_html(k); | 1228 | xs *k2 = encode_html(k); |
| 1229 | xs *v2 = NULL; | 1229 | xs *v2 = NULL; |
| 1230 | 1230 | ||
| 1231 | if (xs_startswith(v, "https:")) { | 1231 | if (xs_startswith(v, "http")) { |
| 1232 | xs *t = encode_html(v); | 1232 | xs *t = encode_html(v); |
| 1233 | v2 = xs_fmt("<a href=\"%s\" rel=\"me\">%s</a>", t, t); | 1233 | v2 = xs_fmt("<a href=\"%s\" rel=\"me\">%s</a>", t, t); |
| 1234 | } | 1234 | } |
| @@ -1320,7 +1320,7 @@ xs_dict *msg_follow(snac *snac, const char *q) | |||
| 1320 | 1320 | ||
| 1321 | xs *url_or_uid = xs_strip_i(xs_str_new(q)); | 1321 | xs *url_or_uid = xs_strip_i(xs_str_new(q)); |
| 1322 | 1322 | ||
| 1323 | if (xs_startswith(url_or_uid, "https:/")) | 1323 | if (xs_startswith(url_or_uid, "http")) |
| 1324 | actor = xs_dup(url_or_uid); | 1324 | actor = xs_dup(url_or_uid); |
| 1325 | else | 1325 | else |
| 1326 | if (!valid_status(webfinger_request(url_or_uid, &actor, NULL)) || actor == NULL) { | 1326 | if (!valid_status(webfinger_request(url_or_uid, &actor, NULL)) || actor == NULL) { |
| @@ -67,7 +67,7 @@ int srv_open(char *basedir, int auto_upgrade) | |||
| 67 | if (host == NULL || prefix == NULL) | 67 | if (host == NULL || prefix == NULL) |
| 68 | error = xs_str_new("ERROR: cannot get server data"); | 68 | error = xs_str_new("ERROR: cannot get server data"); |
| 69 | else { | 69 | else { |
| 70 | srv_baseurl = xs_fmt("https://%s%s", host, prefix); | 70 | srv_baseurl = xs_fmt("http://%s%s", host, prefix); |
| 71 | 71 | ||
| 72 | dbglevel = (int) xs_number_get(dbglvl); | 72 | dbglevel = (int) xs_number_get(dbglvl); |
| 73 | 73 | ||
| @@ -1944,7 +1944,8 @@ xs_list *inbox_list(void) | |||
| 1944 | 1944 | ||
| 1945 | xs_str *_instance_block_fn(const char *instance) | 1945 | xs_str *_instance_block_fn(const char *instance) |
| 1946 | { | 1946 | { |
| 1947 | xs *s1 = xs_replace(instance, "https:/" "/", ""); | 1947 | xs *s = xs_replace(instance, "http:/" "/", ""); |
| 1948 | xs *s1 = xs_replace(s, "https:/" "/", ""); | ||
| 1948 | xs *l = xs_split(s1, "/"); | 1949 | xs *l = xs_split(s1, "/"); |
| 1949 | char *p = xs_list_get(l, 0); | 1950 | char *p = xs_list_get(l, 0); |
| 1950 | xs *md5 = xs_md5_hex(p, strlen(p)); | 1951 | xs *md5 = xs_md5_hex(p, strlen(p)); |
| @@ -783,7 +783,7 @@ static xs_html *html_user_body(snac *user, int read_only) | |||
| 783 | while (xs_dict_next(metadata, &k, &v, &c)) { | 783 | while (xs_dict_next(metadata, &k, &v, &c)) { |
| 784 | xs_html *value; | 784 | xs_html *value; |
| 785 | 785 | ||
| 786 | if (xs_startswith(v, "https:/" "/")) { | 786 | if (xs_startswith(v, "http")) { |
| 787 | /* is this link validated? */ | 787 | /* is this link validated? */ |
| 788 | xs *verified_link = NULL; | 788 | xs *verified_link = NULL; |
| 789 | xs_number *val_time = xs_dict_get(val_links, v); | 789 | 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, | |||
| 32 | date = xs_str_utctime(0, "%a, %d %b %Y %H:%M:%S GMT"); | 32 | date = xs_str_utctime(0, "%a, %d %b %Y %H:%M:%S GMT"); |
| 33 | 33 | ||
| 34 | { | 34 | { |
| 35 | xs *s = xs_replace_n(url, "https:/" "/", "", 1); | 35 | xs *s1 = xs_replace_n(url, "http:/" "/", "", 1); |
| 36 | xs *s = xs_replace_n(s1, "https:/" "/", "", 1); | ||
| 36 | l1 = xs_split_n(s, "/", 1); | 37 | l1 = xs_split_n(s, "/", 1); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| @@ -156,7 +156,7 @@ const char *login_page = "" | |||
| 156 | "</head>\n" | 156 | "</head>\n" |
| 157 | "<body><h1>%s OAuth identify</h1>\n" | 157 | "<body><h1>%s OAuth identify</h1>\n" |
| 158 | "<div style=\"background-color: red; color: white\">%s</div>\n" | 158 | "<div style=\"background-color: red; color: white\">%s</div>\n" |
| 159 | "<form method=\"post\" action=\"https:/" "/%s/%s\">\n" | 159 | "<form method=\"post\" action=\"http:/" "/%s/%s\">\n" |
| 160 | "<p>Login: <input type=\"text\" name=\"login\"></p>\n" | 160 | "<p>Login: <input type=\"text\" name=\"login\"></p>\n" |
| 161 | "<p>Password: <input type=\"password\" name=\"passwd\"></p>\n" | 161 | "<p>Password: <input type=\"password\" name=\"passwd\"></p>\n" |
| 162 | "<input type=\"hidden\" name=\"redir\" value=\"%s\">\n" | 162 | "<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 | |||
| 19 | xs_str *host = NULL; | 19 | xs_str *host = NULL; |
| 20 | xs *resource = NULL; | 20 | xs *resource = NULL; |
| 21 | 21 | ||
| 22 | if (xs_startswith(qs, "https:/" "/")) { | 22 | if (xs_startswith(qs, "http")) { |
| 23 | /* actor query: pick the host */ | 23 | /* actor query: pick the host */ |
| 24 | xs *s = xs_replace_n(qs, "https:/" "/", "", 1); | 24 | xs *s1 = xs_replace_n(qs, "http:/" "/", "", 1); |
| 25 | xs *s = xs_replace_n(s1, "https:/" "/", "", 1); | ||
| 25 | 26 | ||
| 26 | l = xs_split_n(s, "/", 1); | 27 | l = xs_split_n(s, "/", 1); |
| 27 | 28 | ||
| @@ -69,7 +70,7 @@ int webfinger_request_signed(snac *snac, const char *qs, char **actor, char **us | |||
| 69 | &payload, &p_size, &ctype); | 70 | &payload, &p_size, &ctype); |
| 70 | } | 71 | } |
| 71 | else { | 72 | else { |
| 72 | xs *url = xs_fmt("https:/" "/%s/.well-known/webfinger?resource=%s", host, resource); | 73 | xs *url = xs_fmt("http:/" "/%s/.well-known/webfinger?resource=%s", host, resource); |
| 73 | 74 | ||
| 74 | if (snac == NULL) | 75 | if (snac == NULL) |
| 75 | xs_http_request("GET", url, headers, NULL, 0, &status, &payload, &p_size, 0); | 76 | 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, | |||
| 139 | snac snac; | 140 | snac snac; |
| 140 | int found = 0; | 141 | int found = 0; |
| 141 | 142 | ||
| 142 | if (xs_startswith(resource, "https:/" "/")) { | 143 | if (xs_startswith(resource, "https")) { |
| 143 | /* actor search: find a user with this actor */ | 144 | /* actor search: find a user with this actor */ |
| 144 | xs *l = xs_split(resource, "/"); | 145 | xs *l = xs_split(resource, "/"); |
| 145 | char *uid = xs_list_get(l, -1); | 146 | char *uid = xs_list_get(l, -1); |