try again
This commit is contained in:
parent
1f3f1d7299
commit
c7cd0468f1
|
@ -30,7 +30,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
$this->registerGlobalRouteParamConstraints();
|
$this->registerGlobalRouteParamConstraints();
|
||||||
|
|
||||||
$this->routes(function () {
|
$this->routes(function () {
|
||||||
Route::middleware('api')
|
Route::middleware($_ENV['APP_API_PREFIX'] ?? 'api')
|
||||||
->namespace($this->namespace)
|
->namespace($this->namespace)
|
||||||
->group(base_path('routes/api.php'));
|
->group(base_path('routes/api.php'));
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
protected function configureRateLimiting()
|
protected function configureRateLimiting()
|
||||||
{
|
{
|
||||||
RateLimiter::for('api', function (Request $request) {
|
RateLimiter::for($_ENV['APP_API_PREFIX'] ?? 'api', function (Request $request) {
|
||||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,8 @@ use Illuminate\Support\Facades\Storage;
|
||||||
| is assigned the "api" middleware group. Enjoy building your API!
|
| is assigned the "api" middleware group. Enjoy building your API!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
Route::group(['prefix' => $_ENV['API_PREFIX'] ?? ''], function () {
|
|
||||||
|
|
||||||
Route::group(['middleware' => 'auth:api'], function () {
|
Route::group(['middleware' => 'auth:api'], function () {
|
||||||
Route::post('logout', [LoginController::class, 'logout']);
|
Route::post('logout', [LoginController::class, 'logout']);
|
||||||
|
|
||||||
Route::get('user', [UserController::class, 'current'])->name('user.current');
|
Route::get('user', [UserController::class, 'current'])->name('user.current');
|
||||||
|
@ -145,9 +144,9 @@ Route::group(['prefix' => $_ENV['API_PREFIX'] ?? ''], function () {
|
||||||
[\App\Http\Controllers\Admin\ImpersonationController::class, 'impersonate']
|
[\App\Http\Controllers\Admin\ImpersonationController::class, 'impersonate']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['middleware' => 'guest:api'], function () {
|
Route::group(['middleware' => 'guest:api'], function () {
|
||||||
Route::post('login', [LoginController::class, 'login']);
|
Route::post('login', [LoginController::class, 'login']);
|
||||||
Route::post('register', [RegisterController::class, 'register']);
|
Route::post('register', [RegisterController::class, 'register']);
|
||||||
|
|
||||||
|
@ -159,17 +158,17 @@ Route::group(['prefix' => $_ENV['API_PREFIX'] ?? ''], function () {
|
||||||
|
|
||||||
Route::post('oauth/{driver}', [OAuthController::class, 'redirect']);
|
Route::post('oauth/{driver}', [OAuthController::class, 'redirect']);
|
||||||
Route::get('oauth/{driver}/callback', [OAuthController::class, 'handleCallback'])->name('oauth.callback');
|
Route::get('oauth/{driver}/callback', [OAuthController::class, 'handleCallback'])->name('oauth.callback');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['prefix' => 'appsumo'], function () {
|
Route::group(['prefix' => 'appsumo'], function () {
|
||||||
Route::get('oauth/callback', [\App\Http\Controllers\Auth\AppSumoAuthController::class, 'handleCallback'])->name('appsumo.callback');
|
Route::get('oauth/callback', [\App\Http\Controllers\Auth\AppSumoAuthController::class, 'handleCallback'])->name('appsumo.callback');
|
||||||
Route::post('webhook', [\App\Http\Controllers\Webhook\AppSumoController::class, 'handle'])->name('appsumo.webhook');
|
Route::post('webhook', [\App\Http\Controllers\Webhook\AppSumoController::class, 'handle'])->name('appsumo.webhook');
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public Forms related routes
|
* Public Forms related routes
|
||||||
*/
|
*/
|
||||||
Route::prefix('forms')->name('forms.')->group(function () {
|
Route::prefix('forms')->name('forms.')->group(function () {
|
||||||
Route::middleware('protected-form')->group(function () {
|
Route::middleware('protected-form')->group(function () {
|
||||||
Route::post('{slug}/answer', [PublicFormController::class, 'answer'])->name('answer');
|
Route::post('{slug}/answer', [PublicFormController::class, 'answer'])->name('answer');
|
||||||
|
|
||||||
|
@ -190,41 +189,41 @@ Route::group(['prefix' => $_ENV['API_PREFIX'] ?? ''], function () {
|
||||||
// AI
|
// AI
|
||||||
Route::post('ai/generate', [\App\Http\Controllers\Forms\AiFormController::class, 'generateForm'])->name('ai.generate');
|
Route::post('ai/generate', [\App\Http\Controllers\Forms\AiFormController::class, 'generateForm'])->name('ai.generate');
|
||||||
Route::get('ai/{aiFormCompletion}', [\App\Http\Controllers\Forms\AiFormController::class, 'show'])->name('ai.show');
|
Route::get('ai/{aiFormCompletion}', [\App\Http\Controllers\Forms\AiFormController::class, 'show'])->name('ai.show');
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Other public routes
|
* Other public routes
|
||||||
*/
|
*/
|
||||||
Route::prefix('content')->name('content.')->group(function () {
|
Route::prefix('content')->name('content.')->group(function () {
|
||||||
Route::get('changelog/entries', [\App\Http\Controllers\Content\ChangelogController::class, 'index'])->name('changelog.entries');
|
Route::get('changelog/entries', [\App\Http\Controllers\Content\ChangelogController::class, 'index'])->name('changelog.entries');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/sitemap-urls', [\App\Http\Controllers\SitemapController::class, 'index'])->name('sitemap.index');
|
Route::get('/sitemap-urls', [\App\Http\Controllers\SitemapController::class, 'index'])->name('sitemap.index');
|
||||||
|
|
||||||
// Templates
|
// Templates
|
||||||
Route::prefix('templates')->group(function () {
|
Route::prefix('templates')->group(function () {
|
||||||
Route::get('/', [TemplateController::class, 'index'])->name('templates.index');
|
Route::get('/', [TemplateController::class, 'index'])->name('templates.index');
|
||||||
Route::post('/', [TemplateController::class, 'create'])->name('templates.create');
|
Route::post('/', [TemplateController::class, 'create'])->name('templates.create');
|
||||||
Route::get('/{slug}', [TemplateController::class, 'show'])->name('templates.show');
|
Route::get('/{slug}', [TemplateController::class, 'show'])->name('templates.show');
|
||||||
Route::put('/{id}', [TemplateController::class, 'update'])->name('templates.update');
|
Route::put('/{id}', [TemplateController::class, 'update'])->name('templates.update');
|
||||||
Route::delete('/{id}', [TemplateController::class, 'destroy'])->name('templates.destroy');
|
Route::delete('/{id}', [TemplateController::class, 'destroy'])->name('templates.destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::post(
|
Route::post(
|
||||||
'/stripe/webhook',
|
'/stripe/webhook',
|
||||||
[\App\Http\Controllers\Webhook\StripeController::class, 'handleWebhook']
|
[\App\Http\Controllers\Webhook\StripeController::class, 'handleWebhook']
|
||||||
)->name('cashier.webhook');
|
)->name('cashier.webhook');
|
||||||
|
|
||||||
Route::post(
|
Route::post(
|
||||||
'/vapor/signed-storage-url',
|
'/vapor/signed-storage-url',
|
||||||
[\App\Http\Controllers\Content\SignedStorageUrlController::class, 'store']
|
[\App\Http\Controllers\Content\SignedStorageUrlController::class, 'store']
|
||||||
)->middleware([]);
|
)->middleware([]);
|
||||||
Route::post(
|
Route::post(
|
||||||
'/upload-file',
|
'/upload-file',
|
||||||
[\App\Http\Controllers\Content\FileUploadController::class, 'upload']
|
[\App\Http\Controllers\Content\FileUploadController::class, 'upload']
|
||||||
)->middleware([]);
|
)->middleware([]);
|
||||||
|
|
||||||
Route::get('local/temp/{path}', function (Request $request, string $path) {
|
Route::get('local/temp/{path}', function (Request $request, string $path) {
|
||||||
if (! $request->hasValidSignature()) {
|
if (! $request->hasValidSignature()) {
|
||||||
abort(401);
|
abort(401);
|
||||||
}
|
}
|
||||||
|
@ -232,8 +231,7 @@ Route::group(['prefix' => $_ENV['API_PREFIX'] ?? ''], function () {
|
||||||
$response->header('Content-Type', Storage::mimeType($path));
|
$response->header('Content-Type', Storage::mimeType($path));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
})->where('path', '(.*)')->name('local.temp');
|
})->where('path', '(.*)')->name('local.temp');
|
||||||
|
|
||||||
Route::get('caddy/ask-certificate/{secret?}', [\App\Http\Controllers\CaddyController::class, 'ask'])
|
Route::get('caddy/ask-certificate/{secret?}', [\App\Http\Controllers\CaddyController::class, 'ask'])
|
||||||
->name('caddy.ask')->middleware(\App\Http\Middleware\CaddyRequestMiddleware::class);
|
->name('caddy.ask')->middleware(\App\Http\Middleware\CaddyRequestMiddleware::class);
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue