Compare commits

...

12 Commits

Author SHA1 Message Date
501d141ce7 Update CHANGELOG.md 2021-07-20 18:32:37 +05:00
8c2155407a Update Dockerfile 2021-07-20 18:29:54 +05:00
a73173309c Update CI 2021-07-20 15:05:06 +05:00
2fa41ec4b8 Update README.md 2021-05-03 12:43:09 +05:00
0efccb0187 Update CHANGELOG.md 2021-05-02 16:06:42 +05:00
914d6572b7 Update 100-setup-error-pages.sh (#12)
Random template generator, also picked up `nginx-error-pages` template, which we don't want. Proposing small patch to exclude from `allowed_templates`
2021-05-02 16:03:54 +05:00
455bc21d51 Readme file updated 2021-04-28 13:09:16 +05:00
e4bba25dd2 Template hacker-terminal added (#13)
* Template hacker-terminal added

* Changelog updated

* Update README.md
2021-04-28 13:08:24 +05:00
2695a32834 Readme file updated 2021-04-22 10:54:40 +05:00
7b9051c63d Noise template (#10)
Co-authored-by: Ralph <RHITNL@users.noreply.github.com>
2021-04-22 01:53:59 +05:00
fbf13ebb9b Fix file permissions in docker file 2021-04-13 21:51:23 +05:00
80be5911a5 Readme file updated 2021-04-13 19:46:08 +05:00
13 changed files with 423 additions and 24 deletions

View File

@ -34,6 +34,7 @@ jobs:
with:
name: content
path: out/
retention-days: 1
- name: Switch to github pages branch
uses: actions/checkout@v2
@ -73,11 +74,18 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 # Action page: <https://github.com/docker/setup-buildx-action>
- name: Docker login in default registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_LOGIN }}" --password-stdin
- name: Login to default Container Registry
uses: docker/login-action@v1 # Action page: <https://github.com/docker/login-action>
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker login in ghcr.io # Auth docs: <https://git.io/JLDaw>
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login ghcr.io -u tarampampam --password-stdin
- name: Login to GitHub Container Registry
uses: docker/login-action@v1 # Action page: <https://github.com/docker/login-action>
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PASSWORD }}
- name: Generate builder values
id: values
@ -89,8 +97,8 @@ jobs:
--platform "linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7" \
--tag "tarampampam/error-pages:${{ steps.values.outputs.version }}" \
--tag "tarampampam/error-pages:latest" \
--tag "ghcr.io/tarampampam/error-pages:${{ steps.values.outputs.version }}" \
--tag "ghcr.io/tarampampam/error-pages:latest" \
--tag "ghcr.io/${{ github.actor }}/error-pages:${{ steps.values.outputs.version }}" \
--tag "ghcr.io/${{ github.actor }}/error-pages:latest" \
--file ./Dockerfile \
--push \
.

View File

@ -56,6 +56,8 @@ jobs: # Docs: <https://git.io/JvxXE>
test -f ./out/l7-dark/404.html
test -f ./out/l7-light/404.html
test -f ./out/shuffle/404.html
test -f ./out/noise/404.html
test -f ./out/hacker-terminal/404.html
docker-build:
name: Build docker image

View File

@ -4,6 +4,41 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
## v1.7.2
### Changed
- Nginx updated up to `1.21` (from `1.19`)
## v1.7.1
### Fixed
- Random template selecting (thx [@xpliz](https://github.com/xpliz)) [#12]
[#12]:https://github.com/tarampampam/error-pages/pull/12
## v1.7.0
### Added
- Template `hacker-terminal` [#13]
- HTML comments with error code and description into each template (header and footer, it seems more readable for curl usage)
[#10]:https://github.com/tarampampam/error-pages/pull/13
## v1.6.0
### Added
- Template `noise` [#10]
### Fixed
- File permissions in docker image
[#10]:https://github.com/tarampampam/error-pages/issues/10
## v1.5.0
### Changed

View File

@ -30,7 +30,7 @@ RUN set -x \
&& mv /src/docker/nginx-server.conf ./etc/nginx/conf.d/default.conf
# Image page: <https://hub.docker.com/_/nginx>
FROM --platform=${TARGETPLATFORM:-linux/amd64} nginx:1.19-alpine as runtime
FROM nginx:1.21-alpine as runtime
LABEL \
# Docs: <https://github.com/opencontainers/image-spec/blob/master/annotations.md>
@ -42,4 +42,6 @@ LABEL \
org.opencontainers.image.licenses="MIT"
# Import from builder
COPY --from=builder --chown=nginx /tmp/rootfs /
COPY --from=builder /tmp/rootfs /
RUN chown -R nginx:nginx /opt/html

View File

@ -22,12 +22,16 @@ Generated pages (from the latest release) always **[accessible here][link_gh_pag
## Templates
Name | Preview
:--------: | :-----:
`ghost` | ![ghost](https://hsto.org/webt/oj/cl/4k/ojcl4ko_cvusy5xuki6efffzsyo.gif)
`l7-light` | ![l7-light](https://hsto.org/webt/xc/iq/vt/xciqvty-aoj-rchfarsjhutpjny.png)
`l7-dark` | ![l7-dark](https://hsto.org/webt/s1/ih/yr/s1ihyrqs_y-sgraoimfhk6ypney.png)
`shuffle` | ![shuffle](https://hsto.org/webt/7w/rk/3m/7wrk3mrzz3y8qfqwovmuvacu-bs.gif)
Name | Preview
:---------------: | :-----:
`ghost` | [![ghost](https://hsto.org/webt/oj/cl/4k/ojcl4ko_cvusy5xuki6efffzsyo.gif)](https://tarampampam.github.io/error-pages/ghost/404.html)
`l7-light` | [![l7-light](https://hsto.org/webt/xc/iq/vt/xciqvty-aoj-rchfarsjhutpjny.png)](https://tarampampam.github.io/error-pages/l7-light/404.html)
`l7-dark` | [![l7-dark](https://hsto.org/webt/s1/ih/yr/s1ihyrqs_y-sgraoimfhk6ypney.png)](https://tarampampam.github.io/error-pages/l7-dark/404.html)
`shuffle` | [![shuffle](https://hsto.org/webt/7w/rk/3m/7wrk3mrzz3y8qfqwovmuvacu-bs.gif)](https://tarampampam.github.io/error-pages/shuffle/404.html)
`noise` | [![noise](https://hsto.org/webt/42/oq/8y/42oq8yok_i-arrafjt6hds_7ahy.gif)](https://tarampampam.github.io/error-pages/noise/404.html)
`hacker-terminal` | [![hacker-terminal](https://hsto.org/webt/5s/l0/p1/5sl0p1_ud_nalzjzsj5slz6dfda.gif)](https://tarampampam.github.io/error-pages/hacker-terminal/404.html)
> Note: `noise` template highly uses the CPU, be careful
## Usage
@ -39,15 +43,19 @@ Name | Description
--------------- | -----------
`TEMPLATE_NAME` | (`ghost` by default) "default" pages template _(allows to use error pages without passing theme name in URL - `http://127.0.0.1/500.html` instead `http://127.0.0.1/ghost/500.html`)_
Also, you can use a special template name `random` - in this case template will be selected randomly.
### Ready docker image
[![image stats](https://dockeri.co/image/tarampampam/error-pages)][link_docker_hub]
Execute in your shell:
```bash
$ docker run --rm -p "8082:8080" tarampampam/error-pages:X.X.X
```
> Important notice: do **not** use the `latest` image tag _(this is bad practice)_. Use versioned tag (like `1.2.3`) instead.
> Important notice: do **not** use the `latest` image tag _(this is bad practice)_. Use versioned tag (like `1.2.3`) instead. Docker hub mirror located [here (ghcr.io)][link_ghcr].
And open in your browser `http://127.0.0.1:8082/ghost/400.html`.
@ -89,7 +97,7 @@ FROM nginx:1.18-alpine
COPY --chown=nginx \
./nginx.conf /etc/nginx/conf.d/default.conf
COPY --chown=nginx \
--from=tarampampam/error-pages:1.5.0 \
--from=tarampampam/error-pages:1.7.0 \
/opt/html/ghost /usr/share/nginx/errorpages/_error-pages
```
@ -108,7 +116,7 @@ version: '3.4'
services:
error-pages:
image: tarampampam/error-pages:1.5.0
image: tarampampam/error-pages:1.7.0
environment:
TEMPLATE_NAME: l7-dark
networks:

View File

@ -15,6 +15,14 @@
{
"name": "shuffle",
"path": "./templates/shuffle.html"
},
{
"name": "noise",
"path": "./templates/noise.html"
},
{
"name": "hacker-terminal",
"path": "./templates/hacker-terminal.html"
}
],
"output": {

View File

@ -1,6 +1,11 @@
#!/usr/bin/env sh
set -e
# on `docker restart` next directory keep existing: <https://github.com/tarampampam/error-pages/issues/3>
if [ -d /opt/html/nginx-error-pages ]; then
rm -Rf /opt/html/nginx-error-pages;
fi;
# allows to use random template
if [ ! -z "$TEMPLATE_NAME" ] && ([ "$TEMPLATE_NAME" = "random" ] || [ "$TEMPLATE_NAME" = "RANDOM" ]); then
# find all templates in directory (only template directories must be located in /opt/html)
@ -27,11 +32,6 @@ fi;
# allows "direct access" to the error pages using URLs like "/500.html"
ln -f -s "/opt/html/$TEMPLATE_NAME/"* /opt/html;
# on `docker restart` next directory keep existing: <https://github.com/tarampampam/error-pages/issues/3>
if [ -d /opt/html/nginx-error-pages ]; then
rm -Rf /opt/html/nginx-error-pages;
fi;
# next directory is required for easy nginx `error_page` usage
mkdir /opt/html/nginx-error-pages;

View File

@ -1,4 +1,8 @@
<!DOCTYPE html>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@ -17,7 +21,8 @@
h3 {font-size:1.05em;text-transform: uppercase;margin:0.3em auto}
.description {font-size:0.8em;color:#aaa}
</style>
</head><body>
</head>
<body>
<div class="wrap">
<svg class="ghost" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="127.433px" height="132.743px" viewBox="0 0 127.433 132.743" enable-background="new 0 0 127.433 132.743" xml:space="preserve">
<path fill="#FFF6F4" d="M116.223,125.064c1.032-1.183,1.323-2.73,1.391-3.747V54.76c0,0-4.625-34.875-36.125-44.375 s-66,6.625-72.125,44l-0.781,63.219c0.062,4.197,1.105,6.177,1.808,7.006c1.94,1.811,5.408,3.465,10.099-0.6 c7.5-6.5,8.375-10,12.75-6.875s5.875,9.75,13.625,9.25s12.75-9,13.75-9.625s4.375-1.875,7,1.25s5.375,8.25,12.875,7.875 s12.625-8.375,12.625-8.375s2.25-3.875,7.25,0.375s7.625,9.75,14.375,8.125C114.739,126.01,115.412,125.902,116.223,125.064z"></path>
@ -39,4 +44,9 @@
<h3>Error {{ code }}</h3>
<p class="description">{{ description }}</p>
</div>
</body></html>
</body>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
</html>

View File

@ -0,0 +1,130 @@
<!DOCTYPE html>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow" />
<title>{{ message }}</title>
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
<style>
/** Idea author: https://codepen.io/robinselmer */
html, body {
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
}
body {
box-sizing: border-box;
background-color: #000000;
background-image: radial-gradient(#11581E, #041607);
background-repeat: no-repeat;
background-size: cover;
font-family: 'Inconsolata', Helvetica, sans-serif;
font-size: 1.5rem;
color: rgba(128, 255, 128, 0.8);
text-shadow:
0 0 1ex rgba(51, 255, 51, 1),
0 0 2px rgba(255, 255, 255, 0.8);
}
.overlay {
pointer-events: none;
position: absolute;
width: 100%;
height: 100%;
background:
repeating-linear-gradient(
180deg,
rgba(0, 0, 0, 0) 0,
rgba(0, 0, 0, 0.3) 50%,
rgba(0, 0, 0, 0) 100%);
background-size: auto 4px;
z-index: 1;
}
.overlay::before {
content: "";
pointer-events: none;
position: absolute;
display: block;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background-image: linear-gradient(
0deg,
transparent 0%,
rgba(32, 128, 32, 0.2) 2%,
rgba(32, 128, 32, 0.8) 3%,
rgba(32, 128, 32, 0.2) 3%,
transparent 100%);
background-repeat: no-repeat;
animation: scan 7.5s linear 0s infinite;
}
@keyframes scan {
0% { background-position: 0 -100vh; }
35%, 100% { background-position: 0 100vh; }
}
.terminal {
box-sizing: inherit;
position: absolute;
height: 100%;
width: 1000px;
max-width: 100%;
padding: 4rem;
text-transform: uppercase;
}
.output {
color: rgba(128, 255, 128, 0.8);
text-shadow:
0 0 1px rgba(51, 255, 51, 0.4),
0 0 2px rgba(255, 255, 255, 0.8);
}
.output::before {
content: "> ";
}
a {
color: #fff;
text-decoration: none;
}
a::before {
content: "[";
}
a::after {
content: "]";
}
.error_code {
color: white;
}
</style>
</head>
<body>
<div class="overlay"></div>
<div class="terminal">
<h1>Error <span class="error_code">{{ code }}</span></h1>
<p class="output">{{ description }}.</p>
<p class="output">Good luck.</p>
</div>
</body>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
</html>

View File

@ -1,4 +1,8 @@
<!DOCTYPE html>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
<html lang="en">
<head>
<meta charset="utf-8">
@ -26,4 +30,8 @@
</div>
</div>
</body>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
</html>

View File

@ -1,4 +1,8 @@
<!DOCTYPE html>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
<html lang="en">
<head>
<meta charset="utf-8">
@ -26,4 +30,8 @@
</div>
</div>
</body>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
</html>

172
templates/noise.html Normal file
View File

@ -0,0 +1,172 @@
<!DOCTYPE html>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ code }}: {{ message }}</title>
<style>
html, body {
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
}
body {
font: 20px Hack, Helvetica, sans-serif;
color: #333;
}
canvas {
z-index: 1;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.frame {
z-index: 3;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: radial-gradient(ellipse at center, rgba(0, 0, 0, .1) 0%, rgba(0, 0, 0, .2) 19%, rgba(0, 0, 0, .9) 100%);
}
.frame div {
position: absolute;
left: 0;
top: -20%;
width: 100%;
height: 20%;
background-color: rgba(0, 0, 0, .12);
box-shadow: 0 0 30px rgba(0, 0, 0, .25);
animation: horizontalLine 12s linear infinite;
}
.frame div:nth-child(1) {
animation-delay: 0ms;
}
.frame div:nth-child(2) {
animation-delay: 4s;
}
.frame div:nth-child(3) {
animation-delay: 8s;
}
@keyframes horizontalLine {
0% {top: -20%}
100% {top: 100%}
}
.container-center {
height: 100%;
align-items: center;
display: flex;
justify-content: center;
}
.container-center div {
z-index: 2;
}
h1, h2 {
text-align: center;
color: transparent;
text-shadow: 0 0 10px rgba(0, 0, 0, .6);
}
h1 {
font: bold 13em Arial, sans-serif;
animation: codeText 2s linear infinite;
margin: 0;
}
@keyframes codeText {
0% {text-shadow: 0 0 15px rgba(0, 0, 0, .3)}
33% {text-shadow: 0 0 5px rgba(0, 0, 0, .2)}
66% {text-shadow: 0 0 10px rgba(0, 0, 0, .1)}
100% {text-shadow: 0 0 15px rgba(0, 0, 0, .3)}
}
h2 {
font: bold 2.5em Arial, sans-serif;
animation: descriptionText 4s linear infinite;
margin-bottom: 0;
}
@keyframes descriptionText {
0% {text-shadow: 0 0 10px rgba(0, 0, 0, .5)}
33% {text-shadow: 0 0 5px rgba(0, 0, 0, .1)}
66% {text-shadow: 0 0 5px rgba(0, 0, 0, .25)}
100% {text-shadow: 0 0 10px rgba(0, 0, 0, .5)}
}
</style>
</head>
<body>
<div class="container-center">
<div>
<h1>{{ code }}</h1>
<h2>{{ description }}</h2>
</div>
</div>
<div class="frame">
<div></div>
<div></div>
<div></div>
</div>
<canvas id="canvas"></canvas>
<script>
// main idea author: https://codepen.io/moklick
const $canvas = document.getElementById('canvas'),
width = Math.max(800, document.body.clientWidth),
height = Math.max(600, document.body.clientHeight);
$canvas.width = width;
$canvas.height = height;
const ctx = $canvas.getContext('2d');
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, width, height);
ctx.fill();
const imgData = ctx.getImageData(0, 0, width, height), pix = imgData.data;
const flickerInterval = window.setInterval(function () {
for (let i = 0; i < pix.length; i += 4) {
let color = (Math.random() * 255) + 50;
pix[i] = color;
pix[i + 1] = color;
pix[i + 2] = color;
}
ctx.putImageData(imgData, 0, 0);
}, 45);
window.addEventListener('beforeunload', function (/** @param BeforeUnloadEvent event */ event) {
window.clearInterval(flickerInterval);
});
</script>
</body>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
</html>

View File

@ -1,4 +1,8 @@
<!DOCTYPE html>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
<html lang="en">
<head>
<meta charset="utf-8">
@ -68,4 +72,8 @@
}, 350);
</script>
</body>
<!--
Error {{ code }}: {{ message }}
Description: {{ description }}
-->
</html>