Squashed commit of the following:

commit f02ac2b94326054a842a65ed5a2b851351c1d533
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sat Sep 16 18:44:52 2017 +0100

    update changelog

commit 2e77668cae03246189d8ce931f9ab29d2531d522
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sat Sep 16 18:44:45 2017 +0100

    Add a middleware for adding AS2.0 header links

commit 931ba1fe5dd2eacf32e4da3eefec081173dee8de
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sat Sep 16 18:44:16 2017 +0100

    remove references to AS2.0 links
This commit is contained in:
Jonny Barnes 2017-09-16 18:45:06 +01:00
parent 53abe5a42d
commit 309864ba76
5 changed files with 32 additions and 7 deletions

View file

@ -27,9 +27,8 @@ class NotesController extends Controller
->withCount(['webmentions As replies' => function ($query) { ->withCount(['webmentions As replies' => function ($query) {
$query->where('type', 'in-reply-to'); $query->where('type', 'in-reply-to');
}])->paginate(10); }])->paginate(10);
$aslink = config('app.url');
return view('notes.index', compact('notes', 'aslink')); return view('notes.index', compact('notes'));
} }
/** /**
@ -46,9 +45,7 @@ class NotesController extends Controller
return (new ActivityStreamsService)->singleNoteResponse($note); return (new ActivityStreamsService)->singleNoteResponse($note);
} }
$aslink = $note->longurl; return view('notes.show', compact('note'));
return view('notes.show', compact('note', 'aslink'));
} }
/** /**

View file

@ -38,6 +38,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\LinkHeadersMiddleware::class, \App\Http\Middleware\LinkHeadersMiddleware::class,
//\App\Http\Middleware\DevTokenMiddleware::class, //\App\Http\Middleware\DevTokenMiddleware::class,
\App\Http\Middleware\LocalhostSessionMiddleware::class, \App\Http\Middleware\LocalhostSessionMiddleware::class,
\App\Http\Middleware\ActivityStreamLinks::class,
], ],
'api' => [ 'api' => [

View file

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Closure;
class ActivityStreamLinks
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
if ($request->path() === '/') {
$response->header('Link', '<' . config('app.url') . '>; rel="application/activity+json"', false);
}
if ($request->is('notes/*')) {
$response->header('Link', '<' . $request->url() . '>; rel="application/activity+json"', false);
}
return $response;
}
}

View file

@ -2,6 +2,7 @@
## Version {next} ## Version {next}
- Order notes by latest (issue#70) - Order notes by latest (issue#70)
- AcitivtyStream support is now indicated with HTTP Link headers
## Version 0.8 (2017-09-16) ## Version 0.8 (2017-09-16)
- Improve embedding of tweets (issue#66) - Improve embedding of tweets (issue#66)

View file

@ -12,8 +12,6 @@
<link rel="alternate" type="application/rss+xml" title="Notes RSS Feed" href="/notes/feed.rss"> <link rel="alternate" type="application/rss+xml" title="Notes RSS Feed" href="/notes/feed.rss">
<link rel="alternate" type="application/atom+xml" title="Notes Atom Feed" href="/notes/feed.atom"> <link rel="alternate" type="application/atom+xml" title="Notes Atom Feed" href="/notes/feed.atom">
<link rel="alternate" type="application/json" title="Notes JSON Feed" href="/notes/feed.json"> <link rel="alternate" type="application/json" title="Notes JSON Feed" href="/notes/feed.json">
@isset($aslink) <link rel="alternate" type="application/activity+json" href="{{ $aslink }}">
@endisset
<link rel="openid.server" href="https://indieauth.com/openid"> <link rel="openid.server" href="https://indieauth.com/openid">
<link rel="openid.delegate" href="{{ config('app.url') }}"> <link rel="openid.delegate" href="{{ config('app.url') }}">
<link rel="authorization_endpoint" href="https://indieauth.com/auth"> <link rel="authorization_endpoint" href="https://indieauth.com/auth">