Template of a custom feed generator service for the Bluesky network in Ruby
1require 'json' 2require 'open-uri' 3 4module Utils 5 def handle_from_did(did) 6 url = "https://plc.directory/#{did}" 7 json = JSON.parse(URI.open(url).read) 8 json['alsoKnownAs'][0].gsub('at://', '') 9 end 10 11 def did_from_handle(handle) 12 url = "https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=#{handle}" 13 json = JSON.parse(URI.open(url).read) 14 json['did'] 15 end 16 17 extend self 18end