Lemmy App Development

711 readers
70 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 1 year ago
MODERATORS
1
 
 

Thoughts?

2
 
 

It seems like running a pictrs server is optional when running Lemmy. I'm trying to figure out if a given instance supports pictrs.

I see in the documentation for pictrs, there is a GET /healthz endpoint. However when I try to access https://lemmy.ml/pictrs/healthz for example it gives me a 404. Even tho I know that Lemmy.ml has a pictrs server.

What is the best way to determine if a Lemmy server has pictrs?

3
 
 

Hello everyone! 🎉

I’ve created an RSS Feed Bot that automates sharing news in Lemmy and Fediverse channels, helping to keep Fediverse users better informed. The bot is written in Python3 and can easily run via Docker Compose.

Hope you find it useful! 🚀

#Lemmy #Fediverse #RSS #Python #Docker #Automation #OpenSource

4
 
 

Is there a way to determine if a user sign-up application is pending solely based on the server instance URL and the username?

It looks like even when the application is pending the profile page is created and is live. So that doesn’t really help me determine that.

5
 
 

Is there a way to get a list of users subscribed to a given Lemmy community? Trying to do some Lemmy wide data analysis using that information.

Or alternatively, is there a way to get a list of communities a given user is subscribed to?

6
 
 

I'm using lemmy-js-client for app development. I want to render comments in the nested form (like normal people do).

The problem is, the lemmy backend spits out comment lists in a fashion that is unfriendly for nested rendering. Why? It outputs comments whose paths are like follows (for example):

0.1.2.3.4

0.1.2.1

0.1.2.3.4.5

0.1.3.1.5

0.1

Let's say the limit that I've set here is 10. Many a times, the parent comments of the comments in the page are out of the page.

For example, let's say I asked lemmy for comments for a given post. It gives me an output like above. There are many children comments here on page 1 (like 0.1.2.1, 0.1.2.3.4 and so on). Their parent (0.1.2) is NOT on this page. It is on the page that follows.

Hence, I would need to do client side bs to get the correct parent comments.

What is your approach for doing the above?

This is what I have settled for now unfortunately. I fetch all the comments under a post and then convert them in my nested form. This means, that my app doesn't paginate. This thus results in really slow loading times for posts with more comments. The more comments a post has, the slower they will load. This sucks.

I tried other ways, mind you. While implementing pagination, I simply removed orphan comments when on a given page. If the user decided to go to page 2 (simply by scrolling), suddenly, these orphan comments would not be orphans anymore due to them finding their parent comments. This in turn, fucked with my ui completely (which was obvious), thus making the list randomly scroll like crazy. This was a really shitty experience for the user.

Sooooo what have you guys done? How have you handled the situation?

7
 
 

I'm trying to follow the instructions at https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/

I get the error message: {"error":"Unable to fetch key JSON at https://<domain>/actor"}

The actor file is located at: /var/www/<subdomain>/actor

that contains:

{
    "@context": [
        "https://www.w3.org/ns/activitystreams",
        "https://w3id.org/security/v1"
    ],

    "id": "https://<domain>/actor",
    "type": "Person",
    "preferredUsername": "alice",
    "inbox": "https://<domain>/inbox",

    "publicKey": {
        "id": "https://<domain>/actor#main-key",
        "owner": "https://<domain>/actor",
        "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnioC3W5cHbHLo+ln4QPm\n6EX1Ypvs5h+h47b5RwhF+2N84dSHXURUuA6a33+IlVqiO/3gGxIX+4MJuSDAxGZM\nWFDbuqDnHft2zWorKmIqyDzSSB/oMSqOVL8QV1KYWsCyhw9v2l5U6EIw2Z7u3Fc9\nW19dumK0ieL7CPME2dJGV5quBoa2AGg0D36XCp8hAWMXGUnlEcaqjyePJg9/quZn\no3W/+h5ujoUQG73SIUaJdsK16Q0E7o5N7JP7pqqE8p8pEXtpwXJJYE9y9ItTqvRS\na29xymyboCI6jSK+VTgjz1tj6W+EGQsPfka6t8Gq82NL00VxBEYb/eiEFuOSy4RL\ndwIDAQAB\n-----END PUBLIC KEY-----"
    }
}

I haven't been able to find out what that error means. Is it unable to find the actor file? Maybe I should change /actor to /actor/ and put the file inside that? If so, what should the filename be? Is it some problem with the public key inside the JSON? Is it mad about the newlines?

8
 
 

I’ve updated @Mistral@lemmings.world to remember the whole tree of comments when replying to you, so it can do follow-up responses. You still have to mention it on every message, though. Example in the comments.

9
14
submitted 8 months ago* (last edited 8 months ago) by blawsybogsy@lemmy.ml to c/lemmydev@lemm.ee
 
 

There's now a swagger documentation for the Lemmy API.

See also https://mv-gh.github.io/lemmy_openapi_spec/

10
 
 

I just implemented a user overview of mixed posts and comments, but I'm unsure how to do so while respecting sort (hot, new, old, etc.). Currently I merge the user's comments and posts into a list, then sort them all by timestamp.

Because sorting is handled on the server, and merging posts/comments happens after, I can't see how I can't respect sort and still merge the two sets. Does anyone have any pointers?

I expect a similar issue would arise for the unified inbox view also (replies, mentions, and private messages), although in that case there's less need to sort by anything other than recency.

EDIT: here's the relevant ts code in the official lemmy ui. it sorts by date if sort is new, which i already do, then otherwise it just sorts by "score".

https://github.com/LemmyNet/lemmy-ui/blob/79ed5903354067636f5eb9686ff0a005117bc541/src/shared/components/person/person-details.tsx#L245

11
 
 

I recall someone mentioning a way to do it through an ActivityPub “resolve object” endpoint (or something like that) but I couldn’t find anything on it again. #1101 will solve this, but how are you guys handling this in the meantime?

12
 
 

So I'm developing a mobile client using React Native, where I'm utilizing Lemmy's messaging functionality as well. This makes it extremely crucial to have notification support (including push notifications).

How are you guys dealing with this problem? This is what I think an elegant solution could look like. We would need to achieve two things:

  1. Bring back websockets only for notifications by directly changing lemmy server side code.
  2. Find where the email notification code is at, and simply implement expo notifications there.

Whaddya think?

13
 
 

currently my client displays child comments/replies to a given comment based on a get-comments request and the sort arg. if a child comment is returned by such a request, it will be included as part of the tree, but otherwise not. it means the child is subject to sorting itself.

but what is needed is that if a parent comment is displayed/returned by request/sort arg, all its children should be also. that seems to me to be how the webUI works also.

any tips on how to ensure that?

14
 
 

cross-posted from: https://lemmy.ca/post/6770347

This is a very small update, but hopefully it's helpful! As I mentioned in the last update, I'm a little tied up with other commitments right now, so I haven't had a chance to implement the other features on the to-do list. This one was requested the other day, and it was simple to add since I could reuse a lot of existing code.


Links:


❓ What is Instance Assistant?

If you're new to Instance Assistant, it is a browser extension with a collection of tools and features to simplify your browsing experience on Lemmy and Kbin. It is available on Chrome, Firefox, and Edge; you can also install it from the releases page on GitHub.

For a full list of features, please see the GitHub homepage: https://github.com/cynber/lemmy-instance-assistant


⭐ What's new in v1.2.6?

  • Redirect user profile pages: When you want to message a user and click on their profile, you might end up on a foreign instance. To message them, you need to modify the URL or copy/paste. Instead, you will now find a little button to jump you to your home instance.


💛 Also

Thank you for all the suggestions and feedback! Like I said before, I'm really happy to see that people are using the extension and finding it useful. Please continue to make suggestions and contribute your expertise.

Cheers :)

15
 
 

My Lemmy Schedule app now includes the option to get notified of new posts in a specific community!

In case you haven't heard about the app before, here's what other things it can do:

  • schedule a post and post it to multiple communities
    • you can upload an image as well and choose between uploading to your Lemmy instance or to Imgur
  • create a recurring post that gets posted at a specific date and time (especially useful for daily/weekly/monthly/end-of-month threads)
  • schedule pinning and unpinning of posts (instance and community)
    • the pinning and unpinning can be specified as part of creating a post
  • the aforementioned notifications about unread posts from a specific community (useful for mods)
    • can be also set using a recurring schedule, so you can get the report daily/weekly/monthly etc.

To learn more, visit the !schedule@lemmings.world community.

P.S. It's open source and can be self-hosted using docker!

16
 
 

I’d love to host my own Lemmy server but I’m just a script kiddie

17
18
 
 

Where are you all finding details on what features are included in each version of lemmy-js-client?

19
 
 

I hope this is allowed, if not, I'll delete the post, I just wanted to share some stats of my bot because I'm quite excited about them.


 ---------- --------- ----------- ------------------------- ------------------------- ------------------------ 
  Comments   Upvotes   Downvotes   Negative comments count   Positive comments count   Neutral comments count  
 ---------- --------- ----------- ------------------------- ------------------------- ------------------------ 
  2769       13734     426         0                         2769                      0                       
 ---------- --------- ----------- ------------------------- ------------------------- ------------------------

Note that the bots default upvote is not considered for the stats. Positive comments are those where there's more upvotes than downvotes, neutral ones are those where downvotes and upvotes are the same and negative are when the comment has more downvotes than upvotes.

20
 
 

I've made an open source tool for scheduling posts to Lemmy, you can find it at https://schedule.lemmings.world/. It can be used by users from any instance and it can be self-hosted if you wish so!

Changes since the last time I posted about it:

  • you can now login with 2FA enabled
  • you can schedule pin and unpin of posts in a community if you're the mod
  • you can schedule pin and unpin of posts in an instance if you're the admin
  • when creating a post, you can choose to pin it to the community (if you're a mod)
  • you can choose the language of your posts
  • an official support community has been created at !schedule@lemmings.world
  • you can post the same post into multiple communities easily, just select the communities and multiple scheduled posts will be created

Let me know what you think!

21
 
 

cross-posted from: https://lemmy.world/post/3252643

lemmy.readme.io uploaded some great API documentation to get started making your own Lemmy client.

Proved very useful in making my iOS client Lunar

22
 
 

I'm starting lemmy-ui with:

LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy-alpha:8541 node dist/js/server.js

Running against the drone-lemmy instances created by lemmy_server's api-tests scripts. I'm running latest main checkout on both projects.

My browser gives me:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8536/api/v3/community/list?type_=Local&sort=TopMonth&limit=50&page=1. (Reason: CORS request did not succeed). Status code: (null).

api-tests scripts build dev mode, I thought CORS was turned off? I've played around with adding LEMMY_CORS_ORIGIN=* - but it doesn't help.

EDIT: reading this post closer, I see 8536 vs. 8541. If I manually refresh my browser against lemmy-ui on port 1234, it works... but I wonder where 8536 is getting picked up?

Thank you and I hope you are having a great weekend.

23
7
submitted 1 year ago* (last edited 1 year ago) by fixmycode@feddit.cl to c/lemmydev@lemm.ee
 
 

I'm in the process of developing a bot. My intention is to scan all comments regardless of depth in a given community up to a certain date, so it receives only the comments made since the last request. I want to play nice so I'm also trying to do it on the less amount of queries possible.

The community I'm testing this is fairly small, it has 40 comments total, but the problem is that when I request comments without specifying max_depth, and sort ordered by New, I receive only 10 comments, if I try to specify page, or limit, I get an error {"error":"couldnt_get_comments"}.

If I don't specify page or limit, and set an arbitrary number for max_depth, like 4, I get the 40 comments I'm expecting.

My question is: what's the correct way to request comments? My intention is doing something similar to an user pressing "Comments" on front of a community, like calling the community URL with params ?dataType=Comment&amp;page=1&amp;sort=New

24
4
App to schedule posts on Lemmy (schedule.lemmings.world)
submitted 1 year ago* (last edited 1 year ago) by rikudou@lemmings.world to c/lemmydev@lemm.ee
 
 

I've made an app that makes it possible to schedule a post in Lemmy at an arbitrary time. It's available at https://schedule.lemmings.world/ and can be used by people from any instance.

Let me know what you think!

P.S. This post was made from the app!

Edit: And it's open source!

25
 
 

I have a question about the semantics of child_count in the comment list API endpoint. Sorry for being related to an earlier question but I haven't quite figured it out yet.

My assumption was that child_count would indicate the amount of total descendants of a comment, regardless of depth. But take this case for example:

$ curl 'https://lemmy.ml/api/v3/comment/list?parent_id=2157873&amp%3Bmax_depth=999&amp%3Blimit=999' | jq '.comments[]
| { path: .comment.path, id: .comment.id, content: .comment.content, child_count: .counts.child_count }'
{
  "path": "0.2157873",
  "id": 2157873,
  "content": "Really cool! I'm excited to learn more about you and the project!\n\nWhat's the format? Should we submit questions beforehand, or will you process questions that arrive at the start time? I've never participated in an AMA  😅 ",
  "child_count": 9
}
{
  "path": "0.2157873.2158260",
  "id": 2158260,
  "content": "You just post questions as top-level replies to the stickied thread that day, and we'll be online to answer them.",
  "child_count": 6
}
{
  "path": "0.2157873.2158260.2158286",
  "id": 2158286,
  "content": "Cool. Thank you for doing this!",
  "child_count": 1
}
{
  "path": "0.2157873.2158260.2229041",
  "id": 2229041,
  "content": "Post doesn’t mention, where is the AMA? Here or in a different community?",
  "child_count": 3
}
{
  "path": "0.2157873.2158260.2158286.2158743",
  "id": 2158743,
  "content": "No probs!",
  "child_count": 0
}
{
  "path": "0.2157873.2158260.2229041.2231423",
  "id": 2231423,
  "content": "As the post mentions, it will be stickied to the top of lemmy.ml ",
  "child_count": 2
}
{
  "path": "0.2157873.2158260.2229041.2231423.2231737",
  "id": 2231737,
  "content": "Thanks for the details. May be I’m missing something, but I don’t see that detail in the post. ![](https://programming.dev/pictrs/image/82c90859-9cfb-4c00-80d8-7e96bfd96c1c.jpeg)",
  "child_count": 1
}
{
  "path": "0.2157873.2158260.2229041.2231423.2231737.2238347",
  "id": 2238347,
  "content": "Oops my bad, that was something I responded to in a comment.",
  "child_count": 0
}

I see that comment 2157873 has a child count of 9, with one direct descendant (2158260). The descendant has a child count of 6. I'd reason that comment 2157873 has 2 direct descendants that aren't visible in the API response yet, because it has one visible descendant having a child count of 6 (i.e. 9 - 1 - 6 = 2). My calculation seems incorrect because (a) I don't see a 'Load more' indicator for this part of the comment thread on https://lemmy.ml/post/2671212, and (b) every comment shown there also seems present in the API response.

Am I understanding the meaning of child_count correctly?

view more: next ›