From 163c7d7d301fd2ff11f99fd2c12258d994125807 Mon Sep 17 00:00:00 2001 From: Aptivi Date: Wed, 12 Jun 2024 11:28:55 +0300 Subject: [PATCH] imp - sec - Use HTTPS everywhere --- As we're in the world where HTTPS is more secure than HTTP, we need to use HTTPS in both OWM and TWC weather endpoints. --- Type: imp Breaking: False Doc Required: False Part: 1/1 --- Nettify/Weather/WeatherForecast.cs | 8 ++++---- Nettify/Weather/WeatherForecastOwm.cs | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Nettify/Weather/WeatherForecast.cs b/Nettify/Weather/WeatherForecast.cs index fc884c4..27f7404 100644 --- a/Nettify/Weather/WeatherForecast.cs +++ b/Nettify/Weather/WeatherForecast.cs @@ -46,7 +46,7 @@ public static class WeatherForecast /// A class containing properties of weather information public static WeatherForecastInfo GetWeatherInfo(double latitude, double longitude, string APIKey, UnitMeasurement Unit = UnitMeasurement.Metric) { - string WeatherURL = $"http://api.weather.com/v3/wx/forecast/daily/15day?geocode={latitude},{longitude}&format=json&language=en-US&units={(Unit == UnitMeasurement.Metric ? 'm' : 'e')}&apiKey={APIKey}"; + string WeatherURL = $"https://api.weather.com/v3/wx/forecast/daily/15day?geocode={latitude},{longitude}&format=json&language=en-US&units={(Unit == UnitMeasurement.Metric ? 'm' : 'e')}&apiKey={APIKey}"; return GetWeatherInfo(WeatherURL, Unit == UnitMeasurement.Kelvin ? UnitMeasurement.Imperial : Unit); } @@ -82,7 +82,7 @@ internal static WeatherForecastInfo GetWeatherInfo(string WeatherURL, UnitMeasur /// A class containing properties of weather information public static async Task GetWeatherInfoAsync(double latitude, double longitude, string APIKey, UnitMeasurement Unit = UnitMeasurement.Metric) { - string WeatherURL = $"http://api.weather.com/v3/wx/forecast/daily/15day?geocode={latitude},{longitude}&format=json&language=en-US&units={(Unit == UnitMeasurement.Metric ? 'm' : 'e')}&apiKey={APIKey}"; + string WeatherURL = $"https://api.weather.com/v3/wx/forecast/daily/15day?geocode={latitude},{longitude}&format=json&language=en-US&units={(Unit == UnitMeasurement.Metric ? 'm' : 'e')}&apiKey={APIKey}"; return await GetWeatherInfoAsync(WeatherURL, Unit); } @@ -262,7 +262,7 @@ T Adjust(string dayPartData) /// public static Dictionary ListAllCities(string city, string APIKey) { - string WeatherCityListURL = $"http://api.weather.com/v3/location/search?language=en-US&query={city}&format=json&apiKey={APIKey}"; + string WeatherCityListURL = $"https://api.weather.com/v3/location/search?language=en-US&query={city}&format=json&apiKey={APIKey}"; Stream WeatherCityListDataStream; Debug.WriteLine("Weather City List URL: {0}", WeatherCityListURL); @@ -278,7 +278,7 @@ T Adjust(string dayPartData) /// public static async Task> ListAllCitiesAsync(string city, string APIKey) { - string WeatherCityListURL = $"http://api.weather.com/v3/location/search?language=en-US&query={city}&format=json&apiKey={APIKey}"; + string WeatherCityListURL = $"https://api.weather.com/v3/location/search?language=en-US&query={city}&format=json&apiKey={APIKey}"; Stream WeatherCityListDataStream; Debug.WriteLine("Weather City List URL: {0}", WeatherCityListURL); diff --git a/Nettify/Weather/WeatherForecastOwm.cs b/Nettify/Weather/WeatherForecastOwm.cs index cec7449..2c73949 100644 --- a/Nettify/Weather/WeatherForecastOwm.cs +++ b/Nettify/Weather/WeatherForecastOwm.cs @@ -44,7 +44,7 @@ public static class WeatherForecastOwm /// A class containing properties of weather information public static WeatherForecastInfo GetWeatherInfo(long CityID, string APIKey, UnitMeasurement Unit = UnitMeasurement.Metric) { - string WeatherURL = $"http://api.openweathermap.org/data/2.5/weather?id={CityID}&appid={APIKey}"; + string WeatherURL = $"https://api.openweathermap.org/data/2.5/weather?id={CityID}&appid={APIKey}"; return GetWeatherInfo(WeatherURL, Unit); } @@ -57,7 +57,7 @@ public static WeatherForecastInfo GetWeatherInfo(long CityID, string APIKey, Uni /// A class containing properties of weather information public static WeatherForecastInfo GetWeatherInfo(string CityName, string APIKey, UnitMeasurement Unit = UnitMeasurement.Metric) { - string WeatherURL = $"http://api.openweathermap.org/data/2.5/weather?q={CityName}&appid={APIKey}"; + string WeatherURL = $"https://api.openweathermap.org/data/2.5/weather?q={CityName}&appid={APIKey}"; return GetWeatherInfo(WeatherURL, Unit); } @@ -94,7 +94,7 @@ internal static WeatherForecastInfo GetWeatherInfo(string WeatherURL, UnitMeasur /// A class containing properties of weather information public static async Task GetWeatherInfoAsync(long CityID, string APIKey, UnitMeasurement Unit = UnitMeasurement.Metric) { - string WeatherURL = $"http://api.openweathermap.org/data/2.5/weather?id={CityID}&appid={APIKey}"; + string WeatherURL = $"https://api.openweathermap.org/data/2.5/weather?id={CityID}&appid={APIKey}"; return await GetWeatherInfoAsync(WeatherURL, Unit); } @@ -107,7 +107,7 @@ public static async Task GetWeatherInfoAsync(long CityID, s /// A class containing properties of weather information public static async Task GetWeatherInfoAsync(string CityName, string APIKey, UnitMeasurement Unit = UnitMeasurement.Metric) { - string WeatherURL = $"http://api.openweathermap.org/data/2.5/weather?q={CityName}&appid={APIKey}"; + string WeatherURL = $"https://api.openweathermap.org/data/2.5/weather?q={CityName}&appid={APIKey}"; return await GetWeatherInfoAsync(WeatherURL, Unit); } @@ -152,7 +152,7 @@ internal static WeatherForecastInfo FinalizeInstallation(JToken WeatherToken, Un /// public static Dictionary ListAllCities() { - string WeatherCityListURL = $"http://bulk.openweathermap.org/sample/city.list.json.gz"; + string WeatherCityListURL = $"https://bulk.openweathermap.org/sample/city.list.json.gz"; Stream WeatherCityListDataStream; Debug.WriteLine("Weather City List URL: {0}", WeatherCityListURL); @@ -166,7 +166,7 @@ public static Dictionary ListAllCities() /// public static async Task> ListAllCitiesAsync() { - string WeatherCityListURL = $"http://bulk.openweathermap.org/sample/city.list.json.gz"; + string WeatherCityListURL = $"https://bulk.openweathermap.org/sample/city.list.json.gz"; Stream WeatherCityListDataStream; Debug.WriteLine("Weather City List URL: {0}", WeatherCityListURL);