chore: Refactor configuration files based on Laravel 10 skeleton
This commit is contained in:
parent
3f78d5118a
commit
bebbfec510
35 changed files with 205 additions and 284 deletions
|
@ -1,9 +1,5 @@
|
|||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
|
@ -12,11 +8,6 @@ indent_style = space
|
|||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Tab indentation
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
tab_width = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
|
|
14
.gitattributes
vendored
14
.gitattributes
vendored
|
@ -1,5 +1,11 @@
|
|||
* text=auto
|
||||
*.css linguist-vendored
|
||||
*.scss linguist-vendored
|
||||
*.js linguist-vendored
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
|
23
.gitignore
vendored
23
.gitignore
vendored
|
@ -1,22 +1,23 @@
|
|||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/coverage
|
||||
/public/hot
|
||||
/public/files
|
||||
/public/fonts
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/lsp
|
||||
.phpstorm.meta.php
|
||||
_ide_helper.php
|
||||
/.vscode
|
||||
ray.php
|
||||
# Custom paths in /public
|
||||
/public/coverage
|
||||
/public/hot
|
||||
/public/storage
|
||||
/public/fonts
|
||||
/public/files
|
||||
/public/keybase.txt
|
||||
/public/assets/*.map
|
||||
|
|
11
.styleci.yml
11
.styleci.yml
|
@ -1,8 +1,9 @@
|
|||
php:
|
||||
preset: laravel
|
||||
|
||||
disabled:
|
||||
- concat_without_spaces
|
||||
- single_import_per_statement
|
||||
|
||||
- no_unused_imports
|
||||
finder:
|
||||
path: app/
|
||||
not-name:
|
||||
- index.php
|
||||
js: true
|
||||
css: true
|
||||
|
|
|
@ -7,20 +7,8 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $commands = [
|
||||
Commands\ParseCachedWebMentions::class,
|
||||
Commands\ReDownloadWebMentions::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
|
|
|
@ -3,13 +3,10 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
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;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class FeedsController extends Controller
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.displayname'),
|
||||
'url' => config('app.longurl'),
|
||||
'url' => config('url.longurl'),
|
||||
],
|
||||
'children' => $items,
|
||||
], 200, [
|
||||
|
@ -188,7 +188,7 @@ class FeedsController extends Controller
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.displayname'),
|
||||
'url' => config('app.longurl'),
|
||||
'url' => config('url.longurl'),
|
||||
],
|
||||
'children' => $items,
|
||||
], 200, [
|
||||
|
|
|
@ -45,7 +45,7 @@ class TokenEndpointController extends Controller
|
|||
public function create(Request $request): JsonResponse
|
||||
{
|
||||
$auth = $this->verifyIndieAuthCode(
|
||||
config('app.authorization_endpoint'),
|
||||
config('url.authorization_endpoint'),
|
||||
$request->input('code'),
|
||||
$request->input('redirect_uri'),
|
||||
$request->input('client_id'),
|
||||
|
|
|
@ -33,13 +33,11 @@ class Kernel extends HttpKernel
|
|||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\LinkHeadersMiddleware::class,
|
||||
\App\Http\Middleware\LocalhostSessionMiddleware::class,
|
||||
\App\Http\Middleware\ActivityStreamLinks::class,
|
||||
\App\Http\Middleware\CSPHeader::class,
|
||||
],
|
||||
|
||||
|
@ -53,7 +51,7 @@ class Kernel extends HttpKernel
|
|||
/**
|
||||
* The application's middleware aliases.
|
||||
*
|
||||
* Aliases may be used to conveniently assign middleware to routes and groups.
|
||||
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
|
@ -65,7 +63,8 @@ class Kernel extends HttpKernel
|
|||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'micropub.token' => \App\Http\Middleware\VerifyMicropubToken::class,
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class ActivityStreamLinks
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$response = $next($request);
|
||||
if ($request->path() === '/') {
|
||||
$response->header('Link', '<' . config('app.url') . '>; rel="application/activity+json"', false);
|
||||
}
|
||||
if ($request->is('notes/*')) {
|
||||
$response->header('Link', '<' . $request->url() . '>; rel="application/activity+json"', false);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
22
app/Http/Middleware/ValidateSignature.php
Normal file
22
app/Http/Middleware/ValidateSignature.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
|
@ -62,7 +62,7 @@ class SendWebMentions implements ShouldQueue
|
|||
public function discoverWebmentionEndpoint(string $url): ?string
|
||||
{
|
||||
// let’s not send webmentions to myself
|
||||
if (parse_url($url, PHP_URL_HOST) === config('app.longurl')) {
|
||||
if (parse_url($url, PHP_URL_HOST) === config('url.longurl')) {
|
||||
return null;
|
||||
}
|
||||
if (Str::startsWith($url, '/notes/tagged/')) {
|
||||
|
|
|
@ -179,7 +179,7 @@ class Note extends Model
|
|||
|
||||
public function getShorturlAttribute(): string
|
||||
{
|
||||
return config('app.shorturl') . '/notes/' . $this->nb60id;
|
||||
return config('url.shorturl') . '/notes/' . $this->nb60id;
|
||||
}
|
||||
|
||||
public function getIso8601Attribute(): string
|
||||
|
|
|
@ -84,7 +84,7 @@ class Place extends Model
|
|||
protected function shorturl(): Attribute
|
||||
{
|
||||
return Attribute::get(
|
||||
get: fn ($value, $attributes) => config('app.shorturl') . '/places/' . $attributes['slug'],
|
||||
get: fn ($value, $attributes) => config('url.shorturl') . '/places/' . $attributes['slug'],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
|
@ -12,7 +13,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Route;
|
|||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
* The path to your application's "home" route.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
|
@ -24,7 +24,9 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
|
@ -35,14 +37,4 @@ class RouteServiceProvider extends ServiceProvider
|
|||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*/
|
||||
protected function configureRateLimiting(): void
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
{
|
||||
"name": "jonnybarnes/jonnybarnes.uk",
|
||||
"type": "project",
|
||||
"description": "The code for jonnybarnes.uk, based on Laravel 8",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel",
|
||||
"indieweb"
|
||||
],
|
||||
"description": "The code for jonnybarnes.uk, based on Laravel 10",
|
||||
"keywords": ["laravel", "framework", "indieweb"],
|
||||
"license": "CC0-1.0",
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"php": "^8.1",
|
||||
"ext-dom": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"cviebrock/eloquent-sluggable": "^10.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"indieauth/client": "^1.1",
|
||||
"intervention/image": "^2.4",
|
||||
"jonnybarnes/indieweb": "~0.2",
|
||||
"jonnybarnes/webmentions-parser": "~0.5",
|
||||
"jublonet/codebird-php": "4.0.0-beta.1",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/framework": "^10.10",
|
||||
"laravel/horizon": "^5.0",
|
||||
"laravel/sanctum": "^3.0",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/scout": "^10.1",
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/tinker": "^2.8",
|
||||
"lcobucci/jwt": "^5.0",
|
||||
"league/commonmark": "^2.0",
|
||||
"league/flysystem-aws-s3-v3": "^3.0",
|
||||
|
@ -39,29 +35,15 @@
|
|||
"beyondcode/laravel-dump-server": "^1.0",
|
||||
"fakerphp/faker": "^1.9.2",
|
||||
"laravel/dusk": "^7.0",
|
||||
"laravel/pint": "^1.0.0",
|
||||
"laravel/sail": "^1.15",
|
||||
"mockery/mockery": "^1.0",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"phpunit/php-code-coverage": "^10.0",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"phpunit/phpunit": "^10.1",
|
||||
"spatie/laravel-ray": "^1.12",
|
||||
"vimeo/psalm": "^5.0"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": false,
|
||||
"composer/installers": false
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
|
@ -74,24 +56,38 @@
|
|||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests"
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
],
|
||||
"test": [
|
||||
"vendor/bin/phpunit --stop-on-failure"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
return [
|
||||
|
||||
|
@ -58,50 +59,6 @@ return [
|
|||
|
||||
'asset_url' => env('ASSET_URL'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Long URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The long URL for the application
|
||||
|
|
||||
*/
|
||||
|
||||
'longurl' => env('APP_LONGURL', 'longurl.local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Short URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The short URL for the application
|
||||
|
|
||||
*/
|
||||
|
||||
'shorturl' => env('APP_SHORTURL', 'shorturl.local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authorization endpoint
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The authorization endpoint for the application, used primarily for Micropub
|
||||
|
|
||||
*/
|
||||
|
||||
'authorization_endpoint' => env('AUTHORIZATION_ENDPOINT', 'https://indieauth.com/auth'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Display Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The display name for the application, used for example in titles.
|
||||
|
|
||||
*/
|
||||
|
||||
'display_name' => env('DISPLAY_NAME', 'Joe Bloggs'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|
@ -209,34 +166,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Cache\CacheServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Cookie\CookieServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||
Illuminate\Session\SessionServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
|
||||
'providers' => ServiceProvider::defaultProviders()->merge([
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
|
@ -248,10 +178,9 @@ return [
|
|||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\HorizonServiceProvider::class,
|
||||
|
||||
],
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
])->toArray(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -265,7 +194,7 @@ return [
|
|||
*/
|
||||
|
||||
'aliases' => Facade::defaultAliases()->merge([
|
||||
// 'ExampleClass' => App\Example\ExampleClass::class,
|
||||
// 'Example' => App\Facades\Example::class,
|
||||
])->toArray(),
|
||||
|
||||
];
|
||||
|
|
|
@ -80,7 +80,7 @@ return [
|
|||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that each reset token will be
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
|
|
|
@ -36,6 +36,7 @@ return [
|
|||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||
'port' => env('PUSHER_PORT', 443),
|
||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||
|
|
|
@ -52,6 +52,7 @@ return [
|
|||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
|
|
|
@ -36,6 +36,7 @@ return [
|
|||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
|
|
|
@ -73,6 +73,22 @@ return [
|
|||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|
|
|
@ -6,6 +6,38 @@
|
|||
*/
|
||||
|
||||
return [
|
||||
'longurl' => env('APP_LONGURL', 'jonnybarnes.uk'),
|
||||
'shorturl' => env('APP_SHORTURL', 'jmb.lv'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Long URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The long URL for the application
|
||||
|
|
||||
*/
|
||||
|
||||
'longurl' => env('APP_LONGURL', 'longurl.local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Short URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The short URL for the application
|
||||
|
|
||||
*/
|
||||
|
||||
'shorturl' => env('APP_SHORTURL', 'shorturl.local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authorization endpoint
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The authorization endpoint for the application, used primarily for Micropub
|
||||
|
|
||||
*/
|
||||
|
||||
'authorization_endpoint' => env('AUTHORIZATION_ENDPOINT', 'https://indieauth.com/auth'),
|
||||
|
||||
];
|
||||
|
|
18
phpunit.xml
18
phpunit.xml
|
@ -3,34 +3,30 @@
|
|||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
stopOnFailure="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>./tests/Unit</directory>
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="Feature">
|
||||
<directory>./tests/Feature</directory>
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage pathCoverage="true">
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">./app</directory>
|
||||
</include>
|
||||
<report>
|
||||
<html outputDirectory="./public/coverage"/>
|
||||
</report>
|
||||
</coverage>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="DB_DATABASE" value="jbukdev_testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="MAIL_DRIVER" value="array"/>
|
||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
<ini name="memory_limit" value="512M"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
|
|
@ -7,17 +7,17 @@ define('LARAVEL_START', microtime(true));
|
|||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Check If Application Is Under Maintenance
|
||||
| Check If The 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
|
||||
| If the application is in maintenance / demo mode via the "down" command
|
||||
| we will load this file so that any pre-rendered content 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';
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -48,8 +48,8 @@ $app = require_once __DIR__ . '/../bootstrap/app.php';
|
|||
|
||||
$kernel = $app->make(Kernel::class);
|
||||
|
||||
$response = tap($kernel->handle(
|
||||
$response = $kernel->handle(
|
||||
$request = Request::capture()
|
||||
))->send();
|
||||
)->send();
|
||||
|
||||
$kernel->terminate($request, $response);
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<configuration>
|
||||
<system.webServer>
|
||||
<rewrite>
|
||||
<rules>
|
||||
<rule name="Imported Rule 1" stopProcessing="true">
|
||||
<match url="^(.*)/$" ignoreCase="false" />
|
||||
<conditions>
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
|
||||
</rule>
|
||||
<rule name="Imported Rule 2" stopProcessing="true">
|
||||
<match url="^" ignoreCase="false" />
|
||||
<conditions>
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="index.php" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
</system.webServer>
|
||||
</configuration>
|
|
@ -21,7 +21,7 @@
|
|||
<link rel="alternate" type="application/jf2feed+json" title="Notes JF2 Feed" href="/blog/feed.jf2">
|
||||
<link rel="openid.server" href="https://indieauth.com/openid">
|
||||
<link rel="openid.delegate" href="{{ config('app.url') }}">
|
||||
<link rel="authorization_endpoint" href="{{ config('app.authorization_endpoint') }}">
|
||||
<link rel="authorization_endpoint" href="{{ config('url.authorization_endpoint') }}">
|
||||
<link rel="token_endpoint" href="{{ config('app.url') }}/api/token">
|
||||
<link rel="micropub" href="{{ config('app.url') }}/api/post">
|
||||
<link rel="webmention" href="{{ config('app.url') }}/webmention">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider and all of them will
|
||||
| be assigned to the "web" middleware group. Make something great!
|
||||
|
|
||||
*/
|
||||
|
||||
use App\Http\Controllers\Admin\ArticlesController as AdminArticlesController;
|
||||
use App\Http\Controllers\Admin\BioController;
|
||||
use App\Http\Controllers\Admin\ClientsController;
|
||||
|
@ -37,6 +26,17 @@ use App\Http\Controllers\TokenEndpointController;
|
|||
use App\Http\Controllers\WebMentionsController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider and all of them will
|
||||
| be assigned to the "web" middleware group. Make something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group(['domain' => config('url.longurl')], function () {
|
||||
Route::get('/', [FrontPageController::class, 'index']);
|
||||
|
||||
|
|
13
storage/framework/.gitignore
vendored
13
storage/framework/.gitignore
vendored
|
@ -1,8 +1,9 @@
|
|||
config.php
|
||||
routes.php
|
||||
schedule-*
|
||||
compiled.php
|
||||
services.json
|
||||
events.scanned.php
|
||||
routes.scanned.php
|
||||
config.php
|
||||
down
|
||||
events.scanned.php
|
||||
maintenance.php
|
||||
routes.php
|
||||
routes.scanned.php
|
||||
schedule-*
|
||||
services.json
|
||||
|
|
|
@ -65,7 +65,7 @@ class FeedsTest extends TestCase
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.displayname'),
|
||||
'url' => config('app.longurl'),
|
||||
'url' => config('url.longurl'),
|
||||
],
|
||||
'children' => [[
|
||||
'type' => 'entry',
|
||||
|
@ -126,7 +126,7 @@ class FeedsTest extends TestCase
|
|||
'author' => [
|
||||
'type' => 'card',
|
||||
'name' => config('user.displayname'),
|
||||
'url' => config('app.longurl'),
|
||||
'url' => config('url.longurl'),
|
||||
],
|
||||
'children' => [[
|
||||
'type' => 'entry',
|
||||
|
|
|
@ -11,28 +11,28 @@ class ShortURLsControllerTest extends TestCase
|
|||
/** @test */
|
||||
public function shortDomainRedirectsToLongDomain(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('app.shorturl'));
|
||||
$response = $this->get('https://' . config('url.shorturl'));
|
||||
$response->assertRedirect(config('app.url'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function shortDomainSlashAtRedirectsToTwitter(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('app.shorturl') . '/@');
|
||||
$response = $this->get('https://' . config('url.shorturl') . '/@');
|
||||
$response->assertRedirect('https://twitter.com/jonnybarnes');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function shortDomainSlashTRedirectsToLongDomainSlashNotes(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('app.shorturl') . '/t/E');
|
||||
$response = $this->get('https://' . config('url.shorturl') . '/t/E');
|
||||
$response->assertRedirect(config('app.url') . '/notes/E');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function shortDomainSlashBRedirectsToLongDomainSlashBlog(): void
|
||||
{
|
||||
$response = $this->get('https://' . config('app.shorturl') . '/b/1');
|
||||
$response = $this->get('https://' . config('url.shorturl') . '/b/1');
|
||||
$response->assertRedirect(config('app.url') . '/blog/s/1');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class NotesTest extends TestCase
|
|||
{
|
||||
$note = Note::factory()->make();
|
||||
$note->id = 14;
|
||||
$this->assertEquals(config('app.shorturl') . '/notes/E', $note->shorturl);
|
||||
$this->assertEquals(config('url.shorturl') . '/notes/E', $note->shorturl);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
|
|
@ -54,7 +54,7 @@ class PlacesTest extends TestCase
|
|||
$place = Place::factory()->create([
|
||||
'name' => 'The Bridgewater Pub',
|
||||
]);
|
||||
$this->assertEquals(config('app.shorturl') . '/places/the-bridgewater-pub', $place->shorturl);
|
||||
$this->assertEquals(config('url.shorturl') . '/places/the-bridgewater-pub', $place->shorturl);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
|
Loading…
Add table
Reference in a new issue