A simple Ruby server using Sinatra that serves Bluesky custom feeds

pass user context to the interactions handler

+5 -3
+5 -3
lib/blue_factory/server.rb
··· 111 111 end 112 112 113 113 get '/xrpc/app.bsky.feed.describeFeedGenerator' do 114 - return json_response({ 114 + json_response({ 115 115 did: config.service_did, 116 116 feeds: config.feed_keys.map { |f| { uri: feed_uri(f) }} 117 117 }) 118 118 end 119 119 120 120 get '/.well-known/did.json' do 121 - return json_response({ 121 + json_response({ 122 122 '@context': ['https://www.w3.org/ns/did/v1'], 123 123 id: config.service_did, 124 124 service: [ ··· 135 135 if config.interactions_handler 136 136 json = JSON.parse(request.body.read) 137 137 interactions = json['interactions'].map { |x| Interaction.new(x) } 138 - config.interactions_handler.call(interactions) 138 + context = RequestContext.new(request) 139 + 140 + config.interactions_handler.call(interactions, context) 139 141 status 200 140 142 else 141 143 json_error('MethodNotImplemented', 'Method Not Implemented', status: 501)