tangled
alpha
login
or
join now
mackuba.eu
/
tootify
2
fork
atom
Toot toooooooot (Bluesky-Mastodon cross-poster)
2
fork
atom
overview
issues
pulls
pipelines
update to latest minisky
mackuba.eu
2 years ago
af9545b3
932255be
+7
-32
4 changed files
expand all
collapse all
unified
split
Gemfile
Gemfile.lock
app
bluesky_account.rb
bluesky_client.rb
+1
-1
Gemfile
···
2
2
3
3
gem 'didkit', '~> 0.2'
4
4
gem 'mastodon-api', git: 'https://github.com/mastodon/mastodon-api.git'
5
5
-
gem 'minisky', '~> 0.3'
5
5
+
gem 'minisky', '~> 0.4'
6
6
7
7
gem 'io-console', '~> 0.5'
8
8
gem 'json', '~> 2.5'
+4
-2
Gemfile.lock
···
13
13
specs:
14
14
addressable (2.8.6)
15
15
public_suffix (>= 2.0.2, < 6.0)
16
16
+
base64 (0.2.0)
16
17
bigdecimal (3.1.7)
17
18
buftok (0.3.0)
18
19
didkit (0.2.0)
···
33
34
ffi-compiler (>= 1.0, < 2.0)
34
35
io-console (0.7.2)
35
36
json (2.7.1)
36
36
-
minisky (0.3.1)
37
37
+
minisky (0.4.0)
38
38
+
base64 (~> 0.1)
37
39
net-http (0.4.1)
38
40
uri
39
41
oj (3.16.3)
···
52
54
io-console (~> 0.5)
53
55
json (~> 2.5)
54
56
mastodon-api!
55
55
-
minisky (~> 0.3)
57
57
+
minisky (~> 0.4)
56
58
net-http (~> 0.2)
57
59
uri (~> 0.13)
58
60
yaml (~> 0.1)
+2
-8
app/bluesky_account.rb
···
41
41
end
42
42
43
43
def fetch_blob(cid)
44
44
-
# todo
45
45
-
@sky.get_blob('com.atproto.sync.getBlob', { did: @sky.user.did, cid: cid })
44
44
+
@sky.get_request('com.atproto.sync.getBlob', { did: @sky.user.did, cid: cid })
46
45
end
47
46
48
47
def delete_record_at(uri)
49
48
repo, collection, rkey = uri.split('/')[2..4]
50
50
-
51
51
-
begin
52
52
-
@sky.post_request('com.atproto.repo.deleteRecord', { repo: repo, collection: collection, rkey: rkey })
53
53
-
rescue JSON::ParserError
54
54
-
# todo
55
55
-
end
49
49
+
@sky.post_request('com.atproto.repo.deleteRecord', { repo: repo, collection: collection, rkey: rkey })
56
50
end
57
51
end
-21
app/bluesky_client.rb
···
24
24
def save_config
25
25
File.write(CONFIG_FILE, YAML.dump(@config))
26
26
end
27
27
-
28
28
-
def get_blob(method, params = nil)
29
29
-
check_access
30
30
-
31
31
-
headers = authentication_header(true)
32
32
-
url = URI("#{base_url}/#{method}")
33
33
-
34
34
-
if params && !params.empty?
35
35
-
url.query = URI.encode_www_form(params)
36
36
-
end
37
37
-
38
38
-
request = Net::HTTP::Get.new(url, headers)
39
39
-
response = make_request(request)
40
40
-
41
41
-
case response
42
42
-
when Net::HTTPSuccess
43
43
-
response.body
44
44
-
else
45
45
-
handle_response(response)
46
46
-
end
47
47
-
end
48
27
end