commit ee7483c
grunfink
·
2025-12-09 12:31:37 +0000 UTC
parent deb7626
New query variable terse=anything. If set to any value, a public post page doesn't show any headline.
M
html.c
+23,
-15
1@@ -2996,7 +2996,7 @@ xs_html *html_footer(const snac *user)
2 xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
3 int skip, int show, int show_more,
4 const char *title, const char *page,
5- int utl, const char *error)
6+ int utl, const char *error, int terse)
7 /* returns the HTML for the timeline */
8 {
9 xs_list *p = (xs_list *)list;
10@@ -3024,7 +3024,11 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
11
12 if (user) {
13 head = html_user_head(user, desc, alternate);
14- body = html_user_body(user, read_only);
15+
16+ if (terse)
17+ body = xs_html_tag("body", NULL);
18+ else
19+ body = html_user_body(user, read_only);
20 }
21 else {
22 head = html_instance_head();
23@@ -3902,6 +3906,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
24 int cache = 1;
25 int save = 1;
26 int proxy = 0;
27+ int terse = 0;
28 const char *v;
29
30 const xs_dict *q_vars = xs_dict_get(req, "q_vars");
31@@ -3914,6 +3919,9 @@ int html_get_handler(const xs_dict *req, const char *q_path,
32 return HTTP_STATUS_NOT_FOUND;
33 }
34
35+ if (!xs_is_null(xs_dict_get(q_vars, "terse")))
36+ terse = 1;
37+
38 if (strcmp(v, "share-bridge") == 0) {
39 /* temporary redirect for a post */
40 const char *login = xs_dict_get(q_vars, "login");
41@@ -4014,7 +4022,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
42
43 if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) {
44 /** empty public timeline for private users **/
45- *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL, "", 1, error);
46+ *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL, "", 1, error, terse);
47 *b_size = strlen(*body);
48 status = HTTP_STATUS_OK;
49 }
50@@ -4037,7 +4045,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
51 xs *pins = pinned_list(&snac);
52 pins = xs_list_cat(pins, list);
53
54- *body = html_timeline(&snac, pins, 1, skip, show, more, NULL, "", 1, error);
55+ *body = html_timeline(&snac, pins, 1, skip, show, more, NULL, "", 1, error, terse);
56
57 *b_size = strlen(*body);
58 status = HTTP_STATUS_OK;
59@@ -4161,7 +4169,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
60 xs *title = xs_fmt(xs_list_len(tl) ?
61 L("Search results for tag %s") : L("Nothing found for tag %s"), q);
62
63- *body = html_timeline(&snac, tl, 0, skip, show, more, title, page, 0, error);
64+ *body = html_timeline(&snac, tl, 0, skip, show, more, title, page, 0, error, terse);
65 *b_size = strlen(*body);
66 status = HTTP_STATUS_OK;
67 }
68@@ -4186,7 +4194,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
69 title = xs_fmt(L("Nothing found for '%s'"), q);
70
71 *body = html_timeline(&snac, tl, 0, skip, tl_len, to || tl_len == show,
72- title, page, 0, error);
73+ title, page, 0, error, terse);
74 *b_size = strlen(*body);
75 status = HTTP_STATUS_OK;
76 }
77@@ -4213,7 +4221,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
78 xs *list = timeline_list(&snac, "private", skip, show, &more);
79
80 *body = html_timeline(&snac, list, 0, skip, show,
81- more, NULL, "/admin", 1, error);
82+ more, NULL, "/admin", 1, error, terse);
83
84 *b_size = strlen(*body);
85 status = HTTP_STATUS_OK;
86@@ -4240,7 +4248,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
87 xs *list0 = xs_list_append(xs_list_new(), md5);
88 xs *list = timeline_top_level(&snac, list0);
89
90- *body = html_timeline(&snac, list, 0, 0, 0, 0, NULL, "/admin", 1, error);
91+ *body = html_timeline(&snac, list, 0, 0, 0, 0, NULL, "/admin", 1, error, terse);
92 *b_size = strlen(*body);
93 status = HTTP_STATUS_OK;
94 }
95@@ -4281,7 +4289,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
96 xs *next = timeline_instance_list(skip + show, 1);
97
98 *body = html_timeline(&snac, list, 0, skip, show,
99- xs_list_len(next), L("Showing instance timeline"), "/instance", 0, error);
100+ xs_list_len(next), L("Showing instance timeline"), "/instance", 0, error, terse);
101 *b_size = strlen(*body);
102 status = HTTP_STATUS_OK;
103 }
104@@ -4296,7 +4304,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
105 xs *list = pinned_list(&snac);
106
107 *body = html_timeline(&snac, list, 0, skip, show,
108- 0, L("Pinned posts"), "", 0, error);
109+ 0, L("Pinned posts"), "", 0, error, terse);
110 *b_size = strlen(*body);
111 status = HTTP_STATUS_OK;
112 }
113@@ -4311,7 +4319,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
114 xs *list = bookmark_list(&snac);
115
116 *body = html_timeline(&snac, list, 0, skip, show,
117- 0, L("Bookmarked posts"), "", 0, error);
118+ 0, L("Bookmarked posts"), "", 0, error, terse);
119 *b_size = strlen(*body);
120 status = HTTP_STATUS_OK;
121 }
122@@ -4326,7 +4334,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
123 xs *list = draft_list(&snac);
124
125 *body = html_timeline(&snac, list, 0, skip, show,
126- 0, L("Post drafts"), "", 0, error);
127+ 0, L("Post drafts"), "", 0, error, terse);
128 *b_size = strlen(*body);
129 status = HTTP_STATUS_OK;
130 }
131@@ -4341,7 +4349,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
132 xs *list = scheduled_list(&snac);
133
134 *body = html_timeline(&snac, list, 0, skip, show,
135- 0, L("Scheduled posts"), "", 0, error);
136+ 0, L("Scheduled posts"), "", 0, error, terse);
137 *b_size = strlen(*body);
138 status = HTTP_STATUS_OK;
139 }
140@@ -4367,7 +4375,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
141 xs *title = xs_fmt(L("Showing timeline for list '%s'"), name);
142
143 *body = html_timeline(&snac, ttl, 0, skip, show,
144- xs_list_len(next), title, base, 1, error);
145+ xs_list_len(next), title, base, 1, error, terse);
146 *b_size = strlen(*body);
147 status = HTTP_STATUS_OK;
148 }
149@@ -4387,7 +4395,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
150
151 list = xs_list_append(list, md5);
152
153- *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL, "", 1, error);
154+ *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL, "", 1, error, terse);
155 *b_size = strlen(*body);
156 status = HTTP_STATUS_OK;
157 }
M
httpd.c
+2,
-2
1@@ -257,7 +257,7 @@ int server_get_handler(xs_dict *req, const char *q_path,
2 else {
3 xs *page = xs_fmt("?t=%s", t);
4 xs *title = xs_fmt(L("Search results for tag #%s"), t);
5- *body = html_timeline(NULL, tl, 0, skip, show, more, title, page, 0, NULL);
6+ *body = html_timeline(NULL, tl, 0, skip, show, more, title, page, 0, NULL, 0);
7 }
8 }
9 else
10@@ -265,7 +265,7 @@ int server_get_handler(xs_dict *req, const char *q_path,
11 /** instance timeline **/
12 xs *tl = timeline_instance_list(0, 30);
13 *body = html_timeline(NULL, tl, 0, 0, 0, 0,
14- L("Recent posts by users in this instance"), NULL, 0, NULL);
15+ L("Recent posts by users in this instance"), NULL, 0, NULL, 0);
16 }
17 else
18 *body = greeting_html();
M
snac.h
+1,
-1
1@@ -411,7 +411,7 @@ xs_str *encode_html(const char *str);
2
3 xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
4 int skip, int show, int show_more,
5- const char *title, const char *page, int utl, const char *error);
6+ const char *title, const char *page, int utl, const char *error, int terse);
7
8 int html_get_handler(const xs_dict *req, const char *q_path,
9 char **body, int *b_size, char **ctype,