mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
fix: allow configurable domain and prefix for all supported routes (#393)
* fix: allow configurable domain and prefix for all supported routes * style: fix StyleCI finding
This commit is contained in:
+18
-20
@@ -20,8 +20,6 @@ PUSHER_APP_SECRET=
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
ABLY_KEY=
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
# cache
|
||||
CACHE_DRIVER=file
|
||||
@@ -70,17 +68,6 @@ ELASTIC_SCOUT_DRIVER_REFRESH_DOCUMENTS=false
|
||||
# elastic migrations
|
||||
ELASTIC_MIGRATIONS_TABLE=elastic_migrations
|
||||
|
||||
# enlightn
|
||||
ENLIGHTN_SKIP_ENVIRONMENT_SPECIFIC=false
|
||||
ENLIGHTN_USERNAME=
|
||||
ENLIGHTN_API_TOKEN=
|
||||
ENLIGHTN_GITHUB_REPO=
|
||||
|
||||
# feature flags
|
||||
ALLOW_VIDEO_STREAMS=false
|
||||
ALLOW_DISCORD_NOTIFICATIONS=false
|
||||
ALLOW_VIEW_RECORDING=false
|
||||
|
||||
# filesystems
|
||||
FILESYSTEM_DISK=local
|
||||
|
||||
@@ -103,6 +90,15 @@ VIDEO_STREAM_READS=
|
||||
VIDEO_DISABLE_ASSERTS=
|
||||
VIDEO_VISIBILITY=
|
||||
|
||||
# flags
|
||||
ALLOW_VIDEO_STREAMS=false
|
||||
ALLOW_DISCORD_NOTIFICATIONS=false
|
||||
ALLOW_VIEW_RECORDING=false
|
||||
|
||||
# fortify
|
||||
FORTIFY_PATH=
|
||||
FORTIFY_URL=http://localhost
|
||||
|
||||
# hashing
|
||||
BCRYPT_ROUNDS=10
|
||||
|
||||
@@ -111,7 +107,8 @@ HORIZON_DOMAIN=
|
||||
HORIZON_PATH=horizon
|
||||
|
||||
# jetstream
|
||||
TEAM_CREATOR_ID=
|
||||
JETSTREAM_PATH=
|
||||
JETSTREAM_URL=http://localhost
|
||||
|
||||
# logging
|
||||
LOG_CHANNEL=daily
|
||||
@@ -127,7 +124,7 @@ MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
MAIL_SENDMAIL_PATH=/usr/sbin/sendmail
|
||||
MAIL_SENDMAIL_PATH="/usr/sbin/sendmail -bs -i"
|
||||
MAIL_LOG_CHANNEL=
|
||||
|
||||
# nova
|
||||
@@ -176,11 +173,6 @@ SESSION_STORE=null
|
||||
SESSION_DOMAIN=null
|
||||
SESSION_SECURE_COOKIE=
|
||||
|
||||
# teams
|
||||
HORIZON_TEAM_ID=
|
||||
NOVA_TEAM_ID=
|
||||
TELESCOPE_TEAM_ID=
|
||||
|
||||
# telescope
|
||||
TELESCOPE_DOMAIN=null
|
||||
TELESCOPE_PATH=telescope
|
||||
@@ -191,6 +183,12 @@ TELESCOPE_ENABLED=true
|
||||
VIDEO_PATH=/video
|
||||
VIDEO_URL=
|
||||
|
||||
# web
|
||||
WEB_URL=http://localhost
|
||||
WEB_PATH=
|
||||
|
||||
# wiki
|
||||
WIKI_FEATURED_ENTRY=
|
||||
WIKI_FEATURED_VIDEO=
|
||||
WIKI_DONATE_URL=#
|
||||
WIKI_FAQ_URL=#
|
||||
|
||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -30,7 +29,7 @@ class RedirectIfAuthenticated
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
return to_route('dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ class RouteServiceProvider extends ServiceProvider
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('web')
|
||||
->domain(Config::get('web.url'))
|
||||
->prefix(Config::get('web.path'))
|
||||
->group(base_path('routes/web.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
|
||||
+2
-2
@@ -17,13 +17,13 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||
'paths' => ['*'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => ['*'],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
'allowed_origins_patterns' => ['*'],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
|
||||
+11
-2
@@ -76,9 +76,9 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => '',
|
||||
'prefix' => env('FORTIFY_PATH'),
|
||||
|
||||
'domain' => null,
|
||||
'domain' => env('FORTIFY_URL'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -124,6 +124,15 @@ return [
|
||||
|
||||
'views' => true,
|
||||
|
||||
'redirects' => [
|
||||
'login' => null,
|
||||
'logout' => env('FORTIFY_URL').env('FORTIFY_PATH').'/login',
|
||||
'password-confirmation' => null,
|
||||
'register' => null,
|
||||
'email-verification' => null,
|
||||
'password-reset' => null,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Features
|
||||
|
||||
@@ -52,6 +52,21 @@ return [
|
||||
Features::accountDeletion(),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Jetstream Routes Prefix / Subdomain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which prefix Jetstream will assign to all the routes
|
||||
| that it registers with the application. If necessary, you may change
|
||||
| subdomain under which all of the Jetstream routes will be available.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('JETSTREAM_PATH'),
|
||||
|
||||
'domain' => env('JETSTREAM_URL'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Profile Photo Disk
|
||||
|
||||
+4
-4
@@ -51,10 +51,10 @@ return [
|
||||
'domain' => env('NOVA_DOMAIN_NAME'),
|
||||
|
||||
'routes' => [
|
||||
'login' => env('APP_URL').'/login',
|
||||
'logout' => env('APP_URL').'/logout',
|
||||
'forgot_password' => env('APP_URL').'/forgot-password',
|
||||
'reset_password' => env('APP_URL').'/reset-password',
|
||||
'login' => env('FORTIFY_URL').env('FORTIFY_PATH').'/login',
|
||||
'logout' => false,
|
||||
'forgot_password' => env('FORTIFY_URL').env('FORTIFY_PATH').'/forgot-password',
|
||||
'reset_password' => env('FORTIFY_URL').env('FORTIFY_PATH').'/reset-password',
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These values represent the base URL that web routes are hosted on.
|
||||
| It is most likely that only one of these values should be set.
|
||||
| If the web routes are hosted on a subdomain or at the root domain, set WEB_URL and leave WEB_PATH null.
|
||||
| Ex: app.animethemes.test or animethemes.test
|
||||
| If the web routes are NOT hosted on a subdomain or at the root domain, set WEB_PATH and leave WEB_URL null.
|
||||
| Ex: animethemes.test/app
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('WEB_URL'),
|
||||
|
||||
'path' => env('WEB_PATH'),
|
||||
];
|
||||
@@ -20,4 +20,18 @@ return [
|
||||
'featured_entry' => (int) env('WIKI_FEATURED_ENTRY'),
|
||||
|
||||
'featured_video' => (int) env('WIKI_FEATURED_VIDEO'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Footer Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| We have footer links that direct the user to pages that are handled by animethemes-web.
|
||||
| Because we want to decouple dependencies between projects, we should just register the URLs here.
|
||||
|
|
||||
*/
|
||||
|
||||
'donate' => env('WIKI_DONATE_URL'),
|
||||
|
||||
'faq' => env('WIKI_FAQ_URL'),
|
||||
];
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<div class="flex-1 text-center">
|
||||
<a class="hover:underline" href="{{ route('transparency.show') }}">Transparency</a>
|
||||
|
|
||||
<a class="hover:underline" href="{{ url('wiki/page/donate') }}">Donate</a>
|
||||
<a class="hover:underline" href="{{ config('wiki.donate') }}">Donate</a>
|
||||
|
|
||||
<a class="hover:underline" href="{{ url('wiki/page/faq') }}">FAQ</a>
|
||||
<a class="hover:underline" href="{{ config('wiki.faq') }}">FAQ</a>
|
||||
</div>
|
||||
<div class="flex-1 text-center">
|
||||
<a href="https://reddit.com/r/AnimeThemes">
|
||||
|
||||
@@ -19,8 +19,6 @@ use Spatie\RouteDiscovery\Discovery\Discover;
|
||||
Discover::controllers()->in(app_path('Http/Controllers/Auth'));
|
||||
Discover::controllers()->in(app_path('Http/Controllers/Billing'));
|
||||
|
||||
Route::redirect('/', url('/login'));
|
||||
|
||||
Route::middleware(['auth', 'verified'])->get('/dashboard', function () {
|
||||
return view('dashboard');
|
||||
})->name('dashboard');
|
||||
|
||||
@@ -20,7 +20,7 @@ class AuthenticationTest extends TestCase
|
||||
*/
|
||||
public function testLoginScreenCanBeRendered(): void
|
||||
{
|
||||
$response = $this->get('/login');
|
||||
$response = $this->get(route('login'));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class AuthenticationTest extends TestCase
|
||||
{
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$response = $this->post('/login', [
|
||||
$response = $this->post(route('login'), [
|
||||
'email' => $user->email,
|
||||
'password' => 'password',
|
||||
]);
|
||||
@@ -52,7 +52,7 @@ class AuthenticationTest extends TestCase
|
||||
{
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$this->post('/login', [
|
||||
$this->post(route('login'), [
|
||||
'email' => $user->email,
|
||||
'password' => 'wrong-password',
|
||||
]);
|
||||
|
||||
@@ -32,7 +32,7 @@ class EmailVerificationTest extends TestCase
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->get('/email/verify');
|
||||
$response = $this->actingAs($user)->get(route('verification.notice'));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class PasswordConfirmationTest extends TestCase
|
||||
{
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$response = $this->actingAs($user)->get('/user/confirm-password');
|
||||
$response = $this->actingAs($user)->get(route('password.confirm'));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class PasswordConfirmationTest extends TestCase
|
||||
{
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$response = $this->actingAs($user)->post('/user/confirm-password', [
|
||||
$response = $this->actingAs($user)->post(route('password.confirm'), [
|
||||
'password' => 'password',
|
||||
]);
|
||||
|
||||
@@ -52,7 +52,7 @@ class PasswordConfirmationTest extends TestCase
|
||||
{
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$response = $this->actingAs($user)->post('/user/confirm-password', [
|
||||
$response = $this->actingAs($user)->post(route('password.confirm'), [
|
||||
'password' => 'wrong-password',
|
||||
]);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class PasswordResetTest extends TestCase
|
||||
static::markTestSkipped('Password resets are not enabled.');
|
||||
}
|
||||
|
||||
$response = $this->get('/forgot-password');
|
||||
$response = $this->get(route('password.request'));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class PasswordResetTest extends TestCase
|
||||
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$this->post('/forgot-password', [
|
||||
$this->post(route('password.email'), [
|
||||
'email' => $user->email,
|
||||
]);
|
||||
|
||||
@@ -71,12 +71,12 @@ class PasswordResetTest extends TestCase
|
||||
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$this->post('/forgot-password', [
|
||||
$this->post(route('password.email'), [
|
||||
'email' => $user->email,
|
||||
]);
|
||||
|
||||
Notification::assertSentTo($user, ResetPassword::class, function (ResetPassword $notification) {
|
||||
$response = $this->get('/reset-password/'.$notification->token);
|
||||
$response = $this->get(route('password.reset', ['token' => $notification->token]));
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@@ -99,15 +99,14 @@ class PasswordResetTest extends TestCase
|
||||
|
||||
$user = User::factory()->createOne();
|
||||
|
||||
$this->post('/forgot-password', [
|
||||
$this->post(route('password.email'), [
|
||||
'email' => $user->email,
|
||||
]);
|
||||
|
||||
$strongPassword = $this->faker->password(64, 128);
|
||||
|
||||
Notification::assertSentTo($user, ResetPassword::class, function (ResetPassword $notification) use ($user, $strongPassword) {
|
||||
$response = $this->post('/reset-password', [
|
||||
'token' => $notification->token,
|
||||
$response = $this->post(route('password.reset', ['token' => $notification->token]), [
|
||||
'email' => $user->email,
|
||||
'password' => $strongPassword,
|
||||
'password_confirmation' => $strongPassword,
|
||||
|
||||
Reference in New Issue
Block a user