Skip to content

Commit

Permalink
Graph component #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Scobiform committed Apr 20, 2024
1 parent 68bfd03 commit ab532aa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ async def fetch_followers():
if followers:
all_followers.extend(followers)

local_followers = [user for user in all_followers if ('@' in user['acct'] and user['acct'].split('@')[1] == config['instance_url']) or '@' not in user['acct']]

return jsonify(local_followers)
return jsonify(all_followers)
except Exception as e:
return jsonify({'error': str(e)}), 500

Expand All @@ -188,10 +186,8 @@ async def fetch_following():
following = mastodon.fetch_next(following)
if following:
all_following.extend(following)

local_following = [user for user in all_following if ('@' in user['acct'] and user['acct'].split('@')[1] == config['instance_url']) or '@' not in user['acct']]

return jsonify(local_following)
return jsonify(all_following)
except Exception as e:
return jsonify({'error': str(e)}), 500

Expand All @@ -217,6 +213,10 @@ async def search():

try:
results = mastodon.account_search(query, limit=10)

# Filter results for same instance as user
results = [result for result in results if re.search(r"//([^/@]+)", result['url']).group(1) == instance]

return jsonify(results)
except Exception as e:
return jsonify({'error': str(e)}), 500
Expand Down

0 comments on commit ab532aa

Please sign in to comment.