diff --git a/zefie_wtvp_minisrv/includes/WTVShared.js b/zefie_wtvp_minisrv/includes/WTVShared.js
index bf363664..5b1c3024 100644
--- a/zefie_wtvp_minisrv/includes/WTVShared.js
+++ b/zefie_wtvp_minisrv/includes/WTVShared.js
@@ -675,34 +675,36 @@ class WTVShared {
doErrorPage(code, data = null, details = null, pc_mode = false) {
var headers = null;
+ var minisrv_config = this.minisrv_config;
switch (code) {
case 401:
- if (data === null) data = "Authorization Required.";
+ if (data === null) data = minisrv_config.config.errorMessages[code].replace(/\$\{(.+)\}/g, function (x) { return minisrv_config.config[x.replace("${", '').replace('}', '')] });
if (pc_mode) headers = "401 Unauthorized\n";
else headers = code + " " + data + "\n";
headers += "Content-Type: text/html\n";
break;
case 403:
- if (data === null) data = "The publisher of that page has not authorized you to view it.";
+ if (data === null) data = minisrv_config.config.errorMessages[code].replace(/\$\{(.+)\}/g, function (x) { return minisrv_config.config[x.replace("${", '').replace('}', '')] });
if (pc_mode) headers = "403 Forbidden\n";
else headers = code + " " + data + "\n";
headers += "Content-Type: text/html\n";
break;
case 404:
- if (data === null) data = "The service could not find the requested page.";
+ if (data === null) data = minisrv_config.config.errorMessages[code].replace(/\$\{(.+)\}/g, function (x) { return minisrv_config.config[x.replace("${", '').replace('}', '')] });
if (pc_mode) headers = "404 Not Found\n";
else headers = code + " " + data + "\n";
headers += "Content-Type: text/html\n";
break;
case 400:
case 500:
- if (data === null) data = this.minisrv_config.config.service_name + " ran into a technical problem.";
+ if (data === null) data = minisrv_config.config.errorMessages[code].replace(/\$\{(.+)\}/g, function (x) { console.log(x); return minisrv_config.config[x.replace("${", '').replace('}', '')] });
if (details) data += "
Details:
" + details;
if (pc_mode) headers = "500 Internal Server Error\n";
else headers = code + " " + data + "\n";
headers += "Content-Type: text/html\n";
break;
default:
+ if (data === null && this.minisrv_config.config.errorMessages[code]) data = minisrv_config.config.errorMessages[code].replace(/\$\{(.+)\}/g, function (x) { return minisrv_config.config[x.replace("${",'').replace('}','')] });
headers = code + " " + data + "\n";
headers += "Content-Type: text/html\n";
break;
diff --git a/zefie_wtvp_minisrv/includes/config.json b/zefie_wtvp_minisrv/includes/config.json
index 99be988e..0c0e6e3d 100644
--- a/zefie_wtvp_minisrv/includes/config.json
+++ b/zefie_wtvp_minisrv/includes/config.json
@@ -48,6 +48,13 @@
"max_length": 32,
"form_size": 16
},
+ "errorMessages": {
+ "400": "${service_name} ran into a technical problem. Please try again.",
+ "401": "Authorization Required.",
+ "403": "The publisher of that page has not authorized you to view it.",
+ "404": "The service could not find the requested page.",
+ "500": "${service_name} ran into a technical problem. Please try again."
+ },
"lockdownWhitelist": [
"wtv-1800:/preregister",
"wtv-head-waiter:/login",
diff --git a/zefie_wtvp_minisrv/user_config.example.json b/zefie_wtvp_minisrv/user_config.example.json
index dd46416f..57ba47d1 100644
--- a/zefie_wtvp_minisrv/user_config.example.json
+++ b/zefie_wtvp_minisrv/user_config.example.json
@@ -26,7 +26,32 @@
]
},
"hide_ssid_in_logs": true,
- "verbosity": 2
+ "verbosity": 2,
+ "errorMessages": {
+ "999": "My Custom Error Code Message",
+ "400": "${service_name} ran into a technical problem. Please try again.",
+ "401": "Authorization Required.",
+ "403": "The publisher of that page has not authorized you to view it.",
+ "404": "The service could not find the requested page.",
+ "500": "${service_name} ran into a technical problem. Please try again."
+ },
+ "lockdownWhitelist": [
+ "wtv-1800:/preregister",
+ "wtv-head-waiter:/login",
+ "wtv-head-waiter:/ValidateLogin",
+ "wtv-head-waiter:/login-stage-two",
+ "wtv-head-waiter:/relogin",
+ "wtv-head-waiter:/ROMCache/Spacer.gif",
+ "wtv-head-waiter:/ROMCache/NameStrip.gif",
+ "wtv-head-waiter:/images/PasswordBanner.gif",
+ "wtv-head-waiter:/ROMCache/UtilityBullet.gif",
+ "wtv-head-waiter:/images/NameBanner.gif",
+ "wtv-head-waiter:/bad-disk",
+ "wtv-head-waiter:/images/signin_new_mail.gif",
+ "wtv-head-waiter:/images/signin_no_mail.gif",
+ "wtv-log:/log",
+ "wtv-custom-service:/my-cool-page-everyone-should-have-access-to"
+ ]
},
"services": {
"wtv-1800": {