mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-22 17:41:29 +00:00
Compare commits
3 commits
d29a97b19c
...
60ff687f24
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | 60ff687f24 | ||
localhost_frssoft | e3844feb45 | ||
localhost_frssoft | d8e6271d8f |
74
README.md
74
README.md
|
@ -2,39 +2,51 @@
|
|||
|
||||
Эта ветка содержит прототип клиента, где взаимодействие с статусами\постами будет происходить через файлы
|
||||
|
||||
Just for fun. Simple "Client" API script for Pleroma (or maybe also Mastodon) instances.
|
||||
|
||||
Features:
|
||||
* Write longreads in Your default $EDITOR
|
||||
* List timelines
|
||||
* Switch instance from public list in config.json or manual input. Also recent used instance list.
|
||||
* All others futures maybe working 50/50
|
||||
|
||||
Note about proxy:
|
||||
Proxy by default autodetect i2p and onion (not tested) instances address.
|
||||
If provided main_proxy in config.json is disable i2p and onion instances autodetection.
|
||||
Also: don't forget change connect_protocol_via_main_proxy if set http proxy or any proxy without support https.
|
||||
|
||||
Note about auth:
|
||||
i2p and onion instances may no support (or disabled) OAuth2.
|
||||
Workaround: if instance have clearweb address, make auth and copy-paste token in .auth.json, example:
|
||||
## Схема дерева файлов-постов сгруппированных по аккаунтам
|
||||
```
|
||||
{
|
||||
"your.authorized.instance": "xxx",
|
||||
"abc123instance.i2p": "xxx",
|
||||
"abc123instance.onion": "xxx"
|
||||
}
|
||||
[statuses]
|
||||
|
|
||||
|-[instance]
|
||||
| |---[acct]
|
||||
| | |
|
||||
| | |--- [status_id]
|
||||
| | | |
|
||||
| | | |---content
|
||||
| | | |---status-id.json
|
||||
| | | |---media_attachments.m3u8
|
||||
| |... |--- ...
|
||||
|...
|
||||
```
|
||||
На данный момент статусы теперь линкуются из папки all_statuses/$instance, где содержатся не сгруппированные посты
|
||||
Время папок с постами соотвествует постам
|
||||
|
||||
|
||||
## Что доступно:
|
||||
|
||||
### Режим мониторинга файлов и автообновление ленты (пока только home)
|
||||
```
|
||||
daemon_mode=yes ./pleroma-cli.sh
|
||||
```
|
||||
|
||||
Depends:
|
||||
* [jj](http://gitea.phreedom.club/localhost_frssoft/jj)
|
||||
* [curl](https://curl.se/)
|
||||
* [fzy](https://github.com/jhawthorn/fzy)
|
||||
* Any browser (links set by default) - for authorization on instances
|
||||
### Частичное взаимодействие с постами:
|
||||
Чтобы добавить в избранное или бустануть пост нужно в папке с постом создать файл favourite и\или share
|
||||
```
|
||||
touch favourite
|
||||
touch share
|
||||
```
|
||||
|
||||
Opt. Depends:
|
||||
* gpg - for decrypt PGP messages
|
||||
* awk - parse PGP standart messages
|
||||
* Any media player
|
||||
### Чтение
|
||||
Учитывая то, что каждый пост-статус это файл, то вы можете вывести все посты за раз например так:
|
||||
```
|
||||
# все тексты постов
|
||||
cat all_statuses/instance.example/*/content
|
||||
|
||||
Also, thk Tolstoevsky for Pleroma instance (set by default instance)
|
||||
# все тексты постов пользователя
|
||||
cat statuses/instance.example/nick@abc/*/content
|
||||
|
||||
# Посмотреть все мультимедия вложения
|
||||
cat all_statuses/instance.example/*/media_attachments.m3u8 | mpv --playlist=-
|
||||
|
||||
# Прочие "игры" с постами, например узнать кто более активен в вашем инстансе среди загруженных постов
|
||||
cat all_statuses/instance.example/*/*.json | jj -l '..#.account.acct' | sort | uniq -c | sort -r
|
||||
```
|
||||
|
|
|
@ -979,6 +979,38 @@ custom_manual_api_request()
|
|||
done
|
||||
}
|
||||
|
||||
statuses_auto_update()
|
||||
{
|
||||
while true; do
|
||||
echo "Updating statuses..."
|
||||
timeline='home'
|
||||
export instance
|
||||
timeline_api | ./utils/statuses2files.sh
|
||||
echo "Waiting..."
|
||||
sleep 30
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$daemon_mode" = 'yes' ]; then
|
||||
echo "Daemon mode started; files listening..."
|
||||
statuses_auto_update &
|
||||
while true; do
|
||||
sleep 5
|
||||
statuses_to_fav=$(/bin/ls $main_basedir/all_statuses/$instance/*/favourite 2>/dev/null)
|
||||
statuses_to_share=$(/bin/ls $main_basedir/all_statuses/$instance/*/share 2>/dev/null)
|
||||
if [ -n "$statuses_to_fav" ]; then
|
||||
status_id=$(dirname "$statuses_to_fav" | sed 's/.*\///g')
|
||||
favorite_api_status $status_id
|
||||
rm $statuses_to_fav
|
||||
fi
|
||||
if [ -n "$statuses_to_share" ]; then
|
||||
status_id=$(dirname "$statuses_to_share" | sed 's/.*\///g')
|
||||
share_api_status $status_id
|
||||
rm $statuses_to_share
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
menu_write_status='Write status'
|
||||
menu_timeline='Timelines'
|
||||
notif='Notifications'
|
||||
|
|
|
@ -14,7 +14,6 @@ for i in $ids; do
|
|||
status_media_attachments=$(echo "$json" | jj -l "#[id=$i].media_attachments.#.url" | tr -d '"\v')
|
||||
|
||||
chmod 711 "$main_basedir"/all_statuses/$instance/$status_id
|
||||
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$status_id
|
||||
|
||||
if [ -n "$content" ]; then
|
||||
echo "$content" > "$main_basedir"/all_statuses/$instance/$status_id/content
|
||||
|
@ -23,6 +22,7 @@ for i in $ids; do
|
|||
echo "$status_media_attachments" > "$main_basedir"/all_statuses/$instance/$status_id/media_attachments.m3u8
|
||||
fi
|
||||
chmod 600 "$main_basedir"/all_statuses/$instance/$status_id/*
|
||||
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$status_id
|
||||
done
|
||||
|
||||
export ids
|
||||
|
|
|
@ -15,7 +15,9 @@ for i in $ids; do
|
|||
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
||||
continue
|
||||
fi
|
||||
status_date=$(echo "$json" | jj "#[id=$1].created_at")
|
||||
mkdir -m 711 -p "$main_basedir"/all_statuses/$instance/$i
|
||||
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$i
|
||||
echo "$json" | jj -p "#[id=$i]" > "$main_basedir"/all_statuses/$instance/$i/$i.json
|
||||
done
|
||||
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Move statuses to acct dirs
|
||||
# [statuses]
|
||||
# |
|
||||
# |---[acct]
|
||||
# | |
|
||||
# | |--- [status_id]
|
||||
# | |--- ...
|
||||
# |...
|
||||
|
||||
json=$(cat)
|
||||
|
||||
|
@ -17,6 +10,7 @@ for i in $ids; do
|
|||
mkdir -m 711 -p "$main_basedir"/statuses/$instance/$acct
|
||||
if [ -n "$status_id" ]; then
|
||||
ln -s -r "$main_basedir"/all_statuses/$instance/$status_id "$main_basedir"/statuses/$instance/$acct/$status_id
|
||||
touch --reference "$main_basedir"/all_statuses/$instance/$status_id "$main_basedir"/statuses/$instance/$acct/$status_id
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue