Remove references to short domain
This commit is contained in:
parent
328c9badb4
commit
7a58287b34
27 changed files with 215 additions and 404 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>
|
||||
|
|
|
@ -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,7 +40,6 @@ use Illuminate\Support\Facades\Route;
|
|||
|
|
||||
*/
|
||||
|
||||
Route::domain(config('url.longurl'))->group(function () {
|
||||
Route::get('/', [FrontPageController::class, 'index']);
|
||||
|
||||
// Static project page
|
||||
|
@ -223,19 +221,3 @@ Route::domain(config('url.longurl'))->group(function () {
|
|||
|
||||
// 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']);
|
||||
});
|
||||
|
|
|
@ -64,7 +64,7 @@ class FeedsTest extends TestCase
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.display_name'),
|
||||
'url' => config('url.longurl'),
|
||||
'url' => config('app.url'),
|
||||
],
|
||||
'children' => [[
|
||||
'type' => 'entry',
|
||||
|
@ -122,7 +122,7 @@ class FeedsTest extends TestCase
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.display_name'),
|
||||
'url' => config('url.longurl'),
|
||||
'url' => config('app.url'),
|
||||
],
|
||||
'children' => [[
|
||||
'type' => 'entry',
|
||||
|
|
|
@ -299,7 +299,7 @@ class MicropubControllerTest extends TestCase
|
|||
'type' => ['h-entry'],
|
||||
'properties' => [
|
||||
'content' => [$note],
|
||||
'location' => [$place->longurl],
|
||||
'location' => [$place->uri],
|
||||
],
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
|
@ -499,7 +499,7 @@ class MicropubControllerTest extends TestCase
|
|||
'/api/post',
|
||||
[
|
||||
'action' => 'update',
|
||||
'url' => $note->longurl,
|
||||
'url' => $note->uri,
|
||||
'replace' => [
|
||||
'content' => ['replaced content'],
|
||||
],
|
||||
|
@ -519,7 +519,7 @@ class MicropubControllerTest extends TestCase
|
|||
'/api/post',
|
||||
[
|
||||
'action' => 'update',
|
||||
'url' => $note->longurl,
|
||||
'url' => $note->uri,
|
||||
'add' => [
|
||||
'syndication' => [
|
||||
'https://www.swarmapp.com/checkin/123',
|
||||
|
@ -546,7 +546,7 @@ class MicropubControllerTest extends TestCase
|
|||
'/api/post',
|
||||
[
|
||||
'action' => 'update',
|
||||
'url' => $note->longurl,
|
||||
'url' => $note->uri,
|
||||
'add' => [
|
||||
'photo' => ['https://example.org/photo.jpg'],
|
||||
],
|
||||
|
@ -607,7 +607,7 @@ class MicropubControllerTest extends TestCase
|
|||
'/api/post',
|
||||
[
|
||||
'action' => 'update',
|
||||
'url' => $note->longurl,
|
||||
'url' => $note->uri,
|
||||
'morph' => [ // or any other unsupported update type
|
||||
'syndication' => ['https://www.swarmapp.com/checkin/123'],
|
||||
],
|
||||
|
@ -646,7 +646,7 @@ class MicropubControllerTest extends TestCase
|
|||
'/api/post',
|
||||
[
|
||||
'action' => 'update',
|
||||
'url' => $note->longurl,
|
||||
'url' => $note->uri,
|
||||
'replace' => [
|
||||
'syndication' => [
|
||||
'https://www.swarmapp.com/checkin/the-id',
|
||||
|
|
|
@ -31,7 +31,7 @@ class NotesControllerTest extends TestCase
|
|||
public function specificNotePageLoads(): void
|
||||
{
|
||||
$note = Note::factory()->create();
|
||||
$response = $this->get($note->longurl);
|
||||
$response = $this->get($note->uri);
|
||||
$response->assertViewHas('note');
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class NotesControllerTest extends TestCase
|
|||
{
|
||||
$note = Note::factory()->create();
|
||||
$response = $this->get('/note/' . $note->id);
|
||||
$response->assertRedirect($note->longurl);
|
||||
$response->assertRedirect($note->uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class PlacesTest extends TestCase
|
|||
public function singlePlacePageLoads(): void
|
||||
{
|
||||
$place = Place::factory()->create();
|
||||
$response = $this->get($place->longurl);
|
||||
$response = $this->get($place->uri);
|
||||
$response->assertViewHas('place', $place);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ShortURLsControllerTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function shortDomainRedirectsToLongDomain(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('url.shorturl'));
|
||||
$response->assertRedirect(config('app.url'));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function shortDomainSlashAtRedirectsToTwitter(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('url.shorturl') . '/@');
|
||||
$response->assertRedirect('https://twitter.com/jonnybarnes');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function shortDomainSlashTRedirectsToLongDomainSlashNotes(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('url.shorturl') . '/t/E');
|
||||
$response->assertRedirect(config('app.url') . '/notes/E');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function shortDomainSlashBRedirectsToLongDomainSlashBlog(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('url.shorturl') . '/b/1');
|
||||
$response->assertRedirect(config('app.url') . '/blog/s/1');
|
||||
}
|
||||
}
|
|
@ -82,7 +82,7 @@ class WebMentionsControllerTest extends TestCase
|
|||
|
||||
$response = $this->call('POST', '/webmention', [
|
||||
'source' => 'https://example.org/post/123',
|
||||
'target' => $note->longurl,
|
||||
'target' => $note->uri,
|
||||
]);
|
||||
$response->assertStatus(202);
|
||||
|
||||
|
|
|
@ -94,12 +94,12 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
$source = 'https://aaronpk.localhost/reply/1';
|
||||
WebMention::factory()->create([
|
||||
'source' => $source,
|
||||
'target' => $note->longurl,
|
||||
'target' => $note->uri,
|
||||
]);
|
||||
|
||||
$html = <<<HTML
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-in-reply-to" href="{$note->longurl}">a note</a></p>
|
||||
<p>In reply to <a class="u-in-reply-to" href="{$note->uri}">a note</a></p>
|
||||
<div class="e-content">Updated reply</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
@ -117,7 +117,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
'source' => $source,
|
||||
'type' => 'in-reply-to',
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"content": [{"html": "Updated reply", "value": "Updated reply"}], "in-reply-to": ["' . $note->longurl . '"]}}], "rel-urls": []}',
|
||||
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"content": [{"html": "Updated reply", "value": "Updated reply"}], "in-reply-to": ["' . $note->uri . '"]}}], "rel-urls": []}',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -115,14 +115,6 @@ class NotesTest extends TestCase
|
|||
$this->assertEquals($expected, $note->note);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function shorturlMethodReturnsExpectedValue(): void
|
||||
{
|
||||
$note = Note::factory()->make();
|
||||
$note->id = 14;
|
||||
$this->assertEquals(config('url.shorturl') . '/notes/E', $note->shorturl);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function weGetLatitudeLongitudeValuesOfAssociatedPlaceOfNote(): void
|
||||
{
|
||||
|
@ -382,11 +374,11 @@ class NotesTest extends TestCase
|
|||
public function markdown_content_gets_converted(): void
|
||||
{
|
||||
$note = Note::factory()->create([
|
||||
'note' => 'The best search engine? https://duckduckgo.com',
|
||||
'note' => 'The best search engine? https://kagi.com',
|
||||
]);
|
||||
|
||||
$this->assertSame(
|
||||
'<p>The best search engine? <a href="https://duckduckgo.com">https://duckduckgo.com</a></p>' . PHP_EOL,
|
||||
'<p>The best search engine? <a href="https://kagi.com">https://kagi.com</a></p>' . PHP_EOL,
|
||||
$note->note
|
||||
);
|
||||
}
|
||||
|
|
|
@ -40,24 +40,6 @@ class PlacesTest extends TestCase
|
|||
$this->assertEquals('the-bridgewater-pub', $nearby[0]->slug);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function getLongurl(): void
|
||||
{
|
||||
$place = Place::factory()->create([
|
||||
'name' => 'The Bridgewater Pub',
|
||||
]);
|
||||
$this->assertEquals(config('app.url') . '/places/the-bridgewater-pub', $place->longurl);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function getShorturl()
|
||||
{
|
||||
$place = Place::factory()->create([
|
||||
'name' => 'The Bridgewater Pub',
|
||||
]);
|
||||
$this->assertEquals(config('url.shorturl') . '/places/the-bridgewater-pub', $place->shorturl);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function getUri(): void
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue