summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c5
-rw-r--r--html.c2
-rw-r--r--httpd.c15
-rw-r--r--snac.h4
4 files changed, 21 insertions, 5 deletions
diff --git a/data.c b/data.c
index 5026154..cd9c5e7 100644
--- a/data.c
+++ b/data.c
@@ -1575,7 +1575,6 @@ void tag_index(const char *id, const xs_dict *obj)
1575 xs_list *tags = xs_dict_get(obj, "tag"); 1575 xs_list *tags = xs_dict_get(obj, "tag");
1576 1576
1577 if (is_msg_public(obj) && xs_type(tags) == XSTYPE_LIST && xs_list_len(tags) > 0) { 1577 if (is_msg_public(obj) && xs_type(tags) == XSTYPE_LIST && xs_list_len(tags) > 0) {
1578 xs *md5_id = xs_md5_hex(id, strlen(id));
1579 xs *g_tag_dir = xs_fmt("%s/tag", srv_basedir); 1578 xs *g_tag_dir = xs_fmt("%s/tag", srv_basedir);
1580 1579
1581 mkdirx(g_tag_dir); 1580 mkdirx(g_tag_dir);
@@ -1596,7 +1595,7 @@ void tag_index(const char *id, const xs_dict *obj)
1596 mkdirx(tag_dir); 1595 mkdirx(tag_dir);
1597 1596
1598 xs *g_tag_idx = xs_fmt("%s/%s.idx", tag_dir, md5_tag); 1597 xs *g_tag_idx = xs_fmt("%s/%s.idx", tag_dir, md5_tag);
1599 index_add(g_tag_idx, md5_id); 1598 index_add(g_tag_idx, id);
1600 1599
1601 FILE *f; 1600 FILE *f;
1602 xs *g_tag_name = xs_replace(g_tag_idx, ".idx", ".tag"); 1601 xs *g_tag_name = xs_replace(g_tag_idx, ".idx", ".tag");
@@ -1605,7 +1604,7 @@ void tag_index(const char *id, const xs_dict *obj)
1605 fclose(f); 1604 fclose(f);
1606 } 1605 }
1607 1606
1608 srv_debug(0, xs_fmt("tagged %s #%s (%s #%s)", id, name, md5_id, md5_tag)); 1607 srv_debug(0, xs_fmt("tagged %s #%s (#%s)", id, name, md5_tag));
1609 } 1608 }
1610 } 1609 }
1611 } 1610 }
diff --git a/html.c b/html.c
index 7e96f46..1220765 100644
--- a/html.c
+++ b/html.c
@@ -1574,7 +1574,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int
1574 continue; 1574 continue;
1575 1575
1576 /* if it's an instance page, discard private users */ 1576 /* if it's an instance page, discard private users */
1577 if (user == NULL) { 1577 if (user == NULL && xs_startswith(xs_dict_get(msg, "id"), srv_baseurl)) {
1578 const char *atto = xs_dict_get(msg, "attributedTo"); 1578 const char *atto = xs_dict_get(msg, "attributedTo");
1579 xs *l = xs_split(atto, "/"); 1579 xs *l = xs_split(atto, "/");
1580 const char *uid = xs_list_get(l, -1); 1580 const char *uid = xs_list_get(l, -1);
diff --git a/httpd.c b/httpd.c
index aed15dc..2a91523 100644
--- a/httpd.c
+++ b/httpd.c
@@ -141,6 +141,21 @@ int server_get_handler(xs_dict *req, const char *q_path,
141 141
142 /* is it the server root? */ 142 /* is it the server root? */
143 if (*q_path == '\0') { 143 if (*q_path == '\0') {
144 xs_dict *q_vars = xs_dict_get(req, "q_vars");
145 char *t = NULL;
146
147 if (xs_type(q_vars) == XSTYPE_DICT && (t = xs_dict_get(q_vars, "t"))) {
148 /* tag search query */
149 int skip = xs_number_get(xs_dict_get(q_vars, "skip"));
150 int show = xs_number_get(xs_dict_get(q_vars, "show"));
151
152 if (show == 0)
153 show = 64;
154
155 xs *tl = tag_search(t, skip, show);
156 *body = html_timeline(NULL, tl, 0, skip, show, 0);
157 }
158 else
144 if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) { 159 if (xs_type(xs_dict_get(srv_config, "show_instance_timeline")) == XSTYPE_TRUE) {
145 xs *tl = timeline_instance_list(0, 30); 160 xs *tl = timeline_instance_list(0, 30);
146 *body = html_timeline(NULL, tl, 0, 0, 0, 0); 161 *body = html_timeline(NULL, tl, 0, 0, 0, 0);
diff --git a/snac.h b/snac.h
index 582f5f1..8c02004 100644
--- a/snac.h
+++ b/snac.h
@@ -69,7 +69,8 @@ double mtime_nl(const char *fn, int *n_link);
69#define mtime(fn) mtime_nl(fn, NULL) 69#define mtime(fn) mtime_nl(fn, NULL)
70double f_ctime(const char *fn); 70double f_ctime(const char *fn);
71 71
72int index_add(const char *fn, const char *md5); 72int index_add_md5(const char *fn, const char *md5);
73int index_add(const char *fn, const char *id);
73int index_gc(const char *fn); 74int index_gc(const char *fn);
74int index_first(const char *fn, char *buf, int size); 75int index_first(const char *fn, char *buf, int size);
75int index_len(const char *fn); 76int index_len(const char *fn);
@@ -144,6 +145,7 @@ void hide(snac *snac, const char *id);
144int is_hidden(snac *snac, const char *id); 145int is_hidden(snac *snac, const char *id);
145 146
146void tag_index(const char *id, const xs_dict *obj); 147void tag_index(const char *id, const xs_dict *obj);
148xs_list *tag_search(char *tag, int skip, int show);
147 149
148int actor_add(const char *actor, xs_dict *msg); 150int actor_add(const char *actor, xs_dict *msg);
149int actor_get(const char *actor, xs_dict **data); 151int actor_get(const char *actor, xs_dict **data);