Merge branch 'disable-mix-docs' into 'master'

Disable mix docs for now

See merge request framasoft/mobilizon!435
This commit is contained in:
Thomas Citharel 2020-06-04 11:17:09 +02:00
commit 0f73aad9e9
10 changed files with 94 additions and 93 deletions

View File

@ -108,8 +108,9 @@ pages:
- mkdir public - mkdir public
- mkdocs build - mkdocs build
- mv site/* public/ - mv site/* public/
- mix deps.get # Mix docs disabled because of https://github.com/elixir-lang/ex_doc/issues/1172
- mix docs # - mix deps.get
# - mix docs
- mv doc public/backend - mv doc public/backend
#- cd js #- cd js
#- yarn install #- yarn install

View File

@ -185,11 +185,11 @@ defmodule Mobilizon.Federation.ActivityPub do
@doc """ @doc """
Create an activity of type `Create` Create an activity of type `Create`
* Creates the object, which returns AS data * Creates the object, which returns AS data
* Wraps ActivityStreams data into a `Create` activity * Wraps ActivityStreams data into a `Create` activity
* Creates an `Mobilizon.Federation.ActivityPub.Activity` from this * Creates an `Mobilizon.Federation.ActivityPub.Activity` from this
* Federates (asynchronously) the activity * Federates (asynchronously) the activity
* Returns the activity * Returns the activity
""" """
@spec create(atom(), map(), boolean, map()) :: {:ok, Activity.t(), struct()} | any() @spec create(atom(), map(), boolean, map()) :: {:ok, Activity.t(), struct()} | any()
def create(type, args, local \\ false, additional \\ %{}) do def create(type, args, local \\ false, additional \\ %{}) do
@ -220,11 +220,11 @@ defmodule Mobilizon.Federation.ActivityPub do
@doc """ @doc """
Create an activity of type `Update` Create an activity of type `Update`
* Updates the object, which returns AS data * Updates the object, which returns AS data
* Wraps ActivityStreams data into a `Update` activity * Wraps ActivityStreams data into a `Update` activity
* Creates an `Mobilizon.Federation.ActivityPub.Activity` from this * Creates an `Mobilizon.Federation.ActivityPub.Activity` from this
* Federates (asynchronously) the activity * Federates (asynchronously) the activity
* Returns the activity * Returns the activity
""" """
@spec update(atom(), struct(), map(), boolean, map()) :: {:ok, Activity.t(), struct()} | any() @spec update(atom(), struct(), map(), boolean, map()) :: {:ok, Activity.t(), struct()} | any()
def update(type, old_entity, args, local \\ false, additional \\ %{}) do def update(type, old_entity, args, local \\ false, additional \\ %{}) do

View File

@ -48,13 +48,13 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
Handles a `Create` activity for `Note` (comments) objects Handles a `Create` activity for `Note` (comments) objects
The following actions are performed The following actions are performed
* Fetch the author of the activity * Fetch the author of the activity
* Convert the ActivityStream data to the comment model format (it also finds and inserts tags) * 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 * Get (by it's URL) or create the comment with this data
* Insert eventual mentions in the database * Insert eventual mentions in the database
* Convert the comment back in ActivityStreams data * Convert the comment back in ActivityStreams data
* Wrap this data back into a `Create` activity * Wrap this data back into a `Create` activity
* Return the activity and the comment object * Return the activity and the comment object
""" """
def handle_incoming(%{"type" => "Create", "object" => %{"type" => "Note"} = object}) do def handle_incoming(%{"type" => "Create", "object" => %{"type" => "Note"} = object}) do
Logger.info("Handle incoming to create notes") Logger.info("Handle incoming to create notes")
@ -76,13 +76,13 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
Handles a `Create` activity for `Event` objects Handles a `Create` activity for `Event` objects
The following actions are performed The following actions are performed
* Fetch the author of the activity * Fetch the author of the activity
* Convert the ActivityStream data to the event model format (it also finds and inserts tags) * 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 * Get (by it's URL) or create the event with this data
* Insert eventual mentions in the database * Insert eventual mentions in the database
* Convert the event back in ActivityStreams data * Convert the event back in ActivityStreams data
* Wrap this data back into a `Create` activity * Wrap this data back into a `Create` activity
* Return the activity and the event object * Return the activity and the event object
""" """
def handle_incoming(%{"type" => "Create", "object" => %{"type" => "Event"} = object}) do def handle_incoming(%{"type" => "Create", "object" => %{"type" => "Event"} = object}) do
Logger.info("Handle incoming to create event") Logger.info("Handle incoming to create event")

View File

@ -637,8 +637,8 @@ defmodule Mobilizon.Events do
## Examples ## Examples
iex> get_participant(123) iex> get_participant(123)
%Participant{} %Participant{}
iex> get_participant(456) iex> get_participant(456)
nil nil
@ -712,8 +712,8 @@ defmodule Mobilizon.Events do
## Examples ## Examples
iex> get_participant!(123, 19) iex> get_participant!(123, 19)
%Participant{} %Participant{}
iex> get_participant!(456, 5) iex> get_participant!(456, 5)
** (Ecto.NoResultsError) ** (Ecto.NoResultsError)

View File

@ -5,8 +5,8 @@ defmodule Mobilizon.Service.Geospatial.MapQuest do
## Options ## Options
In addition to the [the shared options](Mobilizon.Service.Geospatial.Provider.html#module-shared-options), In addition to the [the shared options](Mobilizon.Service.Geospatial.Provider.html#module-shared-options),
MapQuest methods support the following options: MapQuest methods support the following options:
* `:open_data` Whether to use [Open Data or Licenced Data](https://developer.mapquest.com/documentation/open/). * `:open_data` Whether to use [Open Data or Licenced Data](https://developer.mapquest.com/documentation/open/).
Defaults to `true` Defaults to `true`
""" """
alias Mobilizon.Addresses.Address alias Mobilizon.Addresses.Address

View File

@ -4,26 +4,26 @@ defmodule Mobilizon.Service.Geospatial.Provider do
## Supported backends ## Supported backends
* `Mobilizon.Service.Geospatial.Nominatim` [🔗](https://wiki.openstreetmap.org/wiki/Nominatim) * `Mobilizon.Service.Geospatial.Nominatim` [🔗](https://wiki.openstreetmap.org/wiki/Nominatim)
* `Mobilizon.Service.Geospatial.Photon` [🔗](https://photon.komoot.de) * `Mobilizon.Service.Geospatial.Photon` [🔗](https://photon.komoot.de)
* `Mobilizon.Service.Geospatial.Addok` [🔗](https://github.com/addok/addok) * `Mobilizon.Service.Geospatial.Addok` [🔗](https://github.com/addok/addok)
* `Mobilizon.Service.Geospatial.MapQuest` [🔗](https://developer.mapquest.com/documentation/open/) * `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.GoogleMaps` [🔗](https://developers.google.com/maps/documentation/geocoding/intro)
* `Mobilizon.Service.Geospatial.Mimirsbrunn` [🔗](https://github.com/CanalTP/mimirsbrunn) * `Mobilizon.Service.Geospatial.Mimirsbrunn` [🔗](https://github.com/CanalTP/mimirsbrunn)
* `Mobilizon.Service.Geospatial.Pelias` [🔗](https://pelias.io) * `Mobilizon.Service.Geospatial.Pelias` [🔗](https://pelias.io)
## Shared options ## Shared options
* `:user_agent` User-Agent string to send to the backend. Defaults to `"Mobilizon"` or `Mobilizon.Config.instance_user_agent/0` * `: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 * `:lang` Lang in which to prefer results. Used as a request parameter or
through an `Accept-Language` HTTP header. Defaults to `"en"`. through an `Accept-Language` HTTP header. Defaults to `"en"`.
* `:country_code` An ISO 3166 country code. String or `nil` * `:country_code` An ISO 3166 country code. String or `nil`
* `:limit` Maximum limit for the number of results returned by the backend. * `:limit` Maximum limit for the number of results returned by the backend.
Defaults to `10` Defaults to `10`
* `:api_key` Allows to override the API key (if the backend requires one) set * `:api_key` Allows to override the API key (if the backend requires one) set
inside the configuration. inside the configuration.
* `:endpoint` Allows to override the endpoint set inside the configuration. * `:endpoint` Allows to override the endpoint set inside the configuration.
""" """
alias Mobilizon.Addresses.Address alias Mobilizon.Addresses.Address

View File

@ -30,38 +30,38 @@ defmodule Mobilizon.Web.ReverseProxy do
Some request / responses headers are preserved: Some request / responses headers are preserved:
* request: `#{inspect(@keep_req_headers)}` * request: `#{inspect(@keep_req_headers)}`
* response: `#{inspect(@keep_resp_headers)}` * response: `#{inspect(@keep_resp_headers)}`
If no caching headers (`#{inspect(@resp_cache_headers)}`) are returned by If no caching headers (`#{inspect(@resp_cache_headers)}`) are returned by
upstream, `cache-control` will be set to `#{inspect(@default_cache_control_header)}`. upstream, `cache-control` will be set to `#{inspect(@default_cache_control_header)}`.
Options: Options:
* `redirect_on_failure` (default `false`). Redirects the client to the real * `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 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, not be redirected as the response is chunked. This may expose remote URL,
clients IPs, . clients IPs, .
* `max_body_length` (default `#{inspect(@max_body_length)}`): limits the * `max_body_length` (default `#{inspect(@max_body_length)}`): limits the
content length to be approximately the specified length. It is validated with content length to be approximately the specified length. It is validated with
the `content-length` header and also verified when proxying. the `content-length` header and also verified when proxying.
* `max_read_duration` (default `#{inspect(@max_read_duration)}` ms): the total * `max_read_duration` (default `#{inspect(@max_read_duration)}` ms): the total
time the connection is allowed to read from the remote upstream. time the connection is allowed to read from the remote upstream.
* `inline_content_types`: * `inline_content_types`:
* `true` will not alter `content-disposition` (up to the upstream), * `true` will not alter `content-disposition` (up to the upstream),
* `false` will add `content-disposition: attachment` to any request, * `false` will add `content-disposition: attachment` to any request,
* a list of whitelisted content types * a list of whitelisted content types
* `keep_user_agent` will forward the client's user-agent to the upstream. * `keep_user_agent` will forward the client's user-agent to the upstream.
This may be useful if the upstream is doing content transformation This may be useful if the upstream is doing content transformation
(encoding, ) depending on the request. (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).
""" """

View File

@ -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: This behaviour allows to run filtering actions just before a file is uploaded. This allows to:
* morph in place the temporary file * morph in place the temporary file
* change any field of a `Mobilizon.Upload` struct * change any field of a `Mobilizon.Upload` struct
* cancel/stop the upload * cancel/stop the upload
""" """
require Logger require Logger

View File

@ -8,27 +8,27 @@ defmodule Mobilizon.Web.Upload do
Manage user uploads Manage user uploads
Options: Options:
* `:type`: presets for activity type (defaults to Document) and size limits from app configuration * `:type`: presets for activity type (defaults to Document) and size limits from app configuration
* `:description`: upload alternative text * `:description`: upload alternative text
* `:base_url`: override base url * `:base_url`: override base url
* `:uploader`: override uploader * `:uploader`: override uploader
* `:filters`: override filters * `:filters`: override filters
* `:size_limit`: override size limit * `:size_limit`: override size limit
* `:activity_type`: override activity type * `:activity_type`: override activity type
The `%Mobilizon.Web.Upload{}` struct: all documented fields are meant to be overwritten in filters: The `%Mobilizon.Web.Upload{}` struct: all documented fields are meant to be overwritten in filters:
* `:id` - the upload id. * `:id` - the upload id.
* `:name` - the upload file name. * `: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 * `: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! 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 * `: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. path as the temporary file is also tracked by `Plug.Upload{}` and automatically deleted once the request is over.
Related behaviors: Related behaviors:
* `Mobilizon.Web.Upload.Uploader` * `Mobilizon.Web.Upload.Uploader`
* `Mobilizon.Web.Upload.Filter` * `Mobilizon.Web.Upload.Filter`
""" """

View File

@ -21,14 +21,14 @@ defmodule Mobilizon.Web.Upload.Uploader do
Returns: Returns:
* `:ok` which assumes `{:ok, upload.path}` * `:ok` which assumes `{:ok, upload.path}`
* `{:ok, spec}` where spec is: * `{:ok, spec}` where spec is:
* `{:file, filename :: String.t}` to handle reads with `get_file/1` (recommended) * `{: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. 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. * `{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. * `{: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. * `: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()} @type file_spec :: {:file | :url, String.t()}