Migrate to phoenix 1.7 (#626)
All checks were successful
All checks were successful
Closes #612 Co-authored-by: tusooa <tusooa@kazv.moe> Reviewed-on: #626 Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk> Co-committed-by: FloatingGhost <hannah@coffee-and-dreams.uk>
This commit is contained in:
parent
7a3529ec1c
commit
6cb40bee26
76 changed files with 426 additions and 355 deletions
|
@ -1,3 +1,14 @@
|
||||||
[
|
[
|
||||||
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}", "priv/repo/migrations/*.exs", "priv/repo/optional_migrations/**/*.exs", "priv/scrubbers/*.ex"]
|
import_deps: [:ecto, :ecto_sql, :phoenix],
|
||||||
|
subdirectories: ["priv/*/migrations"],
|
||||||
|
plugins: [Phoenix.LiveView.HTMLFormatter],
|
||||||
|
inputs: [
|
||||||
|
"mix.exs",
|
||||||
|
"*.{heex,ex,exs}",
|
||||||
|
"{config,lib,test}/**/*.{heex,ex,exs}",
|
||||||
|
"priv/*/seeds.exs",
|
||||||
|
"priv/repo/migrations/*.exs",
|
||||||
|
"priv/repo/optional_migrations/**/*.exs",
|
||||||
|
"priv/scrubbers/*.ex"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
55
.woodpecker/lint.yml
Normal file
55
.woodpecker/lint.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- &scw-secrets
|
||||||
|
- SCW_ACCESS_KEY
|
||||||
|
- SCW_SECRET_KEY
|
||||||
|
- SCW_DEFAULT_ORGANIZATION_ID
|
||||||
|
- &setup-hex "mix local.hex --force && mix local.rebar --force"
|
||||||
|
- &on-release
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- tag
|
||||||
|
branch:
|
||||||
|
- develop
|
||||||
|
- stable
|
||||||
|
- refs/tags/v*
|
||||||
|
- refs/tags/stable-*
|
||||||
|
- &on-stable
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- tag
|
||||||
|
branch:
|
||||||
|
- stable
|
||||||
|
- refs/tags/stable-*
|
||||||
|
- &on-point-release
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
branch:
|
||||||
|
- develop
|
||||||
|
- stable
|
||||||
|
- &on-pr-open
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- &tag-build "export BUILD_TAG=$${CI_COMMIT_TAG:-\"$CI_COMMIT_BRANCH\"} && export PLEROMA_BUILD_BRANCH=$BUILD_TAG"
|
||||||
|
|
||||||
|
- &clean "(rm -rf release || true) && (rm -rf _build || true) && (rm -rf /root/.mix)"
|
||||||
|
- &mix-clean "mix deps.clean --all && mix clean"
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
lint:
|
||||||
|
image: akkoma/ci-base:1.15-otp26
|
||||||
|
<<: *on-pr-open
|
||||||
|
environment:
|
||||||
|
MIX_ENV: test
|
||||||
|
commands:
|
||||||
|
- mix local.hex --force
|
||||||
|
- mix local.rebar --force
|
||||||
|
- mix deps.get
|
||||||
|
- mix compile
|
||||||
|
- mix format --check-formatted
|
|
@ -1,5 +1,8 @@
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
ELIXIR_VERSION:
|
ELIXIR_VERSION:
|
||||||
- 1.14
|
- 1.14
|
||||||
|
@ -68,15 +71,7 @@ services:
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
lint:
|
test:
|
||||||
<<: *on-pr-open
|
|
||||||
image: akkoma/ci-base:1.15
|
|
||||||
commands:
|
|
||||||
- mix local.hex --force
|
|
||||||
- mix local.rebar --force
|
|
||||||
- mix format --check-formatted
|
|
||||||
|
|
||||||
build:
|
|
||||||
image: akkoma/ci-base:${ELIXIR_VERSION}-otp${OTP_VERSION}
|
image: akkoma/ci-base:${ELIXIR_VERSION}-otp${OTP_VERSION}
|
||||||
<<: *on-pr-open
|
<<: *on-pr-open
|
||||||
environment:
|
environment:
|
||||||
|
@ -90,24 +85,9 @@ pipeline:
|
||||||
- mix local.rebar --force
|
- mix local.rebar --force
|
||||||
- mix deps.get
|
- mix deps.get
|
||||||
- mix compile
|
- mix compile
|
||||||
|
- mix ecto.drop -f -q
|
||||||
test:
|
- mix ecto.create
|
||||||
image: akkoma/ci-base:${ELIXIR_VERSION}-otp${OTP_VERSION}
|
- mix ecto.migrate
|
||||||
<<: *on-pr-open
|
- mkdir -p test/tmp
|
||||||
environment:
|
- mix test --preload-modules --exclude erratic --exclude federated --exclude mocked
|
||||||
MIX_ENV: test
|
- mix test --preload-modules --only mocked
|
||||||
POSTGRES_DB: pleroma_test_${ELIXIR_VERSION}_${OTP_VERSION}
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
DB_HOST: postgres
|
|
||||||
commands:
|
|
||||||
- mix local.hex --force
|
|
||||||
- mix local.rebar --force
|
|
||||||
- mix deps.get
|
|
||||||
- mix compile
|
|
||||||
- mix ecto.drop -f -q
|
|
||||||
- mix ecto.create
|
|
||||||
- mix ecto.migrate
|
|
||||||
- mkdir -p test/tmp
|
|
||||||
- mix test --preload-modules --exclude erratic --exclude federated --exclude mocked
|
|
||||||
- mix test --preload-modules --only mocked
|
|
||||||
|
|
|
@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
- OTP builds are now built on erlang OTP26
|
- OTP builds are now built on erlang OTP26
|
||||||
|
- The base Phoenix framework is now updated to 1.7
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Documentation issue in which a non-existing nginx file was referenced
|
||||||
|
|
||||||
## 2023.08
|
## 2023.08
|
||||||
|
|
||||||
|
|
|
@ -110,17 +110,6 @@ config :pleroma, :uri_schemes,
|
||||||
"xmpp"
|
"xmpp"
|
||||||
]
|
]
|
||||||
|
|
||||||
websocket_config = [
|
|
||||||
path: "/websocket",
|
|
||||||
serializer: [
|
|
||||||
{Phoenix.Socket.V1.JSONSerializer, "~> 1.0.0"},
|
|
||||||
{Phoenix.Socket.V2.JSONSerializer, "~> 2.0.0"}
|
|
||||||
],
|
|
||||||
timeout: 60_000,
|
|
||||||
transport_log: false,
|
|
||||||
compress: false
|
|
||||||
]
|
|
||||||
|
|
||||||
# Configures the endpoint
|
# Configures the endpoint
|
||||||
config :pleroma, Pleroma.Web.Endpoint,
|
config :pleroma, Pleroma.Web.Endpoint,
|
||||||
url: [host: "localhost"],
|
url: [host: "localhost"],
|
||||||
|
@ -130,10 +119,7 @@ config :pleroma, Pleroma.Web.Endpoint,
|
||||||
{:_,
|
{:_,
|
||||||
[
|
[
|
||||||
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
||||||
{"/websocket", Phoenix.Endpoint.CowboyWebSocket,
|
{:_, Plug.Cowboy.Handler, {Pleroma.Web.Endpoint, []}}
|
||||||
{Phoenix.Transports.WebSocket,
|
|
||||||
{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, websocket_config}}},
|
|
||||||
{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
|
|
||||||
]}
|
]}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
|
@ -236,6 +236,7 @@ defmodule Mix.Tasks.Pleroma.Emoji do
|
||||||
|
|
||||||
IO.puts("#{pack_file} has been created with the #{name} pack")
|
IO.puts("#{pack_file} has been created with the #{name} pack")
|
||||||
end
|
end
|
||||||
|
|
||||||
Pleroma.Emoji.reload()
|
Pleroma.Emoji.reload()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
alias Pleroma.UserInviteToken
|
alias Pleroma.UserInviteToken
|
||||||
alias Pleroma.Web.ActivityPub.Builder
|
alias Pleroma.Web.ActivityPub.Builder
|
||||||
alias Pleroma.Web.ActivityPub.Pipeline
|
alias Pleroma.Web.ActivityPub.Pipeline
|
||||||
|
use Pleroma.Web, :verified_routes
|
||||||
|
|
||||||
@shortdoc "Manages Pleroma users"
|
@shortdoc "Manages Pleroma users"
|
||||||
@moduledoc File.read!("docs/docs/administration/CLI_tasks/user.md")
|
@moduledoc File.read!("docs/docs/administration/CLI_tasks/user.md")
|
||||||
|
@ -113,11 +114,7 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
{:ok, token} <- Pleroma.PasswordResetToken.create_token(user) do
|
{:ok, token} <- Pleroma.PasswordResetToken.create_token(user) do
|
||||||
shell_info("Generated password reset token for #{user.nickname}")
|
shell_info("Generated password reset token for #{user.nickname}")
|
||||||
|
|
||||||
IO.puts(
|
IO.puts("URL: #{~p[/api/v1/pleroma/password_reset/#{token.token}]}")
|
||||||
"URL: #{Pleroma.Web.Router.Helpers.reset_password_url(Pleroma.Web.Endpoint,
|
|
||||||
:reset,
|
|
||||||
token.token)}"
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
_ ->
|
_ ->
|
||||||
shell_error("No local user #{nickname}")
|
shell_error("No local user #{nickname}")
|
||||||
|
@ -303,13 +300,7 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
{:ok, invite} <- UserInviteToken.create_invite(options) do
|
{:ok, invite} <- UserInviteToken.create_invite(options) do
|
||||||
shell_info("Generated user invite token " <> String.replace(invite.invite_type, "_", " "))
|
shell_info("Generated user invite token " <> String.replace(invite.invite_type, "_", " "))
|
||||||
|
|
||||||
url =
|
url = url(~p[/registration/#{invite.token}])
|
||||||
Pleroma.Web.Router.Helpers.redirect_url(
|
|
||||||
Pleroma.Web.Endpoint,
|
|
||||||
:registration_page,
|
|
||||||
invite.token
|
|
||||||
)
|
|
||||||
|
|
||||||
IO.puts(url)
|
IO.puts(url)
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
|
|
|
@ -26,7 +26,6 @@ defmodule Phoenix.Transports.WebSocket.Raw do
|
||||||
conn
|
conn
|
||||||
|> fetch_query_params
|
|> fetch_query_params
|
||||||
|> Transport.transport_log(opts[:transport_log])
|
|> Transport.transport_log(opts[:transport_log])
|
||||||
|> Transport.force_ssl(handler, endpoint, opts)
|
|
||||||
|> Transport.check_origin(handler, endpoint, opts)
|
|> Transport.check_origin(handler, endpoint, opts)
|
||||||
|
|
||||||
case conn do
|
case conn do
|
||||||
|
|
|
@ -6,10 +6,13 @@ defmodule Pleroma.Emails.AdminEmail do
|
||||||
@moduledoc "Admin emails"
|
@moduledoc "Admin emails"
|
||||||
|
|
||||||
import Swoosh.Email
|
import Swoosh.Email
|
||||||
|
use Pleroma.Web, :mailer
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
alias Pleroma.HTML
|
alias Pleroma.HTML
|
||||||
alias Pleroma.Web.Router.Helpers
|
|
||||||
|
use Phoenix.VerifiedRoutes,
|
||||||
|
endpoint: Pleroma.Web.Endpoint,
|
||||||
|
router: Pleroma.Web.Router
|
||||||
|
|
||||||
defp instance_config, do: Config.get(:instance)
|
defp instance_config, do: Config.get(:instance)
|
||||||
defp instance_name, do: instance_config()[:name]
|
defp instance_name, do: instance_config()[:name]
|
||||||
|
@ -45,7 +48,7 @@ defmodule Pleroma.Emails.AdminEmail do
|
||||||
statuses
|
statuses
|
||||||
|> Enum.map(fn
|
|> Enum.map(fn
|
||||||
%{id: id} ->
|
%{id: id} ->
|
||||||
status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, id)
|
status_url = url(~p[/notice/#{id}])
|
||||||
"<li><a href=\"#{status_url}\">#{status_url}</li>"
|
"<li><a href=\"#{status_url}\">#{status_url}</li>"
|
||||||
|
|
||||||
%{"id" => id} when is_binary(id) ->
|
%{"id" => id} when is_binary(id) ->
|
||||||
|
|
|
@ -6,12 +6,11 @@ defmodule Pleroma.Emails.UserEmail do
|
||||||
@moduledoc "User emails"
|
@moduledoc "User emails"
|
||||||
|
|
||||||
require Pleroma.Web.Gettext
|
require Pleroma.Web.Gettext
|
||||||
|
use Pleroma.Web, :mailer
|
||||||
|
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.Endpoint
|
|
||||||
alias Pleroma.Web.Gettext
|
alias Pleroma.Web.Gettext
|
||||||
alias Pleroma.Web.Router
|
|
||||||
|
|
||||||
import Swoosh.Email
|
import Swoosh.Email
|
||||||
import Phoenix.Swoosh, except: [render_body: 3]
|
import Phoenix.Swoosh, except: [render_body: 3]
|
||||||
|
@ -75,7 +74,7 @@ defmodule Pleroma.Emails.UserEmail do
|
||||||
|
|
||||||
def password_reset_email(user, token) when is_binary(token) do
|
def password_reset_email(user, token) when is_binary(token) do
|
||||||
Gettext.with_locale_or_default user.language do
|
Gettext.with_locale_or_default user.language do
|
||||||
password_reset_url = Router.Helpers.reset_password_url(Endpoint, :reset, token)
|
password_reset_url = ~p[/api/v1/pleroma/password_reset/#{token}]
|
||||||
|
|
||||||
html_body =
|
html_body =
|
||||||
Gettext.dpgettext(
|
Gettext.dpgettext(
|
||||||
|
@ -108,12 +107,7 @@ defmodule Pleroma.Emails.UserEmail do
|
||||||
to_name \\ nil
|
to_name \\ nil
|
||||||
) do
|
) do
|
||||||
Gettext.with_locale_or_default user.language do
|
Gettext.with_locale_or_default user.language do
|
||||||
registration_url =
|
registration_url = ~p[/registration/#{user_invite_token.token}]
|
||||||
Router.Helpers.redirect_url(
|
|
||||||
Endpoint,
|
|
||||||
:registration_page,
|
|
||||||
user_invite_token.token
|
|
||||||
)
|
|
||||||
|
|
||||||
html_body =
|
html_body =
|
||||||
Gettext.dpgettext(
|
Gettext.dpgettext(
|
||||||
|
@ -146,13 +140,7 @@ defmodule Pleroma.Emails.UserEmail do
|
||||||
|
|
||||||
def account_confirmation_email(user) do
|
def account_confirmation_email(user) do
|
||||||
Gettext.with_locale_or_default user.language do
|
Gettext.with_locale_or_default user.language do
|
||||||
confirmation_url =
|
confirmation_url = ~p[/api/account/confirm_email/#{user.id}/#{user.confirmation_token}]
|
||||||
Router.Helpers.confirm_email_url(
|
|
||||||
Endpoint,
|
|
||||||
:confirm_email,
|
|
||||||
user.id,
|
|
||||||
to_string(user.confirmation_token)
|
|
||||||
)
|
|
||||||
|
|
||||||
html_body =
|
html_body =
|
||||||
Gettext.dpgettext(
|
Gettext.dpgettext(
|
||||||
|
@ -342,7 +330,7 @@ defmodule Pleroma.Emails.UserEmail do
|
||||||
|> Pleroma.JWT.generate_and_sign!()
|
|> Pleroma.JWT.generate_and_sign!()
|
||||||
|> Base.encode64()
|
|> Base.encode64()
|
||||||
|
|
||||||
Router.Helpers.subscription_url(Endpoint, :unsubscribe, token)
|
~p[/mailer/unsubscribe/#{token}]
|
||||||
end
|
end
|
||||||
|
|
||||||
def backup_is_ready_email(backup, admin_user_id \\ nil) do
|
def backup_is_ready_email(backup, admin_user_id \\ nil) do
|
||||||
|
|
|
@ -44,6 +44,8 @@ defmodule Pleroma.User do
|
||||||
alias Pleroma.Web.RelMe
|
alias Pleroma.Web.RelMe
|
||||||
alias Pleroma.Workers.BackgroundWorker
|
alias Pleroma.Workers.BackgroundWorker
|
||||||
|
|
||||||
|
use Pleroma.Web, :verified_routes
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@type t :: %__MODULE__{}
|
@type t :: %__MODULE__{}
|
||||||
|
@ -2447,12 +2449,7 @@ defmodule Pleroma.User do
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_url(raw_value) do
|
if is_url(raw_value) do
|
||||||
frontend_url =
|
frontend_url = url(~p[/#{nickname}])
|
||||||
Pleroma.Web.Router.Helpers.redirect_url(
|
|
||||||
Pleroma.Web.Endpoint,
|
|
||||||
:redirector_with_meta,
|
|
||||||
nickname
|
|
||||||
)
|
|
||||||
|
|
||||||
possible_urls = [ap_id, frontend_url]
|
possible_urls = [ap_id, frontend_url]
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ defmodule Pleroma.Web do
|
||||||
alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug
|
alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug
|
||||||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||||
alias Pleroma.Web.Plugs.PlugHelper
|
alias Pleroma.Web.Plugs.PlugHelper
|
||||||
|
require Pleroma.Constants
|
||||||
|
|
||||||
def controller do
|
def controller do
|
||||||
quote do
|
quote do
|
||||||
|
@ -37,7 +38,7 @@ defmodule Pleroma.Web do
|
||||||
import Pleroma.Web.Gettext
|
import Pleroma.Web.Gettext
|
||||||
import Pleroma.Web.TranslationHelpers
|
import Pleroma.Web.TranslationHelpers
|
||||||
|
|
||||||
alias Pleroma.Web.Router.Helpers, as: Routes
|
unquote(verified_routes())
|
||||||
|
|
||||||
plug(:set_put_layout)
|
plug(:set_put_layout)
|
||||||
|
|
||||||
|
@ -184,7 +185,10 @@ defmodule Pleroma.Web do
|
||||||
|
|
||||||
# Import convenience functions from controllers
|
# Import convenience functions from controllers
|
||||||
import Phoenix.Controller,
|
import Phoenix.Controller,
|
||||||
only: [get_flash: 1, get_flash: 2, view_module: 1, view_template: 1]
|
only: [view_module: 1, view_template: 1]
|
||||||
|
|
||||||
|
import Phoenix.Flash
|
||||||
|
alias Phoenix.Flash
|
||||||
|
|
||||||
# Include shared imports and aliases for views
|
# Include shared imports and aliases for views
|
||||||
unquote(view_helpers())
|
unquote(view_helpers())
|
||||||
|
@ -218,7 +222,7 @@ defmodule Pleroma.Web do
|
||||||
|
|
||||||
def router do
|
def router do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Router
|
use Phoenix.Router, helpers: false
|
||||||
|
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import Phoenix.Controller
|
import Phoenix.Controller
|
||||||
|
@ -246,7 +250,24 @@ defmodule Pleroma.Web do
|
||||||
|
|
||||||
import Pleroma.Web.ErrorHelpers
|
import Pleroma.Web.ErrorHelpers
|
||||||
import Pleroma.Web.Gettext
|
import Pleroma.Web.Gettext
|
||||||
alias Pleroma.Web.Router.Helpers, as: Routes
|
unquote(verified_routes())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def static_paths, do: Pleroma.Constants.static_only_files()
|
||||||
|
|
||||||
|
def verified_routes do
|
||||||
|
quote do
|
||||||
|
use Phoenix.VerifiedRoutes,
|
||||||
|
endpoint: Pleroma.Web.Endpoint,
|
||||||
|
router: Pleroma.Web.Router,
|
||||||
|
statics: Pleroma.Web.static_paths()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def mailer do
|
||||||
|
quote do
|
||||||
|
unquote(verified_routes())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1792,6 +1792,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pin_data_from_featured_collection(obj) do
|
||||||
|
Logger.error("Could not parse featured collection #{inspect(obj)}")
|
||||||
|
%{}
|
||||||
|
end
|
||||||
|
|
||||||
def fetch_and_prepare_featured_from_ap_id(nil) do
|
def fetch_and_prepare_featured_from_ap_id(nil) do
|
||||||
{:ok, %{}}
|
{:ok, %{}}
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,8 @@ defmodule Pleroma.Web.ActivityPub.Builder do
|
||||||
alias Pleroma.Web.CommonAPI.ActivityDraft
|
alias Pleroma.Web.CommonAPI.ActivityDraft
|
||||||
alias Pleroma.Web.Endpoint
|
alias Pleroma.Web.Endpoint
|
||||||
|
|
||||||
|
use Pleroma.Web, :verified_routes
|
||||||
|
|
||||||
require Pleroma.Constants
|
require Pleroma.Constants
|
||||||
|
|
||||||
def accept_or_reject(actor, activity, type) do
|
def accept_or_reject(actor, activity, type) do
|
||||||
|
@ -402,6 +404,6 @@ defmodule Pleroma.Web.ActivityPub.Builder do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp pinned_url(nickname) when is_binary(nickname) do
|
defp pinned_url(nickname) when is_binary(nickname) do
|
||||||
Pleroma.Web.Router.Helpers.activity_pub_url(Pleroma.Web.Endpoint, :pinned, nickname)
|
url(~p[/users/#{nickname}/collections/featured])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,10 +16,11 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
alias Pleroma.Web.ActivityPub.Visibility
|
alias Pleroma.Web.ActivityPub.Visibility
|
||||||
alias Pleroma.Web.AdminAPI.AccountView
|
alias Pleroma.Web.AdminAPI.AccountView
|
||||||
alias Pleroma.Web.Endpoint
|
alias Pleroma.Web.Endpoint
|
||||||
alias Pleroma.Web.Router.Helpers
|
|
||||||
|
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
|
use Pleroma.Web, :verified_routes
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
require Pleroma.Constants
|
require Pleroma.Constants
|
||||||
|
|
||||||
|
@ -124,19 +125,15 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_activity_id do
|
def generate_activity_id do
|
||||||
generate_id("activities")
|
url(~p[/activities/#{UUID.generate()}])
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_context_id do
|
def generate_context_id do
|
||||||
generate_id("contexts")
|
url(~p[/contexts/#{UUID.generate()}])
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_object_id do
|
def generate_object_id do
|
||||||
Helpers.o_status_url(Endpoint, :object, UUID.generate())
|
url(~p[/objects/#{UUID.generate()}])
|
||||||
end
|
|
||||||
|
|
||||||
def generate_id(type) do
|
|
||||||
"#{Endpoint.url()}/#{type}/#{UUID.generate()}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_notified_from_object(%{"type" => type} = object) when type in @supported_object_types do
|
def get_notified_from_object(%{"type" => type} = object) when type in @supported_object_types do
|
||||||
|
@ -154,7 +151,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
Notification.get_notified_from_activity(%Activity{data: object}, false)
|
Notification.get_notified_from_activity(%Activity{data: object}, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
def maybe_create_context(context), do: context || generate_id("contexts")
|
def maybe_create_context(context), do: context || generate_context_id()
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Enqueues an activity for federation if it's local
|
Enqueues an activity for federation if it's local
|
||||||
|
|
|
@ -12,24 +12,22 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
||||||
alias Pleroma.Web.ActivityPub.ObjectView
|
alias Pleroma.Web.ActivityPub.ObjectView
|
||||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||||
alias Pleroma.Web.ActivityPub.Utils
|
alias Pleroma.Web.ActivityPub.Utils
|
||||||
alias Pleroma.Web.Endpoint
|
|
||||||
alias Pleroma.Web.Router.Helpers
|
|
||||||
|
|
||||||
require Pleroma.Web.ActivityPub.Transmogrifier
|
require Pleroma.Web.ActivityPub.Transmogrifier
|
||||||
|
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
def render("endpoints.json", %{user: %User{nickname: nil, local: true} = _user}) do
|
def render("endpoints.json", %{user: %User{nickname: nil, local: true} = _user}) do
|
||||||
%{"sharedInbox" => Helpers.activity_pub_url(Endpoint, :inbox)}
|
%{"sharedInbox" => ~p"/inbox"}
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("endpoints.json", %{user: %User{local: true} = _user}) do
|
def render("endpoints.json", %{user: %User{local: true} = _user}) do
|
||||||
%{
|
%{
|
||||||
"oauthAuthorizationEndpoint" => Helpers.o_auth_url(Endpoint, :authorize),
|
"oauthAuthorizationEndpoint" => ~p"/oauth/authorize",
|
||||||
"oauthRegistrationEndpoint" => Helpers.app_url(Endpoint, :create),
|
"oauthRegistrationEndpoint" => ~p"/api/v1/apps",
|
||||||
"oauthTokenEndpoint" => Helpers.o_auth_url(Endpoint, :token_exchange),
|
"oauthTokenEndpoint" => ~p"/oauth/token",
|
||||||
"sharedInbox" => Helpers.activity_pub_url(Endpoint, :inbox),
|
"sharedInbox" => ~p"/inbox",
|
||||||
"uploadMedia" => Helpers.activity_pub_url(Endpoint, :upload_media)
|
"uploadMedia" => ~p"/api/ap/upload_media"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
||||||
alias Pleroma.Web.AdminAPI
|
alias Pleroma.Web.AdminAPI
|
||||||
alias Pleroma.Web.AdminAPI.AccountView
|
alias Pleroma.Web.AdminAPI.AccountView
|
||||||
alias Pleroma.Web.AdminAPI.ModerationLogView
|
alias Pleroma.Web.AdminAPI.ModerationLogView
|
||||||
alias Pleroma.Web.Endpoint
|
|
||||||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||||
alias Pleroma.Web.Router
|
|
||||||
|
|
||||||
@users_page_size 50
|
@users_page_size 50
|
||||||
|
|
||||||
|
@ -256,7 +254,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
||||||
conn
|
conn
|
||||||
|> json(%{
|
|> json(%{
|
||||||
token: token.token,
|
token: token.token,
|
||||||
link: Router.Helpers.reset_password_url(Endpoint, :reset, token.token)
|
link: url(~p[/api/v1/pleroma/password_reset/#{token.token}])
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ defmodule Pleroma.Web.Endpoint do
|
||||||
Plug.Static,
|
Plug.Static,
|
||||||
at: "/",
|
at: "/",
|
||||||
from: :pleroma,
|
from: :pleroma,
|
||||||
only: Pleroma.Constants.static_only_files(),
|
only: Pleroma.Web.static_paths(),
|
||||||
# credo:disable-for-previous-line Credo.Check.Readability.MaxLineLength
|
# credo:disable-for-previous-line Credo.Check.Readability.MaxLineLength
|
||||||
gzip: true,
|
gzip: true,
|
||||||
cache_control_for_etags: @static_cache_control,
|
cache_control_for_etags: @static_cache_control,
|
||||||
|
|
|
@ -30,7 +30,7 @@ defmodule Pleroma.Web.Feed.UserController do
|
||||||
|
|
||||||
def feed_redirect(conn, %{"nickname" => nickname}) do
|
def feed_redirect(conn, %{"nickname" => nickname}) do
|
||||||
with {_, %User{} = user} <- {:fetch_user, User.get_cached_by_nickname(nickname)} do
|
with {_, %User{} = user} <- {:fetch_user, User.get_cached_by_nickname(nickname)} do
|
||||||
redirect(conn, external: "#{Routes.user_feed_url(conn, :feed, user.nickname)}.atom")
|
redirect(conn, external: "#{url(~p"/users/#{user.nickname}/feed")}.atom")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ defmodule Pleroma.Web.MastoFEController do
|
||||||
|
|
||||||
index =
|
index =
|
||||||
if flavour == "fedibird-fe" do
|
if flavour == "fedibird-fe" do
|
||||||
"fedibird.index.html"
|
"fedibird.html"
|
||||||
else
|
else
|
||||||
"glitchsoc.index.html"
|
"glitchsoc.html"
|
||||||
end
|
end
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -54,12 +54,7 @@ defmodule Pleroma.Web.MastodonAPI.AuthController do
|
||||||
defp redirect_to_oauth_form(conn, _params) do
|
defp redirect_to_oauth_form(conn, _params) do
|
||||||
with {:ok, app} <- local_mastofe_app() do
|
with {:ok, app} <- local_mastofe_app() do
|
||||||
path =
|
path =
|
||||||
Routes.o_auth_path(conn, :authorize,
|
~p[/oauth/authorize?#{[response_type: "code", client_id: app.client_id, redirect_uri: ".", scope: Enum.join(app.scopes, " ")]}]
|
||||||
response_type: "code",
|
|
||||||
client_id: app.client_id,
|
|
||||||
redirect_uri: ".",
|
|
||||||
scope: Enum.join(app.scopes, " ")
|
|
||||||
)
|
|
||||||
|
|
||||||
redirect(conn, to: path)
|
redirect(conn, to: path)
|
||||||
end
|
end
|
||||||
|
@ -91,7 +86,7 @@ defmodule Pleroma.Web.MastodonAPI.AuthController do
|
||||||
defp local_mastodon_post_login_path(conn) do
|
defp local_mastodon_post_login_path(conn) do
|
||||||
case get_session(conn, :return_to) do
|
case get_session(conn, :return_to) do
|
||||||
nil ->
|
nil ->
|
||||||
Routes.masto_fe_path(conn, :index, ["getting-started"])
|
~p"/web/getting-started"
|
||||||
|
|
||||||
return_to ->
|
return_to ->
|
||||||
delete_session(conn, :return_to)
|
delete_session(conn, :return_to)
|
||||||
|
|
|
@ -322,7 +322,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
|
|
||||||
url =
|
url =
|
||||||
if user.local do
|
if user.local do
|
||||||
Pleroma.Web.Router.Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, activity)
|
url(~p[/notice/#{activity}])
|
||||||
else
|
else
|
||||||
object.data["url"] || object.data["external_url"] || object.data["id"]
|
object.data["url"] || object.data["external_url"] || object.data["id"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule Pleroma.Web.MastodonAPI.TagView do
|
defmodule Pleroma.Web.MastodonAPI.TagView do
|
||||||
use Pleroma.Web, :view
|
use Pleroma.Web, :view
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.Router.Helpers
|
|
||||||
|
|
||||||
def render("index.json", %{tags: tags, for_user: user}) do
|
def render("index.json", %{tags: tags, for_user: user}) do
|
||||||
render_many(tags, __MODULE__, "show.json", %{for_user: user})
|
render_many(tags, __MODULE__, "show.json", %{for_user: user})
|
||||||
|
@ -17,7 +16,7 @@ defmodule Pleroma.Web.MastodonAPI.TagView do
|
||||||
|
|
||||||
%{
|
%{
|
||||||
name: tag.name,
|
name: tag.name,
|
||||||
url: Helpers.tag_feed_url(Pleroma.Web.Endpoint, :feed, tag.name),
|
url: url(~p[/tags/#{tag.name}]),
|
||||||
history: [],
|
history: [],
|
||||||
following: following
|
following: following
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Web.Metadata.Providers.Feed do
|
defmodule Pleroma.Web.Metadata.Providers.Feed do
|
||||||
alias Pleroma.Web.Endpoint
|
|
||||||
alias Pleroma.Web.Metadata.Providers.Provider
|
alias Pleroma.Web.Metadata.Providers.Provider
|
||||||
alias Pleroma.Web.Router.Helpers
|
|
||||||
|
use Pleroma.Web, :verified_routes
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ defmodule Pleroma.Web.Metadata.Providers.Feed do
|
||||||
[
|
[
|
||||||
rel: "alternate",
|
rel: "alternate",
|
||||||
type: "application/atom+xml",
|
type: "application/atom+xml",
|
||||||
href: Helpers.user_feed_path(Endpoint, :feed, user.nickname) <> ".atom"
|
href: ~p[/users/#{user.nickname}/feed.atom]
|
||||||
], []}
|
], []}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,8 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCard do
|
||||||
alias Pleroma.Web.Metadata.Providers.Provider
|
alias Pleroma.Web.Metadata.Providers.Provider
|
||||||
alias Pleroma.Web.Metadata.Utils
|
alias Pleroma.Web.Metadata.Utils
|
||||||
|
|
||||||
|
use Pleroma.Web, :verified_routes
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
@media_types ["image", "audio", "video"]
|
@media_types ["image", "audio", "video"]
|
||||||
|
|
||||||
|
@ -112,7 +114,7 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCard do
|
||||||
defp build_attachments(_id, _object), do: []
|
defp build_attachments(_id, _object), do: []
|
||||||
|
|
||||||
defp player_url(id) do
|
defp player_url(id) do
|
||||||
Pleroma.Web.Router.Helpers.o_status_url(Pleroma.Web.Endpoint, :notice_player, id)
|
url(~p[/notice/#{id}/embed_player])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Videos have problems without dimensions, but we used to not provide WxH for images.
|
# Videos have problems without dimensions, but we used to not provide WxH for images.
|
||||||
|
|
|
@ -449,7 +449,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|
||||||
|> Map.put("state", state)
|
|> Map.put("state", state)
|
||||||
|
|
||||||
# Handing the request to Ueberauth
|
# Handing the request to Ueberauth
|
||||||
redirect(conn, to: Routes.o_auth_path(conn, :request, provider, params))
|
redirect(conn, to: ~p"/oauth/#{provider}?#{params}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def request(%Plug.Conn{} = conn, params) do
|
def request(%Plug.Conn{} = conn, params) do
|
||||||
|
@ -623,7 +623,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Special case: Local MastodonFE
|
# Special case: Local MastodonFE
|
||||||
defp redirect_uri(%Plug.Conn{} = conn, "."), do: Routes.auth_url(conn, :login)
|
defp redirect_uri(_, "."), do: url(~p"/web/login")
|
||||||
|
|
||||||
defp redirect_uri(%Plug.Conn{}, redirect_uri), do: redirect_uri
|
defp redirect_uri(%Plug.Conn{}, redirect_uri), do: redirect_uri
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ defmodule Pleroma.Web.OStatus.OStatusController do
|
||||||
alias Pleroma.Web.Fallback.RedirectController
|
alias Pleroma.Web.Fallback.RedirectController
|
||||||
alias Pleroma.Web.Metadata.PlayerView
|
alias Pleroma.Web.Metadata.PlayerView
|
||||||
alias Pleroma.Web.Plugs.RateLimiter
|
alias Pleroma.Web.Plugs.RateLimiter
|
||||||
alias Pleroma.Web.Router
|
|
||||||
|
|
||||||
plug(
|
plug(
|
||||||
RateLimiter,
|
RateLimiter,
|
||||||
|
@ -87,7 +86,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do
|
||||||
%{
|
%{
|
||||||
activity_id: activity.id,
|
activity_id: activity.id,
|
||||||
object: object,
|
object: object,
|
||||||
url: Router.Helpers.o_status_url(Endpoint, :notice, activity.id),
|
url: url(~p[/notice/#{activity.id}]),
|
||||||
user: user
|
user: user
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
|
defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import Phoenix.Controller, only: [get_format: 1]
|
import Phoenix.Controller, only: [get_format: 1]
|
||||||
|
|
||||||
|
use Pleroma.Web, :verified_routes
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.Web.Router
|
|
||||||
alias Pleroma.Signature
|
alias Pleroma.Signature
|
||||||
alias Pleroma.Instances
|
alias Pleroma.Instances
|
||||||
require Logger
|
require Logger
|
||||||
|
@ -32,10 +33,10 @@ defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
|
||||||
end
|
end
|
||||||
|
|
||||||
def route_aliases(%{path_info: ["objects", id], query_string: query_string}) do
|
def route_aliases(%{path_info: ["objects", id], query_string: query_string}) do
|
||||||
ap_id = Router.Helpers.o_status_url(Pleroma.Web.Endpoint, :object, id)
|
ap_id = url(~p[/objects/#{id}])
|
||||||
|
|
||||||
with %Activity{} = activity <- Activity.get_by_object_ap_id_with_object(ap_id) do
|
with %Activity{} = activity <- Activity.get_by_object_ap_id_with_object(ap_id) do
|
||||||
["/notice/#{activity.id}", "/notice/#{activity.id}?#{query_string}"]
|
[~p"/notice/#{activity.id}", "/notice/#{activity.id}?#{query_string}"]
|
||||||
else
|
else
|
||||||
_ -> []
|
_ -> []
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,6 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
alias Pleroma.Web.ActivityPub.Visibility
|
alias Pleroma.Web.ActivityPub.Visibility
|
||||||
alias Pleroma.Web.Metadata
|
alias Pleroma.Web.Metadata
|
||||||
alias Pleroma.Web.Router.Helpers
|
|
||||||
|
|
||||||
plug(:put_layout, :static_fe)
|
plug(:put_layout, :static_fe)
|
||||||
plug(:assign_id)
|
plug(:assign_id)
|
||||||
|
@ -111,11 +110,11 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|
||||||
end
|
end
|
||||||
|
|
||||||
def show(%{assigns: %{object_id: _}} = conn, _params) do
|
def show(%{assigns: %{object_id: _}} = conn, _params) do
|
||||||
url = Helpers.url(conn) <> conn.request_path
|
url = unverified_url(conn, conn.request_path)
|
||||||
|
|
||||||
case Activity.get_create_by_object_ap_id_with_object(url) do
|
case Activity.get_create_by_object_ap_id_with_object(url) do
|
||||||
%Activity{} = activity ->
|
%Activity{} = activity ->
|
||||||
to = Helpers.o_status_path(Pleroma.Web.Endpoint, :notice, activity)
|
to = ~p[/notice/#{activity}]
|
||||||
redirect(conn, to: to)
|
redirect(conn, to: to)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -124,11 +123,11 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|
||||||
end
|
end
|
||||||
|
|
||||||
def show(%{assigns: %{activity_id: _}} = conn, _params) do
|
def show(%{assigns: %{activity_id: _}} = conn, _params) do
|
||||||
url = Helpers.url(conn) <> conn.request_path
|
url = unverified_url(conn, conn.request_path)
|
||||||
|
|
||||||
case Activity.get_by_ap_id(url) do
|
case Activity.get_by_ap_id(url) do
|
||||||
%Activity{} = activity ->
|
%Activity{} = activity ->
|
||||||
to = Helpers.o_status_path(Pleroma.Web.Endpoint, :notice, activity)
|
to = ~p[/notice/#{activity}]
|
||||||
redirect(conn, to: to)
|
redirect(conn, to: to)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -167,7 +166,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|
||||||
|
|
||||||
link =
|
link =
|
||||||
case user.local do
|
case user.local do
|
||||||
true -> Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, activity)
|
true -> ~p[/notice/#{activity}]
|
||||||
_ -> data["url"] || data["external_url"] || data["id"]
|
_ -> data["url"] || data["external_url"] || data["id"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ defmodule Pleroma.Web.StaticFE.StaticFEView do
|
||||||
alias Pleroma.Web.Gettext
|
alias Pleroma.Web.Gettext
|
||||||
alias Pleroma.Web.MediaProxy
|
alias Pleroma.Web.MediaProxy
|
||||||
alias Pleroma.Web.Metadata.Utils
|
alias Pleroma.Web.Metadata.Utils
|
||||||
alias Pleroma.Web.Router.Helpers
|
|
||||||
|
|
||||||
use Phoenix.HTML
|
use Phoenix.HTML
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<h3>After you submit, you will need to refresh manually to get your new frontend!</h3>
|
<h3>After you submit, you will need to refresh manually to get your new frontend!</h3>
|
||||||
|
|
||||||
<%= form_for @conn, Routes.frontend_switcher_path(@conn, :do_switch), fn f -> %>
|
<%= form_for @conn, ~p"/akkoma/frontend", fn f -> %>
|
||||||
<%= select(f, :frontend, @choices) %>
|
<%= select(f, :frontend, @choices) %>
|
||||||
|
|
||||||
<%= submit do: "submit" %>
|
<%= submit do: "submit" %>
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
xmlns:ostatus="http://ostatus.org/schema/1.0"
|
xmlns:ostatus="http://ostatus.org/schema/1.0"
|
||||||
xmlns:statusnet="http://status.net/schema/api/1/">
|
xmlns:statusnet="http://status.net/schema/api/1/">
|
||||||
|
|
||||||
<id><%= '#{Routes.tag_feed_url(@conn, :feed, @tag)}.rss' %></id>
|
<id><%= '#{url(~p"/tags/#{@tag}")}.rss' %></id>
|
||||||
<title>#<%= @tag %></title>
|
<title>#<%= @tag %></title>
|
||||||
|
|
||||||
<subtitle><%= Gettext.dpgettext("static_pages", "tag feed description", "These are public toots tagged with #%{tag}. You can interact with them if you have an account anywhere in the fediverse.", tag: @tag) %></subtitle>
|
<subtitle><%= Gettext.dpgettext("static_pages", "tag feed description", "These are public toots tagged with #%{tag}. You can interact with them if you have an account anywhere in the fediverse.", tag: @tag) %></subtitle>
|
||||||
<logo><%= feed_logo() %></logo>
|
<logo><%= feed_logo() %></logo>
|
||||||
<updated><%= most_recent_update(@activities) %></updated>
|
<updated><%= most_recent_update(@activities) %></updated>
|
||||||
<link rel="self" href="<%= '#{Routes.tag_feed_url(@conn, :feed, @tag)}.atom' %>" type="application/atom+xml"/>
|
<link rel="self" href="<%= '#{url(~p"/tags/#{@tag}")}.atom' %>" type="application/atom+xml"/>
|
||||||
<%= for activity <- @activities do %>
|
<%= for activity <- @activities do %>
|
||||||
<%= render @view_module, "_tag_activity.atom", Map.merge(assigns, prepare_activity(activity, actor: true)) %>
|
<%= render @view_module, "_tag_activity.atom", Map.merge(assigns, prepare_activity(activity, actor: true)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<title>#<%= @tag %></title>
|
<title>#<%= @tag %></title>
|
||||||
<description><%= Gettext.dpgettext("static_pages", "tag feed description", "These are public toots tagged with #%{tag}. You can interact with them if you have an account anywhere in the fediverse.", tag: @tag) %></description>
|
<description><%= Gettext.dpgettext("static_pages", "tag feed description", "These are public toots tagged with #%{tag}. You can interact with them if you have an account anywhere in the fediverse.", tag: @tag) %></description>
|
||||||
<link><%= '#{Routes.tag_feed_url(@conn, :feed, @tag)}.rss' %></link>
|
<link><%= '#{url(~p"/tags/#{@tag}")}.rss' %></link>
|
||||||
<webfeeds:logo><%= feed_logo() %></webfeeds:logo>
|
<webfeeds:logo><%= feed_logo() %></webfeeds:logo>
|
||||||
<webfeeds:accentColor>2b90d9</webfeeds:accentColor>
|
<webfeeds:accentColor>2b90d9</webfeeds:accentColor>
|
||||||
<%= for activity <- @activities do %>
|
<%= for activity <- @activities do %>
|
||||||
|
|
|
@ -6,16 +6,16 @@
|
||||||
xmlns:poco="http://portablecontacts.net/spec/1.0"
|
xmlns:poco="http://portablecontacts.net/spec/1.0"
|
||||||
xmlns:ostatus="http://ostatus.org/schema/1.0">
|
xmlns:ostatus="http://ostatus.org/schema/1.0">
|
||||||
|
|
||||||
<id><%= Routes.user_feed_url(@conn, :feed, @user.nickname) <> ".atom" %></id>
|
<id><%= url(~p"/users/#{@user.nickname}/feed") <> ".atom" %></id>
|
||||||
<title><%= @user.nickname <> "'s timeline" %></title>
|
<title><%= @user.nickname <> "'s timeline" %></title>
|
||||||
<updated><%= most_recent_update(@activities, @user) %></updated>
|
<updated><%= most_recent_update(@activities, @user) %></updated>
|
||||||
<logo><%= logo(@user) %></logo>
|
<logo><%= logo(@user) %></logo>
|
||||||
<link rel="self" href="<%= '#{Routes.user_feed_url(@conn, :feed, @user.nickname)}.atom' %>" type="application/atom+xml"/>
|
<link rel="self" href="<%= '#{url(~p"/users/#{@user.nickname}/feed")}.atom' %>" type="application/atom+xml"/>
|
||||||
|
|
||||||
<%= render @view_module, "_author.atom", assigns %>
|
<%= render @view_module, "_author.atom", assigns %>
|
||||||
|
|
||||||
<%= if last_activity(@activities) do %>
|
<%= if last_activity(@activities) do %>
|
||||||
<link rel="next" href="<%= '#{Routes.user_feed_url(@conn, :feed, @user.nickname)}.atom?max_id=#{last_activity(@activities).id}' %>" type="application/atom+xml"/>
|
<link rel="next" href="<%= '#{url(~p"/users/#{@user.nickname}/feed")}.atom?max_id=#{last_activity(@activities).id}' %>" type="application/atom+xml"/>
|
||||||
<% end %>
|
<% end %>
|
||||||