Skip to content

Commit 806f551

Browse files
committed
Separate 404.html
1 parent d5445b2 commit 806f551

File tree

3 files changed

+60
-59
lines changed

3 files changed

+60
-59
lines changed

bin/build

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ $iterator = new CallbackFilterIterator($iterator, function (SplFileInfo $fileInf
5656

5757
foreach ($iterator as $fileInfo) {
5858
$file = str_replace(__ROOT__, '', $fileInfo->getRealPath());
59-
echo "Add file: " . $file . "\n";
59+
echo "+ " . $file . "\n";
6060
$phar->addFile($fileInfo->getRealPath(), $file);
6161

6262
if (!array_key_exists('nozip', $opt)) {
@@ -69,15 +69,19 @@ foreach ($iterator as $fileInfo) {
6969
}
7070

7171
// Add schema.json
72-
echo "Add file: /src/schema.json\n";
72+
echo "+ /src/schema.json\n";
7373
$phar->addFile(realpath(__DIR__ . '/../src/schema.json'), '/src/schema.json');
7474

7575
// Add Caddyfile
76-
echo "Add file: /recipe/provision/Caddyfile\n";
76+
echo "+ /recipe/provision/Caddyfile\n";
7777
$phar->addFile(realpath(__DIR__ . '/../recipe/provision/Caddyfile'), '/recipe/provision/Caddyfile');
7878

79+
// Add 404.html
80+
echo "+ /recipe/provision/404.html\n";
81+
$phar->addFile(realpath(__DIR__ . '/../recipe/provision/404.html'), '/recipe/provision/404.html');
82+
7983
// Add bin/dep file
80-
echo "Add file: /bin/dep\n";
84+
echo "+ /bin/dep\n";
8185
$depContent = file_get_contents(__ROOT__ . '/bin/dep');
8286
$depContent = str_replace("#!/usr/bin/env php\n", '', $depContent);
8387
$depContent = str_replace('__FILE__', 'str_replace("phar://", "", Phar::running())', $depContent);

recipe/provision/404.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>404 Not Found</title>
7+
<style>
8+
body {
9+
-moz-osx-font-smoothing: grayscale;
10+
-webkit-font-smoothing: antialiased;
11+
align-content: center;
12+
background: #343434;
13+
color: #fff;
14+
display: grid;
15+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
16+
font-size: 20px;
17+
justify-content: center;
18+
margin: 0;
19+
min-height: 100vh;
20+
}
21+
22+
main {
23+
padding: 0 30px;
24+
}
25+
26+
svg {
27+
animation: 2s ease-in-out infinite hover;
28+
}
29+
30+
@keyframes hover {
31+
0%, 100% {
32+
transform: translateY(0)
33+
}
34+
50% {
35+
transform: translateY(-8px)
36+
}
37+
}
38+
</style>
39+
</head>
40+
<body>
41+
<main>
42+
<svg width="68" viewBox="0 0 48 40" xmlns="http://www.w3.org/2000/svg">
43+
<path
44+
d="M41.8253 0.269788C44.8519 -0.884712 47.9239 1.84927 47.1284 4.98944L39.3219 35.8043C38.615 38.5948 35.2805 39.7475 33.0012 37.9892L19.9291 27.905C17.8765 26.3215 17.8492 23.2338 19.8735 21.6144L35.3856 9.20469C36.2481 8.51467 37.5067 8.65451 38.1967 9.51704C38.8868 10.3796 38.7469 11.6381 37.8844 12.3282L22.8693 24.3402C22.6163 24.5427 22.6197 24.9286 22.8762 25.1266L34.8414 34.3568C35.1263 34.5766 35.5431 34.4325 35.6315 34.0837L43.0145 4.94009C43.1139 4.54757 42.7299 4.20583 42.3516 4.35014L5.41328 18.44C4.96316 18.6117 4.99234 19.2581 5.4561 19.3885L12.954 21.4973C14.4463 21.917 15.5617 23.1612 15.8166 24.6903L17.2908 33.5357C17.3714 34.0193 18.0276 34.11 18.2364 33.6664L18.8254 32.4148C19.2957 31.4154 20.4872 30.9865 21.4866 31.4568C22.486 31.9271 22.915 33.1186 22.4446 34.118L21.1735 36.8193C19.5032 40.3685 14.2535 39.6429 13.6086 35.7737L11.9232 25.6611C11.8913 25.4699 11.7519 25.3144 11.5654 25.2619L2.9172 22.8296C-0.792895 21.7862 -1.02636 16.6153 2.5746 15.2417L41.8253 0.269788Z"
45+
fill="white"/>
46+
</svg>
47+
<h1>Not Found</h1>
48+
<p>The requested URL was not found on this server.</p>
49+
</main>
50+
</body>
51+
</html>

recipe/provision/website.php

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -15,62 +15,8 @@
1515
desc('Configures a server');
1616
task('provision:server', function () {
1717
run('usermod -a -G www-data caddy');
18-
$html = <<<'HTML'
19-
<!DOCTYPE html>
20-
<html lang="en">
21-
<head>
22-
<meta charset="UTF-8">
23-
<meta name="viewport" content="width=device-width, initial-scale=1">
24-
<title>404 Not Found</title>
25-
<style>
26-
body {
27-
-moz-osx-font-smoothing: grayscale;
28-
-webkit-font-smoothing: antialiased;
29-
align-content: center;
30-
background: #343434;
31-
color: #fff;
32-
display: grid;
33-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
34-
font-size: 20px;
35-
justify-content: center;
36-
margin: 0;
37-
min-height: 100vh;
38-
}
39-
main {
40-
padding: 0 30px;
41-
}
42-
svg {
43-
animation: 2s ease-in-out infinite hover;
44-
}
45-
@keyframes hover {
46-
0%, 100% {
47-
transform: translateY(0)
48-
}
49-
50% {
50-
transform: translateY(-8px)
51-
}
52-
}
53-
</style>
54-
</head>
55-
<body>
56-
<main>
57-
<svg width="48" height="38" viewBox="0 0 243 193">
58-
<title>Deployer</title>
59-
<g fill="none" fill-rule="evenodd">
60-
<path fill="#0CF" d="M242.781.39L.207 101.653l83.606 21.79z"/>
61-
<path fill="#00B3E0" d="M97.555 186.363l14.129-50.543L242.78.39 83.812 123.442l13.743 62.922"/>
62-
<path fill="#0084A6" d="M97.555 186.363l33.773-39.113-19.644-11.43-14.13 50.543"/>
63-
<path fill="#0CF" d="M131.328 147.25l78.484 45.664L242.782.391 111.683 135.82l19.644 11.429"/>
64-
</g>
65-
</svg>
66-
<h1>Not Found</h1>
67-
<p>The requested URL was not found on this server.</p>
68-
</main>
69-
</body>
70-
</html>
71-
HTML;
7218
run("mkdir -p /var/deployer");
73-
run("echo $'$html' > /var/deployer/404.html");
19+
upload(__DIR__ . '/404.html', '/var/deployer/404.html');
7420
})->oncePerNode();
7521

7622
desc('Provision website');

0 commit comments

Comments
 (0)