From 42f07c17e50431b97934e897de7fcba2c23fdbb1 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 4 Jun 2020 10:58:27 +0200 Subject: [PATCH] Disable mix docs for now Because of https://github.com/elixir-lang/ex_doc/issues/1172 Signed-off-by: Thomas Citharel --- .gitlab-ci.yml | 5 ++- lib/federation/activity_pub/activity_pub.ex | 20 +++++----- lib/federation/activity_pub/transmogrifier.ex | 28 ++++++------- lib/mobilizon/events/events.ex | 8 ++-- lib/service/geospatial/map_quest.ex | 4 +- lib/service/geospatial/provider.ex | 32 +++++++-------- lib/web/proxy/reverse_proxy.ex | 40 +++++++++---------- lib/web/upload/filter/filter.ex | 6 +-- lib/web/upload/upload.ex | 30 +++++++------- lib/web/upload/uploader/uploader.ex | 14 +++---- 10 files changed, 94 insertions(+), 93 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c8918612..892846a9d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,8 +108,9 @@ pages: - mkdir public - mkdocs build - mv site/* public/ - - mix deps.get - - mix docs + # Mix docs disabled because of https://github.com/elixir-lang/ex_doc/issues/1172 + # - mix deps.get + # - mix docs - mv doc public/backend #- cd js #- yarn install diff --git a/lib/federation/activity_pub/activity_pub.ex b/lib/federation/activity_pub/activity_pub.ex index 9a0c24eed..515260a84 100644 --- a/lib/federation/activity_pub/activity_pub.ex +++ b/lib/federation/activity_pub/activity_pub.ex @@ -185,11 +185,11 @@ defmodule Mobilizon.Federation.ActivityPub do @doc """ Create an activity of type `Create` - * Creates the object, which returns AS data - * Wraps ActivityStreams data into a `Create` activity - * Creates an `Mobilizon.Federation.ActivityPub.Activity` from this - * Federates (asynchronously) the activity - * Returns the activity + * Creates the object, which returns AS data + * Wraps ActivityStreams data into a `Create` activity + * Creates an `Mobilizon.Federation.ActivityPub.Activity` from this + * Federates (asynchronously) the activity + * Returns the activity """ @spec create(atom(), map(), boolean, map()) :: {:ok, Activity.t(), struct()} | any() def create(type, args, local \\ false, additional \\ %{}) do @@ -220,11 +220,11 @@ defmodule Mobilizon.Federation.ActivityPub do @doc """ Create an activity of type `Update` - * Updates the object, which returns AS data - * Wraps ActivityStreams data into a `Update` activity - * Creates an `Mobilizon.Federation.ActivityPub.Activity` from this - * Federates (asynchronously) the activity - * Returns the activity + * Updates the object, which returns AS data + * Wraps ActivityStreams data into a `Update` activity + * Creates an `Mobilizon.Federation.ActivityPub.Activity` from this + * Federates (asynchronously) the activity + * Returns the activity """ @spec update(atom(), struct(), map(), boolean, map()) :: {:ok, Activity.t(), struct()} | any() def update(type, old_entity, args, local \\ false, additional \\ %{}) do diff --git a/lib/federation/activity_pub/transmogrifier.ex b/lib/federation/activity_pub/transmogrifier.ex index b0ab7496e..bd2c28bbe 100644 --- a/lib/federation/activity_pub/transmogrifier.ex +++ b/lib/federation/activity_pub/transmogrifier.ex @@ -48,13 +48,13 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do Handles a `Create` activity for `Note` (comments) objects The following actions are performed - * Fetch the author of the activity - * Convert the ActivityStream data to the comment model format (it also finds and inserts tags) - * Get (by it's URL) or create the comment with this data - * Insert eventual mentions in the database - * Convert the comment back in ActivityStreams data - * Wrap this data back into a `Create` activity - * Return the activity and the comment object + * Fetch the author of the activity + * Convert the ActivityStream data to the comment model format (it also finds and inserts tags) + * Get (by it's URL) or create the comment with this data + * Insert eventual mentions in the database + * Convert the comment back in ActivityStreams data + * Wrap this data back into a `Create` activity + * Return the activity and the comment object """ def handle_incoming(%{"type" => "Create", "object" => %{"type" => "Note"} = object}) do Logger.info("Handle incoming to create notes") @@ -76,13 +76,13 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do Handles a `Create` activity for `Event` objects The following actions are performed - * Fetch the author of the activity - * Convert the ActivityStream data to the event model format (it also finds and inserts tags) - * Get (by it's URL) or create the event with this data - * Insert eventual mentions in the database - * Convert the event back in ActivityStreams data - * Wrap this data back into a `Create` activity - * Return the activity and the event object + * Fetch the author of the activity + * Convert the ActivityStream data to the event model format (it also finds and inserts tags) + * Get (by it's URL) or create the event with this data + * Insert eventual mentions in the database + * Convert the event back in ActivityStreams data + * Wrap this data back into a `Create` activity + * Return the activity and the event object """ def handle_incoming(%{"type" => "Create", "object" => %{"type" => "Event"} = object}) do Logger.info("Handle incoming to create event") diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index 6b5a95282..69be7b24a 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -637,8 +637,8 @@ defmodule Mobilizon.Events do ## Examples - iex> get_participant(123) - %Participant{} + iex> get_participant(123) + %Participant{} iex> get_participant(456) nil @@ -712,8 +712,8 @@ defmodule Mobilizon.Events do ## Examples - iex> get_participant!(123, 19) - %Participant{} + iex> get_participant!(123, 19) + %Participant{} iex> get_participant!(456, 5) ** (Ecto.NoResultsError) diff --git a/lib/service/geospatial/map_quest.ex b/lib/service/geospatial/map_quest.ex index 0b33ec87e..edb597541 100644 --- a/lib/service/geospatial/map_quest.ex +++ b/lib/service/geospatial/map_quest.ex @@ -5,8 +5,8 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do ## Options In addition to the [the shared options](Mobilizon.Service.Geospatial.Provider.html#module-shared-options), MapQuest methods support the following options: - * `:open_data` Whether to use [Open Data or Licenced Data](https://developer.mapquest.com/documentation/open/). - Defaults to `true` + * `:open_data` Whether to use [Open Data or Licenced Data](https://developer.mapquest.com/documentation/open/). + Defaults to `true` """ alias Mobilizon.Addresses.Address diff --git a/lib/service/geospatial/provider.ex b/lib/service/geospatial/provider.ex index 87dbb3606..a86fe2b33 100644 --- a/lib/service/geospatial/provider.ex +++ b/lib/service/geospatial/provider.ex @@ -4,26 +4,26 @@ defmodule Mobilizon.Service.Geospatial.Provider do ## Supported backends - * `Mobilizon.Service.Geospatial.Nominatim` [🔗](https://wiki.openstreetmap.org/wiki/Nominatim) - * `Mobilizon.Service.Geospatial.Photon` [🔗](https://photon.komoot.de) - * `Mobilizon.Service.Geospatial.Addok` [🔗](https://github.com/addok/addok) - * `Mobilizon.Service.Geospatial.MapQuest` [🔗](https://developer.mapquest.com/documentation/open/) - * `Mobilizon.Service.Geospatial.GoogleMaps` [🔗](https://developers.google.com/maps/documentation/geocoding/intro) - * `Mobilizon.Service.Geospatial.Mimirsbrunn` [🔗](https://github.com/CanalTP/mimirsbrunn) - * `Mobilizon.Service.Geospatial.Pelias` [🔗](https://pelias.io) + * `Mobilizon.Service.Geospatial.Nominatim` [🔗](https://wiki.openstreetmap.org/wiki/Nominatim) + * `Mobilizon.Service.Geospatial.Photon` [🔗](https://photon.komoot.de) + * `Mobilizon.Service.Geospatial.Addok` [🔗](https://github.com/addok/addok) + * `Mobilizon.Service.Geospatial.MapQuest` [🔗](https://developer.mapquest.com/documentation/open/) + * `Mobilizon.Service.Geospatial.GoogleMaps` [🔗](https://developers.google.com/maps/documentation/geocoding/intro) + * `Mobilizon.Service.Geospatial.Mimirsbrunn` [🔗](https://github.com/CanalTP/mimirsbrunn) + * `Mobilizon.Service.Geospatial.Pelias` [🔗](https://pelias.io) ## Shared options - * `:user_agent` User-Agent string to send to the backend. Defaults to `"Mobilizon"` or `Mobilizon.Config.instance_user_agent/0` - * `:lang` Lang in which to prefer results. Used as a request parameter or - through an `Accept-Language` HTTP header. Defaults to `"en"`. - * `:country_code` An ISO 3166 country code. String or `nil` - * `:limit` Maximum limit for the number of results returned by the backend. - Defaults to `10` - * `:api_key` Allows to override the API key (if the backend requires one) set - inside the configuration. - * `:endpoint` Allows to override the endpoint set inside the configuration. + * `:user_agent` User-Agent string to send to the backend. Defaults to `"Mobilizon"` or `Mobilizon.Config.instance_user_agent/0` + * `:lang` Lang in which to prefer results. Used as a request parameter or + through an `Accept-Language` HTTP header. Defaults to `"en"`. + * `:country_code` An ISO 3166 country code. String or `nil` + * `:limit` Maximum limit for the number of results returned by the backend. + Defaults to `10` + * `:api_key` Allows to override the API key (if the backend requires one) set + inside the configuration. + * `:endpoint` Allows to override the endpoint set inside the configuration. """ alias Mobilizon.Addresses.Address diff --git a/lib/web/proxy/reverse_proxy.ex b/lib/web/proxy/reverse_proxy.ex index 46a488ccb..045e8ae23 100644 --- a/lib/web/proxy/reverse_proxy.ex +++ b/lib/web/proxy/reverse_proxy.ex @@ -30,38 +30,38 @@ defmodule Mobilizon.Web.ReverseProxy do Some request / responses headers are preserved: - * request: `#{inspect(@keep_req_headers)}` - * response: `#{inspect(@keep_resp_headers)}` + * request: `#{inspect(@keep_req_headers)}` + * response: `#{inspect(@keep_resp_headers)}` If no caching headers (`#{inspect(@resp_cache_headers)}`) are returned by upstream, `cache-control` will be set to `#{inspect(@default_cache_control_header)}`. Options: - * `redirect_on_failure` (default `false`). Redirects the client to the real - remote URL if there's any HTTP errors. Any error during body processing will - not be redirected as the response is chunked. This may expose remote URL, - clients IPs, …. + * `redirect_on_failure` (default `false`). Redirects the client to the real + remote URL if there's any HTTP errors. Any error during body processing will + not be redirected as the response is chunked. This may expose remote URL, + clients IPs, …. - * `max_body_length` (default `#{inspect(@max_body_length)}`): limits the - content length to be approximately the specified length. It is validated with - the `content-length` header and also verified when proxying. + * `max_body_length` (default `#{inspect(@max_body_length)}`): limits the + content length to be approximately the specified length. It is validated with + the `content-length` header and also verified when proxying. - * `max_read_duration` (default `#{inspect(@max_read_duration)}` ms): the total - time the connection is allowed to read from the remote upstream. + * `max_read_duration` (default `#{inspect(@max_read_duration)}` ms): the total + time the connection is allowed to read from the remote upstream. - * `inline_content_types`: - * `true` will not alter `content-disposition` (up to the upstream), - * `false` will add `content-disposition: attachment` to any request, - * a list of whitelisted content types + * `inline_content_types`: + * `true` will not alter `content-disposition` (up to the upstream), + * `false` will add `content-disposition: attachment` to any request, + * a list of whitelisted content types - * `keep_user_agent` will forward the client's user-agent to the upstream. - This may be useful if the upstream is doing content transformation - (encoding, …) depending on the request. + * `keep_user_agent` will forward the client's user-agent to the upstream. + This may be useful if the upstream is doing content transformation + (encoding, …) depending on the request. - * `req_headers`, `resp_headers` additional headers. + * `req_headers`, `resp_headers` additional headers. - * `http`: options for [hackney](https://github.com/benoitc/hackney). + * `http`: options for [hackney](https://github.com/benoitc/hackney). """ diff --git a/lib/web/upload/filter/filter.ex b/lib/web/upload/filter/filter.ex index 63ef16867..322acdf47 100644 --- a/lib/web/upload/filter/filter.ex +++ b/lib/web/upload/filter/filter.ex @@ -9,9 +9,9 @@ defmodule Mobilizon.Web.Upload.Filter do This behaviour allows to run filtering actions just before a file is uploaded. This allows to: - * morph in place the temporary file - * change any field of a `Mobilizon.Upload` struct - * cancel/stop the upload + * morph in place the temporary file + * change any field of a `Mobilizon.Upload` struct + * cancel/stop the upload """ require Logger diff --git a/lib/web/upload/upload.ex b/lib/web/upload/upload.ex index bfb636aaa..dd6ee0652 100644 --- a/lib/web/upload/upload.ex +++ b/lib/web/upload/upload.ex @@ -8,27 +8,27 @@ defmodule Mobilizon.Web.Upload do Manage user uploads Options: - * `:type`: presets for activity type (defaults to Document) and size limits from app configuration - * `:description`: upload alternative text - * `:base_url`: override base url - * `:uploader`: override uploader - * `:filters`: override filters - * `:size_limit`: override size limit - * `:activity_type`: override activity type + * `:type`: presets for activity type (defaults to Document) and size limits from app configuration + * `:description`: upload alternative text + * `:base_url`: override base url + * `:uploader`: override uploader + * `:filters`: override filters + * `:size_limit`: override size limit + * `:activity_type`: override activity type The `%Mobilizon.Web.Upload{}` struct: all documented fields are meant to be overwritten in filters: - * `:id` - the upload id. - * `:name` - the upload file name. - * `:path` - the upload path: set at first to `id/name` but can be changed. Keep in mind that the path - is once created permanent and changing it (especially in uploaders) is probably a bad idea! - * `:tempfile` - path to the temporary file. Prefer in-place changes on the file rather than changing the - path as the temporary file is also tracked by `Plug.Upload{}` and automatically deleted once the request is over. + * `:id` - the upload id. + * `:name` - the upload file name. + * `:path` - the upload path: set at first to `id/name` but can be changed. Keep in mind that the path + is once created permanent and changing it (especially in uploaders) is probably a bad idea! + * `:tempfile` - path to the temporary file. Prefer in-place changes on the file rather than changing the + path as the temporary file is also tracked by `Plug.Upload{}` and automatically deleted once the request is over. Related behaviors: - * `Mobilizon.Web.Upload.Uploader` - * `Mobilizon.Web.Upload.Filter` + * `Mobilizon.Web.Upload.Uploader` + * `Mobilizon.Web.Upload.Filter` """ diff --git a/lib/web/upload/uploader/uploader.ex b/lib/web/upload/uploader/uploader.ex index 5c163b9c0..fce8fdf62 100644 --- a/lib/web/upload/uploader/uploader.ex +++ b/lib/web/upload/uploader/uploader.ex @@ -21,14 +21,14 @@ defmodule Mobilizon.Web.Upload.Uploader do Returns: - * `:ok` which assumes `{:ok, upload.path}` - * `{:ok, spec}` where spec is: - * `{:file, filename :: String.t}` to handle reads with `get_file/1` (recommended) + * `:ok` which assumes `{:ok, upload.path}` + * `{:ok, spec}` where spec is: + * `{:file, filename :: String.t}` to handle reads with `get_file/1` (recommended) - This allows to correctly proxy or redirect requests to the backend, while allowing to migrate backends without breaking any URL. - * `{url, url :: String.t}` to bypass `get_file/2` and use the `url` directly in the activity. - * `{:error, String.t}` error information if the file failed to be saved to the backend. - * `:wait_callback` will wait for an http post request at `/api/pleroma/upload_callback/:upload_path` and call the uploader's `http_callback/3` method. + This allows to correctly proxy or redirect requests to the backend, while allowing to migrate backends without breaking any URL. + * `{url, url :: String.t}` to bypass `get_file/2` and use the `url` directly in the activity. + * `{:error, String.t}` error information if the file failed to be saved to the backend. + * `:wait_callback` will wait for an http post request at `/api/pleroma/upload_callback/:upload_path` and call the uploader's `http_callback/3` method. """ @type file_spec :: {:file | :url, String.t()}