forked from AkkomaGang/akkoma
Merge branch 'develop' into issue/1023
This commit is contained in:
commit
8d6f7aec21
13 changed files with 69 additions and 16 deletions
|
@ -8,9 +8,7 @@
|
|||
|
||||
### Environment
|
||||
|
||||
* Installation type:
|
||||
- [ ] OTP
|
||||
- [ ] From source
|
||||
* Installation type (OTP or From Source):
|
||||
* Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE):
|
||||
* Elixir version (`elixir -v` for from source installations, N/A for OTP):
|
||||
* Operating system:
|
||||
|
|
|
@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
has been simplified down to `block_from_strangers`.
|
||||
- **Breaking:** Notification Settings API option for hiding push notification
|
||||
contents has been renamed to `hide_notification_contents`
|
||||
- Mastodon API: Added `pleroma.metadata.post_formats` to /api/v1/instance
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
@ -66,7 +67,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
<details>
|
||||
<summary>API Changes</summary>
|
||||
- Mastodon API: Add pleroma.parents_visible field to statuses.
|
||||
|
||||
- Mastodon API: Add pleroma.parent_visible field to statuses.
|
||||
- Mastodon API: Extended `/api/v1/instance`.
|
||||
- Mastodon API: Support for `include_types` in `/api/v1/notifications`.
|
||||
- Mastodon API: Added `/api/v1/notifications/:id/dismiss` endpoint.
|
||||
|
@ -120,6 +122,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Follow request notifications
|
||||
<details>
|
||||
<summary>API Changes</summary>
|
||||
|
||||
- Admin API: `GET /api/pleroma/admin/need_reboot`.
|
||||
</details>
|
||||
|
||||
|
@ -187,6 +190,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- **Breaking**: Using third party engines for user recommendation
|
||||
<details>
|
||||
<summary>API Changes</summary>
|
||||
|
||||
- **Breaking**: AdminAPI: migrate_from_db endpoint
|
||||
</details>
|
||||
|
||||
|
|
|
@ -236,6 +236,7 @@ Has theses additional parameters (which are the same as in Pleroma-API):
|
|||
- `pleroma.metadata.features`: A list of supported features
|
||||
- `pleroma.metadata.federation`: The federation restrictions of this instance
|
||||
- `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields.
|
||||
- `pleroma.metadata.post_formats`: A list of the allowed post format types
|
||||
- `vapid_public_key`: The public key needed for push messages
|
||||
|
||||
## Markers
|
||||
|
|
|
@ -96,16 +96,18 @@ def response("") do
|
|||
|
||||
def response("/main/public") do
|
||||
posts =
|
||||
ActivityPub.fetch_public_activities(%{"type" => ["Create"], "local_only" => true})
|
||||
|> render_activities
|
||||
%{type: ["Create"], local_only: true}
|
||||
|> ActivityPub.fetch_public_activities()
|
||||
|> render_activities()
|
||||
|
||||
info("Welcome to the Public Timeline!") <> posts <> ".\r\n"
|
||||
end
|
||||
|
||||
def response("/main/all") do
|
||||
posts =
|
||||
ActivityPub.fetch_public_activities(%{"type" => ["Create"]})
|
||||
|> render_activities
|
||||
%{type: ["Create"]}
|
||||
|> ActivityPub.fetch_public_activities()
|
||||
|> render_activities()
|
||||
|
||||
info("Welcome to the Federated Timeline!") <> posts <> ".\r\n"
|
||||
end
|
||||
|
@ -130,13 +132,14 @@ def response("/notices/" <> id) do
|
|||
def response("/users/" <> nickname) do
|
||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
||||
params = %{
|
||||
"type" => ["Create"],
|
||||
"actor_id" => user.ap_id
|
||||
type: ["Create"],
|
||||
actor_id: user.ap_id
|
||||
}
|
||||
|
||||
activities =
|
||||
ActivityPub.fetch_public_activities(params)
|
||||
|> render_activities
|
||||
params
|
||||
|> ActivityPub.fetch_public_activities()
|
||||
|> render_activities()
|
||||
|
||||
info("Posts by #{user.nickname}") <> activities <> ".\r\n"
|
||||
else
|
||||
|
|
|
@ -69,7 +69,8 @@ def request(method, url, body, headers, options) when is_binary(url) do
|
|||
request = build_request(method, headers, options, url, body, params)
|
||||
|
||||
adapter = Application.get_env(:tesla, :adapter)
|
||||
client = Tesla.client([Pleroma.HTTP.Middleware.FollowRedirects], adapter)
|
||||
|
||||
client = Tesla.client(adapter_middlewares(adapter), adapter)
|
||||
|
||||
maybe_limit(
|
||||
fn ->
|
||||
|
@ -107,4 +108,10 @@ defp maybe_limit(fun, Tesla.Adapter.Gun, opts) do
|
|||
defp maybe_limit(fun, _, _) do
|
||||
fun.()
|
||||
end
|
||||
|
||||
defp adapter_middlewares(Tesla.Adapter.Gun) do
|
||||
[Pleroma.HTTP.Middleware.FollowRedirects]
|
||||
end
|
||||
|
||||
defp adapter_middlewares(_), do: []
|
||||
end
|
||||
|
|
|
@ -159,6 +159,7 @@ def followers_operation do
|
|||
"Accounts which follow the given account, if network is not hidden by the account owner.",
|
||||
parameters: [
|
||||
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
|
||||
Operation.parameter(:id, :query, :string, "ID of the resource owner"),
|
||||
with_relationships_param() | pagination_params()
|
||||
],
|
||||
responses: %{
|
||||
|
@ -177,6 +178,7 @@ def following_operation do
|
|||
"Accounts which the given account is following, if network is not hidden by the account owner.",
|
||||
parameters: [
|
||||
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
|
||||
Operation.parameter(:id, :query, :string, "ID of the resource owner"),
|
||||
with_relationships_param() | pagination_params()
|
||||
],
|
||||
responses: %{200 => Operation.response("Accounts", "application/json", array_of_accounts())}
|
||||
|
|
|
@ -41,7 +41,8 @@ def render("show.json", _) do
|
|||
account_activation_required: Keyword.get(instance, :account_activation_required),
|
||||
features: features(),
|
||||
federation: federation(),
|
||||
fields_limits: fields_limits()
|
||||
fields_limits: fields_limits(),
|
||||
post_formats: Config.get([:instance, :allowed_post_formats])
|
||||
},
|
||||
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
|
||||
<div class="input">
|
||||
<%= label f, :code, "Recovery code" %>
|
||||
<%= text_input f, :code %>
|
||||
<%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, spellcheck: false] %>
|
||||
<%= hidden_input f, :mfa_token, value: @mfa_token %>
|
||||
<%= hidden_input f, :state, value: @state %>
|
||||
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
|
||||
<div class="input">
|
||||
<%= label f, :code, "Authentication code" %>
|
||||
<%= text_input f, :code %>
|
||||
<%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, pattern: "[0-9]*", spellcheck: false] %>
|
||||
<%= hidden_input f, :mfa_token, value: @mfa_token %>
|
||||
<%= hidden_input f, :state, value: @state %>
|
||||
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
|
||||
|
|
|
@ -54,6 +54,20 @@ test "paginates by min_id & limit", %{notes: notes} do
|
|||
|
||||
assert length(paginated) == 1
|
||||
end
|
||||
|
||||
test "handles id gracefully", %{notes: notes} do
|
||||
id = Enum.at(notes, 1).id |> Integer.to_string()
|
||||
|
||||
paginated =
|
||||
Pagination.fetch_paginated(Object, %{
|
||||
id: "9s99Hq44Cnv8PKBwWG",
|
||||
max_id: id,
|
||||
limit: 20,
|
||||
offset: 0
|
||||
})
|
||||
|
||||
assert length(paginated) == 1
|
||||
end
|
||||
end
|
||||
|
||||
describe "offset" do
|
||||
|
|
|
@ -9,6 +9,8 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do
|
|||
alias Pleroma.Upload
|
||||
|
||||
setup do
|
||||
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
|
||||
|
||||
upload_file = %Upload{
|
||||
name: "an… image.jpg",
|
||||
content_type: "image/jpg",
|
||||
|
|
|
@ -14,6 +14,7 @@ test "it returns path to local folder for files" do
|
|||
|
||||
describe "put_file/1" do
|
||||
test "put file to local folder" do
|
||||
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
|
||||
file_path = "local_upload/files/image.jpg"
|
||||
|
||||
file = %Pleroma.Upload{
|
||||
|
@ -32,6 +33,7 @@ test "put file to local folder" do
|
|||
|
||||
describe "delete_file/1" do
|
||||
test "deletes local file" do
|
||||
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
|
||||
file_path = "local_upload/files/image.jpg"
|
||||
|
||||
file = %Pleroma.Upload{
|
||||
|
|
|
@ -583,6 +583,15 @@ test "getting followers, pagination", %{user: user, conn: conn} do
|
|||
|> get("/api/v1/accounts/#{user.id}/followers?max_id=#{follower3_id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [%{"id" => ^follower2_id}, %{"id" => ^follower1_id}] =
|
||||
conn
|
||||
|> get(
|
||||
"/api/v1/accounts/#{user.id}/followers?id=#{user.id}&limit=20&max_id=#{
|
||||
follower3_id
|
||||
}"
|
||||
)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
res_conn = get(conn, "/api/v1/accounts/#{user.id}/followers?limit=1&max_id=#{follower3_id}")
|
||||
|
||||
assert [%{"id" => ^follower2_id}] = json_response_and_validate_schema(res_conn, 200)
|
||||
|
@ -654,6 +663,16 @@ test "getting following, pagination", %{user: user, conn: conn} do
|
|||
assert id2 == following2.id
|
||||
assert id1 == following1.id
|
||||
|
||||
res_conn =
|
||||
get(
|
||||
conn,
|
||||
"/api/v1/accounts/#{user.id}/following?id=#{user.id}&limit=20&max_id=#{following3.id}"
|
||||
)
|
||||
|
||||
assert [%{"id" => id2}, %{"id" => id1}] = json_response_and_validate_schema(res_conn, 200)
|
||||
assert id2 == following2.id
|
||||
assert id1 == following1.id
|
||||
|
||||
res_conn =
|
||||
get(conn, "/api/v1/accounts/#{user.id}/following?limit=1&max_id=#{following3.id}")
|
||||
|
||||
|
|
Loading…
Reference in a new issue