mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2024-11-26 04:51:28 +00:00
Compare commits
2 commits
e7c586e26e
...
2b91d414ca
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | 2b91d414ca | ||
localhost_frssoft | b5f2caf749 |
|
@ -17,13 +17,14 @@ export instance_point="https://$instance/api/v1"
|
|||
|
||||
auth_api_create_client()
|
||||
{
|
||||
mkdir -m 711 -p ".app_sessions"
|
||||
if [ ! -e ".app_sessions/$instance" ]; then
|
||||
curl -s --compressed --url "$instance_point/apps" \
|
||||
--data-urlencode "client_name=$client_name" \
|
||||
--data-urlencode 'redirect_uris=urn:ietf:wg:oauth:2.0:oob' \
|
||||
--data-urlencode 'scopes=read write follow' \
|
||||
--output ".app_sessions/$instance" \
|
||||
--create-file-mode 0600
|
||||
--output ".app_sessions/$instance"
|
||||
chmod 600 ".app_sessions/$instance"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -31,6 +32,7 @@ auth_api_get_code()
|
|||
{
|
||||
auth_api_create_client
|
||||
client_id=$(jq -r '.client_id' ".app_sessions/$instance")
|
||||
echo "Auth link (if fail) https://$instance/oauth/authorize?client_id=$client_id&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=read+write+follow"
|
||||
default_auth_browser "https://$instance/oauth/authorize?client_id=$client_id&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=read+write+follow"
|
||||
echo 'Input token-code:'
|
||||
read pass
|
||||
|
@ -49,10 +51,11 @@ auth_api_get_token()
|
|||
--data-urlencode "redirect_uri=urn:ietf:wg:oauth:2.0:oob" \
|
||||
--data-urlencode 'scope=read write follow' \
|
||||
--data-urlencode "code=$pass" | jq -r '.access_token')
|
||||
echo > "$basedir"/.auth
|
||||
chmod 600 "$basedir"/.auth
|
||||
echo "$token" > "$basedir"/.auth
|
||||
echo > .auth
|
||||
chmod 600 .auth
|
||||
echo "$token" > .auth
|
||||
}
|
||||
|
||||
auth_api_get_token
|
||||
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ headers= {
|
|||
def get_notifications():
|
||||
params = {
|
||||
"limit": 15,
|
||||
"type": "mention"
|
||||
"types": ["mention"]
|
||||
}
|
||||
r = requests.get(instance_point + "/notifications", params, headers=headers)
|
||||
r = requests.get(instance_point + "/notifications", json=params, headers=headers)
|
||||
return r.json()
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ def get_control_mention():
|
|||
|
||||
notif = get_notifications()
|
||||
for i in notif:
|
||||
if i['type'] != "mention":
|
||||
continue
|
||||
seen = i['pleroma']['is_seen']
|
||||
acct_mention = i['account']['acct']
|
||||
reply_to_id = i['status']['in_reply_to_id']
|
||||
|
|
Loading…
Reference in a new issue