Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
authorsadposter <hannah+pleroma@coffee-and-dreams.uk>
Sat, 20 Feb 2021 15:27:56 +0000 (15:27 +0000)
committersadposter <hannah+pleroma@coffee-and-dreams.uk>
Sat, 20 Feb 2021 15:27:56 +0000 (15:27 +0000)
1  2 
config/config.exs
lib/mix/tasks/pleroma/user.ex
lib/pleroma/web/endpoint.ex

diff --combined config/config.exs
index 635dd4ae25ba3917ad8688812ee41c5bdf1517f7,66aee3264a0fa0a305a6748ceba77d1b846d1369..f96860c2e91e195bf34786e711810895006d9561
@@@ -222,9 -222,6 +222,9 @@@ config :pleroma, :instance
      "text/markdown",
      "text/bbcode"
    ],
 +  mrf_transparency: true,
 +  mrf_transparency_exclusions: [],
 +  staff_transparency: [],
    autofollowed_nicknames: [],
    autofollowing_nicknames: [],
    max_pinned_statuses: 1,
@@@ -441,7 -438,9 +441,9 @@@ config :pleroma, Pleroma.Web.MediaProxy
    headers: [],
    options: []
  
- config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, script_path: nil
+ config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script,
+   script_path: nil,
+   url_format: nil
  
  # Note: media preview proxy depends on media proxy to be enabled
  config :pleroma, :media_preview_proxy,
@@@ -544,6 -543,7 +546,7 @@@ config :pleroma, Oban
    queues: [
      activity_expiration: 10,
      token_expiration: 5,
+     filter_expiration: 1,
      backup: 1,
      federator_incoming: 50,
      federator_outgoing: 50,
@@@ -611,10 -611,7 +614,7 @@@ config :ueberauth
         base_path: "/oauth",
         providers: ueberauth_providers
  
- config :pleroma,
-        :auth,
-        enforce_oauth_admin_scope_usage: true,
-        oauth_consumer_strategies: oauth_consumer_strategies
+ config :pleroma, :auth, oauth_consumer_strategies: oauth_consumer_strategies
  
  config :pleroma, Pleroma.Emails.Mailer, adapter: Swoosh.Adapters.Sendmail, enabled: false
  
@@@ -726,7 -723,10 +726,10 @@@ config :pleroma, :frontends
        "git" => "https://git.pleroma.social/pleroma/fedi-fe",
        "build_url" =>
          "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
-       "ref" => "master"
+       "ref" => "master",
+       "custom-http-headers" => [
+         {"service-worker-allowed", "/"}
+       ]
      },
      "admin-fe" => %{
        "name" => "admin-fe",
index d4cca09614929581aab93aa35990fc2988ded88e,53d5fc6d927799253ee85a98d66e14cbd7a4d610..3827fe601cb4b50953b947f864b0c7c21d308943
@@@ -107,21 -107,6 +107,6 @@@ defmodule Mix.Tasks.Pleroma.User d
      end
    end
  
-   def run(["toggle_activated", nickname]) do
-     start_pleroma()
-     with %User{} = user <- User.get_cached_by_nickname(nickname) do
-       {:ok, user} = User.deactivate(user, !user.deactivated)
-       shell_info(
-         "Activation status of #{nickname}: #{if(user.deactivated, do: "de", else: "")}activated"
-       )
-     else
-       _ ->
-         shell_error("No user #{nickname}")
-     end
-   end
    def run(["reset_password", nickname]) do
      start_pleroma()
  
      end
    end
  
+   def run(["activate", nickname]) do
+     start_pleroma()
+     with %User{} = user <- User.get_cached_by_nickname(nickname),
+          false <- user.is_active do
+       User.set_activation(user, true)
+       :timer.sleep(500)
+       shell_info("Successfully activated #{nickname}")
+     else
+       true ->
+         shell_info("User #{nickname} already activated")
+       _ ->
+         shell_error("No user #{nickname}")
+     end
+   end
    def run(["deactivate", nickname]) do
      start_pleroma()
  
-     with %User{} = user <- User.get_cached_by_nickname(nickname) do
-       shell_info("Deactivating #{user.nickname}")
-       User.deactivate(user)
+     with %User{} = user <- User.get_cached_by_nickname(nickname),
+          true <- user.is_active do
+       User.set_activation(user, false)
        :timer.sleep(500)
  
        user = User.get_cached_by_id(user.id)
  
        if Enum.empty?(Enum.filter(User.get_friends(user), & &1.local)) do
-         shell_info("Successfully unsubscribed all local followers from #{user.nickname}")
+         shell_info("Successfully deactivated #{nickname} and unsubscribed all local followers")
        end
      else
+       false ->
+         shell_info("User #{nickname} already deactivated")
        _ ->
          shell_error("No user #{nickname}")
      end
      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()
  
  
      Pleroma.User.Query.build(%{
        local: true,
-       deactivated: false,
+       is_active: true,
        is_moderator: false,
        is_admin: false,
        invisible: false
  
      Pleroma.User.Query.build(%{
        local: true,
-       deactivated: false,
+       is_active: true,
        is_moderator: false,
        is_admin: false,
        invisible: false
          shell_info(
            "#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{
              user.is_locked
-           }, deactivated: #{user.deactivated}"
+           }, is_active: #{user.is_active}"
          )
        end)
      end)
index 0c7f50bd297001a226a5461892b11e241207de2b,8e274de889522ffd1771b6e84fe4595bd69f7783..196d0006b12da73d268e956c5b574df297e418e5
@@@ -23,6 -23,18 +23,18 @@@ defmodule Pleroma.Web.Endpoint d
    # InstanceStatic needs to be before Plug.Static to be able to override shipped-static files
    # If you're adding new paths to `only:` you'll need to configure them in InstanceStatic as well
    # Cache-control headers are duplicated in case we turn off etags in the future
+   plug(
+     Pleroma.Web.Plugs.InstanceStatic,
+     at: "/",
+     from: :pleroma,
+     only: ["emoji", "images"],
+     gzip: true,
+     cache_control_for_etags: "public, max-age=1209600",
+     headers: %{
+       "cache-control" => "public, max-age=1209600"
+     }
+   )
    plug(Pleroma.Web.Plugs.InstanceStatic,
      at: "/",
      gzip: true,
      }
    )
  
 +  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