mirror of
https://github.com/tarampampam/error-pages.git
synced 2024-08-30 18:22:40 +00:00
wip: 🔕 temporary commit
This commit is contained in:
parent
5976f2903d
commit
1fa6e1de4f
@ -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 {
|
||||
|
@ -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
3116
profile001.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 169 KiB |
@ -43,7 +43,7 @@
|
||||
|
||||
@media screen and (min-width: 2000px) {
|
||||
html, body {
|
||||
font-size: 22px;
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
|
15
templates/readme.md
Normal file
15
templates/readme.md
Normal 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)
|
Loading…
Reference in New Issue
Block a user