Merge branch 'develop' into features/mix-task-reset-mfa
This commit is contained in:
commit
34593d6aa5
@ -44,3 +44,11 @@ Currently, only .zip archives are recognized as remote pack files and packs are
|
|||||||
The manifest entry will either be written to a newly created `pack_name.json` file (pack name is asked in questions) or appended to the existing one, *replacing* the old pack with the same name if it was in the file previously.
|
The manifest entry will either be written to a newly created `pack_name.json` file (pack name is asked in questions) or appended to the existing one, *replacing* the old pack with the same name if it was in the file previously.
|
||||||
|
|
||||||
The file list will be written to the file specified previously, *replacing* that file. You _should_ check that the file list doesn't contain anything you don't need in the pack, that is, anything that is not an emoji (the whole pack is downloaded, but only emoji files are extracted).
|
The file list will be written to the file specified previously, *replacing* that file. You _should_ check that the file list doesn't contain anything you don't need in the pack, that is, anything that is not an emoji (the whole pack is downloaded, but only emoji files are extracted).
|
||||||
|
|
||||||
|
## Reload emoji packs
|
||||||
|
|
||||||
|
```sh tab="OTP"
|
||||||
|
./bin/pleroma_ctl emoji reload
|
||||||
|
```
|
||||||
|
|
||||||
|
This command only works with OTP releases.
|
||||||
|
@ -237,6 +237,12 @@ defmodule Mix.Tasks.Pleroma.Emoji do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def run(["reload"]) do
|
||||||
|
start_pleroma()
|
||||||
|
Pleroma.Emoji.reload()
|
||||||
|
IO.puts("Emoji packs have been reloaded.")
|
||||||
|
end
|
||||||
|
|
||||||
defp fetch_and_decode(from) do
|
defp fetch_and_decode(from) do
|
||||||
with {:ok, json} <- fetch(from) do
|
with {:ok, json} <- fetch(from) do
|
||||||
Jason.decode!(json)
|
Jason.decode!(json)
|
||||||
|
@ -113,6 +113,10 @@ defmodule Pleroma.Plugs.HTTPSecurityPlug do
|
|||||||
add_source(acc, host)
|
add_source(acc, host)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
media_proxy_base_url =
|
||||||
|
if Config.get([:media_proxy, :base_url]),
|
||||||
|
do: URI.parse(Config.get([:media_proxy, :base_url])).host
|
||||||
|
|
||||||
upload_base_url =
|
upload_base_url =
|
||||||
if Config.get([Pleroma.Upload, :base_url]),
|
if Config.get([Pleroma.Upload, :base_url]),
|
||||||
do: URI.parse(Config.get([Pleroma.Upload, :base_url])).host
|
do: URI.parse(Config.get([Pleroma.Upload, :base_url])).host
|
||||||
@ -122,6 +126,7 @@ defmodule Pleroma.Plugs.HTTPSecurityPlug do
|
|||||||
do: URI.parse(Config.get([Pleroma.Uploaders.S3, :public_endpoint])).host
|
do: URI.parse(Config.get([Pleroma.Uploaders.S3, :public_endpoint])).host
|
||||||
|
|
||||||
[]
|
[]
|
||||||
|
|> add_source(media_proxy_base_url)
|
||||||
|> add_source(upload_base_url)
|
|> add_source(upload_base_url)
|
||||||
|> add_source(s3_endpoint)
|
|> add_source(s3_endpoint)
|
||||||
|> add_source(media_proxy_whitelist)
|
|> add_source(media_proxy_whitelist)
|
||||||
|
@ -124,6 +124,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
|||||||
defp prepare_tags(query, add_joined_tag \\ true) do
|
defp prepare_tags(query, add_joined_tag \\ true) do
|
||||||
tags =
|
tags =
|
||||||
query
|
query
|
||||||
|
|> preprocess_uri_query()
|
||||||
|> String.split(~r/[^#\w]+/u, trim: true)
|
|> String.split(~r/[^#\w]+/u, trim: true)
|
||||||
|> Enum.uniq_by(&String.downcase/1)
|
|> Enum.uniq_by(&String.downcase/1)
|
||||||
|
|
||||||
@ -147,6 +148,20 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If `query` is a URI, returns last component of its path, otherwise returns `query`
|
||||||
|
defp preprocess_uri_query(query) do
|
||||||
|
if query =~ ~r/https?:\/\// do
|
||||||
|
query
|
||||||
|
|> String.trim_trailing("/")
|
||||||
|
|> URI.parse()
|
||||||
|
|> Map.get(:path)
|
||||||
|
|> String.split("/")
|
||||||
|
|> Enum.at(-1)
|
||||||
|
else
|
||||||
|
query
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp joined_tag(tags) do
|
defp joined_tag(tags) do
|
||||||
tags
|
tags
|
||||||
|> Enum.map(fn tag -> String.capitalize(tag) end)
|
|> Enum.map(fn tag -> String.capitalize(tag) end)
|
||||||
|
@ -111,6 +111,44 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|
|||||||
%{"name" => "prone", "url" => "#{Web.base_url()}/tag/prone"},
|
%{"name" => "prone", "url" => "#{Web.base_url()}/tag/prone"},
|
||||||
%{"name" => "AccidentProne", "url" => "#{Web.base_url()}/tag/AccidentProne"}
|
%{"name" => "AccidentProne", "url" => "#{Web.base_url()}/tag/AccidentProne"}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
results =
|
||||||
|
conn
|
||||||
|
|> get("/api/v2/search?#{URI.encode_query(%{q: "https://shpposter.club/users/shpuld"})}")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert results["hashtags"] == [
|
||||||
|
%{"name" => "shpuld", "url" => "#{Web.base_url()}/tag/shpuld"}
|
||||||
|
]
|
||||||
|
|
||||||
|
results =
|
||||||
|
conn
|
||||||
|
|> get(
|
||||||
|
"/api/v2/search?#{
|
||||||
|
URI.encode_query(%{
|
||||||
|
q:
|
||||||
|
"https://www.washingtonpost.com/sports/2020/06/10/" <>
|
||||||
|
"nascar-ban-display-confederate-flag-all-events-properties/"
|
||||||
|
})
|
||||||
|
}"
|
||||||
|
)
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert results["hashtags"] == [
|
||||||
|
%{"name" => "nascar", "url" => "#{Web.base_url()}/tag/nascar"},
|
||||||
|
%{"name" => "ban", "url" => "#{Web.base_url()}/tag/ban"},
|
||||||
|
%{"name" => "display", "url" => "#{Web.base_url()}/tag/display"},
|
||||||
|
%{"name" => "confederate", "url" => "#{Web.base_url()}/tag/confederate"},
|
||||||
|
%{"name" => "flag", "url" => "#{Web.base_url()}/tag/flag"},
|
||||||
|
%{"name" => "all", "url" => "#{Web.base_url()}/tag/all"},
|
||||||
|
%{"name" => "events", "url" => "#{Web.base_url()}/tag/events"},
|
||||||
|
%{"name" => "properties", "url" => "#{Web.base_url()}/tag/properties"},
|
||||||
|
%{
|
||||||
|
"name" => "NascarBanDisplayConfederateFlagAllEventsProperties",
|
||||||
|
"url" =>
|
||||||
|
"#{Web.base_url()}/tag/NascarBanDisplayConfederateFlagAllEventsProperties"
|
||||||
|
}
|
||||||
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "excludes a blocked users from search results", %{conn: conn} do
|
test "excludes a blocked users from search results", %{conn: conn} do
|
||||||
|
Loading…
Reference in New Issue
Block a user