jekyll-bluesky 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/jekyll-bluesky/bluesky.rb +67 -0
- data/lib/jekyll-bluesky/version.rb +6 -0
- data/lib/jekyll_bluesky.rb +23 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2384338c27ba72c60953c743497dde3c04364dbe56f0c293eb06aaee8e23354d
|
4
|
+
data.tar.gz: 6d8b96a6847867e0c962313d958d3b07fdb6a314af8fd7ff613a2721a465dce7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9131d32cbd0f2eb14ec034ee1c10e2289f21169ea08d6b4c799ee22637484884151fa0c01e110c8bf84b0751a2fc7705bd9f2a540aaf20794ee2956248d88e7f
|
7
|
+
data.tar.gz: 0074ee94d5285f2a1c3537e7065cbb5e530830ac8567ed31425c779d79fd3bb980b1fc23503e3edc5c7d686cd486c72dfa58a2c2f605c6f4210b5c29354c4325
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# lib/jekyll-bluesky/bluesky.rb
|
2
|
+
module Jekyll
|
3
|
+
module Bluesky
|
4
|
+
class Client
|
5
|
+
API_URL = "https://public.api.bsky.app" # Substitua pela URL correta da API do Bluesky
|
6
|
+
|
7
|
+
def self.fetch_post(actor, limit)
|
8
|
+
response = HTTP.get("#{API_URL}/xrpc/app.bsky.feed.getAuthorFeed?actor=#{actor}&limit=#{limit}&filter=posts_and_author_threads")
|
9
|
+
if response.status.success?
|
10
|
+
data = JSON.parse(response.body)
|
11
|
+
format_post(data)
|
12
|
+
else
|
13
|
+
"Error fetching post from Bluesky."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.format_post(data)
|
18
|
+
posts = data["feed"] # Acessa a lista de posts
|
19
|
+
posts.map do |post|
|
20
|
+
post_data = post["post"]
|
21
|
+
author = post_data["author"]
|
22
|
+
record = post_data["record"]
|
23
|
+
embed = post_data["embed"]
|
24
|
+
|
25
|
+
# Extrai o texto do post
|
26
|
+
text = record["text"]
|
27
|
+
|
28
|
+
# Formata o nome do autor e o handle
|
29
|
+
author_name = author["displayName"]
|
30
|
+
author_handle = author["handle"]
|
31
|
+
|
32
|
+
# Extrai a imagem (se houver)
|
33
|
+
image_html = ""
|
34
|
+
if embed && embed["$type"] == "app.bsky.embed.images#view"
|
35
|
+
image_html = embed["images"].map do |image|
|
36
|
+
<<~HTML
|
37
|
+
<img src="#{image['thumb']}" alt="#{image['alt']}" class="bluesky-image" />
|
38
|
+
HTML
|
39
|
+
end.join
|
40
|
+
end
|
41
|
+
|
42
|
+
# Gera o HTML do post
|
43
|
+
<<~HTML
|
44
|
+
<div class="bluesky-post">
|
45
|
+
<div class="bluesky-author">
|
46
|
+
<img src="#{author['avatar']}" alt="#{author_name}" class="bluesky-avatar" />
|
47
|
+
<div class="bluesky-author-info">
|
48
|
+
<strong>#{author_name}</strong>
|
49
|
+
<small>@#{author_handle}</small>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
<div class="bluesky-content">
|
53
|
+
<p>#{text}</p>
|
54
|
+
#{image_html}
|
55
|
+
</div>
|
56
|
+
<div class="bluesky-stats">
|
57
|
+
<span>❤️ #{post_data["likeCount"]}</span>
|
58
|
+
<span>🔁 #{post_data["repostCount"]}</span>
|
59
|
+
<span>💬 #{post_data["replyCount"]}</span>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
HTML
|
63
|
+
end.join("\n")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# lib/jekyll_bluesky.rb
|
2
|
+
require "jekyll"
|
3
|
+
require "http"
|
4
|
+
require "json"
|
5
|
+
require "jekyll-bluesky/bluesky" # Corrigido o caminho
|
6
|
+
|
7
|
+
module Jekyll
|
8
|
+
class BlueskyPlugin < Liquid::Tag
|
9
|
+
def initialize(tag_name, text, tokens)
|
10
|
+
super
|
11
|
+
args = text.strip.split
|
12
|
+
@actor = args[0]
|
13
|
+
@limit = args[1] || "10"
|
14
|
+
end
|
15
|
+
|
16
|
+
def render(context)
|
17
|
+
bluesky_posts = Jekyll::Bluesky::Client.fetch_post(@actor, @limit)
|
18
|
+
bluesky_posts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Liquid::Template.register_tag("bluesky", Jekyll::BlueskyPlugin)
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-bluesky
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Felipe Dias
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-02-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.9.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.9.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: http
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
description: This Jekyll plugin allows displaying Bluesky tweets directly on a static
|
42
|
+
site. It fetches posts from the decentralized social network Bluesky and incorporates
|
43
|
+
them into the content generated by Jekyll, making it easier to integrate real-time
|
44
|
+
updates without the need for complex external APIs.
|
45
|
+
email: felipe@dias.dev.br
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- lib/jekyll-bluesky/bluesky.rb
|
51
|
+
- lib/jekyll-bluesky/version.rb
|
52
|
+
- lib/jekyll_bluesky.rb
|
53
|
+
homepage: https://github.com/fdoliv/jekyll-bluesky
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 3.0.0
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubygems_version: 3.4.10
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: This Jekyll plugin displays Bluesky tweets on the site, enabling automatic
|
76
|
+
and customizable integration of posts without relying on external dynamic solutions.
|
77
|
+
test_files: []
|