Skip to content

Firefly III: a personal finances manager

Replace shitty Laravel Passport command.

James Cole9c07ddaed62a
diff --git a/app/Console/Commands/System/LaravelPassportKeys.php b/app/Console/Commands/System/LaravelPassportKeys.php
new file mode 100644
index 0000000000..4bf490f297
--- /dev/null
+++ b/app/Console/Commands/System/LaravelPassportKeys.php
@@ -0,0 +1,62 @@
+<?php
+/*
+ * LaravelPassportKeys.php
+ * Copyright (c) 2024 [email protected].
+ *
+ * This file is part of Firefly III (https://github.com/firefly-iii).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see https://www.gnu.org/licenses/.
+ */
+
+namespace FireflyIII\Console\Commands\System;
+
+use FireflyIII\Console\Commands\ShowsFriendlyMessages;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Artisan;
+use Symfony\Component\Console\Command\Command as CommandAlias;
+
+class LaravelPassportKeys extends Command
+{
+ use ShowsFriendlyMessages;
+
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'firefly-iii:laravel-passport-keys';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Calls the Laravel "passport:keys" but doesn\'t exit 1.';
+
+ /**
+ * Execute the console command.
+ */
+ public function handle()
+ {
+ Artisan::call('passport:keys --no-interaction', []);
+ $result = Artisan::output();
+ if (str_contains($result, 'Encryption keys already exist')) {
+ $this->friendlyInfo('Encryption keys exist already.');
+ return CommandAlias::SUCCESS;
+
+ }
+ $this->friendlyPositive('Encryption keys have been created, nice!');
+ return CommandAlias::SUCCESS;
+ }
+}
diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php
index ee108f678a..0b244799e2 100644
--- a/app/Console/Commands/Tools/ApplyRules.php
+++ b/app/Console/Commands/Tools/ApplyRules.php
@@ -1,7 +1,7 @@
<?php
-/**
+/*
* ApplyRules.php
- * Copyright (c) 2020 [email protected]
+ * Copyright (c) 2024 [email protected].
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -16,7 +16,7 @@
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1);
diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php
index 4b3b0177b9..d7297ff629 100644
--- a/app/Console/Commands/Tools/Cron.php
+++ b/app/Console/Commands/Tools/Cron.php
@@ -1,8 +1,8 @@
<?php
-/**
+/*
* Cron.php
- * Copyright (c) 2020 [email protected]
+ * Copyright (c) 2024 [email protected].
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -17,7 +17,7 @@
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1);
diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php
index f46af222c1..5a7501dd03 100644
--- a/app/Support/System/OAuthKeys.php
+++ b/app/Support/System/OAuthKeys.php
@@ -88,7 +88,7 @@ class OAuthKeys
public static function generateKeys(): void
{
\Artisan::registerCommand(new KeysCommand());
- \Artisan::call('passport:keys');
+ \Artisan::call('firefly-iii:laravel-passport-keys');
}
public static function storeKeysInDB(): void
diff --git a/composer.json b/composer.json
index 025a655615..46dac18b5d 100644
--- a/composer.json
+++ b/composer.json
@@ -167,7 +167,7 @@
"@php artisan firefly-iii:upgrade-database",
"@php artisan firefly-iii:correct-database",
"@php artisan firefly-iii:report-integrity",
- "@php artisan passport:keys",
+ "@php artisan firefly-iii:laravel-passport-keys",
"@php artisan firefly:instructions update"
],
"post-install-cmd": [