wip: 🔕 temporary commit

This commit is contained in:
Paramtamtam 2024-06-29 00:49:59 +04:00
parent 5976f2903d
commit 1fa6e1de4f
No known key found for this signature in database
GPG Key ID: 366371698FAD0A2B
5 changed files with 3137 additions and 4 deletions

View File

@ -316,6 +316,8 @@ func (cmd *command) Run(ctx context.Context, log *logger.Logger, cfg *config.Con
// ![Used times](https://img.shields.io/badge/dynamic/json?
// url=https%3A%2F%2Ferror-pages.goatcounter.com%2Fcounter%2F%2Fuse-template%2Flost-in-space.json
// &query=%24.count&label=Used%20times)
//
// if you wish, you may view the collected statistics at any time here - https://error-pages.goatcounter.com/
go func() {
var tpl = url.QueryEscape(cfg.TemplateName)
@ -327,7 +329,7 @@ func (cmd *command) Run(ctx context.Context, log *logger.Logger, cfg *config.Con
return
}
req.Header.Set("User-Agent", "error-pages") // by default, the User-Agent is "Go-http-client/x.x"
req.Header.Set("User-Agent", fmt.Sprintf("Mozilla/5.0 (error-pages, rnd:%d)", time.Now().UnixNano()))
resp, respErr := (&http.Client{Timeout: 10 * time.Second}).Do(req) //nolint:mnd // don't care about the response
if respErr != nil {

View File

@ -12,10 +12,10 @@ import (
"gh.tarampamp.am/error-pages/internal/template"
)
const contentTypeHeader = "Content-Type"
// New creates a new handler that returns an error page with the specified status code and format.
func New(cfg *config.Config, log *logger.Logger) http.Handler { //nolint:funlen,gocognit,gocyclo
const contentTypeHeader = "Content-Type"
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var code uint16

3116
profile001.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 169 KiB

View File

@ -43,7 +43,7 @@
@media screen and (min-width: 2000px) {
html, body {
font-size: 22px;
font-size: 20px;
}
}

15
templates/readme.md Normal file
View File

@ -0,0 +1,15 @@
# Templates
Creating templates is a straightforward process, even for those unfamiliar
with [Go Template](https://pkg.go.dev/text/template). Here are a few things to keep in mind:
- The template should be a single page, without additional `css` or `js` files. However, you can load them from a
CDN or other GitHub repositories using [jsdelivr.com](https://www.jsdelivr.com/)
- Be sure to include the `<meta name="robots" content="nofollow,noarchive,noindex">` tag in the header
- You can use special "placeholders" (wrapped in `{{` and `}}`) for the rendering error code, message, and other
details
Built-in "placeholders" and functions with their examples can be found in the following files:
- [props.go](../internal/template/props.go)
- [template.go](../internal/template/template.go)