diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 24 |
1 files changed, 17 insertions, 7 deletions
| @@ -1383,8 +1383,13 @@ xs_str *timeline_fn_by_md5(snac *snac, const char *md5) | |||
| 1383 | fn = xs_free(fn); | 1383 | fn = xs_free(fn); |
| 1384 | fn = xs_fmt("%s/public/%s.json", snac->basedir, md5); | 1384 | fn = xs_fmt("%s/public/%s.json", snac->basedir, md5); |
| 1385 | 1385 | ||
| 1386 | if (mtime(fn) == 0.0) | 1386 | if (mtime(fn) == 0.0) { |
| 1387 | fn = xs_free(fn); | 1387 | fn = xs_free(fn); |
| 1388 | fn = xs_fmt("%s/personal/%s.json", snac->basedir, md5); | ||
| 1389 | |||
| 1390 | if (mtime(fn) == 0.0) | ||
| 1391 | fn = xs_free(fn); | ||
| 1392 | } | ||
| 1388 | } | 1393 | } |
| 1389 | } | 1394 | } |
| 1390 | 1395 | ||
| @@ -1463,6 +1468,8 @@ void timeline_update_indexes(snac *snac, const char *id) | |||
| 1463 | else | 1468 | else |
| 1464 | srv_debug(1, xs_fmt("Not added to public instance index %s", id)); | 1469 | srv_debug(1, xs_fmt("Not added to public instance index %s", id)); |
| 1465 | } | 1470 | } |
| 1471 | else | ||
| 1472 | object_user_cache_add(snac, id, "personal"); | ||
| 1466 | } | 1473 | } |
| 1467 | } | 1474 | } |
| 1468 | } | 1475 | } |
| @@ -3877,14 +3884,14 @@ void purge_server(void) | |||
| 3877 | } | 3884 | } |
| 3878 | 3885 | ||
| 3879 | 3886 | ||
| 3880 | void delete_purged_posts(snac *user, int days) | 3887 | void delete_purged_posts(snac *user, const char *subdir, int days) |
| 3881 | /* enqueues Delete activities for local purged messages */ | 3888 | /* enqueues Delete activities for local purged messages */ |
| 3882 | { | 3889 | { |
| 3883 | if (days == 0) | 3890 | if (days == 0) |
| 3884 | return; | 3891 | return; |
| 3885 | 3892 | ||
| 3886 | time_t mt = time(NULL) - days * 24 * 3600; | 3893 | time_t mt = time(NULL) - days * 24 * 3600; |
| 3887 | xs *spec = xs_fmt("%s/public/" "*.json", user->basedir); | 3894 | xs *spec = xs_fmt("%s/%s/" "*.json", user->basedir, subdir); |
| 3888 | xs *list = xs_glob(spec, 0, 0); | 3895 | xs *list = xs_glob(spec, 0, 0); |
| 3889 | const char *v; | 3896 | const char *v; |
| 3890 | 3897 | ||
| @@ -3937,15 +3944,18 @@ void purge_user(snac *snac) | |||
| 3937 | pub_days = user_days; | 3944 | pub_days = user_days; |
| 3938 | } | 3945 | } |
| 3939 | 3946 | ||
| 3940 | if (xs_is_true(xs_dict_get(srv_config, "propagate_local_purge"))) | 3947 | if (xs_is_true(xs_dict_get(srv_config, "propagate_local_purge"))) { |
| 3941 | delete_purged_posts(snac, pub_days); | 3948 | delete_purged_posts(snac, "public", pub_days); |
| 3949 | delete_purged_posts(snac, "personal", pub_days); | ||
| 3950 | } | ||
| 3942 | 3951 | ||
| 3943 | _purge_user_subdir(snac, "hidden", priv_days); | 3952 | _purge_user_subdir(snac, "hidden", priv_days); |
| 3944 | _purge_user_subdir(snac, "private", priv_days); | 3953 | _purge_user_subdir(snac, "private", priv_days); |
| 3945 | 3954 | ||
| 3946 | _purge_user_subdir(snac, "public", pub_days); | 3955 | _purge_user_subdir(snac, "public", pub_days); |
| 3956 | _purge_user_subdir(snac, "personal", pub_days); | ||
| 3947 | 3957 | ||
| 3948 | const char *idxs[] = { "followers.idx", "private.idx", "public.idx", | 3958 | const char *idxs[] = { "followers.idx", "private.idx", "public.idx", "personal.idx", |
| 3949 | "pinned.idx", "bookmark.idx", "draft.idx", "sched.idx", NULL }; | 3959 | "pinned.idx", "bookmark.idx", "draft.idx", "sched.idx", NULL }; |
| 3950 | 3960 | ||
| 3951 | for (n = 0; idxs[n]; n++) { | 3961 | for (n = 0; idxs[n]; n++) { |