Upgrade to Laravel 8
This commit is contained in:
parent
1ad58f10c5
commit
57186c3e2e
27 changed files with 945 additions and 1003 deletions
|
@ -37,16 +37,6 @@ class ShortURLsController extends Controller
|
|||
return redirect('https://twitter.com/jonnybarnes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect from '/+' to a Google+ profile.
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function googlePlus(): RedirectResponse
|
||||
{
|
||||
return redirect('https://plus.google.com/u/0/117317270900655269082/about');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect a short url of this site out to a long one based on post type.
|
||||
* Further redirects may happen.
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace App\Models;
|
|||
use App\Traits\FilterHtml;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
@ -37,6 +38,7 @@ use Mf2;
|
|||
class Like extends Model
|
||||
{
|
||||
use FilterHtml;
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['url'];
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace App\Models;
|
|||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
@ -33,6 +34,8 @@ use Illuminate\Support\Carbon;
|
|||
*/
|
||||
class MicropubClient extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
|
|
|
@ -10,7 +10,7 @@ use Eloquent;
|
|||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Database\Eloquent\Relations\{BelongsTo, BelongsToMany, HasMany, MorphMany};
|
||||
use Illuminate\Database\Eloquent\{Builder, Collection, Model, SoftDeletes};
|
||||
use Illuminate\Database\Eloquent\{Builder, Collection, Factories\HasFactory, Model, SoftDeletes};
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
|
@ -88,6 +88,7 @@ use Spatie\CommonMarkHighlighter\{FencedCodeRenderer, IndentedCodeRenderer};
|
|||
*/
|
||||
class Note extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Searchable;
|
||||
use SoftDeletes;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace App\Models;
|
|||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\{Builder, Collection, Model};
|
||||
use Illuminate\Database\Eloquent\{Builder, Collection, Factories\HasFactory, Model};
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
|
@ -51,6 +51,7 @@ use Illuminate\Support\Str;
|
|||
*/
|
||||
class Place extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Sluggable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
|
@ -12,9 +15,9 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
// protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
|
@ -23,51 +26,29 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
$this->configureRateLimiting();
|
||||
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
$this->routes(function () {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "jonnybarnes/jonnybarnes.uk",
|
||||
"type": "project",
|
||||
"description": "The code for jonnybarnes.uk, based on Laravel 5.8",
|
||||
"description": "The code for jonnybarnes.uk, based on Laravel 8",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel",
|
||||
|
@ -13,18 +13,18 @@
|
|||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-dom": "*",
|
||||
"cviebrock/eloquent-sluggable": "~7.0",
|
||||
"cviebrock/eloquent-sluggable": "^8.0",
|
||||
"fideloper/proxy": "~4.0",
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"indieauth/client": "~0.1",
|
||||
"intervention/image": "^2.4",
|
||||
"jonnybarnes/indieweb": "~0.2",
|
||||
"jonnybarnes/webmentions-parser": "~0.5",
|
||||
"jublonet/codebird-php": "4.0.0-beta.1",
|
||||
"laravel/framework": "^7.0",
|
||||
"laravel/horizon": "^4.0",
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/horizon": "^5.0",
|
||||
"laravel/scout": "^8.0",
|
||||
"laravel/telescope": "^3.0",
|
||||
"laravel/telescope": "^4.0",
|
||||
"laravel/tinker": "^2.0",
|
||||
"lcobucci/jwt": "^3.1",
|
||||
"league/commonmark": "^1.0",
|
||||
|
@ -32,7 +32,6 @@
|
|||
"mf2/mf2": "~0.3",
|
||||
"pmatseykanets/laravel-scout-postgres": "^7.0",
|
||||
"predis/predis": "~1.0",
|
||||
"ramsey/uuid": "^3.5",
|
||||
"sensiolabs/security-checker": "^6.0",
|
||||
"spatie/browsershot": "~3.0",
|
||||
"spatie/commonmark-highlighter": "^2.0",
|
||||
|
@ -42,11 +41,11 @@
|
|||
"barryvdh/laravel-debugbar": "^3.0",
|
||||
"barryvdh/laravel-ide-helper": "^2.6",
|
||||
"beyondcode/laravel-dump-server": "^1.0",
|
||||
"facade/ignition": "^2.0",
|
||||
"facade/ignition": "^2.3.6",
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
"laravel/dusk": "^6.0",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^4.1",
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"vimeo/psalm": "^3.9"
|
||||
},
|
||||
|
@ -62,12 +61,10 @@
|
|||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
},
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories"
|
||||
],
|
||||
"files": [
|
||||
"helpers.php"
|
||||
]
|
||||
|
|
1286
composer.lock
generated
1286
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,12 +1,35 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Bookmark;
|
||||
use Faker\Generator as Faker;
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Bookmark;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class BookmarkFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Bookmark::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
|
||||
$factory->define(Bookmark::class, function (Faker $faker) {
|
||||
return [
|
||||
'url' => $faker->url,
|
||||
'name' => $faker->sentence,
|
||||
'content' => $faker->text,
|
||||
'url' => $this->faker->url,
|
||||
'name' => $this->faker->sentence,
|
||||
'content' => $this->faker->text,
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,36 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Like;
|
||||
use Faker\Generator as Faker;
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Like;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LikeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Like::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
|
||||
$factory->define(Like::class, function (Faker $faker) {
|
||||
return [
|
||||
'url' => $faker->url,
|
||||
'author_name' => $faker->name,
|
||||
'author_url' => $faker->url,
|
||||
'content' => '<html><body><div class="h-entry"><div class="e-content">' . $faker->realtext() . '</div></div></body></html>',
|
||||
'url' => $this->faker->url,
|
||||
'author_name' => $this->faker->name,
|
||||
'author_url' => $this->faker->url,
|
||||
'content' => '<html><body><div class="h-entry"><div class="e-content">' . $this->faker->realtext() . '</div></div></body></html>',
|
||||
'created_at' => $now->toDateTimeString(),
|
||||
'updated_at' => $now->toDateTimeString(),
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
29
database/factories/MicropubClientFactory.php
Normal file
29
database/factories/MicropubClientFactory.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\MicropubClient;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class MicropubClientFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = MicropubClient::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'client_url' => $this->faker->url,
|
||||
'client_name' => $this->faker->company,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,14 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Note;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
$factory->define(Note::class, function (Faker $faker) {
|
||||
class NoteFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Note::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
$now = Carbon::now()->subDays(rand(5, 15));
|
||||
|
||||
return [
|
||||
'note' => $faker->paragraph,
|
||||
'note' => $this->faker->paragraph,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
32
database/factories/PlaceFactory.php
Normal file
32
database/factories/PlaceFactory.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Place;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class PlaceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Place::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company,
|
||||
'description' => $this->faker->sentence,
|
||||
'latitude' => $this->faker->latitude,
|
||||
'longitude' => $this->faker->longitude,
|
||||
'external_urls' => $this->faker->url,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,10 +1,28 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Tag;
|
||||
use Faker\Generator as Faker;
|
||||
namespace Database\Factories;
|
||||
|
||||
$factory->define(Tag::class, function (Faker $faker) {
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TagFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Tag::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'tag' => $faker->word,
|
||||
'tag' => $this->faker->word,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$factory->define(App\Models\User::class, function (Faker $faker) {
|
||||
static $password;
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => mb_strtolower($faker->firstName),
|
||||
'password' => $password ?: $password = bcrypt('secret'),
|
||||
'name' => $this->faker->name,
|
||||
'password' => bcrypt('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Article;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\{Bookmark, Tag};
|
||||
use Illuminate\Database\Seeder;
|
||||
|
@ -14,6 +16,7 @@ class BookmarksTableSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
Bookmark::factory(10)->create();
|
||||
factory(Bookmark::class, 10)->create()->each(function ($bookmark) {
|
||||
$bookmark->tags()->save(factory(Tag::class)->make());
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\MicropubClient;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ClientsTableSeeder extends Seeder
|
||||
{
|
||||
|
@ -25,5 +29,7 @@ class ClientsTableSeeder extends Seeder
|
|||
'created_at' => Carbon::now()->toDateTimeString(),
|
||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||
]);
|
||||
|
||||
MicropubClient::factory(5)->create();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Contact;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\FileSystem\FileSystem;
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Like;
|
||||
use Faker\Generator;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
@ -15,15 +17,7 @@ class LikesTableSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
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(),
|
||||
]);
|
||||
});
|
||||
Like::factory(10)->create();
|
||||
|
||||
$now = Carbon::now()->subDays(rand(3, 6));
|
||||
$faker = new Generator();
|
|
@ -1,9 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\{Media, Note, Place};
|
||||
use SplFileInfo;
|
||||
|
||||
class NotesTableSeeder extends Seeder
|
||||
{
|
||||
|
@ -205,5 +208,7 @@ EOF;
|
|||
DB::table('notes')
|
||||
->where('id', $noteWithLongUrl->id)
|
||||
->update(['updated_at' => $now->toDateTimeString()]);
|
||||
|
||||
Note::factory(10)->create();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Place;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
@ -20,5 +22,7 @@ class PlacesTableSeeder extends Seeder
|
|||
$place->external_urls = 'https://foursquare.com/v/123435/the-bridgewater-pub';
|
||||
$place->external_urls = 'https://www.openstreetmap.org/way/987654';
|
||||
$place->save();
|
||||
|
||||
Place::factory(10)->create();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\WebMention;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
@ -12,7 +14,8 @@ class WebMentionsTableSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
$webmentionAaron = WebMention::create([
|
||||
// WebMention Aaron
|
||||
WebMention::create([
|
||||
'source' => 'https://aaronpk.localhost/reply/1',
|
||||
'target' => config('app.url') . '/notes/E',
|
||||
'commentable_id' => '14',
|
||||
|
@ -20,7 +23,8 @@ class WebMentionsTableSeeder extends Seeder
|
|||
'type' => 'in-reply-to',
|
||||
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"url": ["https://aaronpk.localhost/reply/1"], "name": ["Hi too"], "author": [{"type": ["h-card"], "value": "Aaron Parecki", "properties": {"url": ["https://aaronpk.localhost"], "name": ["Aaron Parecki"], "photo": ["https://aaronparecki.com/images/profile.jpg"]}}], "content": [{"html": "Hi too", "value": "Hi too"}], "published": ["' . date(DATE_W3C) . '"], "in-reply-to": ["https://aaronpk.loclahost/reply/1", "' . config('app.url') .'/notes/E"]}}]}'
|
||||
]);
|
||||
$webmentionTantek = WebMention::create([
|
||||
// WebMention Tantek
|
||||
WebMention::create([
|
||||
'source' => 'http://tantek.com/',
|
||||
'target' => config('app.url') . '/notes/D',
|
||||
'commentable_id' => '13',
|
|
@ -1,23 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Laravel - A PHP Framework For Web Artisans
|
||||
*
|
||||
* @package Laravel
|
||||
* @author Taylor Otwell <taylor@laravel.com>
|
||||
*/
|
||||
use Illuminate\Contracts\Http\Kernel;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Check If Application Is Under Maintenance
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If the application is maintenance / demo mode via the "down" command we
|
||||
| will require this file so that any prerendered template can be shown
|
||||
| instead of starting the framework, which could cause an exception.
|
||||
|
|
||||
*/
|
||||
|
||||
if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) {
|
||||
require __DIR__ . '/../storage/framework/maintenance.php';
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader for
|
||||
| our application. We just need to utilize it! We'll simply require it
|
||||
| into the script here so that we don't have to worry about manual
|
||||
| loading any of our classes later on. It feels great to relax.
|
||||
| this application. We just need to utilize it! We'll simply require it
|
||||
| into the script here so we don't need to manually load our classes.
|
||||
|
|
||||
*/
|
||||
|
||||
|
@ -25,36 +35,21 @@ require __DIR__.'/../vendor/autoload.php';
|
|||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Turn On The Lights
|
||||
| Run The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| We need to illuminate PHP development, so let us turn on the lights.
|
||||
| This bootstraps the framework and gets it ready for use, then it
|
||||
| will load up this application so that we can run it and send
|
||||
| the responses back to the browser and delight our users.
|
||||
| Once we have the application, we can handle the incoming request using
|
||||
| the application's HTTP kernel. Then, we will send the response back
|
||||
| to this client's browser, allowing them to enjoy our application.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once we have the application, we can handle the incoming request
|
||||
| through the kernel, and send the associated response back to
|
||||
| the client's browser allowing them to enjoy the creative
|
||||
| and wonderful application we have prepared for them.
|
||||
|
|
||||
*/
|
||||
$kernel = $app->make(Kernel::class);
|
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
|
||||
|
||||
$response = $kernel->handle(
|
||||
$request = Illuminate\Http\Request::capture()
|
||||
);
|
||||
|
||||
$response->send();
|
||||
$response = tap($kernel->handle(
|
||||
$request = Request::capture()
|
||||
))->send();
|
||||
|
||||
$kernel->terminate($request, $response);
|
||||
|
|
189
routes/web.php
189
routes/web.php
|
@ -11,10 +11,32 @@
|
|||
|
|
||||
*/
|
||||
|
||||
use App\Http\Controllers\Admin\ArticlesController as AdminArticlesController;
|
||||
use App\Http\Controllers\Admin\ClientsController;
|
||||
use App\Http\Controllers\Admin\ContactsController as AdminContactsController;
|
||||
use App\Http\Controllers\Admin\HomeController;
|
||||
use App\Http\Controllers\Admin\LikesController as AdminLikesController;
|
||||
use App\Http\Controllers\Admin\NotesController as AdminNotesController;
|
||||
use App\Http\Controllers\Admin\PlacesController as AdminPlacesController;
|
||||
use App\Http\Controllers\ArticlesController;
|
||||
use App\Http\Controllers\AuthController;
|
||||
use App\Http\Controllers\BookmarksController;
|
||||
use App\Http\Controllers\ContactsController;
|
||||
use App\Http\Controllers\FeedsController;
|
||||
use App\Http\Controllers\FrontPageController;
|
||||
use App\Http\Controllers\LikesController;
|
||||
use App\Http\Controllers\MicropubController;
|
||||
use App\Http\Controllers\MicropubMediaController;
|
||||
use App\Http\Controllers\NotesController;
|
||||
use App\Http\Controllers\PlacesController;
|
||||
use App\Http\Controllers\SearchController;
|
||||
use App\Http\Controllers\ShortURLsController;
|
||||
use App\Http\Controllers\TokenEndpointController;
|
||||
use App\Http\Controllers\WebMentionsController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['domain' => config('url.longurl')], function () {
|
||||
Route::get('/', 'FrontPageController@index');
|
||||
Route::get('/', [FrontPageController::class, 'index']);
|
||||
|
||||
// Static project page
|
||||
Route::view('projects', 'projects');
|
||||
|
@ -23,12 +45,12 @@ Route::group(['domain' => config('url.longurl')], function () {
|
|||
Route::view('colophon', 'colophon');
|
||||
|
||||
// The login routes to get auth’d for admin
|
||||
Route::get('login', 'AuthController@showLogin')->name('login');
|
||||
Route::post('login', 'AuthController@login');
|
||||
Route::get('login', [AuthController::class, 'showLogin'])->name('login');
|
||||
Route::post('login', [AuthController::class, 'login']);
|
||||
|
||||
// And the logout routes
|
||||
Route::get('logout', 'AuthController@showLogout')->name('logout');
|
||||
Route::post('logout', 'AuthController@logout');
|
||||
Route::get('logout', [AuthController::class, 'showLogout'])->name('logout');
|
||||
Route::post('logout', [AuthController::class, 'logout']);
|
||||
|
||||
// Admin pages grouped for filter
|
||||
Route::group([
|
||||
|
@ -36,149 +58,146 @@ Route::group(['domain' => config('url.longurl')], function () {
|
|||
'namespace' => 'Admin',
|
||||
'prefix' => 'admin',
|
||||
], function () {
|
||||
Route::get('/', 'HomeController@welcome');
|
||||
Route::get('/', [HomeController::class, 'welcome']);
|
||||
|
||||
//Articles
|
||||
Route::group(['prefix' => 'blog'], function () {
|
||||
Route::get('/', 'ArticlesController@index');
|
||||
Route::get('/create', 'ArticlesController@create');
|
||||
Route::post('/', 'ArticlesController@store');
|
||||
Route::get('/{id}/edit', 'ArticlesController@edit');
|
||||
Route::put('/{id}', 'ArticlesController@update');
|
||||
Route::delete('/{id}', 'ArticlesController@destroy');
|
||||
Route::get('/', [AdminArticlesController::class, 'index']);
|
||||
Route::get('/create', [AdminArticlesController::class, 'create']);
|
||||
Route::post('/', [AdminArticlesController::class, 'store']);
|
||||
Route::get('/{id}/edit', [AdminArticlesController::class, 'edit']);
|
||||
Route::put('/{id}', [AdminArticlesController::class, 'update']);
|
||||
Route::delete('/{id}', [AdminArticlesController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// Notes
|
||||
Route::group(['prefix' => 'notes'], function () {
|
||||
Route::get('/', 'NotesController@index');
|
||||
Route::get('/create', 'NotesController@create');
|
||||
Route::post('/', 'NotesController@store');
|
||||
Route::get('/{id}/edit', 'NotesController@edit');
|
||||
Route::put('/{id}', 'NotesController@update');
|
||||
Route::delete('/{id}', 'NotesController@destroy');
|
||||
Route::get('/', [AdminNotesController::class, 'index']);
|
||||
Route::get('/create', [AdminNotesController::class, 'create']);
|
||||
Route::post('/', [AdminNotesController::class, 'store']);
|
||||
Route::get('/{id}/edit', [AdminNotesController::class, 'edit']);
|
||||
Route::put('/{id}', [AdminNotesController::class, 'update']);
|
||||
Route::delete('/{id}', [AdminNotesController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// Micropub Clients
|
||||
Route::group(['prefix' => 'clients'], function () {
|
||||
Route::get('/', 'ClientsController@index');
|
||||
Route::get('/create', 'ClientsController@create');
|
||||
Route::post('/', 'ClientsController@store');
|
||||
Route::get('/{id}/edit', 'ClientsController@edit');
|
||||
Route::put('/{id}', 'ClientsController@update');
|
||||
Route::delete('/{id}', 'ClientsController@destroy');
|
||||
Route::get('/', [ClientsController::class, 'index']);
|
||||
Route::get('/create', [ClientsController::class, 'create']);
|
||||
Route::post('/', [ClientsController::class, 'store']);
|
||||
Route::get('/{id}/edit', [ClientsController::class, 'edit']);
|
||||
Route::put('/{id}', [ClientsController::class, 'update']);
|
||||
Route::delete('/{id}', [ClientsController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// Contacts
|
||||
Route::group(['prefix' => 'contacts'], function () {
|
||||
Route::get('/', 'ContactsController@index');
|
||||
Route::get('/create', 'ContactsController@create');
|
||||
Route::post('/', 'ContactsController@store');
|
||||
Route::get('/{id}/edit', 'ContactsController@edit');
|
||||
Route::put('/{id}', 'ContactsController@update');
|
||||
Route::delete('/{id}', 'ContactsController@destroy');
|
||||
Route::get('/{id}/getavatar', 'ContactsController@getAvatar');
|
||||
Route::get('/', [AdminContactsController::class, 'index']);
|
||||
Route::get('/create', [AdminContactsController::class, 'create']);
|
||||
Route::post('/', [AdminContactsController::class, 'store']);
|
||||
Route::get('/{id}/edit', [AdminContactsController::class, 'edit']);
|
||||
Route::put('/{id}', [AdminContactsController::class, 'update']);
|
||||
Route::delete('/{id}', [AdminContactsController::class, 'destroy']);
|
||||
Route::get('/{id}/getavatar', [AdminContactsController::class, 'getAvatar']);
|
||||
});
|
||||
|
||||
// Places
|
||||
Route::group(['prefix' => 'places'], function () {
|
||||
Route::get('/', 'PlacesController@index');
|
||||
Route::get('/create', 'PlacesController@create');
|
||||
Route::post('/', 'PlacesController@store');
|
||||
Route::get('/{id}/edit', 'PlacesController@edit');
|
||||
Route::put('/{id}', 'PlacesController@update');
|
||||
Route::get('/{id}/merge', 'PlacesController@mergeIndex');
|
||||
Route::get('/{place1_id}/merge/{place2_id}', 'PlacesController@mergeEdit');
|
||||
Route::post('/merge', 'PlacesController@mergeStore');
|
||||
Route::delete('/{id}', 'PlacesController@destroy');
|
||||
Route::get('/', [AdminPlacesController::class, 'index']);
|
||||
Route::get('/create', [AdminPlacesController::class, 'create']);
|
||||
Route::post('/', [AdminPlacesController::class, 'store']);
|
||||
Route::get('/{id}/edit', [AdminPlacesController::class, 'edit']);
|
||||
Route::put('/{id}', [AdminPlacesController::class, 'update']);
|
||||
Route::get('/{id}/merge', [AdminPlacesController::class, 'mergeIndex']);
|
||||
Route::get('/{place1_id}/merge/{place2_id}', [AdminPlacesController::class, 'mergeEdit']);
|
||||
Route::post('/merge', [AdminPlacesController::class, 'mergeStore']);
|
||||
Route::delete('/{id}', [AdminPlacesController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// Likes
|
||||
Route::group(['prefix' => 'likes'], function () {
|
||||
Route::get('/', 'LikesController@index');
|
||||
Route::get('/create', 'LikesController@create');
|
||||
Route::post('/', 'LikesController@store');
|
||||
Route::get('/{id}/edit', 'LikesController@edit');
|
||||
Route::put('/{id}', 'LikesController@update');
|
||||
Route::delete('/{id}', 'LikesController@destroy');
|
||||
Route::get('/', [AdminLikesController::class, 'index']);
|
||||
Route::get('/create', [AdminLikesController::class, 'create']);
|
||||
Route::post('/', [AdminLikesController::class, 'store']);
|
||||
Route::get('/{id}/edit', [AdminLikesController::class, 'edit']);
|
||||
Route::put('/{id}', [AdminLikesController::class, 'update']);
|
||||
Route::delete('/{id}', [AdminLikesController::class, 'destroy']);
|
||||
});
|
||||
});
|
||||
|
||||
// Blog pages using ArticlesController
|
||||
Route::group(['prefix' => 'blog'], function () {
|
||||
Route::get('/feed.rss', 'FeedsController@blogRss');
|
||||
Route::get('/feed.atom', 'FeedsController@blogAtom');
|
||||
Route::get('/feed.json', 'FeedsController@blogJson');
|
||||
Route::get('/feed.jf2', 'Feedscontroller@blogJf2');
|
||||
Route::get('/s/{id}', 'ArticlesController@onlyIdInURL');
|
||||
Route::get('/{year?}/{month?}', 'ArticlesController@index');
|
||||
Route::get('/{year}/{month}/{slug}', 'ArticlesController@show');
|
||||
Route::get('/feed.rss', [FeedsController::class, 'blogRss']);
|
||||
Route::get('/feed.atom', [FeedsController::class, 'blogAtom']);
|
||||
Route::get('/feed.json', [FeedsController::class, 'blogJson']);
|
||||
Route::get('/feed.jf2', [Feedscontroller::class, 'blogJf2']);
|
||||
Route::get('/s/{id}', [ArticlesController::class, 'onlyIdInURL']);
|
||||
Route::get('/{year?}/{month?}', [ArticlesController::class, 'index']);
|
||||
Route::get('/{year}/{month}/{slug}', [ArticlesController::class, 'show']);
|
||||
});
|
||||
|
||||
// Notes pages using NotesController
|
||||
Route::group(['prefix' => 'notes'], function () {
|
||||
Route::get('/', 'NotesController@index');
|
||||
Route::get('/feed.rss', 'FeedsController@notesRss');
|
||||
Route::get('/feed.atom', 'FeedsController@notesAtom');
|
||||
Route::get('/feed.json', 'FeedsController@notesJson');
|
||||
Route::get('/feed.jf2', 'FeedsController@notesJf2');
|
||||
Route::get('/{id}', 'NotesController@show');
|
||||
Route::get('/tagged/{tag}', 'NotesController@tagged');
|
||||
Route::get('/', [NotesController::class, 'index']);
|
||||
Route::get('/feed.rss', [FeedsController::class, 'notesRss']);
|
||||
Route::get('/feed.atom', [FeedsController::class, 'notesAtom']);
|
||||
Route::get('/feed.json', [FeedsController::class, 'notesJson']);
|
||||
Route::get('/feed.jf2', [FeedsController::class, 'notesJf2']);
|
||||
Route::get('/{id}', [NotesController::class, 'show']);
|
||||
Route::get('/tagged/{tag}', [NotesController::class, 'tagged']);
|
||||
});
|
||||
Route::get('note/{id}', 'NotesController@redirect'); // for legacy note URLs
|
||||
Route::get('note/{id}', [NotesController::class, 'redirect']); // for legacy note URLs
|
||||
|
||||
// Likes
|
||||
Route::group(['prefix' => 'likes'], function () {
|
||||
Route::get('/', 'LikesController@index');
|
||||
Route::get('/{like}', 'LikesController@show');
|
||||
Route::get('/', [LikesController::class, 'index']);
|
||||
Route::get('/{like}', [LikesController::class, 'show']);
|
||||
});
|
||||
|
||||
// Bookmarks
|
||||
Route::group(['prefix' => 'bookmarks'], function () {
|
||||
Route::get('/', 'BookmarksController@index');
|
||||
Route::get('/{bookmark}', 'BookmarksController@show');
|
||||
Route::get('/', [BookmarksController::class, 'index']);
|
||||
Route::get('/{bookmark}', [BookmarksController::class, 'show']);
|
||||
});
|
||||
|
||||
// Token Endpoint
|
||||
Route::post('api/token', 'TokenEndpointController@create');
|
||||
Route::post('api/token', [TokenEndpointController::class, 'create']);
|
||||
|
||||
// Micropub Endpoints
|
||||
Route::get('api/post', 'MicropubController@get')->middleware('micropub.token');
|
||||
Route::post('api/post', 'MicropubController@post')->middleware('micropub.token');
|
||||
Route::get('api/media', 'MicropubMediaController@getHandler')->middleware('micropub.token');
|
||||
Route::post('api/media', 'MicropubMediaController@media')
|
||||
Route::get('api/post', [MicropubController::class, 'get'])->middleware('micropub.token');
|
||||
Route::post('api/post', [MicropubController::class, 'post'])->middleware('micropub.token');
|
||||
Route::get('api/media', [MicropubMediaController::class, 'getHandler'])->middleware('micropub.token');
|
||||
Route::post('api/media', [MicropubMediaController:: class, 'media'])
|
||||
->middleware('micropub.token', 'cors')
|
||||
->name('media-endpoint');
|
||||
Route::options('/api/media', 'MicropubMediaController@mediaOptionsResponse')->middleware('cors');
|
||||
Route::options('/api/media', [MicropubMediaController::class, 'mediaOptionsResponse'])->middleware('cors');
|
||||
|
||||
// Webmention
|
||||
Route::get('webmention', 'WebMentionsController@get');
|
||||
Route::post('webmention', 'WebMentionsController@receive');
|
||||
Route::get('webmention', [WebMentionsController::class, 'get']);
|
||||
Route::post('webmention', [WebMentionsController::class, 'receive']);
|
||||
|
||||
// Contacts
|
||||
Route::get('contacts', 'ContactsController@index');
|
||||
Route::get('contacts/{contact:nick}', 'ContactsController@show');
|
||||
Route::get('contacts', [ContactsController::class, 'index']);
|
||||
Route::get('contacts/{contact:nick}', [ContactsController::class, 'show']);
|
||||
|
||||
// Places
|
||||
Route::get('places', 'PlacesController@index');
|
||||
Route::get('places/{place}', 'PlacesController@show');
|
||||
Route::get('places', [PlacesController::class, 'index']);
|
||||
Route::get('places/{place}', [PlacesController::class, 'show']);
|
||||
|
||||
Route::get('search', 'SearchController@search');
|
||||
|
||||
Route::post('update-colour-scheme', 'SessionStoreController@saveColour');
|
||||
Route::get('search', [SearchController::class, 'search']);
|
||||
});
|
||||
|
||||
// Short URL
|
||||
Route::group(['domain' => config('url.shorturl')], function () {
|
||||
Route::get('/', 'ShortURLsController@baseURL');
|
||||
Route::get('@', 'ShortURLsController@twitter');
|
||||
Route::get('+', 'ShortURLsController@googlePlus');
|
||||
Route::get('/', [ShortURLsController::class, 'baseURL']);
|
||||
Route::get('@', [ShortURLsController::class, 'twitter']);
|
||||
|
||||
Route::get('{type}/{id}', 'ShortURLsController@expandType')->where(
|
||||
Route::get('{type}/{id}', [ShortURLsController::class, 'expandType'])->where(
|
||||
[
|
||||
'type' => '[bt]',
|
||||
'id' => '[0-9A-HJ-NP-Z_a-km-z]+',
|
||||
]
|
||||
);
|
||||
|
||||
Route::get('h/{id}', 'ShortURLsController@redirect');
|
||||
Route::get('h/{id}', [ShortURLsController::class, 'redirect']);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue