snarfed / bridgy-fed

🌉 A bridge between decentralized social network protocols
https://fed.brid.gy
Creative Commons Zero v1.0 Universal
627 stars 30 forks source link

AP => Bluesky: don't wait for follow before sending posts #999

Closed snarfed closed 5 months ago

snarfed commented 5 months ago

Right now, if you opt in from the fediverse, we still don't send your posts to Bluesky until someone there follows you. This consistently confuses people; we should change it to proactively send posts, especially since fediverse people are explicitly opting in.

snarfed commented 5 months ago

Done! Hopefully.

qazmlp commented 5 months ago

This won't work unless a bridged user (from any network, due to the shared inbox) follows the AP user. Most AP servers don't send posts to remote instances unless there are any followers of that specific local user there.

Related to #975 and #1018.

snarfed commented 5 months ago

Hah, true, I forgot the other part of this that I planned to do: have the bot user follow them back. Reopening.

snarfed commented 5 months ago

Done! Now, when someone on the fediverse follows @bsky.brid.gy@bsky.brid.gy, it will follow them back, which should make sure that we start receiving their new posts immediately.

Now, for the second part of this: backfilling and making that bot user follow all existing fediverse users.

snarfed commented 5 months ago

Running this script now:

bot = Web.get_by_id('bsky.brid.gy')
now = util.now().isoformat()

for user in ActivityPub.query(ActivityPub.enabled_protocols == 'atproto'):
  follow_id = f'https://bsky.brid.gy/#follow-back-{user.key.id()}-{now}'
  follow = Object(id=follow_id, source_protocol='web', our_as1={
      'objectType': 'activity',
      'verb': 'follow',
      'id': follow_id,
      'actor': bot.key.id(),
      'object': user.key.id(),
  })
  try:
    user.send(follow, user.target_for(user.obj), from_user=bot)
  except BaseException as e:
    logging.info('', exc_info=True)