mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2024-11-29 20:31:28 +00:00
Compare commits
No commits in common. "2b91d414ca72b0f3700866154d9421058a651596" and "e7c586e26e739b6d145bc92eb36755db44d4b818" have entirely different histories.
2b91d414ca
...
e7c586e26e
|
@ -17,14 +17,13 @@ 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"
|
||||
chmod 600 ".app_sessions/$instance"
|
||||
--output ".app_sessions/$instance" \
|
||||
--create-file-mode 0600
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -32,7 +31,6 @@ 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
|
||||
|
@ -51,11 +49,10 @@ 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 > .auth
|
||||
chmod 600 .auth
|
||||
echo "$token" > .auth
|
||||
echo > "$basedir"/.auth
|
||||
chmod 600 "$basedir"/.auth
|
||||
echo "$token" > "$basedir"/.auth
|
||||
}
|
||||
|
||||
auth_api_get_token
|
||||
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ headers= {
|
|||
def get_notifications():
|
||||
params = {
|
||||
"limit": 15,
|
||||
"types": ["mention"]
|
||||
"type": "mention"
|
||||
}
|
||||
r = requests.get(instance_point + "/notifications", json=params, headers=headers)
|
||||
r = requests.get(instance_point + "/notifications", params, headers=headers)
|
||||
return r.json()
|
||||
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ 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