Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85158300
marker_controller.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
marker_controller.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.MastodonAPI.MarkerController
do
use
Pleroma.Web
,
:controller
alias
Pleroma.Web.Plugs.OAuthScopesPlug
plug
(
Pleroma.Web.ApiSpec.CastAndValidate
)
plug
(
OAuthScopesPlug
,
%{
scopes
:
[
"read:statuses"
]}
when
action
==
:index
)
plug
(
OAuthScopesPlug
,
%{
scopes
:
[
"write:statuses"
]}
when
action
==
:upsert
)
action_fallback
(
Pleroma.Web.MastodonAPI.FallbackController
)
defdelegate
open_api_operation
(
action
),
to
:
Pleroma.Web.ApiSpec.MarkerOperation
# GET /api/v1/markers
def
index
(%{
assigns
:
%{
user
:
user
}}
=
conn
,
params
)
do
markers
=
Pleroma.Marker
.
get_markers
(
user
,
params
[
:timeline
])
render
(
conn
,
"markers.json"
,
%{
markers
:
markers
})
end
# POST /api/v1/markers
def
upsert
(%{
assigns
:
%{
user
:
user
},
body_params
:
params
}
=
conn
,
_
)
do
params
=
Map
.
new
(
params
,
fn
{
key
,
value
}
->
{
to_string
(
key
),
value
}
end
)
with
{
:ok
,
result
}
<-
Pleroma.Marker
.
upsert
(
user
,
params
),
markers
<-
Map
.
values
(
result
)
do
render
(
conn
,
"markers.json"
,
%{
markers
:
markers
})
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sun, Jun 28, 5:55 AM (12 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1577612
Default Alt Text
marker_controller.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment