aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-09-03 19:36:33 +0200
committergrunfink <grunfink@comam.es>2025-09-03 19:36:33 +0200
commit0c3665fc49064f1fd5a04f2427056f9ea37f8d70 (patch)
treea27bb3c1066eb2f31cad936413dc4cff5ac012e6 /data.c
parent6dae96de25ed8d91767aa4cb4e634b71a4b9ae9a (diff)
Also keep a 'personal' folder for better organization.
Diffstat (limited to 'data.c')
-rw-r--r--data.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/data.c b/data.c
index 7e90a06..1caaabe 100644
--- a/data.c
+++ b/data.c
@@ -1383,8 +1383,13 @@ xs_str *timeline_fn_by_md5(snac *snac, const char *md5)
fn = xs_free(fn);
fn = xs_fmt("%s/public/%s.json", snac->basedir, md5);
- if (mtime(fn) == 0.0)
+ if (mtime(fn) == 0.0) {
fn = xs_free(fn);
+ fn = xs_fmt("%s/personal/%s.json", snac->basedir, md5);
+
+ if (mtime(fn) == 0.0)
+ fn = xs_free(fn);
+ }
}
}
@@ -1463,6 +1468,8 @@ void timeline_update_indexes(snac *snac, const char *id)
else
srv_debug(1, xs_fmt("Not added to public instance index %s", id));
}
+ else
+ object_user_cache_add(snac, id, "personal");
}
}
}
@@ -3877,14 +3884,14 @@ void purge_server(void)
}
-void delete_purged_posts(snac *user, int days)
+void delete_purged_posts(snac *user, const char *subdir, int days)
/* enqueues Delete activities for local purged messages */
{
if (days == 0)
return;
time_t mt = time(NULL) - days * 24 * 3600;
- xs *spec = xs_fmt("%s/public/" "*.json", user->basedir);
+ xs *spec = xs_fmt("%s/%s/" "*.json", user->basedir, subdir);
xs *list = xs_glob(spec, 0, 0);
const char *v;
@@ -3937,15 +3944,18 @@ void purge_user(snac *snac)
pub_days = user_days;
}
- if (xs_is_true(xs_dict_get(srv_config, "propagate_local_purge")))
- delete_purged_posts(snac, pub_days);
+ if (xs_is_true(xs_dict_get(srv_config, "propagate_local_purge"))) {
+ delete_purged_posts(snac, "public", pub_days);
+ delete_purged_posts(snac, "personal", pub_days);
+ }
_purge_user_subdir(snac, "hidden", priv_days);
_purge_user_subdir(snac, "private", priv_days);
- _purge_user_subdir(snac, "public", pub_days);
+ _purge_user_subdir(snac, "public", pub_days);
+ _purge_user_subdir(snac, "personal", pub_days);
- const char *idxs[] = { "followers.idx", "private.idx", "public.idx",
+ const char *idxs[] = { "followers.idx", "private.idx", "public.idx", "personal.idx",
"pinned.idx", "bookmark.idx", "draft.idx", "sched.idx", NULL };
for (n = 0; idxs[n]; n++) {