Syndicate code posts to Github Gists
This commit is contained in:
@@ -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