breaking change: doErrorPage moved to wtvshared.doErrorPage
- but I fixed flashrom error handling.. - added a passthrough for old scripts
This commit is contained in:
@@ -230,6 +230,37 @@ class WTVShared {
|
||||
});
|
||||
}
|
||||
|
||||
doErrorPage(code, data = null, pc_mode = false) {
|
||||
var headers = null;
|
||||
switch (code) {
|
||||
case 404:
|
||||
if (data === null) data = "The service could not find the requested page.";
|
||||
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 = "HackTV ran into a technical problem.";
|
||||
if (pc_mode) headers = "500 Internal Server Error\n";
|
||||
else headers = code + " " + data + "\n";
|
||||
headers += "Content-Type: text/html\n";
|
||||
break;
|
||||
case 401:
|
||||
if (data === null) data = "Access Denied.";
|
||||
if (pc_mode) headers = "401 Access Denied\n";
|
||||
else headers = code + " " + data + "\n";
|
||||
headers += "Content-Type: text/html\n";
|
||||
break;
|
||||
default:
|
||||
headers = code + " " + data + "\n";
|
||||
headers += "Content-Type: text/html\n";
|
||||
break;
|
||||
}
|
||||
console.error(" * doErrorPage Called:", code, data);
|
||||
return new Array(headers, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips bad things from paths
|
||||
* @param {string} base Base path
|
||||
|
||||
Reference in New Issue
Block a user