2.4.1: Settings GPG, Localization, CLI DB migrate, minor improvements

This commit is contained in:
2024-05-11 16:12:15 +02:00
parent 7920d3164d
commit 150e4eb195
28 changed files with 636 additions and 241 deletions

View File

@@ -212,7 +212,7 @@ namespace Documents\Install {
$step = self::FINISH_INSTALLATION;
$req = new \Core\API\Settings\Set($context);
$success = $req->execute(["settings" => ["installation_completed" => "1"]]);
$success = $req->execute(["settings" => ["installation_completed" => true]]);
if (!$success) {
$this->errorString = $req->getLastError();
}
@@ -633,12 +633,12 @@ namespace Documents\Install {
}
$items[] = html_tag("li", $attr, [
html_tag("div", [], [
html_tag("h6", ["class" => "my-0"], $title),
html_tag("small", ["class" => "text-$statusColor"], $statusText),
], false),
html_tag("span", ["class" => "text-$statusColor"], $statusIcon, false)
], false);
html_tag("div", [], [
html_tag("h6", ["class" => "my-0"], $title),
html_tag("small", ["class" => "text-$statusColor"], $statusText),
], false),
html_tag("span", ["class" => "text-$statusColor"], $statusIcon, false)
], false);
}
return $items;
@@ -956,7 +956,7 @@ namespace Documents\Install {
html_tag("div", ["class" => "col-md-4 order-md-2 mb-4"], [
html_tag("h4", ["class" => "d-flex justify-content-between align-items-center mb-3"],
html_tag("span", ["class" => "text-muted"], "Progress"),
false
false
),
html_tag("ul", ["class" => "list-group mb-3"], $progressSidebar, false)
], false),
@@ -968,7 +968,7 @@ namespace Documents\Install {
], false)
], false),
], false),
false
);

View File

@@ -28,7 +28,7 @@ class Security extends Document {
$sql = $this->getContext()->getSQL();
$settings = $this->getSettings();
$mailSettings = Settings::getAll($sql, "^mail_");
$gpgKey = $settings->getContactGPGKey();
if ($activeRoute->getPattern() === "/.well-known/security.txt") {
@@ -39,7 +39,7 @@ class Security extends Document {
$expires = (new \DateTime())->setTime(0, 0, 0)->modify("+3 months");
$baseUrl = $settings->getBaseUrl();
$gpgKey = null;
// $gpgKey = null;
$lines = [
"# This project is based on the open-source framework hosted on https://github.com/rhergenreder/web-base",
@@ -53,19 +53,16 @@ class Security extends Document {
"",
];
if (isset($mailSettings["mail_contact"])) {
$lines[] = "Contact: " . $mailSettings["mail_contact"];
$contactAddress = $settings->getContactMail();
if (!empty($contactAddress)) {
$lines[] = "Contact: " . $contactAddress;
}
if (isset($mailSettings["mail_contact_gpg_key_id"])) {
$gpgKey = GpgKey::find($sql, $mailSettings["mail_contact_gpg_key_id"]);
if ($gpgKey) {
$lines[] = "Encryption: $baseUrl/.well-known/gpg-key.txt";
}
}
if ($gpgKey !== null) {
$lines[] = "Encryption: $baseUrl/.well-known/gpg-key.txt";
}
$code = implode("\n", $lines);
if ($gpgKey !== null) {
$res = GpgKey::sign($code, $gpgKey->getFingerprint());
if ($res["success"]) {
@@ -75,17 +72,14 @@ class Security extends Document {
return $code;
} else if ($activeRoute->getPattern() === "/.well-known/gpg-key.txt") {
if (isset($mailSettings["mail_contact_gpg_key_id"])) {
$gpgKey = GpgKey::find($sql, $mailSettings["mail_contact_gpg_key_id"]);
if ($gpgKey !== null) {
if ($gpgKey !== null) {
$res = $gpgKey->_export(true);
if ($res["success"]) {
header("Content-Type: text/plain");
$res = $gpgKey->_export(true);
if ($res["success"]) {
return $res["data"];
} else {
return "Error exporting public key: " . $res["msg"];
}
return $res["data"];
} else {
http_response_code(500);
return "Error exporting public key: " . $res["msg"];
}
} else {
http_response_code(412);