浏览代码

Merge branch 'features/mastoapi/2.7.2-instance-attributes' into 'develop'

Mastodon 2.7.2 instance attributes (registrations, languages)

See merge request pleroma/pleroma!979
tags/v1.1.4
lambda 5 年前
父节点
当前提交
c6ab5ebe7c
共有 2 个文件被更改,包括 24 次插入0 次删除
  1. +3
    -0
      lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
  2. +21
    -0
      test/web/mastodon_api/mastodon_api_controller_test.exs

+ 3
- 0
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex 查看文件

@@ -161,6 +161,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
},
stats: Stats.get_stats(),
thumbnail: Web.base_url() <> "/instance/thumbnail.jpeg",
languages: ["en"],
registrations: Pleroma.Config.get([:instance, :registrations_open]),
# Extra (not present in Mastodon):
max_toot_chars: Keyword.get(instance, :limit)
}



+ 21
- 0
test/web/mastodon_api/mastodon_api_controller_test.exs 查看文件

@@ -1808,6 +1808,27 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end

test "get instance information", %{conn: conn} do
conn = get(conn, "/api/v1/instance")
assert result = json_response(conn, 200)

# Note: not checking for "max_toot_chars" since it's optional
assert %{
"uri" => _,
"title" => _,
"description" => _,
"version" => _,
"email" => _,
"urls" => %{
"streaming_api" => _
},
"stats" => _,
"thumbnail" => _,
"languages" => _,
"registrations" => _
} = result
end

test "get instance stats", %{conn: conn} do
user = insert(:user, %{local: true})

user2 = insert(:user, %{local: true})


正在加载...
取消
保存