-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bsky short link service #4542
Bsky short link service #4542
Conversation
Your Render PR Server URL is https://social-app-pr-4542.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cpo9nq6ehbks73b4d4ug. |
|
if req.Method == "GET" && | ||
strings.LastIndex(strings.TrimRight(req.URL.Path, "/"), "/") == 0 && // top-level path | ||
!strings.HasPrefix(req.URL.Path, "/_") { // e.g. /_health endpoint | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to verify, we're okay with these not having some identifying prefix right? ik that came up in discussions though we definitely didn't want it to be a path like /i/abcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just gave it a glance without much opinion, seems good
Included here is a postgres-backed node service for generating short links.
API Usage
POST /link
Generates a short link for a given path. A given path always produces the same short link, up to some path normalization. Currently only paths to starter packs which contain the actor's DID (rather than handle) are supported, e.g.
/start/did:plc:example/3kv5iwj3csz2p
.Request
Response
GET /:linkId
This endpoint represents the short link itself. It generates a 301 permanent redirect to the original link. Query parameters are preserved. If the link id is not familiar, a temporary 303 redirect to the app's homepage is served.