[Credo] write large numbers with underscore separation
This commit is contained in:
parent
c3d41b2b6e
commit
8cd3eada7d
@ -48,7 +48,7 @@ defmodule Pleroma.Application do
|
|||||||
[
|
[
|
||||||
:user_cache,
|
:user_cache,
|
||||||
[
|
[
|
||||||
default_ttl: 25000,
|
default_ttl: 25_000,
|
||||||
ttl_interval: 1000,
|
ttl_interval: 1000,
|
||||||
limit: 2500
|
limit: 2500
|
||||||
]
|
]
|
||||||
@ -60,7 +60,7 @@ defmodule Pleroma.Application do
|
|||||||
[
|
[
|
||||||
:object_cache,
|
:object_cache,
|
||||||
[
|
[
|
||||||
default_ttl: 25000,
|
default_ttl: 25_000,
|
||||||
ttl_interval: 1000,
|
ttl_interval: 1000,
|
||||||
limit: 2500
|
limit: 2500
|
||||||
]
|
]
|
||||||
|
@ -285,7 +285,7 @@ defmodule Pleroma.User do
|
|||||||
def needs_update?(%User{local: false, last_refreshed_at: nil}), do: true
|
def needs_update?(%User{local: false, last_refreshed_at: nil}), do: true
|
||||||
|
|
||||||
def needs_update?(%User{local: false} = user) do
|
def needs_update?(%User{local: false} = user) do
|
||||||
NaiveDateTime.diff(NaiveDateTime.utc_now(), user.last_refreshed_at) >= 86400
|
NaiveDateTime.diff(NaiveDateTime.utc_now(), user.last_refreshed_at) >= 86_400
|
||||||
end
|
end
|
||||||
|
|
||||||
def needs_update?(_), do: true
|
def needs_update?(_), do: true
|
||||||
|
@ -23,7 +23,7 @@ defmodule Pleroma.Web.UserSocket do
|
|||||||
# performing token verification on connect.
|
# performing token verification on connect.
|
||||||
def connect(%{"token" => token}, socket) do
|
def connect(%{"token" => token}, socket) do
|
||||||
with true <- Pleroma.Config.get([:chat, :enabled]),
|
with true <- Pleroma.Config.get([:chat, :enabled]),
|
||||||
{:ok, user_id} <- Phoenix.Token.verify(socket, "user socket", token, max_age: 84600),
|
{:ok, user_id} <- Phoenix.Token.verify(socket, "user socket", token, max_age: 84_600),
|
||||||
%User{} = user <- Pleroma.Repo.get(User, user_id) do
|
%User{} = user <- Pleroma.Repo.get(User, user_id) do
|
||||||
{:ok, assign(socket, :user_name, user.nickname)}
|
{:ok, assign(socket, :user_name, user.nickname)}
|
||||||
else
|
else
|
||||||
|
@ -86,10 +86,10 @@ defmodule Pleroma.Web.Salmon do
|
|||||||
# Native generation of RSA keys is only available since OTP 20+ and in default build conditions
|
# Native generation of RSA keys is only available since OTP 20+ and in default build conditions
|
||||||
# We try at compile time to generate natively an RSA key otherwise we fallback on the old way.
|
# We try at compile time to generate natively an RSA key otherwise we fallback on the old way.
|
||||||
try do
|
try do
|
||||||
_ = :public_key.generate_key({:rsa, 2048, 65537})
|
_ = :public_key.generate_key({:rsa, 2048, 65_537})
|
||||||
|
|
||||||
def generate_rsa_pem do
|
def generate_rsa_pem do
|
||||||
key = :public_key.generate_key({:rsa, 2048, 65537})
|
key = :public_key.generate_key({:rsa, 2048, 65_537})
|
||||||
entry = :public_key.pem_entry_encode(:RSAPrivateKey, key)
|
entry = :public_key.pem_entry_encode(:RSAPrivateKey, key)
|
||||||
pem = :public_key.pem_encode([entry]) |> String.trim_trailing()
|
pem = :public_key.pem_encode([entry]) |> String.trim_trailing()
|
||||||
{:ok, pem}
|
{:ok, pem}
|
||||||
|
Loading…
Reference in New Issue
Block a user