mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-18 23:51:01 +00:00
Webfinger fixes.
This commit is contained in:
parent
5bd3b3a215
commit
3c61df6b9e
2 changed files with 6 additions and 6 deletions
|
@ -45,7 +45,7 @@ defmodule Pleroma.Web.WebFinger do
|
||||||
|
|
||||||
def represent_user(user, "JSON") do
|
def represent_user(user, "JSON") do
|
||||||
{:ok, user} = ensure_keys_present(user)
|
{:ok, user} = ensure_keys_present(user)
|
||||||
{:ok, _private, public} = Salmon.keys_from_pem(user.info["keys"])
|
{:ok, _private, public} = Salmon.keys_from_pem(user.info.keys)
|
||||||
magic_key = Salmon.encode_key(public)
|
magic_key = Salmon.encode_key(public)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
@ -83,7 +83,7 @@ defmodule Pleroma.Web.WebFinger do
|
||||||
|
|
||||||
def represent_user(user, "XML") do
|
def represent_user(user, "XML") do
|
||||||
{:ok, user} = ensure_keys_present(user)
|
{:ok, user} = ensure_keys_present(user)
|
||||||
{:ok, _private, public} = Salmon.keys_from_pem(user.info["keys"])
|
{:ok, _private, public} = Salmon.keys_from_pem(user.info.keys)
|
||||||
magic_key = Salmon.encode_key(public)
|
magic_key = Salmon.encode_key(public)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,15 +99,15 @@ defmodule Pleroma.Web.WebFingerTest do
|
||||||
describe "ensure_keys_present" do
|
describe "ensure_keys_present" do
|
||||||
test "it creates keys for a user and stores them in info" do
|
test "it creates keys for a user and stores them in info" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
refute is_binary(user.info["keys"])
|
refute is_binary(user.info.keys)
|
||||||
{:ok, user} = WebFinger.ensure_keys_present(user)
|
{:ok, user} = WebFinger.ensure_keys_present(user)
|
||||||
assert is_binary(user.info["keys"])
|
assert is_binary(user.info.keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it doesn't create keys if there already are some" do
|
test "it doesn't create keys if there already are some" do
|
||||||
user = insert(:user, %{info: %{"keys" => "xxx"}})
|
user = insert(:user, %{info: %{keys: "xxx"}})
|
||||||
{:ok, user} = WebFinger.ensure_keys_present(user)
|
{:ok, user} = WebFinger.ensure_keys_present(user)
|
||||||
assert user.info["keys"] == "xxx"
|
assert user.info.keys == "xxx"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue