Merge pull request #291 from jonnybarnes/289-initial-fix-of-code-base-with-laravel-pint
Initial fix of code base with Laravel Pint
This commit is contained in:
commit
f763532199
117 changed files with 415 additions and 378 deletions
|
@ -45,6 +45,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* @param Throwable $throwable
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Throwable
|
||||
*/
|
||||
|
@ -90,6 +91,7 @@ class Handler extends ExceptionHandler
|
|||
* @param Request $request
|
||||
* @param Throwable $throwable
|
||||
* @return Response
|
||||
*
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function render($request, Throwable $throwable)
|
||||
|
|
|
@ -4,7 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\{Article, Note};
|
||||
use App\Models\Article;
|
||||
use App\Models\Note;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Http\Responses\MicropubResponses;
|
||||
use App\Models\Place;
|
||||
use App\Services\Micropub\{HCardService, HEntryService, UpdateService};
|
||||
use App\Services\Micropub\HCardService;
|
||||
use App\Services\Micropub\HEntryService;
|
||||
use App\Services\Micropub\UpdateService;
|
||||
use App\Services\TokenService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Lcobucci\JWT\Encoding\CannotDecodeContent;
|
||||
|
@ -18,8 +20,11 @@ use Monolog\Logger;
|
|||
class MicropubController extends Controller
|
||||
{
|
||||
protected TokenService $tokenService;
|
||||
|
||||
protected HEntryService $hentryService;
|
||||
|
||||
protected HCardService $hcardService;
|
||||
|
||||
protected UpdateService $updateService;
|
||||
|
||||
public function __construct(
|
||||
|
@ -168,6 +173,7 @@ class MicropubController extends Controller
|
|||
* Determine the client id from the access token sent with the request.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws RequiredConstraintsViolated
|
||||
*/
|
||||
private function getClientId(): string
|
||||
|
|
|
@ -97,6 +97,7 @@ class MicropubMediaController extends Controller
|
|||
* Process a media item posted to the media endpoint.
|
||||
*
|
||||
* @return JsonResponse
|
||||
*
|
||||
* @throws BindingResolutionException
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -231,6 +232,7 @@ class MicropubMediaController extends Controller
|
|||
*
|
||||
* @param UploadedFile $file
|
||||
* @return string
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private function saveFile(UploadedFile $file): string
|
||||
|
|
|
@ -40,6 +40,7 @@ class DownloadWebMention implements ShouldQueue
|
|||
* Execute the job.
|
||||
*
|
||||
* @param Client $guzzle
|
||||
*
|
||||
* @throws GuzzleException
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
|
|
|
@ -44,6 +44,7 @@ class ProcessLike implements ShouldQueue
|
|||
* @param Client $client
|
||||
* @param Authorship $authorship
|
||||
* @return int
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle(Client $client, Authorship $authorship): int
|
||||
|
|
|
@ -5,13 +5,15 @@ declare(strict_types=1);
|
|||
namespace App\Jobs;
|
||||
|
||||
use App\Exceptions\RemoteContentNotFoundException;
|
||||
use App\Models\{Note, WebMention};
|
||||
use App\Models\Note;
|
||||
use App\Models\WebMention;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\{InteractsWithQueue, SerializesModels};
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\InvalidMentionException;
|
||||
use Jonnybarnes\WebmentionsParser\Parser;
|
||||
use Mf2;
|
||||
|
@ -45,6 +47,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
*
|
||||
* @param Parser $parser
|
||||
* @param Client $guzzle
|
||||
*
|
||||
* @throws RemoteContentNotFoundException
|
||||
* @throws GuzzleException
|
||||
* @throws InvalidMentionException
|
||||
|
|
|
@ -37,6 +37,7 @@ class SyndicateBookmarkToTwitter implements ShouldQueue
|
|||
* Execute the job.
|
||||
*
|
||||
* @param Client $guzzle
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle(Client $guzzle)
|
||||
|
|
|
@ -35,6 +35,7 @@ class SyndicateNoteToTwitter implements ShouldQueue
|
|||
* Execute the job.
|
||||
*
|
||||
* @param Client $guzzle
|
||||
*
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle(Client $guzzle)
|
||||
|
|
|
@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\Builder;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use League\CommonMark\Environment\Environment;
|
||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||
use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode;
|
||||
|
|
|
@ -26,6 +26,7 @@ use Illuminate\Support\Carbon;
|
|||
* @property-read string $longurl
|
||||
* @property-read Collection|Tag[] $tags
|
||||
* @property-read int|null $tags_count
|
||||
*
|
||||
* @method static Builder|Bookmark newModelQuery()
|
||||
* @method static Builder|Bookmark newQuery()
|
||||
* @method static Builder|Bookmark query()
|
||||
|
|
|
@ -30,7 +30,7 @@ class Contact extends Model
|
|||
{
|
||||
$photo = '/assets/profile-images/default-image';
|
||||
|
||||
if (array_key_exists('homepage', $this->attributes) && !empty($this->attributes['homepage'])) {
|
||||
if (array_key_exists('homepage', $this->attributes) && ! empty($this->attributes['homepage'])) {
|
||||
$host = parse_url($this->attributes['homepage'], PHP_URL_HOST);
|
||||
if (file_exists(public_path() . '/assets/profile-images/' . $host . '/image')) {
|
||||
$photo = '/assets/profile-images/' . $host . '/image';
|
||||
|
|
|
@ -5,11 +5,9 @@ declare(strict_types=1);
|
|||
namespace App\Models;
|
||||
|
||||
use App\Traits\FilterHtml;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Mf2;
|
||||
|
||||
class Like extends Model
|
||||
|
|
|
@ -4,11 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Media extends Model
|
||||
|
|
|
@ -4,12 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class MicropubClient extends Model
|
||||
{
|
||||
|
|
|
@ -10,8 +10,14 @@ use App\Exceptions\TwitterContentException;
|
|||
use Codebird\Codebird;
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Database\Eloquent\{Builder, Factories\HasFactory, Model, SoftDeletes};
|
||||
use Illuminate\Database\Eloquent\Relations\{BelongsTo, BelongsToMany, HasMany, MorphMany};
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
|
@ -24,7 +30,8 @@ use League\CommonMark\Extension\Mention\Mention;
|
|||
use League\CommonMark\Extension\Mention\MentionExtension;
|
||||
use League\CommonMark\MarkdownConverter;
|
||||
use Normalizer;
|
||||
use Spatie\CommonMarkHighlighter\{FencedCodeRenderer, IndentedCodeRenderer};
|
||||
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
|
||||
use Spatie\CommonMarkHighlighter\IndentedCodeRenderer;
|
||||
|
||||
class Note extends Model
|
||||
{
|
||||
|
@ -134,7 +141,7 @@ class Note extends Model
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
#[ArrayShape(['note' => "null|string"])]
|
||||
#[ArrayShape(['note' => 'null|string'])]
|
||||
public function toSearchableArray(): array
|
||||
{
|
||||
return [
|
||||
|
@ -339,7 +346,7 @@ class Note extends Model
|
|||
{
|
||||
if (
|
||||
$this->in_reply_to === null ||
|
||||
!$this->isTwitterLink($this->in_reply_to)
|
||||
! $this->isTwitterLink($this->in_reply_to)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -375,6 +382,7 @@ class Note extends Model
|
|||
* That is we swap the contacts names for their known Twitter handles.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws TwitterContentException
|
||||
*/
|
||||
public function getTwitterContentAttribute(): string
|
||||
|
|
|
@ -5,9 +5,10 @@ declare(strict_types=1);
|
|||
namespace App\Models;
|
||||
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\{Builder, Collection, Factories\HasFactory, Model};
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Place extends Model
|
||||
|
|
|
@ -4,12 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Tag extends Model
|
||||
|
|
|
@ -4,13 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\DatabaseNotification;
|
||||
use Illuminate\Notifications\DatabaseNotificationCollection;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
|
@ -6,12 +6,10 @@ namespace App\Models;
|
|||
|
||||
use App\Traits\FilterHtml;
|
||||
use Codebird\Codebird;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Jonnybarnes\WebmentionsParser\Authorship;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
|
||||
|
@ -49,6 +47,7 @@ class WebMention extends Model
|
|||
* Get the author of the webmention.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws AuthorshipParserException
|
||||
*/
|
||||
public function getAuthorAttribute(): array
|
||||
|
|
|
@ -4,8 +4,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\{Note, Tag};
|
||||
use Illuminate\Support\{Arr, Collection};
|
||||
use App\Models\Note;
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class NoteObserver
|
||||
{
|
||||
|
|
|
@ -7,10 +7,12 @@ namespace App\Services;
|
|||
use App\Exceptions\InternetArchiveException;
|
||||
use App\Jobs\ProcessBookmark;
|
||||
use App\Jobs\SyndicateBookmarkToTwitter;
|
||||
use App\Models\{Bookmark, Tag};
|
||||
use App\Models\Bookmark;
|
||||
use App\Models\Tag;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Spatie\Browsershot\Browsershot;
|
||||
use Spatie\Browsershot\Exceptions\CouldNotTakeBrowsershot;
|
||||
|
@ -83,6 +85,7 @@ class BookmarkService
|
|||
*
|
||||
* @param string $url
|
||||
* @return string The uuid for the screenshot
|
||||
*
|
||||
* @throws CouldNotTakeBrowsershot
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
|
@ -106,6 +109,7 @@ class BookmarkService
|
|||
*
|
||||
* @param string $url
|
||||
* @return string
|
||||
*
|
||||
* @throws InternetArchiveException
|
||||
*/
|
||||
public function getArchiveLink(string $url): string
|
||||
|
|
|
@ -4,7 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\Micropub;
|
||||
|
||||
use App\Services\{BookmarkService, LikeService, NoteService};
|
||||
use App\Services\BookmarkService;
|
||||
use App\Services\LikeService;
|
||||
use App\Services\NoteService;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class HEntryService
|
||||
|
|
|
@ -4,9 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\Micropub;
|
||||
|
||||
use App\Models\{Media, Note};
|
||||
use App\Models\Media;
|
||||
use App\Models\Note;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UpdateService
|
||||
{
|
||||
|
|
|
@ -4,9 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Jobs\{SendWebMentions, SyndicateNoteToTwitter};
|
||||
use App\Models\{Media, Note, Place};
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
use App\Jobs\SendWebMentions;
|
||||
use App\Jobs\SyndicateNoteToTwitter;
|
||||
use App\Models\Media;
|
||||
use App\Models\Note;
|
||||
use App\Models\Place;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class NoteService
|
||||
{
|
||||
|
|
|
@ -6,7 +6,8 @@ namespace App\Services;
|
|||
|
||||
use App\Jobs\AddClientToDatabase;
|
||||
use DateTimeImmutable;
|
||||
use Lcobucci\JWT\{Configuration, Token};
|
||||
use Lcobucci\JWT\Configuration;
|
||||
use Lcobucci\JWT\Token;
|
||||
|
||||
class TokenService
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
return array(
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -26,12 +26,12 @@ return array(
|
|||
| can also be used. For PDO, run the package migrations first.
|
||||
|
|
||||
*/
|
||||
'storage' => array(
|
||||
'storage' => [
|
||||
'enabled' => true,
|
||||
'driver' => 'file', // redis, file, pdo
|
||||
'path' => storage_path() . '/debugbar', // For file driver
|
||||
'connection' => null, // Leave null for default connection (Redis/PDO)
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -70,7 +70,7 @@ return array(
|
|||
|
|
||||
*/
|
||||
|
||||
'collectors' => array(
|
||||
'collectors' => [
|
||||
'phpinfo' => true, // Php version
|
||||
'messages' => true, // Messages
|
||||
'time' => true, // Time Datalogger
|
||||
|
@ -90,7 +90,7 @@ return array(
|
|||
'config' => false, // Display config settings
|
||||
'auth' => false, // Display Laravel authentication status
|
||||
'session' => false, // Display session data in a separate tab
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -101,33 +101,33 @@ return array(
|
|||
|
|
||||
*/
|
||||
|
||||
'options' => array(
|
||||
'auth' => array(
|
||||
'options' => [
|
||||
'auth' => [
|
||||
'show_name' => false, // Also show the users name/email in the debugbar
|
||||
),
|
||||
'db' => array(
|
||||
],
|
||||
'db' => [
|
||||
'with_params' => true, // Render SQL with the parameters substituted
|
||||
'timeline' => false, // Add the queries to the timeline
|
||||
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
|
||||
'explain' => array( // EXPERIMENTAL: Show EXPLAIN output on queries
|
||||
'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
|
||||
'enabled' => false,
|
||||
'types' => array('SELECT'), // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
|
||||
),
|
||||
'types' => ['SELECT'], // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
|
||||
],
|
||||
'hints' => true, // Show hints for common mistakes
|
||||
),
|
||||
'mail' => array(
|
||||
'full_log' => false
|
||||
),
|
||||
'views' => array(
|
||||
],
|
||||
'mail' => [
|
||||
'full_log' => false,
|
||||
],
|
||||
'views' => [
|
||||
'data' => false, //Note: Can slow down the application, because the data can be quite large..
|
||||
),
|
||||
'route' => array(
|
||||
'label' => true // show complete route on bar
|
||||
),
|
||||
'logs' => array(
|
||||
'file' => null
|
||||
),
|
||||
),
|
||||
],
|
||||
'route' => [
|
||||
'label' => true, // show complete route on bar
|
||||
],
|
||||
'logs' => [
|
||||
'file' => null,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -142,4 +142,4 @@ return array(
|
|||
|
||||
'inject' => true,
|
||||
|
||||
);
|
||||
];
|
||||
|
|
|
@ -17,7 +17,6 @@ return [
|
|||
*
|
||||
* Defaults to null, which uses the toString() method on your model.
|
||||
*/
|
||||
|
||||
'source' => null,
|
||||
|
||||
/**
|
||||
|
@ -25,7 +24,6 @@ return [
|
|||
* no length restrictions are enforced. Set it to a positive integer if you
|
||||
* want to make sure your slugs aren't too long.
|
||||
*/
|
||||
|
||||
'maxLength' => null,
|
||||
|
||||
/**
|
||||
|
@ -43,13 +41,11 @@ return [
|
|||
*
|
||||
* 'method' => array('Str','slug'),
|
||||
*/
|
||||
|
||||
'method' => null,
|
||||
|
||||
/**
|
||||
* Separator to use when generating slugs. Defaults to a hyphen.
|
||||
*/
|
||||
|
||||
'separator' => '-',
|
||||
|
||||
/**
|
||||
|
@ -61,7 +57,6 @@ return [
|
|||
* my-slug-1
|
||||
* my-slug-2
|
||||
*/
|
||||
|
||||
'unique' => true,
|
||||
|
||||
/**
|
||||
|
@ -72,7 +67,6 @@ return [
|
|||
* "similar" slugs. The closure should return the new unique
|
||||
* suffix to append to the slug.
|
||||
*/
|
||||
|
||||
'uniqueSuffix' => null,
|
||||
|
||||
/**
|
||||
|
@ -81,7 +75,6 @@ return [
|
|||
* If set to "false", then a new slug could duplicate one that exists on a trashed model.
|
||||
* If set to "true", then uniqueness is enforced across trashed and existing models.
|
||||
*/
|
||||
|
||||
'includeTrashed' => false,
|
||||
|
||||
/**
|
||||
|
@ -107,7 +100,6 @@ return [
|
|||
*
|
||||
* and continue from there.
|
||||
*/
|
||||
|
||||
'reserved' => null,
|
||||
|
||||
/**
|
||||
|
@ -120,7 +112,6 @@ return [
|
|||
* is probably not a good idea from an SEO point of view.
|
||||
* Only set this to true if you understand the possible consequences.
|
||||
*/
|
||||
|
||||
'onUpdate' => false,
|
||||
|
||||
];
|
||||
|
|
|
@ -22,5 +22,5 @@ return [
|
|||
'photo' => 'https://pbs.twimg.com/profile_images/875422855932121089/W628ZI8w_400x400.jpg',
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
|
||||
return [
|
||||
'longurl' => env('APP_LONGURL', 'jonnybarnes.uk'),
|
||||
'shorturl' => env('APP_SHORTURL', 'jmb.lv')
|
||||
'shorturl' => env('APP_SHORTURL', 'jmb.lv'),
|
||||
];
|
||||
|
|
|
@ -20,6 +20,7 @@ class NoteFactory extends Factory
|
|||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function definition()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateArticlesTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateNotesTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateTagsTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateNoteTagTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateContactsTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateWebMentionsTable extends Migration
|
||||
{
|
||||
|
@ -12,8 +12,7 @@ class CreateWebMentionsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('webmentions', function (Blueprint $table)
|
||||
{
|
||||
Schema::create('webmentions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('source');
|
||||
$table->string('target');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateClientsTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMediaTable extends Migration
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ class CreateMediaTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreatePlacesTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddPlaceRelationToNotes extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddJsonbMf2ColumnToWebmentionsTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddExceptionColumnToFailedJobsTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CascadeDeleteNoteTags extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFacebookUrlColumnToNotes extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFacebookToContacts extends Migration
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddSearchToNotes extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIconToPlaces extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMediaEndpointTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIndieWebUsersTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateNotesTableAddSwarmUrl extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdatePlacesTableAddFoursquareColumn extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateNotesTableAddInstagramUrl extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdatePlacesTableAddExternalUrls extends Migration
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AllowEmptyNoteContent extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateMediaEndpointTableAddNullableImageWidthColumn extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateLikesTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBookmarksTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBookmarkTagPivotTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateModelsReferenceInWebmentionsTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTelescopeEntriesTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Article;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ArticlesTableSeeder extends Seeder
|
||||
|
@ -28,7 +28,7 @@ class ArticlesTableSeeder extends Seeder
|
|||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(2)->subMinutes(25);
|
||||
$articleWithCode = <<<EOF
|
||||
$articleWithCode = <<<'EOF'
|
||||
I wrote some code.
|
||||
|
||||
I liked writing this:
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\{Bookmark, Tag};
|
||||
use App\Models\Bookmark;
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BookmarksTableSeeder extends Seeder
|
||||
|
|
|
@ -28,7 +28,7 @@ class ContactsTableSeeder extends Seeder
|
|||
'facebook' => '123456',
|
||||
]);
|
||||
$fs = new FileSystem();
|
||||
if (!$fs->exists(public_path('assets/profile-images/aaronparecki.com'))) {
|
||||
if (! $fs->exists(public_path('assets/profile-images/aaronparecki.com'))) {
|
||||
$fs->makeDirectory(public_path('assets/profile-images/aaronparecki.com'));
|
||||
}
|
||||
$fs->copy(
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace Database\Seeders;
|
|||
|
||||
use App\Models\Like;
|
||||
use Faker\Generator;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LikesTableSeeder extends Seeder
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\Media;
|
||||
use App\Models\Note;
|
||||
use App\Models\Place;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\{Media, Note, Place};
|
||||
use SplFileInfo;
|
||||
|
||||
class NotesTableSeeder extends Seeder
|
||||
|
@ -184,7 +186,7 @@ class NotesTableSeeder extends Seeder
|
|||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(2);
|
||||
$noteWithCodeContent = <<<EOF
|
||||
$noteWithCodeContent = <<<'EOF'
|
||||
A note with some code:
|
||||
```php
|
||||
<?php
|
||||
|
@ -203,7 +205,7 @@ EOF;
|
|||
$noteWithLongUrl = Note::create([
|
||||
'note' => 'Best site: https://example.org/posts/some-really-long-slug-that-is-too-wide-on-mobile',
|
||||
'created_at' => $now,
|
||||
'client_id' => 'https://beta.indigenous.abode.pub/ios/'
|
||||
'client_id' => 'https://beta.indigenous.abode.pub/ios/',
|
||||
]);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithLongUrl->id)
|
||||
|
|
|
@ -21,7 +21,7 @@ class WebMentionsTableSeeder extends Seeder
|
|||
'commentable_id' => '14',
|
||||
'commentable_type' => 'App\Models\Note',
|
||||
'type' => 'in-reply-to',
|
||||
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"url": ["https://aaronpk.localhost/reply/1"], "name": ["Hi too"], "author": [{"type": ["h-card"], "value": "Aaron Parecki", "properties": {"url": ["https://aaronpk.localhost"], "name": ["Aaron Parecki"], "photo": ["https://aaronparecki.com/images/profile.jpg"]}}], "content": [{"html": "Hi too", "value": "Hi too"}], "published": ["' . date(DATE_W3C) . '"], "in-reply-to": ["https://aaronpk.loclahost/reply/1", "' . config('app.url') .'/notes/E"]}}]}'
|
||||
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"url": ["https://aaronpk.localhost/reply/1"], "name": ["Hi too"], "author": [{"type": ["h-card"], "value": "Aaron Parecki", "properties": {"url": ["https://aaronpk.localhost"], "name": ["Aaron Parecki"], "photo": ["https://aaronparecki.com/images/profile.jpg"]}}], "content": [{"html": "Hi too", "value": "Hi too"}], "published": ["' . date(DATE_W3C) . '"], "in-reply-to": ["https://aaronpk.loclahost/reply/1", "' . config('app.url') .'/notes/E"]}}]}',
|
||||
]);
|
||||
// WebMention Tantek
|
||||
WebMention::create([
|
||||
|
@ -30,7 +30,7 @@ class WebMentionsTableSeeder extends Seeder
|
|||
'commentable_id' => '13',
|
||||
'commentable_type' => 'App\Models\Note',
|
||||
'type' => 'in-reply-to',
|
||||
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"url": ["http://tantek.com/"], "name": ["KUTGW"], "author": [{"type": ["h-card"], "value": "Tantek Celik", "properties": {"url": ["http://tantek.com/"], "name": ["Tantek Celik"]}}], "content": [{"html": "kutgw", "value": "kutgw"}], "published": ["' . date(DATE_W3C) . '"], "in-reply-to": ["' . config('app.url') . '/notes/D"]}}]}'
|
||||
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"url": ["http://tantek.com/"], "name": ["KUTGW"], "author": [{"type": ["h-card"], "value": "Tantek Celik", "properties": {"url": ["http://tantek.com/"], "name": ["Tantek Celik"]}}], "content": [{"html": "kutgw", "value": "kutgw"}], "published": ["' . date(DATE_W3C) . '"], "in-reply-to": ["' . config('app.url') . '/notes/D"]}}]}',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ if (! function_exists('normalize_url')) {
|
|||
$url['path'] = preg_replace_callback(
|
||||
array_map(
|
||||
function ($str) {
|
||||
return "/%" . strtoupper($str) . "/x";
|
||||
return '/%' . strtoupper($str) . '/x';
|
||||
},
|
||||
$u
|
||||
),
|
||||
|
|
6
pint.json
Normal file
6
pint.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"preset": "laravel",
|
||||
"rules": {
|
||||
"concat_space": false
|
||||
}
|
||||
}
|
|
@ -29,7 +29,6 @@ use App\Http\Controllers\MicropubController;
|
|||
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\TokenEndpointController;
|
||||
use App\Http\Controllers\WebMentionsController;
|
||||
|
@ -167,7 +166,7 @@ Route::group(['domain' => config('url.longurl')], function () {
|
|||
Route::get('api/post', [MicropubController::class, 'get'])->middleware('micropub.token');
|
||||
Route::post('api/post', [MicropubController::class, 'post'])->middleware('micropub.token');
|
||||
Route::get('api/media', [MicropubMediaController::class, 'getHandler'])->middleware('micropub.token');
|
||||
Route::post('api/media', [MicropubMediaController:: class, 'media'])
|
||||
Route::post('api/media', [MicropubMediaController::class, 'media'])
|
||||
->middleware('micropub.token', 'cors')
|
||||
->name('media-endpoint');
|
||||
Route::options('/api/media', [MicropubMediaController::class, 'mediaOptionsResponse'])->middleware('cors');
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
/**
|
||||
* Laravel - A PHP Framework For Web Artisans
|
||||
*
|
||||
* @package Laravel
|
||||
* @author Taylor Otwell <taylor@laravel.com>
|
||||
*/
|
||||
|
||||
$uri = urldecode(
|
||||
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
||||
);
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Tests\DuskTestCase;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Tests\DuskTestCase;
|
||||
|
||||
class ExampleTest extends DuskTestCase
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace Tests\Browser;
|
||||
|
||||
use Tests\DuskTestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class NotesTest extends DuskTestCase
|
||||
{
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace Tests;
|
||||
|
||||
use Laravel\Dusk\TestCase as BaseTestCase;
|
||||
use Facebook\WebDriver\Chrome\ChromeOptions;
|
||||
use Facebook\WebDriver\Remote\RemoteWebDriver;
|
||||
use Facebook\WebDriver\Remote\DesiredCapabilities;
|
||||
use Facebook\WebDriver\Remote\RemoteWebDriver;
|
||||
use Laravel\Dusk\TestCase as BaseTestCase;
|
||||
|
||||
abstract class DuskTestCase extends BaseTestCase
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ abstract class DuskTestCase extends BaseTestCase
|
|||
* Prepare for Dusk test execution.
|
||||
*
|
||||
* @beforeClass
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function prepare()
|
||||
|
@ -34,7 +35,7 @@ abstract class DuskTestCase extends BaseTestCase
|
|||
$options = new ChromeOptions();
|
||||
$options->addArguments([
|
||||
'headless',
|
||||
'disable-gpu'
|
||||
'disable-gpu',
|
||||
]);
|
||||
|
||||
$desiredCapabilities->setCapability(ChromeOptions::CAPABILITY, $options);
|
||||
|
|
|
@ -53,8 +53,8 @@ class ActivityStreamTest extends TestCase
|
|||
],
|
||||
'object' => [
|
||||
'type' => 'Note',
|
||||
'name' => strip_tags($note->note)
|
||||
]
|
||||
'name' => strip_tags($note->note),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class ArticlesTest extends TestCase
|
|||
$this->actingAs($user)
|
||||
->post('/admin/blog', [
|
||||
'title' => 'Test Title',
|
||||
'main' => 'Article content'
|
||||
'main' => 'Article content',
|
||||
]);
|
||||
$this->assertDatabaseHas('articles', ['title' => 'Test Title']);
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ class ClientsTest extends TestCase
|
|||
$this->actingAs($user)
|
||||
->post('/admin/clients', [
|
||||
'client_name' => 'Micropublish',
|
||||
'client_url' => 'https://micropublish.net'
|
||||
'client_url' => 'https://micropublish.net',
|
||||
]);
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'client_name' => 'Micropublish',
|
||||
'client_url' => 'https://micropublish.net'
|
||||
'client_url' => 'https://micropublish.net',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Tests\Feature\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Contact;
|
||||
use App\Models\User;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
|
@ -58,7 +58,7 @@ class ContactsTest extends TestCase
|
|||
$this->assertDatabaseHas('contacts', [
|
||||
'name' => 'Fred Bloggs',
|
||||
'nick' => 'fred',
|
||||
'homepage' => 'https://fred.blog/gs'
|
||||
'homepage' => 'https://fred.blog/gs',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ class ContactsTest extends TestCase
|
|||
/** @test */
|
||||
public function adminCanTriggerRetrievalOfRemoteAvatar(): void
|
||||
{
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-card">
|
||||
<img class="u-photo" alt="" src="http://tantek.com/tantek.png">
|
||||
</div>
|
||||
|
@ -181,7 +181,7 @@ class ContactsTest extends TestCase
|
|||
/** @test */
|
||||
public function gettingRemoteAvatarFailsGracefullyWithRemoteError(): void
|
||||
{
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-card">
|
||||
<img class="u-photo" src="http://tantek.com/tantek.png">
|
||||
</div>
|
||||
|
|
|
@ -43,10 +43,10 @@ class LikesTest extends TestCase
|
|||
|
||||
$this->actingAs($user)
|
||||
->post('/admin/likes', [
|
||||
'like_url' => 'https://example.com'
|
||||
'like_url' => 'https://example.com',
|
||||
]);
|
||||
$this->assertDatabaseHas('likes', [
|
||||
'url' => 'https://example.com'
|
||||
'url' => 'https://example.com',
|
||||
]);
|
||||
Queue::assertPushed(ProcessLike::class);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class FeedsTest extends TestCase
|
|||
'children' => [[
|
||||
'type' => 'entry',
|
||||
'post-type' => 'article',
|
||||
]]
|
||||
]],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ class FeedsTest extends TestCase
|
|||
'children' => [[
|
||||
'type' => 'entry',
|
||||
'post-type' => 'note',
|
||||
]]
|
||||
]],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Tests\TestCase;
|
||||
|
||||
class HorizonTest extends TestCase
|
||||
|
@ -13,6 +11,7 @@ class HorizonTest extends TestCase
|
|||
* Horizon has its own test suite, here we just test it has been installed successfully.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function horizonIsInstalled(): void
|
||||
|
|
|
@ -85,7 +85,7 @@ class LikesTest extends TestCase
|
|||
|
||||
$job = new ProcessLike($like);
|
||||
|
||||
$content = <<<END
|
||||
$content = <<<'END'
|
||||
<html>
|
||||
<body>
|
||||
<div class="h-entry">
|
||||
|
@ -124,7 +124,7 @@ class LikesTest extends TestCase
|
|||
|
||||
$job = new ProcessLike($like);
|
||||
|
||||
$content = <<<END
|
||||
$content = <<<'END'
|
||||
<html>
|
||||
<body>
|
||||
<div class="h-entry">
|
||||
|
@ -167,7 +167,7 @@ class LikesTest extends TestCase
|
|||
|
||||
$job = new ProcessLike($like);
|
||||
|
||||
$content = <<<END
|
||||
$content = <<<'END'
|
||||
<html>
|
||||
<body>
|
||||
<div>
|
||||
|
|
|
@ -4,13 +4,17 @@ declare(strict_types=1);
|
|||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Jobs\SendWebMentions;
|
||||
use App\Jobs\SyndicateNoteToTwitter;
|
||||
use App\Models\Media;
|
||||
use App\Models\Note;
|
||||
use App\Models\Place;
|
||||
use Carbon\Carbon;
|
||||
use Faker\Factory;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use App\Jobs\{SendWebMentions, SyndicateNoteToTwitter};
|
||||
use App\Models\{Media, Note, Place};
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Tests\{TestCase, TestToken};
|
||||
use Tests\TestCase;
|
||||
use Tests\TestToken;
|
||||
|
||||
class MicropubControllerTest extends TestCase
|
||||
{
|
||||
|
@ -67,6 +71,7 @@ class MicropubControllerTest extends TestCase
|
|||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @todo Add uncertainty parameter
|
||||
*
|
||||
public function micropubClientsCanRequestKnownNearbyPlacesWithUncertaintyParameter(): void
|
||||
|
@ -119,7 +124,7 @@ class MicropubControllerTest extends TestCase
|
|||
[
|
||||
'h' => 'entry',
|
||||
'content' => $note,
|
||||
'mp-syndicate-to' => 'https://twitter.com/jonnybarnes'
|
||||
'mp-syndicate-to' => 'https://twitter.com/jonnybarnes',
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
);
|
||||
|
@ -136,7 +141,7 @@ class MicropubControllerTest extends TestCase
|
|||
[
|
||||
'h' => 'card',
|
||||
'name' => 'The Barton Arms',
|
||||
'geo' => 'geo:53.4974,-2.3768'
|
||||
'geo' => 'geo:53.4974,-2.3768',
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
);
|
||||
|
@ -199,7 +204,7 @@ class MicropubControllerTest extends TestCase
|
|||
[
|
||||
'h' => 'card',
|
||||
'name' => 'The Barton Arms',
|
||||
'geo' => 'geo:53.4974,-2.3768'
|
||||
'geo' => 'geo:53.4974,-2.3768',
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getTokenWithIncorrectScope()]
|
||||
);
|
||||
|
@ -366,7 +371,7 @@ class MicropubControllerTest extends TestCase
|
|||
$response
|
||||
->assertJson([
|
||||
'response' => 'error',
|
||||
'error' => 'unauthorized'
|
||||
'error' => 'unauthorized',
|
||||
])
|
||||
->assertStatus(401);
|
||||
}
|
||||
|
@ -394,7 +399,7 @@ class MicropubControllerTest extends TestCase
|
|||
$response
|
||||
->assertJson([
|
||||
'response' => 'error',
|
||||
'error' => 'insufficient_scope'
|
||||
'error' => 'insufficient_scope',
|
||||
])
|
||||
->assertStatus(401);
|
||||
}
|
||||
|
@ -415,7 +420,7 @@ class MicropubControllerTest extends TestCase
|
|||
$response
|
||||
->assertJson([
|
||||
'response' => 'error',
|
||||
'error_description' => 'unsupported_request_type'
|
||||
'error_description' => 'unsupported_request_type',
|
||||
])
|
||||
->assertStatus(500);
|
||||
}
|
||||
|
@ -430,7 +435,7 @@ class MicropubControllerTest extends TestCase
|
|||
'type' => ['h-card'],
|
||||
'properties' => [
|
||||
'name' => $faker->name,
|
||||
'geo' => 'geo:' . $faker->latitude . ',' . $faker->longitude
|
||||
'geo' => 'geo:' . $faker->latitude . ',' . $faker->longitude,
|
||||
],
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
|
@ -450,7 +455,7 @@ class MicropubControllerTest extends TestCase
|
|||
'type' => ['h-card'],
|
||||
'properties' => [
|
||||
'name' => $faker->name,
|
||||
'geo' => 'geo:' . $faker->latitude . ',' . $faker->longitude . ';u=35'
|
||||
'geo' => 'geo:' . $faker->latitude . ',' . $faker->longitude . ';u=35',
|
||||
],
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
|
|
|
@ -29,7 +29,7 @@ class OwnYourGramTest extends TestCase
|
|||
'syndication' => ['https://www.instagram.com/p/BVC_nVTBFfi/'],
|
||||
'photo' => [
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'https://scontent-sjc2-1.cdninstagram.com/t51.2885-15/e35/18888604_425332491185600_326487281944756224_n.jpg'
|
||||
'https://scontent-sjc2-1.cdninstagram.com/t51.2885-15/e35/18888604_425332491185600_326487281944756224_n.jpg',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -37,15 +37,15 @@ class OwnYourGramTest extends TestCase
|
|||
);
|
||||
|
||||
$response->assertStatus(201)->assertJson([
|
||||
'response' => 'created'
|
||||
'response' => 'created',
|
||||
]);
|
||||
$this->assertDatabaseHas('media_endpoint', [
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'path' => 'https://scontent-sjc2-1.cdninstagram.com/t51.2885-15/e35/18888604_425332491185600_326487281944756224_n.jpg'
|
||||
'path' => 'https://scontent-sjc2-1.cdninstagram.com/t51.2885-15/e35/18888604_425332491185600_326487281944756224_n.jpg',
|
||||
]);
|
||||
$this->assertDatabaseHas('notes', [
|
||||
'note' => 'How beautiful are the plates and chopsticks',
|
||||
'instagram_url' => 'https://www.instagram.com/p/BVC_nVTBFfi/'
|
||||
'instagram_url' => 'https://www.instagram.com/p/BVC_nVTBFfi/',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@ class SwarmTest extends TestCase
|
|||
->assertStatus(201)
|
||||
->assertJson(['response' => 'created']);
|
||||
$this->assertDatabaseHas('notes', [
|
||||
'swarm_url' => 'https://www.swarmapp.com/checkin/abc'
|
||||
'swarm_url' => 'https://www.swarmapp.com/checkin/abc',
|
||||
]);
|
||||
$this->assertDatabaseHas('places', [
|
||||
'external_urls' => '{"foursquare": "https://foursquare.com/v/123456"}'
|
||||
'external_urls' => '{"foursquare": "https://foursquare.com/v/123456"}',
|
||||
]);
|
||||
|
||||
Queue::assertPushed(SendWebMentions::class);
|
||||
|
@ -101,7 +101,7 @@ class SwarmTest extends TestCase
|
|||
->assertStatus(201)
|
||||
->assertJson(['response' => 'created']);
|
||||
$this->assertDatabaseHas('places', [
|
||||
'external_urls' => '{"osm": "https://www.openstreetmap.org/way/123456"}'
|
||||
'external_urls' => '{"osm": "https://www.openstreetmap.org/way/123456"}',
|
||||
]);
|
||||
|
||||
Queue::assertPushed(SendWebMentions::class);
|
||||
|
@ -144,7 +144,7 @@ class SwarmTest extends TestCase
|
|||
->assertStatus(201)
|
||||
->assertJson(['response' => 'created']);
|
||||
$this->assertDatabaseHas('places', [
|
||||
'external_urls' => '{"default": "https://www.example.org/way/123456"}'
|
||||
'external_urls' => '{"default": "https://www.example.org/way/123456"}',
|
||||
]);
|
||||
|
||||
Queue::assertPushed(SendWebMentions::class);
|
||||
|
@ -178,10 +178,10 @@ class SwarmTest extends TestCase
|
|||
->assertStatus(201)
|
||||
->assertJson(['response' => 'created']);
|
||||
$this->assertDatabaseHas('places', [
|
||||
'external_urls' => '{"foursquare": "https://foursquare.com/v/654321"}'
|
||||
'external_urls' => '{"foursquare": "https://foursquare.com/v/654321"}',
|
||||
]);
|
||||
$this->assertDatabaseHas('notes', [
|
||||
'swarm_url' => 'https://www.swarmapp.com/checkin/def'
|
||||
'swarm_url' => 'https://www.swarmapp.com/checkin/def',
|
||||
]);
|
||||
// Check the default text content for the note was saved
|
||||
$this->get($response->__get('headers')->get('location'))->assertSee('📍');
|
||||
|
@ -280,10 +280,10 @@ class SwarmTest extends TestCase
|
|||
[
|
||||
'type' => ['h-entry'],
|
||||
'properties' => [
|
||||
'published' => [Carbon::now()->toDateTimeString()]
|
||||
'published' => [Carbon::now()->toDateTimeString()],
|
||||
],
|
||||
'syndication' => [
|
||||
'https://www.swarmapp.com/user/199841/checkin/5c4b1ac56dcf04002c0a4f58'
|
||||
'https://www.swarmapp.com/user/199841/checkin/5c4b1ac56dcf04002c0a4f58',
|
||||
],
|
||||
'checkin' => [
|
||||
'type' => ['h-card'],
|
||||
|
@ -295,9 +295,9 @@ class SwarmTest extends TestCase
|
|||
'street-address' => ['65 Oldham St.'],
|
||||
'locality' => ['Manchester'],
|
||||
'country-name' => ['United Kingdom'],
|
||||
'postal-code' => ['M1 1JR']
|
||||
'postal-code' => ['M1 1JR'],
|
||||
],
|
||||
'value' => 'https://foursquare.com/v/4ade0e46f964a520bf6f21e3'
|
||||
'value' => 'https://foursquare.com/v/4ade0e46f964a520bf6f21e3',
|
||||
],
|
||||
'location' => [
|
||||
'type' => ['h-adr'],
|
||||
|
@ -307,8 +307,8 @@ class SwarmTest extends TestCase
|
|||
'street-address' => ['65 Oldham St.'],
|
||||
'locality' => ['Manchester'],
|
||||
'country-name' => ['United Kingdom'],
|
||||
'postal-code' => ['M1 1JR']
|
||||
]
|
||||
'postal-code' => ['M1 1JR'],
|
||||
],
|
||||
],
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
|
|
|
@ -59,7 +59,7 @@ class TokenEndpointTest extends TestCase
|
|||
]);
|
||||
$response->assertStatus(401);
|
||||
$response->assertJson([
|
||||
'error' => 'There was an error verifying the authorisation code.'
|
||||
'error' => 'There was an error verifying the authorisation code.',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class TokenEndpointTest extends TestCase
|
|||
]);
|
||||
$response->assertStatus(400);
|
||||
$response->assertJson([
|
||||
'error' => 'Can’t determine the authorisation endpoint.']
|
||||
'error' => 'Can’t determine the authorisation endpoint.', ]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ class TokenServiceTest extends TestCase
|
|||
$data = [
|
||||
'me' => 'https://example.org',
|
||||
'client_id' => 'https://quill.p3k.io',
|
||||
'scope' => 'post'
|
||||
'scope' => 'post',
|
||||
];
|
||||
$token = $tokenService->getNewToken($data);
|
||||
$valid = $tokenService->validateToken($token);
|
||||
$validData = [
|
||||
'me' => $valid->claims()->get('me'),
|
||||
'client_id' => $valid->claims()->get('client_id'),
|
||||
'scope' => $valid->claims()->get('scope')
|
||||
'scope' => $valid->claims()->get('scope'),
|
||||
];
|
||||
$this->assertSame($data, $validData);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class TokenServiceTest extends TestCase
|
|||
$data = [
|
||||
'me' => 'https://example.org',
|
||||
'client_id' => 'https://quill.p3k.io',
|
||||
'scope' => 'post'
|
||||
'scope' => 'post',
|
||||
];
|
||||
|
||||
$config = resolve(Configuration::class);
|
||||
|
|
|
@ -43,7 +43,7 @@ class WebMentionsControllerTest extends TestCase
|
|||
{
|
||||
$response = $this->call('POST', '/webmention', [
|
||||
'source' => 'https://example.org/post/123',
|
||||
'target' => config('app.url') . '/invalid/target'
|
||||
'target' => config('app.url') . '/invalid/target',
|
||||
]);
|
||||
$response->assertStatus(400);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class WebMentionsControllerTest extends TestCase
|
|||
{
|
||||
$response = $this->call('POST', '/webmention', [
|
||||
'source' => 'https://example.org/post/123',
|
||||
'target' => config('app.url') . '/blog/target'
|
||||
'target' => config('app.url') . '/blog/target',
|
||||
]);
|
||||
$response->assertStatus(501);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class WebMentionsControllerTest extends TestCase
|
|||
{
|
||||
$response = $this->call('POST', '/webmention', [
|
||||
'source' => 'https://example.org/post/123',
|
||||
'target' => config('app.url') . '/notes/ZZZZZ'
|
||||
'target' => config('app.url') . '/notes/ZZZZZ',
|
||||
]);
|
||||
$response->assertStatus(400);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ class HelpersTest extends TestCase
|
|||
/**
|
||||
* @test
|
||||
* @dataProvider urlProvider
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $output
|
||||
*/
|
||||
|
@ -30,12 +31,12 @@ class HelpersTest extends TestCase
|
|||
public function prettyPrintJson(): void
|
||||
{
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$json = <<<JSON
|
||||
$json = <<<'JSON'
|
||||
{"glossary": {"title": "example glossary", "GlossDiv": {"title": "S", "GlossList": {"GlossEntry": {"ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": {"para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"]}, "GlossSee": "markup"}}}}}
|
||||
JSON;
|
||||
// phpcs:enable Generic.Files.LineLength.TooLong
|
||||
|
||||
$expected = <<<EXPECTED
|
||||
$expected = <<<'EXPECTED'
|
||||
{
|
||||
"glossary": {
|
||||
"title": "example glossary",
|
||||
|
|
|
@ -28,7 +28,7 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply/1';
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
|
@ -56,12 +56,12 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply/1';
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
HTML;
|
||||
$html2 = <<<HTML
|
||||
$html2 = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
<a class="u-repost-of" href=""></a>
|
||||
|
@ -91,7 +91,7 @@ class DownloadWebMentionJobTest extends TestCase
|
|||
{
|
||||
$this->assertFileDoesNotExist(storage_path('HTML/https'));
|
||||
$source = 'https://example.org/reply-one/';
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<a class="u-like-of" href=""></a>
|
||||
</div>
|
||||
|
|
|
@ -58,7 +58,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
I liked <a class="u-like-of" href="/notes/1">a note</a>.
|
||||
</div>
|
||||
|
@ -125,7 +125,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-in-reply-to" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">Replying to someone else</div>
|
||||
|
@ -162,7 +162,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-like-of" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">I like someone else now</div>
|
||||
|
@ -199,7 +199,7 @@ class ProcessWebMentionJobTest extends TestCase
|
|||
{
|
||||
$parser = new Parser();
|
||||
|
||||
$html = <<<HTML
|
||||
$html = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<p>In reply to <a class="u-repost-of" href="https://other.com/notes/E">a note</a></p>
|
||||
<div class="e-content">Reposting someone else</div>
|
||||
|
|
|
@ -23,7 +23,7 @@ class SyndicateBookmarkToTwitterJobTest extends TestCase
|
|||
$faker = \Faker\Factory::create();
|
||||
$randomNumber = $faker->randomNumber();
|
||||
$json = json_encode([
|
||||
'url' => 'https://twitter.com/' . $randomNumber
|
||||
'url' => 'https://twitter.com/' . $randomNumber,
|
||||
]);
|
||||
$mock = new MockHandler([
|
||||
new Response(201, ['Content-Type' => 'application/json'], $json),
|
||||
|
|
|
@ -45,7 +45,7 @@ class LikesTest extends TestCase
|
|||
/** @test */
|
||||
public function htmlLikeContentIsFiltered(): void
|
||||
{
|
||||
$htmlEvil = <<<HTML
|
||||
$htmlEvil = <<<'HTML'
|
||||
<div class="h-entry">
|
||||
<div class="e-content">
|
||||
<p>Hello</p>
|
||||
|
@ -53,7 +53,7 @@ class LikesTest extends TestCase
|
|||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
$htmlFiltered = <<<HTML
|
||||
$htmlFiltered = <<<'HTML'
|
||||
<p>Hello</p>
|
||||
<img />
|
||||
HTML;
|
||||
|
|
|
@ -4,14 +4,18 @@ declare(strict_types=1);
|
|||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\{Contact, Media, Note, Place, Tag};
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Models\Contact;
|
||||
use App\Models\Media;
|
||||
use App\Models\Note;
|
||||
use App\Models\Place;
|
||||
use App\Models\Tag;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
class NotesTest extends TestCase
|
||||
|
@ -23,6 +27,7 @@ class NotesTest extends TestCase
|
|||
* relevant sub-methods.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getNoteAttributeMethodCallsSubMethods(): void
|
||||
|
@ -39,6 +44,7 @@ class NotesTest extends TestCase
|
|||
* Look for a default image in the contact’s h-card for the makeHCards method.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function defaultImageUsedAsFallbackInMakehcardsMethod(): void
|
||||
|
@ -62,6 +68,7 @@ class NotesTest extends TestCase
|
|||
* Look for a specific profile image in the contact’s h-card.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function specificProfileImageUsedInMakehcardsMethod(): void
|
||||
|
@ -75,7 +82,7 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$fileSystem = new Filesystem();
|
||||
$fileSystem->ensureDirectoryExists(public_path('/assets/profile-images/aaronparecki.com'));
|
||||
if (!$fileSystem->exists(public_path('/assets/profile-images/aaronparecki.com/image'))) {
|
||||
if (! $fileSystem->exists(public_path('/assets/profile-images/aaronparecki.com/image'))) {
|
||||
$fileSystem->copy('./tests/aaron.png', public_path('/assets/profile-images/aaronparecki.com/image'));
|
||||
}
|
||||
$note = Note::factory()->create([
|
||||
|
@ -91,6 +98,7 @@ class NotesTest extends TestCase
|
|||
* Look for twitter URL when there’s no associated contact.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function twitterLinkIsCreatedWhenNoContactFound(): void
|
||||
|
@ -306,8 +314,8 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$note->media()->save($media);
|
||||
|
||||
$expected = "<p>A nice image</p>
|
||||
<img src=\"" . config('filesystems.disks.s3.url') . "/test.png\" alt=\"\">";
|
||||
$expected = '<p>A nice image</p>
|
||||
<img src="' . config('filesystems.disks.s3.url') . '/test.png" alt="">';
|
||||
$this->assertEquals($expected, $note->content);
|
||||
}
|
||||
|
||||
|
@ -323,8 +331,8 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$note->media()->save($media);
|
||||
|
||||
$expected = "<p>A nice video</p>
|
||||
<video src=\"" . config('filesystems.disks.s3.url') . "/test.mkv\">";
|
||||
$expected = '<p>A nice video</p>
|
||||
<video src="' . config('filesystems.disks.s3.url') . '/test.mkv">';
|
||||
$this->assertEquals($expected, $note->content);
|
||||
}
|
||||
|
||||
|
@ -340,13 +348,14 @@ class NotesTest extends TestCase
|
|||
]);
|
||||
$note->media()->save($media);
|
||||
|
||||
$expected = "<p>Some nice audio</p>
|
||||
<audio src=\"" . config('filesystems.disks.s3.url') . "/test.flac\">";
|
||||
$expected = '<p>Some nice audio</p>
|
||||
<audio src="' . config('filesystems.disks.s3.url') . '/test.flac">';
|
||||
$this->assertEquals($expected, $note->content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @todo Why do we need to provide text?
|
||||
*/
|
||||
public function provideTextForBlankContent(): void
|
||||
|
@ -392,7 +401,7 @@ class NotesTest extends TestCase
|
|||
Cache::put('933662564587855877', $tempContent);
|
||||
|
||||
$note = Note::factory()->create([
|
||||
'in_reply_to' => 'https://twitter.com/someRando/status/933662564587855877'
|
||||
'in_reply_to' => 'https://twitter.com/someRando/status/933662564587855877',
|
||||
]);
|
||||
|
||||
$this->assertSame($tempContent, $note->twitter);
|
||||
|
|
|
@ -9,7 +9,6 @@ use App\Models\Place;
|
|||
use App\Services\PlaceService;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use InvalidArgumentException;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
@ -82,7 +81,7 @@ class PlacesTest extends TestCase
|
|||
$ret = $service->createPlaceFromCheckin([
|
||||
'properties' => [
|
||||
'url' => ['https://www.openstreetmap.org/way/1234'],
|
||||
]
|
||||
],
|
||||
]);
|
||||
$this->assertInstanceOf('App\Models\Place', $ret);
|
||||
$this->assertCount(11, Place::all());
|
||||
|
|
|
@ -35,6 +35,7 @@ class TagsTest extends TestCase
|
|||
/**
|
||||
* @test
|
||||
* @dataProvider tagsProvider
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $expected
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue