CSP fix + install update
This commit is contained in:
parent
a7fa180c64
commit
f9ecf795c2
@ -24,18 +24,6 @@ class CreateDatabase extends DatabaseScript {
|
||||
->addString("cookie", 26)
|
||||
->unique("day", "cookie");
|
||||
|
||||
$queries[] = Route::getHandler($sql)->getInsertQuery([
|
||||
new DocumentRoute("/admin", false, \Core\Documents\Admin::class),
|
||||
new DocumentRoute("/register", true, \Core\Documents\Account::class, "account/register.twig"),
|
||||
new DocumentRoute("/confirmEmail", true, \Core\Documents\Account::class, "account/confirm_email.twig"),
|
||||
new DocumentRoute("/acceptInvite", true, \Core\Documents\Account::class, "account/accept_invite.twig"),
|
||||
new DocumentRoute("/resetPassword", true, \Core\Documents\Account::class, "account/reset_password.twig"),
|
||||
new DocumentRoute("/login", true, \Core\Documents\Account::class, "account/login.twig"),
|
||||
new DocumentRoute("/resendConfirmEmail", true, \Core\Documents\Account::class, "account/resend_confirm_email.twig"),
|
||||
new DocumentRoute("/debug", true, \Core\Documents\Info::class),
|
||||
new StaticFileRoute("/", true, "/static/welcome.html"),
|
||||
]);
|
||||
|
||||
$queries[] = $sql->createTable("Settings")
|
||||
->addString("name", 32)
|
||||
->addString("value", 1024, true)
|
||||
|
@ -11,6 +11,6 @@ class Admin extends TemplateDocument {
|
||||
$this->title = "Administration";
|
||||
$this->searchable = false;
|
||||
$this->enableCSP();
|
||||
$this->addCSPWhitelist("/js/admin-panel/");
|
||||
$this->addCSPWhitelist("/react/dist/admin-panel/");
|
||||
}
|
||||
}
|
@ -244,24 +244,12 @@ namespace Documents\Install {
|
||||
$success = false;
|
||||
}
|
||||
|
||||
if (function_exists("posix_getuid")) {
|
||||
$userId = posix_getuid();
|
||||
if (fileowner(WEBROOT) !== $userId) {
|
||||
$username = posix_getpwuid($userId)['name'];
|
||||
$failedRequirements[] = sprintf("<b>%s</b> is not owned by current user: $username ($userId). " .
|
||||
"Try running <b>chown -R $userId %s</b> or give the required directories write permissions: " .
|
||||
"<b>Site/Configuration</b>, <b>Site/Cache</b>, <b>Site/Logs</b>, <b>Core/External</b>",
|
||||
WEBROOT, WEBROOT);
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists("yaml_emit")) {
|
||||
$failedRequirements[] = "<b>YAML</b> extension is not installed.";
|
||||
$success = false;
|
||||
}
|
||||
|
||||
$requiredVersion = '8.0';
|
||||
$requiredVersion = '8.1';
|
||||
if (version_compare(PHP_VERSION, $requiredVersion, '<')) {
|
||||
$failedRequirements[] = "PHP Version <b>>= $requiredVersion</b> is required. Got: <b>" . PHP_VERSION . "</b>";
|
||||
$success = false;
|
||||
|
@ -229,4 +229,18 @@ abstract class Route extends DatabaseEntity {
|
||||
public function setExact(bool $exact) {
|
||||
$this->exact = $exact;
|
||||
}
|
||||
|
||||
public static function getPredefinedValues(): array {
|
||||
return [
|
||||
new DocumentRoute("/admin", false, \Core\Documents\Admin::class),
|
||||
new DocumentRoute("/register", true, \Core\Documents\Account::class, "account/register.twig"),
|
||||
new DocumentRoute("/confirmEmail", true, \Core\Documents\Account::class, "account/confirm_email.twig"),
|
||||
new DocumentRoute("/acceptInvite", true, \Core\Documents\Account::class, "account/accept_invite.twig"),
|
||||
new DocumentRoute("/resetPassword", true, \Core\Documents\Account::class, "account/reset_password.twig"),
|
||||
new DocumentRoute("/login", true, \Core\Documents\Account::class, "account/login.twig"),
|
||||
new DocumentRoute("/resendConfirmEmail", true, \Core\Documents\Account::class, "account/resend_confirm_email.twig"),
|
||||
new DocumentRoute("/debug", true, \Core\Documents\Info::class),
|
||||
new StaticFileRoute("/", true, "/static/welcome.html"),
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user