projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fbc3f28
)
Various runtime configuration fixes
author
href
<href@random.sh>
Fri, 16 Nov 2018 20:35:08 +0000
(21:35 +0100)
committer
href
<href@random.sh>
Mon, 19 Nov 2018 09:09:24 +0000
(10:09 +0100)
config/config.exs
patch
|
blob
|
history
config/prod.exs
patch
|
blob
|
history
lib/pleroma/application.ex
patch
|
blob
|
history
lib/pleroma/object.ex
patch
|
blob
|
history
lib/pleroma/web/channels/user_socket.ex
patch
|
blob
|
history
lib/pleroma/web/endpoint.ex
patch
|
blob
|
history
lib/pleroma/web/federator/federator.ex
patch
|
blob
|
history
lib/pleroma/web/ostatus/ostatus_controller.ex
patch
|
blob
|
history
lib/pleroma/web/router.ex
patch
|
blob
|
history
diff --git
a/config/config.exs
b/config/config.exs
index af0fdca9aae4d79745df95b405f91bedde938000..faeac8ed1ede0e534c7b3689fbf8e68d87f85a50 100644
(file)
--- a/
config/config.exs
+++ b/
config/config.exs
@@
-52,6
+52,7
@@
config :pleroma, Pleroma.Web.Endpoint,
url: [host: "localhost"],
protocol: "https",
secret_key_base: "aK4Abxf29xU9TTDKre9coZPUgevcVCFQJe/5xP/7Lt4BEif6idBIbjupVbOrbKxl",
url: [host: "localhost"],
protocol: "https",
secret_key_base: "aK4Abxf29xU9TTDKre9coZPUgevcVCFQJe/5xP/7Lt4BEif6idBIbjupVbOrbKxl",
+ signing_salt: "CqaoopA2",
render_errors: [view: Pleroma.Web.ErrorView, accepts: ~w(json)],
pubsub: [name: Pleroma.PubSub, adapter: Phoenix.PubSub.PG2],
secure_cookie_flag: true
render_errors: [view: Pleroma.Web.ErrorView, accepts: ~w(json)],
pubsub: [name: Pleroma.PubSub, adapter: Phoenix.PubSub.PG2],
secure_cookie_flag: true
diff --git
a/config/prod.exs
b/config/prod.exs
index d0cfd1ac2f895ce7cea4905e74542a67e72f0efd..e5e5a977e4a0efbe054345f46094c9069c19a622 100644
(file)
--- a/
config/prod.exs
+++ b/
config/prod.exs
@@
-14,6
+14,7
@@
use Mix.Config
# manifest is generated by the mix phoenix.digest task
# which you typically run after static files are built.
config :pleroma, Pleroma.Web.Endpoint,
# manifest is generated by the mix phoenix.digest task
# which you typically run after static files are built.
config :pleroma, Pleroma.Web.Endpoint,
+ server: true,
http: [port: 4000],
protocol: "http"
http: [port: 4000],
protocol: "http"
diff --git
a/lib/pleroma/application.ex
b/lib/pleroma/application.ex
index eedad767507a6b48adc88f9f6c81b0d6ca9cab66..4c0e3ddb0ac8b99520cf6c0d9e07facbfb29379a 100644
(file)
--- a/
lib/pleroma/application.ex
+++ b/
lib/pleroma/application.ex
@@
-3,6
+3,7
@@
defmodule Pleroma.Application do
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
+ @env Mix.env()
def start(_type, _args) do
import Supervisor.Spec
import Cachex.Spec
def start(_type, _args) do
import Supervisor.Spec
import Cachex.Spec
@@
-60,7
+61,7
@@
defmodule Pleroma.Application do
worker(Pleroma.Stats, []),
worker(Pleroma.Gopher.Server, [])
] ++
worker(Pleroma.Stats, []),
worker(Pleroma.Gopher.Server, [])
] ++
- if
Mix.env()
== :test,
+ if
@env
== :test,
do: [],
else:
[worker(Pleroma.Web.Streamer, [])] ++
do: [],
else:
[worker(Pleroma.Web.Streamer, [])] ++
diff --git
a/lib/pleroma/object.ex
b/lib/pleroma/object.ex
index 067ecfaf4732d271f7edfa045401efe2b80d279b..03a75dfbdbbcdcf00bbf9493b1c8cc9272868266 100644
(file)
--- a/
lib/pleroma/object.ex
+++ b/
lib/pleroma/object.ex
@@
-31,10
+31,12
@@
defmodule Pleroma.Object do
def normalize(ap_id) when is_binary(ap_id), do: Object.get_by_ap_id(ap_id)
def normalize(_), do: nil
def normalize(ap_id) when is_binary(ap_id), do: Object.get_by_ap_id(ap_id)
def normalize(_), do: nil
-
def get_cached_by_ap_id(ap_id)
do
-
if Mix.env() == :test
do
+
if Mix.env() == :test
do
+
def get_cached_by_ap_id(ap_id)
do
get_by_ap_id(ap_id)
get_by_ap_id(ap_id)
- else
+ end
+ else
+ def get_cached_by_ap_id(ap_id) do
key = "object:#{ap_id}"
Cachex.fetch!(:object_cache, key, fn _ ->
key = "object:#{ap_id}"
Cachex.fetch!(:object_cache, key, fn _ ->
diff --git
a/lib/pleroma/web/channels/user_socket.ex
b/lib/pleroma/web/channels/user_socket.ex
index 21b22b40994a6419282645f8ecb68dd757ff597a..07ddee16913646fe219ada404bb635da98ef56a3 100644
(file)
--- a/
lib/pleroma/web/channels/user_socket.ex
+++ b/
lib/pleroma/web/channels/user_socket.ex
@@
-4,9
+4,7
@@
defmodule Pleroma.Web.UserSocket do
## Channels
# channel "room:*", Pleroma.Web.RoomChannel
## Channels
# channel "room:*", Pleroma.Web.RoomChannel
- if Application.get_env(:pleroma, :chat) |> Keyword.get(:enabled) do
- channel("chat:*", Pleroma.Web.ChatChannel)
- end
+ channel("chat:*", Pleroma.Web.ChatChannel)
## Transports
transport(:websocket, Phoenix.Transports.WebSocket)
## Transports
transport(:websocket, Phoenix.Transports.WebSocket)
@@
-24,7
+22,8
@@
defmodule Pleroma.Web.UserSocket do
# See `Phoenix.Token` documentation for examples in
# performing token verification on connect.
def connect(%{"token" => token}, socket) do
# See `Phoenix.Token` documentation for examples in
# performing token verification on connect.
def connect(%{"token" => token}, socket) do
- with {:ok, user_id} <- Phoenix.Token.verify(socket, "user socket", token, max_age: 84600),
+ with true <- Pleroma.Config.get([:chat, :enabled]),
+ {:ok, user_id} <- Phoenix.Token.verify(socket, "user socket", token, max_age: 84600),
%User{} = user <- Pleroma.Repo.get(User, user_id) do
{:ok, assign(socket, :user_name, user.nickname)}
else
%User{} = user <- Pleroma.Repo.get(User, user_id) do
{:ok, assign(socket, :user_name, user.nickname)}
else
diff --git
a/lib/pleroma/web/endpoint.ex
b/lib/pleroma/web/endpoint.ex
index 85bb4ff5f45a3a7a1d38b70c7eb730cebb68430e..8728c908b491a6e06b1b7e6140c4dbb17b312ae1 100644
(file)
--- a/
lib/pleroma/web/endpoint.ex
+++ b/
lib/pleroma/web/endpoint.ex
@@
-1,9
+1,7
@@
defmodule Pleroma.Web.Endpoint do
use Phoenix.Endpoint, otp_app: :pleroma
defmodule Pleroma.Web.Endpoint do
use Phoenix.Endpoint, otp_app: :pleroma
- if Application.get_env(:pleroma, :chat) |> Keyword.get(:enabled) do
- socket("/socket", Pleroma.Web.UserSocket)
- end
+ socket("/socket", Pleroma.Web.UserSocket)
socket("/api/v1", Pleroma.Web.MastodonAPI.MastodonSocket)
socket("/api/v1", Pleroma.Web.MastodonAPI.MastodonSocket)
@@
-58,7
+56,7
@@
defmodule Pleroma.Web.Endpoint do
Plug.Session,
store: :cookie,
key: cookie_name,
Plug.Session,
store: :cookie,
key: cookie_name,
- signing_salt:
"CqaoopA2"
,
+ signing_salt:
{Pleroma.Config, :get, [[__MODULE__, :signing_salt], "CqaoopA2"]}
,
http_only: true,
secure:
Application.get_env(:pleroma, Pleroma.Web.Endpoint) |> Keyword.get(:secure_cookie_flag),
http_only: true,
secure:
Application.get_env(:pleroma, Pleroma.Web.Endpoint) |> Keyword.get(:secure_cookie_flag),
diff --git
a/lib/pleroma/web/federator/federator.ex
b/lib/pleroma/web/federator/federator.ex
index 6554fd2ef4d6ca89f1d014ec31bb3b9d2bd8a60c..f047708d31d27a4b831a50e7e4fe6d1b1e00f2c7 100644
(file)
--- a/
lib/pleroma/web/federator/federator.ex
+++ b/
lib/pleroma/web/federator/federator.ex
@@
-153,11
+153,15
@@
defmodule Pleroma.Web.Federator do
{:error, "Don't know what to do with this"}
end
{:error, "Don't know what to do with this"}
end
-
def enqueue(type, payload, priority \\ 1)
do
-
if Pleroma.Config.get([:instance, :federating]
) do
- if
Mix.env() == :test
do
+
if Mix.env() == :test
do
+
def enqueue(type, payload, priority \\ 1
) do
+ if
Pleroma.Config.get([:instance, :federating])
do
handle(type, payload)
handle(type, payload)
- else
+ end
+ end
+ else
+ def enqueue(type, payload, priority \\ 1) do
+ if Pleroma.Config.get([:instance, :federating]) do
GenServer.cast(__MODULE__, {:enqueue, type, payload, priority})
end
end
GenServer.cast(__MODULE__, {:enqueue, type, payload, priority})
end
end
diff --git
a/lib/pleroma/web/ostatus/ostatus_controller.ex
b/lib/pleroma/web/ostatus/ostatus_controller.ex
index 34fdf97274a3a4450e2233bea3215e6e1f362dae..af6e22c2b8c90e18c4aeefa1f9817568abf399b6 100644
(file)
--- a/
lib/pleroma/web/ostatus/ostatus_controller.ex
+++ b/
lib/pleroma/web/ostatus/ostatus_controller.ex
@@
-136,7
+136,7
@@
defmodule Pleroma.Web.OStatus.OStatusController do
"html" ->
conn
|> put_resp_content_type("text/html")
"html" ->
conn
|> put_resp_content_type("text/html")
- |> send_file(200,
"priv/static/index.html"
)
+ |> send_file(200,
Application.app_dir(:pleroma, "priv/static/index.html")
)
_ ->
represent_activity(conn, format, activity, user)
_ ->
represent_activity(conn, format, activity, user)
diff --git
a/lib/pleroma/web/router.ex
b/lib/pleroma/web/router.ex
index 4623698064193905b3ec1b02888dcadf6d9aa8d7..07f69fcd8cbd45cd0b85aba84deb2dbcffe9aec7 100644
(file)
--- a/
lib/pleroma/web/router.ex
+++ b/
lib/pleroma/web/router.ex
@@
-404,11
+404,9
@@
defmodule Fallback.RedirectController do
use Pleroma.Web, :controller
def redirector(conn, _params) do
use Pleroma.Web, :controller
def redirector(conn, _params) do
- if Mix.env() != :test do
- conn
- |> put_resp_content_type("text/html")
- |> send_file(200, "priv/static/index.html")
- end
+ conn
+ |> put_resp_content_type("text/html")
+ |> send_file(200, Application.app_dir(:pleroma, "priv/static/index.html"))
end
def registration_page(conn, params) do
end
def registration_page(conn, params) do