mirror of
https://github.com/etesync/android
synced 2024-12-24 15:38:09 +00:00
Resource detection fixes
* check TXT records for <service>._tcp.domain.tld instead of domain.tld * duplicate log to ADB for successful resource detection
This commit is contained in:
parent
94770fb0c8
commit
82f80fed1c
@ -45,6 +45,7 @@ import at.bitfire.dav4android.property.CurrentUserPrivilegeSet;
|
|||||||
import at.bitfire.dav4android.property.DisplayName;
|
import at.bitfire.dav4android.property.DisplayName;
|
||||||
import at.bitfire.dav4android.property.ResourceType;
|
import at.bitfire.dav4android.property.ResourceType;
|
||||||
import at.bitfire.dav4android.property.SupportedCalendarComponentSet;
|
import at.bitfire.dav4android.property.SupportedCalendarComponentSet;
|
||||||
|
import at.bitfire.davdroid.Constants;
|
||||||
import at.bitfire.davdroid.HttpClient;
|
import at.bitfire.davdroid.HttpClient;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
@ -396,18 +397,18 @@ public class DavResourceFinder {
|
|||||||
log.info("Found " + service + " service: fqdn=" + fqdn + ", port=" + port);
|
log.info("Found " + service + " service: fqdn=" + fqdn + ", port=" + port);
|
||||||
|
|
||||||
// look for TXT record too (for initial context path)
|
// look for TXT record too (for initial context path)
|
||||||
records = new Lookup(domain, Type.TXT).run();
|
records = new Lookup(query, Type.TXT).run();
|
||||||
if (records != null && records.length >= 1) {
|
if (records != null)
|
||||||
TXTRecord txt = (TXTRecord)records[0];
|
for (Record record : records)
|
||||||
for (String segment : (String[])txt.getStrings().toArray(new String[0]))
|
if (record instanceof TXTRecord)
|
||||||
|
for (String segment : (List<String>) ((TXTRecord) record).getStrings())
|
||||||
if (segment.startsWith("path=")) {
|
if (segment.startsWith("path=")) {
|
||||||
paths.add(segment.substring(5));
|
paths.add(segment.substring(5));
|
||||||
log.info("Found TXT record; initial context path=" + paths);
|
log.info("Found TXT record; initial context path=" + paths);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// if there's TXT record if it it's wrong, try well-known
|
// if there's TXT record and if it it's wrong, try well-known
|
||||||
paths.add("/.well-known/" + service.name);
|
paths.add("/.well-known/" + service.name);
|
||||||
// if this fails, too, try "/"
|
// if this fails, too, try "/"
|
||||||
paths.add("/");
|
paths.add("/");
|
||||||
|
@ -21,12 +21,19 @@ import android.content.Intent;
|
|||||||
import android.content.Loader;
|
import android.content.Loader;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringReader;
|
||||||
|
|
||||||
|
import at.bitfire.davdroid.Constants;
|
||||||
import at.bitfire.davdroid.R;
|
import at.bitfire.davdroid.R;
|
||||||
import at.bitfire.davdroid.log.StringLogger;
|
import at.bitfire.davdroid.log.StringLogger;
|
||||||
import at.bitfire.davdroid.resource.DavResourceFinder;
|
import at.bitfire.davdroid.resource.DavResourceFinder;
|
||||||
import at.bitfire.davdroid.resource.LocalTaskList;
|
import at.bitfire.davdroid.resource.LocalTaskList;
|
||||||
import at.bitfire.davdroid.resource.ServerInfo;
|
import at.bitfire.davdroid.resource.ServerInfo;
|
||||||
import at.bitfire.davdroid.ui.DebugInfoActivity;
|
import at.bitfire.davdroid.ui.DebugInfoActivity;
|
||||||
|
import lombok.Cleanup;
|
||||||
|
|
||||||
public class QueryServerDialogFragment extends DialogFragment implements LoaderCallbacks<ServerInfo> {
|
public class QueryServerDialogFragment extends DialogFragment implements LoaderCallbacks<ServerInfo> {
|
||||||
public static final String KEY_SERVER_INFO = "server_info";
|
public static final String KEY_SERVER_INFO = "server_info";
|
||||||
@ -154,7 +161,20 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC
|
|||||||
DavResourceFinder finder = new DavResourceFinder(logger, context, serverInfo);
|
DavResourceFinder finder = new DavResourceFinder(logger, context, serverInfo);
|
||||||
finder.findResources();
|
finder.findResources();
|
||||||
|
|
||||||
|
// duplicate logs to ADB
|
||||||
|
String logs = logger.toString();
|
||||||
|
try {
|
||||||
|
@Cleanup BufferedReader logStream = new BufferedReader(new StringReader(logs));
|
||||||
|
Constants.log.info("Successful resource detection:");
|
||||||
|
String line;
|
||||||
|
while ((line = logStream.readLine()) != null)
|
||||||
|
Constants.log.debug(line);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Constants.log.error("Couldn't read resource detection logs", e);
|
||||||
|
}
|
||||||
|
|
||||||
serverInfo.setLogs(logger.toString());
|
serverInfo.setLogs(logger.toString());
|
||||||
|
|
||||||
return serverInfo;
|
return serverInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU
|
|||||||
<string name="setup_account_details">Konto-Details</string>
|
<string name="setup_account_details">Konto-Details</string>
|
||||||
<string name="setup_account_name">Kontoname:</string>
|
<string name="setup_account_name">Kontoname:</string>
|
||||||
<string name="setup_account_name_hint">Mein CalDAV/CardDAV-Konto</string>
|
<string name="setup_account_name_hint">Mein CalDAV/CardDAV-Konto</string>
|
||||||
<string name="setup_account_name_info">\"Verwenden Sie Ihre Email-Adresse als Kontoname, da Android den Kontonamen als ORGANIZER-Feld in Terminen benutzt. Sie können keine zwei Konten mit dem gleichen Namen anlegen.</string>
|
<string name="setup_account_name_info">Verwenden Sie Ihre Email-Adresse als Kontoname, da Android den Kontonamen als ORGANIZER-Feld in Terminen benutzt. Sie können keine zwei Konten mit dem gleichen Namen anlegen.</string>
|
||||||
<string name="setup_read_only">schreibgeschützt</string>
|
<string name="setup_read_only">schreibgeschützt</string>
|
||||||
<!--sync errors and DebugInfoActivity-->
|
<!--sync errors and DebugInfoActivity-->
|
||||||
<string name="debug_info_title">Debug-Info</string>
|
<string name="debug_info_title">Debug-Info</string>
|
||||||
|
@ -178,7 +178,7 @@
|
|||||||
<string name="setup_account_details">Account details</string>
|
<string name="setup_account_details">Account details</string>
|
||||||
<string name="setup_account_name">Account name:</string>
|
<string name="setup_account_name">Account name:</string>
|
||||||
<string name="setup_account_name_hint">My CalDAV/CardDAV Account</string>
|
<string name="setup_account_name_hint">My CalDAV/CardDAV Account</string>
|
||||||
<string name="setup_account_name_info">"Use your email address as account name because Android will use the account name as ORGANIZER field for events you create. You can't have two accounts with the same name.</string>
|
<string name="setup_account_name_info">Use your email address as account name because Android will use the account name as ORGANIZER field for events you create. You can\'t have two accounts with the same name.</string>
|
||||||
<string name="setup_read_only">read-only</string>
|
<string name="setup_read_only">read-only</string>
|
||||||
|
|
||||||
<!-- sync errors and DebugInfoActivity -->
|
<!-- sync errors and DebugInfoActivity -->
|
||||||
|
Loading…
Reference in New Issue
Block a user