Remove short domain #34
69 changed files with 516 additions and 705 deletions
|
|
@ -60,7 +60,7 @@ class PasskeysController extends Controller
|
|||
// RP Entity i.e. the application
|
||||
$rpEntity = PublicKeyCredentialRpEntity::create(
|
||||
config('app.name'),
|
||||
config('url.longurl'),
|
||||
config('app.url'),
|
||||
);
|
||||
|
||||
// User Entity
|
||||
|
|
@ -148,7 +148,7 @@ class PasskeysController extends Controller
|
|||
);
|
||||
$securedRelyingPartyId = [];
|
||||
if (App::environment('local', 'development')) {
|
||||
$securedRelyingPartyId = [config('url.longurl')];
|
||||
$securedRelyingPartyId = [config('app.url')];
|
||||
}
|
||||
$ceremonyStepManagerFactory->setSecuredRelyingPartyId($securedRelyingPartyId);
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ class PasskeysController extends Controller
|
|||
$publicKeyCredentialSource = $authenticatorAttestationResponseValidator->check(
|
||||
authenticatorAttestationResponse: $publicKeyCredential->response,
|
||||
publicKeyCredentialCreationOptions: $publicKeyCredentialCreationOptions,
|
||||
request: config('url.longurl'),
|
||||
request: config('app.url'),
|
||||
securedRelyingPartyId: $securedRelyingPartyId,
|
||||
);
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ class PasskeysController extends Controller
|
|||
);
|
||||
$securedRelyingPartyId = [];
|
||||
if (App::environment('local', 'development')) {
|
||||
$securedRelyingPartyId = [config('url.longurl')];
|
||||
$securedRelyingPartyId = [config('app.url')];
|
||||
}
|
||||
$ceremonyStepManagerFactory->setSecuredRelyingPartyId($securedRelyingPartyId);
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ class PasskeysController extends Controller
|
|||
credentialId: $publicKeyCredentialSource,
|
||||
authenticatorAssertionResponse: $publicKeyCredential->response,
|
||||
publicKeyCredentialRequestOptions: $publicKeyCredentialRequestOptions,
|
||||
request: config('url.longurl'),
|
||||
request: config('app.url'),
|
||||
userHandle: null,
|
||||
securedRelyingPartyId: $securedRelyingPartyId,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ class FeedsController extends Controller
|
|||
|
||||
foreach ($notes as $key => $note) {
|
||||
$data['items'][$key] = [
|
||||
'id' => $note->longurl,
|
||||
'url' => $note->longurl,
|
||||
'id' => $note->uri,
|
||||
'url' => $note->uri,
|
||||
'content_text' => $note->content,
|
||||
'date_published' => $note->created_at->tz('UTC')->toRfc3339String(),
|
||||
'date_modified' => $note->updated_at->tz('UTC')->toRfc3339String(),
|
||||
|
|
@ -164,7 +164,7 @@ class FeedsController extends Controller
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.display_name'),
|
||||
'url' => config('url.longurl'),
|
||||
'url' => config('app.url'),
|
||||
],
|
||||
'children' => $items,
|
||||
], 200, [
|
||||
|
|
@ -183,8 +183,8 @@ class FeedsController extends Controller
|
|||
$items[] = [
|
||||
'type' => 'entry',
|
||||
'published' => $note->created_at,
|
||||
'uid' => $note->longurl,
|
||||
'url' => $note->longurl,
|
||||
'uid' => $note->uri,
|
||||
'url' => $note->uri,
|
||||
'content' => [
|
||||
'text' => $note->getRawOriginal('note'),
|
||||
'html' => $note->note,
|
||||
|
|
@ -200,7 +200,7 @@ class FeedsController extends Controller
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.display_name'),
|
||||
'url' => config('url.longurl'),
|
||||
'url' => config('app.url'),
|
||||
],
|
||||
'children' => $items,
|
||||
], 200, [
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
/**
|
||||
* @psalm-suppress UnusedClass
|
||||
*/
|
||||
class ShortURLsController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Short URL Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This redirects the short urls to long ones
|
||||
|
|
||||
*/
|
||||
|
||||
/**
|
||||
* Redirect from '/' to the long url.
|
||||
*/
|
||||
public function baseURL(): RedirectResponse
|
||||
{
|
||||
return redirect(config('app.url'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect from '/@' to a twitter profile.
|
||||
*/
|
||||
public function twitter(): RedirectResponse
|
||||
{
|
||||
return redirect('https://twitter.com/jonnybarnes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect a short url of this site out to a long one based on post type.
|
||||
*
|
||||
* Further redirects may happen.
|
||||
*/
|
||||
public function expandType(string $type, string $postId): RedirectResponse
|
||||
{
|
||||
if ($type === 't') {
|
||||
$type = 'notes';
|
||||
}
|
||||
if ($type === 'b') {
|
||||
$type = 'blog/s';
|
||||
}
|
||||
|
||||
return redirect(config('app.url') . '/' . $type . '/' . $postId);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
// check webmention still references target
|
||||
// we try each type of mention (reply/like/repost)
|
||||
if ($webmention->type === 'in-reply-to') {
|
||||
if ($parser->checkInReplyTo($microformats, $this->note->longurl) === false) {
|
||||
if ($parser->checkInReplyTo($microformats, $this->note->uri) === false) {
|
||||
// it doesn’t so delete
|
||||
$webmention->delete();
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
return;
|
||||
}
|
||||
if ($webmention->type === 'like-of') {
|
||||
if ($parser->checkLikeOf($microformats, $this->note->longurl) === false) {
|
||||
if ($parser->checkLikeOf($microformats, $this->note->uri) === false) {
|
||||
// it doesn’t so delete
|
||||
$webmention->delete();
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
} // note we don’t need to do anything if it still is a like
|
||||
}
|
||||
if ($webmention->type === 'repost-of') {
|
||||
if ($parser->checkRepostOf($microformats, $this->note->longurl) === false) {
|
||||
if ($parser->checkRepostOf($microformats, $this->note->uri) === false) {
|
||||
// it doesn’t so delete
|
||||
$webmention->delete();
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
$type = $parser->getMentionType($microformats); // throw error here?
|
||||
dispatch(new SaveProfileImage($microformats));
|
||||
$webmention->source = $this->source;
|
||||
$webmention->target = $this->note->longurl;
|
||||
$webmention->target = $this->note->uri;
|
||||
$webmention->commentable_id = $this->note->id;
|
||||
$webmention->commentable_type = Note::class;
|
||||
$webmention->type = $type;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class SendWebMentions implements ShouldQueue
|
|||
$guzzle = resolve(Client::class);
|
||||
$guzzle->post($endpoint, [
|
||||
'form_params' => [
|
||||
'source' => $this->note->longurl,
|
||||
'source' => $this->note->uri,
|
||||
'target' => $url,
|
||||
],
|
||||
]);
|
||||
|
|
@ -61,7 +61,7 @@ class SendWebMentions implements ShouldQueue
|
|||
public function discoverWebmentionEndpoint(string $url): ?string
|
||||
{
|
||||
// let’s not send webmentions to myself
|
||||
if (parse_url($url, PHP_URL_HOST) === config('url.longurl')) {
|
||||
if (parse_url($url, PHP_URL_HOST) === parse_url(config('app.url'), PHP_URL_HOST)) {
|
||||
return null;
|
||||
}
|
||||
if (Str::startsWith($url, '/notes/tagged/')) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Bookmark extends Model
|
|||
return $this->belongsToMany('App\Models\Tag');
|
||||
}
|
||||
|
||||
protected function longurl(): Attribute
|
||||
protected function local_uri(): Attribute
|
||||
{
|
||||
return Attribute::get(
|
||||
get: fn () => config('app.url') . '/bookmarks/' . $this->id,
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class Note extends Model
|
|||
public function getNoteAttribute(?string $value): ?string
|
||||
{
|
||||
if ($value === null && $this->place !== null) {
|
||||
$value = '📍: <a href="' . $this->place->longurl . '">' . $this->place->name . '</a>';
|
||||
$value = '📍: <a href="' . $this->place->uri . '">' . $this->place->name . '</a>';
|
||||
}
|
||||
|
||||
// if $value is still null, just return null
|
||||
|
|
@ -172,16 +172,11 @@ class Note extends Model
|
|||
return (string) resolve(Numbers::class)->numto60($this->id);
|
||||
}
|
||||
|
||||
public function getLongurlAttribute(): string
|
||||
public function getUriAttribute(): string
|
||||
{
|
||||
return config('app.url') . '/notes/' . $this->nb60id;
|
||||
}
|
||||
|
||||
public function getShorturlAttribute(): string
|
||||
{
|
||||
return config('url.shorturl') . '/notes/' . $this->nb60id;
|
||||
}
|
||||
|
||||
public function getIso8601Attribute(): string
|
||||
{
|
||||
return $this->updated_at->toISO8601String();
|
||||
|
|
|
|||
|
|
@ -74,24 +74,10 @@ class Place extends Model
|
|||
]));
|
||||
}
|
||||
|
||||
protected function longurl(): Attribute
|
||||
{
|
||||
return Attribute::get(
|
||||
get: fn ($value, $attributes) => config('app.url') . '/places/' . $attributes['slug'],
|
||||
);
|
||||
}
|
||||
|
||||
protected function shorturl(): Attribute
|
||||
{
|
||||
return Attribute::get(
|
||||
get: fn ($value, $attributes) => config('url.shorturl') . '/places/' . $attributes['slug'],
|
||||
);
|
||||
}
|
||||
|
||||
protected function uri(): Attribute
|
||||
{
|
||||
return Attribute::get(
|
||||
get: fn () => $this->longurl,
|
||||
get: static fn ($value, $attributes) => config('app.url') . '/places/' . $attributes['slug'],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ class HCardService
|
|||
$data['longitude'] = Arr::get($request, 'longitude');
|
||||
}
|
||||
|
||||
return resolve(PlaceService::class)->createPlace($data)->longurl;
|
||||
return resolve(PlaceService::class)->createPlace($data)->uri;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ class HEntryService
|
|||
public function process(array $request, ?string $client = null): ?string
|
||||
{
|
||||
if (Arr::get($request, 'properties.like-of') || Arr::get($request, 'like-of')) {
|
||||
return resolve(LikeService::class)->create($request)->longurl;
|
||||
return resolve(LikeService::class)->create($request)->url;
|
||||
}
|
||||
|
||||
if (Arr::get($request, 'properties.bookmark-of') || Arr::get($request, 'bookmark-of')) {
|
||||
return resolve(BookmarkService::class)->create($request)->longurl;
|
||||
return resolve(BookmarkService::class)->create($request)->uri;
|
||||
}
|
||||
|
||||
if (Arr::get($request, 'properties.name') || Arr::get($request, 'name')) {
|
||||
return resolve(ArticleService::class)->create($request)->longurl;
|
||||
return resolve(ArticleService::class)->create($request)->link;
|
||||
}
|
||||
|
||||
return resolve(NoteService::class)->create($request, $client)->longurl;
|
||||
return resolve(NoteService::class)->create($request, $client)->uri;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Here we set the long and short URLs our app shall use
|
||||
* You can override these settings in the .env file
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Long URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The long URL for the application
|
||||
|
|
||||
*/
|
||||
|
||||
'longurl' => env('APP_LONGURL', 'longurl.local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Short URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The short URL for the application
|
||||
|
|
||||
*/
|
||||
|
||||
'shorturl' => env('APP_SHORTURL', 'shorturl.local'),
|
||||
|
||||
];
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<channel>
|
||||
<title>{{ config('user.display_name') }}</title>
|
||||
<atom:link href="{{ config('app.url') }}/blog/feed.rss" rel="self" type="application/rss+xml" />
|
||||
<description>An RSS feed of the blog posts found on {{ config('url.longurl') }}</description>
|
||||
<description>An RSS feed of the blog posts found on {{ config('app.url') }}</description>
|
||||
<link>{{ config('app.url') }}/blog</link>
|
||||
<lastBuildDate>{{ $buildDate }}</lastBuildDate>
|
||||
<ttl>1800</ttl>
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@
|
|||
@foreach($bookmarks as $bookmark)
|
||||
<div class="h-entry">
|
||||
<div class="bookmark-link">
|
||||
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->url }}">
|
||||
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->uri }}">
|
||||
@isset($bookmark->name)
|
||||
{{ $bookmark->name }}
|
||||
@endisset
|
||||
|
||||
@empty($bookmark->name)
|
||||
{{ $bookmark->url }}
|
||||
{{ $bookmark->uri }}
|
||||
@endempty
|
||||
</a> <a href="{{ $bookmark->longurl }}">🔗</a>
|
||||
</a> <a href="{{ $bookmark->uri }}">🔗</a>
|
||||
</div>
|
||||
@isset($bookmark->content)
|
||||
<p>{{ $bookmark->content }}</p>
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@
|
|||
@foreach($bookmarks as $bookmark)
|
||||
<div class="h-entry">
|
||||
<div class="bookmark-link">
|
||||
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->url }}">
|
||||
<a class="u-bookmark-of<?php if ($bookmark->name !== null) { echo ' h-cite'; } ?>" href="{{ $bookmark->uri }}">
|
||||
@isset($bookmark->name)
|
||||
{{ $bookmark->name }}
|
||||
@endisset
|
||||
|
||||
@empty($bookmark->name)
|
||||
{{ $bookmark->url }}
|
||||
{{ $bookmark->uri }}
|
||||
@endempty
|
||||
</a> <a href="{{ $bookmark->longurl }}">🔗</a>
|
||||
</a> <a href="{{ $bookmark->uri }}">🔗</a>
|
||||
</div>
|
||||
@isset($bookmark->content)
|
||||
<p>{{ $bookmark->content }}</p>
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
@foreach($notes as $note)
|
||||
<entry>
|
||||
<title>{{ strip_tags($note->note) }}</title>
|
||||
<link href="{{ $note->longurl }}" />
|
||||
<id>{{ $note->longurl }}</id>
|
||||
<link href="{{ $note->uri }}" />
|
||||
<id>{{ $note->uri }}</id>
|
||||
<updated>{{ $note->updated_at->toAtomString() }}</updated>
|
||||
<content type="html">{{ $note->note }}</content>
|
||||
<author>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<channel>
|
||||
<title>{{ config('user.display_name') }}</title>
|
||||
<atom:link href="{{ config('app.url') }}/notes/feed.rss" rel="self" type="application/rss+xml" />
|
||||
<description>An RSS feed of the notes found on {{ config('url.longurl') }}</description>
|
||||
<description>An RSS feed of the notes found on {{ config('app.url') }}</description>
|
||||
<link>{{ config('app.url') }}/notes</link>
|
||||
<lastBuildDate>{{ $buildDate }}</lastBuildDate>
|
||||
<ttl>1800</ttl>
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
{!! $note->note !!}
|
||||
]]>
|
||||
</description>
|
||||
<link>{{ $note->longurl }}</link>
|
||||
<guid>{{ $note->longurl}}</guid>
|
||||
<link>{{ $note->uri }}</link>
|
||||
<guid>{{ $note->uri}}</guid>
|
||||
<pubDate>{{ $note->pubdate }}</pubDate>
|
||||
</item>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
@if($note->client) via <a class="client" href="{{ $note->client->client_url }}">{{ $note->client->client_name }}</a>@endif
|
||||
@if($note->place)
|
||||
@if($note->getOriginal('note'))
|
||||
in <span class="p-location h-card"><a class="p-name u-url" href="{{ $note->place->longurl }}">{{ $note->address }}</a><data class="p-latitude" value="{{ $note->place->latitude }}"></data><data class="p-longitude" value="{{ $note->place->longitude }}"></data></span>
|
||||
in <span class="p-location h-card"><a class="p-name u-url" href="{{ $note->place->uri }}">{{ $note->address }}</a><data class="p-latitude" value="{{ $note->place->latitude }}"></data><data class="p-longitude" value="{{ $note->place->longitude }}"></data></span>
|
||||
@endif
|
||||
@elseif($note->address)
|
||||
in <span class="p-location h-adr">{!! $note->address !!}<data class="p-latitude" value="{{ $note->latitude }}"></data><data class="p-longitude" value="{{ $note->longitude }}"></data></span>
|
||||
|
|
|
|||
126
routes/web.php
126
routes/web.php
|
|
@ -23,7 +23,6 @@ use App\Http\Controllers\MicropubMediaController;
|
|||
use App\Http\Controllers\NotesController;
|
||||
use App\Http\Controllers\PlacesController;
|
||||
use App\Http\Controllers\SearchController;
|
||||
use App\Http\Controllers\ShortURLsController;
|
||||
use App\Http\Controllers\WebMentionsController;
|
||||
use App\Http\Middleware\CorsHeaders;
|
||||
use App\Http\Middleware\MyAuthMiddleware;
|
||||
|
|
@ -41,27 +40,26 @@ use Illuminate\Support\Facades\Route;
|
|||
|
|
||||
*/
|
||||
|
||||
Route::domain(config('url.longurl'))->group(function () {
|
||||
Route::get('/', [FrontPageController::class, 'index']);
|
||||
Route::get('/', [FrontPageController::class, 'index']);
|
||||
|
||||
// Static project page
|
||||
Route::view('projects', 'projects');
|
||||
// Static project page
|
||||
Route::view('projects', 'projects');
|
||||
|
||||
// Static colophon page
|
||||
Route::view('colophon', 'colophon');
|
||||
// Static colophon page
|
||||
Route::view('colophon', 'colophon');
|
||||
|
||||
// The login routes to get auth’d for admin
|
||||
Route::get('login', [AuthController::class, 'showLogin'])->name('login');
|
||||
Route::post('login', [AuthController::class, 'login']);
|
||||
Route::get('login/passkey', [PasskeysController::class, 'getRequestOptions']);
|
||||
Route::post('login/passkey', [PasskeysController::class, 'login']);
|
||||
// The login routes to get auth’d for admin
|
||||
Route::get('login', [AuthController::class, 'showLogin'])->name('login');
|
||||
Route::post('login', [AuthController::class, 'login']);
|
||||
Route::get('login/passkey', [PasskeysController::class, 'getRequestOptions']);
|
||||
Route::post('login/passkey', [PasskeysController::class, 'login']);
|
||||
|
||||
// And the logout routes
|
||||
Route::get('logout', [AuthController::class, 'showLogout'])->name('logout');
|
||||
Route::post('logout', [AuthController::class, 'logout']);
|
||||
// And the logout routes
|
||||
Route::get('logout', [AuthController::class, 'showLogout'])->name('logout');
|
||||
Route::post('logout', [AuthController::class, 'logout']);
|
||||
|
||||
// Admin pages grouped for filter
|
||||
Route::middleware(MyAuthMiddleware::class)->prefix('admin')->group(function () {
|
||||
// Admin pages grouped for filter
|
||||
Route::middleware(MyAuthMiddleware::class)->prefix('admin')->group(function () {
|
||||
Route::get('/', [HomeController::class, 'welcome']);
|
||||
|
||||
// Articles
|
||||
|
|
@ -150,10 +148,10 @@ Route::domain(config('url.longurl'))->group(function () {
|
|||
Route::get('register', [PasskeysController::class, 'getCreateOptions']);
|
||||
Route::post('register', [PasskeysController::class, 'create']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Blog pages using ArticlesController
|
||||
Route::prefix('blog')->group(function () {
|
||||
// Blog pages using ArticlesController
|
||||
Route::prefix('blog')->group(function () {
|
||||
Route::get('/feed.rss', [FeedsController::class, 'blogRss']);
|
||||
Route::get('/feed.atom', [FeedsController::class, 'blogAtom']);
|
||||
Route::get('/feed.json', [FeedsController::class, 'blogJson']);
|
||||
|
|
@ -161,10 +159,10 @@ Route::domain(config('url.longurl'))->group(function () {
|
|||
Route::get('/s/{id}', [ArticlesController::class, 'onlyIdInURL']);
|
||||
Route::get('/{year?}/{month?}', [ArticlesController::class, 'index'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{2}']);
|
||||
Route::get('/{year}/{month}/{slug}', [ArticlesController::class, 'show'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{2}']);
|
||||
});
|
||||
});
|
||||
|
||||
// Notes pages using NotesController
|
||||
Route::prefix('notes')->group(function () {
|
||||
// Notes pages using NotesController
|
||||
Route::prefix('notes')->group(function () {
|
||||
Route::get('/', [NotesController::class, 'index']);
|
||||
Route::get('/feed.rss', [FeedsController::class, 'notesRss']);
|
||||
Route::get('/feed.atom', [FeedsController::class, 'notesAtom']);
|
||||
|
|
@ -173,69 +171,53 @@ Route::domain(config('url.longurl'))->group(function () {
|
|||
Route::get('/new', [NotesController::class, 'create']);
|
||||
Route::get('/{id}', [NotesController::class, 'show']);
|
||||
Route::get('/tagged/{tag}', [NotesController::class, 'tagged']);
|
||||
});
|
||||
Route::get('note/{id}', [NotesController::class, 'redirect']); // for legacy note URLs
|
||||
});
|
||||
Route::get('note/{id}', [NotesController::class, 'redirect']); // for legacy note URLs
|
||||
|
||||
// Likes
|
||||
Route::prefix('likes')->group(function () {
|
||||
// Likes
|
||||
Route::prefix('likes')->group(function () {
|
||||
Route::get('/', [LikesController::class, 'index']);
|
||||
Route::get('/{like}', [LikesController::class, 'show']);
|
||||
});
|
||||
});
|
||||
|
||||
// Bookmarks
|
||||
Route::prefix('bookmarks')->group(function () {
|
||||
// Bookmarks
|
||||
Route::prefix('bookmarks')->group(function () {
|
||||
Route::get('/', [BookmarksController::class, 'index']);
|
||||
Route::redirect('/tagged', '/bookmarks');
|
||||
Route::get('/{bookmark}', [BookmarksController::class, 'show']);
|
||||
Route::get('/tagged/{tag}', [BookmarksController::class, 'tagged']);
|
||||
});
|
||||
});
|
||||
|
||||
// IndieAuth
|
||||
Route::get('.well-known/indieauth-server', [IndieAuthController::class, 'indieAuthMetadataEndpoint'])->name('indieauth.metadata');
|
||||
Route::get('auth', [IndieAuthController::class, 'start'])->middleware(MyAuthMiddleware::class)->name('indieauth.start');
|
||||
Route::post('auth/confirm', [IndieAuthController::class, 'confirm'])->middleware(MyAuthMiddleware::class);
|
||||
Route::post('auth', [IndieAuthController::class, 'processCodeExchange']);
|
||||
Route::post('token', [IndieAuthController::class, 'processTokenRequest'])->name('indieauth.token');
|
||||
// IndieAuth
|
||||
Route::get('.well-known/indieauth-server', [IndieAuthController::class, 'indieAuthMetadataEndpoint'])->name('indieauth.metadata');
|
||||
Route::get('auth', [IndieAuthController::class, 'start'])->middleware(MyAuthMiddleware::class)->name('indieauth.start');
|
||||
Route::post('auth/confirm', [IndieAuthController::class, 'confirm'])->middleware(MyAuthMiddleware::class);
|
||||
Route::post('auth', [IndieAuthController::class, 'processCodeExchange']);
|
||||
Route::post('token', [IndieAuthController::class, 'processTokenRequest'])->name('indieauth.token');
|
||||
|
||||
// Micropub Endpoints
|
||||
Route::get('api/post', [MicropubController::class, 'get'])->middleware(VerifyMicropubToken::class);
|
||||
Route::post('api/post', [MicropubController::class, 'post'])->middleware(VerifyMicropubToken::class)->name('micropub-endpoint');
|
||||
Route::get('api/media', [MicropubMediaController::class, 'getHandler'])->middleware(VerifyMicropubToken::class);
|
||||
Route::post('api/media', [MicropubMediaController::class, 'media'])
|
||||
// Micropub Endpoints
|
||||
Route::get('api/post', [MicropubController::class, 'get'])->middleware(VerifyMicropubToken::class);
|
||||
Route::post('api/post', [MicropubController::class, 'post'])->middleware(VerifyMicropubToken::class)->name('micropub-endpoint');
|
||||
Route::get('api/media', [MicropubMediaController::class, 'getHandler'])->middleware(VerifyMicropubToken::class);
|
||||
Route::post('api/media', [MicropubMediaController::class, 'media'])
|
||||
->middleware([VerifyMicropubToken::class, CorsHeaders::class])
|
||||
->name('media-endpoint');
|
||||
Route::options('/api/media', [MicropubMediaController::class, 'mediaOptionsResponse'])->middleware(CorsHeaders::class);
|
||||
Route::options('/api/media', [MicropubMediaController::class, 'mediaOptionsResponse'])->middleware(CorsHeaders::class);
|
||||
|
||||
// Webmention
|
||||
Route::get('webmention', [WebMentionsController::class, 'get'])->name('webmention-endpoint');
|
||||
Route::post('webmention', [WebMentionsController::class, 'receive']);
|
||||
// Webmention
|
||||
Route::get('webmention', [WebMentionsController::class, 'get'])->name('webmention-endpoint');
|
||||
Route::post('webmention', [WebMentionsController::class, 'receive']);
|
||||
|
||||
// Contacts
|
||||
Route::get('contacts', [ContactsController::class, 'index']);
|
||||
Route::get('contacts/{contact:nick}', [ContactsController::class, 'show']);
|
||||
// Contacts
|
||||
Route::get('contacts', [ContactsController::class, 'index']);
|
||||
Route::get('contacts/{contact:nick}', [ContactsController::class, 'show']);
|
||||
|
||||
// Places
|
||||
Route::get('places', [PlacesController::class, 'index']);
|
||||
Route::get('places/{place}', [PlacesController::class, 'show']);
|
||||
// Places
|
||||
Route::get('places', [PlacesController::class, 'index']);
|
||||
Route::get('places/{place}', [PlacesController::class, 'show']);
|
||||
|
||||
// Micropub
|
||||
Route::redirect('/micropub/create', '/notes/new');
|
||||
// Micropub
|
||||
Route::redirect('/micropub/create', '/notes/new');
|
||||
|
||||
// Search
|
||||
Route::get('search', [SearchController::class, 'search']);
|
||||
});
|
||||
|
||||
// Short URL
|
||||
Route::domain(config('url.shorturl'))->group(function () {
|
||||
Route::get('/', [ShortURLsController::class, 'baseURL']);
|
||||
Route::get('@', [ShortURLsController::class, 'twitter']);
|
||||
|
||||
Route::get('{type}/{id}', [ShortURLsController::class, 'expandType'])->where(
|
||||
[
|
||||
'type' => '[bt]',
|
||||
'id' => '[0-9A-HJ-NP-Z_a-km-z]+',
|
||||
]
|
||||
);
|
||||
|
||||
Route::get('h/{id}', [ShortURLsController::class, 'redirect']);
|
||||
});
|
||||
// Search
|
||||
Route::get('search', [SearchController::class, 'search']);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class AdminHomeControllerTest extends TestCase
|
|||
use RefreshDatabase;
|
||||
|
||||
#[Test]
|
||||
public function adminHomepageLoads(): void
|
||||
public function admin_homepage_loads(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
|
||||
|
|
|
|||
|
|
@ -11,21 +11,21 @@ use Tests\TestCase;
|
|||
class AdminTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function adminPageRedirectsUnauthorisedUsersToLoginPage(): void
|
||||
public function admin_page_redirects_unauthorised_users_to_login_page(): void
|
||||
{
|
||||
$response = $this->get('/admin');
|
||||
$response->assertRedirect('/login');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function loginPageLoads(): void
|
||||
public function login_page_loads(): void
|
||||
{
|
||||
$response = $this->get('/login');
|
||||
$response->assertViewIs('login');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function loginAttemptWithBadCredentialsFails(): void
|
||||
public function login_attempt_with_bad_credentials_fails(): void
|
||||
{
|
||||
$response = $this->post('/login', [
|
||||
'username' => 'bad',
|
||||
|
|
@ -35,7 +35,7 @@ class AdminTest extends TestCase
|
|||
}
|
||||
|
||||
#[Test]
|
||||
public function loginSucceeds(): void
|
||||
public function login_succeeds(): void
|
||||
{
|
||||
User::factory([
|
||||
'name' => 'admin',
|
||||
|
|
@ -51,7 +51,7 @@ class AdminTest extends TestCase
|
|||
}
|
||||
|
||||
#[Test]
|
||||
public function whenLoggedInRedirectsToAdminPage(): void
|
||||
public function when_logged_in_redirects_to_admin_page(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$response = $this->actingAs($user)->get('/login');
|
||||
|
|
@ -59,14 +59,14 @@ class AdminTest extends TestCase
|
|||
}
|
||||
|
||||
#[Test]
|
||||
public function loggedOutUsersSimplyRedirected(): void
|
||||
public function logged_out_users_simply_redirected(): void
|
||||
{
|
||||
$response = $this->get('/logout');
|
||||
$response->assertRedirect('/');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function loggedInUsersShownLogoutForm(): void
|
||||
public function logged_in_users_shown_logout_form(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$response = $this->actingAs($user)->get('/logout');
|
||||
|
|
@ -74,7 +74,7 @@ class AdminTest extends TestCase
|
|||
}
|
||||
|
||||
#[Test]
|
||||
public function loggedInUsersCanLogout(): void
|
||||
public function logged_in_users_can_logout(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$response = $this->actingAs($user)->post('/logout');
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue