diff --git a/.gitignore b/.gitignore
index 803f8eb7..dec9281f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,8 @@ priv/static/*
!priv/static/.gitkeep
priv/data/*
!priv/data/.gitkeep
+priv/errors/*
+!priv/errors/.gitkeep
.vscode/
cover/
site/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24aa810c..f108cdc5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,10 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Special operations
-We added `application/ld+json` as acceptable MIME type for ActivityPub requests, so you'll need to recompile the `mime` library we use before recompiling Mobilizon:
-```
-MIX_ENV=prod mix deps.clean mime --build
-```
+* We added `application/ld+json` as acceptable MIME type for ActivityPub requests, so you'll need to recompile the `mime` library we use before recompiling Mobilizon:
+ ```
+ MIX_ENV=prod mix deps.clean mime --build
+ ```
+
+* The [nginx configuration](https://framagit.org/framasoft/mobilizon/-/blob/master/support/nginx/mobilizon.conf) has been changed with improvements and support for custom error pages.
### Added
diff --git a/config/config.exs b/config/config.exs
index d833be2f..5272fe76 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -19,6 +19,7 @@ config :mobilizon, :instance,
registrations_open: false,
registration_email_allowlist: [],
languages: [],
+ default_language: "en",
demo: false,
repository: Mix.Project.config()[:source_url],
allow_relay: true,
diff --git a/lib/mobilizon.ex b/lib/mobilizon.ex
index 8ed9f71b..496deb89 100644
--- a/lib/mobilizon.ex
+++ b/lib/mobilizon.ex
@@ -16,6 +16,7 @@ defmodule Mobilizon do
alias Mobilizon.{Config, Storage, Web}
alias Mobilizon.Federation.ActivityPub
+ alias Mobilizon.Service.ErrorPage
alias Mobilizon.Service.Export.{Feed, ICalendar}
@name Mix.Project.config()[:name]
@@ -104,7 +105,7 @@ defmodule Mobilizon do
defp fallback_options(fallback), do: [fallback: fallback(default: fallback)]
defp task_children(:test), do: []
- defp task_children(_), do: [relay_actor(), anonymous_actor()]
+ defp task_children(_), do: [relay_actor(), anonymous_actor(), render_error_page()]
defp relay_actor do
%{
@@ -121,4 +122,12 @@ defmodule Mobilizon do
restart: :temporary
}
end
+
+ defp render_error_page do
+ %{
+ id: :render_error_page_init,
+ start: {Task, :start_link, [&ErrorPage.init/0]},
+ restart: :temporary
+ }
+ end
end
diff --git a/lib/service/error_page.ex b/lib/service/error_page.ex
new file mode 100644
index 00000000..bca368c9
--- /dev/null
+++ b/lib/service/error_page.ex
@@ -0,0 +1,17 @@
+defmodule Mobilizon.Service.ErrorPage do
+ @moduledoc """
+ Render an error page
+ """
+
+ def init do
+ render_error_page()
+ end
+
+ defp render_error_page do
+ content =
+ Phoenix.View.render_to_string(Mobilizon.Web.ErrorView, "500.html", conn: %Plug.Conn{})
+
+ path = Path.join(Application.app_dir(:mobilizon, "priv/errors"), "error.html")
+ File.write(path, content)
+ end
+end
diff --git a/lib/web/gettext.ex b/lib/web/gettext.ex
index 18a2fd49..7718ce6e 100644
--- a/lib/web/gettext.ex
+++ b/lib/web/gettext.ex
@@ -37,8 +37,8 @@ defmodule Mobilizon.Web.Gettext do
locale in locales -> locale
# Either the first part matches, "fr_CA" => "fr"
split_locale(locale) in locales -> split_locale(locale)
- # Otherwise default to english
- true -> "en"
+ # Otherwise set to default
+ true -> Keyword.get(Mobilizon.Config.instance_config(), :default_language, "en") || "en"
end
end
diff --git a/lib/web/templates/error/500_page.html.eex b/lib/web/templates/error/500_page.html.eex
new file mode 100644
index 00000000..4c58c312
--- /dev/null
+++ b/lib/web/templates/error/500_page.html.eex
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ <%= gettext "This page is not correct" %>
+
+
+
+
+
+
+
+
+
+
<%= gettext "We're sorry, but something went wrong on our end." %>
+
<%= gettext "The Mobilizon server seems to be temporarily down." %>
+
+
+
+
diff --git a/lib/web/views/error_view.ex b/lib/web/views/error_view.ex
index 398c8b95..5c27caf5 100644
--- a/lib/web/views/error_view.ex
+++ b/lib/web/views/error_view.ex
@@ -39,7 +39,11 @@ defmodule Mobilizon.Web.ErrorView do
end
def render("500.html", _assigns) do
- "Internal server error"
+ Mobilizon.Config.instance_config()
+ |> Keyword.get(:default_language, "en")
+ |> Gettext.put_locale()
+
+ render("500_page.html", %{})
end
# In case no render clause matches or no
diff --git a/priv/errors/.gitkeep b/priv/errors/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/priv/gettext/ar/LC_MESSAGES/default.po b/priv/gettext/ar/LC_MESSAGES/default.po
index 94c25fcd..8438fec3 100644
--- a/priv/gettext/ar/LC_MESSAGES/default.po
+++ b/priv/gettext/ar/LC_MESSAGES/default.po
@@ -1395,12 +1395,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "الفعالية"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/be/LC_MESSAGES/default.po b/priv/gettext/be/LC_MESSAGES/default.po
index 68c0a2c3..b883b99e 100644
--- a/priv/gettext/be/LC_MESSAGES/default.po
+++ b/priv/gettext/be/LC_MESSAGES/default.po
@@ -1371,12 +1371,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/ca/LC_MESSAGES/default.po b/priv/gettext/ca/LC_MESSAGES/default.po
index 372a1a5b..26bf766b 100644
--- a/priv/gettext/ca/LC_MESSAGES/default.po
+++ b/priv/gettext/ca/LC_MESSAGES/default.po
@@ -1391,12 +1391,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Activitat"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/cs/LC_MESSAGES/default.po b/priv/gettext/cs/LC_MESSAGES/default.po
index da2b289c..26a8692b 100644
--- a/priv/gettext/cs/LC_MESSAGES/default.po
+++ b/priv/gettext/cs/LC_MESSAGES/default.po
@@ -1371,12 +1371,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po
index 59016be5..caec2526 100644
--- a/priv/gettext/de/LC_MESSAGES/default.po
+++ b/priv/gettext/de/LC_MESSAGES/default.po
@@ -1399,12 +1399,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Veranstaltung"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
index 3581d4c2..4ae1d133 100644
--- a/priv/gettext/default.pot
+++ b/priv/gettext/default.pot
@@ -1359,3 +1359,18 @@ msgstr ""
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index 92c08e70..5d651236 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -1403,12 +1403,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Event"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/es/LC_MESSAGES/default.po b/priv/gettext/es/LC_MESSAGES/default.po
index 62a94b33..fbcd9a89 100644
--- a/priv/gettext/es/LC_MESSAGES/default.po
+++ b/priv/gettext/es/LC_MESSAGES/default.po
@@ -1699,12 +1699,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr "Envió una solicitud para asistir a %{title}."
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Evento"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr "Ha habido cambios para% {title}, así que pensamos en avisarle."
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/fi/LC_MESSAGES/default.po b/priv/gettext/fi/LC_MESSAGES/default.po
index 7158cf11..eb913c33 100644
--- a/priv/gettext/fi/LC_MESSAGES/default.po
+++ b/priv/gettext/fi/LC_MESSAGES/default.po
@@ -1649,12 +1649,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr "Lähetit pyynnön osallistua tapahtumaan %{title}."
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Tapahtuma"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr "%{title} on joiltain osin muuttunut, ja ajattelimme ilmoittaa asiasta."
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/fr/LC_MESSAGES/default.po b/priv/gettext/fr/LC_MESSAGES/default.po
index 01df84ec..b6267bcb 100644
--- a/priv/gettext/fr/LC_MESSAGES/default.po
+++ b/priv/gettext/fr/LC_MESSAGES/default.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2020-10-08 08:52+0200\n"
+"PO-Revision-Date: 2020-10-09 09:46+0200\n"
"Last-Translator: Thomas Citharel \n"
"Language-Team: French \n"
"Language: fr\n"
@@ -1094,3 +1094,15 @@ msgstr "Titre de l'événement"
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr "Il y a eu des changements pour %{title} donc nous avons pensé que nous vous le ferions savoir."
+
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr "Le serveur Mobilizon semble être temporairement hors-service."
+
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr "Cette page n’est pas correcte"
+
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr "Nous sommes désolé·e·s, mais quelque chose s’est mal passé de notre côté."
diff --git a/priv/gettext/it/LC_MESSAGES/default.po b/priv/gettext/it/LC_MESSAGES/default.po
index 80fff496..3f613515 100644
--- a/priv/gettext/it/LC_MESSAGES/default.po
+++ b/priv/gettext/it/LC_MESSAGES/default.po
@@ -1369,12 +1369,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Evento"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/ja/LC_MESSAGES/default.po b/priv/gettext/ja/LC_MESSAGES/default.po
index e3c657ca..f2fef6d7 100644
--- a/priv/gettext/ja/LC_MESSAGES/default.po
+++ b/priv/gettext/ja/LC_MESSAGES/default.po
@@ -1359,12 +1359,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "イベント"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/nl/LC_MESSAGES/default.po b/priv/gettext/nl/LC_MESSAGES/default.po
index 598496e4..7994fcb5 100644
--- a/priv/gettext/nl/LC_MESSAGES/default.po
+++ b/priv/gettext/nl/LC_MESSAGES/default.po
@@ -1394,12 +1394,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Evenement"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/oc/LC_MESSAGES/default.po b/priv/gettext/oc/LC_MESSAGES/default.po
index 47985aba..0222116b 100644
--- a/priv/gettext/oc/LC_MESSAGES/default.po
+++ b/priv/gettext/oc/LC_MESSAGES/default.po
@@ -1396,12 +1396,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Eveniment"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/pl/LC_MESSAGES/default.po b/priv/gettext/pl/LC_MESSAGES/default.po
index 8f5e9931..1ecc0b0c 100644
--- a/priv/gettext/pl/LC_MESSAGES/default.po
+++ b/priv/gettext/pl/LC_MESSAGES/default.po
@@ -1407,12 +1407,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Wydarzenie"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/pt/LC_MESSAGES/default.po b/priv/gettext/pt/LC_MESSAGES/default.po
index 142941d9..27a515b8 100644
--- a/priv/gettext/pt/LC_MESSAGES/default.po
+++ b/priv/gettext/pt/LC_MESSAGES/default.po
@@ -1364,12 +1364,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/pt_BR/LC_MESSAGES/default.po b/priv/gettext/pt_BR/LC_MESSAGES/default.po
index 23f03de4..ad4adc1f 100644
--- a/priv/gettext/pt_BR/LC_MESSAGES/default.po
+++ b/priv/gettext/pt_BR/LC_MESSAGES/default.po
@@ -1486,12 +1486,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Evento"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/ru/LC_MESSAGES/default.po b/priv/gettext/ru/LC_MESSAGES/default.po
index 8d212a7b..ddba4a89 100644
--- a/priv/gettext/ru/LC_MESSAGES/default.po
+++ b/priv/gettext/ru/LC_MESSAGES/default.po
@@ -1382,12 +1382,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Событие"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/priv/gettext/sv/LC_MESSAGES/default.po b/priv/gettext/sv/LC_MESSAGES/default.po
index dd808ad9..ccb1efab 100644
--- a/priv/gettext/sv/LC_MESSAGES/default.po
+++ b/priv/gettext/sv/LC_MESSAGES/default.po
@@ -1387,12 +1387,27 @@ msgstr ""
msgid "You issued a request to attend %{title}."
msgstr ""
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:64
msgid "Event title"
msgstr "Evenemang"
-#, elixir-format, fuzzy
+#, elixir-format
#: lib/web/templates/email/event_updated.html.eex:38
msgid "There have been changes for %{title} so we'd thought we'd let you know."
msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:46
+msgid "The Mobilizon server seems to be temporarily down."
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:7
+msgid "This page is not correct"
+msgstr ""
+
+#, elixir-format
+#: lib/web/templates/error/500_page.html.eex:45
+msgid "We're sorry, but something went wrong on our end."
+msgstr ""
diff --git a/support/nginx/mobilizon.conf b/support/nginx/mobilizon.conf
index 7ff6a169..aff05d8e 100644
--- a/support/nginx/mobilizon.conf
+++ b/support/nginx/mobilizon.conf
@@ -35,13 +35,14 @@ server {
# ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
# Add TLSv1.3 if it's supported by your system
- ssl_protocols TLSv1.2;
+ ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA';
ssl_prefer_server_ciphers on;
ssl_ecdh_curve prime256v1;
# ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
ssl_stapling on;
ssl_stapling_verify on;
+ add_header Strict-Transport-Security "max-age=31536000";
gzip on;
gzip_disable "msie6";
@@ -55,6 +56,18 @@ server {
# the nginx default is 1m, not enough for large media uploads
client_max_body_size 16m;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+
+
+ location / {
+ try_files $uri @proxy;
+ }
+
# Let's Encrypt keeps its files here
location ^~ '/.well-known/acme-challenge' {
root /var/www/certbot;
@@ -62,29 +75,27 @@ server {
}
location / {
- gzip off;
- proxy_http_version 1.1;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- # For Websocket support
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Host $http_host;
-
- proxy_redirect off;
-
proxy_pass http://localhost:4000;
-
- client_max_body_size 16m;
}
- location ~* \.(css|js)$ {
+ location ~ ^/(js|css) {
root /home/mobilizon/live/priv/static;
etag off;
- expires 1y;
access_log off;
- add_header Cache-Control public;
+ add_header Cache-Control "public, max-age=31536000, immutable";
+ }
+
+ location ~ ^/(media|proxy) {
+ etag off;
+ access_log off;
+ add_header Cache-Control "public, max-age=31536000, immutable";
+ proxy_pass http://localhost:4000;
+ }
+
+ error_page 500 501 502 503 504 @error;
+ location @error {
+ root /home/tcit/dev/frama/mobilizon/priv/errors;
+ try_files /error.html 502;
}
}
diff --git a/test/service/error_page_test.exs b/test/service/error_page_test.exs
new file mode 100644
index 00000000..035353f2
--- /dev/null
+++ b/test/service/error_page_test.exs
@@ -0,0 +1,31 @@
+defmodule Mobilizon.Service.ErrorPageTest do
+ @moduledoc """
+ Test the error page producer module
+ """
+
+ alias Mobilizon.Config
+ alias Mobilizon.Service.ErrorPage
+
+ use Mobilizon.DataCase
+
+ describe "init/0" do
+ test "renders an error page in the default language" do
+ ErrorPage.init()
+ path = Path.join(Application.app_dir(:mobilizon, "priv/errors"), "error.html")
+ assert File.exists?(path)
+ assert {:ok, data} = File.read(path)
+ assert data =~ "This page is not correct"
+ end
+
+ test "uses the instance default language if defined" do
+ Config.put([:instance, :default_language], "fr")
+ ErrorPage.init()
+ path = Path.join(Application.app_dir(:mobilizon, "priv/errors"), "error.html")
+ assert File.exists?(path)
+ assert {:ok, data} = File.read(path)
+ refute data =~ "This page is not correct"
+ assert data =~ ""
+ Config.put([:instance, :default_language], "en")
+ end
+ end
+end
diff --git a/test/web/views/error_view_test.exs b/test/web/views/error_view_test.exs
index 8cb250bb..419c94a2 100644
--- a/test/web/views/error_view_test.exs
+++ b/test/web/views/error_view_test.exs
@@ -17,10 +17,14 @@ defmodule Mobilizon.Web.ErrorViewTest do
end
test "render 500.html" do
- assert render_to_string(ErrorView, "500.html", []) == "Internal server error"
+ assert render_to_string(ErrorView, "500.html", []) =~
+ Phoenix.HTML.html_escape("We're sorry, but something went wrong on our end.")
+ |> Phoenix.HTML.safe_to_string()
end
test "render any other" do
- assert render_to_string(ErrorView, "505.html", []) == "Internal server error"
+ assert render_to_string(ErrorView, "505.html", []) =~
+ Phoenix.HTML.html_escape("We're sorry, but something went wrong on our end.")
+ |> Phoenix.HTML.safe_to_string()
end
end