jekyll-bluesky 0.26.0 → 0.27.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 +4 -4
- data/lib/jekyll-bluesky/version.rb +1 -1
- data/lib/jekyll-bluesky.rb +5 -53
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 691243e229e2c2e2656db46ed566ea514d337017f3fc00849adf34d75c0cb315
|
4
|
+
data.tar.gz: f4bf2934f95900d071c714172d14eb5a409af1d9a3310992c1b0c2df2d034699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca1be8d51f26fd13937e5532a3f0cdba7cb436866411f9e1bbc75418af6f3352ccb0990cab74550fcc3aea1ec502874093949744fb3ad3b17c7346135d66358c
|
7
|
+
data.tar.gz: f8e0eb5e24c11b05204eed30ea2d602e8283cfacf752c2ff833b680bb20e27d2c88aaadf15a0b1366f7b365c8e33a10cade7c2e41f57707cc2e446e8e05a5d71
|
data/lib/jekyll-bluesky.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
require 'jekyll'
|
3
3
|
require 'http'
|
4
4
|
require 'json'
|
5
|
-
require 'digest'
|
6
|
-
require 'fileutils'
|
7
5
|
require 'time' # Necessário para manipulação de datas
|
8
6
|
|
9
7
|
puts 'Plugin jekyll-bluesky load successfully!'
|
@@ -20,26 +18,7 @@ module Jekyll
|
|
20
18
|
|
21
19
|
def render(context)
|
22
20
|
Jekyll.logger.debug 'Rendering bluesky tag...'
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def fetch_posts
|
29
|
-
cache_key = Digest::MD5.hexdigest("#{@actor}-#{@limit}")
|
30
|
-
cached_response = cache.read(cache_key)
|
31
|
-
|
32
|
-
if cached_response
|
33
|
-
cached_response
|
34
|
-
else
|
35
|
-
response = Jekyll::Client.fetch_post(@actor, @limit)
|
36
|
-
cache.write(cache_key, response)
|
37
|
-
response
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def cache
|
42
|
-
@cache ||= FileCache.new('./.bluesky-cache')
|
21
|
+
Jekyll::Client.fetch_post(@actor, @limit)
|
43
22
|
end
|
44
23
|
end
|
45
24
|
|
@@ -83,7 +62,7 @@ module Jekyll
|
|
83
62
|
margin-bottom: 10px;
|
84
63
|
}
|
85
64
|
.bluesky-header {
|
86
|
-
display: flex;
|
65
|
+
display: inline-flex;
|
87
66
|
align-items: center;
|
88
67
|
justify-content: flex-start;
|
89
68
|
gap: 8px;
|
@@ -135,7 +114,7 @@ module Jekyll
|
|
135
114
|
text = record['text'].gsub("\n", "<br>")
|
136
115
|
author_name = author['displayName']
|
137
116
|
author_handle = author['handle']
|
138
|
-
post_time = calculate_post_time(record['createdAt'])
|
117
|
+
post_time = calculate_post_time(record['createdAt'])
|
139
118
|
|
140
119
|
image_html = ''
|
141
120
|
if embed && embed['$type'] == 'app.bsky.embed.images#view'
|
@@ -172,9 +151,8 @@ module Jekyll
|
|
172
151
|
styles + formatted_posts
|
173
152
|
end
|
174
153
|
|
175
|
-
# Método para calcular o tempo do post
|
176
154
|
def self.calculate_post_time(created_at)
|
177
|
-
post_time = Time.parse(created_at)
|
155
|
+
post_time = Time.parse(created_at)
|
178
156
|
current_time = Time.now
|
179
157
|
difference_in_seconds = (current_time - post_time).round
|
180
158
|
|
@@ -189,32 +167,6 @@ module Jekyll
|
|
189
167
|
end
|
190
168
|
end
|
191
169
|
end
|
192
|
-
|
193
|
-
class FileCache
|
194
|
-
def initialize(path)
|
195
|
-
@cache_folder = File.expand_path path
|
196
|
-
FileUtils.mkdir_p @cache_folder
|
197
|
-
end
|
198
|
-
|
199
|
-
def read(key)
|
200
|
-
file_to_read = cache_file(key)
|
201
|
-
File.read(file_to_read) if File.exist?(file_to_read)
|
202
|
-
end
|
203
|
-
|
204
|
-
def write(key, data)
|
205
|
-
file_to_write = cache_file(key)
|
206
|
-
File.open(file_to_write, 'w') do |f|
|
207
|
-
f.write(data)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
private
|
212
|
-
|
213
|
-
def cache_file(key)
|
214
|
-
File.join(@cache_folder, "#{key}.cache")
|
215
|
-
end
|
216
|
-
end
|
217
170
|
end
|
218
171
|
|
219
|
-
|
220
|
-
Liquid::Template.register_tag 'bluesky', Jekyll::BlueskyPlugin
|
172
|
+
Liquid::Template.register_tag 'bluesky', Jekyll::BlueskyPlugin
|