Introduce group basic federation, event new page and notifications

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-02-18 08:57:00 +01:00
parent 300ef8f245
commit 4144e9ffd0
416 changed files with 32220 additions and 16750 deletions

View File

@@ -13,6 +13,11 @@ defmodule Mobilizon.Service.Geospatial.Addok do
@endpoint Application.get_env(:mobilizon, __MODULE__) |> get_in([:endpoint])
@http_options [
follow_redirect: true,
ssl: [{:versions, [:"tlsv1.2"]}]
]
@impl Provider
@doc """
Addok implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -26,7 +31,7 @@ defmodule Mobilizon.Service.Geospatial.Addok do
Logger.debug("Asking addok for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else
@@ -46,7 +51,7 @@ defmodule Mobilizon.Service.Geospatial.Addok do
Logger.debug("Asking addok for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else

View File

@@ -28,6 +28,11 @@ defmodule Mobilizon.Service.Geospatial.GoogleMaps do
@api_key_missing_message "API Key required to use Google Maps"
@http_options [
follow_redirect: true,
ssl: [{:versions, [:"tlsv1.2"]}]
]
@impl Provider
@doc """
Google Maps implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -39,7 +44,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMaps do
Logger.debug("Asking Google Maps for reverse geocode with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url),
HTTPoison.get(url, [], @http_options),
{:ok, %{"results" => results, "status" => "OK"}} <- Poison.decode(body) do
Enum.map(results, fn entry -> process_data(entry, options) end)
else
@@ -59,7 +64,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMaps do
Logger.debug("Asking Google Maps for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url),
HTTPoison.get(url, [], @http_options),
{:ok, %{"results" => results, "status" => "OK"}} <- Poison.decode(body) do
results |> Enum.map(fn entry -> process_data(entry, options) end)
else
@@ -161,7 +166,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMaps do
Logger.debug("Asking Google Maps for details with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url),
HTTPoison.get(url, [], @http_options),
{:ok, %{"result" => %{"name" => name}, "status" => "OK"}} <- Poison.decode(body) do
name
else

View File

@@ -21,6 +21,11 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do
@api_key_missing_message "API Key required to use MapQuest"
@http_options [
follow_redirect: true,
ssl: [{:versions, [:"tlsv1.2"]}]
]
@impl Provider
@doc """
MapQuest implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -42,7 +47,8 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do
"https://#{prefix}.mapquestapi.com/geocoding/v1/reverse?key=#{api_key}&location=#{
lat
},#{lon}&maxResults=#{limit}",
headers
headers,
@http_options
),
{:ok, %{"results" => results, "info" => %{"statuscode" => 0}}} <- Poison.decode(body) do
results |> Enum.map(&process_data/1)
@@ -77,7 +83,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do
Logger.debug("Asking MapQuest for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"results" => results, "info" => %{"statuscode" => 0}}} <- Poison.decode(body) do
results |> Enum.map(&process_data/1)
else

View File

@@ -17,6 +17,11 @@ defmodule Mobilizon.Service.Geospatial.Mimirsbrunn do
@endpoint Application.get_env(:mobilizon, __MODULE__) |> get_in([:endpoint])
@http_options [
follow_redirect: true,
ssl: [{:versions, [:"tlsv1.2"]}]
]
@impl Provider
@doc """
Mimirsbrunn implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -29,7 +34,7 @@ defmodule Mobilizon.Service.Geospatial.Mimirsbrunn do
Logger.debug("Asking Mimirsbrunn for reverse geocoding with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else
@@ -49,7 +54,7 @@ defmodule Mobilizon.Service.Geospatial.Mimirsbrunn do
Logger.debug("Asking Mimirsbrunn for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else

View File

@@ -14,6 +14,11 @@ defmodule Mobilizon.Service.Geospatial.Nominatim do
@endpoint Application.get_env(:mobilizon, __MODULE__) |> get_in([:endpoint])
@api_key Application.get_env(:mobilizon, __MODULE__) |> get_in([:api_key])
@http_options [
follow_redirect: true,
ssl: [{:versions, [:"tlsv1.2"]}]
]
@impl Provider
@doc """
Nominatim implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -26,7 +31,7 @@ defmodule Mobilizon.Service.Geospatial.Nominatim do
Logger.debug("Asking Nominatim for geocode with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
features |> process_data() |> Enum.filter(& &1)
else
@@ -46,7 +51,7 @@ defmodule Mobilizon.Service.Geospatial.Nominatim do
Logger.debug("Asking Nominatim for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
features |> process_data() |> Enum.filter(& &1)
else

View File

@@ -15,6 +15,11 @@ defmodule Mobilizon.Service.Geospatial.Pelias do
@endpoint Application.get_env(:mobilizon, __MODULE__) |> get_in([:endpoint])
@http_options [
follow_redirect: true,
ssl: [{:versions, [:"tlsv1.2"]}]
]
@impl Provider
@doc """
Pelias implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -27,7 +32,7 @@ defmodule Mobilizon.Service.Geospatial.Pelias do
Logger.debug("Asking Pelias for reverse geocoding with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else
@@ -47,7 +52,7 @@ defmodule Mobilizon.Service.Geospatial.Pelias do
Logger.debug("Asking Pelias for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else

View File

@@ -13,6 +13,11 @@ defmodule Mobilizon.Service.Geospatial.Photon do
@endpoint Application.get_env(:mobilizon, __MODULE__) |> get_in([:endpoint])
@http_options [
follow_redirect: true,
ssl: [{:versions, [:"tlsv1.2"]}]
]
@impl Provider
@doc """
Photon implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -27,7 +32,7 @@ defmodule Mobilizon.Service.Geospatial.Photon do
Logger.debug("Asking photon for reverse geocoding with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else
@@ -47,7 +52,7 @@ defmodule Mobilizon.Service.Geospatial.Photon do
Logger.debug("Asking photon for addresses with #{url}")
with {:ok, %HTTPoison.Response{status_code: 200, body: body}} <-
HTTPoison.get(url, headers),
HTTPoison.get(url, headers, @http_options),
{:ok, %{"features" => features}} <- Poison.decode(body) do
process_data(features)
else