Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
391
Issues
391
List
Boards
Labels
Service Desk
Milestones
Merge Requests
54
Merge Requests
54
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
pleroma
Commits
8bcfac93
Verified
Commit
8bcfac93
authored
Feb 03, 2019
by
Haelwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make credo happy
parent
c5f8df08
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
85 additions
and
91 deletions
+85
-91
.credo.exs
.credo.exs
+1
-1
lib/mix/tasks/pleroma/user.ex
lib/mix/tasks/pleroma/user.ex
+1
-1
lib/pleroma/stats.ex
lib/pleroma/stats.ex
+1
-1
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/activity_pub.ex
+1
-1
lib/pleroma/web/common_api/utils.ex
lib/pleroma/web/common_api/utils.ex
+1
-2
lib/pleroma/web/federator/federator.ex
lib/pleroma/web/federator/federator.ex
+1
-2
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+64
-60
lib/pleroma/web/mastodon_api/views/account_view.ex
lib/pleroma/web/mastodon_api/views/account_view.ex
+3
-3
lib/pleroma/web/mastodon_api/views/filter_view.ex
lib/pleroma/web/mastodon_api/views/filter_view.ex
+1
-1
lib/pleroma/web/mastodon_api/views/status_view.ex
lib/pleroma/web/mastodon_api/views/status_view.ex
+2
-6
lib/pleroma/web/mastodon_api/websocket_handler.ex
lib/pleroma/web/mastodon_api/websocket_handler.ex
+1
-1
lib/pleroma/web/media_proxy/controller.ex
lib/pleroma/web/media_proxy/controller.ex
+3
-2
lib/pleroma/web/media_proxy/media_proxy.ex
lib/pleroma/web/media_proxy/media_proxy.ex
+1
-1
lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
+3
-8
lib/pleroma/web/uploader_controller.ex
lib/pleroma/web/uploader_controller.ex
+1
-1
No files found.
.credo.exs
View file @
8bcfac93
...
...
@@ -57,7 +57,7 @@
# For some checks, like AliasUsage, you can only customize the priority
# Priority values are: `low, normal, high, higher`
{
Credo
.
Check
.
Design
.
AliasUsage
,
priority:
:low
},
{
Credo
.
Check
.
Design
.
AliasUsage
,
priority:
:low
,
if_called_more_often_than:
3
},
# For others you can set parameters
...
...
lib/mix/tasks/pleroma/user.ex
View file @
8bcfac93
...
...
@@ -211,7 +211,7 @@ def run(["unsubscribe", nickname]) do
user
=
Repo
.
get
(
User
,
user
.
id
)
if
length
(
user
.
following
)
==
0
do
if
Enum
.
empty?
(
user
.
following
)
do
Mix
.
shell
()
.
info
(
"Successfully unsubscribed all followers from
#{
user
.
nickname
}
"
)
end
else
...
...
lib/pleroma/stats.ex
View file @
8bcfac93
...
...
@@ -23,7 +23,7 @@ def get_peers do
def
schedule_update
do
spawn
(
fn
->
# 1 hour
Process
.
sleep
(
1000
*
60
*
60
*
1
)
Process
.
sleep
(
1000
*
60
*
60
)
schedule_update
()
end
)
...
...
lib/pleroma/web/activity_pub/activity_pub.ex
View file @
8bcfac93
...
...
@@ -119,7 +119,7 @@ def stream_out(activity) do
activity
.
data
[
"object"
]
|>
Map
.
get
(
"tag"
,
[])
|>
Enum
.
filter
(
fn
tag
->
is_bitstring
(
tag
)
end
)
|>
Enum
.
map
(
fn
tag
->
Pleroma
.
Web
.
Streamer
.
stream
(
"hashtag:"
<>
tag
,
activity
)
end
)
|>
Enum
.
each
(
fn
tag
->
Pleroma
.
Web
.
Streamer
.
stream
(
"hashtag:"
<>
tag
,
activity
)
end
)
if
activity
.
data
[
"object"
][
"attachment"
]
!=
[]
do
Pleroma
.
Web
.
Streamer
.
stream
(
"public:media"
,
activity
)
...
...
lib/pleroma/web/common_api/utils.ex
View file @
8bcfac93
...
...
@@ -6,8 +6,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
alias
Calendar
.
Strftime
alias
Comeonin
.
Pbkdf2
alias
Pleroma
.
{
Activity
,
Formatter
,
Object
,
Repo
}
alias
Pleroma
.
User
alias
Pleroma
.
Web
alias
Pleroma
.
{
User
,
Web
}
alias
Pleroma
.
Web
.
ActivityPub
.
Utils
alias
Pleroma
.
Web
.
Endpoint
alias
Pleroma
.
Web
.
MediaProxy
...
...
lib/pleroma/web/federator/federator.ex
View file @
8bcfac93
...
...
@@ -25,7 +25,7 @@ def init(args) do
def
start_link
do
spawn
(
fn
->
# 1 minute
Process
.
sleep
(
1000
*
60
*
1
)
Process
.
sleep
(
1000
*
60
)
enqueue
(
:refresh_subscriptions
,
nil
)
end
)
...
...
@@ -197,7 +197,6 @@ def handle_cast({:enqueue, type, payload, _priority}, state) do
end
def
handle_cast
(
m
,
state
)
do
IO
.
inspect
(
"Unknown:
#{
inspect
(
m
)
}
,
#{
inspect
(
state
)
}
"
)
{
:noreply
,
state
}
end
...
...
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
8bcfac93
This diff is collapsed.
Click to expand it.
lib/pleroma/web/mastodon_api/views/account_view.ex
View file @
8bcfac93
...
...
@@ -4,11 +4,11 @@
defmodule
Pleroma
.
Web
.
MastodonAPI
.
AccountView
do
use
Pleroma
.
Web
,
:view
alias
Pleroma
.
User
alias
Pleroma
.
Web
.
MastodonAPI
.
AccountView
alias
Pleroma
.
{
HTML
,
User
}
alias
Pleroma
.
Web
.
CommonAPI
.
Utils
alias
Pleroma
.
Web
.
MastodonAPI
.
AccountView
alias
Pleroma
.
Web
.
MediaProxy
alias
Pleroma
.
HTML
def
render
(
"accounts.json"
,
%{
users:
users
}
=
opts
)
do
users
...
...
lib/pleroma/web/mastodon_api/views/filter_view.ex
View file @
8bcfac93
...
...
@@ -4,8 +4,8 @@
defmodule
Pleroma
.
Web
.
MastodonAPI
.
FilterView
do
use
Pleroma
.
Web
,
:view
alias
Pleroma
.
Web
.
MastodonAPI
.
FilterView
alias
Pleroma
.
Web
.
CommonAPI
.
Utils
alias
Pleroma
.
Web
.
MastodonAPI
.
FilterView
def
render
(
"filters.json"
,
%{
filters:
filters
}
=
opts
)
do
render_many
(
filters
,
FilterView
,
"filter.json"
,
opts
)
...
...
lib/pleroma/web/mastodon_api/views/status_view.ex
View file @
8bcfac93
...
...
@@ -5,14 +5,10 @@
defmodule
Pleroma
.
Web
.
MastodonAPI
.
StatusView
do
use
Pleroma
.
Web
,
:view
alias
Pleroma
.
Activity
alias
Pleroma
.
HTML
alias
Pleroma
.
Repo
alias
Pleroma
.
User
alias
Pleroma
.
{
Activity
,
HTML
,
Repo
,
User
}
alias
Pleroma
.
Web
.
CommonAPI
.
Utils
alias
Pleroma
.
Web
.
MastodonAPI
.
{
AccountView
,
StatusView
}
alias
Pleroma
.
Web
.
MediaProxy
alias
Pleroma
.
Web
.
MastodonAPI
.
AccountView
alias
Pleroma
.
Web
.
MastodonAPI
.
StatusView
# TODO: Add cached version.
defp
get_replied_to_activities
(
activities
)
do
...
...
lib/pleroma/web/mastodon_api/websocket_handler.ex
View file @
8bcfac93
...
...
@@ -6,7 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
require
Logger
alias
Pleroma
.
Web
.
OAuth
.
Token
alias
Pleroma
.
{
User
,
Repo
}
alias
Pleroma
.
{
Repo
,
User
}
@behaviour
:cowboy_websocket_handler
...
...
lib/pleroma/web/media_proxy/controller.ex
View file @
8bcfac93
...
...
@@ -4,11 +4,12 @@
defmodule
Pleroma
.
Web
.
MediaProxy
.
MediaProxyController
do
use
Pleroma
.
Web
,
:controller
alias
Pleroma
.
{
Web
.
MediaProxy
,
ReverseProxy
}
alias
Pleroma
.
ReverseProxy
alias
Pleroma
.
Web
.
MediaProxy
@default_proxy_opts
[
max_body_length:
25
*
1_048_576
,
http:
[
follow_redirect:
true
]]
def
remote
(
conn
,
params
=
%{
"sig"
=>
sig64
,
"url"
=>
url64
}
)
do
def
remote
(
conn
,
%{
"sig"
=>
sig64
,
"url"
=>
url64
}
=
params
)
do
with
config
<-
Pleroma
.
Config
.
get
([
:media_proxy
],
[]),
true
<-
Keyword
.
get
(
config
,
:enabled
,
false
),
{
:ok
,
url
}
<-
MediaProxy
.
decode_url
(
sig64
,
url64
),
...
...
lib/pleroma/web/media_proxy/media_proxy.ex
View file @
8bcfac93
...
...
@@ -9,7 +9,7 @@ def url(nil), do: nil
def
url
(
""
),
do
:
nil
def
url
(
url
=
"/"
<>
_
),
do
:
url
def
url
(
"/"
<>
_
=
url
),
do
:
url
def
url
(
url
)
do
config
=
Application
.
get_env
(
:pleroma
,
:media_proxy
,
[])
...
...
lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
View file @
8bcfac93
...
...
@@ -5,10 +5,7 @@
defmodule
Pleroma
.
Web
.
Nodeinfo
.
NodeinfoController
do
use
Pleroma
.
Web
,
:controller
alias
Pleroma
.
Stats
alias
Pleroma
.
Web
alias
Pleroma
.
{
User
,
Repo
}
alias
Pleroma
.
Config
alias
Pleroma
.
{
Config
,
Repo
,
Stats
,
User
,
Web
}
alias
Pleroma
.
Web
.
ActivityPub
.
MRF
plug
(
Pleroma
.
Web
.
FederatingPlug
)
...
...
@@ -32,7 +29,7 @@ def schemas(conn, _params) do
# returns a nodeinfo 2.0 map, since 2.1 just adds a repository field
# under software.
def
raw_nodeinfo
()
do
def
raw_nodeinfo
do
instance
=
Application
.
get_env
(
:pleroma
,
:instance
)
media_proxy
=
Application
.
get_env
(
:pleroma
,
:media_proxy
)
suggestions
=
Application
.
get_env
(
:pleroma
,
:suggestions
)
...
...
@@ -66,10 +63,8 @@ def raw_nodeinfo() do
Config
.
get
([
:mrf_user_allowlist
],
[])
|>
Enum
.
into
(%{},
fn
{
k
,
v
}
->
{
k
,
length
(
v
)}
end
)
mrf_transparency
=
Keyword
.
get
(
instance
,
:mrf_transparency
)
federation_response
=
if
mrf_transparency
do
if
Keyword
.
get
(
instance
,
:mrf_transparency
)
do
%{
mrf_policies:
mrf_policies
,
mrf_simple:
mrf_simple
,
...
...
lib/pleroma/web/uploader_controller.ex
View file @
8bcfac93
...
...
@@ -3,7 +3,7 @@ defmodule Pleroma.Web.UploaderController do
alias
Pleroma
.
Uploaders
.
Uploader
def
callback
(
conn
,
params
=
%{
"upload_path"
=>
upload_path
}
)
do
def
callback
(
conn
,
%{
"upload_path"
=>
upload_path
}
=
params
)
do
process_callback
(
conn
,
:global
.
whereis_name
({
Uploader
,
upload_path
}),
params
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment