10
submitted 7 months ago by self@awful.systems to c/freeasm@awful.systems

reply with features and bug fixes you'd like to see in Philthy, the lemmy fork that runs on this instance. no guarantees I'll get to any of them soon, but particularly low-hanging fruit and well-liked features can be prioritized.

you are viewing a single comment's thread
view the rest of the comments
[-] self@awful.systems 3 points 7 months ago

I believe it's this bit of code:

  if local_site_data
    .blocked_instances
    .iter()
    .any(|i| domain.to_lowercase().eq(&i.domain.to_lowercase()))
  {
    Err(LemmyErrorType::DomainBlocked(domain.clone()))?
  }

which gets blocked_instances filled in from the database and domain from the connecting instance. so it's just a case insensitive string match of everything in the block list against the exact hostname given by the connecting instance as given by ActivityPub -- presumably that layer takes care of ensuring the provided hostname is actually the instance's domain name. so in short I have to do a bunch of stupid shit to block an instance thoroughly, and good luck if I want to block a domain and all of its subdomains

[-] froztbyte@awful.systems 4 points 7 months ago

reading that made me flinch

it's the exact same thinking I see from a lot of node devs ("just slap chained ops on it to express the logic! it'll be fine. won't ever need any complexity!")

[-] self@awful.systems 3 points 7 months ago

you're gonna hate me but this style of code is usually my jam

however, the fact that it's a conditional whose true branch essentially crashes the task for something that happens frequently (this pattern is everwhere in lemmy, and it's why my logs are almost nothing but long stack traces) is truly godawful

[-] froztbyte@awful.systems 4 points 7 months ago

oh I understand the appeal: it is rapid to express on the fly without breaking flow and enumerating through failure cases. and, for a bit of leeway, there is the upside that rust's rich return styles affords better actual expression/handling

but ime each site the pattern gets used for barely holds out at that approach over time (for all but the very simplest cases), and you always discover this far later, when the appropriate context has gotten paged out of all relevant peoples heads

[-] froztbyte@awful.systems 3 points 7 months ago

(at one of my old clients, an :aa-gun: emoji was added exclusively because of my code reviews)

this post was submitted on 12 Apr 2024
10 points (100.0% liked)

FreeAssembly

75 readers
1 users here now

this is FreeAssembly, a non-toxic design, programming, and art collective. post your share-alike (CC SA, GPL, BSD, or similar) projects here! collaboration is welcome, and mutual education is too.

in brief, this community is the awful.systems answer to Hacker News. read this article for a solid summary of why having a less toxic collaborative community is important from a technical standpoint in addition to a social one.

some posting guidelines apply in addition to the typical awful.systems stuff:

(logo credit, with modifications by @dgerard@awful.systems)

founded 7 months ago
MODERATORS