Lemmy App Development

762 readers
4 users here now

A place for Lemmy builders to chat about building apps, clients, tools and bots for the Lemmy platform.

On-Topic:

Off-Topic:

founded 2 years ago
MODERATORS
51
 
 

Or is it documented? with mastodon, i set up clients to always load URLs in my app if they resembled masto-compatible URLS. I'm unsure how to go about this with lemmy. the lemmy-js-client "documentation" makes no mention of webfinger at all, though the lemmy repos have PRs fixing it.

52
 
 

Hello! I’m the developer of Summit, one of the Lemmy apps.

I want to be able to mark a post as read using an API call.

I understand that fetching the post itself using the account JWT will mark the post as read for that account, however this also fetches a lot of data.

Trying to be as server friendly as possible, what is the least resource intensive way to mark a post as read and nothing else?

53
1
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
 
 

I'm working on a test bot to understand the API and I have a question about authentication and JWT validation.

As far as I can see, the way to authenticate is to call the /user/login endpoint with valid credentials which will return a JWT. All is good except the JWT payload. I see that it contains iat but nothing about expiry (exp).

Now, I wanted to use the JWT for multiple requests, but that's difficult if I cannot figure out when the token expires. What is the best way to be sure about the validity of a JWT before using it. Should I get a new JWT before every operation, is that the intended behavior? Or maybe I misunderstand the way authentication works with Lemmy?

Edit: I asked this on Lemmy Development channel a few days ago and apparently someone has created an issue in Github. So, perhaps this will be addressed in a later update.

54
 
 

Is there any Discord bot that can automatically post Lemmy threads to a channel? I would use webhooks to do so for Reddit for easy use with the server our subreddit had, but since moving to Lemmy and the API death, that doesn't work and now we need an equivalent for Lemmy. So, anybody know if any exist yet?

55
56
 
 

Hi all,

I've put together some code on on Val Town that easily allows auto-publishing videos on Youtube channels to a Lemmy community.

It's simple enough that hopefully anyone should be able to set it up, and Val Town has a free tier which should be enough for anyone to publish a few feeds for free. There's a "README" on top showing how it's used.

Anyway, let me know what you think! If you end up using it, I'd love to get some thoughts on how easy it was to set up etc.

57
 
 

The Limit property is just a number, but it is different for different API endpoints. I'd like to have a list of the different values so i can easily stay within the max for each endpoint. Are the values documented somewhere? From the official js-client docs site, not even a given endpoint documents its maximum.

58
 
 

I often find communities where I’d like so see some posts from, but it starts flooding my feed so I unsubscribe again. Is it somehow possible to subscribe to a community but only get posts that are above a certain vote threshold? Or subscribe to every single new post for smaller communities?

Would that have to be implemented on an application level or somewhere else and where is the correct place to post a feature request about it?

Thanks :)

59
1
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
 
 

Sometimes an API request returns {"comments":[]} and {"posts":[]} respectively, for a post and community, where posts and comments show up on the web frontend. Is that happening to any of you too? How do I handle it?

Edit: did some more testing, it's most definitely a federation issue. If I query the instance that the post was made on for the comments, everything works fine. If I query my home instance, the result comes back empty.

Edit 2: As always, just after publicly showcasing my lack of programming abilities, I discover it's been me the entire time. Make sure to await promises and to fetch posts from the correct instance, guys.

60
 
 

i have requests to fetch comment and post data, but i'm struggling to work out how to build a tree from the responses? do i fetch comments with arg parent_id to get a comment's children, and do so recursively for those comments returned that themselves have comments?

61
 
 

This happens for me on a small number of posts, and is generally repeatable, even when the website shows comments.

For instance, running on lemmy.world, GetPost(id: 290602) tells me the post exists and has 7 comments, as does https://lemmy.world/post/290602

But GetComments(postId: 290602) returns an empty list.

If I run against the original post on 'programming.dev', GetComments(postId: 99912) does show me the comments, but I don't think I'm supposed to be second guessing the federating logic :-)

Has anyone seen anything similar or can confirm they see this same behaviour for this post?

62
 
 

EDIT: I've created a community for the Lemon app: [email protected] !

Hello community! πŸ‘‹

I wanted to drop a short announcement: I'm building an iOS client for lemmy, named Lemon πŸ‹!

It is still very much in early development, only having one week of dev time so far. I'm not yet ready for users (unless you want a lot of bugs πŸ˜…).

I'll be sharing some development logs throughout the journey. Consider this the first of (hopefully many) entries!

Story time:

For years, I was an avid user of Apollo for Reddit. I was an "ultra subscriber" and occasional donor, since I loved the app and Christian Selig was such a kind and engaged developer. He managed to build both an inspiring app and community.

I was heartbroken when I learned Apollo would shut down due to Reddit's API changes.

Lemon for Lemmy as an homage to Apollo and is greatly inspired by his amazing work (Thank you, Christian!)

Features

Some of the currently-working features are:

  • πŸ”’ Logging in and registering (including instance search + information browsing such as user count, location, accepting memberships, etc!)
  • πŸ’‘ Light and Dark modes
  • πŸ”Ό Upvoting / downvoting posts with optimistic updates and rollbacks (including swipe to vote!)
  • πŸš€ highly performant feed with infinite scroll
  • πŸ“š persistent cache to read while you're offline

My goal is to make this a fully featured Lemmy client for iOS, and hopefully one day as good as Apollo is/was!

That's all for now. Here's some screenshots. Until next time!

Dark Lemon Light Lemon

63
 
 

Any ideas how to get the endpoints to return pure JSON? This only happens when using fetch in the browser as far as I can tell, when using curl in the command line I get pure JSON. I’m using the lemmy-js-client and it’s throwing errors because of this as well

64
 
 

Welcome to LemmyDev! πŸ‘‹

LemmyDev hopes to be a home for anyone interested in learning about (or actively engaged in) developing apps, clients, bots and tools for the Lemmy Platform.

If you're new here: consult the sidebar for how this community is intended to be used.

I hope this place can be a helpful, supportive and positive community where we encourage one another, share work in progress, and celebrate successes together.

If you have any questions, comments or concerns don't be afraid to reach out to me, and have fun building!