commit
1bba326711
448 changed files with 7279 additions and 13416 deletions
|
@ -1,7 +1,7 @@
|
|||
APP_ENV=testing
|
||||
APP_DEBUG=true
|
||||
APP_KEY=base64:6DJhvZLVjE6dD4Cqrteh+6Z5vZlG+v/soCKcDHLOAH0=
|
||||
APP_URL=http://jonnybarnes.localhost:8000
|
||||
APP_URL=http://jonnybarnes.localhost
|
||||
APP_LONGURL=jonnybarnes.localhost
|
||||
APP_SHORTURL=jmb.localhost
|
||||
|
||||
|
|
10
.travis.yml
10
.travis.yml
|
@ -1,10 +1,7 @@
|
|||
language: php
|
||||
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
cache:
|
||||
- apt
|
||||
dist: bionic
|
||||
|
||||
addons:
|
||||
hosts:
|
||||
|
@ -14,8 +11,7 @@ addons:
|
|||
apt:
|
||||
packages:
|
||||
- nginx-full
|
||||
- realpath
|
||||
- postgresql-9.6-postgis-2.3
|
||||
- postgresql-9.6-postgis-2.4
|
||||
- imagemagick
|
||||
#- google-chrome-stable
|
||||
artifacts:
|
||||
|
@ -34,8 +30,8 @@ env:
|
|||
- setup=basic
|
||||
|
||||
php:
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4.2
|
||||
|
||||
before_install:
|
||||
- printf "\n" | pecl install imagick
|
||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\DownloadWebMention;
|
||||
use App\Models\WebMention;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Jobs\DownloadWebMention;
|
||||
|
||||
class ReDownloadWebMentions extends Command
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ class Kernel extends ConsoleKernel
|
|||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @param Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
|
@ -37,7 +37,7 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
$this->load(__DIR__ . '/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@ namespace App\Exceptions;
|
|||
|
||||
use App;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
|
@ -37,11 +39,14 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param Exception $exception
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
|
||||
$guzzle = new \GuzzleHttp\Client([
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json',
|
||||
|
@ -56,7 +61,7 @@ class Handler extends ExceptionHandler
|
|||
'fallback' => 'There was an exception.',
|
||||
'pretext' => 'There was an exception.',
|
||||
'color' => '#d00000',
|
||||
'author_name' => App::environment(),
|
||||
'author_name' => app()->environment(),
|
||||
'author_link' => config('app.url'),
|
||||
'fields' => [[
|
||||
'title' => get_class($exception) ?? 'Unkown Exception',
|
||||
|
@ -67,16 +72,15 @@ class Handler extends ExceptionHandler
|
|||
]),
|
||||
]
|
||||
);
|
||||
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
* @return Response
|
||||
* @throws Exception
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
|
|
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Article;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Article;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ArticlesController extends Controller
|
||||
{
|
||||
|
|
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\MicropubClient;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MicropubClient;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ClientsController extends Controller
|
||||
{
|
||||
|
|
|
@ -4,14 +4,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use App\Models\Contact;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Contact;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ContactsController extends Controller
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
|
|
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Like;
|
||||
use App\Jobs\ProcessLike;
|
||||
use Illuminate\View\View;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\ProcessLike;
|
||||
use App\Models\Like;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class LikesController extends Controller
|
||||
{
|
||||
|
|
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Note;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Jobs\SendWebMentions;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\SendWebMentions;
|
||||
use App\Models\Note;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class NotesController extends Controller
|
||||
{
|
||||
|
|
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Place;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PlaceService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Place;
|
||||
use App\Services\PlaceService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Phaza\LaravelPostgis\Geometries\Point;
|
||||
|
||||
class PlacesController extends Controller
|
||||
|
|
|
@ -5,18 +5,18 @@ declare(strict_types=1);
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Article;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\View\View;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class ArticlesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show all articles (with pagination).
|
||||
*
|
||||
* @param int $year
|
||||
* @param int $month
|
||||
* @return \Illuminate\View\View
|
||||
* @param int $year
|
||||
* @param int $month
|
||||
* @return View
|
||||
*/
|
||||
public function index(int $year = null, int $month = null): View
|
||||
{
|
||||
|
@ -31,10 +31,10 @@ class ArticlesController extends Controller
|
|||
/**
|
||||
* Show a single article.
|
||||
*
|
||||
* @param int $year
|
||||
* @param int $month
|
||||
* @param string $slug
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
* @param int $year
|
||||
* @param int $month
|
||||
* @param string $slug
|
||||
* @return RedirectResponse|View
|
||||
*/
|
||||
public function show(int $year, int $month, string $slug)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class ArticlesController extends Controller
|
|||
return redirect('/blog/'
|
||||
. $article->updated_at->year
|
||||
. '/' . $article->updated_at->format('m')
|
||||
.'/' . $slug);
|
||||
. '/' . $slug);
|
||||
}
|
||||
|
||||
return view('articles.show', compact('article'));
|
||||
|
@ -53,8 +53,8 @@ class ArticlesController extends Controller
|
|||
* We only have the ID, work out post title, year and month
|
||||
* and redirect to it.
|
||||
*
|
||||
* @param int $idFromUrl
|
||||
* @return \Illuminte\Http\RedirectResponse
|
||||
* @param int $idFromUrl
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function onlyIdInUrl(int $idFromUrl): RedirectResponse
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Contact;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ContactsController extends Controller
|
||||
{
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
use AuthorizesRequests;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use App\Models\{Article, Note};
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FeedsController extends Controller
|
||||
{
|
||||
|
|
46
app/Http/Controllers/FrontPageController.php
Normal file
46
app/Http/Controllers/FrontPageController.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Article;
|
||||
use App\Models\Bookmark;
|
||||
use App\Models\Like;
|
||||
use App\Models\Note;
|
||||
use App\Services\ActivityStreamsService;
|
||||
|
||||
class FrontPageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show all the recent activity.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (request()->wantsActivityStream()) {
|
||||
return (new ActivityStreamsService())->siteOwnerResponse();
|
||||
}
|
||||
|
||||
$pageNumber = request()->query('page') ?? 1;
|
||||
|
||||
$notes = Note::latest()->get();
|
||||
$articles = Article::latest()->get();
|
||||
$bookmarks = Bookmark::latest()->get();
|
||||
$likes = Like::latest()->get();
|
||||
|
||||
$allItems = collect($notes)
|
||||
->merge($articles)
|
||||
->merge($bookmarks)
|
||||
->merge($likes)
|
||||
->sortByDesc('updated_at')
|
||||
->chunk(10);
|
||||
|
||||
$page = $allItems->get($pageNumber - 1);
|
||||
|
||||
if (is_null($page)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return view('front-page', [
|
||||
'items' => $page,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -4,22 +4,22 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Monolog\Logger;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Illuminate\Http\File;
|
||||
use App\Exceptions\InvalidTokenException;
|
||||
use App\Jobs\ProcessMedia;
|
||||
use App\Models\{Like, Media, Note, Place};
|
||||
use App\Services\Micropub\{HCardService, HEntryService, UpdateService};
|
||||
use App\Services\TokenService;
|
||||
use Illuminate\Http\File;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Http\{Request, Response};
|
||||
use App\Exceptions\InvalidTokenException;
|
||||
use App\Models\{Like, Media, Note, Place};
|
||||
use Phaza\LaravelPostgis\Geometries\Point;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Intervention\Image\Exception\NotReadableException;
|
||||
use App\Services\Micropub\{HCardService, HEntryService, UpdateService};
|
||||
use Intervention\Image\ImageManager;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Logger;
|
||||
use Phaza\LaravelPostgis\Geometries\Point;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class MicropubController extends Controller
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ class MicropubController extends Controller
|
|||
], 201)->header('Location', $location);
|
||||
}
|
||||
|
||||
if (request()->input('h') == 'card' || request()->input('type')[0] == 'h-card') {
|
||||
if (request()->input('h') == 'card' || request()->input('type.0') == 'h-card') {
|
||||
if (stristr($tokenData->getClaim('scope'), 'create') === false) {
|
||||
return $this->insufficientScopeResponse();
|
||||
}
|
||||
|
|
|
@ -5,11 +5,13 @@ declare(strict_types=1);
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Note;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Services\ActivityStreamsService;
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\View\View;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
|
||||
// Need to sort out Twitter and webmentions!
|
||||
|
||||
|
@ -18,12 +20,12 @@ class NotesController extends Controller
|
|||
/**
|
||||
* Show all the notes. This is also the homepage.
|
||||
*
|
||||
* @return \Illuminate\View\View|\Illuminate\Http\JsonResponse
|
||||
* @return ViewFactory|View|Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (request()->wantsActivityStream()) {
|
||||
return (new ActivityStreamsService)->siteOwnerResponse();
|
||||
return (new ActivityStreamsService())->siteOwnerResponse();
|
||||
}
|
||||
|
||||
$notes = Note::latest()
|
||||
|
@ -38,15 +40,15 @@ class NotesController extends Controller
|
|||
/**
|
||||
* Show a single note.
|
||||
*
|
||||
* @param string $urlId The id of the note
|
||||
* @return \Illuminate\View\View|\Illuminate\Http\JsonResponse
|
||||
* @param string $urlId The id of the note
|
||||
* @return View|JsonResponse|Response
|
||||
*/
|
||||
public function show(string $urlId)
|
||||
{
|
||||
$note = Note::nb60($urlId)->with('webmentions')->firstOrFail();
|
||||
|
||||
if (request()->wantsActivityStream()) {
|
||||
return (new ActivityStreamsService)->singleNoteResponse($note);
|
||||
return (new ActivityStreamsService())->singleNoteResponse($note);
|
||||
}
|
||||
|
||||
return view('notes.show', compact('note'));
|
||||
|
@ -55,8 +57,8 @@ class NotesController extends Controller
|
|||
/**
|
||||
* Redirect /note/{decID} to /notes/{nb60id}.
|
||||
*
|
||||
* @param int $decId The decimal id of the note
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @param int $decId The decimal id of the note
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function redirect(int $decId): RedirectResponse
|
||||
{
|
||||
|
@ -66,8 +68,8 @@ class NotesController extends Controller
|
|||
/**
|
||||
* Show all notes tagged with {tag}.
|
||||
*
|
||||
* @param string $tag
|
||||
* @return \Illuminate\View\View
|
||||
* @param string $tag
|
||||
* @return View
|
||||
*/
|
||||
public function tagged(string $tag): View
|
||||
{
|
||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use IndieAuth\Client;
|
||||
use App\Services\TokenService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use IndieAuth\Client;
|
||||
|
||||
class TokenEndpointController extends Controller
|
||||
{
|
||||
|
|
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Note;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Jobs\ProcessWebMention;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
use App\Models\Note;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\View\View;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
|
||||
class WebMentionsController extends Controller
|
||||
{
|
||||
|
|
|
@ -14,11 +14,11 @@ class Kernel extends HttpKernel
|
|||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\App\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,20 +3,22 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CSPHeader
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
// headers have to be single-line strings,
|
||||
// so we concat multiple lines
|
||||
// phpcs:disable
|
||||
return $next($request)
|
||||
->header(
|
||||
'Content-Security-Policy',
|
||||
|
@ -67,10 +69,11 @@ report-uri https://jonnybarnes.report-uri.io/r/default/csp/enforce;")
|
|||
)->header(
|
||||
'Report-To',
|
||||
'{' .
|
||||
"'url': 'https://jonnybarnes.report-uri.io/r/default/csp/enforce', " .
|
||||
"'group': 'csp-endpoint'," .
|
||||
"'max-age': 10886400" .
|
||||
"'url': 'https://jonnybarnes.report-uri.io/r/default/csp/enforce', " .
|
||||
"'group': 'csp-endpoint'," .
|
||||
"'max-age': 10886400" .
|
||||
'}'
|
||||
);
|
||||
// phpcs:enable
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,22 +2,22 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array
|
||||
* @var array|string
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The header that should be used to detect proxies.
|
||||
*
|
||||
* @var string
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
||||
|
|
|
@ -4,23 +4,26 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Models\MicropubClient;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class AddClientToDatabase implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
protected $client_id;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param string $client_id
|
||||
* @param string $client_id
|
||||
*/
|
||||
public function __construct(string $client_id)
|
||||
{
|
||||
|
@ -35,7 +38,7 @@ class AddClientToDatabase implements ShouldQueue
|
|||
public function handle()
|
||||
{
|
||||
if (MicropubClient::where('client_url', $this->client_id)->count() == 0) {
|
||||
$client = MicropubClient::create([
|
||||
MicropubClient::create([
|
||||
'client_url' => $this->client_id,
|
||||
'client_name' => $this->client_id, // default client name is the URL
|
||||
]);
|
||||
|
|
|
@ -5,27 +5,31 @@ declare(strict_types=1);
|
|||
namespace App\Jobs;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\FileSystem\FileSystem;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\FileSystem\FileSystem;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DownloadWebMention implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The webmention source URL.
|
||||
*
|
||||
* @var
|
||||
* @var string
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $source
|
||||
*/
|
||||
public function __construct(string $source)
|
||||
{
|
||||
|
@ -35,7 +39,9 @@ class DownloadWebMention implements ShouldQueue
|
|||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @param \GuzzleHttp\Client $guzzle
|
||||
* @param Client $guzzle
|
||||
* @throws GuzzleException
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public function handle(Client $guzzle)
|
||||
{
|
||||
|
@ -73,13 +79,12 @@ class DownloadWebMention implements ShouldQueue
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a file path from a URL. This is used when caching the HTML
|
||||
* response.
|
||||
* Create a file path from a URL. This is used when caching the HTML response.
|
||||
*
|
||||
* @param string The URL
|
||||
* @return string The path name
|
||||
* @param string $url
|
||||
* @return string The path name
|
||||
*/
|
||||
private function createFilenameFromURL($url)
|
||||
private function createFilenameFromURL(string $url)
|
||||
{
|
||||
$filepath = str_replace(['https://', 'http://'], ['https/', 'http/'], $url);
|
||||
if (substr($filepath, -1) == '/') {
|
||||
|
|
|
@ -4,25 +4,29 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Exceptions\InternetArchiveException;
|
||||
use App\Models\Bookmark;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Services\BookmarkService;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use App\Exceptions\InternetArchiveException;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ProcessBookmark implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var Bookmark */
|
||||
protected $bookmark;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Models\Bookmark $bookmark
|
||||
* @param Bookmark $bookmark
|
||||
*/
|
||||
public function __construct(Bookmark $bookmark)
|
||||
{
|
||||
|
|
|
@ -5,28 +5,33 @@ declare(strict_types=1);
|
|||
namespace App\Jobs;
|
||||
|
||||
use App\Models\Like;
|
||||
use Codebird\Codebird;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Thujohn\Twitter\Facades\Twitter;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Arr;
|
||||
use Jonnybarnes\WebmentionsParser\Authorship;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
|
||||
|
||||
class ProcessLike implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var Like */
|
||||
protected $like;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Models\Like $like
|
||||
* @param Like $like
|
||||
*/
|
||||
public function __construct(Like $like)
|
||||
{
|
||||
|
@ -36,14 +41,18 @@ class ProcessLike implements ShouldQueue
|
|||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @param \GuzzleHttp\Client $client
|
||||
* @param \Jonnybarnes\WebmentionsParser\Authorship $authorship
|
||||
* @param Client $client
|
||||
* @param Authorship $authorship
|
||||
* @return int
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle(Client $client, Authorship $authorship): int
|
||||
{
|
||||
if ($this->isTweet($this->like->url)) {
|
||||
$tweet = Twitter::getOembed(['url' => $this->like->url]);
|
||||
$codebird = resolve(Codebird::class);
|
||||
|
||||
$tweet = $codebird->statuses_oembed(['url' => $this->like->url]);
|
||||
|
||||
$this->like->author_name = $tweet->author_name;
|
||||
$this->like->author_url = $tweet->author_url;
|
||||
$this->like->content = $tweet->html;
|
||||
|
|
|
@ -5,24 +5,28 @@ declare(strict_types=1);
|
|||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Intervention\Image\Exception\NotReadableException;
|
||||
use Intervention\Image\ImageManager;
|
||||
|
||||
class ProcessMedia implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var string */
|
||||
protected $filename;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $filename
|
||||
*/
|
||||
public function __construct(string $filename)
|
||||
{
|
||||
|
@ -32,7 +36,7 @@ class ProcessMedia implements ShouldQueue
|
|||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @param \Intervention\Image\ImageManager $manager
|
||||
* @param ImageManager $manager
|
||||
*/
|
||||
public function handle(ImageManager $manager)
|
||||
{
|
||||
|
@ -49,7 +53,7 @@ class ProcessMedia implements ShouldQueue
|
|||
if ($image->width() > 1000) {
|
||||
$filenameParts = explode('.', $this->filename);
|
||||
$extension = array_pop($filenameParts);
|
||||
// the following acheives this data flow
|
||||
// the following achieves this data flow
|
||||
// foo.bar.png => ['foo', 'bar', 'png'] => ['foo', 'bar'] => foo.bar
|
||||
$basename = ltrim(array_reduce($filenameParts, function ($carry, $item) {
|
||||
return $carry . '.' . $item;
|
||||
|
@ -57,7 +61,7 @@ class ProcessMedia implements ShouldQueue
|
|||
$medium = $image->resize(1000, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
Storage::disk('s3')->put('media/'. $basename . '-medium.' . $extension, (string) $medium->encode());
|
||||
Storage::disk('s3')->put('media/' . $basename . '-medium.' . $extension, (string) $medium->encode());
|
||||
$small = $image->resize(500, null, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
|
|
|
@ -4,30 +4,37 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Mf2;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Models\{Note, WebMention};
|
||||
use Jonnybarnes\WebmentionsParser\Parser;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use App\Exceptions\RemoteContentNotFoundException;
|
||||
use App\Models\{Note, 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 Jonnybarnes\WebmentionsParser\Exceptions\InvalidMentionException;
|
||||
use Jonnybarnes\WebmentionsParser\Parser;
|
||||
use Mf2;
|
||||
|
||||
class ProcessWebMention implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var Note */
|
||||
protected $note;
|
||||
|
||||
/** @var string */
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Note $note
|
||||
* @param string $source
|
||||
* @param Note $note
|
||||
* @param string $source
|
||||
*/
|
||||
public function __construct(Note $note, $source)
|
||||
public function __construct(Note $note, string $source)
|
||||
{
|
||||
$this->note = $note;
|
||||
$this->source = $source;
|
||||
|
@ -36,15 +43,18 @@ class ProcessWebMention implements ShouldQueue
|
|||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @param \Jonnybarnes\WebmentionsParser\Parser $parser
|
||||
* @param \GuzzleHttp\Client $guzzle
|
||||
* @param Parser $parser
|
||||
* @param Client $guzzle
|
||||
* @throws RemoteContentNotFoundException
|
||||
* @throws GuzzleException
|
||||
* @throws InvalidMentionException
|
||||
*/
|
||||
public function handle(Parser $parser, Client $guzzle)
|
||||
{
|
||||
try {
|
||||
$response = $guzzle->request('GET', $this->source);
|
||||
} catch (RequestException $e) {
|
||||
throw new RemoteContentNotFoundException;
|
||||
throw new RemoteContentNotFoundException();
|
||||
}
|
||||
$this->saveRemoteContent((string) $response->getBody(), $this->source);
|
||||
$microformats = Mf2\parse((string) $response->getBody(), $this->source);
|
||||
|
@ -59,7 +69,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
|
||||
return;
|
||||
}
|
||||
// webmenion is still a reply, so update content
|
||||
// webmention is still a reply, so update content
|
||||
dispatch(new SaveProfileImage($microformats));
|
||||
$webmention->mf2 = json_encode($microformats);
|
||||
$webmention->save();
|
||||
|
@ -91,7 +101,7 @@ class ProcessWebMention implements ShouldQueue
|
|||
$webmention->source = $this->source;
|
||||
$webmention->target = $this->note->longurl;
|
||||
$webmention->commentable_id = $this->note->id;
|
||||
$webmention->commentable_type = 'App\Note';
|
||||
$webmention->commentable_type = 'App\Model\Note';
|
||||
$webmention->type = $type;
|
||||
$webmention->mf2 = json_encode($microformats);
|
||||
$webmention->save();
|
||||
|
|
|
@ -5,24 +5,27 @@ declare(strict_types=1);
|
|||
namespace App\Jobs;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Jonnybarnes\WebmentionsParser\Authorship;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
|
||||
|
||||
class SaveProfileImage implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var array */
|
||||
protected $microformats;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param array $microformats
|
||||
* @param array $microformats
|
||||
*/
|
||||
public function __construct(array $microformats)
|
||||
{
|
||||
|
@ -32,7 +35,7 @@ class SaveProfileImage implements ShouldQueue
|
|||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @param \Jonnybarnes\WebmentionsParser\Authorship $authorship
|
||||
* @param Authorship $authorship
|
||||
*/
|
||||
public function handle(Authorship $authorship)
|
||||
{
|
||||
|
@ -44,14 +47,16 @@ class SaveProfileImage implements ShouldQueue
|
|||
$photo = $author['properties']['photo'][0];
|
||||
$home = $author['properties']['url'][0];
|
||||
//dont save pbs.twimg.com links
|
||||
if (parse_url($photo, PHP_URL_HOST) != 'pbs.twimg.com'
|
||||
&& parse_url($photo, PHP_URL_HOST) != 'twitter.com') {
|
||||
if (
|
||||
parse_url($photo, PHP_URL_HOST) != 'pbs.twimg.com'
|
||||
&& parse_url($photo, PHP_URL_HOST) != 'twitter.com'
|
||||
) {
|
||||
$client = resolve(Client::class);
|
||||
try {
|
||||
$response = $client->get($photo);
|
||||
$image = $response->getBody(true);
|
||||
} catch (RequestException $e) {
|
||||
// we are openning and reading the default image so that
|
||||
// we are opening and reading the default image so that
|
||||
$default = public_path() . '/assets/profile-images/default-image';
|
||||
$handle = fopen($default, 'rb');
|
||||
$image = fread($handle, filesize($default));
|
||||
|
|
|
@ -6,22 +6,26 @@ namespace App\Jobs;
|
|||
|
||||
use App\Models\Note;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Str;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SendWebMentions implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var Note */
|
||||
protected $note;
|
||||
|
||||
/**
|
||||
* Create the job instance, inject dependencies.
|
||||
*
|
||||
* @param Note $note
|
||||
* @param Note $note
|
||||
*/
|
||||
public function __construct(Note $note)
|
||||
{
|
||||
|
@ -58,7 +62,7 @@ class SendWebMentions implements ShouldQueue
|
|||
/**
|
||||
* Discover if a URL has a webmention endpoint.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $url
|
||||
* @return string|null
|
||||
*/
|
||||
public function discoverWebmentionEndpoint(string $url)
|
||||
|
@ -101,14 +105,15 @@ class SendWebMentions implements ShouldQueue
|
|||
/**
|
||||
* Get the URLs from a note.
|
||||
*
|
||||
* @param string $html
|
||||
* @return array $urls
|
||||
* @param string|null $html
|
||||
* @return array
|
||||
*/
|
||||
public function getLinks($html)
|
||||
public function getLinks(?string $html): array
|
||||
{
|
||||
if ($html == '' || is_null($html)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$urls = [];
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadHTML($html);
|
||||
|
@ -123,8 +128,10 @@ class SendWebMentions implements ShouldQueue
|
|||
/**
|
||||
* Resolve a URI if necessary.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $base The base of the URL
|
||||
* @todo Update deprecated resolve method
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $base The base of the URL
|
||||
* @return string
|
||||
*/
|
||||
public function resolveUri(string $url, string $base): string
|
||||
|
@ -134,7 +141,7 @@ class SendWebMentions implements ShouldQueue
|
|||
return (string) $endpoint;
|
||||
}
|
||||
|
||||
return (string) \GuzzleHttp\Psr7\Uri::resolve(
|
||||
return (string) Uri::resolve(
|
||||
\GuzzleHttp\Psr7\uri_for($base),
|
||||
$endpoint
|
||||
);
|
||||
|
|
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Jobs;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use App\Models\Bookmark;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SyndicateBookmarkToTwitter implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var Bookmark */
|
||||
protected $bookmark;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Models\Bookmark $bookmark
|
||||
* @param Bookmark $bookmark
|
||||
*/
|
||||
public function __construct(Bookmark $bookmark)
|
||||
{
|
||||
|
@ -31,7 +36,8 @@ class SyndicateBookmarkToTwitter implements ShouldQueue
|
|||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @param \GuzzleHttp\Client $guzzle
|
||||
* @param Client $guzzle
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle(Client $guzzle)
|
||||
{
|
||||
|
|
|
@ -6,21 +6,25 @@ namespace App\Jobs;
|
|||
|
||||
use App\Models\Note;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SyndicateNoteToTwitter implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/** @var Note */
|
||||
protected $note;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Models\Note $note
|
||||
* @param Note $note
|
||||
*/
|
||||
public function __construct(Note $note)
|
||||
{
|
||||
|
@ -30,7 +34,8 @@ class SyndicateNoteToTwitter implements ShouldQueue
|
|||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @param \GuzzleHttp\Client $guzzle
|
||||
* @param Client $guzzle
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function handle(Client $guzzle)
|
||||
{
|
||||
|
|
|
@ -4,14 +4,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use League\CommonMark\Environment;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use League\CommonMark\Block\Element\FencedCode;
|
||||
use League\CommonMark\Block\Element\IndentedCode;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use League\CommonMark\Environment;
|
||||
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
|
||||
use Spatie\CommonMarkHighlighter\IndentedCodeRenderer;
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Mf2;
|
||||
use App\Traits\FilterHtml;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Mf2;
|
||||
|
||||
class Like extends Model
|
||||
{
|
||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Media extends Model
|
||||
{
|
||||
|
|
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Cache;
|
||||
use Twitter;
|
||||
use Normalizer;
|
||||
use GuzzleHttp\Client;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
use League\CommonMark\Environment;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Jonnybarnes\EmojiA11y\EmojiModifier;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use App\Exceptions\TwitterContentException;
|
||||
use Cache;
|
||||
use Codebird\Codebird;
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
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 Jonnybarnes\IndieWeb\Numbers;
|
||||
use Laravel\Scout\Searchable;
|
||||
use League\CommonMark\Block\Element\FencedCode;
|
||||
use League\CommonMark\Block\Element\IndentedCode;
|
||||
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use League\CommonMark\Environment;
|
||||
use League\CommonMark\Ext\Autolink\AutolinkExtension;
|
||||
use Normalizer;
|
||||
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
|
||||
use Spatie\CommonMarkHighlighter\IndentedCodeRenderer;
|
||||
use Twitter;
|
||||
|
||||
class Note extends Model
|
||||
{
|
||||
|
@ -29,7 +34,7 @@ class Note extends Model
|
|||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The reges for matching lone usernames.
|
||||
* The regex for matching lone usernames.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -79,7 +84,7 @@ class Note extends Model
|
|||
/**
|
||||
* Define the relationship with tags.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function tags()
|
||||
{
|
||||
|
@ -89,7 +94,7 @@ class Note extends Model
|
|||
/**
|
||||
* Define the relationship with clients.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function client()
|
||||
{
|
||||
|
@ -99,7 +104,7 @@ class Note extends Model
|
|||
/**
|
||||
* Define the relationship with webmentions.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function webmentions()
|
||||
{
|
||||
|
@ -109,7 +114,7 @@ class Note extends Model
|
|||
/**
|
||||
* Define the relationship with places.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function place()
|
||||
{
|
||||
|
@ -119,7 +124,7 @@ class Note extends Model
|
|||
/**
|
||||
* Define the relationship with media.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
* @return HasMany
|
||||
*/
|
||||
public function media()
|
||||
{
|
||||
|
@ -174,9 +179,8 @@ class Note extends Model
|
|||
$hcards = $this->makeHCards($value);
|
||||
$hashtags = $this->autoLinkHashtag($hcards);
|
||||
$html = $this->convertMarkdown($hashtags);
|
||||
$modified = resolve(EmojiModifier::class)->makeEmojiAccessible($html);
|
||||
|
||||
return $modified;
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,13 +350,18 @@ class Note extends Model
|
|||
}
|
||||
|
||||
try {
|
||||
$oEmbed = Twitter::getOembed([
|
||||
$codebird = resolve(Codebird::class);
|
||||
$oEmbed = $codebird->statuses_oembed([
|
||||
'url' => $this->in_reply_to,
|
||||
'dnt' => true,
|
||||
'align' => 'center',
|
||||
'maxwidth' => 512,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
if ($oEmbed->httpstatus >= 400) {
|
||||
throw new Exception();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
Cache::put($tweetId, $oEmbed, ($oEmbed->cache_age));
|
||||
|
@ -376,8 +385,10 @@ class Note extends Model
|
|||
|
||||
// here we check the matched contact from the note corresponds to a contact
|
||||
// in the database
|
||||
if (count(array_unique(array_values($this->contacts))) === 1
|
||||
&& array_unique(array_values($this->contacts))[0] === null) {
|
||||
if (
|
||||
count(array_unique(array_values($this->contacts))) === 1
|
||||
&& array_unique(array_values($this->contacts))[0] === null
|
||||
) {
|
||||
throw new TwitterContentException('The matched contact is not in the database');
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Phaza\LaravelPostgis\Geometries\Point;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Phaza\LaravelPostgis\Eloquent\PostgisTrait;
|
||||
use Phaza\LaravelPostgis\Geometries\Point;
|
||||
|
||||
class Place extends Model
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
|
@ -4,12 +4,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Cache;
|
||||
use Twitter;
|
||||
use App\Traits\FilterHtml;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Codebird\Codebird;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Jonnybarnes\WebmentionsParser\Authorship;
|
||||
use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException;
|
||||
|
||||
class WebMention extends Model
|
||||
{
|
||||
|
@ -32,7 +34,7 @@ class WebMention extends Model
|
|||
/**
|
||||
* Define the relationship.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function commentable()
|
||||
{
|
||||
|
@ -43,12 +45,14 @@ class WebMention extends Model
|
|||
* Get the author of the webmention.
|
||||
*
|
||||
* @return array
|
||||
* @throws AuthorshipParserException
|
||||
*/
|
||||
public function getAuthorAttribute(): array
|
||||
{
|
||||
$authorship = new Authorship();
|
||||
$hCard = $authorship->findAuthor(json_decode($this->mf2, true));
|
||||
if (array_key_exists('properties', $hCard) &&
|
||||
if (
|
||||
array_key_exists('properties', $hCard) &&
|
||||
array_key_exists('photo', $hCard['properties'])
|
||||
) {
|
||||
$hCard['properties']['photo'][0] = $this->createPhotoLink($hCard['properties']['photo'][0]);
|
||||
|
@ -118,7 +122,8 @@ class WebMention extends Model
|
|||
return Cache::get($url);
|
||||
}
|
||||
$username = ltrim(parse_url($url, PHP_URL_PATH), '/');
|
||||
$info = Twitter::getUsers(['screen_name' => $username]);
|
||||
$codebird = resolve(Codebird::class);
|
||||
$info = $codebird->users_show(['screen_name' => $username]);
|
||||
$profile_image = $info->profile_image_url_https;
|
||||
Cache::put($url, $profile_image, 10080); //1 week
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ class NoteObserver
|
|||
/**
|
||||
* Listen to the Note created event.
|
||||
*
|
||||
* @param \App\Note $note
|
||||
* @param Note $note
|
||||
*/
|
||||
public function created(Note $note)
|
||||
{
|
||||
$text = array_get($note->getAttributes(), 'note');
|
||||
$text = Arr::get($note->getAttributes(), 'note');
|
||||
if ($text === null) {
|
||||
return;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class NoteObserver
|
|||
/**
|
||||
* Listen to the Note updated event.
|
||||
*
|
||||
* @param \App\Note $Note
|
||||
* @param Note $note
|
||||
*/
|
||||
public function updated(Note $note)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ class NoteObserver
|
|||
/**
|
||||
* Listen to the Note deleting event.
|
||||
*
|
||||
* @param \App\Note $note
|
||||
* @param Note $note
|
||||
*/
|
||||
public function deleting(Note $note)
|
||||
{
|
||||
|
@ -72,8 +72,8 @@ class NoteObserver
|
|||
/**
|
||||
* Retrieve the tags from a note’s text, tag for form #tag.
|
||||
*
|
||||
* @param string $note
|
||||
* @return \Illuminate\Support\Collection
|
||||
* @param string $note
|
||||
* @return Collection
|
||||
*/
|
||||
private function getTagsFromNote(string $note): Collection
|
||||
{
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use App\Models\Note;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Observers\NoteObserver;
|
||||
use Laravel\Dusk\DuskServiceProvider;
|
||||
use Codebird\Codebird;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Dusk\DuskServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -29,6 +30,23 @@ class AppServiceProvider extends ServiceProvider
|
|||
$this->app->bind('Intervention\Image\ImageManager', function () {
|
||||
return new \Intervention\Image\ImageManager(['driver' => config('image.driver')]);
|
||||
});
|
||||
|
||||
// Bind the Codebird client
|
||||
$this->app->bind('Codebird\Codebird', function () {
|
||||
Codebird::setConsumerKey(
|
||||
env('TWITTER_CONSUMER_KEY'),
|
||||
env('TWITTER_CONSUMER_SECRET')
|
||||
);
|
||||
|
||||
$cb = Codebird::getInstance();
|
||||
|
||||
$cb->setToken(
|
||||
env('TWITTER_ACCESS_TOKEN'),
|
||||
env('TWITTER_ACCESS_TOKEN_SECRET')
|
||||
);
|
||||
|
||||
return $cb;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -13,8 +15,8 @@ class EventServiceProvider extends ServiceProvider
|
|||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\Event' => [
|
||||
'App\Listeners\EventListener',
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Laravel\Horizon\Horizon;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Horizon\Horizon;
|
||||
use Laravel\Horizon\HorizonApplicationServiceProvider;
|
||||
|
||||
class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Laravel\Telescope\Telescope;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Telescope\IncomingEntry;
|
||||
use Laravel\Telescope\Telescope;
|
||||
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
||||
|
||||
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||||
|
|
|
@ -4,24 +4,24 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Jobs\ProcessBookmark;
|
||||
use App\Models\{Bookmark, Tag};
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
use Spatie\Browsershot\Browsershot;
|
||||
use App\Jobs\SyndicateBookmarkToTwitter;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use App\Exceptions\InternetArchiveException;
|
||||
use App\Jobs\ProcessBookmark;
|
||||
use App\Jobs\SyndicateBookmarkToTwitter;
|
||||
use App\Models\{Bookmark, Tag};
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Spatie\Browsershot\Browsershot;
|
||||
use Spatie\Browsershot\Exceptions\CouldNotTakeBrowsershot;
|
||||
|
||||
class BookmarkService
|
||||
{
|
||||
/**
|
||||
* Create a new Bookmark.
|
||||
*
|
||||
* @param array $request Data from request()->all()
|
||||
* @return Bookmark $bookmark
|
||||
* @param array $request Data from request()->all()
|
||||
* @return Bookmark
|
||||
*/
|
||||
public function createBookmark(array $request): Bookmark
|
||||
{
|
||||
|
@ -81,8 +81,9 @@ class BookmarkService
|
|||
/**
|
||||
* Given a URL, use browsershot to save an image of the page.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $url
|
||||
* @return string The uuid for the screenshot
|
||||
* @throws CouldNotTakeBrowsershot
|
||||
*/
|
||||
public function saveScreenshot(string $url): string
|
||||
{
|
||||
|
@ -102,8 +103,9 @@ class BookmarkService
|
|||
/**
|
||||
* Given a URL, attempt to save it to the Internet Archive.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $url
|
||||
* @return string
|
||||
* @throws InternetArchiveException
|
||||
*/
|
||||
public function getArchiveLink(string $url): string
|
||||
{
|
||||
|
@ -112,7 +114,7 @@ class BookmarkService
|
|||
$response = $client->request('GET', 'https://web.archive.org/save/' . $url);
|
||||
} catch (ClientException $e) {
|
||||
//throw an exception to be caught
|
||||
throw new InternetArchiveException;
|
||||
throw new InternetArchiveException();
|
||||
}
|
||||
if ($response->hasHeader('Content-Location')) {
|
||||
if (Str::startsWith(Arr::get($response->getHeader('Content-Location'), 0), '/web')) {
|
||||
|
@ -121,6 +123,6 @@ class BookmarkService
|
|||
}
|
||||
|
||||
//throw an exception to be caught
|
||||
throw new InternetArchiveException;
|
||||
throw new InternetArchiveException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Like;
|
||||
use App\Jobs\ProcessLike;
|
||||
use App\Models\Like;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class LikeService
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\Micropub;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Services\PlaceService;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class HCardService
|
||||
{
|
||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\Micropub;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Services\{BookmarkService, LikeService, NoteService};
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class HEntryService
|
||||
{
|
||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
|||
namespace App\Services\Micropub;
|
||||
|
||||
use App\Models\{Media, Note};
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
|
||||
class UpdateService
|
||||
{
|
||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
use App\Models\{Media, Note, Place};
|
||||
use App\Jobs\{SendWebMentions, SyndicateNoteToTwitter};
|
||||
use App\Models\{Media, Note, Place};
|
||||
use Illuminate\Support\{Arr, Str};
|
||||
|
||||
class NoteService
|
||||
{
|
||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Exceptions\InvalidTokenException;
|
||||
use App\Jobs\AddClientToDatabase;
|
||||
use Lcobucci\JWT\Signer\Hmac\Sha256;
|
||||
use App\Exceptions\InvalidTokenException;
|
||||
use Lcobucci\JWT\{Builder, Parser, Token};
|
||||
|
||||
class TokenService
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "jonnybarnes/jonnybarnes.uk",
|
||||
"type": "project",
|
||||
"description": "The code for jonnybanres.uk, based on Laravel 5.8",
|
||||
"description": "The code for jonnybarnes.uk, based on Laravel 5.8",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel",
|
||||
|
@ -9,46 +9,46 @@
|
|||
],
|
||||
"license": "CC0-1.0",
|
||||
"require": {
|
||||
"php": ">=7.2.0",
|
||||
"cviebrock/eloquent-sluggable": "~4.3",
|
||||
"php": "^7.3",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-dom": "*",
|
||||
"cviebrock/eloquent-sluggable": "~6.0",
|
||||
"fideloper/proxy": "~4.0",
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
"indieauth/client": "~0.1",
|
||||
"intervention/image": "^2.4",
|
||||
"jonnybarnes/emoji-a11y": "^0.3",
|
||||
"jonnybarnes/indieweb": "dev-master",
|
||||
"jonnybarnes/webmentions-parser": "0.4.*",
|
||||
"laravel/framework": "5.8.*",
|
||||
"jublonet/codebird-php": "4.0.0-beta.1",
|
||||
"laravel/framework": "^6.0",
|
||||
"laravel/horizon": "^3.0",
|
||||
"laravel/scout": "^7.0",
|
||||
"laravel/telescope": "^2.0",
|
||||
"laravel/tinker": "^1.0",
|
||||
"laravel/tinker": "^2.0",
|
||||
"lcobucci/jwt": "^3.1",
|
||||
"league/commonmark": "^1.0",
|
||||
"league/commonmark-ext-autolink": "^1.0",
|
||||
"league/flysystem-aws-s3-v3": "^1.0",
|
||||
"mf2/mf2": "~0.3",
|
||||
"phaza/laravel-postgis": "~3.1",
|
||||
"pmatseykanets/laravel-scout-postgres": "~5.0",
|
||||
"phaza/laravel-postgis": "~4.0",
|
||||
"pmatseykanets/laravel-scout-postgres": "~6.0",
|
||||
"predis/predis": "~1.0",
|
||||
"ramsey/uuid": "^3.5",
|
||||
"sensiolabs/security-checker": "^6.0",
|
||||
"spatie/browsershot": "~3.0",
|
||||
"spatie/commonmark-highlighter": "^2.0",
|
||||
"tgalopin/html-sanitizer": "^1.1",
|
||||
"thujohn/twitter": "~2.0"
|
||||
"tgalopin/html-sanitizer": "^1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.0",
|
||||
"beyondcode/laravel-dump-server": "^1.0",
|
||||
"barryvdh/laravel-debugbar": "~3.0",
|
||||
"codedungeon/phpunit-result-printer": "^0.26.0",
|
||||
"filp/whoops": "~2.0",
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"facade/ignition": "^1.4",
|
||||
"fzaninotto/faker": "^1.4",
|
||||
"laravel/dusk": "^5.0",
|
||||
"mockery/mockery": "~1.0",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^3.0",
|
||||
"phpunit/phpunit": "~8.0",
|
||||
"symfony/thanks": "~1.0"
|
||||
"phpunit/phpunit": "^8.0"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
|
|
2932
composer.lock
generated
2932
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -13,7 +13,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'name' => 'jonnybarnes.uk',
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -100,7 +100,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -113,7 +113,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LANG', 'en'),
|
||||
'locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -202,14 +202,9 @@ return [
|
|||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\TelescopeServiceProvider::class,
|
||||
App\Providers\HorizonServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Thujohn’s Twitter API client
|
||||
*/
|
||||
Thujohn\Twitter\TwitterServiceProvider::class,
|
||||
App\Providers\HorizonServiceProvider::class,
|
||||
App\Providers\TelescopeServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
|
@ -261,8 +256,6 @@ return [
|
|||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
||||
'Twitter' => Thujohn\Twitter\Facades\Twitter::class,
|
||||
|
||||
],
|
||||
|
||||
'piwik' => env('PIWIK', false),
|
||||
|
|
|
@ -36,7 +36,8 @@ return [
|
|||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
//
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'useTLS' => true,
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ return [
|
|||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
||||
| Supported: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb"
|
||||
|
|
||||
*/
|
||||
|
||||
|
@ -75,6 +76,15 @@ return [
|
|||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|
@ -88,6 +98,6 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
|
||||
|
||||
];
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|
@ -35,6 +37,7 @@ return [
|
|||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
|
@ -42,6 +45,7 @@ return [
|
|||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
|
@ -61,6 +65,7 @@ return [
|
|||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
|
@ -75,6 +80,7 @@ return [
|
|||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
|
@ -124,9 +130,15 @@ return [
|
|||
|
||||
'redis' => [
|
||||
|
||||
'client' => 'predis',
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', 6379),
|
||||
|
@ -134,6 +146,7 @@ return [
|
|||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', 6379),
|
||||
|
|
|
@ -51,7 +51,7 @@ return [
|
|||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'url' => env('APP_URL') . '/storage',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
|
||||
|
|
|
@ -11,10 +11,39 @@ return [
|
|||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon"
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
'bcrypt' => [
|
||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
'argon' => [
|
||||
'memory' => 1024,
|
||||
'threads' => 2,
|
||||
'time' => 2,
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
|
@ -37,6 +38,7 @@ return [
|
|||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['daily'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
|
@ -88,6 +90,11 @@ return [
|
|||
'driver' => 'errorlog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -11,8 +11,8 @@ return [
|
|||
| sending of e-mail. You may specify which one you're using throughout
|
||||
| your application here. By default, Laravel is setup for SMTP mail.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses"
|
||||
| "sparkpost", "log", "array"
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses"
|
||||
| "postmark", "log", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ return [
|
|||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'block_for' => 0,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
|
@ -79,6 +80,7 @@ return [
|
|||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
|
|
@ -20,24 +20,14 @@ return [
|
|||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('SES_KEY'),
|
||||
'secret' => env('SES_SECRET'),
|
||||
'region' => 'us-east-1',
|
||||
],
|
||||
|
||||
'sparkpost' => [
|
||||
'secret' => env('SPARKPOST_SECRET'),
|
||||
],
|
||||
|
||||
'stripe' => [
|
||||
'model' => App\User::class,
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'secret' => env('STRIPE_SECRET'),
|
||||
'webhook' => [
|
||||
'secret' => env('STRIPE_WEBHOOK_SECRET'),
|
||||
'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -14,7 +14,7 @@ return [
|
|||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "array"
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
|
@ -31,7 +31,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'lifetime' => 60 * 24 * 7,
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => false,
|
||||
|
||||
|
@ -126,7 +126,7 @@ return [
|
|||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|
|
|
@ -2,9 +2,13 @@
|
|||
|
||||
use App\Models\Note;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
$factory->define(Note::class, function (Faker $faker) {
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
return [
|
||||
'note' => $faker->paragraph,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Article;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ArticlesTableSeeder extends Seeder
|
||||
{
|
||||
|
@ -12,12 +14,18 @@ class ArticlesTableSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
Article::create([
|
||||
$now = Carbon::now()->subMonth();
|
||||
$articleFirst = Article::create([
|
||||
'title' => 'My New Blog',
|
||||
'main' => 'This is *my* new blog. It uses `Markdown`.',
|
||||
'published' => 1,
|
||||
'created_at' => $now,
|
||||
]);
|
||||
DB::table('articles')
|
||||
->where('id', $articleFirst->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(2)->subMinutes(25);
|
||||
$articleWithCode = <<<EOF
|
||||
I wrote some code.
|
||||
|
||||
|
@ -37,10 +45,14 @@ class Foo
|
|||
}
|
||||
```
|
||||
EOF;
|
||||
Article::create([
|
||||
$articleSecond = Article::create([
|
||||
'title' => 'Some code I did',
|
||||
'main' => $articleWithCode,
|
||||
'published' => 1,
|
||||
'created_at' => $now,
|
||||
]);
|
||||
DB::table('articles')
|
||||
->where('id', $articleSecond->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\{Bookmark, Tag};
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BookmarksTableSeeder extends Seeder
|
||||
{
|
||||
|
@ -14,6 +16,14 @@ class BookmarksTableSeeder extends Seeder
|
|||
{
|
||||
factory(Bookmark::class, 10)->create()->each(function ($bookmark) {
|
||||
$bookmark->tags()->save(factory(Tag::class)->make());
|
||||
|
||||
$now = Carbon::now()->subDays(rand(2, 12));
|
||||
DB::table('bookmarks')
|
||||
->where('id', $bookmark->id)
|
||||
->update([
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
use App\Models\Like;
|
||||
use Faker\Generator;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LikesTableSeeder extends Seeder
|
||||
{
|
||||
|
@ -13,20 +15,40 @@ class LikesTableSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(Like::class, 10)->create();
|
||||
sleep(1);
|
||||
factory(Like::class, 10)->create()->each(function ($like) {
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
DB::table('likes')
|
||||
->where('id', $like->id)
|
||||
->update([
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
]);
|
||||
});
|
||||
|
||||
$now = Carbon::now()->subDays(rand(3, 6));
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new \Faker\Provider\en_US\Person($faker));
|
||||
$faker->addProvider(new \Faker\Provider\Lorem($faker));
|
||||
$faker->addProvider(new \Faker\Provider\Internet($faker));
|
||||
Like::create([
|
||||
$likeFromAuthor = Like::create([
|
||||
'url' => $faker->url,
|
||||
'author_url' => $faker->url,
|
||||
'author_name' => $faker->name,
|
||||
]);
|
||||
sleep(1);
|
||||
DB::table('likes')
|
||||
->where('id', $likeFromAuthor->id)
|
||||
->update([
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
]);
|
||||
|
||||
Like::create(['url' => 'https://example.com']);
|
||||
$now = Carbon::now()->subHours(rand(3, 6));
|
||||
$likeJustUrl = Like::create(['url' => 'https://example.com']);
|
||||
DB::table('likes')
|
||||
->where('id', $likeJustUrl->id)
|
||||
->update([
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\{Media, Note, Place};
|
||||
|
||||
class NotesTableSeeder extends Seeder
|
||||
|
@ -12,103 +14,175 @@ class NotesTableSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(Note::class, 10)->create();
|
||||
sleep(1);
|
||||
//factory(Note::class, 10)->create();
|
||||
|
||||
$now = Carbon::now()->subDays(rand(2, 5));
|
||||
$noteTwitterReply = Note::create([
|
||||
'note' => 'What does this even mean?',
|
||||
'in_reply_to' => 'https://twitter.com/realDonaldTrump/status/933662564587855877',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteTwitterReply->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subDays(rand(2, 5));
|
||||
$noteWithPlace = Note::create([
|
||||
'note' => 'Having a #beer at the local. 🍺',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
$noteWithPlace->tweet_id = '123456789';
|
||||
$place = Place::find(1);
|
||||
$noteWithPlace->place()->associate($place);
|
||||
$noteWithPlace->save();
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithPlace->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subDays(rand(3, 6));
|
||||
$noteWithPlaceTwo = Note::create([
|
||||
'note' => 'It’s really good',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
$place = Place::find(1);
|
||||
$noteWithPlaceTwo->place()->associate($place);
|
||||
$noteWithPlaceTwo->save();
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithPlaceTwo->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subDays(rand(4, 8));
|
||||
$noteWithContact = Note::create([
|
||||
'note' => 'Hi @tantek'
|
||||
'note' => 'Hi @tantek',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithContact->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subDays(rand(1, 10));
|
||||
$noteWithContactPlusPic = Note::create([
|
||||
'note' => 'Hi @aaron',
|
||||
'client_id' => 'https://jbl5.dev/notes/new'
|
||||
'client_id' => 'https://jbl5.dev/notes/new',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithContactPlusPic->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subDays(rand(2, 5));
|
||||
$noteWithoutContact = Note::create([
|
||||
'note' => 'Hi @bob',
|
||||
'client_id' => 'https://quill.p3k.io'
|
||||
'client_id' => 'https://quill.p3k.io',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithoutContact->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
//copy aaron’s profile pic in place
|
||||
$spl = new SplFileInfo(public_path() . '/assets/profile-images/aaronparecki.com');
|
||||
if ($spl->isDir() === false) {
|
||||
mkdir(public_path() . '/assets/profile-images/aaronparecki.com', 0755);
|
||||
copy(base_path() . '/tests/aaron.png', public_path() . '/assets/profile-images/aaronparecki.com/image');
|
||||
}
|
||||
|
||||
$now = Carbon::now()->subDays(rand(3, 7));
|
||||
$noteWithCoords = Note::create([
|
||||
'note' => 'Note from a town',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithCoords->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
$noteWithCoords->location = '53.499,-2.379';
|
||||
$noteWithCoords->save();
|
||||
sleep(1);
|
||||
$noteWithCoords2 = Note::create([
|
||||
'note' => 'Note from a city',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
$noteWithCoords2->location = '53.9026894,-2.42250444118781';
|
||||
$noteWithCoords2->save();
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithCoords2->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
$noteWithCoords3 = Note::create([
|
||||
'note' => 'Note from a county',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
$noteWithCoords3->location = '57.5066357,-5.0038367';
|
||||
$noteWithCoords3->save();
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithCoords3->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
$noteWithCoords4 = Note::create([
|
||||
'note' => 'Note from a country',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
$noteWithCoords4->location = '63.000147,-136.002502';
|
||||
$noteWithCoords4->save();
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithCoords4->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(7);
|
||||
$noteSyndicated = Note::create([
|
||||
'note' => 'This note has all the syndication targets',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
$noteSyndicated->tweet_id = '123456';
|
||||
$noteSyndicated->facebook_url = 'https://www.facebook.com/post/12345789';
|
||||
$noteSyndicated->swarm_url = 'https://www.swarmapp.com/checking/123456789';
|
||||
$noteSyndicated->instagram_url = 'https://www.instagram.com/p/aWsEd123Jh';
|
||||
$noteSyndicated->save();
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteSyndicated->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(6);
|
||||
$noteWithTextLinkandEmoji = Note::create([
|
||||
'note' => 'I love https://duckduckgo.com 💕' // theres a two-heart emoji at the end of this
|
||||
'note' => 'I love https://duckduckgo.com 💕', // there’s a two-heart emoji at the end of this
|
||||
'created_at' => $now,
|
||||
]);
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithTextLinkandEmoji->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(5);
|
||||
$noteJustCheckin = new Note();
|
||||
$noteJustCheckin->setCreatedAt($now);
|
||||
$place = Place::find(1);
|
||||
$noteJustCheckin->place()->associate($place);
|
||||
$noteJustCheckin->save();
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteJustCheckin->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(4);
|
||||
$media = new Media();
|
||||
$media->path = 'media/f1bc8faa-1a8f-45b8-a9b1-57282fa73f87.jpg';
|
||||
$media->type = 'image';
|
||||
$media->image_widths = '3648';
|
||||
$media->save();
|
||||
$noteWithOnlyImage = new Note();
|
||||
$noteWithOnlyImage->setCreatedAt($now);
|
||||
$noteWithOnlyImage->setUpdatedAt($now);
|
||||
$noteWithOnlyImage->save();
|
||||
$noteWithOnlyImage->media()->save($media);
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithOnlyImage->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(3);
|
||||
$noteCapitalHashtag = Note::create([
|
||||
'note' => 'A #TwoWord hashtag',
|
||||
'created_at' => $now,
|
||||
]);
|
||||
sleep(1);
|
||||
DB::table('notes')
|
||||
->where('id', $noteCapitalHashtag->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
$now = Carbon::now()->subHours(2);
|
||||
$noteWithCodeContent = <<<EOF
|
||||
A note with some code:
|
||||
```php
|
||||
|
@ -118,6 +192,10 @@ echo 'Hello World';
|
|||
EOF;
|
||||
$noteWithCode = Note::create([
|
||||
'note' => $noteWithCodeContent,
|
||||
'created_at' => $now,
|
||||
]);
|
||||
DB::table('notes')
|
||||
->where('id', $noteWithCode->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
}
|
||||
}
|
||||
|
|
14345
package-lock.json
generated
14345
package-lock.json
generated
File diff suppressed because it is too large
Load diff
58
package.json
58
package.json
|
@ -5,54 +5,32 @@
|
|||
"repository": "https://github.com/jonnybarnes/jonnybarnes.uk",
|
||||
"license": "CC0-1.0",
|
||||
"dependencies": {
|
||||
"a11y.css": "^5.0.3",
|
||||
"alertify.js": "^1.0.12",
|
||||
"marked": "^0.7.0",
|
||||
"normalize.css": "^8.0.1",
|
||||
"puppeteer": "^1.18.1"
|
||||
"puppeteer": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.4",
|
||||
"@babel/preset-env": "^7.5.4",
|
||||
"ajv": "^6.10.1",
|
||||
"ajv-keywords": "^3.4.1",
|
||||
"autoprefixer": "^9.6.1",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"dotenv-webpack": "^1.7.0",
|
||||
"eslint": "^6.0.1",
|
||||
"eslint-config-standard": "^13.0.1",
|
||||
"eslint-plugin-import": "^2.18.0",
|
||||
"eslint-plugin-node": "^9.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.0",
|
||||
"husky": "^3.0.0",
|
||||
"lint-staged": "^9.2.0",
|
||||
"postcss-cli": "^6.1.3",
|
||||
"postcss-sass": "^0.4.1",
|
||||
"css-loader": "^3.4.2",
|
||||
"husky": "^4.2.1",
|
||||
"lint-staged": "^10.0.2",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"pre-commit": "^1.1.3",
|
||||
"source-list-map": "^2.0.1",
|
||||
"stylelint": "^10.1.0",
|
||||
"stylelint-config-standard": "^18.3.0",
|
||||
"uglify-js": "^3.6.0",
|
||||
"webpack": "^4.35.3",
|
||||
"webpack-cli": "^3.3.5",
|
||||
"webpack-sources": "^1.3.0"
|
||||
"sass-loader": "^8.0.2",
|
||||
"style-loader": "^1.1.3",
|
||||
"stylelint": "^13.0.0",
|
||||
"stylelint-config-standard": "^19.0.0",
|
||||
"webpack": "^4.41.5",
|
||||
"webpack-cli": "^3.3.10"
|
||||
},
|
||||
"scripts": {
|
||||
"compress": "scripts/compress",
|
||||
"copy-dist": "cp ./node_modules/alertify.js/dist/css/alertify.css ./public/assets/frontend/ && cp ./node_modules/normalize.css/normalize.css ./public/assets/frontend/ && cp ./node_modules/a11y.css/css/*.css ./public/assets/frontend/a11y.css/",
|
||||
"lint:es6": "eslint resources/es6/*.js",
|
||||
"copy-dist": "cp ./node_modules/normalize.css/normalize.css ./public/assets/frontend/",
|
||||
"lint:es6": "eslint resources/es/*.js",
|
||||
"lint:sass": "stylelint --syntax=scss resources/sass/**/*.scss",
|
||||
"make": "npm run make:css && npm run make:js",
|
||||
"make:css": "npm run lint:sass && npm run sass && npm run postcss",
|
||||
"make:js": "npm run lint:es6 && npm run webpack && npm run uglifyjs",
|
||||
"postcss": "postcss public/assets/css/app.css --use autoprefixer --autoprefixer.browsers \"> 5%\" --replace --map",
|
||||
"sass": "sassc --style compressed --sourcemap resources/sass/app.scss public/assets/css/app.css",
|
||||
"uglifyjs": "scripts/uglifyjs",
|
||||
"webpack": "webpack --progress --colors"
|
||||
"webpack": "webpack"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -61,12 +39,10 @@
|
|||
},
|
||||
"lint-staged": {
|
||||
"./resources/es6/*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
"eslint"
|
||||
],
|
||||
"*.scss": [
|
||||
"stylelint --syntax=scss --fix",
|
||||
"git add"
|
||||
"stylelint --syntax=scss"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
<ruleset name="jonnybarnes.uk">
|
||||
<description>Custom configuration for code running jonnybarnes.uk</description>
|
||||
<file>./app/</file>
|
||||
<rule ref="PSR2">
|
||||
<exclude name="PSR2.Namespaces.UseDeclaration" />
|
||||
</rule>
|
||||
<rule ref="PSR12" />
|
||||
</ruleset>
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
|
||||
stopOnFailure="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
|
|
78
public/assets/app.css
vendored
Normal file
78
public/assets/app.css
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
:root {
|
||||
--font-stack-body: montserrat, sans-serif;
|
||||
--font-stack-headings: bebas-neue, sans-serif; }
|
||||
|
||||
body {
|
||||
font-family: var(--font-stack-body);
|
||||
font-size: 2rem; }
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: var(--font-stack-headings); }
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column; }
|
||||
|
||||
#top-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center; }
|
||||
#top-header h1 {
|
||||
display: flex;
|
||||
justify-content: center; }
|
||||
#top-header nav {
|
||||
display: flex;
|
||||
justify-content: center; }
|
||||
#top-header nav a {
|
||||
margin: 0 0.5rem; }
|
||||
|
||||
.h-feed {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto; }
|
||||
@media screen and (min-width: 700px) {
|
||||
.h-feed {
|
||||
max-width: 700px; }
|
||||
.h-feed > .note,
|
||||
.h-feed > .h-entry {
|
||||
padding: 0 1rem; } }
|
||||
|
||||
.note {
|
||||
display: flex;
|
||||
flex-direction: column; }
|
||||
.note .note-metadata {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between; }
|
||||
.note .note-metadata .syndication-links svg {
|
||||
height: 1em;
|
||||
width: 1em; }
|
||||
.note > .e-content > .naked-link .u-photo {
|
||||
margin: 2rem 0; }
|
||||
|
||||
.personal-bio {
|
||||
padding: 0 2rem; }
|
||||
|
||||
footer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 1.5rem; }
|
||||
|
||||
.post-info a {
|
||||
text-decoration: none; }
|
||||
|
||||
.syndication-links .u-syndication {
|
||||
text-decoration: none; }
|
||||
|
||||
.p-bridgy-facebook-content,
|
||||
.p-bridgy-twitter-content {
|
||||
display: none; }
|
||||
|
||||
|
||||
/*# sourceMappingURL=app.css.map*/
|
1
public/assets/app.css.map
Normal file
1
public/assets/app.css.map
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["webpack:///./resources/sass/_variables.scss","webpack:///./resources/sass/_base.scss","webpack:///./resources/sass/_layout-main.scss","webpack:///./resources/sass/_link-styles.scss","webpack:///./resources/sass/_posse.scss"],"names":[],"mappings":"AAAA;EACI,yCAAkB;EAClB,6CAAsB;;ACF1B;EACI,mCAAmC;EACnC,eAAe;;AAGnB;;;;;;EAMI,uCAAuC;;ACX3C;EACI,aAAa;EACb,sBAAsB;;AAG1B;EACI,aAAa;EACb,sBAAsB;EACtB,uBAAuB;EAH3B;IAMQ,aAAa;IACb,uBAAuB;EAP/B;IAWQ,aAAa;IACb,uBAAuB;IAZ/B;MAeY,gBAAgB;;AAK5B;EACI,aAAa;EACb,sBAAsB;EACtB,YAAY;EAEZ;IALJ;MAMQ,gBAAgB;MANxB;;QAUY,eAAe,IAClB;;AAIT;EACI,aAAa;EACb,sBAAsB;EAF1B;IAKQ,aAAa;IACb,mBAAmB;IACnB,8BAA8B;IAPtC;MAWgB,WAAW;MACX,UAAU;EAZ1B;IAoBgB,cAAc;;AAM9B;EACI,eAAe;;AAGnB;EACI,aAAa;EACb,sBAAsB;EACtB,mBAAmB;EACnB,kBAAkB;;AC1EtB;EAEQ,qBAAqB;;AAI7B;EAEQ,qBAAqB;;ACR7B;;EAEI,aAAa","file":"app.css","sourcesContent":[":root {\n --font-stack-body: montserrat, sans-serif;\n --font-stack-headings: bebas-neue, sans-serif;\n}\n","body {\n font-family: var(--font-stack-body);\n font-size: 2rem;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-family: var(--font-stack-headings);\n}\n","body {\n display: flex;\n flex-direction: column;\n}\n\n#top-header {\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n h1 {\n display: flex;\n justify-content: center;\n }\n\n nav {\n display: flex;\n justify-content: center;\n\n a {\n margin: 0 0.5rem;\n }\n }\n}\n\n.h-feed {\n display: flex;\n flex-direction: column;\n margin: auto;\n\n @media screen and (min-width: 700px) {\n max-width: 700px;\n\n > .note,\n > .h-entry {\n padding: 0 1rem;\n }\n }\n}\n\n.note {\n display: flex;\n flex-direction: column;\n\n .note-metadata {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n\n .syndication-links {\n svg {\n height: 1em;\n width: 1em;\n }\n }\n }\n\n > .e-content {\n > .naked-link {\n .u-photo {\n margin: 2rem 0;\n }\n }\n }\n}\n\n.personal-bio {\n padding: 0 2rem;\n}\n\nfooter {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin-top: 1.5rem;\n}\n",".post-info {\n a {\n text-decoration: none;\n }\n}\n\n.syndication-links {\n .u-syndication {\n text-decoration: none;\n }\n}\n",".p-bridgy-facebook-content,\n.p-bridgy-twitter-content {\n display: none;\n}\n"],"sourceRoot":""}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue