commit 0c3665f
grunfink
·
2025-09-03 17:36:33 +0000 UTC
parent 6dae96d
Also keep a 'personal' folder for better organization.
1 files changed,
+17,
-7
M
data.c
M
data.c
+17,
-7
1@@ -1383,8 +1383,13 @@ xs_str *timeline_fn_by_md5(snac *snac, const char *md5)
2 fn = xs_free(fn);
3 fn = xs_fmt("%s/public/%s.json", snac->basedir, md5);
4
5- if (mtime(fn) == 0.0)
6+ if (mtime(fn) == 0.0) {
7 fn = xs_free(fn);
8+ fn = xs_fmt("%s/personal/%s.json", snac->basedir, md5);
9+
10+ if (mtime(fn) == 0.0)
11+ fn = xs_free(fn);
12+ }
13 }
14 }
15
16@@ -1463,6 +1468,8 @@ void timeline_update_indexes(snac *snac, const char *id)
17 else
18 srv_debug(1, xs_fmt("Not added to public instance index %s", id));
19 }
20+ else
21+ object_user_cache_add(snac, id, "personal");
22 }
23 }
24 }
25@@ -3877,14 +3884,14 @@ void purge_server(void)
26 }
27
28
29-void delete_purged_posts(snac *user, int days)
30+void delete_purged_posts(snac *user, const char *subdir, int days)
31 /* enqueues Delete activities for local purged messages */
32 {
33 if (days == 0)
34 return;
35
36 time_t mt = time(NULL) - days * 24 * 3600;
37- xs *spec = xs_fmt("%s/public/" "*.json", user->basedir);
38+ xs *spec = xs_fmt("%s/%s/" "*.json", user->basedir, subdir);
39 xs *list = xs_glob(spec, 0, 0);
40 const char *v;
41
42@@ -3937,15 +3944,18 @@ void purge_user(snac *snac)
43 pub_days = user_days;
44 }
45
46- if (xs_is_true(xs_dict_get(srv_config, "propagate_local_purge")))
47- delete_purged_posts(snac, pub_days);
48+ if (xs_is_true(xs_dict_get(srv_config, "propagate_local_purge"))) {
49+ delete_purged_posts(snac, "public", pub_days);
50+ delete_purged_posts(snac, "personal", pub_days);
51+ }
52
53 _purge_user_subdir(snac, "hidden", priv_days);
54 _purge_user_subdir(snac, "private", priv_days);
55
56- _purge_user_subdir(snac, "public", pub_days);
57+ _purge_user_subdir(snac, "public", pub_days);
58+ _purge_user_subdir(snac, "personal", pub_days);
59
60- const char *idxs[] = { "followers.idx", "private.idx", "public.idx",
61+ const char *idxs[] = { "followers.idx", "private.idx", "public.idx", "personal.idx",
62 "pinned.idx", "bookmark.idx", "draft.idx", "sched.idx", NULL };
63
64 for (n = 0; idxs[n]; n++) {