diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 2195412f..9786a8a5 100644 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace App\Http\Controllers; +use App\Exceptions\ImporterErrorException; use App\Services\Session\Constants; use App\Services\Shared\Authentication\SecretManager; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/TokenController.php b/app/Http/Controllers/TokenController.php index 2067de0d..e6ec2f4c 100644 --- a/app/Http/Controllers/TokenController.php +++ b/app/Http/Controllers/TokenController.php @@ -225,7 +225,12 @@ class TokenController extends Controller // Option 3: either is empty, ask for client ID and/or base URL: $clientId = 0 === $clientId ? '' : $clientId; - return view('token.client_id', compact('baseUrl', 'clientId', 'pageTitle')); + // if the vanity url is the same as the base url, just give this view an empty string + if($vanityUrl === $baseUrl) { + $vanityUrl = ''; + } + + return view('token.client_id', compact('baseUrl','vanityUrl', 'clientId', 'pageTitle')); } /** diff --git a/resources/js/v2/src/pages/index/index.js b/resources/js/v2/src/pages/index/index.js index f7b36010..68ae122f 100644 --- a/resources/js/v2/src/pages/index/index.js +++ b/resources/js/v2/src/pages/index/index.js @@ -53,6 +53,8 @@ let index = function () { let tokenPageUrl = './token'; window.axios.get(validateUrl).then((response) => { let message = response.data.result; + console.log('message is ', message) + if ('OK' === message) { this.loadingFunctions.file = false; this.importFunctions.file = true; @@ -68,7 +70,7 @@ let index = function () { this.importFunctions.spectre = false; this.pageProperties.connectionError = true; - this.pageProperties.connectionErrorMessage = data.message; + this.pageProperties.connectionErrorMessage = response.data.message; }).catch((error) => { this.loadingFunctions.file = false; this.loadingFunctions.gocardless = false; @@ -80,9 +82,12 @@ let index = function () { this.pageProperties.connectionError = true; this.pageProperties.connectionErrorMessage = error; }).finally(() => { - this.checkSpectreConnection(); - this.checkGoCardlessConnection(); + if(false === this.pageProperties.connectionError) { + this.checkSpectreConnection(); + this.checkGoCardlessConnection(); + } }); + }, checkSpectreConnection() { let validateUrl = './validate/spectre'; @@ -97,7 +102,9 @@ let index = function () { this.importFunctions.spectre = false; this.errors.spectre = 'The Spectre / Salt Edge API is configured incorrectly and cannot be used to import data.'; }).catch((error) => { - + this.loadingFunctions.spectre = false; + this.importFunctions.spectre = false; + this.errors.spectre = 'The Spectre / Salt Edge API is configured incorrectly and cannot be used to import data.'; }); }, checkGoCardlessConnection() { @@ -113,7 +120,9 @@ let index = function () { this.importFunctions.gocardless = false; this.errors.gocardless = 'The GoCardless API is configured incorrectly and cannot be used to import data.'; }).catch((error) => { - + this.loadingFunctions.gocardless = false; + this.importFunctions.gocardless = false; + this.errors.gocardless = 'The GoCardless API is configured incorrectly and cannot be used to import data.'; }); } } diff --git a/resources/js/v2/vite.config.js b/resources/js/v2/vite.config.js index ad0d2e9d..4d78cef6 100644 --- a/resources/js/v2/vite.config.js +++ b/resources/js/v2/vite.config.js @@ -48,19 +48,11 @@ export default defineConfig({ 'src/sass/app.scss', // index - 'src/pages/index/index.js', - - // configuration 'src/pages/configuration/index.js', - - // selection - 'src/pages/selection/gocardless.js', - - // conversion 'src/pages/conversion/index.js', - - // submission - 'src/pages/submission/index.js', + 'src/pages/index/index.js', + 'src/pages/selection/gocardless.js', + 'src/pages/submit/index.js', ], publicDirectory: '../../../public', refresh: true diff --git a/resources/views/v2/debug-table.blade.php b/resources/views/v2/debug-table.blade.php new file mode 100644 index 00000000..5498e8a7 --- /dev/null +++ b/resources/views/v2/debug-table.blade.php @@ -0,0 +1,78 @@ + + + + + + + + + + + + + @if($system['is_docker']) + + + + + @endif + + + + +
System information
ItemValue
Version{{ config('importer.version') }}
Build#{{ $system['build'] }}, base #{{ $system['base_build'] }}
SystemPHP {{ $system['php_version'] }}, {{ $system['php_os'] }}, {{ $system['interface'] }}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
App information
ItemValue
Timezone{{ config('app.timezone') }}, [BrowserTZ]
Environment{{ config('app.env') }}
Debug mode{{ $app['debug'] }}, cache '{{ config('cache.default') }}'
Log level{{ config('logging.level') }}, {{ config('logging.default') }}
Display errors{{ $app['display_errors'] }}, {{ $app['reporting'] }}
BCscale{{ $app['bcscale'] }}
Trusted proxies{{ config('importer.trusted_proxies') }}
+ + + + + + + + + + + + +
User information
ItemValue
+ User agent + + {{ $user['user_agent'] }} +
diff --git a/resources/views/v2/debug.blade.php b/resources/views/v2/debug.blade.php new file mode 100644 index 00000000..3aa859a1 --- /dev/null +++ b/resources/views/v2/debug.blade.php @@ -0,0 +1,45 @@ + + + Firefly III Data Importer Debug + + + +

+ Firefly III data importer debug page +

+

+ Copy and paste the content of this textarea in your issue. Please do not add quotes or backticks, it breaks the table. +

+ + + +

+ Back to index +

+ +

+ Extra info. Do not share this lightly! +

+ + + +

+ Back to index +

+ + + diff --git a/resources/views/v2/emails/import/report.blade.php b/resources/views/v2/emails/import/report.blade.php new file mode 100644 index 00000000..d509d01f --- /dev/null +++ b/resources/views/v2/emails/import/report.blade.php @@ -0,0 +1,52 @@ +@component('mail::message') +# Result of your import on {{ $time }} + +
+ +@if(count($errors) > 0) +## Errors +@endif + +@foreach($errors as $index => $objList) +@foreach($objList as $message) +- Line #{{ $index + 1 }}: {!! $message !!} +@endforeach +@endforeach + +@if(count($warnings) > 0) +## Warnings +@endif + +@foreach($warnings as $index => $objList) +@foreach($objList as $message) +- Line #{{ $index + 1 }}: {!! $message !!} +@endforeach +@endforeach + +@if(count($messages) > 0) +## Messages +@endif + +@foreach($messages as $index => $objList) +@foreach($objList as $message) +- Line #{{ $index + 1 }}: {!! $message !!} +@endforeach +@endforeach + +
+ +@if(0 === count($errors) and 0 === count($messages) and 0 === count($warnings)) + +*No messages, warnings or errors: nothing to report* + +@endif +@if('' !== $url) +@component('mail::button', ['url' => $url]) +Go to Firefly III +@endcomponent +@endif + +Enjoy!
+Firefly III Data Importer, v{{ config('importer.version') }} + +@endcomponent diff --git a/resources/views/v2/errors/503.blade.php b/resources/views/v2/errors/503.blade.php new file mode 100644 index 00000000..19e211f5 --- /dev/null +++ b/resources/views/v2/errors/503.blade.php @@ -0,0 +1,86 @@ + + + + + + Firefly III Data Importer Maintenance Mode + + + + + + + + + @yield('styles') + @vite(['src/sass/app.scss']) + + + +
+
+

Firefly III Data Importer

+
+
+
+
+

The Firefly III Data Importer is in maintenance mode.

+
+
+
+
+

+ This should only take a few moments. If you had an import running, you may have to start over. My apologies. +

+

+ Please check back in a second! +

+
+
+ + diff --git a/resources/views/v2/errors/exception.blade.php b/resources/views/v2/errors/exception.blade.php new file mode 100644 index 00000000..32c2ab9b --- /dev/null +++ b/resources/views/v2/errors/exception.blade.php @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + @yield('styles') + @vite(['src/sass/app.scss']) + + 500 error :( + + +@if(config('importer.is_external')) + +@endif +
+
+
+

Whoops! 500 :(

+

+ Sorry, the Firefly III Data Importer broke down. +

+

Error message

+

+ {{ $exception->getMessage() }} +

+

More information

+

+ The error occurred in {{ $exception->getFile() }}:{{ $exception->getLine() }}. +

+

+ Please collect more information in the storage/logs directory, where you will find log files. + If you're running Docker, use docker logs -f [container]. + You can read more about collecting error information in the FAQ. +

+

Get help on GitHub

+

+ You're more than welcome to open a new issue on GitHub. +

+
    +
  1. Use the search!
  2. +
  3. Include the information from this debug page.
  4. +
  5. Tell us more than "it says Whoops!"
  6. +
  7. Include error logs (see above).
  8. +
  9. Tell us what you were doing.
  10. +
+ +
+
+ + diff --git a/resources/views/v2/import/002-authenticate/index.blade.php b/resources/views/v2/import/002-authenticate/index.blade.php new file mode 100644 index 00000000..10a24f76 --- /dev/null +++ b/resources/views/v2/import/002-authenticate/index.blade.php @@ -0,0 +1,118 @@ +@extends('layout.v2') +@section('content') +
+
+
+

{{ $mainTitle }}

+
+
+
+
+
+
+ {{ $subTitle }} +
+
+

In order to import using + @if('nordigen' === $flow) + GoCardless, + @endif + @if('spectre' === $flow) + Spectre, + @endif + you must enter the authentication data you + received from this provider. + You can read how to get the necessary codes in the + documentation +

+
+
+
+
+
+
+
+
+ Form +
+
+ @if('' !== ($error ?? '')) +

{{ $error }}

+ @endif + +
+ + + @if('nordigen' === $flow) + +
+ +
+ + + Your GoCardless ID + +
+
+ +
+ +
+ + + Your GoCardless secret key + +
+
+ @endif + + @if('spectre' === $flow) + +
+ +
+ + + The app ID + +
+
+ +
+ +
+ + + The secret + +
+
+ @endif + +
+
+
+
+
+
+
+ +
+
+
+@endsection diff --git a/resources/views/v2/import/005-roles/index-camt.blade.php b/resources/views/v2/import/005-roles/index-camt.blade.php new file mode 100644 index 00000000..71f7bb65 --- /dev/null +++ b/resources/views/v2/import/005-roles/index-camt.blade.php @@ -0,0 +1,152 @@ +@extends('layout.v2') +@section('content') +
+
+
+

{{ $mainTitle }}

+
+
+
+
+
+
+ {{ $subTitle }} +
+
+

+ CAMT files feature "layers", where each layer has its own content. + Your options per field may be limited. Firefly III will not be able to + store all content of a CAMT file. If you feel your choices are too limited, please + open an issue on GitHub. +

+
+
+
+
+ @if(!$errors->isEmpty()) +
+
+
+
+ Errors :( +
+
+

Some error(s) occurred:

+
    + @foreach($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+
+
+
+ @endif +
+
+
+
+ Role configuration +
+
+
+ + + @foreach($levels as $key => $level) +

Level {{ $key }}: {{ $level['title'] }}

+

+ {{ $level['title'] }}: {{ $level['explanation'] }} +

+ @if(count($level['fields']) > 0) + + + + + + + + + + + @foreach($level['fields'] as $field) + @if(true === ($field['section'] ?? false)) + + + + @endif + @if(false === ($field['section'] ?? false)) + + + + + + + @endif + @endforeach + +
FieldExample dataFirefly III roleMap data?
{{ __('camt.section_'. $field['title']) }}
+ {{ __('camt.field_'.$field['title']) }} + @if(__('camt.field_' . $field['title'] . '_description') !== 'camt.field_' . $field['title'] . '_description') +
{{ __('camt.field_' . $field['title'] . '_description') }} + @endif +
+ @if(0 == count($examples[$field['title']])) + (no example data) + @endif + @if(count($examples[$field['title']]) > 0) + @foreach($examples[$field['title']] as $example) + {{ $example }}
+ @endforeach + @endif +
+ @if(0 === count(config('camt.roles.' . $field['roles']))) + (no roles available) + @endif + @if(count(config('camt.roles.' . $field['roles'])) > 0) + + @endif + + + @if(true === $field['mappable']) + + @endif +
+ @endif + @endforeach + +
+
+
+
+
+ +
+ +@endsection + diff --git a/resources/views/v2/token/client_id.blade.php b/resources/views/v2/token/client_id.blade.php new file mode 100644 index 00000000..aba3bbb3 --- /dev/null +++ b/resources/views/v2/token/client_id.blade.php @@ -0,0 +1,91 @@ +@extends('layout.v2') +@section('content') +
+
+
+

Firefly III Data Import Tool, v{{ $version }}

+
+
+
+
+
+
+ Authenticate with Firefly III +
+
+

+ Welcome! This tool will help you import data into Firefly III. +

+

+ This tool is sparsely documented, you can find all the details you need + in the + documentation. Any links you see to the docs will open in a new window or tab. +

+

+ @if('' !== (string)$baseUrl) + In order to get access to your Firefly III installation at {{ $baseUrl }} + @if('' !== (string)$vanityUrl) + ({{ $vanityUrl }}) + @endif + , you will need to submit a valid Client ID. This is a number. + @else + In order to get access to your Firefly III installation, you will need to submit a valid Client ID. This is a number. + @endif +

+

+ @if('' !== (string)$baseUrl) + If you don't have one, you must create in your + profile under "OAuth". Make sure you + remove the checkbox under "Confidential". + @else + If you don't have one, you must create in your profile under "OAuth". Make sure you + remove the checkbox under "Confidential". + @endif +

+

+ The callback URL for this installation is
{{ route('token.callback') }} +

+ @foreach($errors->all() as $error) +

{{ $error }}

+ @endforeach + +
+ + @if('' === (string)$baseUrl) +
+ + + @if($errors->has('base_url')) + {{ $errors->first('base_url') }} + @endif + @if(session()->has('secure_url')) + {{ session()->get('secure_url') }} + @endif +
+ @endif +
+ + + @if($errors->has('client_id')) + {{ $errors->first('client_id') }} + @endif +
+ +
+ +
+
+
+
+

+ Start over +

+
+
+
+
+ +
+@endsection