mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Started an instance page.
This commit is contained in:
parent
bc3c7dde33
commit
49b226a8e9
1 changed files with 23 additions and 1 deletions
24
html.c
24
html.c
|
@ -698,6 +698,8 @@ static xs_html *html_user_body(snac *user, int read_only)
|
|||
xs *admin_url = xs_fmt("%s/admin", user->actor);
|
||||
xs *notify_url = xs_fmt("%s/notifications", user->actor);
|
||||
xs *people_url = xs_fmt("%s/people", user->actor);
|
||||
xs *instance_url = xs_fmt("%s/instance", user->actor);
|
||||
|
||||
xs_html_add(top_nav,
|
||||
xs_html_tag("a",
|
||||
xs_html_attr("href", user->actor),
|
||||
|
@ -714,7 +716,11 @@ static xs_html *html_user_body(snac *user, int read_only)
|
|||
xs_html_text(" - "),
|
||||
xs_html_tag("a",
|
||||
xs_html_attr("href", people_url),
|
||||
xs_html_text(L("people"))));
|
||||
xs_html_text(L("people"))),
|
||||
xs_html_text(" - "),
|
||||
xs_html_tag("a",
|
||||
xs_html_attr("href", instance_url),
|
||||
xs_html_text(L("instance"))));
|
||||
}
|
||||
|
||||
xs_html_add(body,
|
||||
|
@ -1962,6 +1968,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
|
|||
}
|
||||
|
||||
if (list && user && read_only) {
|
||||
/** history **/
|
||||
if (xs_type(xs_dict_get(srv_config, "disable_history")) != XSTYPE_TRUE) {
|
||||
xs_html *ul = xs_html_tag("ul", NULL);
|
||||
|
||||
|
@ -2495,6 +2502,21 @@ int html_get_handler(const xs_dict *req, const char *q_path,
|
|||
}
|
||||
}
|
||||
else
|
||||
if (strcmp(p_path, "instance") == 0) { /** instance timeline **/
|
||||
if (!login(&snac, req)) {
|
||||
*body = xs_dup(uid);
|
||||
status = 401;
|
||||
}
|
||||
else {
|
||||
xs *list = timeline_instance_list(skip, show);
|
||||
xs *next = timeline_instance_list(skip + show, 1);
|
||||
|
||||
*body = html_timeline(&snac, list, 0, skip, show, xs_list_len(next), NULL, "/instance");
|
||||
*b_size = strlen(*body);
|
||||
status = 200;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (xs_startswith(p_path, "p/")) { /** a timeline with just one entry **/
|
||||
if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE)
|
||||
return 403;
|
||||
|
|
Loading…
Reference in a new issue