Merge pull request #4156 from osmandapp/replace_http

Replace http with https
This commit is contained in:
vshcherb 2017-07-21 10:03:43 +02:00 committed by GitHub
commit 564a8662b3
15 changed files with 39 additions and 107 deletions

View file

@ -10,11 +10,11 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AlertDialog;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.aidl.OsmandAidlApi;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.map.OsmandRegions;
import net.osmand.map.OsmandRegions.RegionTranslation;
import net.osmand.map.WorldRegion;
@ -45,7 +45,6 @@ import net.osmand.plus.voice.MediaCommandPlayerImpl;
import net.osmand.plus.voice.TTSCommandPlayerImpl;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.router.RoutingConfiguration;
import net.osmand.search.SearchUICore;
import net.osmand.util.Algorithms;
import org.xmlpull.v1.XmlPullParserException;
@ -60,6 +59,7 @@ import java.util.List;
import java.util.Random;
import btools.routingapp.BRouterServiceConnection;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
@ -86,7 +86,7 @@ public class AppInitializer implements IProgress {
private static final String VERSION_INSTALLED = "VERSION_INSTALLED"; //$NON-NLS-1$
private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$
public static final String LATEST_CHANGES_URL = "http://osmand.net/blog?id=osmand-2-7-released";
public static final String LATEST_CHANGES_URL = "https://osmand.net/blog?id=osmand-2-7-released";
// public static final String LATEST_CHANGES_URL = null; // not enough to read
public static final int APP_EXIT_CODE = 4;
public static final String APP_EXIT_KEY = "APP_EXIT_KEY";

View file

@ -1128,7 +1128,7 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<String> LIVE_MONITORING_URL = new StringPreference("live_monitoring_url",
"http://example.com?lat={0}&lon={1}&timestamp={2}&hdop={3}&altitude={4}&speed={5}").makeGlobal();
"https://example.com?lat={0}&lon={1}&timestamp={2}&hdop={3}&altitude={4}&speed={5}").makeGlobal();
public final CommonPreference<String> GPS_STATUS_APP = new StringPreference("gps_status_app", "").makeGlobal();

View file

@ -33,7 +33,7 @@ public class Version {
} else if (isGooglePlayEnabled(ctx)) {
return "market://search?q=pname:";
}
return "http://osmand.net/apps?id=";
return "https://osmand.net/apps?id=";
}
private static boolean isAmazonEnabled(OsmandApplication ctx) {

View file

@ -29,11 +29,11 @@ public class HelpActivity extends OsmandActionBarActivity implements AdapterView
// public static final String DIALOG = "dialog";
@IdRes
public static final String OSMAND_POLL_HTML = "http://osmand.net/android-poll.html";
public static final String OSMAND_POLL_HTML = "https://osmand.net/android-poll.html";
public static final int NULL_ID = -1;
private ArrayAdapter<ContextMenuItem> mAdapter;
//public static final String OSMAND_MAP_LEGEND = "http://osmand.net/help/map-legend_default.png";
//public static final String OSMAND_MAP_LEGEND = "https://osmand.net/help/map-legend_default.png";
@Override
protected void onCreate(Bundle savedInstanceState) {

View file

@ -167,7 +167,7 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv
NOMINATIM_API = "https://nominatim.openstreetmap.org/search";
}
else {
NOMINATIM_API = "http://nominatim.openstreetmap.org/search";
NOMINATIM_API = "https://nominatim.openstreetmap.org/search";
}
final List<Place> places = new ArrayList<Place>();

View file

@ -1,10 +1,8 @@
package net.osmand.plus.dialogs;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.widget.Toolbar;
@ -14,6 +12,7 @@ import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
@ -104,12 +103,12 @@ public class HelpArticleDialogFragment extends DialogFragment {
sb.append(fileContents);
sb.append(FOOTER_INNER);
webView.loadDataWithBaseURL("http://osmand.net", sb.toString(), null, "utf-8", null);
webView.loadDataWithBaseURL("https://osmand.net", sb.toString(), null, "utf-8", null);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("http://osmand.net/features?id=")) {
String id = url.substring("http://osmand.net/features?id=".length());
if (url.startsWith("https://osmand.net/features?id=")) {
String id = url.substring("https://osmand.net/features?id=".length());
dismiss();
instantiateWithAsset("feature_articles/" + id + ".html", getString(R.string.shared_string_help))
.show(getActivity().getSupportFragmentManager(), "DIALOG_HELP_ARTICLE");

View file

@ -1,5 +1,14 @@
package net.osmand.plus.download;
import android.os.Build;
import net.osmand.PlatformUtil;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.Version;
import org.apache.commons.logging.Log;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
@ -11,15 +20,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import net.osmand.PlatformUtil;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.Version;
import org.apache.commons.logging.Log;
import android.os.Build;
public class DownloadTracker {
private static final Log log = PlatformUtil.getLog(DownloadTracker.class);
@ -49,7 +49,7 @@ public class DownloadTracker {
Map<String, String> customVariables = getCustomVars(a);
parameters.put("AnalyticsVersion", analyticsVersion);
parameters.put("utmn", randomNumber());
parameters.put("utmhn", "http://app.osmand.net");
parameters.put("utmhn", "https://app.osmand.net");
parameters.put("utmni", "1");
parameters.put("utmt", "event");

View file

@ -344,7 +344,7 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
@Override
protected String doInBackground(Void... params) {
try {
return AndroidNetworkUtils.sendRequest(app, "http://osmand.net/api/geo-ip", pms,
return AndroidNetworkUtils.sendRequest(app, "https://osmand.net/api/geo-ip", pms,
"Requesting location by IP...", false, false);
} catch (Exception e) {

View file

@ -1,9 +1,12 @@
package net.osmand.plus.helpers;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.Settings.Secure;
import android.util.Log;
import android.view.View;
import net.osmand.AndroidNetworkUtils;
import net.osmand.plus.OsmandApplication;
@ -19,13 +22,10 @@ import net.osmand.util.Algorithms;
import org.json.JSONObject;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.Settings.Secure;
import android.util.Log;
import android.view.View;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
public class DiscountHelper {
@ -38,7 +38,7 @@ public class DiscountHelper {
private static String mIcon;
private static String mUrl;
private static boolean mBannerVisible;
private static final String URL = "http://osmand.net/api/motd";
private static final String URL = "https://osmand.net/api/motd";
private static final String INAPP_PREFIX = "osmand-in-app:";

View file

@ -186,7 +186,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
readMoreBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("http://osmand.net/osm_live.php");
Uri uri = Uri.parse("https://osmand.net/osm_live.php");
Intent goToOsmLive = new Intent(Intent.ACTION_VIEW, uri);
startActivity(goToOsmLive);
}

View file

@ -51,7 +51,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
private static final Log LOG = PlatformUtil.getLog(ReportsFragment.class);
public static final String OSM_LIVE_URL = "http://osmand.net/osm_live";
public static final String OSM_LIVE_URL = "https://osmand.net/osm_live";
private TextView contributorsTextView;
private TextView editsTextView;

View file

@ -410,7 +410,7 @@ public abstract class ImageCard extends AbstractCard {
if (!Algorithms.isEmpty(preferredLang)) {
pms.put("lang", preferredLang);
}
String response = AndroidNetworkUtils.sendRequest(app, "http://osmand.net/api/cm_place.php", pms,
String response = AndroidNetworkUtils.sendRequest(app, "https://osmand.net/api/cm_place.php", pms,
"Requesting location images...", false, false);
if (!Algorithms.isEmpty(response)) {

View file

@ -82,7 +82,7 @@ public class ShareMenu extends BaseMenuController {
public void share(ShareItem item) {
final int zoom = getMapActivity().getMapView().getZoom();
final String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom);
final String httpUrl = "http://osmand.net/go?lat=" + ((float) latLon.getLatitude())
final String httpUrl = "https://osmand.net/go?lat=" + ((float) latLon.getLatitude())
+ "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom;
StringBuilder sb = new StringBuilder();
if (!Algorithms.isEmpty(title)) {

View file

@ -21,7 +21,6 @@ import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.notifications.OsmandNotification;
import net.osmand.plus.notifications.OsmandNotification.NotificationType;
import org.apache.commons.logging.Log;

View file

@ -972,72 +972,6 @@ public class RouteProvider {
return directions;
}
protected RouteCalculationResult findORSRoute(RouteCalculationParams params) throws MalformedURLException, IOException, ParserConfigurationException, FactoryConfigurationError,
SAXException {
List<Location> res = new ArrayList<Location>();
String rpref = "Fastest";
if (params.mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
rpref = "Pedestrian";
} else if (params.mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
rpref = "Bicycle";
// } else if (ApplicationMode.LOWTRAFFIC == mode) {
// rpref = "BicycleSafety";
// } else if (ApplicationMode.RACEBIKE == mode) {
// rpref = "BicycleRacer";
// } else if (ApplicationMode.TOURBIKE == mode) {
// rpref = "BicycleRoute";
// } else if (ApplicationMode.MTBIKE == mode) {
// rpref = "BicycleMTB";
} else if (params.mode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
if (!params.fast) {
rpref = "Shortest";
}
} else {
return applicationModeNotSupported(params);
}
StringBuilder request = new StringBuilder();
request.append("http://openls.geog.uni-heidelberg.de/osm/eu/routing?").append("start=").append(params.start.getLongitude()).append(',')
.append(params.start.getLatitude()).append("&end=").append(params.end.getLongitude()).append(',').append(params.end.getLatitude())
.append("&preference=").append(rpref);
// TODO if we would get instructions from the service, we could use this language setting
// .append("&language=").append(Locale.getDefault().getLanguage());
log.info("URL route " + request);
URLConnection connection = NetworkUtils.getHttpURLConnection(request.toString());
connection.setRequestProperty("User-Agent", Version.getFullVersion(params.ctx));
DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = dom.parse(new InputSource(new InputStreamReader(connection.getInputStream())));
NodeList list = doc.getElementsByTagName("xls:RouteGeometry"); //$NON-NLS-1$
for (int i = 0; i < list.getLength(); i++) {
NodeList poslist = ((Element) list.item(i)).getElementsByTagName("gml:pos"); //$NON-NLS-1$
for (int j = 0; j < poslist.getLength(); j++) {
String text = poslist.item(j).getFirstChild().getNodeValue();
int s = text.indexOf(' ');
try {
double lon = Double.parseDouble(text.substring(0, s));
double lat = Double.parseDouble(text.substring(s + 1));
Location l = new Location("router"); //$NON-NLS-1$
l.setLatitude(lat);
l.setLongitude(lon);
res.add(l);
} catch (NumberFormatException nfe) {
}
}
}
if (list.getLength() == 0) {
if (doc.getChildNodes().getLength() == 1) {
Node item = doc.getChildNodes().item(0);
return new RouteCalculationResult(item.getNodeValue());
}
}
params.intermediates = null;
return new RouteCalculationResult(res, null, params, null, true);
}
public GPXFile createOsmandRouterGPX(RouteCalculationResult srcRoute, OsmandApplication ctx) {
TargetPointsHelper helper = ctx.getTargetPointsHelper();
int currentRoute = srcRoute.currentRoute;