Manual fixes

This commit is contained in:
Philipp Heckel 2026-01-09 12:46:03 -05:00
parent c1a04bee83
commit 7a64c393f2
6 changed files with 38 additions and 18 deletions

View file

@ -59,6 +59,7 @@ class ClientCertificateFragment : DialogFragment() {
private lateinit var passwordText: TextInputEditText
private lateinit var baseUrlLayout: TextInputLayout
private lateinit var baseUrlText: TextInputEditText
private lateinit var errorLayout: LinearLayout
private lateinit var errorText: TextView
// Page 2 views
@ -159,6 +160,7 @@ class ClientCertificateFragment : DialogFragment() {
passwordText = view.findViewById(R.id.client_certificate_password_text)
baseUrlLayout = view.findViewById(R.id.client_certificate_base_url_layout)
baseUrlText = view.findViewById(R.id.client_certificate_base_url_text)
errorLayout = view.findViewById(R.id.client_certificate_error_layout)
errorText = view.findViewById(R.id.client_certificate_error_text)
// Page 2 views
@ -273,7 +275,7 @@ class ClientCertificateFragment : DialogFragment() {
extractedCert = keyStore.getCertificate(alias) as X509Certificate
baseUrl = url
password = pwd
errorText.isVisible = false
errorLayout.isVisible = false
showPage2()
} catch (e: Exception) {
showError(getString(R.string.client_certificate_dialog_error_wrong_password))
@ -335,7 +337,7 @@ class ClientCertificateFragment : DialogFragment() {
private fun showError(message: String) {
errorText.text = message
errorText.isVisible = true
errorLayout.isVisible = true
}
enum class Mode {

View file

@ -358,7 +358,9 @@ class TrustedCertificateFragment : DialogFragment() {
val pem = CertUtil.encodeCertificateToPem(certificate)
repository.addTrustedCertificate(url, fingerprint, pem)
withContext(Dispatchers.Main) {
Toast.makeText(context, R.string.trusted_certificate_dialog_added_toast, Toast.LENGTH_SHORT).show()
if (mode != Mode.UNKNOWN) {
Toast.makeText(context, R.string.trusted_certificate_dialog_added_toast, Toast.LENGTH_SHORT).show()
}
listener?.onCertificateTrusted(certificate)
dismiss()
}

View file

@ -94,16 +94,32 @@
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/client_certificate_error_text"
<LinearLayout
android:id="@+id/client_certificate_error_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/holo_red_dark"
android:textSize="14sp"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:orientation="horizontal"
android:paddingTop="16dp"
android:visibility="gone" />
android:visibility="gone">
<ImageView
android:id="@+id/client_certificate_error_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="1dp"
app:srcCompat="@drawable/ic_error_red_24dp"
android:importantForAccessibility="no" />
<TextView
android:id="@+id/client_certificate_error_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="@style/DangerText"
android:paddingStart="4dp"
android:paddingEnd="4dp" />
</LinearLayout>
</LinearLayout>

View file

@ -64,14 +64,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="@string/trusted_certificate_dialog_base_url_hint">
android:hint="@string/trusted_certificate_dialog_base_url_hint"
app:placeholderText="@string/trusted_certificate_dialog_base_url_placeholder">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/trusted_certificate_base_url_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:text="@string/trusted_certificate_dialog_base_url_placeholder" />
android:inputType="textUri" />
</com.google.android.material.textfield.TextInputLayout>

View file

@ -431,7 +431,7 @@
<string name="settings_advanced_certificates_trusted_item_summary">%1$s, expires %2$s</string>
<string name="settings_advanced_certificates_trusted_item_summary_expired">%1$s, expired</string>
<string name="settings_advanced_certificates_trusted_add_title">Add a trusted certificate</string>
<string name="settings_advanced_certificates_trusted_add_summary">Import a certificate into the trust store (PEM). When connecting to the specified ntfy server, this certificate will be trusted.</string>
<string name="settings_advanced_certificates_trusted_add_summary">Import a certificate into the trust store (PEM). When connecting to the ntfy server, this certificate will be trusted.</string>
<string name="settings_advanced_certificates_client_header">Client certificates (mTLS)</string>
<string name="settings_advanced_certificates_client_item_summary">Client certificate, issued by %1$s\nExpires %2$s, used by %3$s</string>
<string name="settings_advanced_certificates_client_item_summary_expired">Client certificate, issued by %1$s\nExpired, used by %2$s</string>
@ -505,11 +505,11 @@
<string name="trusted_certificate_dialog_title_add">Add trusted certificate</string>
<string name="trusted_certificate_dialog_description">The server\'s certificate could not be verified. Review the details below before trusting.</string>
<string name="trusted_certificate_dialog_security_title">Your connection is not private</string>
<string name="trusted_certificate_dialog_security_description">Attackers might be trying to steal your information. You should not proceed unless you know why this certificate is not trusted.</string>
<string name="trusted_certificate_dialog_security_description">The server certificate is not trusted. Attackers might be trying to steal your information. Do not proceed unless you know why this certificate is not trusted.</string>
<string name="trusted_certificate_dialog_description_add">You\'ve selected a certificate file. Review the details below before adding it to your trusted certificates.</string>
<string name="trusted_certificate_dialog_description_page1">Enter the service URL that this certificate should be pinned to. The certificate will only be trusted for this URL.</string>
<string name="trusted_certificate_dialog_base_url_hint">Service URL</string>
<string name="trusted_certificate_dialog_base_url_placeholder">https://ntfy.example.com</string>
<string name="trusted_certificate_dialog_base_url_placeholder">e.g. https://ntfy.example.com</string>
<string name="trusted_certificate_dialog_service_url">Service URL</string>
<string name="trusted_certificate_dialog_subject">Subject</string>
<string name="trusted_certificate_dialog_issuer">Issuer</string>
@ -529,7 +529,7 @@
<string name="client_certificate_dialog_title">Client certificate</string>
<string name="client_certificate_dialog_title_add">Add client certificate</string>
<string name="client_certificate_dialog_description_page1">Enter the service URL this certificate should be used for, and the password for the PKCS#12 file.</string>
<string name="client_certificate_dialog_description_page2">Review the certificate details and save to add this client certificate.</string>
<string name="client_certificate_dialog_description_page2">Review the certificate details and save to add this client certificate. This certificate will be used to authenticate with the server.</string>
<string name="client_certificate_dialog_password_hint">Password</string>
<string name="client_certificate_dialog_base_url_hint">Service URL</string>
<string name="client_certificate_dialog_base_url_placeholder">e.g. https://ntfy.example.com</string>

View file

@ -1,5 +1,5 @@
Features:
* Support for self-signed certs, custom CAs and client certs for mTLS (#215, #530, ntfy-android#149)
* Support for self-signed certs and client certs for mTLS (#215, #530, ntfy-android#149)
Maintenance + bug fixes:
* Use server-specific user for attachment downloads (#1529, thanks to @ManInDark for reporting)