Skip to content

Commit

Permalink
fix: add missing mastodon profile redirect
Browse files Browse the repository at this point in the history
This is needed for GitHub profile mastodon link to work.
  • Loading branch information
limulus authored Nov 22, 2024
1 parent c26460e commit 47a4d1a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ Resources:
FunctionCode: !Sub |
const needsIndexHtmlRe = /(\/[^\/.]+)\/*$/
const penumbraJournalRedirectRe = /^\/penumbra\/journal\/00[1-5]-/
const mastodonProfileRedirectRe = /^\/@eric\/?/
function handler(event) {
const request = event.request
Expand Down Expand Up @@ -239,6 +240,18 @@ Resources:
}
}
if (mastodonProfileRedirectRe.test(request.uri)) {
return {
statusCode: 302,
statusDescription: 'Found',
headers: {
location: {
value: 'https://mastodon.limulus.net' + request.uri
}
}
}
}
request.uri = request.uri.replace(needsIndexHtmlRe, '$1/index.html')
return request
}
Expand Down

0 comments on commit 47a4d1a

Please sign in to comment.