+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.BBS.Handler do
- @moduledoc """
- An example implementation of `Sshd.ShellHandler`, implementing a very simple
- Read-Eval-Loop, that does nothing.
- """
use Sshd.ShellHandler
- alias Pleroma.Web.CommonAPI
- alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Activity
+ alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.CommonAPI
def on_shell(username, _pubkey, _ip, _port) do
:ok = IO.puts("Welcome to #{Pleroma.Config.get([:instance, :name])}!")
- user = Pleroma.User.get_by_nickname(to_string(username))
+ user = Pleroma.User.get_cached_by_nickname(to_string(username))
Logger.debug("#{inspect(user)}")
loop(run_state(user: user))
end
params =
%{}
- |> Map.put("type", ["Create", "Announce"])
+ |> Map.put("type", ["Create"])
|> Map.put("blocking_user", user)
|> Map.put("muting_user", user)
|> Map.put("user", user)
activities =
[user.ap_id | user.following]
|> ActivityPub.fetch_activities(params)
- |> ActivityPub.contain_timeline(user)
- |> Enum.reverse()
Enum.each(activities, fn activity ->
puts_activity(activity)
state
end
- def handle_command(_state, command) do
+ def handle_command(state, command) do
IO.puts("Unknown command '#{command}'")
+ state
end
defp wait_input(state, input) do