From e7ba75e59ecbb097db7fe92450d57d4695a5b4e2 Mon Sep 17 00:00:00 2001 From: Andi Dittrich Date: Sun, 29 Nov 2020 20:17:20 +0100 Subject: [PATCH 1/6] expose response object within filter callback --- CHANGES.md | 5 +++++ examples/express.js | 2 +- examples/koa.js | 2 +- lib/express.js | 2 +- package.json | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0c82dbf..770ad72 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,11 @@ CHANGELOG Branch 3.X.X ------------------------------------------------------ +### 3.1.0 ### + +* Added: exposed `express.js` response object within `filter()` callback + + ### 3.0.0 ### * Refactored the whole codebase diff --git a/examples/express.js b/examples/express.js index 25e94fb..7b28e1f 100644 --- a/examples/express.js +++ b/examples/express.js @@ -45,7 +45,7 @@ async function bootstrap(){ footer: 'Hello World', pagetitle: 'we are sorry - an internal error encountered', }, - filter: function(data){ + filter: function(data, req, res){ // remove footer //data.footer = null; return data; diff --git a/examples/koa.js b/examples/koa.js index 4fb0fcf..ba1a482 100644 --- a/examples/koa.js +++ b/examples/koa.js @@ -14,7 +14,7 @@ async function bootstrap(){ footer: 'Hello World', pagetitle: 'we are sorry - an internal error encountered', }, - filter: function(data){ + filter: function(data, ctx){ // remove footer //data.footer = null; return data; diff --git a/lib/express.js b/lib/express.js index df88839..1b6de54 100644 --- a/lib/express.js +++ b/lib/express.js @@ -27,7 +27,7 @@ async function createDispatcher(options={}){ // standard http-error-pages html: function(){ res.type('.html'); - res.send(_render(resources.template, resources.stylesheet, opt.filter(templateVars, req))) + res.send(_render(resources.template, resources.stylesheet, opt.filter(templateVars, req, res))) }, // json diff --git a/package.json b/package.json index 174ae82..e3c6b6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http-error-pages", - "version": "3.0.0", + "version": "3.1.0", "description": "Simple HTTP Error Pages. standalone + static + koa + express", "engines": { "node": ">=7.6" From 610ca5d348e96f12da35dade4d89565cc7bb6d05 Mon Sep 17 00:00:00 2001 From: Marcin Pietrzak Date: Thu, 10 Jun 2021 09:11:09 +0200 Subject: [PATCH 2/6] Add pl-PL config file. --- i18n/pages-pl-PL.json | 81 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 i18n/pages-pl-PL.json diff --git a/i18n/pages-pl-PL.json b/i18n/pages-pl-PL.json new file mode 100644 index 0000000..b2f89a0 --- /dev/null +++ b/i18n/pages-pl-PL.json @@ -0,0 +1,81 @@ +{ + + "400": { + "title": "Błędne zapytanie", + "message": "Serwer nie mógł przetworzyć żądania." + }, + "401": { + "title": "Brak uwierzytelnienia", + "message": "Żądany zasób wymaga uwierzytelnienia." + }, + + "403": { + "title": "brak dostępu", + "message": "Żądany zasób wymaga uwierzytelnienia." + }, + + "404": { + "title": "Nie znaleziono", + "message": "Nie można znaleźć żądanego zasobu, ale może on być ponownie dostępny w przyszłości." + }, + + "405": { + "title": "Nie dozwolona metoda", + "message": "Witryna nie bługuje wybranej metody." + }, + + "408": { + "title": "Upłynął limit czasu żadania", + "message": "Witryna przekroczyła limit czasu oczekiwania na żądanie przeglądarki." + }, + + "410": { + "title": "Nie znaleziono", + "message": "Nie można znaleźć żądanego zasobu, ale był on kiedyś dostępny." + }, + + "429": { + "title": "Za dużo zapytań", + "message": "Wysłano zbyt wiele zapytań w zbyt krótkim czasie." + }, + + "499": { + "title": "Żądanie zamknięcia", + "message": "Przeglądarka wsyłała żądanie przerwania" + }, + + "500": { + "title": "Witryna jest aktualnie niedostępna", + "message": "Wystąpił nieoczekiwany błąd.\nJuż pracujemy nad przywróceniem witryny." + }, + + "501": { + "title": "Brak obsługi", + "message": "Witryna nie jest w stanie obsłużyć takiego zapytania." + }, + + "502": { + "title": "Witryna jest aktualnie niedostępna", + "message": "Wystąpił nieoczekiwany błąd.\nJuż pracujemy nad przywróceniem witryny." + }, + + "503": { + "title": "Witryna jest aktualnie niedostępna", + "message": "Wystąpił nieoczekiwany błąd.\nJuż pracujemy nad przywróceniem witryny." + }, + + "520": { + "title": "Błąd — nieznany host", + "message": "Żądana nazwa hosta nie jest routowana. Używaj tylko nazw hostów, aby uzyskać dostęp do zasobów." + }, + + "521": { + "title": "Witryna jest aktualnie niedostępna", + "message": "Wystąpił nieoczekiwany błąd.\nJuż pracujemy nad przywróceniem witryny." + }, + + "533": { + "title": "Zaplanowana konserwacja", + "message": "Witryna jest obecnie niedostępna z powodu konserwacji.\nPracujemy na tym, aby wkrótce przywrócić ją do trybu online." + } +} From f203cbf6966e95f1dfc384d21ab284ce0e959e5a Mon Sep 17 00:00:00 2001 From: Marcin Pietrzak Date: Thu, 10 Jun 2021 10:39:52 +0200 Subject: [PATCH 3/6] typo --- i18n/pages-pl-PL.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/pages-pl-PL.json b/i18n/pages-pl-PL.json index b2f89a0..97a978b 100644 --- a/i18n/pages-pl-PL.json +++ b/i18n/pages-pl-PL.json @@ -10,7 +10,7 @@ }, "403": { - "title": "brak dostępu", + "title": "Brak dostępu", "message": "Żądany zasób wymaga uwierzytelnienia." }, From 4ea71e2b6f4241080db81d7507b557b631fe1db1 Mon Sep 17 00:00:00 2001 From: Gabriele Lauricella Date: Thu, 6 Apr 2023 09:59:43 +0200 Subject: [PATCH 4/6] Update 'gulp' and use 'sass' package instead of deprecated 'node-sass' --- gulpfile.js | 2 +- package.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 3ab2d29..43bb132 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,5 +1,5 @@ const _gulp = require('gulp'); -const _sass = require('gulp-sass'); +const _sass = require('gulp-sass')(require('sass')); const _prettyError = require('gulp-prettyerror'); const _cleanCSS = require('gulp-clean-css'); const _concat = require('gulp-concat'); diff --git a/package.json b/package.json index e3c6b6d..cfc2990 100644 --- a/package.json +++ b/package.json @@ -50,9 +50,10 @@ "gulp-clean-css": "^4.3.0", "gulp-concat": "^2.6.1", "gulp-prettyerror": "^2.0.0", - "gulp-sass": "^4.1.0", + "gulp-sass": "^5.1.0", "koa": "^2.13.0", - "less": "^3.11.3" + "less": "^3.11.3", + "sass": "^1.60.0" }, "dependencies": { "ejs": "^3.1.3", From 31671a2910ae65d52c93b0234bfcf713e56d413b Mon Sep 17 00:00:00 2001 From: Claude Perrin Date: Sat, 9 Sep 2023 08:51:04 +0200 Subject: [PATCH 5/6] add missing 504 Gateway Timeout error in all languages except existing one Italian --- docs/HTTP504.html | 13 +++++++++++++ i18n/pages-en_US.json | 6 ++++++ i18n/pages-es_VE.json | 6 ++++++ i18n/pages-fr_FR.json | 6 ++++++ i18n/pages-pl-PL.json | 5 +++++ i18n/pages-pt_BR.json | 6 ++++++ i18n/pages-zh_CN.json | 6 ++++++ 7 files changed, 48 insertions(+) create mode 100644 docs/HTTP504.html diff --git a/docs/HTTP504.html b/docs/HTTP504.html new file mode 100644 index 0000000..09b9e0e --- /dev/null +++ b/docs/HTTP504.html @@ -0,0 +1,13 @@ + + + + + + We've got some trouble | 504 - Webservice currently unavailable + + + +

Webservice currently unavailable 502

We've got some trouble with our backend upstream cluster.
Our service team has been dispatched to bring it back online.

+ + + diff --git a/i18n/pages-en_US.json b/i18n/pages-en_US.json index 257d5a4..9a771b9 100644 --- a/i18n/pages-en_US.json +++ b/i18n/pages-en_US.json @@ -45,6 +45,12 @@ "title": "Webservice currently unavailable", "message": "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online." }, + + // http proxy time out error + "504": { + "title": "Webservice currently unavailable", + "message": "We've got some trouble with our backend upstream cluster.\nOur service team has been dispatched to bring it back online." + }, // CUSTOM ERROR CODES // ======================================================= diff --git a/i18n/pages-es_VE.json b/i18n/pages-es_VE.json index 2b1508b..4becc96 100644 --- a/i18n/pages-es_VE.json +++ b/i18n/pages-es_VE.json @@ -51,6 +51,12 @@ "message": "Se encontró una condición inesperada. Nuestro equipo de servicio está abocado para colocarlo nuevamente en servicio." }, + // http 504 Gateway Timeout + "504": { + "title": "Servicio web proxy actualmente no disponible", + "message": "Tenemos algunos problemas con nuestro racimo. Nuestro equipo de servicio fue enviado para restablecerlo nuevamente en línea." + }, + //https://tools.ietf.org/html/rfc6585#section-6 // http 511 Network Authentication Required (offer a URL for login) diff --git a/i18n/pages-fr_FR.json b/i18n/pages-fr_FR.json index a6af9e1..438947c 100644 --- a/i18n/pages-fr_FR.json +++ b/i18n/pages-fr_FR.json @@ -45,6 +45,12 @@ "title": "Service Web actuellement indisponible", "message": "Nous avons quelques problèmes avec notre cluster en amont. Notre équipe de service a été dépêchée pour le remettre en ligne." }, + + // http proxy timeout error + "504": { + "title": "Service Web actuellement indisponible", + "message": "Nous avons quelques problèmes avec notre cluster en amont. Notre équipe de service a été dépêchée pour le remettre en ligne." + }, // CUSTOM ERROR CODES // ======================================================= diff --git a/i18n/pages-pl-PL.json b/i18n/pages-pl-PL.json index 97a978b..880177c 100644 --- a/i18n/pages-pl-PL.json +++ b/i18n/pages-pl-PL.json @@ -64,6 +64,11 @@ "message": "Wystąpił nieoczekiwany błąd.\nJuż pracujemy nad przywróceniem witryny." }, + "504": { + "title": "Witryna jest aktualnie niedostępna", + "message": "Wystąpił nieoczekiwany błąd.\nJuż pracujemy nad przywróceniem witryny." + }, + "520": { "title": "Błąd — nieznany host", "message": "Żądana nazwa hosta nie jest routowana. Używaj tylko nazw hostów, aby uzyskać dostęp do zasobów." diff --git a/i18n/pages-pt_BR.json b/i18n/pages-pt_BR.json index c5562fa..061ac7f 100644 --- a/i18n/pages-pt_BR.json +++ b/i18n/pages-pt_BR.json @@ -44,6 +44,12 @@ "message": "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente." }, + // http proxy timeout error + "504": { + "title": "Webservice atualmente indisponível", + "message": "Nós tivemos alguns problema com o nosso backend. Nosso time de serviços está trabalhando para deixar isso online novamente." + }, + // CUSTOM ERROR CODES // ======================================================= // webserver origin error diff --git a/i18n/pages-zh_CN.json b/i18n/pages-zh_CN.json index 097d652..2f12214 100644 --- a/i18n/pages-zh_CN.json +++ b/i18n/pages-zh_CN.json @@ -45,6 +45,12 @@ "title": "Webservice目前不可用", "message": "我们的后端上游服务器出现了问题。\n技术支持团队正在努力修复中。" }, + + // http proxy timeout error + "504": { + "title": "Webservice目前不可用", + "message": "我们的后端上游服务器出现了问题。\n技术支持团队正在努力修复中。" + }, // CUSTOM ERROR CODES // ======================================================= From 7d3966e9cd29a0e316430442e9885c25f86aece1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= Date: Fri, 9 Aug 2024 21:24:46 +0300 Subject: [PATCH 6/6] Add 405 and redirect pages aswell --- i18n/pages-en_US.json | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/i18n/pages-en_US.json b/i18n/pages-en_US.json index 9a771b9..1dcd54b 100644 --- a/i18n/pages-en_US.json +++ b/i18n/pages-en_US.json @@ -1,4 +1,31 @@ -{ +{ + // REDIRECT CODES + // ======================================================= + + "301": { + "title": "Moved Permanently", + "message": "We found it elsewhere." + }, + "302": { + "title": "Found", + "message": "We found it elsewhere." + }, + + "303": { + "title": "See Other", + "message": "We found it elsewhere." + }, + + "307": { + "title": "Temporary Redirect", + "message": "We found it elsewhere." + }, + + "308": { + "title": "Permanent Redirect", + "message": "We found it elsewhere." + }, + // STANDARD ERROR CODES // ======================================================= @@ -21,7 +48,12 @@ "title": "Resource not found", "message": "The requested resource could not be found but may be available again in the future." }, - + + "405": { + "title": "Method Not Allowed", + "message": "A request method is not supported for the requested resource." + }, + // internal server error "500": { "title": "Webservice currently unavailable", @@ -72,4 +104,4 @@ "title": "Scheduled Maintenance", "message": "This site is currently down for maintenance.\nOur service team is working hard to bring it back online soon." } -} \ No newline at end of file +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy