ActivityPub.Utils (Bonfire v1.0.0-social-rc.2.3)

View Source

Misc functions used for federation

Summary

Functions

Checks if any of the given labels exist in any of the given collections. Supports both single values and lists for labels and collections.

Format according to RFC 1123, which is the standard for HTTP dates. Example: Mon, 15 Apr 2025 14:30:15 GMT

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

conditionally update a map

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

Determines if an object or an activity is public.

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

Functions

activitypub_object_headers()

adapter_fallback()

any_in_collections?(labels, collection)

@spec any_in_collections?(any(), any()) :: boolean()

Checks if any of the given labels exist in any of the given collections. Supports both single values and lists for labels and collections.

ap_base_url()

ap_id(map)

cache_clear()

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

error_json(conn, error, status \\ 500)

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

Format according to RFC 1123, which is the standard for HTTP dates. Example: Mon, 15 Apr 2025 14:30:15 GMT

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 \\ [])

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)