diff --git a/app/Http/Controllers/SpaController.php b/app/Http/Controllers/SpaController.php deleted file mode 100644 index 50456f1..0000000 --- a/app/Http/Controllers/SpaController.php +++ /dev/null @@ -1,18 +0,0 @@ - (new SeoMetaResolver($request))->getMetas(), - ]); - } -} diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index faee4fa..b9d4a78 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -40,18 +40,13 @@ class RouteServiceProvider extends ServiceProvider $this->routes(function () { - Route::prefix('api') - ->middleware('api') + Route::middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); - - Route::middleware('spa') - ->namespace($this->namespace) - ->group(base_path('routes/spa.php')); }); } diff --git a/client/components/open/forms/components/FormSubmissions.vue b/client/components/open/forms/components/FormSubmissions.vue index 32beba1..3cbf8dc 100644 --- a/client/components/open/forms/components/FormSubmissions.vue +++ b/client/components/open/forms/components/FormSubmissions.vue @@ -101,7 +101,8 @@ export default { setup () { const workingFormStore = useWorkingFormStore() return { - workingFormStore + workingFormStore, + runtimeConfig: useRuntimeConfig() } }, @@ -134,7 +135,7 @@ export default { if (!this.form) { return '' } - return '/api/open/forms/' + this.form.id + '/submissions/export' + return this.runtimeConfig.public.apiBase + '/open/forms/' + this.form.id + '/submissions/export' }, filteredData () { if (!this.tableData) return [] diff --git a/client/components/pages/auth/ForgotPasswordModal.vue b/client/components/pages/auth/ForgotPasswordModal.vue index b5f0440..d437db3 100644 --- a/client/components/pages/auth/ForgotPasswordModal.vue +++ b/client/components/pages/auth/ForgotPasswordModal.vue @@ -64,7 +64,7 @@ }), methods: { async send () { - const { data } = await this.form.post('/api/password/email') + const { data } = await this.form.post('/password/email') this.isMailSent = true }, close () { diff --git a/client/components/pages/forms/create/CreateFormBaseModal.vue b/client/components/pages/forms/create/CreateFormBaseModal.vue index 3966ecc..e2b4b0f 100644 --- a/client/components/pages/forms/create/CreateFormBaseModal.vue +++ b/client/components/pages/forms/create/CreateFormBaseModal.vue @@ -120,7 +120,7 @@ export default { if (this.loading) return this.loading = true - this.aiForm.post('/api/forms/ai/generate').then(response => { + this.aiForm.post('/forms/ai/generate').then(response => { this.useAlert.success(response.data.message) this.fetchGeneratedForm(response.data.ai_form_completion_id) }).catch(error => { diff --git a/client/components/pages/forms/show/RegenerateFormLink.vue b/client/components/pages/forms/show/RegenerateFormLink.vue index ad23640..40e3aa7 100644 --- a/client/components/pages/forms/show/RegenerateFormLink.vue +++ b/client/components/pages/forms/show/RegenerateFormLink.vue @@ -95,7 +95,7 @@ export default { }), computed: { - formEndpoint: () => '/api/open/forms/{id}', + formEndpoint: () => '/open/forms/{id}', }, methods: { diff --git a/client/pages/auth/password/email.vue b/client/pages/auth/password/email.vue index d277490..289dfe0 100644 --- a/client/pages/auth/password/email.vue +++ b/client/pages/auth/password/email.vue @@ -42,7 +42,7 @@ export default { methods: { async send () { - const { data } = await this.form.post('/api/password/email') + const { data } = await this.form.post('/password/email') this.status = data.status diff --git a/client/pages/auth/password/reset.vue b/client/pages/auth/password/reset.vue index e3c0da9..b82032d 100644 --- a/client/pages/auth/password/reset.vue +++ b/client/pages/auth/password/reset.vue @@ -60,7 +60,7 @@ export default { methods: { async reset () { - const { data } = await this.form.post('/api/password/reset') + const { data } = await this.form.post('/password/reset') this.status = data.status diff --git a/client/pages/settings/admin.vue b/client/pages/settings/admin.vue index b168fb3..99e2325 100644 --- a/client/pages/settings/admin.vue +++ b/client/pages/settings/admin.vue @@ -8,12 +8,12 @@ Tools
- + Stats - + Horizon @@ -53,6 +53,10 @@ let form = useForm({ }) let loading = false +const runtimeConfig = useRuntimeConfig() +const statsUrl = runtimeConfig.public.apiBase + '/stats' +const horizonUrl = runtimeConfig.public.apiBase + '/horizon' + const impersonate = () => { loading = true authStore.startImpersonating() diff --git a/config/cors.php b/config/cors.php index 558369d..005e772 100644 --- a/config/cors.php +++ b/config/cors.php @@ -15,7 +15,7 @@ return [ | */ - 'paths' => ['api/*'], + 'paths' => ['*'], 'allowed_methods' => ['*'], diff --git a/routes/api.php b/routes/api.php index 063589a..418156d 100644 --- a/routes/api.php +++ b/routes/api.php @@ -18,6 +18,9 @@ use App\Http\Controllers\Forms\RecordController; use App\Http\Controllers\WorkspaceController; use App\Http\Controllers\TemplateController; use App\Http\Controllers\Forms\Integration\FormZapierWebhookController; +use Illuminate\Http\Request; +use Illuminate\Http\Response; +use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Route; /* @@ -177,3 +180,31 @@ Route::prefix('templates')->group(function () { Route::put('/{id}', [TemplateController::class, 'update'])->name('templates.update'); Route::delete('/{id}', [TemplateController::class, 'destroy'])->name('templates.destroy'); }); + + + +Route::post( + '/stripe/webhook', + [\App\Http\Controllers\Webhook\StripeController::class, 'handleWebhook'] +)->name('cashier.webhook'); + +Route::post( + '/vapor/signed-storage-url', + [\App\Http\Controllers\Content\SignedStorageUrlController::class, 'store'] +)->middleware([]); +Route::post( + '/upload-file', + [\App\Http\Controllers\Content\FileUploadController::class, 'upload'] +)->middleware([]); + +Route::get('local/temp/{path}', function (Request $request, string $path){ + if (!$request->hasValidSignature()) { + abort(401); + } + $response = Response::make(Storage::get($path), 200); + $response->header("Content-Type", Storage::mimeType($path)); + return $response; +})->where('path', '(.*)')->name('local.temp'); + +Route::get('caddy/ask-certificate/{secret?}', [\App\Http\Controllers\CaddyController::class, 'ask']) + ->name('caddy.ask')->middleware(\App\Http\Middleware\CaddyRequestMiddleware::class); diff --git a/routes/spa.php b/routes/spa.php deleted file mode 100644 index 91f771d..0000000 --- a/routes/spa.php +++ /dev/null @@ -1,17 +0,0 @@ -where('path', '^(?!(api|stats|mailcoach|vapor|sitemap|caddy|dist)).*$'); diff --git a/routes/web.php b/routes/web.php index 05896a9..94febc7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,8 +1,6 @@ name('cashier.webhook'); - -Route::post( - '/vapor/signed-storage-url', - [\App\Http\Controllers\Content\SignedStorageUrlController::class, 'store'] -)->middleware([]); -Route::post( - '/upload-file', - [\App\Http\Controllers\Content\FileUploadController::class, 'upload'] -)->middleware([]); - -Route::get('local/temp/{path}', function (Request $request, string $path){ - if (!$request->hasValidSignature()) { - abort(401); - } - $response = Response::make(Storage::get($path), 200); - $response->header("Content-Type", Storage::mimeType($path)); - return $response; -})->where('path', '(.*)')->name('local.temp'); - -Route::get('caddy/ask-certificate/{secret?}', [\App\Http\Controllers\CaddyController::class, 'ask']) - ->name('caddy.ask')->middleware(\App\Http\Middleware\CaddyRequestMiddleware::class);