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