diff --git a/Gemfile b/Gemfile index ba048d9..0a98453 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' gem 'didkit', '~> 0.2' gem 'mastodon-api', git: 'https://github.com/mastodon/mastodon-api.git' -gem 'minisky', '~> 0.3' +gem 'minisky', '~> 0.4' gem 'io-console', '~> 0.5' gem 'json', '~> 2.5' diff --git a/Gemfile.lock b/Gemfile.lock index b19713e..38bec47 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,6 +13,7 @@ GEM specs: addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) + base64 (0.2.0) bigdecimal (3.1.7) buftok (0.3.0) didkit (0.2.0) @@ -33,7 +34,8 @@ GEM ffi-compiler (>= 1.0, < 2.0) io-console (0.7.2) json (2.7.1) - minisky (0.3.1) + minisky (0.4.0) + base64 (~> 0.1) net-http (0.4.1) uri oj (3.16.3) @@ -52,7 +54,7 @@ DEPENDENCIES io-console (~> 0.5) json (~> 2.5) mastodon-api! - minisky (~> 0.3) + minisky (~> 0.4) net-http (~> 0.2) uri (~> 0.13) yaml (~> 0.1) diff --git a/app/bluesky_account.rb b/app/bluesky_account.rb index eb3a68a..6c01fcc 100644 --- a/app/bluesky_account.rb +++ b/app/bluesky_account.rb @@ -41,17 +41,11 @@ class BlueskyAccount end def fetch_blob(cid) - # todo - @sky.get_blob('com.atproto.sync.getBlob', { did: @sky.user.did, cid: cid }) + @sky.get_request('com.atproto.sync.getBlob', { did: @sky.user.did, cid: cid }) end def delete_record_at(uri) repo, collection, rkey = uri.split('/')[2..4] - - begin - @sky.post_request('com.atproto.repo.deleteRecord', { repo: repo, collection: collection, rkey: rkey }) - rescue JSON::ParserError - # todo - end + @sky.post_request('com.atproto.repo.deleteRecord', { repo: repo, collection: collection, rkey: rkey }) end end diff --git a/app/bluesky_client.rb b/app/bluesky_client.rb index b3e5dc3..5c59e42 100644 --- a/app/bluesky_client.rb +++ b/app/bluesky_client.rb @@ -24,25 +24,4 @@ class BlueskyClient def save_config File.write(CONFIG_FILE, YAML.dump(@config)) end - - def get_blob(method, params = nil) - check_access - - headers = authentication_header(true) - url = URI("#{base_url}/#{method}") - - if params && !params.empty? - url.query = URI.encode_www_form(params) - end - - request = Net::HTTP::Get.new(url, headers) - response = make_request(request) - - case response - when Net::HTTPSuccess - response.body - else - handle_response(response) - end - end end