derpibooru / philomena

Next-generation imageboard
https://derpibooru.org/
GNU Affero General Public License v3.0
219 stars 56 forks source link

[Feature Request, API] Add user avatar URL to comments response objects #65

Closed pingzing closed 4 years ago

pingzing commented 4 years ago

Is your feature request related to a problem? Please describe. If I want to display a list of comments for a post, I cannot display user avatars without a separate network request per-comment, to go and fetch the user's profile.

Describe the solution you'd like Right now, the best way to get the comments on a particular image is to do a comments search, which looks like this: https://derpibooru.org/api/v1/json/search/comments?q=image_id:2304983, and returns an array of these:

{
 "author": "someName",
 "body": "Whatever the user wrote",
 "id": 0000001,
 "image_id": 1234567,
 "user_id": 1234567
}

I'd like to add an extra field to each comment: avatar_url.

That way I could (mostly) replicate the website's comments experience with only two calls per image.

Describe alternatives you've considered One thing that comes to mind: what about anonymous comments? They don't have a user profile, so they don't have an avatar. It looks like the website autogenerates an avatar though--could that be exposed here?

liamwhite commented 4 years ago

Would it be acceptable for anonymous avatars to be a data:image/svg+xml;base64, style URI, and the rest to just be CDN URLs? Or would something else be preferable?

pingzing commented 4 years ago

A raster image format would be easier (for my use case, anyway), but SVG isn't a dealbreaker. For the rest, CDN URLs is fine.

liamwhite commented 4 years ago

We never generate raster images for anonymous avatars on the server end, it's the vector or nothing.

liamwhite commented 4 years ago

Fixed in c8b0d9ca3d20e2334e245340c6bcd3ede793f853