From 7330141371a95ee5d9805776515a78a35787effb Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Wed, 4 Sep 2024 13:33:37 -0400 Subject: [PATCH] Fix TCVN-3, add charsets to about page Closes #1290 Closes #281 --- build.xml | 27 +++++++++++++++++++++++++++ src/qz/common/AboutInfo.java | 15 +++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/build.xml b/build.xml index 8eddf3e75..4629bb716 100644 --- a/build.xml +++ b/build.xml @@ -169,6 +169,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/qz/common/AboutInfo.java b/src/qz/common/AboutInfo.java index f369c29e6..87d06c41d 100644 --- a/src/qz/common/AboutInfo.java +++ b/src/qz/common/AboutInfo.java @@ -25,6 +25,7 @@ import java.io.InputStreamReader; import java.lang.management.ManagementFactory; import java.net.URL; +import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.security.GeneralSecurityException; import java.security.cert.CertificateEncodingException; @@ -46,6 +47,7 @@ public static JSONObject gatherAbout(String domain, CertificateManager certifica about.put("environment", environment()); about.put("ssl", ssl(certificateManager)); about.put("libraries", libraries()); + about.put("charsets", charsets()); } catch(JSONException | GeneralSecurityException e) { log.error("Failed to write JSON data", e); @@ -153,6 +155,19 @@ private static JSONObject libraries() throws JSONException { return libraries; } + private static JSONObject charsets() throws JSONException { + JSONObject charsets = new JSONObject(); + + SortedMap avail = Charset.availableCharsets(); + ArrayList names = new ArrayList<>(); + for(Map.Entry entry : avail.entrySet()) { + names.add(entry.getValue().name()); + } + + charsets.put("charsets", Arrays.toString(names.toArray())); + return charsets; + } + public static String getPreferredHostname() { return preferredHostname; }