A simple Ruby server using Sinatra that serves Bluesky custom feeds

removed the feed rkey length limit

+8 -3
+1
CHANGELOG.md
··· 3 3 - added YARD documentation 4 4 - added explicit `base64` dependency in gemspec 5 5 - added `MAX_LIMIT` (100) and `DEFAULT_LIMIT` (50) constants 6 + - removed the length limit on feed rkeys, since it isn't actually limited to 15 6 7 - removed deprecated options `enable_unsafe_auth` and `validate_responses` 7 8 - fixed `rake:publish` not working with feed `description` is nil (thx @jthigpen) 8 9 - `rake:publish` shows a better error message when `createSession` requires a 2FA token
+1 -1
README.md
··· 29 29 - `publisher_did` – DID identifier of the account that you will publish the feed on (the string that starts with `did:plc:...`) 30 30 - `hostname` – the hostname on which the feed service will be run 31 31 32 - You also need to configure at least one feed by passing a feed key and a feed object. The key is the identifier (rkey) that will appear at the end of the feed URI – it must only contain characters that are valid in URLs (preferably all lowercase) and it can't be longer than 15 characters. The feed object is anything that implements the single required method `get_posts` (could be a class, a module or an instance). 32 + You also need to configure at least one feed by passing a feed key and a feed object. The key is the identifier (rkey) that will appear at the end of the feed URI – it must only contain characters that are valid in URLs (preferably all lowercase) and it should be rather short. The feed object is anything that implements the single required method `get_posts` (could be a class, a module or an instance). 33 33 34 34 So a simple setup could look like this: 35 35
-1
lib/blue_factory/modules/feeds.rb
··· 76 76 def validate_key(key) 77 77 raise ConfigurationError, "Key must be a string (got: #{key.inspect})" unless key.is_a?(String) 78 78 raise ConfigurationError, "Key must not be empty" if key == '' 79 - raise ConfigurationError, "Key must not be longer than 15 characters (got: #{key.inspect})" if key.length > 15 80 79 raise ConfigurationError, "Key #{key.inspect} contains invalid characters" if key !~ RKEY_REGEXP 81 80 end 82 81
+6 -1
spec/feeds_spec.rb
··· 34 34 { blue: true }, 35 35 ['a', 'b'], 36 36 '', 37 - 'Llan­fair­pwll­gwyn­gyll­gogery­chwyrn­drob­wlll­lanty­silio­gogo­goch', 38 37 'blue sky', 39 38 'gnu/linux', 40 39 'ohno!', ··· 45 44 bad_keys.each do |key| 46 45 expect { BlueFactory.add_feed(key, TestFeed.new) }.to raise_error(BlueFactory::ConfigurationError) 47 46 end 47 + end 48 + 49 + it 'should not raise an error for very long keys' do 50 + name = 'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch' 51 + 52 + expect { BlueFactory.add_feed(name, TestFeed.new) }.to_not raise_error 48 53 end 49 54 50 55 it "should raise an error when the feed doesn't have a get_posts method" do