Private
Public Access
Minamp 1.5: Galician interface
- Interface in Galician by default regardless of the phone's language, with English selectable under Axustes -> Idioma; switching rebuilds the screens - All text in tools/strings.py (key -> English, Galician), generating res/values/strings.xml (gl) and res/values-en/strings.xml; layouts now use string resources - util/Tr.java: translations for the network and Plex layers, which can't read Android resources (falls back to English in desktop tests) - net/RefusedException: distinguish "server answered but refused" from connection failures - The connection log stays in English for troubleshooting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6fd17bc9c5
commit
fa67e95fde
29 files changed
+1029
-206
No files matched your search
@@ -7,6 +7,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.minamp.util.Tr;
|
||||
import com.minamp.bc.asn1.ASN1Encoding;
|
||||
import com.minamp.bc.asn1.ASN1ObjectIdentifier;
|
||||
import com.minamp.bc.asn1.ASN1OctetString;
|
||||
@@ -69,7 +70,7 @@ public final class CertVerifier {
|
||||
synchronized (verifiedChains) { known = verifiedChains.contains(chainKey); }
|
||||
if (known) {
|
||||
Certificate leaf = Certificate.getInstance(chainDer.get(0));
|
||||
if (!hostMatches(leaf, host)) throw new IOException("Certificate does not match " + host);
|
||||
if (!hostMatches(leaf, host)) throw new IOException(Tr.t("cert_mismatch", "Certificate does not match %1$s", host));
|
||||
if (new Date().getTime() > 1704067200000L) checkDates(leaf, new Date());
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +84,7 @@ public final class CertVerifier {
|
||||
|
||||
Certificate leaf = chain.get(0);
|
||||
if (!hostMatches(leaf, host)) {
|
||||
throw new IOException("Certificate does not match " + host);
|
||||
throw new IOException(Tr.t("cert_mismatch", "Certificate does not match %1$s", host));
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
@@ -115,7 +116,7 @@ public final class CertVerifier {
|
||||
if (!isCa(cand)) continue;
|
||||
if (signatureValid(current, cand)) { next = cand; break; }
|
||||
}
|
||||
if (next == null) throw new IOException("Untrusted certificate chain for " + host);
|
||||
if (next == null) throw new IOException(Tr.t("cert_untrusted", "Untrusted certificate chain for %1$s", host));
|
||||
current = next;
|
||||
}
|
||||
throw new IOException("Certificate chain too long");
|
||||
@@ -125,7 +126,7 @@ public final class CertVerifier {
|
||||
Date from = c.getStartDate().getDate();
|
||||
Date to = c.getEndDate().getDate();
|
||||
if (now.before(from) || now.after(to)) {
|
||||
throw new IOException("Certificate expired or not yet valid (check the phone's date)");
|
||||
throw new IOException(Tr.t("cert_dates", "Certificate expired or not yet valid (check the phone's date)"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.minamp.net;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/** The server answered, but refused the request (HTTP status in {@link #code}). */
|
||||
public class RefusedException extends IOException {
|
||||
public final int code;
|
||||
|
||||
public RefusedException(int code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -197,10 +197,6 @@ public final class StreamProxy implements Runnable {
|
||||
out.flush();
|
||||
}
|
||||
|
||||
private static final class RefusedException extends IOException {
|
||||
final int code;
|
||||
RefusedException(int code, String msg) { super(msg); this.code = code; }
|
||||
}
|
||||
|
||||
/** Tries the route's URLs in order; returns the accepted response or throws with the server's words. */
|
||||
private Http.Response openUpstream(Route route, String method, String range, int first, int last) throws IOException {
|
||||
@@ -223,9 +219,10 @@ public final class StreamProxy implements Runnable {
|
||||
try { body = "HEAD".equals(method) ? "" : new String(up.readAll(), "UTF-8"); } catch (IOException ignored) {}
|
||||
up.close();
|
||||
code = up.code;
|
||||
refusal = "Server refused the stream (" + up.code + ")" + (body.trim().length() > 0 ? ": " + com.minamp.plex.Plex.snippet(body) : "");
|
||||
refusal = com.minamp.util.Tr.t("refused", "Server refused the stream (%1$d)", up.code)
|
||||
+ (body.trim().length() > 0 ? ": " + com.minamp.plex.Plex.snippet(body) : "");
|
||||
if (up.code == 503 && route.urls.get(i).indexOf("/library/parts/") >= 0) {
|
||||
refusal = "Plex couldn't open this file (503). Is the drive or folder with your music available to the server?";
|
||||
refusal = com.minamp.util.Tr.t("file_503", "Plex couldn't open this file (503). Is the drive or folder with your music available to the server?");
|
||||
}
|
||||
DiagLog.log("stream variant " + i + " refused: " + refusal);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user