Fix signed links behind the Strato release rewrite (base URL), mail redirect for test environments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 22:24:31 +02:00
1 parent fd744edf8c
commit 565eee4325
4 files changed
+18

No files matched your search

+2
View File
@@ -43,6 +43,8 @@ MAIL_FROM_NAME="${APP_NAME}"
FEWO_OWNER_NAME="Brigitte Stommer"
FEWO_OWNER_EMAIL=fewo@stommer.de
FEWO_NOTIFICATION_EMAIL=fewo@stommer.de
# Nur Testbetrieb: alle E-Mails ausschließlich an diese Adresse (leer = normaler Versand)
FEWO_MAIL_REDIRECT_TO=
FEWO_BANK_ACCOUNT_HOLDER=
FEWO_BANK_IBAN=
FEWO_BANK_BIC=
+6
View File
@@ -4,6 +4,7 @@
use App\Support\StripImageMetadata;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent;
@@ -23,6 +24,11 @@ public function register(): void
*/
public function boot(): void
{
// Test environments: deliver every e-mail to one address only, so no guest gets test mails.
if (filled(config('fewo.mail_redirect_to'))) {
Mail::alwaysTo(config('fewo.mail_redirect_to'));
}
// Photos: remove metadata (GPS position, camera data) from uploaded originals, which stay downloadable.
Event::listen(MediaHasBeenAddedEvent::class, fn (MediaHasBeenAddedEvent $event) => StripImageMetadata::strip($event->media));
+3
View File
@@ -50,6 +50,9 @@
| Further retention periods (docs/LOESCHKONZEPT.md). The defaults are PROPOSALS – please have them
| confirmed according to the general legal opinion (tax advisor / legal advice) and adjust here.
*/
// Test environments: every e-mail goes to this address only (instead of guests/landlord). Empty = normal delivery.
'mail_redirect_to' => env('FEWO_MAIL_REDIRECT_TO'),
// Daily database backup (php artisan backup:database): number of dumps kept in storage/app/private/backups.
'backup' => [
'keep' => (int) env('FEWO_BACKUP_KEEP', 14),
+7
View File
@@ -13,6 +13,13 @@
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Strato: the domain points at the deployment folder and .htaccess forwards to releases/<version>/public.
// The script then lives below that path, so the base URL would contain it and signed links would not
// match. The site is always served from the domain root, therefore the script is reported as /index.php.
if (preg_match('~/(releases/[^/]+|current)/public/index\.php$~', $_SERVER['SCRIPT_NAME'] ?? '')) {
$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = '/index.php';
}
// Bootstrap Laravel and handle the request...
/** @var Application $app */
$app = require_once __DIR__.'/../bootstrap/app.php';