Rename MobilizonWeb to Mobilizon.Web

This commit is contained in:
rustra 2020-01-26 21:36:50 +01:00
parent b3f8d52bc9
commit 8856cc2f55
143 changed files with 490 additions and 490 deletions

View File

@ -36,18 +36,18 @@ config :mime, :types, %{
} }
# Configures the endpoint # Configures the endpoint
config :mobilizon, MobilizonWeb.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
url: [host: "localhost"], url: [host: "localhost"],
secret_key_base: "1yOazsoE0Wqu4kXk3uC5gu3jDbShOimTCzyFL3OjCdBmOXMyHX87Qmf3+Tu9s0iM", secret_key_base: "1yOazsoE0Wqu4kXk3uC5gu3jDbShOimTCzyFL3OjCdBmOXMyHX87Qmf3+Tu9s0iM",
render_errors: [view: MobilizonWeb.ErrorView, accepts: ~w(html json)], render_errors: [view: Mobilizon.Web.ErrorView, accepts: ~w(html json)],
pubsub: [name: Mobilizon.PubSub, adapter: Phoenix.PubSub.PG2] pubsub: [name: Mobilizon.PubSub, adapter: Phoenix.PubSub.PG2]
# Upload configuration # Upload configuration
config :mobilizon, MobilizonWeb.Upload, config :mobilizon, Mobilizon.Web.Upload,
uploader: MobilizonWeb.Upload.Uploader.Local, uploader: Mobilizon.Web.Upload.Uploader.Local,
filters: [ filters: [
MobilizonWeb.Upload.Filter.Dedupe, Mobilizon.Web.Upload.Filter.Dedupe,
MobilizonWeb.Upload.Filter.Optimize Mobilizon.Web.Upload.Filter.Optimize
], ],
link_name: true, link_name: true,
proxy_remote: false, proxy_remote: false,
@ -60,7 +60,7 @@ config :mobilizon, MobilizonWeb.Upload,
] ]
] ]
config :mobilizon, MobilizonWeb.Upload.Uploader.Local, uploads: "uploads" config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "uploads"
config :mobilizon, :media_proxy, config :mobilizon, :media_proxy,
enabled: true, enabled: true,
@ -78,7 +78,7 @@ config :logger, :console,
format: "$time $metadata[$level] $message\n", format: "$time $metadata[$level] $message\n",
metadata: [:request_id] metadata: [:request_id]
config :mobilizon, MobilizonWeb.Auth.Guardian, config :mobilizon, Mobilizon.Web.Auth.Guardian,
issuer: "mobilizon", issuer: "mobilizon",
secret_key: "ty0WM7YBE3ojvxoUQxo8AERrNpfbXnIJ82ovkPdqbUFw31T5LcK8wGjaOiReVQjo" secret_key: "ty0WM7YBE3ojvxoUQxo8AERrNpfbXnIJ82ovkPdqbUFw31T5LcK8wGjaOiReVQjo"

View File

@ -6,7 +6,7 @@ import Config
# The watchers configuration can be used to run external # The watchers configuration can be used to run external
# watchers to your application. For example, we use it # watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources. # with brunch.io to recompile .js and .css sources.
config :mobilizon, MobilizonWeb.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
http: [ http: [
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000 port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000
], ],
@ -39,7 +39,7 @@ config :mobilizon, MobilizonWeb.Endpoint,
# different ports. # different ports.
# Watch static and templates for browser reloading. # Watch static and templates for browser reloading.
config :mobilizon, MobilizonWeb.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
live_reload: [ live_reload: [
patterns: [ patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$}, ~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
@ -61,7 +61,7 @@ config :phoenix, :stacktrace_depth, 20
# Initialize plugs at runtime for faster development compilation # Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime config :phoenix, :plug_init_mode, :runtime
config :mobilizon, MobilizonWeb.Email.Mailer, adapter: Bamboo.LocalAdapter config :mobilizon, Mobilizon.Web.Email.Mailer, adapter: Bamboo.LocalAdapter
# Configure your database # Configure your database
config :mobilizon, Mobilizon.Storage.Repo, config :mobilizon, Mobilizon.Storage.Repo,

View File

@ -2,7 +2,7 @@ import Config
import_config "dev.exs" import_config "dev.exs"
config :mobilizon, MobilizonWeb.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
http: [ http: [
port: 4000 port: 4000
], ],

View File

@ -1,6 +1,6 @@
import Config import Config
config :mobilizon, MobilizonWeb.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
http: [ http: [
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000, port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000,
transport_options: [socket_opts: [:inet6]] transport_options: [socket_opts: [:inet6]]
@ -24,7 +24,7 @@ config :mobilizon, Mobilizon.Storage.Repo,
port: System.get_env("MOBILIZON_DATABASE_PORT") || "5432", port: System.get_env("MOBILIZON_DATABASE_PORT") || "5432",
pool_size: 15 pool_size: 15
config :mobilizon, MobilizonWeb.Email.Mailer, config :mobilizon, Mobilizon.Web.Email.Mailer,
adapter: Bamboo.SMTPAdapter, adapter: Bamboo.SMTPAdapter,
server: "localhost", server: "localhost",
hostname: "localhost", hostname: "localhost",
@ -53,7 +53,7 @@ config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geos
# To get SSL working, you will need to add the `https` key # To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443: # to the previous section and set your `:url` port to 443:
# #
# config :mobilizon, MobilizonWeb.Endpoint, # config :mobilizon, Mobilizon.Web.Endpoint,
# ... # ...
# url: [host: "example.com", port: 443], # url: [host: "example.com", port: 443],
# https: [:inet6, # https: [:inet6,
@ -68,7 +68,7 @@ config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geos
# We also recommend setting `force_ssl`, ensuring no data is # We also recommend setting `force_ssl`, ensuring no data is
# ever sent via http, always redirecting to https: # ever sent via http, always redirecting to https:
# #
# config :mobilizon, MobilizonWeb.Endpoint, # config :mobilizon, Mobilizon.Web.Endpoint,
# force_ssl: [hsts: true] # force_ssl: [hsts: true]
# #
# Check `Plug.SSL` for all available options in `force_ssl`. # Check `Plug.SSL` for all available options in `force_ssl`.
@ -83,5 +83,5 @@ config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geos
# Alternatively, you can configure exactly which server to # Alternatively, you can configure exactly which server to
# start per endpoint: # start per endpoint:
# #
# config :mobilizon, MobilizonWeb.Endpoint, server: true # config :mobilizon, Mobilizon.Web.Endpoint, server: true
# #

View File

@ -6,7 +6,7 @@ config :mobilizon, :instance,
# We don't run a server during test. If one is required, # We don't run a server during test. If one is required,
# you can enable the server option below. # you can enable the server option below.
config :mobilizon, MobilizonWeb.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
http: [ http: [
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 80 port: System.get_env("MOBILIZON_INSTANCE_PORT") || 80
], ],
@ -30,11 +30,11 @@ config :mobilizon, Mobilizon.Storage.Repo,
hostname: System.get_env("MOBILIZON_DATABASE_HOST") || "localhost", hostname: System.get_env("MOBILIZON_DATABASE_HOST") || "localhost",
pool: Ecto.Adapters.SQL.Sandbox pool: Ecto.Adapters.SQL.Sandbox
config :mobilizon, MobilizonWeb.Email.Mailer, adapter: Bamboo.TestAdapter config :mobilizon, Mobilizon.Web.Email.Mailer, adapter: Bamboo.TestAdapter
config :mobilizon, MobilizonWeb.Upload, filters: [], link_name: false config :mobilizon, Mobilizon.Web.Upload, filters: [], link_name: false
config :mobilizon, MobilizonWeb.Upload.Uploader.Local, uploads: "test/uploads" config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "test/uploads"
config :exvcr, config :exvcr,
vcr_cassette_library_dir: "test/fixtures/vcr_cassettes" vcr_cassette_library_dir: "test/fixtures/vcr_cassettes"

View File

@ -32,7 +32,7 @@ defmodule Mobilizon.Federation.ActivityPub do
alias Mobilizon.GraphQL.API.Utils, as: APIUtils alias Mobilizon.GraphQL.API.Utils, as: APIUtils
alias MobilizonWeb.Email.{Admin, Mailer} alias Mobilizon.Web.Email.{Admin, Mailer}
require Logger require Logger
@ -318,7 +318,7 @@ defmodule Mobilizon.Federation.ActivityPub do
Convertible.model_to_as(%{follow | actor: follower, target_actor: followed}), Convertible.model_to_as(%{follow | actor: follower, target_actor: followed}),
{:ok, follow_activity} <- create_activity(follow_as_data, local), {:ok, follow_activity} <- create_activity(follow_as_data, local),
activity_unfollow_id <- activity_unfollow_id <-
activity_id || "#{MobilizonWeb.Endpoint.url()}/unfollow/#{follow_id}/activity", activity_id || "#{Mobilizon.Web.Endpoint.url()}/unfollow/#{follow_id}/activity",
unfollow_data <- unfollow_data <-
make_unfollow_data(follower, followed, follow_activity, activity_unfollow_id), make_unfollow_data(follower, followed, follow_activity, activity_unfollow_id),
{:ok, activity} <- create_activity(unfollow_data, local), {:ok, activity} <- create_activity(unfollow_data, local),
@ -483,7 +483,7 @@ defmodule Mobilizon.Federation.ActivityPub do
# If it's an exclusion it should be something else # If it's an exclusion it should be something else
"actor" => actor_url, "actor" => actor_url,
"object" => event_url, "object" => event_url,
"id" => "#{MobilizonWeb.Endpoint.url()}/leave/event/#{participant.id}" "id" => "#{Mobilizon.Web.Endpoint.url()}/leave/event/#{participant.id}"
}, },
audience <- audience <-
Audience.calculate_to_and_cc_from_mentions(participant), Audience.calculate_to_and_cc_from_mentions(participant),
@ -778,7 +778,7 @@ defmodule Mobilizon.Federation.ActivityPub do
make_accept_join_data( make_accept_join_data(
follower_as_data, follower_as_data,
Map.merge(additional, %{ Map.merge(additional, %{
"id" => "#{MobilizonWeb.Endpoint.url()}/accept/follow/#{follower.id}", "id" => "#{Mobilizon.Web.Endpoint.url()}/accept/follow/#{follower.id}",
"to" => [follower.actor.url], "to" => [follower.actor.url],
"cc" => [], "cc" => [],
"actor" => follower.target_actor.url "actor" => follower.target_actor.url
@ -797,7 +797,7 @@ defmodule Mobilizon.Federation.ActivityPub do
defp accept_join(%Participant{} = participant, additional) do defp accept_join(%Participant{} = participant, additional) do
with {:ok, %Participant{} = participant} <- with {:ok, %Participant{} = participant} <-
Events.update_participant(participant, %{role: :participant}), Events.update_participant(participant, %{role: :participant}),
Absinthe.Subscription.publish(MobilizonWeb.Endpoint, participant.actor, Absinthe.Subscription.publish(Mobilizon.Web.Endpoint, participant.actor,
event_person_participation_changed: participant.actor.id event_person_participation_changed: participant.actor.id
), ),
participant_as_data <- Convertible.model_to_as(participant), participant_as_data <- Convertible.model_to_as(participant),
@ -807,7 +807,7 @@ defmodule Mobilizon.Federation.ActivityPub do
make_accept_join_data( make_accept_join_data(
participant_as_data, participant_as_data,
Map.merge(Map.merge(audience, additional), %{ Map.merge(Map.merge(audience, additional), %{
"id" => "#{MobilizonWeb.Endpoint.url()}/accept/join/#{participant.id}" "id" => "#{Mobilizon.Web.Endpoint.url()}/accept/join/#{participant.id}"
}) })
) do ) do
{:ok, participant, update_data} {:ok, participant, update_data}
@ -823,7 +823,7 @@ defmodule Mobilizon.Federation.ActivityPub do
defp reject_join(%Participant{} = participant, additional) do defp reject_join(%Participant{} = participant, additional) do
with {:ok, %Participant{} = participant} <- with {:ok, %Participant{} = participant} <-
Events.update_participant(participant, %{approved: false, role: :rejected}), Events.update_participant(participant, %{approved: false, role: :rejected}),
Absinthe.Subscription.publish(MobilizonWeb.Endpoint, participant.actor, Absinthe.Subscription.publish(Mobilizon.Web.Endpoint, participant.actor,
event_person_participation_changed: participant.actor.id event_person_participation_changed: participant.actor.id
), ),
participant_as_data <- Convertible.model_to_as(participant), participant_as_data <- Convertible.model_to_as(participant),
@ -839,7 +839,7 @@ defmodule Mobilizon.Federation.ActivityPub do
reject_data reject_data
|> Map.merge(audience) |> Map.merge(audience)
|> Map.merge(%{ |> Map.merge(%{
"id" => "#{MobilizonWeb.Endpoint.url()}/reject/join/#{participant.id}" "id" => "#{Mobilizon.Web.Endpoint.url()}/reject/join/#{participant.id}"
}) do }) do
{:ok, participant, update_data} {:ok, participant, update_data}
else else
@ -866,7 +866,7 @@ defmodule Mobilizon.Federation.ActivityPub do
reject_data reject_data
|> Map.merge(audience) |> Map.merge(audience)
|> Map.merge(%{ |> Map.merge(%{
"id" => "#{MobilizonWeb.Endpoint.url()}/reject/follow/#{follower.id}" "id" => "#{Mobilizon.Web.Endpoint.url()}/reject/follow/#{follower.id}"
}) do }) do
{:ok, follower, update_data} {:ok, follower, update_data}
else else

View File

@ -28,7 +28,7 @@ defmodule Mobilizon.Federation.ActivityPub.Relay do
@spec get_actor() :: Actor.t() | {:error, Ecto.Changeset.t()} @spec get_actor() :: Actor.t() | {:error, Ecto.Changeset.t()}
def get_actor do def get_actor do
with {:ok, %Actor{} = actor} <- with {:ok, %Actor{} = actor} <-
Actors.get_or_create_instance_actor_by_url("#{MobilizonWeb.Endpoint.url()}/relay") do Actors.get_or_create_instance_actor_by_url("#{Mobilizon.Web.Endpoint.url()}/relay") do
actor actor
end end
end end

View File

@ -17,7 +17,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
alias Mobilizon.Federation.ActivityPub.{Activity, Utils} alias Mobilizon.Federation.ActivityPub.{Activity, Utils}
alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} alias Mobilizon.Federation.ActivityStream.{Converter, Convertible}
alias MobilizonWeb.Email.Participation alias Mobilizon.Web.Email.Participation
require Logger require Logger

View File

@ -198,7 +198,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
Save picture data from %Plug.Upload{} and return AS Link data. Save picture data from %Plug.Upload{} and return AS Link data.
""" """
def make_picture_data(%Plug.Upload{} = picture, opts) do def make_picture_data(%Plug.Upload{} = picture, opts) do
case MobilizonWeb.Upload.store(picture, opts) do case Mobilizon.Web.Upload.store(picture, opts) do
{:ok, picture} -> {:ok, picture} ->
picture picture
@ -219,7 +219,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
""" """
def make_picture_data(picture) when is_map(picture) do def make_picture_data(picture) when is_map(picture) do
with {:ok, %{"url" => [%{"href" => url, "mediaType" => content_type}], "size" => size}} <- with {:ok, %{"url" => [%{"href" => url, "mediaType" => content_type}], "size" => size}} <-
MobilizonWeb.Upload.store(picture.file), Mobilizon.Web.Upload.store(picture.file),
{:picture_exists, nil} <- {:picture_exists, Mobilizon.Media.get_picture_by_url(url)}, {:picture_exists, nil} <- {:picture_exists, Mobilizon.Media.get_picture_by_url(url)},
{:ok, %Picture{file: _file} = picture} <- {:ok, %Picture{file: _file} = picture} <-
Mobilizon.Media.create_picture(%{ Mobilizon.Media.create_picture(%{

View File

@ -29,14 +29,14 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
data["icon"]["url"] && data["icon"]["url"] &&
%{ %{
"name" => data["icon"]["name"] || "avatar", "name" => data["icon"]["name"] || "avatar",
"url" => MobilizonWeb.MediaProxy.url(data["icon"]["url"]) "url" => Mobilizon.Web.MediaProxy.url(data["icon"]["url"])
} }
banner = banner =
data["image"]["url"] && data["image"]["url"] &&
%{ %{
"name" => data["image"]["name"] || "banner", "name" => data["image"]["name"] || "banner",
"url" => MobilizonWeb.MediaProxy.url(data["image"]["url"]) "url" => Mobilizon.Web.MediaProxy.url(data["image"]["url"])
} }
actor_data = %{ actor_data = %{

View File

@ -34,7 +34,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Picture do
when is_bitstring(picture_url) do when is_bitstring(picture_url) do
with {:ok, %HTTPoison.Response{body: body}} <- HTTPoison.get(picture_url), with {:ok, %HTTPoison.Response{body: body}} <- HTTPoison.get(picture_url),
{:ok, %{name: name, url: url, content_type: content_type, size: size}} <- {:ok, %{name: name, url: url, content_type: content_type, size: size}} <-
MobilizonWeb.Upload.store(%{body: body, name: name}), Mobilizon.Web.Upload.store(%{body: body, name: name}),
{:picture_exists, nil} <- {:picture_exists, Mobilizon.Media.get_picture_by_url(url)} do {:picture_exists, nil} <- {:picture_exists, Mobilizon.Media.get_picture_by_url(url)} do
Mobilizon.Media.create_picture(%{ Mobilizon.Media.create_picture(%{
"file" => %{ "file" => %{

View File

@ -40,7 +40,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Utils do
def build_tags(tags) do def build_tags(tags) do
Enum.map(tags, fn %Tag{} = tag -> Enum.map(tags, fn %Tag{} = tag ->
%{ %{
"href" => MobilizonWeb.Endpoint.url() <> "/tags/#{tag.slug}", "href" => Mobilizon.Web.Endpoint.url() <> "/tags/#{tag.slug}",
"name" => "##{tag.title}", "name" => "##{tag.title}",
"type" => "Hashtag" "type" => "Hashtag"
} }

View File

@ -17,7 +17,7 @@ defmodule Mobilizon.Federation.WebFinger do
require Logger require Logger
def host_meta do def host_meta do
base_url = MobilizonWeb.Endpoint.url() base_url = Mobilizon.Web.Endpoint.url()
{ {
:XRD, :XRD,
@ -35,7 +35,7 @@ defmodule Mobilizon.Federation.WebFinger do
end end
def webfinger(resource, "JSON") do def webfinger(resource, "JSON") do
host = MobilizonWeb.Endpoint.host() host = Mobilizon.Web.Endpoint.host()
regex = ~r/(acct:)?(?<name>\w+)@#{host}/ regex = ~r/(acct:)?(?<name>\w+)@#{host}/
with %{"name" => name} <- Regex.named_captures(regex, resource), with %{"name" => name} <- Regex.named_captures(regex, resource),
@ -59,7 +59,7 @@ defmodule Mobilizon.Federation.WebFinger do
@spec represent_actor(Actor.t(), String.t()) :: struct() @spec represent_actor(Actor.t(), String.t()) :: struct()
def represent_actor(actor, "JSON") do def represent_actor(actor, "JSON") do
%{ %{
"subject" => "acct:#{actor.preferred_username}@#{MobilizonWeb.Endpoint.host()}", "subject" => "acct:#{actor.preferred_username}@#{Mobilizon.Web.Endpoint.host()}",
"aliases" => [actor.url], "aliases" => [actor.url],
"links" => [ "links" => [
%{"rel" => "self", "type" => "application/activity+json", "href" => actor.url}, %{"rel" => "self", "type" => "application/activity+json", "href" => actor.url},

View File

@ -8,7 +8,7 @@ defmodule Mobilizon.GraphQL.API.Participations do
alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub
alias MobilizonWeb.Email.Participation alias Mobilizon.Web.Email.Participation
@spec join(Event.t(), Actor.t()) :: {:ok, Participant.t()} @spec join(Event.t(), Actor.t()) :: {:ok, Participant.t()}
def join(%Event{id: event_id} = event, %Actor{id: actor_id} = actor) do def join(%Event{id: event_id} = event, %Actor{id: actor_id} = actor) do

View File

@ -157,7 +157,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
pic = args[key][:picture] pic = args[key][:picture]
with {:ok, %{name: name, url: url, content_type: content_type, size: _size}} <- with {:ok, %{name: name, url: url, content_type: content_type, size: _size}} <-
MobilizonWeb.Upload.store(pic.file, type: key, description: pic.alt) do Mobilizon.Web.Upload.store(pic.file, type: key, description: pic.alt) do
Map.put(args, key, %{"name" => name, "url" => url, "mediaType" => content_type}) Map.put(args, key, %{"name" => name, "url" => url, "mediaType" => content_type})
end end
else else
@ -236,7 +236,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
@spec proxify_avatar(Actor.t()) :: Actor.t() @spec proxify_avatar(Actor.t()) :: Actor.t()
defp proxify_avatar(%Actor{avatar: %{url: avatar_url} = avatar} = actor) do defp proxify_avatar(%Actor{avatar: %{url: avatar_url} = avatar} = actor) do
actor |> Map.put(:avatar, avatar |> Map.put(:url, MobilizonWeb.MediaProxy.url(avatar_url))) actor |> Map.put(:avatar, avatar |> Map.put(:url, Mobilizon.Web.MediaProxy.url(avatar_url)))
end end
@spec proxify_avatar(Actor.t()) :: Actor.t() @spec proxify_avatar(Actor.t()) :: Actor.t()
@ -244,7 +244,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
@spec proxify_banner(Actor.t()) :: Actor.t() @spec proxify_banner(Actor.t()) :: Actor.t()
defp proxify_banner(%Actor{banner: %{url: banner_url} = banner} = actor) do defp proxify_banner(%Actor{banner: %{url: banner_url} = banner} = actor) do
actor |> Map.put(:banner, banner |> Map.put(:url, MobilizonWeb.MediaProxy.url(banner_url))) actor |> Map.put(:banner, banner |> Map.put(:url, Mobilizon.Web.MediaProxy.url(banner_url)))
end end
@spec proxify_banner(Actor.t()) :: Actor.t() @spec proxify_banner(Actor.t()) :: Actor.t()

View File

@ -18,7 +18,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Picture do
@doc """ @doc """
Get picture for an event that has an attached Get picture for an event that has an attached
See MobilizonWeb.Resolvers.Event.create_event/3 See Mobilizon.Web.Resolvers.Event.create_event/3
""" """
def picture(%{picture: picture} = _parent, _args, _resolution), do: {:ok, picture} def picture(%{picture: picture} = _parent, _args, _resolution), do: {:ok, picture}
def picture(_parent, %{id: picture_id}, _resolution), do: do_fetch_picture(picture_id) def picture(_parent, %{id: picture_id}, _resolution), do: do_fetch_picture(picture_id)
@ -53,7 +53,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Picture do
) do ) do
with {:is_owned, %Actor{}} <- User.owns_actor(user, actor_id), with {:is_owned, %Actor{}} <- User.owns_actor(user, actor_id),
{:ok, %{name: _name, url: url, content_type: content_type, size: size}} <- {:ok, %{name: _name, url: url, content_type: content_type, size: size}} <-
MobilizonWeb.Upload.store(file), Mobilizon.Web.Upload.store(file),
args <- args <-
args args
|> Map.put(:url, url) |> Map.put(:url, url)

View File

@ -10,7 +10,7 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
alias Mobilizon.Storage.Repo alias Mobilizon.Storage.Repo
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias MobilizonWeb.{Auth, Email} alias Mobilizon.Web.{Auth, Email}
require Logger require Logger

View File

@ -26,7 +26,7 @@ defmodule Mobilizon do
@spec user_agent :: String.t() @spec user_agent :: String.t()
def user_agent do def user_agent do
info = "#{MobilizonWeb.Endpoint.url()} <#{Config.get([:instance, :email], "")}>" info = "#{Mobilizon.Web.Endpoint.url()} <#{Config.get([:instance, :email], "")}>"
"#{named_version()}; #{info}" "#{named_version()}; #{info}"
end end
@ -37,8 +37,8 @@ defmodule Mobilizon do
children = [ children = [
# supervisors # supervisors
Mobilizon.Storage.Repo, Mobilizon.Storage.Repo,
MobilizonWeb.Endpoint, Mobilizon.Web.Endpoint,
{Absinthe.Subscription, [MobilizonWeb.Endpoint]}, {Absinthe.Subscription, [Mobilizon.Web.Endpoint]},
{Oban, Application.get_env(:mobilizon, Oban)}, {Oban, Application.get_env(:mobilizon, Oban)},
# workers # workers
Guardian.DB.Token.SweeperServer, Guardian.DB.Token.SweeperServer,
@ -55,7 +55,7 @@ defmodule Mobilizon do
@spec config_change(keyword, keyword, [atom]) :: :ok @spec config_change(keyword, keyword, [atom]) :: :ok
def config_change(changed, _new, removed) do def config_change(changed, _new, removed) do
MobilizonWeb.Endpoint.config_change(changed, removed) Mobilizon.Web.Endpoint.config_change(changed, removed)
:ok :ok
end end

View File

@ -15,8 +15,8 @@ defmodule Mobilizon.Actors.Actor do
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias Mobilizon.Mention alias Mobilizon.Mention
alias MobilizonWeb.Endpoint alias Mobilizon.Web.Endpoint
alias MobilizonWeb.Router.Helpers, as: Routes alias Mobilizon.Web.Router.Helpers, as: Routes
require Logger require Logger
@ -336,7 +336,7 @@ defmodule Mobilizon.Actors.Actor do
|> put_change(:followers_url, build_url(username, :followers)) |> put_change(:followers_url, build_url(username, :followers))
|> put_change(:following_url, build_url(username, :following)) |> put_change(:following_url, build_url(username, :following))
|> put_change(:inbox_url, build_url(username, :inbox)) |> put_change(:inbox_url, build_url(username, :inbox))
|> put_change(:shared_inbox_url, "#{MobilizonWeb.Endpoint.url()}/inbox") |> put_change(:shared_inbox_url, "#{Mobilizon.Web.Endpoint.url()}/inbox")
|> put_change(:url, build_url(username, :page)) |> put_change(:url, build_url(username, :page))
end end
@ -376,10 +376,10 @@ defmodule Mobilizon.Actors.Actor do
"keys" => Crypto.generate_rsa_2048_private_key(), "keys" => Crypto.generate_rsa_2048_private_key(),
"preferred_username" => preferred_username, "preferred_username" => preferred_username,
"domain" => nil, "domain" => nil,
"inbox_url" => "#{MobilizonWeb.Endpoint.url()}/inbox", "inbox_url" => "#{Mobilizon.Web.Endpoint.url()}/inbox",
"followers_url" => "#{url}/followers", "followers_url" => "#{url}/followers",
"following_url" => "#{url}/following", "following_url" => "#{url}/following",
"shared_inbox_url" => "#{MobilizonWeb.Endpoint.url()}/inbox", "shared_inbox_url" => "#{Mobilizon.Web.Endpoint.url()}/inbox",
"type" => :Application "type" => :Application
} }
end end

View File

@ -755,7 +755,7 @@ defmodule Mobilizon.Actors do
@spec safe_remove_file(String.t(), Actor.t()) :: {:ok, Actor.t()} @spec safe_remove_file(String.t(), Actor.t()) :: {:ok, Actor.t()}
defp safe_remove_file(url, %Actor{} = actor) do defp safe_remove_file(url, %Actor{} = actor) do
case MobilizonWeb.Upload.remove(url) do case Mobilizon.Web.Upload.remove(url) do
{:ok, _value} -> {:ok, _value} ->
{:ok, actor} {:ok, actor}
@ -774,7 +774,7 @@ defmodule Mobilizon.Actors do
with %Ecto.Changeset{changes: %{url: new_url}} <- changes[key], with %Ecto.Changeset{changes: %{url: new_url}} <- changes[key],
%{url: old_url} <- data |> Map.from_struct() |> Map.get(key), %{url: old_url} <- data |> Map.from_struct() |> Map.get(key),
false <- new_url == old_url do false <- new_url == old_url do
MobilizonWeb.Upload.remove(old_url) Mobilizon.Web.Upload.remove(old_url)
end end
end end
end) end)

View File

@ -65,6 +65,6 @@ defmodule Mobilizon.Actors.Follower do
changeset changeset
|> put_change(:id, uuid) |> put_change(:id, uuid)
|> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/follow/#{uuid}") |> put_change(:url, "#{Mobilizon.Web.Endpoint.url()}/follow/#{uuid}")
end end
end end

View File

@ -65,7 +65,7 @@ defmodule Mobilizon.Addresses.Address do
@spec set_url(Ecto.Changeset.t()) :: Ecto.Changeset.t() @spec set_url(Ecto.Changeset.t()) :: Ecto.Changeset.t()
defp set_url(%Ecto.Changeset{changes: changes} = changeset) do defp set_url(%Ecto.Changeset{changes: changes} = changeset) do
url = Map.get(changes, :url, "#{MobilizonWeb.Endpoint.url()}/address/#{Ecto.UUID.generate()}") url = Map.get(changes, :url, "#{Mobilizon.Web.Endpoint.url()}/address/#{Ecto.UUID.generate()}")
put_change(changeset, :url, url) put_change(changeset, :url, url)
end end

View File

@ -11,8 +11,8 @@ defmodule Mobilizon.Events.Comment do
alias Mobilizon.Events.{Comment, CommentVisibility, Event, Tag} alias Mobilizon.Events.{Comment, CommentVisibility, Event, Tag}
alias Mobilizon.Mention alias Mobilizon.Mention
alias MobilizonWeb.Endpoint alias Mobilizon.Web.Endpoint
alias MobilizonWeb.Router.Helpers, as: Routes alias Mobilizon.Web.Router.Helpers, as: Routes
@type t :: %__MODULE__{ @type t :: %__MODULE__{
text: String.t(), text: String.t(),

View File

@ -33,8 +33,8 @@ defmodule Mobilizon.Events.Event do
alias Mobilizon.Mention alias Mobilizon.Mention
alias Mobilizon.Storage.Repo alias Mobilizon.Storage.Repo
alias MobilizonWeb.Endpoint alias Mobilizon.Web.Endpoint
alias MobilizonWeb.Router.Helpers, as: Routes alias Mobilizon.Web.Router.Helpers, as: Routes
@type t :: %__MODULE__{ @type t :: %__MODULE__{
url: String.t(), url: String.t(),

View File

@ -31,7 +31,7 @@ defmodule Mobilizon.Events do
alias Mobilizon.Storage.{Page, Repo} alias Mobilizon.Storage.{Page, Repo}
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias MobilizonWeb.Email alias Mobilizon.Web.Email
defenum(EventVisibility, :event_visibility, [ defenum(EventVisibility, :event_visibility, [
:public, :public,

View File

@ -11,7 +11,7 @@ defmodule Mobilizon.Events.Participant do
alias Mobilizon.Events alias Mobilizon.Events
alias Mobilizon.Events.{Event, ParticipantRole} alias Mobilizon.Events.{Event, ParticipantRole}
alias MobilizonWeb.Endpoint alias Mobilizon.Web.Endpoint
@type t :: %__MODULE__{ @type t :: %__MODULE__{
role: ParticipantRole.t(), role: ParticipantRole.t(),

View File

@ -62,7 +62,7 @@ defmodule Mobilizon.Media do
Multi.new() Multi.new()
|> Multi.delete(:picture, picture) |> Multi.delete(:picture, picture)
|> Multi.run(:remove, fn _repo, %{picture: %Picture{file: %File{url: url}}} -> |> Multi.run(:remove, fn _repo, %{picture: %Picture{file: %File{url: url}}} ->
MobilizonWeb.Upload.remove(url) Mobilizon.Web.Upload.remove(url)
end) end)
|> Repo.transaction() |> Repo.transaction()

View File

@ -71,7 +71,7 @@ defmodule Mobilizon.Reports.Report do
@spec maybe_generate_url(Ecto.Changeset.t()) :: Ecto.Changeset.t() @spec maybe_generate_url(Ecto.Changeset.t()) :: Ecto.Changeset.t()
defp maybe_generate_url(%Ecto.Changeset{} = changeset) do defp maybe_generate_url(%Ecto.Changeset{} = changeset) do
with res when res in [:error, {:data, nil}] <- fetch_field(changeset, :url), with res when res in [:error, {:data, nil}] <- fetch_field(changeset, :url),
url <- "#{MobilizonWeb.Endpoint.url()}/report/#{Ecto.UUID.generate()}" do url <- "#{Mobilizon.Web.Endpoint.url()}/report/#{Ecto.UUID.generate()}" do
put_change(changeset, :url, url) put_change(changeset, :url, url)
else else
_ -> changeset _ -> changeset

View File

@ -12,7 +12,7 @@ defmodule Mobilizon.Users.User do
alias Mobilizon.Events.FeedToken alias Mobilizon.Events.FeedToken
alias Mobilizon.Users.UserRole alias Mobilizon.Users.UserRole
alias MobilizonWeb.Email alias Mobilizon.Web.Email
@type t :: %__MODULE__{ @type t :: %__MODULE__{
email: String.t(), email: String.t(),

View File

@ -13,7 +13,7 @@ defmodule Mobilizon.Users do
alias Mobilizon.Storage.{Page, Repo} alias Mobilizon.Storage.{Page, Repo}
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias MobilizonWeb.Auth alias Mobilizon.Web.Auth
@type tokens :: %{ @type tokens :: %{
required(:access_token) => String.t(), required(:access_token) => String.t(),

View File

@ -1,3 +0,0 @@
defmodule MobilizonWeb.LayoutView do
use MobilizonWeb, :view
end

View File

@ -3,7 +3,7 @@ defmodule Mobilizon.Service.Export.Feed do
Serve Atom Syndication Feeds. Serve Atom Syndication Feeds.
""" """
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
alias Atomex.{Entry, Feed} alias Atomex.{Entry, Feed}
@ -12,8 +12,8 @@ defmodule Mobilizon.Service.Export.Feed do
alias Mobilizon.Events.{Event, FeedToken} alias Mobilizon.Events.{Event, FeedToken}
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias MobilizonWeb.{Endpoint, MediaProxy} alias Mobilizon.Web.{Endpoint, MediaProxy}
alias MobilizonWeb.Router.Helpers, as: Routes alias Mobilizon.Web.Router.Helpers, as: Routes
require Logger require Logger
@ -74,7 +74,7 @@ defmodule Mobilizon.Service.Export.Feed do
self_url self_url
|> Feed.new( |> Feed.new(
DateTime.utc_now(), DateTime.utc_now(),
Gettext.gettext(MobilizonWeb.Gettext, title, actor: display_name) Gettext.gettext(Mobilizon.Web.Gettext, title, actor: display_name)
) )
|> Feed.author(display_name, uri: actor.url) |> Feed.author(display_name, uri: actor.url)
|> Feed.link(self_url, rel: "self") |> Feed.link(self_url, rel: "self")

View File

@ -52,7 +52,7 @@ defmodule Mobilizon.Service.Formatter do
def hashtag_handler("#" <> tag = tag_text, _buffer, _opts, acc) do def hashtag_handler("#" <> tag = tag_text, _buffer, _opts, acc) do
tag = String.downcase(tag) tag = String.downcase(tag)
url = "#{MobilizonWeb.Endpoint.url()}/tag/#{tag}" url = "#{Mobilizon.Web.Endpoint.url()}/tag/#{tag}"
link = "<a class='hashtag' data-tag='#{tag}' href='#{url}' rel='tag'>#{tag_text}</a>" link = "<a class='hashtag' data-tag='#{tag}' href='#{url}' rel='tag'>#{tag_text}</a>"
{link, %{acc | tags: MapSet.put(acc.tags, {tag_text, tag})}} {link, %{acc | tags: MapSet.put(acc.tags, {tag_text, tag})}}

View File

@ -1,7 +1,7 @@
defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do
alias Phoenix.HTML.Tag alias Phoenix.HTML.Tag
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias MobilizonWeb.MediaProxy alias Mobilizon.Web.MediaProxy
def build_tags(%Actor{} = actor) do def build_tags(%Actor{} = actor) do
tags = [ tags = [

View File

@ -2,8 +2,8 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Events.Event do
alias Phoenix.HTML alias Phoenix.HTML
alias Phoenix.HTML.Tag alias Phoenix.HTML.Tag
alias Mobilizon.Events.Event alias Mobilizon.Events.Event
alias MobilizonWeb.JsonLD.ObjectView alias Mobilizon.Web.JsonLD.ObjectView
alias MobilizonWeb.MediaProxy alias Mobilizon.Web.MediaProxy
def build_tags(%Event{} = event) do def build_tags(%Event{} = event) do
event = Map.put(event, :description, process_description(event.description)) event = Map.put(event, :description, process_description(event.description))

View File

@ -6,7 +6,7 @@ defmodule Mobilizon.Service.Metadata.Instance do
alias Phoenix.HTML alias Phoenix.HTML
alias Phoenix.HTML.Tag alias Phoenix.HTML.Tag
alias Mobilizon.Config alias Mobilizon.Config
alias MobilizonWeb.Endpoint alias Mobilizon.Web.Endpoint
def build_tags() do def build_tags() do
description = process_description(Config.instance_description()) description = process_description(Config.instance_description())

View File

@ -1,6 +1,6 @@
defmodule MobilizonWeb.Auth.Context do defmodule Mobilizon.Web.Auth.Context do
@moduledoc """ @moduledoc """
Guardian context for MobilizonWeb Guardian context for Mobilizon.Web
""" """
@behaviour Plug @behaviour Plug

View File

@ -1,4 +1,4 @@
defmodule MobilizonWeb.Auth.ErrorHandler do defmodule Mobilizon.Web.Auth.ErrorHandler do
@moduledoc """ @moduledoc """
In case we have an auth error In case we have an auth error
""" """

View File

@ -1,4 +1,4 @@
defmodule MobilizonWeb.Auth.Guardian do defmodule Mobilizon.Web.Auth.Guardian do
@moduledoc """ @moduledoc """
Handles the JWT tokens encoding and decoding Handles the JWT tokens encoding and decoding
""" """

View File

@ -1,14 +1,14 @@
defmodule MobilizonWeb.Auth.Pipeline do defmodule Mobilizon.Web.Auth.Pipeline do
@moduledoc """ @moduledoc """
Handles the app sessions Handles the app sessions
""" """
use Guardian.Plug.Pipeline, use Guardian.Plug.Pipeline,
otp_app: :mobilizon, otp_app: :mobilizon,
module: MobilizonWeb.Auth.Guardian, module: Mobilizon.Web.Auth.Guardian,
error_handler: MobilizonWeb.Auth.ErrorHandler error_handler: Mobilizon.Web.Auth.ErrorHandler
plug(Guardian.Plug.VerifyHeader, realm: "Bearer") plug(Guardian.Plug.VerifyHeader, realm: "Bearer")
plug(Guardian.Plug.LoadResource, allow_blank: true) plug(Guardian.Plug.LoadResource, allow_blank: true)
plug(MobilizonWeb.Auth.Context) plug(Mobilizon.Web.Auth.Context)
end end

View File

@ -1,4 +1,4 @@
defmodule MobilizonWeb.Cache.ActivityPub do defmodule Mobilizon.Web.Cache.ActivityPub do
@moduledoc """ @moduledoc """
ActivityPub related cache. ActivityPub related cache.
""" """
@ -9,8 +9,8 @@ defmodule MobilizonWeb.Cache.ActivityPub do
alias Mobilizon.Federation.ActivityPub.Relay alias Mobilizon.Federation.ActivityPub.Relay
alias MobilizonWeb.Endpoint alias Mobilizon.Web.Endpoint
alias MobilizonWeb.Router.Helpers, as: Routes alias Mobilizon.Web.Router.Helpers, as: Routes
@cache :activity_pub @cache :activity_pub

View File

@ -1,11 +1,11 @@
defmodule MobilizonWeb.Cache do defmodule Mobilizon.Web.Cache do
@moduledoc """ @moduledoc """
Facade module which provides access to all cached data. Facade module which provides access to all cached data.
""" """
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias MobilizonWeb.Cache.ActivityPub alias Mobilizon.Web.Cache.ActivityPub
@caches [:activity_pub, :feed, :ics] @caches [:activity_pub, :feed, :ics]

View File

@ -1,14 +1,14 @@
defmodule MobilizonWeb.GraphQLSocket do defmodule Mobilizon.Web.GraphQLSocket do
use Phoenix.Socket use Phoenix.Socket
use Absinthe.Phoenix.Socket, use Absinthe.Phoenix.Socket,
schema: MobilizonWeb.Schema schema: Mobilizon.Web.Schema
alias Mobilizon.Users.User alias Mobilizon.Users.User
def connect(%{"token" => token}, socket) do def connect(%{"token" => token}, socket) do
with {:ok, authed_socket} <- with {:ok, authed_socket} <-
Guardian.Phoenix.Socket.authenticate(socket, MobilizonWeb.Auth.Guardian, token), Guardian.Phoenix.Socket.authenticate(socket, Mobilizon.Web.Auth.Guardian, token),
%User{} = user <- Guardian.Phoenix.Socket.current_resource(authed_socket) do %User{} = user <- Guardian.Phoenix.Socket.current_resource(authed_socket) do
authed_socket = authed_socket =
Absinthe.Phoenix.Socket.put_options(socket, Absinthe.Phoenix.Socket.put_options(socket,

View File

@ -3,8 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/activity_pub/activity_pub_controller.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/activity_pub/activity_pub_controller.ex
defmodule MobilizonWeb.ActivityPubController do defmodule Mobilizon.Web.ActivityPubController do
use MobilizonWeb, :controller use Mobilizon.Web, :controller
alias Mobilizon.{Actors, Config} alias Mobilizon.{Actors, Config}
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
@ -12,14 +12,14 @@ defmodule MobilizonWeb.ActivityPubController do
alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Federator alias Mobilizon.Federation.ActivityPub.Federator
alias MobilizonWeb.ActivityPub.ActorView alias Mobilizon.Web.ActivityPub.ActorView
alias MobilizonWeb.Cache alias Mobilizon.Web.Cache
require Logger require Logger
action_fallback(:errors) action_fallback(:errors)
plug(MobilizonWeb.Plugs.Federating when action in [:inbox, :relay]) plug(Mobilizon.Web.Plugs.Federating when action in [:inbox, :relay])
plug(:relay_active? when action in [:relay]) plug(:relay_active? when action in [:relay])
def relay_active?(conn, _) do def relay_active?(conn, _) do

View File

@ -1,15 +1,15 @@
defmodule MobilizonWeb.FallbackController do defmodule Mobilizon.Web.FallbackController do
@moduledoc """ @moduledoc """
Translates controller action results into valid `Plug.Conn` responses. Translates controller action results into valid `Plug.Conn` responses.
See `Phoenix.Controller.action_fallback/1` for more details. See `Phoenix.Controller.action_fallback/1` for more details.
""" """
use MobilizonWeb, :controller use Mobilizon.Web, :controller
def call(conn, {:error, :not_found}) do def call(conn, {:error, :not_found}) do
conn conn
|> put_status(:not_found) |> put_status(:not_found)
|> put_view(MobilizonWeb.ErrorView) |> put_view(Mobilizon.Web.ErrorView)
|> render(:"404") |> render(:"404")
end end
end end

View File

@ -1,10 +1,10 @@
defmodule MobilizonWeb.FeedController do defmodule Mobilizon.Web.FeedController do
@moduledoc """ @moduledoc """
Controller to serve RSS, ATOM and iCal Feeds Controller to serve RSS, ATOM and iCal Feeds
""" """
use MobilizonWeb, :controller use Mobilizon.Web, :controller
plug(:put_layout, false) plug(:put_layout, false)
action_fallback(MobilizonWeb.FallbackController) action_fallback(Mobilizon.Web.FallbackController)
def actor(conn, %{"name" => name, "format" => "atom"}) do def actor(conn, %{"name" => name, "format" => "atom"}) do
case Cachex.fetch(:feed, "actor_" <> name) do case Cachex.fetch(:feed, "actor_" <> name) do

View File

@ -3,15 +3,15 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/media_proxy/controller.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/media_proxy/controller.ex
defmodule MobilizonWeb.MediaProxyController do defmodule Mobilizon.Web.MediaProxyController do
use MobilizonWeb, :controller use Mobilizon.Web, :controller
alias Plug.Conn alias Plug.Conn
alias Mobilizon.Config alias Mobilizon.Config
alias MobilizonWeb.MediaProxy alias Mobilizon.Web.MediaProxy
alias MobilizonWeb.ReverseProxy alias Mobilizon.Web.ReverseProxy
@default_proxy_opts [max_body_length: 25 * 1_048_576, http: [follow_redirect: true]] @default_proxy_opts [max_body_length: 25 * 1_048_576, http: [follow_redirect: true]]

View File

@ -3,14 +3,14 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
defmodule MobilizonWeb.NodeInfoController do defmodule Mobilizon.Web.NodeInfoController do
use MobilizonWeb, :controller use Mobilizon.Web, :controller
alias Mobilizon.Config alias Mobilizon.Config
alias Mobilizon.Service.Statistics alias Mobilizon.Service.Statistics
alias MobilizonWeb.Endpoint alias Mobilizon.Web.Endpoint
alias MobilizonWeb.Router.Helpers, as: Routes alias Mobilizon.Web.Router.Helpers, as: Routes
@node_info_supported_versions ["2.0", "2.1"] @node_info_supported_versions ["2.0", "2.1"]
@node_info_schema_uri "http://nodeinfo.diaspora.software/ns/schema/" @node_info_schema_uri "http://nodeinfo.diaspora.software/ns/schema/"

View File

@ -1,13 +1,13 @@
defmodule MobilizonWeb.PageController do defmodule Mobilizon.Web.PageController do
@moduledoc """ @moduledoc """
Controller to load our webapp Controller to load our webapp
""" """
use MobilizonWeb, :controller use Mobilizon.Web, :controller
alias MobilizonWeb.Cache alias Mobilizon.Web.Cache
plug(:put_layout, false) plug(:put_layout, false)
action_fallback(MobilizonWeb.FallbackController) action_fallback(Mobilizon.Web.FallbackController)
def index(conn, _params), do: render(conn, :index) def index(conn, _params), do: render(conn, :index)

View File

@ -3,16 +3,16 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/web_finger/web_finger_controller.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/web_finger/web_finger_controller.ex
defmodule MobilizonWeb.WebFingerController do defmodule Mobilizon.Web.WebFingerController do
@moduledoc """ @moduledoc """
Handles Webfinger requests Handles Webfinger requests
""" """
use MobilizonWeb, :controller use Mobilizon.Web, :controller
alias Mobilizon.Federation.WebFinger alias Mobilizon.Federation.WebFinger
plug(MobilizonWeb.Plugs.Federating) plug(Mobilizon.Web.Plugs.Federating)
@doc """ @doc """
Provides /.well-known/host-meta Provides /.well-known/host-meta

View File

@ -1,23 +1,23 @@
defmodule MobilizonWeb.Email.Admin do defmodule Mobilizon.Web.Email.Admin do
@moduledoc """ @moduledoc """
Handles emails sent to admins. Handles emails sent to admins.
""" """
use Bamboo.Phoenix, view: MobilizonWeb.EmailView use Bamboo.Phoenix, view: Mobilizon.Web.EmailView
import Bamboo.Phoenix import Bamboo.Phoenix
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
alias Mobilizon.Config alias Mobilizon.Config
alias Mobilizon.Reports.Report alias Mobilizon.Reports.Report
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias MobilizonWeb.Email alias Mobilizon.Web.Email
@spec report(User.t(), Report.t(), String.t()) :: Bamboo.Email.t() @spec report(User.t(), Report.t(), String.t()) :: Bamboo.Email.t()
def report(%User{email: email}, %Report{} = report, locale \\ "en") do def report(%User{email: email}, %Report{} = report, locale \\ "en") do
MobilizonWeb.Gettext.put_locale(locale) Mobilizon.Web.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -1,4 +1,4 @@
defmodule MobilizonWeb.Email.Checker do defmodule Mobilizon.Web.Email.Checker do
@moduledoc """ @moduledoc """
Provides a function to test emails against a "not so bad" regex. Provides a function to test emails against a "not so bad" regex.
""" """

View File

@ -1,9 +1,9 @@
defmodule MobilizonWeb.Email do defmodule Mobilizon.Web.Email do
@moduledoc """ @moduledoc """
The Email context. The Email context.
""" """
use Bamboo.Phoenix, view: MobilizonWeb.EmailView use Bamboo.Phoenix, view: Mobilizon.Web.EmailView
alias Mobilizon.Config alias Mobilizon.Config
@ -16,7 +16,7 @@ defmodule MobilizonWeb.Email do
|> from({Config.instance_name(), Config.instance_email_from()}) |> from({Config.instance_name(), Config.instance_email_from()})
|> put_header("Reply-To", Config.instance_email_reply_to()) |> put_header("Reply-To", Config.instance_email_reply_to())
|> assign(:instance, instance) |> assign(:instance, instance)
|> put_html_layout({MobilizonWeb.EmailView, "email.html"}) |> put_html_layout({Mobilizon.Web.EmailView, "email.html"})
|> put_text_layout({MobilizonWeb.EmailView, "email.text"}) |> put_text_layout({Mobilizon.Web.EmailView, "email.text"})
end end
end end

View File

@ -1,13 +1,13 @@
defmodule MobilizonWeb.Email.Event do defmodule Mobilizon.Web.Email.Event do
@moduledoc """ @moduledoc """
Handles emails sent about events. Handles emails sent about events.
""" """
use Bamboo.Phoenix, view: MobilizonWeb.EmailView use Bamboo.Phoenix, view: Mobilizon.Web.EmailView
import Bamboo.Phoenix import Bamboo.Phoenix
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Events alias Mobilizon.Events
@ -15,7 +15,7 @@ defmodule MobilizonWeb.Email.Event do
alias Mobilizon.Storage.Repo alias Mobilizon.Storage.Repo
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias MobilizonWeb.Email alias Mobilizon.Web.Email
@important_changes [:title, :begins_on, :ends_on, :status] @important_changes [:title, :begins_on, :ends_on, :status]
@ -29,7 +29,7 @@ defmodule MobilizonWeb.Email.Event do
changes, changes,
locale \\ "en" locale \\ "en"
) do ) do
MobilizonWeb.Gettext.put_locale(locale) Mobilizon.Web.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -1,4 +1,4 @@
defmodule MobilizonWeb.Email.Mailer do defmodule Mobilizon.Web.Email.Mailer do
@moduledoc """ @moduledoc """
Mobilizon Mailer. Mobilizon Mailer.
""" """

View File

@ -1,19 +1,19 @@
defmodule MobilizonWeb.Email.Participation do defmodule Mobilizon.Web.Email.Participation do
@moduledoc """ @moduledoc """
Handles emails sent about participation. Handles emails sent about participation.
""" """
use Bamboo.Phoenix, view: MobilizonWeb.EmailView use Bamboo.Phoenix, view: Mobilizon.Web.EmailView
import Bamboo.Phoenix import Bamboo.Phoenix
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Events.Participant alias Mobilizon.Events.Participant
alias MobilizonWeb.Email alias Mobilizon.Web.Email
@doc """ @doc """
Send emails to local user Send emails to local user
@ -46,7 +46,7 @@ defmodule MobilizonWeb.Email.Participation do
%Participant{event: event, role: :rejected}, %Participant{event: event, role: :rejected},
locale locale
) do ) do
MobilizonWeb.Gettext.put_locale(locale) Mobilizon.Web.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(
@ -67,7 +67,7 @@ defmodule MobilizonWeb.Email.Participation do
%Participant{event: event, role: :participant}, %Participant{event: event, role: :participant},
locale locale
) do ) do
MobilizonWeb.Gettext.put_locale(locale) Mobilizon.Web.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -1,19 +1,19 @@
defmodule MobilizonWeb.Email.User do defmodule Mobilizon.Web.Email.User do
@moduledoc """ @moduledoc """
Handles emails sent to users. Handles emails sent to users.
""" """
use Bamboo.Phoenix, view: MobilizonWeb.EmailView use Bamboo.Phoenix, view: Mobilizon.Web.EmailView
import Bamboo.Phoenix import Bamboo.Phoenix
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
alias Mobilizon.{Config, Crypto, Users} alias Mobilizon.{Config, Crypto, Users}
alias Mobilizon.Storage.Repo alias Mobilizon.Storage.Repo
alias Mobilizon.Users.User alias Mobilizon.Users.User
alias MobilizonWeb.Email alias Mobilizon.Web.Email
require Logger require Logger
@ -22,7 +22,7 @@ defmodule MobilizonWeb.Email.User do
%User{email: email, confirmation_token: confirmation_token}, %User{email: email, confirmation_token: confirmation_token},
locale \\ "en" locale \\ "en"
) do ) do
MobilizonWeb.Gettext.put_locale(locale) Mobilizon.Web.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(
@ -42,7 +42,7 @@ defmodule MobilizonWeb.Email.User do
%User{email: email, reset_password_token: reset_password_token}, %User{email: email, reset_password_token: reset_password_token},
locale \\ "en" locale \\ "en"
) do ) do
MobilizonWeb.Gettext.put_locale(locale) Mobilizon.Web.Gettext.put_locale(locale)
subject = subject =
gettext( gettext(

View File

@ -1,4 +1,4 @@
defmodule MobilizonWeb.Endpoint do defmodule Mobilizon.Web.Endpoint do
@moduledoc """ @moduledoc """
Endpoint for Mobilizon app Endpoint for Mobilizon app
""" """
@ -14,12 +14,12 @@ defmodule MobilizonWeb.Endpoint do
) )
end end
socket("/graphql_socket", MobilizonWeb.GraphQLSocket, socket("/graphql_socket", Mobilizon.Web.GraphQLSocket,
websocket: true, websocket: true,
longpoll: false longpoll: false
) )
plug(MobilizonWeb.Plugs.UploadedMedia) plug(Mobilizon.Web.Plugs.UploadedMedia)
# Serve at "/" the static files from "priv/static" directory. # Serve at "/" the static files from "priv/static" directory.
# #
@ -65,5 +65,5 @@ defmodule MobilizonWeb.Endpoint do
signing_salt: "F9CCTF22" signing_salt: "F9CCTF22"
) )
plug(MobilizonWeb.Router) plug(Mobilizon.Web.Router)
end end

View File

@ -1,11 +1,11 @@
defmodule MobilizonWeb.Gettext do defmodule Mobilizon.Web.Gettext do
@moduledoc """ @moduledoc """
A module providing Internationalization with a gettext-based API. A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext), By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example: your module gains a set of macros for translations, for example:
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
# Simple translation # Simple translation
gettext "Here is the string to translate" gettext "Here is the string to translate"
@ -24,13 +24,13 @@ defmodule MobilizonWeb.Gettext do
def put_locale(locale) do def put_locale(locale) do
locale = determine_best_locale(locale) locale = determine_best_locale(locale)
Gettext.put_locale(MobilizonWeb.Gettext, locale) Gettext.put_locale(Mobilizon.Web.Gettext, locale)
end end
@spec determine_best_locale(String.t()) :: String.t() @spec determine_best_locale(String.t()) :: String.t()
def determine_best_locale(locale) do def determine_best_locale(locale) do
locale = String.trim(locale) locale = String.trim(locale)
locales = Gettext.known_locales(MobilizonWeb.Gettext) locales = Gettext.known_locales(Mobilizon.Web.Gettext)
cond do cond do
# Either it matches directly, eg: "en" => "en", "fr" => "fr", "fr_FR" => "fr_FR" # Either it matches directly, eg: "en" => "en", "fr" => "fr", "fr_FR" => "fr_FR"

View File

@ -1,12 +1,12 @@
defmodule MobilizonWeb do defmodule Mobilizon.Web do
@moduledoc """ @moduledoc """
The entrypoint for defining your web interface, such The entrypoint for defining your web interface, such
as controllers, views, channels and so on. as controllers, views, channels and so on.
This can be used in your application as: This can be used in your application as:
use MobilizonWeb, :controller use Mobilizon.Web, :controller
use MobilizonWeb, :view use Mobilizon.Web, :view
The definitions below will be executed for every view, The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused controller, etc, so keep them short and clean, focused
@ -19,18 +19,18 @@ defmodule MobilizonWeb do
def controller do def controller do
quote do quote do
use Phoenix.Controller, namespace: MobilizonWeb use Phoenix.Controller, namespace: Mobilizon.Web
import Plug.Conn import Plug.Conn
import MobilizonWeb.Router.Helpers import Mobilizon.Web.Router.Helpers
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
end end
end end
def view do def view do
quote do quote do
use Phoenix.View, use Phoenix.View,
root: "lib/mobilizon_web/templates", root: "lib/web/templates",
namespace: MobilizonWeb namespace: Mobilizon.Web
# Import convenience functions from controllers # Import convenience functions from controllers
import Phoenix.Controller, only: [get_flash: 2, view_module: 1] import Phoenix.Controller, only: [get_flash: 2, view_module: 1]
@ -38,9 +38,9 @@ defmodule MobilizonWeb do
# Use all HTML functionality (forms, tags, etc) # Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML use Phoenix.HTML
import MobilizonWeb.Router.Helpers import Mobilizon.Web.Router.Helpers
import MobilizonWeb.ErrorHelpers import Mobilizon.Web.ErrorHelpers
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
end end
end end
@ -55,7 +55,7 @@ defmodule MobilizonWeb do
def channel do def channel do
quote do quote do
use Phoenix.Channel use Phoenix.Channel
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
end end
end end

View File

@ -3,7 +3,7 @@
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule MobilizonWeb.Plugs.Federating do defmodule Mobilizon.Web.Plugs.Federating do
@moduledoc """ @moduledoc """
Restrict ActivityPub routes when not federating Restrict ActivityPub routes when not federating
""" """
@ -20,7 +20,7 @@ defmodule MobilizonWeb.Plugs.Federating do
else else
conn conn
|> put_status(404) |> put_status(404)
|> Phoenix.Controller.put_view(MobilizonWeb.ErrorView) |> Phoenix.Controller.put_view(Mobilizon.Web.ErrorView)
|> Phoenix.Controller.render("404.json") |> Phoenix.Controller.render("404.json")
|> halt() |> halt()
end end

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/plugs/http_signature.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/plugs/http_signature.ex
defmodule MobilizonWeb.Plugs.HTTPSignatures do defmodule Mobilizon.Web.Plugs.HTTPSignatures do
@moduledoc """ @moduledoc """
Plug to check HTTP Signatures on every incoming request Plug to check HTTP Signatures on every incoming request
""" """

View File

@ -3,7 +3,7 @@
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule MobilizonWeb.Plugs.MappedSignatureToIdentity do defmodule Mobilizon.Web.Plugs.MappedSignatureToIdentity do
@moduledoc """ @moduledoc """
Get actor identity from Signature when handing fetches Get actor identity from Signature when handing fetches
""" """

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/plugs/uploaded_media.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/plugs/uploaded_media.ex
defmodule MobilizonWeb.Plugs.UploadedMedia do defmodule Mobilizon.Web.Plugs.UploadedMedia do
@moduledoc """ @moduledoc """
Serves uploaded media files Serves uploaded media files
""" """
@ -41,7 +41,7 @@ defmodule MobilizonWeb.Plugs.UploadedMedia do
conn conn
end end
config = Config.get([MobilizonWeb.Upload]) config = Config.get([Mobilizon.Web.Upload])
with uploader <- Keyword.fetch!(config, :uploader), with uploader <- Keyword.fetch!(config, :uploader),
proxy_remote = Keyword.get(config, :proxy_remote, false), proxy_remote = Keyword.get(config, :proxy_remote, false),
@ -76,7 +76,7 @@ defmodule MobilizonWeb.Plugs.UploadedMedia do
end end
defp get_media(conn, {:url, url}, true, _) do defp get_media(conn, {:url, url}, true, _) do
MobilizonWeb.ReverseProxy.call(conn, url, Config.get([Mobilizon.Upload, :proxy_opts], [])) Mobilizon.Web.ReverseProxy.call(conn, url, Config.get([Mobilizon.Upload, :proxy_opts], []))
end end
defp get_media(conn, {:url, url}, _, _) do defp get_media(conn, {:url, url}, _, _) do

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/media_proxy/media_proxy.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/media_proxy/media_proxy.ex
defmodule MobilizonWeb.MediaProxy do defmodule Mobilizon.Web.MediaProxy do
@moduledoc """ @moduledoc """
Handles proxifying media files Handles proxifying media files
""" """
@ -22,7 +22,7 @@ defmodule MobilizonWeb.MediaProxy do
config = Application.get_env(:mobilizon, :media_proxy, []) config = Application.get_env(:mobilizon, :media_proxy, [])
if !Keyword.get(config, :enabled, false) or if !Keyword.get(config, :enabled, false) or
String.starts_with?(url, MobilizonWeb.Endpoint.url()) do String.starts_with?(url, Mobilizon.Web.Endpoint.url()) do
url url
else else
encode_url(url) encode_url(url)
@ -30,7 +30,7 @@ defmodule MobilizonWeb.MediaProxy do
end end
def encode_url(url) do def encode_url(url) do
secret = Application.get_env(:mobilizon, MobilizonWeb.Endpoint)[:secret_key_base] secret = Application.get_env(:mobilizon, Mobilizon.Web.Endpoint)[:secret_key_base]
# Must preserve `%2F` for compatibility with S3 # Must preserve `%2F` for compatibility with S3
# https://git.pleroma.social/pleroma/pleroma/issues/580 # https://git.pleroma.social/pleroma/pleroma/issues/580
@ -52,7 +52,7 @@ defmodule MobilizonWeb.MediaProxy do
end end
def decode_url(sig, url) do def decode_url(sig, url) do
secret = Application.get_env(:mobilizon, MobilizonWeb.Endpoint)[:secret_key_base] secret = Application.get_env(:mobilizon, Mobilizon.Web.Endpoint)[:secret_key_base]
sig = Base.url_decode64!(sig, @base64_opts) sig = Base.url_decode64!(sig, @base64_opts)
local_sig = :crypto.hmac(:sha, secret, url) local_sig = :crypto.hmac(:sha, secret, url)
@ -69,7 +69,7 @@ defmodule MobilizonWeb.MediaProxy do
def build_url(sig_base64, url_base64, filename \\ nil) do def build_url(sig_base64, url_base64, filename \\ nil) do
[ [
Config.get([:media_proxy, :base_url], MobilizonWeb.Endpoint.url()), Config.get([:media_proxy, :base_url], Mobilizon.Web.Endpoint.url()),
"proxy", "proxy",
sig_base64, sig_base64,
url_base64, url_base64,

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/reverse_proxy.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/reverse_proxy.ex
defmodule MobilizonWeb.ReverseProxy do defmodule Mobilizon.Web.ReverseProxy do
@keep_req_headers ~w(accept user-agent accept-encoding cache-control @keep_req_headers ~w(accept user-agent accept-encoding cache-control
if-modified-since if-unmodified-since if-none-match if-range range) if-modified-since if-unmodified-since if-none-match if-range range)
@resp_cache_headers ~w(etag date last-modified cache-control) @resp_cache_headers ~w(etag date last-modified cache-control)
@ -18,7 +18,7 @@ defmodule MobilizonWeb.ReverseProxy do
@moduledoc """ @moduledoc """
A reverse proxy. A reverse proxy.
MobilizonWeb.ReverseProxy.call(conn, url, options) Mobilizon.Web.ReverseProxy.call(conn, url, options)
It is not meant to be added into a plug pipeline, but to be called from another It is not meant to be added into a plug pipeline, but to be called from another
plug or controller. plug or controller.
@ -111,7 +111,7 @@ defmodule MobilizonWeb.ReverseProxy do
req_headers = build_req_headers(conn.req_headers, opts) req_headers = build_req_headers(conn.req_headers, opts)
opts = opts =
if filename = MobilizonWeb.MediaProxy.filename(url) do if filename = Mobilizon.Web.MediaProxy.filename(url) do
Keyword.put_new(opts, :attachment_name, filename) Keyword.put_new(opts, :attachment_name, filename)
else else
opts opts

View File

@ -1,12 +1,12 @@
defmodule MobilizonWeb.Router do defmodule Mobilizon.Web.Router do
@moduledoc """ @moduledoc """
Router for mobilizon app Router for mobilizon app
""" """
use MobilizonWeb, :router use Mobilizon.Web, :router
pipeline :graphql do pipeline :graphql do
# plug(:accepts, ["json"]) # plug(:accepts, ["json"])
plug(MobilizonWeb.Auth.Pipeline) plug(Mobilizon.Web.Auth.Pipeline)
end end
pipeline :well_known do pipeline :well_known do
@ -14,13 +14,13 @@ defmodule MobilizonWeb.Router do
end end
pipeline :activity_pub_signature do pipeline :activity_pub_signature do
plug(MobilizonWeb.Plugs.HTTPSignatures) plug(Mobilizon.Web.Plugs.HTTPSignatures)
plug(MobilizonWeb.Plugs.MappedSignatureToIdentity) plug(Mobilizon.Web.Plugs.MappedSignatureToIdentity)
end end
pipeline :relay do pipeline :relay do
plug(MobilizonWeb.Plugs.HTTPSignatures) plug(Mobilizon.Web.Plugs.HTTPSignatures)
plug(MobilizonWeb.Plugs.MappedSignatureToIdentity) plug(Mobilizon.Web.Plugs.MappedSignatureToIdentity)
plug(:accepts, ["activity-json", "json"]) plug(:accepts, ["activity-json", "json"])
end end
@ -60,7 +60,7 @@ defmodule MobilizonWeb.Router do
## FEDERATION ## FEDERATION
scope "/.well-known", MobilizonWeb do scope "/.well-known", Mobilizon.Web do
pipe_through(:well_known) pipe_through(:well_known)
get("/host-meta", WebFingerController, :host_meta) get("/host-meta", WebFingerController, :host_meta)
@ -69,7 +69,7 @@ defmodule MobilizonWeb.Router do
get("/nodeinfo/:version", NodeInfoController, :nodeinfo) get("/nodeinfo/:version", NodeInfoController, :nodeinfo)
end end
scope "/", MobilizonWeb do scope "/", Mobilizon.Web do
pipe_through(:activity_pub_and_html) pipe_through(:activity_pub_and_html)
pipe_through(:activity_pub_signature) pipe_through(:activity_pub_signature)
@ -78,7 +78,7 @@ defmodule MobilizonWeb.Router do
get("/comments/:uuid", PageController, :comment) get("/comments/:uuid", PageController, :comment)
end end
scope "/", MobilizonWeb do scope "/", Mobilizon.Web do
pipe_through(:activity_pub) pipe_through(:activity_pub)
get("/@:name/outbox", ActivityPubController, :outbox) get("/@:name/outbox", ActivityPubController, :outbox)
@ -86,13 +86,13 @@ defmodule MobilizonWeb.Router do
get("/@:name/followers", ActivityPubController, :followers) get("/@:name/followers", ActivityPubController, :followers)
end end
scope "/", MobilizonWeb do scope "/", Mobilizon.Web do
pipe_through(:activity_pub_signature) pipe_through(:activity_pub_signature)
post("/@:name/inbox", ActivityPubController, :inbox) post("/@:name/inbox", ActivityPubController, :inbox)
post("/inbox", ActivityPubController, :inbox) post("/inbox", ActivityPubController, :inbox)
end end
scope "/relay", MobilizonWeb do scope "/relay", Mobilizon.Web do
pipe_through(:relay) pipe_through(:relay)
get("/", ActivityPubController, :relay) get("/", ActivityPubController, :relay)
@ -101,7 +101,7 @@ defmodule MobilizonWeb.Router do
## FEED ## FEED
scope "/", MobilizonWeb do scope "/", Mobilizon.Web do
pipe_through(:atom_and_ical) pipe_through(:atom_and_ical)
get("/@:name/feed/:format", FeedController, :actor) get("/@:name/feed/:format", FeedController, :actor)
@ -111,9 +111,9 @@ defmodule MobilizonWeb.Router do
## MOBILIZON ## MOBILIZON
forward("/graphiql", Absinthe.Plug.GraphiQL, schema: MobilizonWeb.Schema) forward("/graphiql", Absinthe.Plug.GraphiQL, schema: Mobilizon.Web.Schema)
scope "/", MobilizonWeb do scope "/", Mobilizon.Web do
pipe_through(:browser) pipe_through(:browser)
# Because the "/events/:uuid" route caches all these, we need to force them # Because the "/events/:uuid" route caches all these, we need to force them
@ -127,7 +127,7 @@ defmodule MobilizonWeb.Router do
get("/moderation/reports/:id", PageController, :index, as: "moderation_report") get("/moderation/reports/:id", PageController, :index, as: "moderation_report")
end end
scope "/proxy/", MobilizonWeb do scope "/proxy/", Mobilizon.Web do
pipe_through(:remote_media) pipe_through(:remote_media)
get("/:sig/:url", MediaProxyController, :remote) get("/:sig/:url", MediaProxyController, :remote)
@ -139,7 +139,7 @@ defmodule MobilizonWeb.Router do
forward("/sent_emails", Bamboo.SentEmailViewerPlug) forward("/sent_emails", Bamboo.SentEmailViewerPlug)
end end
scope "/", MobilizonWeb do scope "/", Mobilizon.Web do
pipe_through(:browser) pipe_through(:browser)
get("/*path", PageController, :index) get("/*path", PageController, :index)

View File

@ -58,8 +58,8 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;" > <table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;" >
<tr> <tr>
<td align="center" valign="top" style="padding: 40px 10px 40px 10px;"> <td align="center" valign="top" style="padding: 40px 10px 40px 10px;">
<a href="<%= MobilizonWeb.Endpoint.url() %>" target="_blank"> <a href="<%= Mobilizon.Web.Endpoint.url() %>" target="_blank">
<img alt="<%= Mobilizon.Config.instance_name() %>" src="<%= "#{MobilizonWeb.Endpoint.url()}/img/mobilizon_logo.png" %>" width="366" height="108" style="display: block; width: 366px; max-width: 366px; min-width: 366px; font-family: 'Lato', Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px;" border="0"> <img alt="<%= Mobilizon.Config.instance_name() %>" src="<%= "#{Mobilizon.Web.Endpoint.url()}/img/mobilizon_logo.png" %>" width="366" height="108" style="display: block; width: 366px; max-width: 366px; min-width: 366px; font-family: 'Lato', Helvetica, Arial, sans-serif; color: #ffffff; font-size: 18px;" border="0">
</a> </a>
</td> </td>
</tr> </tr>

View File

@ -54,7 +54,7 @@
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= page_url(MobilizonWeb.Endpoint, :event, @event.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;"> <td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= page_url(Mobilizon.Web.Endpoint, :event, @event.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;">
<%= gettext "Go to event page" %> <%= gettext "Go to event page" %>
</a></td> </a></td>
</tr> </tr>

View File

@ -6,6 +6,6 @@
<%= gettext "An organizer just approved your participation. You're now going to this event!" %> <%= gettext "An organizer just approved your participation. You're now going to this event!" %>
<%= page_url(MobilizonWeb.Endpoint, :event, @event.id) %> <%= page_url(Mobilizon.Web.Endpoint, :event, @event.id) %>
<%= gettext "If you need to cancel your participation, just access the previous link and click on the participation button." %> <%= gettext "If you need to cancel your participation, just access the previous link and click on the participation button." %>

View File

@ -97,7 +97,7 @@
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= page_url(MobilizonWeb.Endpoint, :event, @event.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;"> <td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= page_url(Mobilizon.Web.Endpoint, :event, @event.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;">
<%= gettext "Go to event page" %> <%= gettext "Go to event page" %>
</a></td> </a></td>
</tr> </tr>

View File

@ -16,6 +16,6 @@
<%= gettext "New date and time for ending of event: %{ends_on}", ends_on: datetime_to_string(@event.ends_on, @locale) %> <%= gettext "New date and time for ending of event: %{ends_on}", ends_on: datetime_to_string(@event.ends_on, @locale) %>
<% end %> <% end %>
<%= gettext "View the updated event on: %{link}", link: page_url(MobilizonWeb.Endpoint, :event, @event.id) %> <%= gettext "View the updated event on: %{link}", link: page_url(Mobilizon.Web.Endpoint, :event, @event.id) %>
<%= gettext "If you need to cancel your participation, just access the event page through link above and click on the participation button." %> <%= gettext "If you need to cancel your participation, just access the event page through link above and click on the participation button." %>

View File

@ -57,7 +57,7 @@
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= "#{MobilizonWeb.Endpoint.url()}/password-reset/#{@token}" %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;"> <td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= "#{Mobilizon.Web.Endpoint.url()}/password-reset/#{@token}" %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;">
<%= gettext "Reset Password" %> <%= gettext "Reset Password" %>
</a></td> </a></td>
</tr> </tr>

View File

@ -6,7 +6,7 @@
<%= gettext "Resetting your password is easy. Just click the link below and follow the instructions. We'll have you up and running in no time." %> <%= gettext "Resetting your password is easy. Just click the link below and follow the instructions. We'll have you up and running in no time." %>
<%= MobilizonWeb.Endpoint.url() <> "/password-reset/#{@token}" %> <%= Mobilizon.Web.Endpoint.url() <> "/password-reset/#{@token}" %>
<%= gettext "If you didn't request this, please ignore this email. Your password won't change until you access the link below and create a new one." %> <%= gettext "If you didn't request this, please ignore this email. Your password won't change until you access the link below and create a new one." %>

View File

@ -54,7 +54,7 @@
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= "#{MobilizonWeb.Endpoint.url()}/validate/#{@token}" %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;"> <td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= "#{Mobilizon.Web.Endpoint.url()}/validate/#{@token}" %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;">
<%= gettext "Activate my account" %> <%= gettext "Activate my account" %>
</a></td> </a></td>
</tr> </tr>

View File

@ -4,4 +4,4 @@
<%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance[:name] %> <%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance[:name] %>
<%= MobilizonWeb.Endpoint.url() <> "/validate/#{@token}" %> <%= Mobilizon.Web.Endpoint.url() <> "/validate/#{@token}" %>

View File

@ -48,7 +48,7 @@
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;" > <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;" >
<p style="margin: 0;"> <p style="margin: 0;">
<h3><%= gettext "Event" %></h3> <h3><%= gettext "Event" %></h3>
<a href="<%= "#{MobilizonWeb.Endpoint.url()}/events/#{@report.event.uuid}" %>" target="_blank"> <a href="<%= "#{Mobilizon.Web.Endpoint.url()}/events/#{@report.event.uuid}" %>" target="_blank">
<%= gettext "%{title} by %{creator}", title: @report.event.title, creator: Mobilizon.Actors.Actor.preferred_username_and_domain(@report.reported) %> <%= gettext "%{title} by %{creator}", title: @report.event.title, creator: Mobilizon.Actors.Actor.preferred_username_and_domain(@report.reported) %>
</a> </a>
</p> </p>
@ -100,7 +100,7 @@
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= moderation_report_url(MobilizonWeb.Endpoint, :index, @report.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;"> <td align="center" style="border-radius: 3px;" bgcolor="#424056"><a href="<%= moderation_report_url(Mobilizon.Web.Endpoint, :index, @report.id) %>" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #424056; display: inline-block;">
<%= gettext "View the report" %> <%= gettext "View the report" %>
</a></td> </a></td>
</tr> </tr>

View File

@ -25,5 +25,5 @@
<% end %> <% end %>
View the report: <%= moderation_report_url(MobilizonWeb.Endpoint, :index, @report.id) %> View the report: <%= moderation_report_url(Mobilizon.Web.Endpoint, :index, @report.id) %>

View File

@ -3,21 +3,21 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter/anonymize_filename.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter/anonymize_filename.ex
defmodule MobilizonWeb.Upload.Filter.AnonymizeFilename do defmodule Mobilizon.Web.Upload.Filter.AnonymizeFilename do
@moduledoc """ @moduledoc """
Replaces the original filename with a pre-defined text or randomly generated string. Replaces the original filename with a pre-defined text or randomly generated string.
Should be used after `MobilizonWeb.Upload.Filter.Dedupe`. Should be used after `Mobilizon.Web.Upload.Filter.Dedupe`.
""" """
@behaviour MobilizonWeb.Upload.Filter @behaviour Mobilizon.Web.Upload.Filter
alias Mobilizon.Config alias Mobilizon.Config
def filter(upload) do def filter(upload) do
extension = List.last(String.split(upload.name, ".")) extension = List.last(String.split(upload.name, "."))
name = Config.get([__MODULE__, :text], random(extension)) name = Config.get([__MODULE__, :text], random(extension))
{:ok, %MobilizonWeb.Upload{upload | name: name}} {:ok, %Mobilizon.Web.Upload{upload | name: name}}
end end
defp random(extension) do defp random(extension) do

View File

@ -3,12 +3,12 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter/dedupe.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter/dedupe.ex
defmodule MobilizonWeb.Upload.Filter.Dedupe do defmodule Mobilizon.Web.Upload.Filter.Dedupe do
@moduledoc """ @moduledoc """
Names the file after its hash to avoid dedupes Names the file after its hash to avoid dedupes
""" """
@behaviour MobilizonWeb.Upload.Filter @behaviour Mobilizon.Web.Upload.Filter
alias MobilizonWeb.Upload alias Mobilizon.Web.Upload
def filter(%Upload{name: name} = upload) do def filter(%Upload{name: name} = upload) do
extension = name |> String.split(".") |> List.last() extension = name |> String.split(".") |> List.last()

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter.ex
defmodule MobilizonWeb.Upload.Filter do defmodule Mobilizon.Web.Upload.Filter do
@moduledoc """ @moduledoc """
Upload Filter behaviour Upload Filter behaviour
@ -16,11 +16,11 @@ defmodule MobilizonWeb.Upload.Filter do
require Logger require Logger
@callback filter(MobilizonWeb.Upload.t()) :: @callback filter(Mobilizon.Web.Upload.t()) ::
:ok | {:ok, MobilizonWeb.Upload.t()} | {:error, any()} :ok | {:ok, Mobilizon.Web.Upload.t()} | {:error, any()}
@spec filter([module()], MobilizonWeb.Upload.t()) :: @spec filter([module()], Mobilizon.Web.Upload.t()) ::
{:ok, MobilizonWeb.Upload.t()} | {:error, any()} {:ok, Mobilizon.Web.Upload.t()} | {:error, any()}
def filter([], upload) do def filter([], upload) do
{:ok, upload} {:ok, upload}

View File

@ -3,19 +3,19 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter/mogrify.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload/filter/mogrify.ex
defmodule MobilizonWeb.Upload.Filter.Mogrify do defmodule Mobilizon.Web.Upload.Filter.Mogrify do
@moduledoc """ @moduledoc """
Handle mogrify transformations Handle mogrify transformations
""" """
@behaviour MobilizonWeb.Upload.Filter @behaviour Mobilizon.Web.Upload.Filter
alias Mobilizon.Config alias Mobilizon.Config
@type conversion :: action :: String.t() | {action :: String.t(), opts :: String.t()} @type conversion :: action :: String.t() | {action :: String.t(), opts :: String.t()}
@type conversions :: conversion() | [conversion()] @type conversions :: conversion() | [conversion()]
def filter(%MobilizonWeb.Upload{tempfile: file, content_type: "image" <> _}) do def filter(%Mobilizon.Web.Upload{tempfile: file, content_type: "image" <> _}) do
filters = Config.get!([__MODULE__, :args]) filters = Config.get!([__MODULE__, :args])
file file

View File

@ -1,9 +1,9 @@
defmodule MobilizonWeb.Upload.Filter.Optimize do defmodule Mobilizon.Web.Upload.Filter.Optimize do
@moduledoc """ @moduledoc """
Handle picture optimizations Handle picture optimizations
""" """
@behaviour MobilizonWeb.Upload.Filter @behaviour Mobilizon.Web.Upload.Filter
alias Mobilizon.Config alias Mobilizon.Config
@ -16,7 +16,7 @@ defmodule MobilizonWeb.Upload.Filter.Optimize do
Cwebp Cwebp
] ]
def filter(%MobilizonWeb.Upload{tempfile: file, content_type: "image" <> _}) do def filter(%Mobilizon.Web.Upload{tempfile: file, content_type: "image" <> _}) do
optimizers = Config.get([__MODULE__, :optimizers], @default_optimizers) optimizers = Config.get([__MODULE__, :optimizers], @default_optimizers)
case ExOptimizer.optimize(file, deps: optimizers) do case ExOptimizer.optimize(file, deps: optimizers) do

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/mime.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/mime.ex
defmodule MobilizonWeb.Upload.MIME do defmodule Mobilizon.Web.Upload.MIME do
@moduledoc """ @moduledoc """
Returns the mime-type of a binary and optionally a normalized file-name. Returns the mime-type of a binary and optionally a normalized file-name.
""" """

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/upload.ex
defmodule MobilizonWeb.Upload do defmodule Mobilizon.Web.Upload do
@moduledoc """ @moduledoc """
Manage user uploads Manage user uploads
@ -16,7 +16,7 @@ defmodule MobilizonWeb.Upload do
* `:size_limit`: override size limit * `:size_limit`: override size limit
* `:activity_type`: override activity type * `:activity_type`: override activity type
The `%MobilizonWeb.Upload{}` struct: all documented fields are meant to be overwritten in filters: The `%Mobilizon.Web.Upload{}` struct: all documented fields are meant to be overwritten in filters:
* `:id` - the upload id. * `:id` - the upload id.
* `:name` - the upload file name. * `:name` - the upload file name.
@ -27,8 +27,8 @@ defmodule MobilizonWeb.Upload do
Related behaviors: Related behaviors:
* `MobilizonWeb.Upload.Uploader` * `Mobilizon.Web.Upload.Uploader`
* `MobilizonWeb.Upload.Filter` * `Mobilizon.Web.Upload.Filter`
""" """
@ -36,7 +36,7 @@ defmodule MobilizonWeb.Upload do
alias Mobilizon.Config alias Mobilizon.Config
alias MobilizonWeb.Upload.{Filter, MIME, Uploader} alias Mobilizon.Web.Upload.{Filter, MIME, Uploader}
require Logger require Logger
@ -91,7 +91,7 @@ defmodule MobilizonWeb.Upload do
def remove(url, opts \\ []) do def remove(url, opts \\ []) do
with opts <- get_opts(opts), with opts <- get_opts(opts),
%URI{path: "/media/" <> path, host: host} <- URI.parse(url), %URI{path: "/media/" <> path, host: host} <- URI.parse(url),
{:same_host, true} <- {:same_host, host == MobilizonWeb.Endpoint.host()} do {:same_host, true} <- {:same_host, host == Mobilizon.Web.Endpoint.host()} do
Uploader.remove_file(opts.uploader, path) Uploader.remove_file(opts.uploader, path)
else else
%URI{} = _uri -> %URI{} = _uri ->
@ -129,7 +129,7 @@ defmodule MobilizonWeb.Upload do
Keyword.get( Keyword.get(
opts, opts,
:base_url, :base_url,
Config.get([__MODULE__, :base_url], MobilizonWeb.Endpoint.url()) Config.get([__MODULE__, :base_url], Mobilizon.Web.Endpoint.url())
) )
} }
end end

View File

@ -3,12 +3,12 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/uploaders/local.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/uploaders/local.ex
defmodule MobilizonWeb.Upload.Uploader.Local do defmodule Mobilizon.Web.Upload.Uploader.Local do
@moduledoc """ @moduledoc """
Local uploader for files Local uploader for files
""" """
@behaviour MobilizonWeb.Upload.Uploader @behaviour Mobilizon.Web.Upload.Uploader
alias Mobilizon.Config alias Mobilizon.Config

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/uploaders/uploader.ex # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/uploaders/uploader.ex
defmodule MobilizonWeb.Upload.Uploader do defmodule Mobilizon.Web.Upload.Uploader do
@moduledoc """ @moduledoc """
Defines the contract to put and get an uploaded file to any backend. Defines the contract to put and get an uploaded file to any backend.
""" """
@ -11,7 +11,7 @@ defmodule MobilizonWeb.Upload.Uploader do
@doc """ @doc """
Instructs how to get the file from the backend. Instructs how to get the file from the backend.
Used by `MobilizonWeb.Plugs.UploadedMedia`. Used by `Mobilizon.Web.Plugs.UploadedMedia`.
""" """
@type get_method :: {:static_dir, directory :: String.t()} | {:url, url :: String.t()} @type get_method :: {:static_dir, directory :: String.t()} | {:url, url :: String.t()}
@callback get_file(file :: String.t()) :: {:ok, get_method()} @callback get_file(file :: String.t()) :: {:ok, get_method()}
@ -32,7 +32,7 @@ defmodule MobilizonWeb.Upload.Uploader do
""" """
@type file_spec :: {:file | :url, String.t()} @type file_spec :: {:file | :url, String.t()}
@callback put_file(MobilizonWeb.Upload.t()) :: @callback put_file(Mobilizon.Web.Upload.t()) ::
:ok | {:ok, file_spec()} | {:error, String.t()} | :wait_callback :ok | {:ok, file_spec()} | {:error, String.t()} | :wait_callback
@callback remove_file(file_spec()) :: :ok | {:ok, file_spec()} | {:error, String.t()} @callback remove_file(file_spec()) :: :ok | {:ok, file_spec()} | {:error, String.t()}
@ -43,7 +43,7 @@ defmodule MobilizonWeb.Upload.Uploader do
| {:error, Plug.Conn.t(), String.t()} | {:error, Plug.Conn.t(), String.t()}
@optional_callbacks http_callback: 2 @optional_callbacks http_callback: 2
@spec put_file(module(), MobilizonWeb.Upload.t()) :: {:ok, file_spec()} | {:error, String.t()} @spec put_file(module(), Mobilizon.Web.Upload.t()) :: {:ok, file_spec()} | {:error, String.t()}
def put_file(uploader, upload) do def put_file(uploader, upload) do
case uploader.put_file(upload) do case uploader.put_file(upload) do
:ok -> {:ok, {:file, upload.path}} :ok -> {:ok, {:file, upload.path}}

View File

@ -1,5 +1,5 @@
defmodule MobilizonWeb.ActivityPub.ActorView do defmodule Mobilizon.Web.ActivityPub.ActorView do
use MobilizonWeb, :view use Mobilizon.Web, :view
alias Mobilizon.Actors alias Mobilizon.Actors
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor

View File

@ -1,5 +1,5 @@
defmodule MobilizonWeb.ActivityPub.ObjectView do defmodule Mobilizon.Web.ActivityPub.ObjectView do
use MobilizonWeb, :view use Mobilizon.Web, :view
alias Mobilizon.Federation.ActivityPub.{Activity, Utils} alias Mobilizon.Federation.ActivityPub.{Activity, Utils}

View File

@ -1,14 +1,14 @@
defmodule MobilizonWeb.ChangesetView do defmodule Mobilizon.Web.ChangesetView do
@moduledoc """ @moduledoc """
View for changesets in case of errors View for changesets in case of errors
""" """
use MobilizonWeb, :view use Mobilizon.Web, :view
@doc """ @doc """
Traverses and translates changeset errors. Traverses and translates changeset errors.
See `Ecto.Changeset.traverse_errors/2` and See `Ecto.Changeset.traverse_errors/2` and
`MobilizonWeb.ErrorHelpers.translate_error/1` for more details. `Mobilizon.Web.ErrorHelpers.translate_error/1` for more details.
""" """
def translate_errors(changeset) do def translate_errors(changeset) do
Ecto.Changeset.traverse_errors(changeset, &translate_error/1) Ecto.Changeset.traverse_errors(changeset, &translate_error/1)

View File

@ -1,7 +1,7 @@
defmodule MobilizonWeb.EmailView do defmodule Mobilizon.Web.EmailView do
use MobilizonWeb, :view use Mobilizon.Web, :view
import MobilizonWeb.Gettext import Mobilizon.Web.Gettext
def datetime_to_string(%DateTime{} = datetime, locale \\ "en") do def datetime_to_string(%DateTime{} = datetime, locale \\ "en") do
with {:ok, string} <- with {:ok, string} <-

View File

@ -1,4 +1,4 @@
defmodule MobilizonWeb.ErrorHelpers do defmodule Mobilizon.Web.ErrorHelpers do
@moduledoc """ @moduledoc """
Conveniences for translating and building error messages. Conveniences for translating and building error messages.
""" """
@ -32,9 +32,9 @@ defmodule MobilizonWeb.ErrorHelpers do
# dgettext "errors", "is invalid" # dgettext "errors", "is invalid"
# #
if count = opts[:count] do if count = opts[:count] do
Gettext.dngettext(MobilizonWeb.Gettext, "errors", msg, msg, count, opts) Gettext.dngettext(Mobilizon.Web.Gettext, "errors", msg, msg, count, opts)
else else
Gettext.dgettext(MobilizonWeb.Gettext, "errors", msg, opts) Gettext.dgettext(Mobilizon.Web.Gettext, "errors", msg, opts)
end end
end end
end end

View File

@ -1,8 +1,8 @@
defmodule MobilizonWeb.ErrorView do defmodule Mobilizon.Web.ErrorView do
@moduledoc """ @moduledoc """
View for errors View for errors
""" """
use MobilizonWeb, :view use Mobilizon.Web, :view
def render("404.html", _assigns) do def render("404.html", _assigns) do
with {:ok, index_content} <- File.read(index_file_path()) do with {:ok, index_content} <- File.read(index_file_path()) do

View File

@ -1,12 +1,12 @@
defmodule MobilizonWeb.JsonLD.ObjectView do defmodule Mobilizon.Web.JsonLD.ObjectView do
use MobilizonWeb, :view use Mobilizon.Web, :view
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Addresses.Address alias Mobilizon.Addresses.Address
alias Mobilizon.Events.Event alias Mobilizon.Events.Event
alias MobilizonWeb.JsonLD.ObjectView alias Mobilizon.Web.JsonLD.ObjectView
alias MobilizonWeb.MediaProxy alias Mobilizon.Web.MediaProxy
def render("event.json", %{event: %Event{} = event}) do def render("event.json", %{event: %Event{} = event}) do
# TODO: event.description is actually markdown! # TODO: event.description is actually markdown!

View File

@ -0,0 +1,3 @@
defmodule Mobilizon.Web.LayoutView do
use Mobilizon.Web, :view
end

View File

@ -1,9 +1,9 @@
defmodule MobilizonWeb.PageView do defmodule Mobilizon.Web.PageView do
@moduledoc """ @moduledoc """
View for our webapp View for our webapp
""" """
use MobilizonWeb, :view use Mobilizon.Web, :view
alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Actor
alias Mobilizon.Events.{Comment, Event} alias Mobilizon.Events.{Comment, Event}

196
mix.exs
View File

@ -159,10 +159,10 @@ defmodule Mobilizon.Mixfile do
groups_for_modules: groups_for_modules(), groups_for_modules: groups_for_modules(),
nest_modules_by_prefix: [ nest_modules_by_prefix: [
Mobilizon, Mobilizon,
MobilizonWeb, Mobilizon.Web,
Mobilizon.Service.Geospatial, Mobilizon.Service.Geospatial,
MobilizonWeb.Resolvers, Mobilizon.Web.Resolvers,
MobilizonWeb.Schema, Mobilizon.Web.Schema,
Mobilizon.Service Mobilizon.Service
] ]
] ]
@ -216,56 +216,56 @@ defmodule Mobilizon.Mixfile do
Mobilizon.Federation.ActivityPub.Activity Mobilizon.Federation.ActivityPub.Activity
], ],
APIs: [ APIs: [
MobilizonWeb.API.Comments, Mobilizon.Web.API.Comments,
MobilizonWeb.API.Events, Mobilizon.Web.API.Events,
MobilizonWeb.API.Follows, Mobilizon.Web.API.Follows,
MobilizonWeb.API.Groups, Mobilizon.Web.API.Groups,
MobilizonWeb.API.Participations, Mobilizon.Web.API.Participations,
MobilizonWeb.API.Reports, Mobilizon.Web.API.Reports,
MobilizonWeb.API.Search, Mobilizon.Web.API.Search,
MobilizonWeb.API.Utils Mobilizon.Web.API.Utils
], ],
Web: [ Web: [
MobilizonWeb, Mobilizon.Web,
MobilizonWeb.Endpoint, Mobilizon.Web.Endpoint,
MobilizonWeb.Router, Mobilizon.Web.Router,
MobilizonWeb.Router.Helpers, Mobilizon.Web.Router.Helpers,
MobilizonWeb.Plugs.UploadedMedia, Mobilizon.Web.Plugs.UploadedMedia,
MobilizonWeb.FallbackController, Mobilizon.Web.FallbackController,
MobilizonWeb.FeedController, Mobilizon.Web.FeedController,
MobilizonWeb.MediaProxyController, Mobilizon.Web.MediaProxyController,
MobilizonWeb.PageController, Mobilizon.Web.PageController,
MobilizonWeb.ChangesetView, Mobilizon.Web.ChangesetView,
MobilizonWeb.JsonLD.ObjectView, Mobilizon.Web.JsonLD.ObjectView,
MobilizonWeb.EmailView, Mobilizon.Web.EmailView,
MobilizonWeb.ErrorHelpers, Mobilizon.Web.ErrorHelpers,
MobilizonWeb.ErrorView, Mobilizon.Web.ErrorView,
MobilizonWeb.LayoutView, Mobilizon.Web.LayoutView,
MobilizonWeb.PageView, Mobilizon.Web.PageView,
MobilizonWeb.Auth.Context, Mobilizon.Web.Auth.Context,
MobilizonWeb.Auth.ErrorHandler, Mobilizon.Web.Auth.ErrorHandler,
MobilizonWeb.Auth.Guardian, Mobilizon.Web.Auth.Guardian,
MobilizonWeb.Auth.Pipeline, Mobilizon.Web.Auth.Pipeline,
MobilizonWeb.Cache, Mobilizon.Web.Cache,
MobilizonWeb.Cache.ActivityPub, Mobilizon.Web.Cache.ActivityPub,
MobilizonWeb.Email, Mobilizon.Web.Email,
MobilizonWeb.Email.Admin, Mobilizon.Web.Email.Admin,
MobilizonWeb.Email.Checker, Mobilizon.Web.Email.Checker,
MobilizonWeb.Email.Event, Mobilizon.Web.Email.Event,
MobilizonWeb.Email.Mailer, Mobilizon.Web.Email.Mailer,
MobilizonWeb.Email.Participation, Mobilizon.Web.Email.Participation,
MobilizonWeb.Email.User, Mobilizon.Web.Email.User,
MobilizonWeb.Upload, Mobilizon.Web.Upload,
MobilizonWeb.Upload.Filter, Mobilizon.Web.Upload.Filter,
MobilizonWeb.Upload.Filter.AnonymizeFilename, Mobilizon.Web.Upload.Filter.AnonymizeFilename,
MobilizonWeb.Upload.Filter.Dedupe, Mobilizon.Web.Upload.Filter.Dedupe,
MobilizonWeb.Upload.Filter.Mogrify, Mobilizon.Web.Upload.Filter.Mogrify,
MobilizonWeb.Upload.Filter.Optimize, Mobilizon.Web.Upload.Filter.Optimize,
MobilizonWeb.Upload.MIME, Mobilizon.Web.Upload.MIME,
MobilizonWeb.Upload.Uploader, Mobilizon.Web.Upload.Uploader,
MobilizonWeb.Upload.Uploader.Local, Mobilizon.Web.Upload.Uploader.Local,
MobilizonWeb.MediaProxy, Mobilizon.Web.MediaProxy,
MobilizonWeb.ReverseProxy Mobilizon.Web.ReverseProxy
], ],
Geospatial: [ Geospatial: [
Mobilizon.Service.Geospatial, Mobilizon.Service.Geospatial,
@ -280,47 +280,47 @@ defmodule Mobilizon.Mixfile do
], ],
Localization: [ Localization: [
Mobilizon.Cldr, Mobilizon.Cldr,
MobilizonWeb.Gettext Mobilizon.Web.Gettext
], ],
GraphQL: [ GraphQL: [
MobilizonWeb.GraphQLSocket, Mobilizon.Web.GraphQLSocket,
MobilizonWeb.Resolvers.Address, Mobilizon.Web.Resolvers.Address,
MobilizonWeb.Resolvers.Admin, Mobilizon.Web.Resolvers.Admin,
MobilizonWeb.Resolvers.Comment, Mobilizon.Web.Resolvers.Comment,
MobilizonWeb.Resolvers.Config, Mobilizon.Web.Resolvers.Config,
MobilizonWeb.Resolvers.Event, Mobilizon.Web.Resolvers.Event,
MobilizonWeb.Resolvers.FeedToken, Mobilizon.Web.Resolvers.FeedToken,
MobilizonWeb.Resolvers.Group, Mobilizon.Web.Resolvers.Group,
MobilizonWeb.Resolvers.Member, Mobilizon.Web.Resolvers.Member,
MobilizonWeb.Resolvers.Person, Mobilizon.Web.Resolvers.Person,
MobilizonWeb.Resolvers.Picture, Mobilizon.Web.Resolvers.Picture,
MobilizonWeb.Resolvers.Report, Mobilizon.Web.Resolvers.Report,
MobilizonWeb.Resolvers.Search, Mobilizon.Web.Resolvers.Search,
MobilizonWeb.Resolvers.Tag, Mobilizon.Web.Resolvers.Tag,
MobilizonWeb.Resolvers.User, Mobilizon.Web.Resolvers.User,
MobilizonWeb.Schema, Mobilizon.Web.Schema,
MobilizonWeb.Schema.ActorInterface, Mobilizon.Web.Schema.ActorInterface,
MobilizonWeb.Schema.Actors.ApplicationType, Mobilizon.Web.Schema.Actors.ApplicationType,
MobilizonWeb.Schema.Actors.FollowerType, Mobilizon.Web.Schema.Actors.FollowerType,
MobilizonWeb.Schema.Actors.GroupType, Mobilizon.Web.Schema.Actors.GroupType,
MobilizonWeb.Schema.Actors.MemberType, Mobilizon.Web.Schema.Actors.MemberType,
MobilizonWeb.Schema.Actors.PersonType, Mobilizon.Web.Schema.Actors.PersonType,
MobilizonWeb.Schema.AddressType, Mobilizon.Web.Schema.AddressType,
MobilizonWeb.Schema.AdminType, Mobilizon.Web.Schema.AdminType,
MobilizonWeb.Schema.CommentType, Mobilizon.Web.Schema.CommentType,
MobilizonWeb.Schema.ConfigType, Mobilizon.Web.Schema.ConfigType,
MobilizonWeb.Schema.EventType, Mobilizon.Web.Schema.EventType,
MobilizonWeb.Schema.Events.FeedTokenType, Mobilizon.Web.Schema.Events.FeedTokenType,
MobilizonWeb.Schema.Events.ParticipantType, Mobilizon.Web.Schema.Events.ParticipantType,
MobilizonWeb.Schema.PictureType, Mobilizon.Web.Schema.PictureType,
MobilizonWeb.Schema.ReportType, Mobilizon.Web.Schema.ReportType,
MobilizonWeb.Schema.SearchType, Mobilizon.Web.Schema.SearchType,
MobilizonWeb.Schema.SortType, Mobilizon.Web.Schema.SortType,
MobilizonWeb.Schema.TagType, Mobilizon.Web.Schema.TagType,
MobilizonWeb.Schema.UserType, Mobilizon.Web.Schema.UserType,
MobilizonWeb.Schema.Utils, Mobilizon.Web.Schema.Utils,
MobilizonWeb.Schema.Custom.Point, Mobilizon.Web.Schema.Custom.Point,
MobilizonWeb.Schema.Custom.UUID Mobilizon.Web.Schema.Custom.UUID
], ],
ActivityPub: [ ActivityPub: [
Mobilizon.Federation.ActivityPub, Mobilizon.Federation.ActivityPub,
@ -345,14 +345,14 @@ defmodule Mobilizon.Mixfile do
Mobilizon.Federation.HTTPSignatures.Signature, Mobilizon.Federation.HTTPSignatures.Signature,
Mobilizon.Federation.WebFinger, Mobilizon.Federation.WebFinger,
Mobilizon.Federation.WebFinger.XmlBuilder, Mobilizon.Federation.WebFinger.XmlBuilder,
MobilizonWeb.Plugs.Federating, Mobilizon.Web.Plugs.Federating,
MobilizonWeb.Plugs.HTTPSignatures, Mobilizon.Web.Plugs.HTTPSignatures,
MobilizonWeb.Plugs.MappedSignatureToIdentity, Mobilizon.Web.Plugs.MappedSignatureToIdentity,
MobilizonWeb.ActivityPubController, Mobilizon.Web.ActivityPubController,
MobilizonWeb.NodeInfoController, Mobilizon.Web.NodeInfoController,
MobilizonWeb.WebFingerController, Mobilizon.Web.WebFingerController,
MobilizonWeb.ActivityPub.ActorView, Mobilizon.Web.ActivityPub.ActorView,
MobilizonWeb.ActivityPub.ObjectView Mobilizon.Web.ActivityPub.ObjectView
], ],
Services: [ Services: [
Mobilizon.Service.Export.Feed, Mobilizon.Service.Export.Feed,

Some files were not shown because too many files have changed in this diff Show More