Merge branch 'disable-mix-docs' into 'master'
Disable mix docs for now See merge request framasoft/mobilizon!435
This commit is contained in:
commit
0f73aad9e9
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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).
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
@ -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()}
|
||||
|
|
Loading…
Reference in New Issue