Minamp 1.3

- Fix NoSuchMethodError on Android 2.x: Dalvik before 4.0 can't link Object
  methods (toString/equals/...) called through an interface. Patch the bundled
  Bouncy Castle (tools/patch_bc_dalvik.py) and our own CertVerifier, and make
  build.sh fail if tools/scan_dalvik.py finds any such call
- Treat a manually entered private address (10.x, 172.16-31.x, 192.168.x,
  .local) as home, so LAN servers that allow access without sign-in work
- Send Plex client headers on media requests (files and transcodes)
- Explain a 503 on a file as the server being unable to open it (drive or
  folder not available)
- Connection log: home/away, token presence, Plex's file check and a direct
  file request in the streaming test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xockoandClaude Opus 5.5 committed 2026-10-14 20:56:27 +02:00
1 parent a4b875ef34
commit 58d21b6d68
14 files changed
+218 -13

No files matched your search

+26
View File
@@ -196,6 +196,32 @@ public class PlexTest {
Server.Conn c3 = s3.pick();
check(c3.kind == Server.LOCAL_HTTP, "falls back when TLS name check fails -> " + c3.uri);
// --- manual LAN address without a token (server allows this network without sign-in)
Server lan = new Server();
lan.name = "manual"; lan.token = "";
lan.add(Server.normalizeManual("127.0.0.1"), Server.MANUAL);
lan.pick();
check(lan.isLocal(), "manual private address counts as home (original quality)");
check(lan.url("/library/parts/501/1/file.mp3").indexOf("X-Plex-Token") < 0, "no empty X-Plex-Token on media URLs");
Library lanLib = new Library(lan, "1");
Item lanTrack = lanLib.tracksOf(album).get(0);
String lid = proxy.newId();
String lurl = proxy.register(lid, java.util.Collections.singletonList(lanLib.directUrl(lanTrack)), "mp3", false, lan.mediaHeaders());
hc = (HttpURLConnection) new URL(lurl).openConnection(Proxy.NO_PROXY);
byte[] lb = read(hc.getInputStream());
check(hc.getResponseCode() == 200 && lb.length == 300000, "token-less LAN: original MP3 streams (" + hc.getResponseCode() + ")");
Item flac = lanLib.tracksOf(album).get(1);
String lid2 = proxy.newId();
String lurl2 = proxy.register(lid2, lanLib.transcodeUrls(flac, 192, 0, "lan1"), "mp3", true, lan.mediaHeaders());
hc = (HttpURLConnection) new URL(lurl2).openConnection(Proxy.NO_PROXY);
byte[] lt = read(hc.getInputStream());
check(hc.getResponseCode() == 200 && new String(lt, "ISO-8859-1").startsWith("TRANSCODE"), "token-less LAN: FLAC converts to MP3");
// and the old behaviour reproduces the phone's log exactly
Http.Response o1 = Http.get(lanLib.directUrl(lanTrack) + "?X-Plex-Token=", null, 10000); o1.readAll();
Http.Response o2 = Http.get(lanLib.transcodeUrls(flac, 192, 0, "lan2").get(0) + "&X-Plex-Token=", null, 10000); o2.readAll();
check(o1.code == 503 && o2.code == 400, "old empty-token URLs reproduce the log's 503 and 400");
check(lanLib.checkPart(lanTrack).indexOf("exists=") >= 0 || lanLib.checkPart(lanTrack).length() > 0, "file check runs: " + lanLib.checkPart(lanTrack));
// --- trust checks
CertVerifier.setRootStore(roots(args[1])); // real Mozilla roots: test CA must be rejected
Http.evictAll();