fix: log in with the password on servers that refuse tokens

Nextcloud Music answers a token login with Subsonic error 41, so remus
could not log in to it at all. Login now retries with the password,
hex-encoded as the spec allows, when the server returns 41, and saves
which method worked. Servers that accept tokens are unaffected, and
existing login files still load.

Server errors now keep their code. A wrong password on Nextcloud adds a
line about the API password from the Music app's settings, which is not
the Nextcloud login password.
This commit is contained in:
Ansho Rei
2026-11-04 03:44:34 +01:00
parent a74fd1bd5c
commit c12ed3e12d
5 changed files with 358 additions and 59 deletions
+2
View File
@@ -301,6 +301,8 @@ mod tests {
assert_eq!(s, "Not Found (404), URL: https://h/rest/stream?…, Redirect to: (NULL)");
assert!(!strip_queries("\"http://x/y?t=secret\" next").contains("secret"));
assert_eq!(strip_queries("what? no url here"), "what? no url here");
let s = strip_queries("URL: https://h/rest/stream?u=a&p=enc%3A736573616d65&v=1 failed");
assert!(!s.contains("736573616d65"), "{s}");
}
/// Writes `secs` of silence as a 16-bit mono WAV and returns its file:// URI.