Compare commits

...

20 commits

Author SHA1 Message Date
1e1b31ec2d Add changelog for BigBuffet-specific changes
Signed-off-by: mkljczk <git@mkljczk.pl>
2024-12-06 20:21:19 +01:00
f3b722bf53 Merge branch 'fork' into backend-new 2024-12-06 20:05:26 +01:00
ffa874eba7 Merge remote-tracking branch 'origin/develop' into fork 2024-11-25 19:16:02 +01:00
1f06b2ae6c fix deepl
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-11-25 19:15:44 +01:00
lain
d92d6132f2 Merge branch 'meilisearch/misc-fixes' into 'develop'
Miscellaneous fixes for Meilisearch

See merge request pleroma/pleroma!4296
2024-11-21 14:29:26 +00:00
Mint
462a6a2000 Revert "Docs: fix OTP mix task command for Meilisearch"
This reverts commit 3a82a51a6e.
2024-11-21 16:52:30 +03:00
lain
2482d56153 Merge branch 'fix-module-search-in-pleroma-ctl' into 'develop'
B ReleaseTasks: Fix task module finding.

See merge request pleroma/pleroma!4297
2024-11-21 13:15:33 +00:00
Lain Soykaf
14dbf789b3 Linting 2024-11-21 16:32:05 +04:00
Lain Soykaf
551534f3ee B ReleaseTasks: Fix task module finding. 2024-11-21 16:07:09 +04:00
Mint
da7132caba Remove unused import 2024-11-21 02:40:27 +03:00
Mint
af7de4c17a Changelog 2024-11-21 02:17:53 +03:00
Mint
3a82a51a6e Docs: fix OTP mix task command for Meilisearch 2024-11-21 02:16:36 +03:00
Mint
d65f768b59 Meilisearch: stop attempting to index posts with nil date 2024-11-21 02:14:55 +03:00
Mint
c9f9ec04c8 Meilisearch: use PUT method for indexing Mix task
See https://github.com/meilisearch/meilisearch/issues/2619
2024-11-21 02:13:10 +03:00
375e71631d Merge remote-tracking branch 'origin/develop' into fork 2024-11-19 18:39:47 +01:00
lain
dcb0c47773 Merge branch 'mastodon-websocket-fix' into 'develop'
Fix Mastodon WebSocket authentication

See merge request pleroma/pleroma!4206
2024-11-13 08:22:44 +00:00
lain
83b866b257 Merge branch 'bump-lexbor' into 'develop'
bump fast_html to 2.3.0

See merge request pleroma/pleroma!4294
2024-11-13 07:18:18 +00:00
Haelwenn (lanodan) Monnier
0c3b71e1cc
mix.lock: bump fast_html to 2.3.0 2024-11-13 05:17:51 +01:00
Mark Felder
8c91fd8785 Fix Mastodon WebSocket authentication
Mastodon uses the Sec-Websocket-Protocol header to send the auth token. It is not clear if this is a violation of the RFC, but Mastodon is not the first application in the wild to use this header for authentication purposes. Phoenix does not allow accessing this header, so we work around it temporarily with a minor patch to Phoenix 1.7.14. We will reach out to Phoenix to discuss how to make this use case possible.
2024-08-04 15:04:29 -04:00
Mark Felder
3e4768efca Revert "Remove invalid test"
This reverts commit d0f4b2b02f.
2024-08-04 13:59:13 -04:00
17 changed files with 90 additions and 19 deletions

15
CHANGELOG_BIGBUFFET.md Normal file
View file

@ -0,0 +1,15 @@
# Changelog for BigBuffet-specific changes
* Every change from [`pl`](https://github.com/mkljczk/pl), another fork of Pleroma.
* Timelines can be sorted by declared publication date, rather than insertion date.
* Multilanguage posts are supported, based on [pleroma/pleroma!3822](https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3822).
* Alternative forms of hashtags (double-hashtags and triple-hashtags) are supported.
* Hashtags are inserted with a preferred name, which is the casing in which they appeared the first time.
* Post translations are stored in the database.
* New users are marked as discoverable by default.
* Information about hashtags most commonly used by given users is stored.
* Users can import .zip archives of posts, based on [pleroma/pleroma!3769](https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3769).
* Posts and timelines can be fetched with post translation in a given language (if already stored in the database).
* A endpoint for translating multiple posts was added.
* Discovery endpoint allows to order users by their post count.

View file

@ -1,3 +1,9 @@
This repo is a fork of Pleroma, including BigBuffet-specific changes. Changelog for BigBuffet-specific changes is available [here](./CHANGELOG_BIGBUFFET.md).
---
Original README:
<img src="https://git.pleroma.social/pleroma/pleroma/uploads/8cec84f5a084d887339f57deeb8a293e/pleroma-banner-vector-nopad-notext.svg" width="300px" />
## About

View file

@ -0,0 +1 @@
- Bumped `fast_html` to v2.3.0, which notably allows to use system-installed lexbor with passing `WITH_SYSTEM_LEXBOR=1` environment variable at build-time

View file

@ -0,0 +1 @@
Fix Mastodon WebSocket authentication

View file

@ -0,0 +1 @@
Miscellaneous fixes for Meilisearch support

View file

@ -0,0 +1 @@
Fix pleroma_ctl mix task calls sometimes not being found

View file

@ -9,7 +9,7 @@ defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
import Ecto.Query
import Pleroma.Search.Meilisearch,
only: [meili_post: 2, meili_put: 2, meili_get: 1, meili_delete: 1]
only: [meili_put: 2, meili_get: 1, meili_delete: 1]
def run(["index"]) do
start_pleroma()
@ -28,7 +28,7 @@ def run(["index"]) do
end
{:ok, _} =
meili_post(
meili_put(
"/indexes/objects/settings/ranking-rules",
[
"published:desc",
@ -42,7 +42,7 @@ def run(["index"]) do
)
{:ok, _} =
meili_post(
meili_put(
"/indexes/objects/settings/searchable-attributes",
[
"content"

View file

@ -30,7 +30,7 @@ def translate(content, source_language, target_language) do
text: content,
source_lang: source_language |> String.upcase(),
target_lang: target_language,
tag_handling: @name
tag_handling: "html"
}),
"",
[

View file

@ -16,17 +16,24 @@ def run(args) do
end
end
def find_module(task) do
module_name =
task
|> String.split(".")
|> Enum.map(&String.capitalize/1)
|> then(fn x -> [Mix, Tasks, Pleroma] ++ x end)
|> Module.concat()
case Code.ensure_loaded(module_name) do
{:module, _} -> module_name
_ -> nil
end
end
defp mix_task(task, args) do
Application.load(:pleroma)
{:ok, modules} = :application.get_key(:pleroma, :modules)
module =
Enum.find(modules, fn module ->
module = Module.split(module)
match?(["Mix", "Tasks", "Pleroma" | _], module) and
String.downcase(List.last(module)) == task
end)
module = find_module(task)
if module do
module.run(args)

View file

@ -122,6 +122,7 @@ def object_to_search_data(object) do
# Only index public or unlisted Notes
if not is_nil(object) and object.data["type"] == "Note" and
not is_nil(object.data["content"]) and
not is_nil(object.data["published"]) and
(Pleroma.Constants.as_public() in object.data["to"] or
Pleroma.Constants.as_public() in object.data["cc"]) and
object.data["content"] not in ["", "."] do

View file

@ -14,6 +14,7 @@ defmodule Pleroma.Web.Endpoint do
websocket: [
path: "/",
compress: false,
connect_info: [:sec_websocket_protocol],
error_handler: {Pleroma.Web.MastodonAPI.WebsocketHandler, :handle_error, []},
fullsweep_after: 20
]

View file

@ -84,9 +84,6 @@ def render("show2.json", _) do
},
# Extra (not present in Mastodon):
pleroma: pleroma_configuration2(instance)
# soapbox: %{
# version: Soapbox.version()
# }
})
end

View file

@ -22,7 +22,7 @@ def child_spec(_opts), do: :ignore
# This only prepares the connection and is not in the process yet
@impl Phoenix.Socket.Transport
def connect(%{params: params} = transport_info) do
with access_token <- Map.get(params, "access_token"),
with access_token <- find_access_token(transport_info),
{:ok, user, oauth_token} <- authenticate_request(access_token),
{:ok, topic} <-
Streamer.get_topic(params["stream"], user, oauth_token, params) do
@ -244,4 +244,13 @@ def handle_error(conn, :unauthorized) do
def handle_error(conn, _reason) do
Plug.Conn.send_resp(conn, 404, "Not Found")
end
defp find_access_token(%{
connect_info: %{sec_websocket_protocol: [token]}
}),
do: token
defp find_access_token(%{params: %{"access_token" => token}}), do: token
defp find_access_token(_), do: nil
end

View file

@ -134,7 +134,8 @@ defp logger_deps do
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.7.3"},
{:phoenix,
git: "https://github.com/feld/phoenix", branch: "v1.7.14-websocket-headers", override: true},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.10"},
{:phoenix_pubsub, "~> 2.0"},

View file

@ -52,7 +52,7 @@
"ex_syslogger": {:hex, :ex_syslogger, "1.5.2", "72b6aa2d47a236e999171f2e1ec18698740f40af0bd02c8c650bf5f1fd1bac79", [:mix], [{:poison, ">= 1.5.0", [hex: :poison, repo: "hexpm", optional: true]}, {:syslog, "~> 1.1.0", [hex: :syslog, repo: "hexpm", optional: false]}], "hexpm", "ab9fab4136dbc62651ec6f16fa4842f10cf02ab4433fa3d0976c01be99398399"},
"exile": {:hex, :exile, "0.10.0", "b69e2d27a9af670b0f0a0898addca0eda78f6f5ba95ccfbc9bc6ccdd04925436", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "c62ee8fee565b5ac4a898d0dcd58d2b04fb5eec1655af1ddcc9eb582c6732c33"},
"expo": {:hex, :expo, "0.5.1", "249e826a897cac48f591deba863b26c16682b43711dd15ee86b92f25eafd96d9", [:mix], [], "hexpm", "68a4233b0658a3d12ee00d27d37d856b1ba48607e7ce20fd376958d0ba6ce92b"},
"fast_html": {:hex, :fast_html, "2.2.0", "6c5ef1be087a4ed613b0379c13f815c4d11742b36b67bb52cee7859847c84520", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}], "hexpm", "064c4f23b4a6168f9187dac8984b056f2c531bb0787f559fd6a8b34b38aefbae"},
"fast_html": {:hex, :fast_html, "2.3.0", "08c1d8ead840dd3060ba02c761bed9f37f456a1ddfe30bcdcfee8f651cec06a6", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}], "hexpm", "f18e3c7668f82d3ae0b15f48d48feeb257e28aa5ab1b0dbf781c7312e5da029d"},
"fast_sanitize": {:hex, :fast_sanitize, "0.2.3", "67b93dfb34e302bef49fec3aaab74951e0f0602fd9fa99085987af05bd91c7a5", [:mix], [{:fast_html, "~> 2.0", [hex: :fast_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "e8ad286d10d0386e15d67d0ee125245ebcfbc7d7290b08712ba9013c8c5e56e2"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"},
@ -109,7 +109,7 @@
"parallel_stream": {:hex, :parallel_stream, "1.0.6", "b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c", [:mix], [], "hexpm", "639b2e8749e11b87b9eb42f2ad325d161c170b39b288ac8d04c4f31f8f0823eb"},
"parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"},
"pbkdf2_elixir": {:hex, :pbkdf2_elixir, "1.2.1", "9cbe354b58121075bd20eb83076900a3832324b7dd171a6895fab57b6bb2752c", [:mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}], "hexpm", "d3b40a4a4630f0b442f19eca891fcfeeee4c40871936fed2f68e1c4faa30481f"},
"phoenix": {:hex, :phoenix, "1.7.14", "a7d0b3f1bc95987044ddada111e77bd7f75646a08518942c72a8440278ae7825", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "c7859bc56cc5dfef19ecfc240775dae358cbaa530231118a9e014df392ace61a"},
"phoenix": {:git, "https://github.com/feld/phoenix", "fb6dc76c657422e49600896c64aab4253fceaef6", [branch: "v1.7.14-websocket-headers"]},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.3", "86e9878f833829c3f66da03d75254c155d91d72a201eb56ae83482328dc7ca93", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d36c401206f3011fefd63d04e8ef626ec8791975d9d107f9a0817d426f61ac07"},
"phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"},
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.3", "7ff51c9b6609470f681fbea20578dede0e548302b0c8bdf338b5a753a4f045bf", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "f9470a0a8bae4f56430a23d42f977b5a6205fdba6559d76f932b876bfaec652d"},

View file

@ -274,6 +274,17 @@ test "accepts the 'user:notification' stream", %{token: token} = _state do
end)
end
test "accepts valid token on Sec-WebSocket-Protocol header", %{token: token} do
assert {:ok, _} = start_socket("?stream=user", [{"Sec-WebSocket-Protocol", token.token}])
capture_log(fn ->
assert {:error, %WebSockex.RequestError{code: 401}} =
start_socket("?stream=user", [{"Sec-WebSocket-Protocol", "I am a friend"}])
Process.sleep(30)
end)
end
test "accepts valid token on client-sent event", %{token: token} do
assert {:ok, pid} = start_socket()

View file

@ -0,0 +1,19 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ReleaseTaskTest do
use Pleroma.DataCase, async: true
alias Pleroma.ReleaseTasks
test "finding the module" do
task = "search.meilisearch"
assert Mix.Tasks.Pleroma.Search.Meilisearch == ReleaseTasks.find_module(task)
task = "user"
assert Mix.Tasks.Pleroma.User == ReleaseTasks.find_module(task)
refute ReleaseTasks.find_module("doesnt.exist")
end
end