mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 04:41:16 +00:00
Removed old compatibility code
This commit is contained in:
parent
b707f0e6a3
commit
5b93948e7b
1 changed files with 1 additions and 45 deletions
|
@ -45,17 +45,6 @@ public class ConfigXml {
|
|||
|
||||
private static final String TAG = "ConfigXml";
|
||||
|
||||
private static final String[] REMOVE_ANNOUNCE_IPS = new String[] {
|
||||
"udp4://194.126.249.5:22026",
|
||||
"udp6://[2001:470:28:4d6::5]:22026",
|
||||
"https://194.126.249.5/?id=SR7AARM-TCBUZ5O-VFAXY4D-CECGSDE-3Q6IZ4G-XG7AH75-OBIXJQV-QJ6NLQA",
|
||||
"https://45.55.230.38/?id=AQEHEO2-XOS7QRA-X2COH5K-PO6OPVA-EWOSEGO-KZFMD32-XJ4ZV46-CUUVKAS",
|
||||
"https://128.199.95.124/?id=7WT2BVR-FX62ZOW-TNVVW25-6AHFJGD-XEXQSBW-VO3MPL2-JBTLL4T-P4572Q4",
|
||||
"https://[2001:470:28:4d6::5]/?id=SR7AARM-TCBUZ5O-VFAXY4D-CECGSDE-3Q6IZ4G-XG7AH75-OBIXJQV-QJ6NLQA",
|
||||
"https://[2604:a880:800:10::182:a001]/?id=AQEHEO2-XOS7QRA-X2COH5K-PO6OPVA-EWOSEGO-KZFMD32-XJ4ZV46-CUUVKAS",
|
||||
"https://[2400:6180:0:d0::d9:d001]/?id=7WT2BVR-FX62ZOW-TNVVW25-6AHFJGD-XEXQSBW-VO3MPL2-JBTLL4T-P4572Q4",
|
||||
};
|
||||
|
||||
/**
|
||||
* File in the config folder that contains configuration.
|
||||
*/
|
||||
|
@ -123,13 +112,6 @@ public class ConfigXml {
|
|||
private void updateIfNeeded() {
|
||||
Log.i(TAG, "Checking for needed config updates");
|
||||
boolean changed = false;
|
||||
Element options = (Element) mConfig.getDocumentElement()
|
||||
.getElementsByTagName("options").item(0);
|
||||
|
||||
if (restoreDefaultAnnounceServers(options)) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
NodeList folders = mConfig.getDocumentElement().getElementsByTagName("folder");
|
||||
for (int i = 0; i < folders.getLength(); i++) {
|
||||
Element r = (Element) folders.item(i);
|
||||
|
@ -146,6 +128,7 @@ public class ConfigXml {
|
|||
// https://code.google.com/p/android/issues/detail?id=189231
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (!r.getAttribute("rescanIntervalS").equals("60")) {
|
||||
Log.i(TAG, "Set 60s rescan interval on folder " + r.getAttribute("id"));
|
||||
r.setAttribute("rescanIntervalS", "60");
|
||||
changed = true;
|
||||
}
|
||||
|
@ -171,33 +154,6 @@ public class ConfigXml {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes our hardcoded announce server IPs, and adds the 'default' value again.
|
||||
*
|
||||
* For compatibility with 0.7.4
|
||||
*/
|
||||
private boolean restoreDefaultAnnounceServers(Element options) {
|
||||
// Hardcode default globalAnnounceServer ip.
|
||||
NodeList globalAnnounceServers = options.getElementsByTagName("globalAnnounceServer");
|
||||
boolean announceServersRemoved = false;
|
||||
for (int i = 0; i < globalAnnounceServers.getLength(); i++) {
|
||||
Node announce = globalAnnounceServers.item(i);
|
||||
if (Arrays.asList(REMOVE_ANNOUNCE_IPS).contains(announce.getTextContent())) {
|
||||
options.removeChild(announce);
|
||||
announceServersRemoved = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (announceServersRemoved) {
|
||||
Log.i(TAG, "Replacing globalAnnounceServer address with ip");
|
||||
Element newAnnounce = mConfig.createElement("globalAnnounceServer");
|
||||
newAnnounce.setTextContent("default");
|
||||
options.appendChild(newAnnounce);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set 'hashers' (see https://github.com/syncthing/syncthing-android/issues/384) on the
|
||||
* given folder.
|
||||
|
|
Loading…
Reference in a new issue