commit 83aad1b
default
·
2023-05-17 08:40:44 +0000 UTC
parent 970ad7a
Added some comments.
1 files changed,
+20,
-31
M
html.c
M
html.c
+20,
-31
1@@ -1347,8 +1347,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2 if ((v = xs_dict_get(q_vars, "show")) != NULL)
3 show = atoi(v), cache = 0, save = 0;
4
5- if (p_path == NULL) {
6- /* public timeline */
7+ if (p_path == NULL) { /** public timeline **/
8 xs *h = xs_str_localtime(0, "%Y-%m.html");
9
10 if (cache && history_mtime(&snac, h) > timeline_mtime(&snac)) {
11@@ -1372,9 +1371,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
12 }
13 }
14 else
15- if (strcmp(p_path, "admin") == 0) {
16- /* private timeline */
17-
18+ if (strcmp(p_path, "admin") == 0) { /** private timeline **/
19 if (!login(&snac, req))
20 status = 401;
21 else {
22@@ -1402,9 +1399,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
23 }
24 }
25 else
26- if (strcmp(p_path, "people") == 0) {
27- /* the list of people */
28-
29+ if (strcmp(p_path, "people") == 0) { /** the list of people **/
30 if (!login(&snac, req))
31 status = 401;
32 else {
33@@ -1414,9 +1409,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
34 }
35 }
36 else
37- if (strcmp(p_path, "notifications") == 0) {
38- /* the list of notifications */
39-
40+ if (strcmp(p_path, "notifications") == 0) { /** the list of notifications **/
41 if (!login(&snac, req))
42 status = 401;
43 else {
44@@ -1426,8 +1419,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
45 }
46 }
47 else
48- if (xs_startswith(p_path, "p/")) {
49- /* a timeline with just one entry */
50+ if (xs_startswith(p_path, "p/")) { /** a timeline with just one entry **/
51 xs *id = xs_fmt("%s/%s", snac.actor, p_path);
52 xs *msg = NULL;
53
54@@ -1443,8 +1435,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
55 }
56 }
57 else
58- if (xs_startswith(p_path, "s/")) {
59- /* a static file */
60+ if (xs_startswith(p_path, "s/")) { /** a static file **/
61 xs *l = xs_split(p_path, "/");
62 char *id = xs_list_get(l, 1);
63 int sz;
64@@ -1456,8 +1447,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
65 }
66 }
67 else
68- if (xs_startswith(p_path, "h/")) {
69- /* an entry from the history */
70+ if (xs_startswith(p_path, "h/")) { /** an entry from the history **/
71 xs *l = xs_split(p_path, "/");
72 char *id = xs_list_get(l, 1);
73
74@@ -1467,8 +1457,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
75 }
76 }
77 else
78- if (strcmp(p_path, ".rss") == 0) {
79- /* public timeline in RSS format */
80+ if (strcmp(p_path, ".rss") == 0) { /** public timeline in RSS format **/
81 d_char *rss;
82 xs *elems = timeline_simple_list(&snac, "public", 0, 20);
83 xs *bio = not_really_markdown(xs_dict_get(snac.config, "bio"));
84@@ -1588,7 +1577,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
85 }
86 #endif
87
88- if (p_path && strcmp(p_path, "admin/note") == 0) {
89+ if (p_path && strcmp(p_path, "admin/note") == 0) { /** **/
90 /* post note */
91 xs_str *content = xs_dict_get(p_vars, "content");
92 xs_str *in_reply_to = xs_dict_get(p_vars, "in_reply_to");
93@@ -1696,7 +1685,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
94 status = 303;
95 }
96 else
97- if (p_path && strcmp(p_path, "admin/action") == 0) {
98+ if (p_path && strcmp(p_path, "admin/action") == 0) { /** **/
99 /* action on an entry */
100 char *id = xs_dict_get(p_vars, "id");
101 char *actor = xs_dict_get(p_vars, "actor");
102@@ -1709,7 +1698,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
103
104 status = 303;
105
106- if (strcmp(action, L("Like")) == 0) {
107+ if (strcmp(action, L("Like")) == 0) { /** **/
108 xs *msg = msg_admiration(&snac, id, "Like");
109
110 if (msg != NULL) {
111@@ -1718,7 +1707,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
112 }
113 }
114 else
115- if (strcmp(action, L("Boost")) == 0) {
116+ if (strcmp(action, L("Boost")) == 0) { /** **/
117 xs *msg = msg_admiration(&snac, id, "Announce");
118
119 if (msg != NULL) {
120@@ -1727,19 +1716,19 @@ int html_post_handler(const xs_dict *req, const char *q_path,
121 }
122 }
123 else
124- if (strcmp(action, L("MUTE")) == 0) {
125+ if (strcmp(action, L("MUTE")) == 0) { /** **/
126 mute(&snac, actor);
127 }
128 else
129- if (strcmp(action, L("Unmute")) == 0) {
130+ if (strcmp(action, L("Unmute")) == 0) { /** **/
131 unmute(&snac, actor);
132 }
133 else
134- if (strcmp(action, L("Hide")) == 0) {
135+ if (strcmp(action, L("Hide")) == 0) { /** **/
136 hide(&snac, id);
137 }
138 else
139- if (strcmp(action, L("Follow")) == 0) {
140+ if (strcmp(action, L("Follow")) == 0) { /** **/
141 xs *msg = msg_follow(&snac, actor);
142
143 if (msg != NULL) {
144@@ -1752,7 +1741,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
145 }
146 }
147 else
148- if (strcmp(action, L("Unfollow")) == 0) {
149+ if (strcmp(action, L("Unfollow")) == 0) { /** **/
150 /* get the following object */
151 xs *object = NULL;
152
153@@ -1769,7 +1758,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
154 snac_log(&snac, xs_fmt("actor is not being followed %s", actor));
155 }
156 else
157- if (strcmp(action, L("Delete")) == 0) {
158+ if (strcmp(action, L("Delete")) == 0) { /** **/
159 char *actor_form = xs_dict_get(p_vars, "actor-form");
160 if (actor_form != NULL) {
161 /* delete follower */
162@@ -1802,7 +1791,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
163 history_del(&snac, "timeline.html_");
164 }
165 else
166- if (p_path && strcmp(p_path, "admin/user-setup") == 0) {
167+ if (p_path && strcmp(p_path, "admin/user-setup") == 0) { /** **/
168 /* change of user data */
169 char *v;
170 char *p1, *p2;
171@@ -1881,7 +1870,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
172 status = 303;
173 }
174 else
175- if (p_path && strcmp(p_path, "admin/clear-notifications") == 0) {
176+ if (p_path && strcmp(p_path, "admin/clear-notifications") == 0) { /** **/
177 notify_clear(&snac);
178 timeline_touch(&snac);
179