commit
1bba326711
448 changed files with 10368 additions and 16505 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
|
||||
{
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue