# App artifacts
+secret
/_build
/db
/deps
# Database setup file, some may forget to delete it
- /config/setup_db.psql
+ /config/setup_db*.psql
.DS_Store
.env
filters: [Pleroma.Upload.Filter.Dedupe],
link_name: false,
proxy_remote: false,
- proxy_opts: [
- redirect_on_failure: false,
- max_body_length: 25 * 1_048_576,
- http: [
- follow_redirect: true,
- pool: :upload
- ]
- ],
filename_display_max_length: 30,
- default_description: nil
+ default_description: nil,
+ base_url: nil
config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
config :pleroma, Pleroma.Uploaders.S3,
bucket: nil,
- streaming_enabled: true,
- public_endpoint: "https://s3.amazonaws.com"
+ bucket_namespace: nil,
+ truncated_namespace: nil,
+ streaming_enabled: true
+
+ config :ex_aws, :s3,
+ # host: "s3.wasabisys.com", # required if not Amazon AWS
+ access_key_id: nil,
+ secret_access_key: nil,
+ # region: "us-east-1", # may be required for Amazon AWS
+ scheme: "https://"
config :pleroma, :emoji,
shortcode_globs: ["/emoji/custom/**/*.png"],
"text/markdown",
"text/bbcode"
],
+ mrf_transparency: true,
+ mrf_transparency_exclusions: [],
+ staff_transparency: [],
autofollowed_nicknames: [],
autofollowing_nicknames: [],
max_pinned_statuses: 1,
scheduled_activities: 10,
background: 5,
remote_fetcher: 2,
- attachments_cleanup: 5,
+ attachments_cleanup: 1,
new_users_digest: 1,
mute_expire: 5
],
limit_days: 7,
dir: nil
+ config :pleroma, ConcurrentLimiter, [
+ {Pleroma.Web.RichMedia.Helpers, [max_running: 5, max_waiting: 5]},
+ {Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy, [max_running: 5, max_waiting: 5]}
+ ]
+
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"
# Pleroma: A lightweight social networking server
- # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+ # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.User do
bio: bio
}
- changeset = User.register_changeset(%User{}, params, need_confirmation: false)
+ changeset = User.register_changeset(%User{}, params, is_confirmed: true)
{:ok, _user} = User.register(changeset)
shell_info("User #{nickname} created")
user =
case Keyword.get(options, :confirmed) do
nil -> user
- value -> set_confirmed(user, value)
+ value -> set_confirmation(user, value)
end
user =
end
end
+ def run(["change_email", nickname, email]) do
+ start_pleroma()
+
+ with %User{} = user <- User.get_cached_by_nickname(nickname) do
+ user
+ |> User.update_changeset(%{"email" => email})
+ |> User.update_and_set_cache()
+
+ shell_info("#{nickname}'s email updated")
+ end
+ end
+
+ def run(["show", nickname]) do
+ start_pleroma()
+
+ nickname
+ |> User.get_cached_by_nickname()
+ |> IO.inspect()
+ end
+
+ def run(["send_confirmation", nickname]) do
+ start_pleroma()
+
+ with %User{} = user <- User.get_cached_by_nickname(nickname) do
+ user
+ |> Pleroma.Emails.UserEmail.account_confirmation_email()
+ |> IO.inspect()
+ |> Pleroma.Emails.Mailer.deliver!()
+
+ shell_info("#{nickname}'s email sent")
+ end
+ end
+
def run(["confirm", nickname]) do
start_pleroma()
with %User{} = user <- User.get_cached_by_nickname(nickname) do
{:ok, user} = User.confirm(user)
- message = if user.confirmation_pending, do: "needs", else: "doesn't need"
+ message = if !user.is_confirmed, do: "needs", else: "doesn't need"
shell_info("#{nickname} #{message} confirmation.")
else
|> Pleroma.Repo.chunk_stream(500, :batches)
|> Stream.each(fn users ->
users
- |> Enum.each(fn user -> User.need_confirmation(user, false) end)
+ |> Enum.each(fn user -> User.set_confirmation(user, true) end)
end)
|> Stream.run()
end
|> Pleroma.Repo.chunk_stream(500, :batches)
|> Stream.each(fn users ->
users
- |> Enum.each(fn user -> User.need_confirmation(user, true) end)
+ |> Enum.each(fn user -> User.set_confirmation(user, false) end)
end)
|> Stream.run()
end
user
end
- defp set_confirmed(user, value) do
- {:ok, user} = User.need_confirmation(user, !value)
+ defp set_confirmation(user, value) do
+ {:ok, user} = User.set_confirmation(user, value)
- shell_info("Confirmation pending status of #{user.nickname}: #{user.confirmation_pending}")
+ shell_info("Confirmation status of #{user.nickname}: #{user.is_confirmed}")
user
end
end
# Pleroma: A lightweight social networking server
- # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+ # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Endpoint do
}
)
+ plug(Plug.Static.IndexHtml, at: "/pleroma/fedife/")
+
+ plug(Pleroma.Web.Plugs.FrontendStatic,
+ at: "/pleroma/fedife",
+ frontend_type: :fedife,
+ gzip: true,
+ cache_control_for_etags: @static_cache_control,
+ headers: %{
+ "cache-control" => @static_cache_control
+ }
+ )
+
+
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# Pleroma: A lightweight social networking server
- # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+ # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
use Pleroma.Web, :controller
+ alias Pleroma.Config
+ alias Pleroma.Stats
+ alias Pleroma.User
alias Pleroma.Web
- alias Pleroma.Web.Nodeinfo.Nodeinfo
+ alias Pleroma.Web.Federator.Publisher
+ alias Pleroma.Web.MastodonAPI.InstanceView
def schemas(conn, _params) do
response = %{
json(conn, response)
end
+ # returns a nodeinfo 2.0 map, since 2.1 just adds a repository field
+ # under software.
+ def raw_nodeinfo do
+ stats = Stats.get_stats()
+
+ staff_accounts =
+ User.all_superusers()
+ |> Enum.map(fn u -> u.ap_id end)
+ |> Enum.filter(fn u -> not Enum.member?(Config.get([:instance, :staff_transparency]), u) end)
+
+ features = InstanceView.features()
+ federation = InstanceView.federation()
+
+ %{
+ version: "2.0",
+ software: %{
+ name: Pleroma.Application.name() |> String.downcase(),
+ version: Pleroma.Application.version()
+ },
+ protocols: Publisher.gather_nodeinfo_protocol_names(),
+ services: %{
+ inbound: [],
+ outbound: []
+ },
+ openRegistrations: Config.get([:instance, :registrations_open]),
+ usage: %{
+ users: %{
+ total: Map.get(stats, :user_count, 0)
+ },
+ localPosts: Map.get(stats, :status_count, 0)
+ },
+ metadata: %{
+ nodeName: Config.get([:instance, :name]),
+ nodeDescription: Config.get([:instance, :description]),
+ private: !Config.get([:instance, :public], true),
+ suggestions: %{
+ enabled: false
+ },
+ staffAccounts: staff_accounts,
+ federation: federation,
+ pollLimits: Config.get([:instance, :poll_limits]),
+ postFormats: Config.get([:instance, :allowed_post_formats]),
+ uploadLimits: %{
+ general: Config.get([:instance, :upload_limit]),
+ avatar: Config.get([:instance, :avatar_upload_limit]),
+ banner: Config.get([:instance, :banner_upload_limit]),
+ background: Config.get([:instance, :background_upload_limit])
+ },
+ fieldsLimits: %{
+ maxFields: Config.get([:instance, :max_account_fields]),
+ maxRemoteFields: Config.get([:instance, :max_remote_account_fields]),
+ nameLength: Config.get([:instance, :account_field_name_length]),
+ valueLength: Config.get([:instance, :account_field_value_length])
+ },
+ accountActivationRequired: Config.get([:instance, :account_activation_required], false),
+ invitesEnabled: Config.get([:instance, :invites_enabled], false),
+ mailerEnabled: Config.get([Pleroma.Emails.Mailer, :enabled], false),
+ features: features,
+ restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames]),
+ skipThreadContainment: Config.get([:instance, :skip_thread_containment], false)
+ }
+ }
+ end
+
# Schema definition: https://github.com/jhass/nodeinfo/blob/master/schemas/2.0/schema.json
# and https://github.com/jhass/nodeinfo/blob/master/schemas/2.1/schema.json
- def nodeinfo(conn, %{"version" => version}) do
- case Nodeinfo.get_nodeinfo(version) do
- {:error, :missing} ->
- render_error(conn, :not_found, "Nodeinfo schema version not handled")
-
- node_info ->
- conn
- |> put_resp_header(
- "content-type",
- "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8"
- )
- |> json(node_info)
- end
+ def nodeinfo(conn, %{"version" => "2.0"}) do
+ conn
+ |> put_resp_header(
+ "content-type",
+ "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8"
+ )
+ |> json(raw_nodeinfo())
+ end
+
+ def nodeinfo(conn, %{"version" => "2.1"}) do
+ raw_response = raw_nodeinfo()
+
+ updated_software =
+ raw_response
+ |> Map.get(:software)
+ |> Map.put(:repository, Pleroma.Application.repository())
+
+ response =
+ raw_response
+ |> Map.put(:software, updated_software)
+ |> Map.put(:version, "2.1")
+
+ conn
+ |> put_resp_header(
+ "content-type",
+ "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.1#; charset=utf-8"
+ )
+ |> json(response)
+ end
+
+ def nodeinfo(conn, _) do
+ render_error(conn, :not_found, "Nodeinfo schema version not handled")
end
end