Skip to content

Firefly III: a personal finances manager

Various updates.

James Coleb1afaea1aa8d
diff --git a/.env.example b/.env.example
index f63a3e2ac5..9bf6ec8409 100644
--- a/.env.example
+++ b/.env.example
@@ -1,6 +1,6 @@
# You can leave this on "local". If you change it to production most console commands will ask for extra confirmation.
# Never set it to "testing".
-APP_ENV=local
+APP_ENV=production
# Set to true if you want to see debug information in error screens.
APP_DEBUG=false
diff --git a/app/Console/Commands/System/UpgradeFireflyInstructions.php b/app/Console/Commands/System/UpgradeFireflyInstructions.php
index 24fe129742..05e4ee5919 100644
--- a/app/Console/Commands/System/UpgradeFireflyInstructions.php
+++ b/app/Console/Commands/System/UpgradeFireflyInstructions.php
@@ -72,6 +72,16 @@ class UpgradeFireflyInstructions extends Command
}
}
+ // validate some settings.
+ if('' === $text && 'local' === (string)config('app.env')) {
+ $text = 'Please set APP_ENV=production for a safer environment.';
+ }
+
+ $prefix = 'v';
+ if(str_starts_with($version, 'develop')) {
+ $prefix = '';
+ }
+
$this->newLine();
$this->showLogo();
$this->newLine();
@@ -79,7 +89,7 @@ class UpgradeFireflyInstructions extends Command
$this->boxed('');
if ('' === $text) {
- $this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version));
+ $this->boxed(sprintf('Thank you for updating to Firefly III, %s%s', $prefix, $version));
$this->boxedInfo('There are no extra upgrade instructions.');
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
@@ -88,7 +98,7 @@ class UpgradeFireflyInstructions extends Command
return;
}
- $this->boxed(sprintf('Thank you for updating to Firefly III, v%s!', $version));
+ $this->boxed(sprintf('Thank you for updating to Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo($text);
$this->boxed('');
$this->showLine();
@@ -181,13 +191,24 @@ class UpgradeFireflyInstructions extends Command
$text = (string)$config[$compare];
}
}
+
+ // validate some settings.
+ if('' === $text && 'local' === (string)config('app.env')) {
+ $text = 'Please set APP_ENV=production for a safer environment.';
+ }
+
+ $prefix = 'v';
+ if(str_starts_with($version, 'develop')) {
+ $prefix = '';
+ }
+
$this->newLine();
$this->showLogo();
$this->newLine();
$this->showLine();
$this->boxed('');
if ('' === $text) {
- $this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
+ $this->boxed(sprintf('Thank you for installing Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo('There are no extra installation instructions.');
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
@@ -196,7 +217,7 @@ class UpgradeFireflyInstructions extends Command
return;
}
- $this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
+ $this->boxed(sprintf('Thank you for installing Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo($text);
$this->boxed('');
$this->showLine();
diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php
index 2bec5fe695..a02441f937 100644
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php
@@ -123,15 +123,15 @@ class ForgotPasswordController extends Controller
}
/**
- * @return void
* @throws FireflyException
*/
- private function validateHost(): void {
- $configuredHost = parse_url((string)config('app.url'), PHP_URL_HOST);
+ private function validateHost(): void
+ {
+ $configuredHost = parse_url((string)config('app.url'), PHP_URL_HOST);
if(false === $configuredHost || null === $configuredHost) {
throw new FireflyException('Please set a valid and correct Firefly III URL in the APP_URL environment variable.');
}
- $host = request()->host();
+ $host = request()->host();
if($configuredHost !== $host) {
throw new FireflyException('The Host-header does not match the host in the APP_URL environment variable. Please make sure these match. See also: https://bit.ly/FF3-host-header');
}
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index 6f2cc2b045..09982b2063 100644
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -81,7 +81,6 @@ class ResetPasswordController extends Controller
return view('error', compact('message'));
}
-
$rules = [
'token' => 'required',
'email' => 'required|email',
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index 18abec5c9d..d17ae5c079 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
-use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Models\AccountType;
@@ -178,7 +177,9 @@ class DebugController extends Controller
'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
'php_version' => PHP_VERSION,
'php_os' => PHP_OS,
+ 'uname' => php_uname('m'),
'interface' => \PHP_SAPI,
+ 'bits' => \PHP_INT_SIZE * 8,
'bcscale' => bcscale(),
'display_errors' => ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),
diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php
new file mode 100644
index 0000000000..4045a4aba8
--- /dev/null
+++ b/app/Http/Middleware/TrustHosts.php
@@ -0,0 +1,41 @@
+<?php
+/*
+ * TrustHosts.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/.
+ */
+
+declare(strict_types=1);
+
+namespace FireflyIII\Http\Middleware;
+
+use Illuminate\Http\Middleware\TrustHosts as Middleware;
+
+class TrustHosts extends Middleware
+{
+ /**
+ * Get the host patterns that should be trusted.
+ *
+ * @return array<int, null|string>
+ */
+ public function hosts(): array
+ {
+ return [
+ $this->allSubdomainsOfApplicationUrl(),
+ ];
+ }
+}
diff --git a/composer.lock b/composer.lock
index 470d251fed..794f12c259 100644
--- a/composer.lock
+++ b/composer.lock
@@ -8990,16 +8990,16 @@
"packages-dev": [
{
"name": "barryvdh/laravel-debugbar",
- "version": "v3.10.4",
+ "version": "v3.10.5",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
- "reference": "09d3dc77d7dc1b063e3728a6029c39ee0fbebf1d"
+ "reference": "d1a48965f2b25a6cec2eea07d719b568a37c9a88"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/09d3dc77d7dc1b063e3728a6029c39ee0fbebf1d",
- "reference": "09d3dc77d7dc1b063e3728a6029c39ee0fbebf1d",
+ "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/d1a48965f2b25a6cec2eea07d719b568a37c9a88",
+ "reference": "d1a48965f2b25a6cec2eea07d719b568a37c9a88",
"shasum": ""
},
"require": {
@@ -9058,7 +9058,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
- "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.10.4"
+ "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.10.5"
},
"funding": [
{
@@ -9070,20 +9070,20 @@
"type": "github"
}
],
- "time": "2024-02-14T08:52:12+00:00"
+ "time": "2024-02-15T10:45:45+00:00"
},
{
"name": "barryvdh/laravel-ide-helper",
- "version": "v2.15.0",
+ "version": "v2.15.1",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
- "reference": "dca3ebe81ea385632651791cb8b3db42153c380c"
+ "reference": "77831852bb7bc54f287246d32eb91274eaf87f8b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/dca3ebe81ea385632651791cb8b3db42153c380c",
- "reference": "dca3ebe81ea385632651791cb8b3db42153c380c",
+ "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/77831852bb7bc54f287246d32eb91274eaf87f8b",
+ "reference": "77831852bb7bc54f287246d32eb91274eaf87f8b",
"shasum": ""
},
"require": {
@@ -9152,7 +9152,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-ide-helper/issues",
- "source": "https://github.com/barryvdh/laravel-ide-helper/tree/v2.15.0"
+ "source": "https://github.com/barryvdh/laravel-ide-helper/tree/v2.15.1"
},
"funding": [
{
@@ -9164,7 +9164,7 @@
"type": "github"
}
],
- "time": "2024-02-14T11:19:26+00:00"
+ "time": "2024-02-15T14:23:20+00:00"
},
{
"name": "barryvdh/reflection-docblock",
@@ -9651,16 +9651,16 @@
},
{
"name": "maximebf/debugbar",
- "version": "v1.20.1",
+ "version": "v1.20.2",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
- "reference": "06ebf922ccedfa4cc43015825697ee8c1fb80f7e"
+ "reference": "484625c23a4fa4f303617f29fcacd42951c9c01d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/06ebf922ccedfa4cc43015825697ee8c1fb80f7e",
- "reference": "06ebf922ccedfa4cc43015825697ee8c1fb80f7e",
+ "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/484625c23a4fa4f303617f29fcacd42951c9c01d",
+ "reference": "484625c23a4fa4f303617f29fcacd42951c9c01d",
"shasum": ""
},
"require": {
@@ -9711,9 +9711,9 @@
],
"support": {
"issues": "https://github.com/maximebf/php-debugbar/issues",
- "source": "https://github.com/maximebf/php-debugbar/tree/v1.20.1"
+ "source": "https://github.com/maximebf/php-debugbar/tree/v1.20.2"
},
- "time": "2024-02-13T19:03:14+00:00"
+ "time": "2024-02-15T10:49:09+00:00"
},
{
"name": "mockery/mockery",
diff --git a/config/app.php b/config/app.php
index 0b14d37b1b..a22045103c 100644
--- a/config/app.php
+++ b/config/app.php
@@ -114,7 +114,7 @@ use TwigBridge\ServiceProvider;
return [
'name' => envNonEmpty('APP_NAME', 'Firefly III'),
- 'env' => envNonEmpty('APP_ENV', 'local'),
+ 'env' => envNonEmpty('APP_ENV', 'production'),
'debug' => env('APP_DEBUG', false),
'url' => envNonEmpty('APP_URL', 'http://localhost'),
'timezone' => envNonEmpty('TZ', 'UTC'),
diff --git a/resources/views/partials/debug-table.twig b/resources/views/partials/debug-table.twig
index eb4a358161..f4526e8581 100644
--- a/resources/views/partials/debug-table.twig
+++ b/resources/views/partials/debug-table.twig
@@ -18,7 +18,7 @@
{# PHP version + settings #}
<tr>
<td>PHP version</td>
- <td>{{ system.php_version|escape }} / {{ system.interface }} / {{ system.php_os }}</td>
+ <td>{{ system.php_version|escape }} ({{ system.bits }}bits) / {{ system.interface }} / {{ system.php_os }} {{ system.uname }}</td>
</tr>
<tr>
<td>BCscale</td>