View Source ActivityPub.Utils (Bonfire v0.9.11-social-beta.6)

Misc functions used for federation

Summary

Functions

activitypub_object_headers()

adapter_fallback()

ap_base_url()

ap_id(map)

as_local_public()

cache_clear()

cachex_fetch(cache, key, fallback, options \\ [])

error_json(conn, error, status \\ 500)

format_date(date \\ NaiveDateTime.utc_now(Calendar.ISO))

generate_id(type)

generate_object_id()

get_with_cache(get_fun, cache_bucket, key, identifier)

has_as_public?(tos)

is_uid?(input)

is_ulid?(str)

is_uuid?(str)

Takes a string and returns true if it is a valid UUID (Universally Unique Identifier)

json_with_cache(conn \\ nil, get_fun, cache_bucket, id, ret_fn \\ &return_json/4, opts \\ [])

label_in_collection?(label, collection)

@spec label_in_collection?(String.t(), map()) :: boolean()

make_date()

make_json_ld_header(type \\ :object)

maybe_put(map, key, value)

conditionally update a map

maybe_to_atom(str)

maybe_to_string(atom)

Handles multiple cases where the input value is of a different type (atom, list, tuple, etc.) and returns a string representation of it.

ok_unwrap(val, fallback \\ nil)

public?(params)

public?(activity_data, object_data)

Determines if an object or an activity is public.

put_if_present(map, key, value, value_function \\ &{:ok, &1})

repo()

request_ip(remote_ip)

return_json(conn, meta, json, opts \\ [])

safe_put_in(data, keys, value)

service_actor()

service_actor!()

set_repo(repo)

single_ap_id(ap_id)

single_ap_id_or_object(ap_id)

stringify_keys(map, recursive \\ false)

Takes a map or keyword list, and returns a map with any atom keys converted to string keys. It can optionally do so recursively.

uid(input)