mirror of https://github.com/M66B/FairEmail.git
Open safe for ISPDB
This commit is contained in:
parent
610c557470
commit
2a62fc33a3
|
@ -19,11 +19,13 @@ package eu.faircode.email;
|
|||
Copyright 2018-2023 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Misc {
|
||||
public static List<String> getISPDBUrls(String domain, String email) {
|
||||
public static List<String> getISPDBUrls(Context context, String domain, String email) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
|
@ -19,17 +19,34 @@ package eu.faircode.email;
|
|||
Copyright 2018-2023 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Misc {
|
||||
public static List<String> getISPDBUrls(String domain, String email) {
|
||||
return Collections.unmodifiableList(Arrays.asList(
|
||||
public static List<String> getISPDBUrls(Context context, String domain, String email) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean open_safe = prefs.getBoolean("open_safe", false);
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
result.addAll(Arrays.asList(
|
||||
"https://autoconfig." + domain + "/mail/config-v1.1.xml?emailaddress=" + email,
|
||||
"https://" + domain + "/.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=" + email,
|
||||
"http://autoconfig." + domain + "/mail/config-v1.1.xml?emailaddress=" + email,
|
||||
"http://" + domain + "/.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=" + email
|
||||
"https://" + domain + "/.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=" + email
|
||||
));
|
||||
|
||||
if (!open_safe)
|
||||
result.addAll(Arrays.asList(
|
||||
"http://autoconfig." + domain + "/mail/config-v1.1.xml?emailaddress=" + email,
|
||||
"http://" + domain + "/.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=" + email
|
||||
));
|
||||
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -614,7 +614,7 @@ public class EmailProvider implements Parcelable {
|
|||
@NonNull
|
||||
private static EmailProvider fromISPDB(Context context, String domain, String email, IDiscovery intf) throws Throwable {
|
||||
// https://wiki.mozilla.org/Thunderbird:Autoconfiguration
|
||||
for (String link : Misc.getISPDBUrls(domain, email))
|
||||
for (String link : Misc.getISPDBUrls(context, domain, email))
|
||||
try {
|
||||
URL url = new URL(link);
|
||||
return getISPDB(context, domain, url, true, intf);
|
||||
|
|
Loading…
Reference in New Issue