Skip to content

Commit

Permalink
Use absolute URLs to send webmention
Browse files Browse the repository at this point in the history
  • Loading branch information
barryf committed Sep 3, 2023
1 parent 556d673 commit eb191a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/events/process-post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ exports.handler = async function subscribe (event) {
}

// fire webmentions asynchronously
const links = await findLinks(url)
const absoluteUrl = new URL(url, process.env.ROOT_URL).href
const links = await findLinks(absoluteUrl)
for (const link of links) {
await arc.events.publish({
name: 'send-webmention',
payload: { url, link }
payload: { source: absoluteUrl, target: link }
})
}

Expand Down
3 changes: 1 addition & 2 deletions src/events/send-webmention/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ async function sendWebmention (source, target) {

exports.handler = async function subscribe (event) {
const body = JSON.parse(event.Records[0].Sns.Message)
const url = new URL(body.url, process.env.ROOT_URL).href
await sendWebmention(url, body.link)
await sendWebmention(body.source, body.target)
}

0 comments on commit eb191a6

Please sign in to comment.