Spyke

Posts

jellyfin·Jellyfin: The Free Software Media Systembykia

Error accessing Jellyfin web UI from Firefox

I'm running into an issue accessing the Jellyfin web UI from Firefox (Chrome works fine). I try to log into an account but the spinner runs for a few seconds then disappears without logging in. When I reload the page, it appears I'm logged in, though all I see is the header and the rest of the page is blank. I get the following errors in console:

Uncaught Error: Permission denied to access property "ownerDocument"
Uncaught Error: Permission denied to access property "localName"

Has anyone else run into this issue?

View original on lemmy.ca
rust·Rustbykia

Cursor key_value in 1.78.0-nightly

It seems like the key_value function has been removed from Cursor in 1.78.0-nightly. I've been using this to get the key/value pair from BTreeMap::upper_bound and BTreeMap::lower_bound.

Does anyone know why this was removed and what a good idiomatic alternative would be?

Edit: In case anyone encounters the same problem and is curious what's going on (the documentation hasn't been updated to reflect the change yet), it was referred to in this issue: 107540 changed in this commit: 8ee9693. Essentially, cursors in BTreeMaps previously pointed to specific nodes in the tree whereas now they point to gaps between the nodes. To get the node values, you need to use prev or next on the cursors returned by upper_bound or lower_bound.

View original on lemmy.ca
boostforlemmy·Boost for Lemmybykia

Errors when trying to create comments

I'm getting errors such as "Socket: CLOSED" when I try to create comments, however the comment gets created. It then brings me back to the comment editing screen where if I click create again, it keeps duplicating the comment.

Wondering if anyone else is having this issue?

Edit: I get an error when creating posts as well: "stream was reset: CANCEL"

View original on lemmy.ca
rust·Rustbykia

Small pattern that made my code much cleaner

This is a really simple silly thing I just realized, but I noticed I have a lot code that looks something like this:

fn foo() -> Result<(), Error> {
    // do something
}

fn bar() -> Option<()> {
    let Ok(f) = foo() else {
        return None;
    };
}

I hated that if-statement. I realized today that I could simplify to:

fn bar() -> Option<()> {
    let f = foo().ok()?;
}

And that cleaned up my code a lot. It's a tiny thing, but when it's okay to discard the error from the result, makes such a big difference when you have a lot of them!

View original on lemmy.ca