Added config for status archiver

This commit is contained in:
localhost_frssoft 2022-08-09 09:48:48 +03:00
parent a85d67dab5
commit 7c09fb0307
3 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,7 @@
{ {
"instance": "soc.phreedom.club", "instance": "soc.phreedom.club",
"statuses_file_archive": true,
"statuses_file_archive_after_time": 86400,
"main_proxy": "", "main_proxy": "",
"connect_protocol_via_main_proxy": "https", "connect_protocol_via_main_proxy": "https",
"i2p_http_proxy_addr": "http://127.0.0.1:4444", "i2p_http_proxy_addr": "http://127.0.0.1:4444",

View file

@ -31,6 +31,7 @@ proxy_init
instance_point="$default_connect_protocol://$instance/api/v1" instance_point="$default_connect_protocol://$instance/api/v1"
instance_point_pleroma="$default_connect_protocol://$instance/api/pleroma" instance_point_pleroma="$default_connect_protocol://$instance/api/pleroma"
instance_hist='instance.hist' instance_hist='instance.hist'
statuses_file_archive=$(jj -i config.json statuses_file_archive)
enabled_nsfw=$(jj -i config.json enabled_nsfw) enabled_nsfw=$(jj -i config.json enabled_nsfw)
nsfw_only=$(jj -i config.json nsfw_only) nsfw_only=$(jj -i config.json nsfw_only)
hide_reblogs=$(jj -i config.json hide_reblogs) hide_reblogs=$(jj -i config.json hide_reblogs)
@ -799,7 +800,9 @@ statuses_auto_update()
sleep 3 sleep 3
done done
echo "Sleeping..." echo "Sleeping..."
./utils/statuses_archiver.sh if [ "$statuses_file_archive" = 'true' ]; then
./utils/statuses_archiver.sh
fi
sleep 30 sleep 30
done done
} }

View file

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
mkdir -p "$main_basedir/archives/" mkdir -p "$main_basedir/archives/"
unixtime_offset=$(expr $(date "+%s") - 86400) statuses_file_archive_after_time=$(jj -i "$main_basedir"/config.json statuses_file_archive_after_time)
unixtime_offset=$(expr $(date "+%s") - $statuses_file_archive_after_time)
for i in "$main_basedir"/all_statuses/$instance/*; do for i in "$main_basedir"/all_statuses/$instance/*; do