Skip to content

Commit

Permalink
fix Caddyfile config, update PHP dependencies, vendor in frontend dep…
Browse files Browse the repository at this point in the history
…endencies and define a Content Security Policy
  • Loading branch information
1ma committed Jul 30, 2024
1 parent 4ed83ae commit 42fb79b
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 72 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"uma/dic": "^4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.59",
"friendsofphp/php-cs-fixer": "^3.60",
"phpunit/phpunit": "^11.2",
"roave/security-advisories": "dev-latest"
},
Expand Down
147 changes: 78 additions & 69 deletions composer.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/caddy/Caddyfile-dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:80 {
root * /var/www/signet-faucet/web
file_server
encode zstd gzip
php_fastcgi php-fpm:9000
}
1 change: 1 addition & 0 deletions docs/caddy/Caddyfile-prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
faucet.example.com {
root * /var/www/signet-faucet/current/web
file_server
encode zstd gzip
php_fastcgi unix//run/php/php-fpm.sock {
resolve_root_symlink
Expand Down
1 change: 1 addition & 0 deletions src/DI/Faucet.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function provide(Container $c): void
$twig->getEnvironment()->addGlobal('faucet_max_btc', (string) $settings->maxOneTimeBtc);
$twig->getEnvironment()->addGlobal('use_captcha', $settings->useCaptcha);
$twig->getEnvironment()->addGlobal('use_password', null !== $settings->passwordBcryptHash);
$twig->getEnvironment()->addGlobal('random_nonce', base64_encode(random_bytes(12)));

return $twig;
});
Expand Down
6 changes: 4 additions & 2 deletions views/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="htmx-config" content='{"inlineStyleNonce":"{{ random_nonce }}"}'>
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'nonce-{{ random_nonce }}'; object-src 'none';">
<title>{{ faucet_name }}</title>
<script src="https://unpkg.com/htmx.org@2.0.0" integrity="sha384-wS5l5IKJBvK6sPTKa2WZ1js3d947pvWXbPJ1OmWfEuxLgeHcEbjUUA5i9V5ZkpCw" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.1/css/bulma.min.css" integrity="sha384-u1DpPo/VC1cCewPdLA1ujElPdm1c/ZVa5MNAV6930PlrYYXhoKH/+hui6tE7szxu" crossorigin="anonymous">
<script src="/js/htmx-2.0.1.min.js"></script>
<link rel="stylesheet" href="/css/bulma-1.0.2.min.css">
<link rel="stylesheet" href="/css/main.css">
</head>

Expand Down
3 changes: 3 additions & 0 deletions web/css/bulma-1.0.2.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/js/htmx-2.0.1.min.js

Large diffs are not rendered by default.

0 comments on commit 42fb79b

Please sign in to comment.