now profile pictures are federalized as well
This commit is contained in:
parent
9b23a1beba
commit
4f254ed9cf
@ -57,7 +57,9 @@ class ProfileController extends Controller
|
|||||||
Storage::disk ("public")->put ("avatars/" . $fname, $image_data);
|
Storage::disk ("public")->put ("avatars/" . $fname, $image_data);
|
||||||
|
|
||||||
$old_avatar = $user->avatar;
|
$old_avatar = $user->avatar;
|
||||||
|
|
||||||
$user->avatar = $fname;
|
$user->avatar = $fname;
|
||||||
|
$user->actor->icon = env ("APP_URL") . $user->avatar;
|
||||||
|
|
||||||
$changing_avatar = true;
|
$changing_avatar = true;
|
||||||
}
|
}
|
||||||
@ -71,6 +73,9 @@ class ProfileController extends Controller
|
|||||||
$user->interests_heroes = $incoming_fields["heroes"];
|
$user->interests_heroes = $incoming_fields["heroes"];
|
||||||
$user->save ();
|
$user->save ();
|
||||||
|
|
||||||
|
$user->actor->summary = $user->bio;
|
||||||
|
$user->actor->save ();
|
||||||
|
|
||||||
if ($changing_avatar)
|
if ($changing_avatar)
|
||||||
{
|
{
|
||||||
Storage::disk ("public")->delete (str_replace ("/storage/", "", $old_avatar));
|
Storage::disk ("public")->delete (str_replace ("/storage/", "", $old_avatar));
|
||||||
|
@ -33,6 +33,11 @@ class Actor extends Model
|
|||||||
"private_key"
|
"private_key"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function user ()
|
||||||
|
{
|
||||||
|
return $this->belongsTo (User::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function create_from_user (User $user)
|
public function create_from_user (User $user)
|
||||||
{
|
{
|
||||||
$app_url = Config::get ("app.url");
|
$app_url = Config::get ("app.url");
|
||||||
@ -74,7 +79,7 @@ class Actor extends Model
|
|||||||
|
|
||||||
public static function build_response (Actor $actor)
|
public static function build_response (Actor $actor)
|
||||||
{
|
{
|
||||||
return [
|
$response = [
|
||||||
"@context" => [
|
"@context" => [
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
"https://w3id.org/security/v1"
|
"https://w3id.org/security/v1"
|
||||||
@ -96,11 +101,25 @@ class Actor extends Model
|
|||||||
"name" => $actor->name,
|
"name" => $actor->name,
|
||||||
"summary" => $actor->summary,
|
"summary" => $actor->summary,
|
||||||
|
|
||||||
|
"icon" => [
|
||||||
|
"type" => "Image",
|
||||||
|
"mediaType" => "image/jpeg",
|
||||||
|
"url" => $actor->icon
|
||||||
|
],
|
||||||
|
|
||||||
|
"image" => [
|
||||||
|
"type" => "Image",
|
||||||
|
"mediaType" => "image/jpeg",
|
||||||
|
"url" => $actor->icon
|
||||||
|
],
|
||||||
|
|
||||||
"publicKey" => [
|
"publicKey" => [
|
||||||
"id" => $actor->actor_id . "#main-key",
|
"id" => $actor->actor_id . "#main-key",
|
||||||
"owner" => $actor->actor_id,
|
"owner" => $actor->actor_id,
|
||||||
"publicKeyPem" => $actor->public_key
|
"publicKeyPem" => $actor->public_key
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ return new class extends Migration
|
|||||||
$table->string ("public_key")->nullable ();
|
$table->string ("public_key")->nullable ();
|
||||||
$table->string ("private_key")->nullable ();
|
$table->string ("private_key")->nullable ();
|
||||||
|
|
||||||
|
$table->string ("icon")->nullable ();
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user