Merge branch 'feature/incoming_ostatus' of ssh.gitgud.io:lambadalambda/pleroma into feature/incoming_ostatus
commit
9e9d95ec99
@ -0,0 +1,32 @@
|
|||||||
|
defmodule Pleroma.Web.Federator do
|
||||||
|
alias Pleroma.User
|
||||||
|
require Logger
|
||||||
|
|
||||||
|
@websub_verifier Application.get_env(:pleroma, :websub_verifier)
|
||||||
|
|
||||||
|
def handle(:publish, activity) do
|
||||||
|
Logger.debug("Running publish for #{activity.data["id"]}")
|
||||||
|
with actor when not is_nil(actor) <- User.get_cached_by_ap_id(activity.data["actor"]) do
|
||||||
|
Pleroma.Web.Websub.publish(Pleroma.Web.OStatus.feed_path(actor), actor, activity)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle(:verify_websub, websub) do
|
||||||
|
Logger.debug("Running websub verification for #{websub.id} (#{websub.topic}, #{websub.callback})")
|
||||||
|
@websub_verifier.verify(websub)
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle(type, payload) do
|
||||||
|
Logger.debug("Unknown task: #{type}")
|
||||||
|
{:error, "Don't know what do do with this"}
|
||||||
|
end
|
||||||
|
|
||||||
|
def enqueue(type, payload) do
|
||||||
|
# for now, just run immediately in a new process.
|
||||||
|
if Mix.env == :test do
|
||||||
|
handle(type, payload)
|
||||||
|
else
|
||||||
|
spawn(fn -> handle(type, payload) end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
defmodule Pleroma.Web.Websub.WebsubClientSubscription do
|
||||||
|
use Ecto.Schema
|
||||||
|
|
||||||
|
schema "websub_client_subscriptions" do
|
||||||
|
field :topic, :string
|
||||||
|
field :secret, :string
|
||||||
|
field :valid_until, :naive_datetime
|
||||||
|
field :state, :string
|
||||||
|
field :subscribers, {:array, :string}, default: []
|
||||||
|
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
defmodule Pleroma.Repo.Migrations.CreateWebsubClientSubscription do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create table(:websub_client_subscriptions) do
|
||||||
|
add :topic, :string
|
||||||
|
add :secret, :string
|
||||||
|
add :valid_until, :naive_datetime
|
||||||
|
add :state, :string
|
||||||
|
add :subscribers, :map
|
||||||
|
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEowIBAAKCAQEAqnWeDtrqWasCKNXiuSq1tSCLI5H7BSvIROy5YfuGsXHrIlCq
|
||||||
|
LdIm9QlIUUmIi9QyzgiGEDsPCCkA1UguCVgF/UrJ1+FvHcHsTELkkBu/yCl9mrgt
|
||||||
|
WzTckhb6KjOhqtxi/TKgRaJ2Rlwz2bvH5sbCP9qffthitdxfh14KC5V0gqDt1xCy
|
||||||
|
WgZo79vbYMcVkcQoh5uLtG64ksYFBMfgnLaSj7xg5i2qCDiIY7bqBujo5HllDqeo
|
||||||
|
w3LXmsztt1cT8heXEjW0SYJvAHJK00OsG1kp4cqhfKzxLCHNGQJVHQxLOXy97I7o
|
||||||
|
HOeuhbxPhjpGSBMgw7YFm3ODXviqf557eqFcaQIDAQABAoIBAC6f+VnK22sncXHF
|
||||||
|
/zvyyL0AZ86U8XpanW7s6VA5wn/qzwwV0Fa0Mt+3aEaDvIuywSrF/hWWcegjfwzX
|
||||||
|
r2/y2cCMomUgTopvLrk1WttoG68eWjLlydI2xVZYXpkIgmH/4juri1dAtuVL9wrJ
|
||||||
|
aEZhe2SH4jSJ74Ya/y5BtLGycaoA9FHyIzHPTx52Ix2jWKWtKimW8J+aERi2uHdN
|
||||||
|
7yTnLT2APhs5fnvNnn0tg85CI3Ny2GNiqmAail14yVfRz8Sf6qDIepH5Jfz9oll4
|
||||||
|
I+GYUOLs6eTgkHXBn8LGhtHTE/9UJmb42OyWrW8X+nc/Mjz5xh0u/g1Gdp36oU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issue