Skip to content

Commit

Permalink
hack: generate #account events on updateHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBuchanan314 committed Dec 8, 2024
1 parent c61701a commit e755cb0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/ACCOUNTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You'll probably run into some error messages because the relay doesn't know abou
curl --json '{"hostname": "https://pds.example.com"}' "https://bsky.network/xrpc/com.atproto.sync.requestCrawl"
```

Now we need to emit an `#identity` event (probably an `#account` event too but millipds doesn't do that yet!!!). This can be done by heading to your settings in `bsky.app` and "changing" your handle to the value it already is (e.g. `bob.example.com`) - this tells millipds to emit an `#identity` event. (I'll make this part more automatic in the future)
Now we need to emit an `#identity` event. This can be done by heading to your settings in `bsky.app` and "changing" your handle to the value it already is (e.g. `bob.example.com`) - this tells millipds to emit an `#identity` event. (I'll make this part more automatic in the future) (Note: as a temp workaround, this will also generate an `#account` event, which is maybe-necessary. unsure! In the future this should be triggered by account creation itself, probably.)

The relay should be paying attention now, but maybe not the appview. To make the appview start indexing your posts, I *think* you need to create a bluesky profile record first, which can be done by setting your display name and/or bio (e.g. from `bsky.app`).

Expand Down
20 changes: 20 additions & 0 deletions src/millipds/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,26 @@ async def identity_update_handle(request: web.Request):
(firehose_seq, 0, firehose_bytes) # TODO: put sensible timestamp here...
)
await atproto_repo.firehose_broadcast(request, (firehose_seq, firehose_bytes))

# temp hack: #account events shouldn't really be generated here
with get_db(request).new_con() as con:
# TODO: refactor to avoid duplicated logic between here and apply_writes
firehose_seq = con.execute("SELECT IFNULL(MAX(seq), 0) + 1 FROM firehose").fetchone()[0]
firehose_bytes = cbrrr.encode_dag_cbor({
"t": "#account",
"op": 1
}) + cbrrr.encode_dag_cbor({
"seq": firehose_seq,
"did": request["authed_did"],
"time": util.iso_string_now(),
"active": True
})
con.execute(
"INSERT INTO firehose (seq, timestamp, msg) VALUES (?, ?, ?)",
(firehose_seq, 0, firehose_bytes) # TODO: put sensible timestamp here...
)
await atproto_repo.firehose_broadcast(request, (firehose_seq, firehose_bytes))

return web.Response()


Expand Down

0 comments on commit e755cb0

Please sign in to comment.