mirror of https://codeberg.org/grunfink/snac2.git
Compare commits
7 Commits
5daab81d01
...
2d2c1bdfef
Author | SHA1 | Date |
---|---|---|
default | 2d2c1bdfef | |
default | 6ed34913f0 | |
default | 16a4a09e4f | |
default | cf1c2b1ed8 | |
default | 9cfce7a4bd | |
default | ebf6a4bd8e | |
default | 62cc167c5f |
8
TODO.md
8
TODO.md
|
@ -14,14 +14,10 @@ Important: deleting a follower should do more that just delete the object, see h
|
|||
|
||||
Implement `Group`-like accounts (i.e. an actor that boosts to their followers all posts that mention it).
|
||||
|
||||
Integrate "Ability to federate with hidden networks" see https://codeberg.org/grunfink/snac2/issues/93
|
||||
|
||||
Integrate "Added handling for International Domain Names" PR https://codeberg.org/grunfink/snac2/pulls/104
|
||||
|
||||
Consider adding Mastodon import functionality (for following_accounts.csv and outbox.json).
|
||||
|
||||
Consider adding milter-like support to reject posts to mitigate spam.
|
||||
|
||||
Do something about Akkoma and Misskey's quoted replies (they use the `quoteUrl` field instead of `inReplyTo`).
|
||||
|
||||
Add more CSS classes according to https://comam.es/snac/grunfink/p/1705598619.090050
|
||||
|
@ -311,3 +307,7 @@ Consider implementing the rejection of activities from recently-created accounts
|
|||
Consider discarding posts by content using string or regex to mitigate spam (2024-03-14T10:40:14+0100).
|
||||
|
||||
Post edits should preserve the image and the image description somewhat (2024-03-22T09:57:18+0100).
|
||||
|
||||
Integrate "Ability to federate with hidden networks" see https://codeberg.org/grunfink/snac2/issues/93
|
||||
|
||||
Consider adding milter-like support to reject posts to mitigate spam (discarded; 2024-04-20T22:46:35+0200).
|
||||
|
|
|
@ -2371,6 +2371,7 @@ void process_queue_item(xs_dict *q_item)
|
|||
int p_status = xs_number_get(xs_dict_get(q_item, "p_status"));
|
||||
xs *payload = NULL;
|
||||
int p_size = 0;
|
||||
int timeout = 0;
|
||||
|
||||
if (xs_is_null(inbox) || xs_is_null(msg) || xs_is_null(keyid) || xs_is_null(seckey)) {
|
||||
srv_log(xs_fmt("output message error: missing fields"));
|
||||
|
@ -2383,8 +2384,15 @@ void process_queue_item(xs_dict *q_item)
|
|||
}
|
||||
|
||||
/* deliver (if previous error status was a timeout, try now longer) */
|
||||
status = send_to_inbox_raw(keyid, seckey, inbox, msg,
|
||||
&payload, &p_size, p_status == 599 ? 8 : 6);
|
||||
if (p_status == 599)
|
||||
timeout = xs_number_get(xs_dict_get_def(srv_config, "queue_timeout_2", "8"));
|
||||
else
|
||||
timeout = xs_number_get(xs_dict_get_def(srv_config, "queue_timeout", "6"));
|
||||
|
||||
if (timeout == 0)
|
||||
timeout = 6;
|
||||
|
||||
status = send_to_inbox_raw(keyid, seckey, inbox, msg, &payload, &p_size, timeout);
|
||||
|
||||
if (payload) {
|
||||
if (p_size > 64) {
|
||||
|
@ -2516,8 +2524,6 @@ void process_queue_item(xs_dict *q_item)
|
|||
|
||||
if (r == 0) {
|
||||
/* transient error? retry */
|
||||
int queue_retry_max = xs_number_get(xs_dict_get(srv_config, "queue_retry_max"));
|
||||
|
||||
if (retries > queue_retry_max)
|
||||
srv_log(xs_fmt("shared input giving up"));
|
||||
else {
|
||||
|
|
14
data.c
14
data.c
|
@ -1065,14 +1065,18 @@ int timeline_touch(snac *snac)
|
|||
xs_str *timeline_fn_by_md5(snac *snac, const char *md5)
|
||||
/* get the filename of an entry by md5 from any timeline */
|
||||
{
|
||||
xs_str *fn = xs_fmt("%s/private/%s.json", snac->basedir, md5);
|
||||
xs_str *fn = NULL;
|
||||
|
||||
if (mtime(fn) == 0.0) {
|
||||
fn = xs_free(fn);
|
||||
fn = xs_fmt("%s/public/%s.json", snac->basedir, md5);
|
||||
if (xs_is_hex(md5) && strlen(md5) == 32) {
|
||||
fn = xs_fmt("%s/private/%s.json", snac->basedir, md5);
|
||||
|
||||
if (mtime(fn) == 0.0)
|
||||
if (mtime(fn) == 0.0) {
|
||||
fn = xs_free(fn);
|
||||
fn = xs_fmt("%s/public/%s.json", snac->basedir, md5);
|
||||
|
||||
if (mtime(fn) == 0.0)
|
||||
fn = xs_free(fn);
|
||||
}
|
||||
}
|
||||
|
||||
return fn;
|
||||
|
|
|
@ -143,6 +143,14 @@ times the sending will be retried.
|
|||
The number of minutes to wait before the failed posting of a message is
|
||||
retried. This is not linear, but multipled by the number of retries
|
||||
already done.
|
||||
.It Ic queue_timeout
|
||||
The maximum number of seconds to wait when sending a message from the queue.
|
||||
.It Ic queue_timeout_2
|
||||
The maximum number of seconds to wait when sending a message from the queue
|
||||
to those servers that went timeout in the previous retry. If you want to
|
||||
give slow servers a chance to receive your messages, you can increase this
|
||||
value (but also take into account that processing the queue will take longer
|
||||
while waiting for these molasses to respond).
|
||||
.It Ic max_timeline_entries
|
||||
This is the maximum timeline entries shown in the web interface.
|
||||
.It Ic timeline_purge_days
|
||||
|
|
19
html.c
19
html.c
|
@ -2586,6 +2586,25 @@ int html_get_handler(const xs_dict *req, const char *q_path,
|
|||
}
|
||||
}
|
||||
else
|
||||
if (xs_startswith(p_path, "admin/p/")) { /** unique post by md5 **/
|
||||
if (!login(&snac, req)) {
|
||||
*body = xs_dup(uid);
|
||||
status = 401;
|
||||
}
|
||||
else {
|
||||
xs *l = xs_split(p_path, "/");
|
||||
char *md5 = xs_list_get(l, -1);
|
||||
|
||||
if (md5 && *md5 && timeline_here(&snac, md5)) {
|
||||
xs *list = xs_list_append(xs_list_new(), md5);
|
||||
|
||||
*body = html_timeline(&snac, list, 0, 0, 0, 0, NULL, "/admin", 1);
|
||||
*b_size = strlen(*body);
|
||||
status = 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strcmp(p_path, "people") == 0) { /** the list of people **/
|
||||
if (!login(&snac, req)) {
|
||||
*body = xs_dup(uid);
|
||||
|
|
2
utils.c
2
utils.c
|
@ -25,6 +25,8 @@ static const char *default_srv_config = "{"
|
|||
"\"dbglevel\": 0,"
|
||||
"\"queue_retry_minutes\": 2,"
|
||||
"\"queue_retry_max\": 10,"
|
||||
"\"queue_timeout\": 6,"
|
||||
"\"queue_timeout_2\": 8,"
|
||||
"\"cssurls\": [\"\"],"
|
||||
"\"max_timeline_entries\": 50,"
|
||||
"\"timeline_purge_days\": 120,"
|
||||
|
|
44
xs.h
44
xs.h
|
@ -94,6 +94,7 @@ xs_list *xs_list_append_m(xs_list *list, const char *mem, int dsz);
|
|||
xs_list *_xs_list_append(xs_list *list, const xs_val *vals[]);
|
||||
#define xs_list_append(list, ...) _xs_list_append(list, (const xs_val *[]){ __VA_ARGS__, NULL })
|
||||
int xs_list_iter(xs_list **list, xs_val **value);
|
||||
int xs_list_next(const xs_list *list, xs_val **value, int *ctxt);
|
||||
int xs_list_len(const xs_list *list);
|
||||
xs_val *xs_list_get(const xs_list *list, int num);
|
||||
xs_list *xs_list_del(xs_list *list, int num);
|
||||
|
@ -752,6 +753,42 @@ int xs_list_iter(xs_list **list, xs_val **value)
|
|||
}
|
||||
|
||||
|
||||
int xs_list_next(const xs_list *list, xs_val **value, int *ctxt)
|
||||
/* iterates a list, with context */
|
||||
{
|
||||
if (xs_type(list) != XSTYPE_LIST)
|
||||
return 0;
|
||||
|
||||
int goon = 1;
|
||||
|
||||
char *p = (char *)list;
|
||||
|
||||
/* skip the start of the list */
|
||||
if (*ctxt == 0)
|
||||
*ctxt = 1 + _XS_TYPE_SIZE;
|
||||
|
||||
p += *ctxt;
|
||||
|
||||
/* an element? */
|
||||
if (xs_type(p) == XSTYPE_LITEM) {
|
||||
p++;
|
||||
|
||||
*value = p;
|
||||
|
||||
p += xs_size(*value);
|
||||
}
|
||||
else {
|
||||
/* end of list */
|
||||
goon = 0;
|
||||
}
|
||||
|
||||
/* update the context */
|
||||
*ctxt = p - list;
|
||||
|
||||
return goon;
|
||||
}
|
||||
|
||||
|
||||
int xs_list_len(const xs_list *list)
|
||||
/* returns the number of elements in the list */
|
||||
{
|
||||
|
@ -1199,8 +1236,11 @@ double xs_number_get(const xs_number *v)
|
|||
{
|
||||
double f = 0.0;
|
||||
|
||||
if (v != NULL && v[0] == XSTYPE_NUMBER)
|
||||
if (xs_type(v) == XSTYPE_NUMBER)
|
||||
f = atof(&v[1]);
|
||||
else
|
||||
if (xs_type(v) == XSTYPE_STRING)
|
||||
f = atof(v);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
@ -1211,7 +1251,7 @@ const char *xs_number_str(const xs_number *v)
|
|||
{
|
||||
const char *p = NULL;
|
||||
|
||||
if (v != NULL && v[0] == XSTYPE_NUMBER)
|
||||
if (xs_type(v) == XSTYPE_NUMBER)
|
||||
p = &v[1];
|
||||
|
||||
return p;
|
||||
|
|
|
@ -1 +1 @@
|
|||
/* f712d1336ef427c3b56305364b2687578537543f 2024-04-14T19:11:53+02:00 */
|
||||
/* 0206a65508e86f66b6aa329418ddc8f6f8c1ecb2 2024-04-22T07:31:05+02:00 */
|
||||
|
|
Loading…
Reference in New Issue