projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '1813-throttling' into 'develop'
[akkoma]
/
lib
/
pleroma
/
bbs
/
handler.ex
diff --git
a/lib/pleroma/bbs/handler.ex
b/lib/pleroma/bbs/handler.ex
index 106fe5d18f4a634875ae6b3696b6ad93b3dbfc2f..12d64c2fe2c982f2c09800bb9d5cb5871b5661bb 100644
(file)
--- a/
lib/pleroma/bbs/handler.ex
+++ b/
lib/pleroma/bbs/handler.ex
@@
-1,6
+1,11
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.BBS.Handler do
use Sshd.ShellHandler
alias Pleroma.Activity
defmodule Pleroma.BBS.Handler do
use Sshd.ShellHandler
alias Pleroma.Activity
+ alias Pleroma.HTML
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
@@
-38,9
+43,9
@@
defmodule Pleroma.BBS.Handler do
end
def puts_activity(activity) do
end
def puts_activity(activity) do
- status = Pleroma.Web.MastodonAPI.StatusView.render("s
tatus
.json", %{activity: activity})
+ status = Pleroma.Web.MastodonAPI.StatusView.render("s
how
.json", %{activity: activity})
IO.puts("-- #{status.id} by #{status.account.display_name} (#{status.account.acct})")
IO.puts("-- #{status.id} by #{status.account.display_name} (#{status.account.acct})")
- IO.puts(H
tmlSanitizeEx
.strip_tags(status.content))
+ IO.puts(H
TML
.strip_tags(status.content))
IO.puts("")
end
IO.puts("")
end
@@
-61,7
+66,7
@@
defmodule Pleroma.BBS.Handler do
with %Activity{} <- Activity.get_by_id(activity_id),
{:ok, _activity} <-
with %Activity{} <- Activity.get_by_id(activity_id),
{:ok, _activity} <-
- CommonAPI.post(user, %{
"status" => rest, "in_reply_to_status_id" =>
activity_id}) do
+ CommonAPI.post(user, %{
status: rest, in_reply_to_status_id:
activity_id}) do
IO.puts("Replied!")
else
_e -> IO.puts("Could not reply...")
IO.puts("Replied!")
else
_e -> IO.puts("Could not reply...")
@@
-73,7
+78,7
@@
defmodule Pleroma.BBS.Handler do
def handle_command(%{user: user} = state, "p " <> text) do
text = String.trim(text)
def handle_command(%{user: user} = state, "p " <> text) do
text = String.trim(text)
- with {:ok, _activity} <- CommonAPI.post(user, %{
"status" =>
text}) do
+ with {:ok, _activity} <- CommonAPI.post(user, %{
status:
text}) do
IO.puts("Posted!")
else
_e -> IO.puts("Could not post...")
IO.puts("Posted!")
else
_e -> IO.puts("Could not post...")
@@
-93,9
+98,8
@@
defmodule Pleroma.BBS.Handler do
|> Map.put("user", user)
activities =
|> Map.put("user", user)
activities =
- [user.ap_id |
user.following
]
+ [user.ap_id |
Pleroma.User.following(user)
]
|> ActivityPub.fetch_activities(params)
|> ActivityPub.fetch_activities(params)
- |> ActivityPub.contain_timeline(user)
Enum.each(activities, fn activity ->
puts_activity(activity)
Enum.each(activities, fn activity ->
puts_activity(activity)