Rename MobilizonWeb to Mobilizon.Web

master
rustra 3 years ago
parent b3f8d52bc9
commit 8856cc2f55
  1. 16
      config/config.exs
  2. 6
      config/dev.exs
  3. 2
      config/e2e.exs
  4. 10
      config/prod.exs
  5. 8
      config/test.exs
  6. 18
      lib/federation/activity_pub/activity_pub.ex
  7. 2
      lib/federation/activity_pub/relay.ex
  8. 2
      lib/federation/activity_pub/transmogrifier.ex
  9. 4
      lib/federation/activity_pub/utils.ex
  10. 4
      lib/federation/activity_stream/converter/actor.ex
  11. 2
      lib/federation/activity_stream/converter/picture.ex
  12. 2
      lib/federation/activity_stream/converter/utils.ex
  13. 6
      lib/federation/web_finger/web_finger.ex
  14. 2
      lib/graphql/api/participations.ex
  15. 6
      lib/graphql/resolvers/person.ex
  16. 4
      lib/graphql/resolvers/picture.ex
  17. 2
      lib/graphql/resolvers/user.ex
  18. 8
      lib/mobilizon.ex
  19. 10
      lib/mobilizon/actors/actor.ex
  20. 4
      lib/mobilizon/actors/actors.ex
  21. 2
      lib/mobilizon/actors/follower.ex
  22. 2
      lib/mobilizon/addresses/address.ex
  23. 4
      lib/mobilizon/events/comment.ex
  24. 4
      lib/mobilizon/events/event.ex
  25. 2
      lib/mobilizon/events/events.ex
  26. 2
      lib/mobilizon/events/participant.ex
  27. 2
      lib/mobilizon/media/media.ex
  28. 2
      lib/mobilizon/reports/report.ex
  29. 2
      lib/mobilizon/users/user.ex
  30. 2
      lib/mobilizon/users/users.ex
  31. 3
      lib/mobilizon_web/views/layout_view.ex
  32. 8
      lib/service/export/feed.ex
  33. 2
      lib/service/formatter/formatter.ex
  34. 2
      lib/service/metadata/actor.ex
  35. 4
      lib/service/metadata/event.ex
  36. 2
      lib/service/metadata/instance.ex
  37. 4
      lib/web/auth/context.ex
  38. 2
      lib/web/auth/error_handler.ex
  39. 2
      lib/web/auth/guardian.ex
  40. 8
      lib/web/auth/pipeline.ex
  41. 6
      lib/web/cache/activity_pub.ex
  42. 4
      lib/web/cache/cache.ex
  43. 6
      lib/web/channels/graphql_socket.ex
  44. 10
      lib/web/controllers/activity_pub_controller.ex
  45. 6
      lib/web/controllers/fallback_controller.ex
  46. 6
      lib/web/controllers/feed_controller.ex
  47. 8
      lib/web/controllers/media_proxy_controller.ex
  48. 8
      lib/web/controllers/node_info_controller.ex
  49. 8
      lib/web/controllers/page_controller.ex
  50. 6
      lib/web/controllers/web_finger_controller.ex
  51. 10
      lib/web/email/admin.ex
  52. 2
      lib/web/email/checker.ex
  53. 8
      lib/web/email/email.ex
  54. 10
      lib/web/email/event.ex
  55. 2
      lib/web/email/mailer.ex
  56. 12
      lib/web/email/participation.ex
  57. 12
      lib/web/email/user.ex
  58. 8
      lib/web/endpoint.ex
  59. 8
      lib/web/gettext.ex
  60. 24
      lib/web/mobilizon_web.ex
  61. 4
      lib/web/plugs/federating.ex
  62. 2
      lib/web/plugs/http_signatures.ex
  63. 2
      lib/web/plugs/mapped_signature_to_identity.ex
  64. 6
      lib/web/plugs/uploaded_media.ex
  65. 10
      lib/web/proxy/media_proxy.ex
  66. 6
      lib/web/proxy/reverse_proxy.ex
  67. 34
      lib/web/router.ex
  68. 4
      lib/web/templates/email/email.html.eex
  69. 0
      lib/web/templates/email/email.text.eex
  70. 2
      lib/web/templates/email/event_participation_approved.html.eex
  71. 2
      lib/web/templates/email/event_participation_approved.text.eex
  72. 0
      lib/web/templates/email/event_participation_rejected.html.eex
  73. 0
      lib/web/templates/email/event_participation_rejected.text.eex
  74. 2
      lib/web/templates/email/event_updated.html.eex
  75. 2
      lib/web/templates/email/event_updated.text.eex
  76. 2
      lib/web/templates/email/password_reset.html.eex
  77. 2
      lib/web/templates/email/password_reset.text.eex
  78. 2
      lib/web/templates/email/registration_confirmation.html.eex
  79. 2
      lib/web/templates/email/registration_confirmation.text.eex
  80. 4
      lib/web/templates/email/report.html.eex
  81. 2
      lib/web/templates/email/report.text.eex
  82. 8
      lib/web/upload/filter/anonymize_filename.ex
  83. 6
      lib/web/upload/filter/dedupe.ex
  84. 10
      lib/web/upload/filter/filter.ex
  85. 6
      lib/web/upload/filter/mogrify.ex
  86. 6
      lib/web/upload/filter/optimize.ex
  87. 2
      lib/web/upload/mime.ex
  88. 14
      lib/web/upload/upload.ex
  89. 4
      lib/web/upload/uploader/local.ex
  90. 8
      lib/web/upload/uploader/uploader.ex
  91. 4
      lib/web/views/activity_pub/actor_view.ex
  92. 4
      lib/web/views/activity_pub/object_view.ex
  93. 6
      lib/web/views/changeset_view.ex
  94. 6
      lib/web/views/email_view.ex
  95. 6
      lib/web/views/error_helpers.ex
  96. 4
      lib/web/views/error_view.ex
  97. 8
      lib/web/views/json_ld/object_view.ex
  98. 3
      lib/web/views/layout_view.ex
  99. 4
      lib/web/views/page_view.ex
  100. 196
      mix.exs
  101. Some files were not shown because too many files have changed in this diff Show More

@ -36,18 +36,18 @@ config :mime, :types, %{
}
# Configures the endpoint
config :mobilizon, MobilizonWeb.Endpoint,
config :mobilizon, Mobilizon.Web.Endpoint,
url: [host: "localhost"],
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]
# Upload configuration
config :mobilizon, MobilizonWeb.Upload,
uploader: MobilizonWeb.Upload.Uploader.Local,
config :mobilizon, Mobilizon.Web.Upload,
uploader: Mobilizon.Web.Upload.Uploader.Local,
filters: [
MobilizonWeb.Upload.Filter.Dedupe,
MobilizonWeb.Upload.Filter.Optimize
Mobilizon.Web.Upload.Filter.Dedupe,
Mobilizon.Web.Upload.Filter.Optimize
],
link_name: true,
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,
enabled: true,
@ -78,7 +78,7 @@ config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
config :mobilizon, MobilizonWeb.Auth.Guardian,
config :mobilizon, Mobilizon.Web.Auth.Guardian,
issuer: "mobilizon",
secret_key: "ty0WM7YBE3ojvxoUQxo8AERrNpfbXnIJ82ovkPdqbUFw31T5LcK8wGjaOiReVQjo"

@ -6,7 +6,7 @@ import Config
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :mobilizon, MobilizonWeb.Endpoint,
config :mobilizon, Mobilizon.Web.Endpoint,
http: [
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000
],
@ -39,7 +39,7 @@ config :mobilizon, MobilizonWeb.Endpoint,
# different ports.
# Watch static and templates for browser reloading.
config :mobilizon, MobilizonWeb.Endpoint,
config :mobilizon, Mobilizon.Web.Endpoint,
live_reload: [
patterns: [
~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
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
config :mobilizon, Mobilizon.Storage.Repo,

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

@ -1,6 +1,6 @@
import Config
config :mobilizon, MobilizonWeb.Endpoint,
config :mobilizon, Mobilizon.Web.Endpoint,
http: [
port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000,
transport_options: [socket_opts: [:inet6]]
@ -24,7 +24,7 @@ config :mobilizon, Mobilizon.Storage.Repo,
port: System.get_env("MOBILIZON_DATABASE_PORT") || "5432",
pool_size: 15
config :mobilizon, MobilizonWeb.Email.Mailer,
config :mobilizon, Mobilizon.Web.Email.Mailer,
adapter: Bamboo.SMTPAdapter,
server: "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 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],
# 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
# ever sent via http, always redirecting to https:
#
# config :mobilizon, MobilizonWeb.Endpoint,
# config :mobilizon, Mobilizon.Web.Endpoint,
# force_ssl: [hsts: true]
#
# 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
# start per endpoint:
#
# config :mobilizon, MobilizonWeb.Endpoint, server: true
# config :mobilizon, Mobilizon.Web.Endpoint, server: true
#

@ -6,7 +6,7 @@ config :mobilizon, :instance,
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :mobilizon, MobilizonWeb.Endpoint,
config :mobilizon, Mobilizon.Web.Endpoint,
http: [
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",
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,
vcr_cassette_library_dir: "test/fixtures/vcr_cassettes"

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

@ -28,7 +28,7 @@ defmodule Mobilizon.Federation.ActivityPub.Relay do
@spec get_actor() :: Actor.t() | {:error, Ecto.Changeset.t()}
def get_actor do
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
end
end

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

@ -198,7 +198,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
Save picture data from %Plug.Upload{} and return AS Link data.
"""
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} ->
picture
@ -219,7 +219,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
"""
def make_picture_data(picture) when is_map(picture) do
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)},
{:ok, %Picture{file: _file} = picture} <-
Mobilizon.Media.create_picture(%{

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

@ -34,7 +34,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Picture do
when is_bitstring(picture_url) do
with {:ok, %HTTPoison.Response{body: body}} <- HTTPoison.get(picture_url),
{: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
Mobilizon.Media.create_picture(%{
"file" => %{

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

@ -17,7 +17,7 @@ defmodule Mobilizon.Federation.WebFinger do
require Logger
def host_meta do
base_url = MobilizonWeb.Endpoint.url()
base_url = Mobilizon.Web.Endpoint.url()
{
:XRD,
@ -35,7 +35,7 @@ defmodule Mobilizon.Federation.WebFinger do
end
def webfinger(resource, "JSON") do
host = MobilizonWeb.Endpoint.host()
host = Mobilizon.Web.Endpoint.host()
regex = ~r/(acct:)?(?<name>\w+)@#{host}/
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()
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],
"links" => [
%{"rel" => "self", "type" => "application/activity+json", "href" => actor.url},

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

@ -157,7 +157,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
pic = args[key][:picture]
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})
end
else
@ -236,7 +236,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
@spec proxify_avatar(Actor.t()) :: Actor.t()
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
@spec proxify_avatar(Actor.t()) :: Actor.t()
@ -244,7 +244,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
@spec proxify_banner(Actor.t()) :: Actor.t()
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
@spec proxify_banner(Actor.t()) :: Actor.t()

@ -18,7 +18,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Picture do
@doc """
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(_parent, %{id: picture_id}, _resolution), do: do_fetch_picture(picture_id)
@ -53,7 +53,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Picture do
) do
with {:is_owned, %Actor{}} <- User.owns_actor(user, actor_id),
{:ok, %{name: _name, url: url, content_type: content_type, size: size}} <-
MobilizonWeb.Upload.store(file),
Mobilizon.Web.Upload.store(file),
args <-
args
|> Map.put(:url, url)

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

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

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

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

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

@ -65,7 +65,7 @@ defmodule Mobilizon.Addresses.Address do
@spec set_url(Ecto.Changeset.t()) :: Ecto.Changeset.t()
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)
end

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

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

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

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

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

@ -71,7 +71,7 @@ defmodule Mobilizon.Reports.Report do
@spec maybe_generate_url(Ecto.Changeset.t()) :: Ecto.Changeset.t()
defp maybe_generate_url(%Ecto.Changeset{} = changeset) do
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)
else
_ -> changeset

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

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

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

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

@ -52,7 +52,7 @@ defmodule Mobilizon.Service.Formatter do
def hashtag_handler("#" <> tag = tag_text, _buffer, _opts, acc) do
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, %{acc | tags: MapSet.put(acc.tags, {tag_text, tag})}}

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

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

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

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

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

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

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

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

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

@ -1,14 +1,14 @@
defmodule MobilizonWeb.GraphQLSocket do
defmodule Mobilizon.Web.GraphQLSocket do
use Phoenix.Socket
use Absinthe.Phoenix.Socket,
schema: MobilizonWeb.Schema
schema: Mobilizon.Web.Schema
alias Mobilizon.Users.User
def connect(%{"token" => token}, socket) do
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
authed_socket =
Absinthe.Phoenix.Socket.put_options(socket,

@ -3,8 +3,8 @@
# 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
defmodule MobilizonWeb.ActivityPubController do
use MobilizonWeb, :controller
defmodule Mobilizon.Web.ActivityPubController do
use Mobilizon.Web, :controller
alias Mobilizon.{Actors, Config}
alias Mobilizon.Actors.Actor
@ -12,14 +12,14 @@ defmodule MobilizonWeb.ActivityPubController do
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Federator
alias MobilizonWeb.ActivityPub.ActorView
alias MobilizonWeb.Cache
alias Mobilizon.Web.ActivityPub.ActorView
alias Mobilizon.Web.Cache
require Logger
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])
def relay_active?(conn, _) do

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

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

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

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

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

@ -3,16 +3,16 @@
# 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
defmodule MobilizonWeb.WebFingerController do
defmodule Mobilizon.Web.WebFingerController do
@moduledoc """
Handles Webfinger requests
"""
use MobilizonWeb, :controller
use Mobilizon.Web, :controller
alias Mobilizon.Federation.WebFinger
plug(MobilizonWeb.Plugs.Federating)
plug(Mobilizon.Web.Plugs.Federating)
@doc """
Provides /.well-known/host-meta

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

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

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

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

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

@ -1,19 +1,19 @@
defmodule MobilizonWeb.Email.Participation do
defmodule Mobilizon.Web.Email.Participation do
@moduledoc """
Handles emails sent about participation.
"""
use Bamboo.Phoenix, view: MobilizonWeb.EmailView
use Bamboo.Phoenix, view: Mobilizon.Web.EmailView
import Bamboo.Phoenix
import MobilizonWeb.Gettext
import Mobilizon.Web.Gettext
alias Mobilizon.Users.User
alias Mobilizon.Actors.Actor
alias Mobilizon.Events.Participant