Various updates.

This commit is contained in:
James Cole 2024-02-18 11:35:08 +01:00
parent 997dc3814b
commit b1afaea1aa
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
9 changed files with 93 additions and 31 deletions

View File

@ -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

View File

@ -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();

View File

@ -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');
}

View File

@ -81,7 +81,6 @@ class ResetPasswordController extends Controller
return view('error', compact('message'));
}
$rules = [
'token' => 'required',
'email' => 'required|email',

View File

@ -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')),

View File

@ -0,0 +1,41 @@
<?php
/*
* TrustHosts.php
* Copyright (c) 2024 james@firefly-iii.org.
*
* 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(),
];
}
}

36
composer.lock generated
View File

@ -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",

View File

@ -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'),

View File

@ -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>