🧑‍💻 use request proto and domain for mail urls

This commit is contained in:
DrMaxNix 2024-02-11 13:20:04 +01:00
parent 6b8addab1a
commit 8989ad37b7
2 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,7 @@
<table>
<tbody>
<tr>
<td><img src="http://sbgg.localhost/static/logo-256.png" alt="" style="height: 64px;" /></td>
<td><img src="{{const:url_prefix}}/static/logo-256.png" alt="" style="height: 64px;" /></td>
<td><h1>SBGG.jetzt</h1></td>
</tr>
</tbody>
@ -73,7 +73,7 @@
{{main}}
<hr />
<center><a href="http://sbgg.localhost/api/newsletter/unsubscribe?key={{dataset:unsubscribe_key}}">{{text_unsubscribe}}</a></center>
<center><a href="{{const:url_prefix}}/api/newsletter/unsubscribe?key={{dataset:unsubscribe_key}}">{{text_unsubscribe}}</a></center>
</div>
<div class="footer">

View File

@ -5,6 +5,7 @@
use Flake\Id64;
use Flake\Project;
use Flake\Error;
use Flake\Request;
use PHPMailer\PHPMailer\PHPMailer;
class Newsletter {
@ -200,6 +201,7 @@
// constant
if($key === "const"){
if($value === "version") return Project::version();
if($value === "url_prefix") return ("http" . (Request::has_ssl() ? "s" : "") . "://" . Request::domain_raw_full());
Error::error(message: "Unknown constant name", data: ["value" => $value]);
}