Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7892893
instances.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
instances.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Instances
do
@moduledoc
"Instances context."
alias
Pleroma.Instances.Instance
defdelegate
filter_reachable
(
urls_or_hosts
),
to
:
Instance
defdelegate
reachable?
(
url_or_host
),
to
:
Instance
defdelegate
set_reachable
(
url_or_host
),
to
:
Instance
defdelegate
set_unreachable
(
url_or_host
,
unreachable_since
\\
nil
),
to
:
Instance
defdelegate
get_consistently_unreachable
,
to
:
Instance
def
set_consistently_unreachable
(
url_or_host
),
do
:
set_unreachable
(
url_or_host
,
reachability_datetime_threshold
())
def
reachability_datetime_threshold
do
federation_reachability_timeout_days
=
Pleroma.Config
.
get
([
:instance
,
:federation_reachability_timeout_days
],
0
)
if
federation_reachability_timeout_days
>
0
do
NaiveDateTime
.
add
(
NaiveDateTime
.
utc_now
(),
-
federation_reachability_timeout_days
*
24
*
3600
,
:second
)
else
~N[0000-01-01 00:00:00]
end
end
def
host
(
url_or_host
)
when
is_binary
(
url_or_host
)
do
if
url_or_host
=~
~r/^http/i
do
URI
.
parse
(
url_or_host
)
.
host
else
url_or_host
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Thu, Oct 2, 4:41 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
480421
Default Alt Text
instances.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment