Browse Source

Move shout configuration from :instance, update docs and changelog

cycles-validator
Mark Felder Mark Felder 3 years ago
parent
commit
d6432a65da
6 changed files with 11 additions and 10 deletions
  1. +1
    -1
      CHANGELOG.md
  2. +3
    -2
      config/config.exs
  3. +3
    -3
      docs/configuration/cheatsheet.md
  4. +1
    -1
      lib/pleroma/web/mastodon_api/views/instance_view.ex
  5. +1
    -1
      lib/pleroma/web/shout_channel.ex
  6. +2
    -2
      test/pleroma/web/shout_channel_test.ex

+ 1
- 1
CHANGELOG.md View File

@@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed

- **Breaking:** Configuration: `:chat, enabled` moved to `:shout, enabled` and `:instance, chat_limit` moved to `:instance, shout_limit`
- **Breaking:** Configuration: `:chat, enabled` moved to `:shout, enabled` and `:instance, chat_limit` moved to `:shout, limit`
- The `application` metadata returned with statuses is no longer hardcoded. Apps that want to display these details will now have valid data for new posts after this change.
- HTTPSecurityPlug now sends a response header to opt out of Google's FLoC (Federated Learning of Cohorts) targeted advertising.
- Email address is now returned if requesting user is the owner of the user account so it can be exposed in client and FE user settings UIs.


+ 3
- 2
config/config.exs View File

@@ -190,7 +190,6 @@ config :pleroma, :instance,
instance_thumbnail: "/instance/thumbnail.jpeg",
limit: 5_000,
description_limit: 5_000,
shout_limit: 5_000,
remote_limit: 100_000,
upload_limit: 16_000_000,
avatar_upload_limit: 2_000_000,
@@ -457,7 +456,9 @@ config :pleroma, :media_preview_proxy,
image_quality: 85,
min_content_length: 100 * 1024

config :pleroma, :shout, enabled: true
config :pleroma, :shout,
enabled: true,
limit: 5_000

config :phoenix, :format_encoders, json: Jason



+ 3
- 3
docs/configuration/cheatsheet.md View File

@@ -8,9 +8,10 @@ For from source installations Pleroma configuration works by first importing the

To add configuration to your config file, you can copy it from the base config. The latest version of it can be viewed [here](https://git.pleroma.social/pleroma/pleroma/blob/develop/config/config.exs). You can also use this file if you don't know how an option is supposed to be formatted.

## :chat
## :shout

* `enabled` - Enables the backend chat. Defaults to `true`.
* `enabled` - Enables the backend Shoutbox chat feature. Defaults to `true`.
* `limit` - Shout character limit. Defaults to `5_000`

## :instance
* `name`: The instance’s name.
@@ -19,7 +20,6 @@ To add configuration to your config file, you can copy it from the base config.
* `description`: The instance’s description, can be seen in nodeinfo and ``/api/v1/instance``.
* `limit`: Posts character limit (CW/Subject included in the counter).
* `description_limit`: The character limit for image descriptions.
* `chat_limit`: Character limit of the instance chat messages.
* `remote_limit`: Hard character limit beyond which remote posts will be dropped.
* `upload_limit`: File size limit of uploads (except for avatar, background, banner).
* `avatar_upload_limit`: File size limit of user’s profile avatars.


+ 1
- 1
lib/pleroma/web/mastodon_api/views/instance_view.ex View File

@@ -37,7 +37,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
background_upload_limit: Keyword.get(instance, :background_upload_limit),
banner_upload_limit: Keyword.get(instance, :banner_upload_limit),
background_image: Pleroma.Web.Endpoint.url() <> Keyword.get(instance, :background_image),
shout_limit: Keyword.get(instance, :shout_limit),
shout_limit: Config.get([:shout, :limit]),
description_limit: Keyword.get(instance, :description_limit),
pleroma: %{
metadata: %{


+ 1
- 1
lib/pleroma/web/shout_channel.ex View File

@@ -22,7 +22,7 @@ defmodule Pleroma.Web.ShoutChannel do
def handle_in("new_msg", %{"text" => text}, %{assigns: %{user_name: user_name}} = socket) do
text = String.trim(text)

if String.length(text) in 1..Pleroma.Config.get([:instance, :shout_limit]) do
if String.length(text) in 1..Pleroma.Config.get([:shout, :limit]) do
author = User.get_cached_by_nickname(user_name)
author_json = AccountView.render("show.json", user: author, skip_visibility_check: true)



+ 2
- 2
test/pleroma/web/shout_channel_test.ex View File

@@ -25,7 +25,7 @@ defmodule Pleroma.Web.ShoutChannelTest do
end

describe "message lengths" do
setup do: clear_config([:instance, :shout_limit])
setup do: clear_config([:shout, :limit])

test "it ignores messages of length zero", %{socket: socket} do
push(socket, "new_msg", %{"text" => ""})
@@ -33,7 +33,7 @@ defmodule Pleroma.Web.ShoutChannelTest do
end

test "it ignores messages above a certain length", %{socket: socket} do
Pleroma.Config.put([:instance, :shout_limit], 2)
Pleroma.Config.put([:shout, :limit], 2)
push(socket, "new_msg", %{"text" => "123"})
refute_broadcast("new_msg", %{text: "123"})
end


Loading…
Cancel
Save