mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 17:45:04 +00:00
Ability to federate with hidden networks #93 (update for v2.49)
This commit is contained in:
parent
951e6b2315
commit
7312f4ce51
6 changed files with 14 additions and 11 deletions
|
@ -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) {
|
||||
|
|
5
data.c
5
data.c
|
@ -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));
|
||||
|
|
2
html.c
2
html.c
|
@ -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);
|
||||
|
|
3
http.c
3
http.c
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue