nmtake

joined 2 years ago
[–] nmtake@lemm.ee 11 points 1 year ago* (last edited 1 year ago) (1 children)

Strong focus on privacy and security (all authentication with the Lemmy API is done through secure httpOnly cookies, user IP addresses are not leaked to external image hosts, etc)

Awesome. The current lemmy-ui sends a lot of traffic to other Lemmy instances to get pictrs-cached images, so this is huge improvement. On the other hand, on next.lemm.ee those requests seems to be gone. As feedback, I noticed this page still seems to send a request to imgur, ~~and the text is difficult to read because of the low-contrast theme.~~ (edit: fixed and now completely readable. thank you @sunaurus@lemm.ee )

[–] nmtake@lemm.ee 2 points 1 year ago (1 children)

If I understood correctly, the first match expression doesn't take the ownership of the prev_data.kind because the prev_data.kind is a place expression:

https://doc.rust-lang.org/stable/reference/expressions.html#place-expressions-and-value-expressions

A place expression is an expression that represents a memory location.

https://doc.rust-lang.org/stable/reference/expressions/match-expr.html#match-expressions

When the scrutinee expression is a place expression, the match does not allocate a temporary location; however, a by-value binding may copy or move from the memory location.

I'm not sure what "a by-value binding may copy or move from the memory location" does mean, but I beleive no allocation means no move.

For the second match, move happens. The tuple (prev_data.kind, new_data.kind) tries to take an ownership of the prev_data.kind, but the prev_data is &Data (borrowed from the vec data), so the tuple can't take the ownership.

[–] nmtake@lemm.ee 4 points 1 year ago

I prefer high-contrast themes these days and modus-themes work great. Note that Emacs 29 doesn't contain newer themes like modus-vivendi-tinted.

[–] nmtake@lemm.ee 3 points 1 year ago

Oh I didn't know the book is freely available under the CC license; I bought the Japanese translated version just a week ago. The book is quite difficult for me but the first chapter was very good read.

[–] nmtake@lemm.ee 2 points 1 year ago (1 children)

Can you run another distro on VirtualBox? (vanilla Fedora, Debian, Arch, etc.)

[–] nmtake@lemm.ee 2 points 2 years ago (1 children)

Oh I was completely wrong. cmp() takes a number (not Ordering) and returns Ordering. Sorry for bothering you.

[–] nmtake@lemm.ee 2 points 2 years ago (3 children)

The Enum Ordering provides compile-time safety. For example, if cmp() takes a string or int, the compiler can't catch invalid inputs ("less", "equal", -123, ...) at compile time and crash at runtime.

[–] nmtake@lemm.ee 2 points 2 years ago

Glad it worked. I didn't know the endpoint before reading your post.

[–] nmtake@lemm.ee 3 points 2 years ago* (last edited 2 years ago) (2 children)

As you said, GET /resolove_object (https://join-lemmy.org/api/interfaces/ResolveObject.html) may work:

$ post_id=9589178
$ curl 'https://lemm.ee/api/v3/resolve_object?q=https%3A%2F%2Fprogramming.dev%2Fpost%2F${post_id}' | jq .post.post.id
22873872
$ curl 'https://lemm.ee/api/v3/post?id=22873872' | jq '.post_view.post | [.id, .name]'
[
  22873872,
  "How do you get the url or id of the same post on a different instance?"
]
[–] nmtake@lemm.ee 3 points 2 years ago* (last edited 2 years ago)

I think you're right. In CGI, web server spawns a process for each incoming request to the CGI app, so the author provide static files for visitors to reduce the overhead.

Edit: here is the repository: https://codeberg.org/seppo/seppo and written in OCaml, so the single file CGI app is a compiled binary.

[–] nmtake@lemm.ee 3 points 2 years ago (1 children)

Hosting Lemmy instances on a localhost has these advantages: 1) no TLS required (right?), 2) can sniff the network traffic between the instances, 3) can change codes and settings of the all instances without asking to anyone, and more importantly, 4) no maintance cost. But if someone want to learn Web app deployment (TLS certs, hosting, etc.), your option would be a good idea.

view more: ‹ prev next ›