diff --git a/user_config_README.md b/user_config_README.md index 8b8c0cfe..83f8ebe7 100644 --- a/user_config_README.md +++ b/user_config_README.md @@ -103,3 +103,16 @@ The `wtv-1800` example above shows how you could override the default port for a } ``` The `wtv-music` example above shows how you could disable a default service without modifying `config.json` + +``` + "http": { + "wtv-explanation": { + "401": "wtv-guide:/errors/invalidauth", + "403": "wtv-guide:/errors/unauthorized", + "404": "wtv-guide:/errors/notfound" + } + } +``` +The `http` example above shows how you could add a custom "Explain" button to the error message shown for a specific HTTP error. +This only applies to "http" and "https" sources (you do not need to define it in both, it will apply to both). Does not apply to +wtv-services. You can add an explain button to any HTTP code, not just the examples above. \ No newline at end of file diff --git a/zefie_wtvp_minisrv/app.js b/zefie_wtvp_minisrv/app.js index d2805c53..331d781e 100644 --- a/zefie_wtvp_minisrv/app.js +++ b/zefie_wtvp_minisrv/app.js @@ -523,6 +523,13 @@ async function doHTTPProxy(socket, request_headers) { headers["wtv-connection-close"] = true; } } + + if (minisrv_config.services['http']['wtv-explanation']) { + if (minisrv_config.services['http']['wtv-explanation'][res.statusCode]) { + headers['wtv-explanation-url'] = minisrv_config.services['http']['wtv-explanation'][res.statusCode]; + } + } + if (data_hex.substring(0, 8) == "0d0a0d0a") data_hex = data_hex.substring(8); if (data_hex.substring(0, 4) == "0a0a") data_hex = data_hex.substring(4); sendToClient(socket, headers, Buffer.from(data_hex, 'hex'));