1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-09 11:41:29 +00:00

Show meaningful error message if config file is missing (fixes #1156) (#1157)

This commit is contained in:
Catfriend1 2018-06-18 01:06:44 +02:00 committed by Audrius Butkevicius
parent 0f954c07fb
commit 1a6db23281
2 changed files with 12 additions and 3 deletions

View file

@ -19,6 +19,7 @@ import android.webkit.HttpAuthHandler;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.service.Constants;
@ -206,13 +207,18 @@ public class WebGuiActivity extends StateDialogActivity
}
/**
* Reads the SyncthingService.HTTPS_CERT_FILE Ca Cert key and loads it in memory
* Reads the SyncthingService.HTTPS_CERT_FILE Ca Cert key and loads it in memory
*/
private void loadCaCert() {
InputStream inStream = null;
File httpsCertFile = Constants.getHttpsCertFile(this);
if (!httpsCertFile.exists()) {
Toast.makeText(WebGuiActivity.this, R.string.config_file_missing, Toast.LENGTH_LONG).show();
finish();
return;
}
try {
File httpsCertPath = Constants.getHttpsCertFile(this);
inStream = new FileInputStream(httpsCertPath);
inStream = new FileInputStream(httpsCertFile);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
mCaCert = (X509Certificate)
cf.generateCertificate(inStream);

View file

@ -583,6 +583,9 @@ Please report any problems you encounter via Github.</string>
<!-- Toast shown if syncthing failed to create a config -->
<string name="config_create_failed">Failed to create config file</string>
<!-- Toast shown if a config file crucial to operation is missing -->
<string name="config_file_missing">A config file crucial to operation is missing</string>
<!-- Label of the default folder created of first start (camera folder). -->
<string name="default_folder_label">Camera</string>