Add a new service to import some data from Mastodon accounts: * Find users by username, store Mastodon account ID in local db when found * Import display name (don't overwrite existing) * Import avatar (don't overwrite existing)
23 lines
427 B
Ruby
23 lines
427 B
Ruby
#
|
|
# API Docs: https://docs.joinmastodon.org/methods/
|
|
#
|
|
class MastodonManagerService < RestApiService
|
|
private
|
|
|
|
def base_url
|
|
@base_url ||= "#{Setting.mastodon_public_url}/api"
|
|
end
|
|
|
|
def auth_token
|
|
@auth_token ||= Setting.mastodon_auth_token
|
|
end
|
|
|
|
def headers
|
|
{
|
|
"Content-Type" => "application/json",
|
|
"Accept" => "application/json",
|
|
"Authorization" => "Bearer #{auth_token}"
|
|
}
|
|
end
|
|
end
|