summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar grunfink2025-12-09 13:31:37 +0100
committerGravatar grunfink2025-12-09 13:31:37 +0100
commitee7483cf0dd007d104a815fce47a0d5f050ca870 (patch)
treeb8af2e538311bb1bcfa005c20e21479c81f41af0 /html.c
parentUpdated TODO. (diff)
downloadsnac2-ee7483cf0dd007d104a815fce47a0d5f050ca870.tar.gz
snac2-ee7483cf0dd007d104a815fce47a0d5f050ca870.tar.xz
snac2-ee7483cf0dd007d104a815fce47a0d5f050ca870.zip
New query variable terse=anything.
If set to any value, a public post page doesn't show any headline.
Diffstat (limited to 'html.c')
-rw-r--r--html.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/html.c b/html.c
index 9ac57f8..32ed057 100644
--- a/html.c
+++ b/html.c
@@ -2996,7 +2996,7 @@ xs_html *html_footer(const snac *user)
2996xs_str *html_timeline(snac *user, const xs_list *list, int read_only, 2996xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
2997 int skip, int show, int show_more, 2997 int skip, int show, int show_more,
2998 const char *title, const char *page, 2998 const char *title, const char *page,
2999 int utl, const char *error) 2999 int utl, const char *error, int terse)
3000/* returns the HTML for the timeline */ 3000/* returns the HTML for the timeline */
3001{ 3001{
3002 xs_list *p = (xs_list *)list; 3002 xs_list *p = (xs_list *)list;
@@ -3024,7 +3024,11 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
3024 3024
3025 if (user) { 3025 if (user) {
3026 head = html_user_head(user, desc, alternate); 3026 head = html_user_head(user, desc, alternate);
3027 body = html_user_body(user, read_only); 3027
3028 if (terse)
3029 body = xs_html_tag("body", NULL);
3030 else
3031 body = html_user_body(user, read_only);
3028 } 3032 }
3029 else { 3033 else {
3030 head = html_instance_head(); 3034 head = html_instance_head();
@@ -3902,6 +3906,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
3902 int cache = 1; 3906 int cache = 1;
3903 int save = 1; 3907 int save = 1;
3904 int proxy = 0; 3908 int proxy = 0;
3909 int terse = 0;
3905 const char *v; 3910 const char *v;
3906 3911
3907 const xs_dict *q_vars = xs_dict_get(req, "q_vars"); 3912 const xs_dict *q_vars = xs_dict_get(req, "q_vars");
@@ -3914,6 +3919,9 @@ int html_get_handler(const xs_dict *req, const char *q_path,
3914 return HTTP_STATUS_NOT_FOUND; 3919 return HTTP_STATUS_NOT_FOUND;
3915 } 3920 }
3916 3921
3922 if (!xs_is_null(xs_dict_get(q_vars, "terse")))
3923 terse = 1;
3924
3917 if (strcmp(v, "share-bridge") == 0) { 3925 if (strcmp(v, "share-bridge") == 0) {
3918 /* temporary redirect for a post */ 3926 /* temporary redirect for a post */
3919 const char *login = xs_dict_get(q_vars, "login"); 3927 const char *login = xs_dict_get(q_vars, "login");
@@ -4014,7 +4022,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4014 4022
4015 if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) { 4023 if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) {
4016 /** empty public timeline for private users **/ 4024 /** empty public timeline for private users **/
4017 *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL, "", 1, error); 4025 *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL, "", 1, error, terse);
4018 *b_size = strlen(*body); 4026 *b_size = strlen(*body);
4019 status = HTTP_STATUS_OK; 4027 status = HTTP_STATUS_OK;
4020 } 4028 }
@@ -4037,7 +4045,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4037 xs *pins = pinned_list(&snac); 4045 xs *pins = pinned_list(&snac);
4038 pins = xs_list_cat(pins, list); 4046 pins = xs_list_cat(pins, list);
4039 4047
4040 *body = html_timeline(&snac, pins, 1, skip, show, more, NULL, "", 1, error); 4048 *body = html_timeline(&snac, pins, 1, skip, show, more, NULL, "", 1, error, terse);
4041 4049
4042 *b_size = strlen(*body); 4050 *b_size = strlen(*body);
4043 status = HTTP_STATUS_OK; 4051 status = HTTP_STATUS_OK;
@@ -4161,7 +4169,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4161 xs *title = xs_fmt(xs_list_len(tl) ? 4169 xs *title = xs_fmt(xs_list_len(tl) ?
4162 L("Search results for tag %s") : L("Nothing found for tag %s"), q); 4170 L("Search results for tag %s") : L("Nothing found for tag %s"), q);
4163 4171
4164 *body = html_timeline(&snac, tl, 0, skip, show, more, title, page, 0, error); 4172 *body = html_timeline(&snac, tl, 0, skip, show, more, title, page, 0, error, terse);
4165 *b_size = strlen(*body); 4173 *b_size = strlen(*body);
4166 status = HTTP_STATUS_OK; 4174 status = HTTP_STATUS_OK;
4167 } 4175 }
@@ -4186,7 +4194,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4186 title = xs_fmt(L("Nothing found for '%s'"), q); 4194 title = xs_fmt(L("Nothing found for '%s'"), q);
4187 4195
4188 *body = html_timeline(&snac, tl, 0, skip, tl_len, to || tl_len == show, 4196 *body = html_timeline(&snac, tl, 0, skip, tl_len, to || tl_len == show,
4189 title, page, 0, error); 4197 title, page, 0, error, terse);
4190 *b_size = strlen(*body); 4198 *b_size = strlen(*body);
4191 status = HTTP_STATUS_OK; 4199 status = HTTP_STATUS_OK;
4192 } 4200 }
@@ -4213,7 +4221,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4213 xs *list = timeline_list(&snac, "private", skip, show, &more); 4221 xs *list = timeline_list(&snac, "private", skip, show, &more);
4214 4222
4215 *body = html_timeline(&snac, list, 0, skip, show, 4223 *body = html_timeline(&snac, list, 0, skip, show,
4216 more, NULL, "/admin", 1, error); 4224 more, NULL, "/admin", 1, error, terse);
4217 4225
4218 *b_size = strlen(*body); 4226 *b_size = strlen(*body);
4219 status = HTTP_STATUS_OK; 4227 status = HTTP_STATUS_OK;
@@ -4240,7 +4248,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4240 xs *list0 = xs_list_append(xs_list_new(), md5); 4248 xs *list0 = xs_list_append(xs_list_new(), md5);
4241 xs *list = timeline_top_level(&snac, list0); 4249 xs *list = timeline_top_level(&snac, list0);
4242 4250
4243 *body = html_timeline(&snac, list, 0, 0, 0, 0, NULL, "/admin", 1, error); 4251 *body = html_timeline(&snac, list, 0, 0, 0, 0, NULL, "/admin", 1, error, terse);
4244 *b_size = strlen(*body); 4252 *b_size = strlen(*body);
4245 status = HTTP_STATUS_OK; 4253 status = HTTP_STATUS_OK;
4246 } 4254 }
@@ -4281,7 +4289,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4281 xs *next = timeline_instance_list(skip + show, 1); 4289 xs *next = timeline_instance_list(skip + show, 1);
4282 4290
4283 *body = html_timeline(&snac, list, 0, skip, show, 4291 *body = html_timeline(&snac, list, 0, skip, show,
4284 xs_list_len(next), L("Showing instance timeline"), "/instance", 0, error); 4292 xs_list_len(next), L("Showing instance timeline"), "/instance", 0, error, terse);
4285 *b_size = strlen(*body); 4293 *b_size = strlen(*body);
4286 status = HTTP_STATUS_OK; 4294 status = HTTP_STATUS_OK;
4287 } 4295 }
@@ -4296,7 +4304,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4296 xs *list = pinned_list(&snac); 4304 xs *list = pinned_list(&snac);
4297 4305
4298 *body = html_timeline(&snac, list, 0, skip, show, 4306 *body = html_timeline(&snac, list, 0, skip, show,
4299 0, L("Pinned posts"), "", 0, error); 4307 0, L("Pinned posts"), "", 0, error, terse);
4300 *b_size = strlen(*body); 4308 *b_size = strlen(*body);
4301 status = HTTP_STATUS_OK; 4309 status = HTTP_STATUS_OK;
4302 } 4310 }
@@ -4311,7 +4319,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4311 xs *list = bookmark_list(&snac); 4319 xs *list = bookmark_list(&snac);
4312 4320
4313 *body = html_timeline(&snac, list, 0, skip, show, 4321 *body = html_timeline(&snac, list, 0, skip, show,
4314 0, L("Bookmarked posts"), "", 0, error); 4322 0, L("Bookmarked posts"), "", 0, error, terse);
4315 *b_size = strlen(*body); 4323 *b_size = strlen(*body);
4316 status = HTTP_STATUS_OK; 4324 status = HTTP_STATUS_OK;
4317 } 4325 }
@@ -4326,7 +4334,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4326 xs *list = draft_list(&snac); 4334 xs *list = draft_list(&snac);
4327 4335
4328 *body = html_timeline(&snac, list, 0, skip, show, 4336 *body = html_timeline(&snac, list, 0, skip, show,
4329 0, L("Post drafts"), "", 0, error); 4337 0, L("Post drafts"), "", 0, error, terse);
4330 *b_size = strlen(*body); 4338 *b_size = strlen(*body);
4331 status = HTTP_STATUS_OK; 4339 status = HTTP_STATUS_OK;
4332 } 4340 }
@@ -4341,7 +4349,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4341 xs *list = scheduled_list(&snac); 4349 xs *list = scheduled_list(&snac);
4342 4350
4343 *body = html_timeline(&snac, list, 0, skip, show, 4351 *body = html_timeline(&snac, list, 0, skip, show,
4344 0, L("Scheduled posts"), "", 0, error); 4352 0, L("Scheduled posts"), "", 0, error, terse);
4345 *b_size = strlen(*body); 4353 *b_size = strlen(*body);
4346 status = HTTP_STATUS_OK; 4354 status = HTTP_STATUS_OK;
4347 } 4355 }
@@ -4367,7 +4375,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4367 xs *title = xs_fmt(L("Showing timeline for list '%s'"), name); 4375 xs *title = xs_fmt(L("Showing timeline for list '%s'"), name);
4368 4376
4369 *body = html_timeline(&snac, ttl, 0, skip, show, 4377 *body = html_timeline(&snac, ttl, 0, skip, show,
4370 xs_list_len(next), title, base, 1, error); 4378 xs_list_len(next), title, base, 1, error, terse);
4371 *b_size = strlen(*body); 4379 *b_size = strlen(*body);
4372 status = HTTP_STATUS_OK; 4380 status = HTTP_STATUS_OK;
4373 } 4381 }
@@ -4387,7 +4395,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4387 4395
4388 list = xs_list_append(list, md5); 4396 list = xs_list_append(list, md5);
4389 4397
4390 *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL, "", 1, error); 4398 *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL, "", 1, error, terse);
4391 *b_size = strlen(*body); 4399 *b_size = strlen(*body);
4392 status = HTTP_STATUS_OK; 4400 status = HTTP_STATUS_OK;
4393 } 4401 }