Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21908042
timelines.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
timelines.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.Web.Preload.Providers.Timelines
do
alias
Pleroma.Web.ActivityPub.ActivityPub
alias
Pleroma.Web.MastodonAPI.StatusView
alias
Pleroma.Web.Preload.Providers.Provider
@behaviour
Provider
@public_url
"/api/v1/timelines/public"
@impl
Provider
def
generate_terms
(
params
)
do
build_public_tag
(%{},
params
)
end
def
build_public_tag
(
acc
,
params
)
do
if
Pleroma.Config
.
restrict_unauthenticated_access?
(
:timelines
,
:federated
)
do
acc
else
Map
.
put
(
acc
,
@public_url
,
public_timeline
(
params
))
end
end
defp
public_timeline
(%{
"path"
=>
[
"main"
,
"all"
]}),
do
:
get_public_timeline
(
false
)
defp
public_timeline
(
_params
),
do
:
get_public_timeline
(
true
)
defp
get_public_timeline
(
local_only
)
do
activities
=
ActivityPub
.
fetch_public_activities
(%{
type
:
[
"Create"
],
local_only
:
local_only
})
StatusView
.
render
(
"index.json"
,
activities
:
activities
,
for
:
nil
,
as
:
:activity
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sun, Dec 28, 1:42 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
839761
Default Alt Text
timelines.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment