mirror of https://github.com/perkeep/perkeep.git
client/android: remove self-signed cert option
Change-Id: I902b45cf7ac6e05d9085494a902a4554ac3a17af
This commit is contained in:
parent
87a8e7ad54
commit
2c9fbcf2ef
|
@ -34,7 +34,6 @@ public final class Preferences {
|
|||
|
||||
public static final String HOST = "camli.host";
|
||||
// TODO(mpl): list instead of single string later? seems overkill for now.
|
||||
public static final String TRUSTED_CERT = "camli.trusted_cert";
|
||||
public static final String USERNAME = "camli.username";
|
||||
public static final String PASSWORD = "camli.password";
|
||||
public static final String AUTO = "camli.auto";
|
||||
|
@ -126,10 +125,6 @@ public final class Preferences {
|
|||
return new HostPort(mSP.getString(Preferences.HOST, ""));
|
||||
}
|
||||
|
||||
public String trustedCert() {
|
||||
return mSP.getString(TRUSTED_CERT, "").toLowerCase();
|
||||
}
|
||||
|
||||
public void setDevIP(String value) {
|
||||
mSP.edit().putString(DEV_IP, value).apply();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
private IUploadService mServiceStub = null;
|
||||
|
||||
private EditTextPreference hostPref;
|
||||
private EditTextPreference trustedCertPref;
|
||||
private EditTextPreference usernamePref;
|
||||
private EditTextPreference passwordPref;
|
||||
private EditTextPreference devIPPref;
|
||||
|
@ -83,7 +82,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
|
||||
Map<CharSequence, String> m = new HashMap<CharSequence, String>();
|
||||
m.put(Preferences.HOST, "server");
|
||||
m.put(Preferences.TRUSTED_CERT, "certFingerprint");
|
||||
m.put(Preferences.USERNAME, "username");
|
||||
m.put(Preferences.PASSWORD, "password");
|
||||
m.put(Preferences.AUTO, "autoUpload");
|
||||
|
@ -94,7 +92,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
hostPref = (EditTextPreference) findPreference(Preferences.HOST);
|
||||
trustedCertPref = (EditTextPreference) findPreference(Preferences.TRUSTED_CERT);
|
||||
usernamePref = (EditTextPreference) findPreference(Preferences.USERNAME);
|
||||
passwordPref = (EditTextPreference) findPreference(Preferences.PASSWORD);
|
||||
autoPref = (CheckBoxPreference) findPreference(Preferences.AUTO);
|
||||
|
@ -121,8 +118,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
: null;
|
||||
if (pref == hostPref) {
|
||||
updateHostSummary(newStr);
|
||||
} else if (pref == trustedCertPref) {
|
||||
updateTrustedCertSummary(newStr);
|
||||
} else if (pref == passwordPref) {
|
||||
updatePasswordSummary(newStr);
|
||||
} else if (pref == usernamePref) {
|
||||
|
@ -137,7 +132,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
}
|
||||
};
|
||||
hostPref.setOnPreferenceChangeListener(onChange);
|
||||
trustedCertPref.setOnPreferenceChangeListener(onChange);
|
||||
passwordPref.setOnPreferenceChangeListener(onChange);
|
||||
usernamePref.setOnPreferenceChangeListener(onChange);
|
||||
maxCacheSizePref.setOnPreferenceChangeListener(onChange);
|
||||
|
@ -195,7 +189,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
hostPref.setText(uri.getQueryParameter("server"));
|
||||
trustedCertPref.setText(uri.getQueryParameter("certFingerprint"));
|
||||
usernamePref.setText(uri.getQueryParameter("username"));
|
||||
String auto = uri.getQueryParameter("autoUpload");
|
||||
autoPref.setChecked(auto != null && auto.equals("1"));
|
||||
|
@ -256,7 +249,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
|
||||
private void updatePreferenceSummaries() {
|
||||
updateHostSummary(hostPref.getText());
|
||||
updateTrustedCertSummary(trustedCertPref.getText());
|
||||
updatePasswordSummary(passwordPref.getText());
|
||||
updateAutoOpts(autoPref.isChecked());
|
||||
updateMaxCacheSizeSummary(maxCacheSizePref.getText());
|
||||
|
@ -282,7 +274,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
}
|
||||
boolean enabled = TextUtils.isEmpty(value);
|
||||
hostPref.setEnabled(enabled);
|
||||
trustedCertPref.setEnabled(enabled);
|
||||
usernamePref.setEnabled(enabled);
|
||||
passwordPref.setEnabled(enabled);
|
||||
if (!enabled) {
|
||||
|
@ -317,14 +308,6 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateTrustedCertSummary(String value) {
|
||||
if (value != null && value.length() > 0) {
|
||||
trustedCertPref.setSummary(value);
|
||||
} else {
|
||||
trustedCertPref.setSummary("<unset; optional 20 hex SHA-256 prefix>");
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAutoOpts(boolean checked) {
|
||||
autoOpts.setEnabled(checked);
|
||||
}
|
||||
|
|
|
@ -752,7 +752,7 @@ public class UploadService extends Service {
|
|||
mLastNotificationProgress = -1;
|
||||
|
||||
mUploading = true;
|
||||
mUploadThread = new UploadThread(UploadService.this, hp, mPrefs.trustedCert(), mPrefs.username(), mPrefs.password());
|
||||
mUploadThread = new UploadThread(UploadService.this, hp, mPrefs.username(), mPrefs.password());
|
||||
mUploadThread.start();
|
||||
|
||||
// Start a thread to release the wakelock...
|
||||
|
|
|
@ -39,7 +39,6 @@ public class UploadThread extends Thread {
|
|||
|
||||
private final UploadService mService;
|
||||
private final HostPort mHostPort;
|
||||
private final String mTrustedCert;
|
||||
private final String mUsername;
|
||||
private final String mPassword;
|
||||
private final LinkedBlockingQueue<UploadThreadMessage> msgCh = new LinkedBlockingQueue<UploadThreadMessage>();
|
||||
|
@ -54,10 +53,9 @@ public class UploadThread extends Thread {
|
|||
// to stdinWriter
|
||||
private BufferedWriter stdinWriter;
|
||||
|
||||
public UploadThread(UploadService uploadService, HostPort hp, String trustedCert, String username, String password) {
|
||||
public UploadThread(UploadService uploadService, HostPort hp, String username, String password) {
|
||||
mService = uploadService;
|
||||
mHostPort = hp;
|
||||
mTrustedCert = trustedCert != null ? trustedCert.toLowerCase().trim() : "";
|
||||
mUsername = username;
|
||||
mPassword = password;
|
||||
}
|
||||
|
@ -163,7 +161,6 @@ public class UploadThread extends Thread {
|
|||
pb.command(binaryPath("pk-put.bin"), "--server=" + mHostPort.urlPrefix(), "file", "-stdinargs", "-vivify");
|
||||
pb.redirectErrorStream(false);
|
||||
pb.environment().put("CAMLI_AUTH", "userpass:" + mUsername + ":" + mPassword);
|
||||
pb.environment().put("CAMLI_TRUSTED_CERT", mTrustedCert);
|
||||
pb.environment().put("CAMLI_CACHE_DIR", mService.getCacheDir().getAbsolutePath());
|
||||
pb.environment().put("CAMPUT_ANDROID_OUTPUT", "1");
|
||||
process = pb.start();
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
<string name="profiles_summary">default</string>
|
||||
<string name="settings_qr_title">QR</string>
|
||||
<string name="settings_qr_summary">Scan QR code from /ui/mobile.html</string>
|
||||
<string name="settings_trusted_cert_title">Self-signed cert fingerprint</string>
|
||||
<string name="settings_trusted_cert_summary">The fingerprint of your self-signed certificate. Not needed for commercial certs.</string>
|
||||
<string name="settings_username_title">Username</string>
|
||||
<string name="settings_password_title">Password</string>
|
||||
<string name="settings_max_cache_size_title">Maximum cache size</string>
|
||||
|
|
|
@ -67,12 +67,6 @@
|
|||
android:singleLine="true"
|
||||
android:title="@string/settings_max_cache_size_title" />
|
||||
|
||||
<EditTextPreference
|
||||
android:key="camli.trusted_cert"
|
||||
android:persistent="true"
|
||||
android:summary="@string/settings_trusted_cert_summary"
|
||||
android:title="@string/settings_trusted_cert_title" />
|
||||
|
||||
<EditTextPreference
|
||||
android:key="camli.dev_ip"
|
||||
android:phoneNumber="true"
|
||||
|
|
Loading…
Reference in New Issue