Support "like" web mentions

This commit is contained in:
2023-12-21 20:29:45 +11:00
parent 38175e45ff
commit e19b86a4c1
2 changed files with 22 additions and 0 deletions

View File

@@ -21,6 +21,17 @@ module Adamantium
target_url: wm_params[:"in-reply-to"]
}]
when "like-of"
Success[:like, {
type: "like",
author_name: wm_params[:author][:name],
author_photo: wm_params[:author][:photo],
author_url: wm_params[:author][:url],
published_at: wm_params[:published],
content_html: wm_params[:content][:html],
content_text: wm_params[:content][:text],
source_url: wm_params[:url],
target_url: wm_params[:"in-reply-to"]
}]
Failure(:not_implemented)
when "repost-of"
Failure(:not_implemented)

View File

@@ -18,6 +18,17 @@ module Micropub
reply[:post_id] = post.id
webmentions_repo.create(reply)
res.body = {
result: "Webmention was successful"
}.to_json
res.status = 202
in Success[:like, like]
slug = req.params[:"like-of"].split("/").last
post = post_repo.fetch!(slug)
reply[:post_id] = post.id
webmentions_repo.create(reply)
res.body = {
result: "Webmention was successful"