A simple Ruby server using Sinatra that serves Bluesky custom feeds
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

support old API with a warning until 0.3

+17 -2
+12
lib/blue_factory/configuration.rb
··· 16 16 configurable :publisher_did, :hostname, :validate_responses, :enable_unsafe_auth 17 17 18 18 set :validate_responses, (environment != :production) 19 + 20 + def self.set(property, value) 21 + if property.to_sym == :enable_unsafe_auth 22 + puts "===" 23 + puts "WARNING: option :enable_unsafe_auth and old API get_posts(args, user_did) is deprecated and will be removed in version 0.3." 24 + puts "Switch to get_posts(args, context) instead and get the user DID from: context.user.raw_did." 25 + puts "===" 26 + @enable_unsafe_auth = value 27 + else 28 + super 29 + end 30 + end 19 31 end
+1 -1
lib/blue_factory/modules/configurable.rb
··· 14 14 if @properties.include?(property.to_sym) 15 15 self.instance_variable_set("@#{property}", value) 16 16 else 17 - raise NoMethodError 17 + raise NoMethodError, "No such property: #{property}" 18 18 end 19 19 end 20 20
+4 -1
lib/blue_factory/server.rb
··· 78 78 get_posts = feed.method(:get_posts) 79 79 args = params.slice(:feed, :cursor, :limit) 80 80 81 - if get_posts.arity == 1 81 + if config.enable_unsafe_auth 82 + context = RequestContext.new(request) 83 + response = feed.get_posts(args, context.user.raw_did) 84 + elsif get_posts.arity == 1 82 85 response = feed.get_posts(args) 83 86 elsif get_posts.arity == 2 84 87 context = RequestContext.new(request)