mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-25 11:51:28 +00:00
Proxy support global main proxy; Update README.md
This commit is contained in:
parent
5c08b9de1a
commit
eb5a57dd35
16
README.md
16
README.md
|
@ -7,6 +7,22 @@ Features:
|
||||||
* Switch instance from public list in config.json or manual input. Also recent used instance list.
|
* Switch instance from public list in config.json or manual input. Also recent used instance list.
|
||||||
* All others futures maybe working 50/50
|
* 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"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Depends:
|
Depends:
|
||||||
* [jj](http://gitea.phreedom.club/localhost_frssoft/jj)
|
* [jj](http://gitea.phreedom.club/localhost_frssoft/jj)
|
||||||
* [curl](https://curl.se/)
|
* [curl](https://curl.se/)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
{
|
{
|
||||||
"instance": "soc.phreedom.club",
|
"instance": "soc.phreedom.club",
|
||||||
|
"main_proxy": "",
|
||||||
|
"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",
|
||||||
"tor_proxy_addr": "socks5://127.0.0.1:9050",
|
"tor_proxy_addr": "socks5://127.0.0.1:9050",
|
||||||
"max_statuses": 40,
|
"max_statuses": 40,
|
||||||
|
|
|
@ -5,18 +5,22 @@ alias default_auth_browser=links
|
||||||
|
|
||||||
proxy_init()
|
proxy_init()
|
||||||
{
|
{
|
||||||
if [ $(echo "$instance" | grep -q 'i2p$' ; echo $?) -eq 0 ]; then
|
main_proxy=$(jj -i config.json main_proxy)
|
||||||
|
if [ -n "$main_proxy" ]; then
|
||||||
|
default_connect_protocol=$(jj -i config.json connect_protocol_via_main_proxy)
|
||||||
|
ALL_PROXY="$main_proxy"
|
||||||
|
elif [ $(echo "$instance" | grep -q 'i2p$' ; echo $?) -eq 0 ]; then
|
||||||
default_connect_protocol='http'
|
default_connect_protocol='http'
|
||||||
proxy=$(jj -i config.json i2p_http_proxy_addr)
|
ALL_PROXY=$(jj -i config.json i2p_http_proxy_addr)
|
||||||
elif [ $(echo "$instance" | grep -q 'onion$'; echo $?) -eq 0 ]; then
|
elif [ $(echo "$instance" | grep -q 'onion$'; echo $?) -eq 0 ]; then
|
||||||
default_connect_protocol='https'
|
default_connect_protocol='https'
|
||||||
proxy=$(jj -i config.json tor_proxy_addr)
|
ALL_PROXY=$(jj -i config.json tor_proxy_addr)
|
||||||
else
|
else
|
||||||
default_connect_protocol='https'
|
default_connect_protocol='https'
|
||||||
proxy=''
|
ALL_PROXY=''
|
||||||
fi
|
fi
|
||||||
export default_connect_protocol
|
export default_connect_protocol
|
||||||
export proxy
|
export ALL_PROXY
|
||||||
}
|
}
|
||||||
proxy_init
|
proxy_init
|
||||||
|
|
||||||
|
@ -48,11 +52,11 @@ make_login()
|
||||||
if [ -n "$auth" ]; then
|
if [ -n "$auth" ]; then
|
||||||
default_curl_opt()
|
default_curl_opt()
|
||||||
{
|
{
|
||||||
curl --proxy "$proxy" -s --compressed -H "Authorization: Bearer $auth" "$@"
|
curl -s --compressed -H "Authorization: Bearer $auth" "$@"
|
||||||
}
|
}
|
||||||
post_request()
|
post_request()
|
||||||
{
|
{
|
||||||
curl --proxy "$proxy" -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
|
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
|
||||||
}
|
}
|
||||||
echo '+Authorized account+'
|
echo '+Authorized account+'
|
||||||
export default_curl_opt
|
export default_curl_opt
|
||||||
|
@ -60,7 +64,7 @@ make_login()
|
||||||
else
|
else
|
||||||
default_curl_opt()
|
default_curl_opt()
|
||||||
{
|
{
|
||||||
curl --proxy "$proxy" -s --compressed "$1"
|
curl -s --compressed "$1"
|
||||||
}
|
}
|
||||||
export default_curl_opt
|
export default_curl_opt
|
||||||
export post_request=
|
export post_request=
|
||||||
|
|
Loading…
Reference in a new issue