mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-19 13:01:26 +00:00
Merge pull request #752 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
217bd63406
2 changed files with 36 additions and 2 deletions
|
@ -239,7 +239,7 @@ XML;
|
|||
}
|
||||
$signatureData = HttpSignature::parseSignatureHeader($signature);
|
||||
$keyId = Helpers::validateUrl($signatureData['keyId']);
|
||||
$actor = Profile::whereKeyId($keyId)->first();
|
||||
$actor = Profile::whereKeyId($keyId)->whereNotNull('remote_url')->firstOrFail();
|
||||
$res = Zttp::timeout(5)->withHeaders([
|
||||
'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
||||
'User-Agent' => 'PixelFedBot v0.1 - https://pixelfed.org',
|
||||
|
|
|
@ -9,6 +9,7 @@ use App\Media;
|
|||
use App\Profile;
|
||||
use App\Status;
|
||||
use App\Transformer\ActivityPub\StatusTransformer;
|
||||
use App\Transformer\ActivityPub\Verb\CreateNote;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Cache;
|
||||
|
@ -55,6 +56,39 @@ class StatusController extends Controller
|
|||
return view($template, compact('user', 'status'));
|
||||
}
|
||||
|
||||
public function showObject(Request $request, $username, int $id)
|
||||
{
|
||||
$user = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||
|
||||
if($user->status != null) {
|
||||
return ProfileController::accountCheck($user);
|
||||
}
|
||||
|
||||
$status = Status::whereProfileId($user->id)
|
||||
->whereNotIn('visibility',['draft','direct'])
|
||||
->findOrFail($id);
|
||||
|
||||
if($status->uri) {
|
||||
$url = $status->uri;
|
||||
if(ends_with($url, '/activity')) {
|
||||
$url = str_replace('/activity', '', $url);
|
||||
}
|
||||
return redirect($url);
|
||||
}
|
||||
|
||||
if($status->visibility == 'private' || $user->is_private) {
|
||||
if(!Auth::check()) {
|
||||
abort(403);
|
||||
}
|
||||
$pid = Auth::user()->profile;
|
||||
if($user->followedBy($pid) == false && $user->id !== $pid->id) {
|
||||
abort(403);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->showActivityPub($request, $status);
|
||||
}
|
||||
|
||||
public function compose()
|
||||
{
|
||||
$this->authCheck();
|
||||
|
@ -213,7 +247,7 @@ class StatusController extends Controller
|
|||
public function showActivityPub(Request $request, $status)
|
||||
{
|
||||
$fractal = new Fractal\Manager();
|
||||
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
||||
$resource = new Fractal\Resource\Item($status, new CreateNote());
|
||||
$res = $fractal->createData($resource)->toArray();
|
||||
|
||||
return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
|
||||
|
|
Loading…
Reference in a new issue