Syndicate code posts to Github Gists
This commit is contained in:
3
slices/main/templates/shared/_gist.html.slim
Normal file
3
slices/main/templates/shared/_gist.html.slim
Normal file
@@ -0,0 +1,3 @@
|
||||
- w_class = defined?(width) ? width : "w-6"
|
||||
<svg class="fill-grey-900 hover:fill-grey-600 #{w_class}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M186.1 328.7c0 20.9-10.9 55.1-36.7 55.1s-36.7-34.2-36.7-55.1 10.9-55.1 36.7-55.1 36.7 34.2 36.7 55.1zM480 278.2c0 31.9-3.2 65.7-17.5 95-37.9 76.6-142.1 74.8-216.7 74.8-75.8 0-186.2 2.7-225.6-74.8-14.6-29-20.2-63.1-20.2-95 0-41.9 13.9-81.5 41.5-113.6-5.2-15.8-7.7-32.4-7.7-48.8 0-21.5 4.9-32.3 14.6-51.8 45.3 0 74.3 9 108.8 36 29-6.9 58.8-10 88.7-10 27 0 54.2 2.9 80.4 9.2 34-26.7 63-35.2 107.8-35.2 9.8 19.5 14.6 30.3 14.6 51.8 0 16.4-2.6 32.7-7.7 48.2 27.5 32.4 39 72.3 39 114.2zm-64.3 50.5c0-43.9-26.7-82.6-73.5-82.6-18.9 0-37 3.4-56 6-14.9 2.3-29.8 3.2-45.1 3.2-15.2 0-30.1-.9-45.1-3.2-18.7-2.6-37-6-56-6-46.8 0-73.5 38.7-73.5 82.6 0 87.8 80.4 101.3 150.4 101.3h48.2c70.3 0 150.6-13.4 150.6-101.3zm-82.6-55.1c-25.8 0-36.7 34.2-36.7 55.1s10.9 55.1 36.7 55.1 36.7-34.2 36.7-55.1-10.9-55.1-36.7-55.1z"/></svg>
|
||||
|
@@ -29,6 +29,10 @@ module Micropub
|
||||
{
|
||||
uid: "https://bsky.social",
|
||||
name: "Blue Sky"
|
||||
},
|
||||
{
|
||||
uid: "https://gist.github.com",
|
||||
name: "Gist"
|
||||
}
|
||||
]
|
||||
}.to_json
|
||||
@@ -44,6 +48,10 @@ module Micropub
|
||||
{
|
||||
uid: "https://bsky.social",
|
||||
name: "Blue Sky"
|
||||
},
|
||||
{
|
||||
uid: "https://gist.github.com",
|
||||
name: "Gist"
|
||||
}
|
||||
]
|
||||
}.to_json
|
||||
|
@@ -15,7 +15,7 @@ module Micropub
|
||||
post_params = prepare_params(params: post)
|
||||
created_post = post_repo.create(post_params)
|
||||
|
||||
# syndicate.call(created_post.id, post)
|
||||
syndicate.call(created_post.id, post)
|
||||
|
||||
# decorated_post = Decorators::Posts::Decorator.new(created_post)
|
||||
|
||||
|
@@ -11,6 +11,7 @@ module Micropub
|
||||
include Deps["settings",
|
||||
"syndication.mastodon",
|
||||
"syndication.blue_sky",
|
||||
"syndication.gist",
|
||||
add_post_syndication_source: "commands.posts.add_syndication_source",
|
||||
send_to_dayone: "syndication.dayone",
|
||||
]
|
||||
@@ -30,7 +31,13 @@ module Micropub
|
||||
add_post_syndication_source.call(post_id, :blue_sky, res.value!) if res.success?
|
||||
end
|
||||
|
||||
if post[:category].include? "weekly"
|
||||
if syndicate_to.include? :gist
|
||||
res = gist.call(post: post)
|
||||
|
||||
add_post_syndication_source.call(post_id, :gist, res.value!) if res.success?
|
||||
end
|
||||
|
||||
if post[:category]&.include? "weekly"
|
||||
send_to_dayone.call(name: post[:name], content: post[:content])
|
||||
end
|
||||
|
||||
@@ -43,6 +50,7 @@ module Micropub
|
||||
targets = []
|
||||
targets << :mastodon if syndicate_to.any? { |url| settings.mastodon_server.match(/#{url}/) }
|
||||
targets << :blue_sky if syndicate_to.any? { |url| settings.blue_sky_url.match(/#{url}/) }
|
||||
targets << :gist if syndicate_to.any? { |url| "https://gist.github.com".match(/#{url}/) }
|
||||
targets
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user