Move SSD network string checks to typed Kotlin

ober

ffb4c8b7fa3a023a2e6c891549ad4cd2c9a0164d

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index 5b5ea66..9ef4ac7 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -4568,7 +4568,8 @@
 
     (typed-kotlin-file "com/sfb/ssdreview/NetworkSafety.kt"
       (typed-library (com sfb ssdreview)
-        (export normalizeRemoteEndpointValue normalizeRemoteEndpoint urlEncode localTruthHttpAllowed)
+        (export normalizeRemoteEndpointValue normalizeRemoteEndpoint urlEncode
+                contentEncodingIsGzip localTruthHttpAllowed)
         (def (normalizeRemoteEndpointValue (value : String) (defaultEndpoint : String)) : String
           (let ((trimmed (string-trim value)))
             (let ((base (if (string-blank? trimmed) defaultEndpoint trimmed)))
@@ -4589,6 +4590,8 @@
           (normalizeRemoteEndpointValue value "https://10.66.60.2:8797/api"))
         (def (urlEncode (value : String)) : String
           (url-encode-utf8 value))
+        (def (contentEncodingIsGzip (value : String)) : Bool
+          (string-contains? (string-lowercase value) "gzip"))
         (def (localTruthHttpAllowed (host : String)) : Bool
           (let ((lower (string-lowercase host)))
             (if (or (or (equal? lower "localhost")
@@ -7274,7 +7277,7 @@
        "    private fun loadRemoteConfig(): RemoteConfig? {"
        "        val preferences = context.getSharedPreferences(\"ssd_review_remote\", Context.MODE_PRIVATE)"
        "        val savedEndpoint = preferences.getString(\"base_url\", null)?.trim().orEmpty()"
-       "        val endpoint = normalizeRemoteEndpoint(savedEndpoint.ifBlank { DEFAULT_TRUTH_API_URL })"
+       "        val endpoint = normalizeRemoteEndpoint(savedEndpoint)"
        "        val pinText = preferences.getString(\"spki_sha256\", null)?.trim().orEmpty()"
        "        val token = preferences.getString(\"bearer_token\", null)?.trim().orEmpty()"
        "        val url = URL(endpoint.trimEnd('/'))"
@@ -7431,7 +7434,7 @@
        "            throw IllegalStateException(\"HTTP response exceeds compressed-byte limit\")"
        "        }"
        "        val raw = LimitedInputStream(connection.inputStream, MAX_HTTP_COMPRESSED_BYTES)"
-       "        val input = if ((connection.contentEncoding ?: \"\").lowercase().contains(\"gzip\")) {"
+       "        val input = if (contentEncodingIsGzip(connection.contentEncoding ?: \"\")) {"
        "            GZIPInputStream(BufferedInputStream(raw))"
        "        } else {"
        "            raw"