start templating wtv-guide, improve WTVIRC

This commit is contained in:
zefie
2025-08-07 17:16:30 -04:00
parent fee0c0fa39
commit a6ce8fa90e
13 changed files with 456 additions and 370 deletions

View File

@@ -1,88 +0,0 @@
data = `
<html>
<head>
<title>Missing publisher's name</title>
<display
noscroll
showwhencomplete
>
</head>
<body hspace=0 vspace=0
text='E6E6E6' link='E6E6E6' vlink='E6E6E6'
fontsize='medium'
bgcolor=00292f
>
<table cellspacing=0 cellpadding=0>
<tr>
<td width=560 height=96 valign=top>
<table background="wtv-guide:/ROMCache/help/common/helpMastheadBlank.swf" width=560 height=96 cellspacing=0 cellpadding=0>
<tr>
<td width=107 height=96 valign=top rowspan=2>
<spacer type=vertical height=7><br>
<spacer type=horizontal width=7>
<a href='wtv-home:/home'>
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
</a>
<td width=453 valign=top>
<spacer type=vertical height=54><br>
<font size=+3><blackface>
Missing publisher's name&nbsp;
</blackface></font>
<tr>
<td align=right>
&nbsp;
</table>
<tr>
<td width=560 valign=top height=225>
<table cellpadding=0 cellspacing=0 width=560>
<tr>
<td width=25 height=17>
<td width=535>
<tr>
<td>
<td height=225 rowspan=2 valign=top>
<table cellpadding=0 cellspacing=0 height=225 width=535>
<tr>
<td height=15>
<tr>
<td>
<td valign=top>
Web addresses generally include a publisher's
name after the colon. This name is often called
a <i>host</i> name. In this address, <B>www.npr.org</B>
is the publisher's name:
<table>
<tr>
<td height=8>
<tr>
<td width=10>
<td><tt>http://<b>www.npr.org</b>/news/</tt>
</table>
<p>
This message appears if you don't include the publisher's
name in an address that you type.
<p>
<font size=-1>
<i>Technical details</i><br>
This is result&nbsp;&nbsp;<tt>400 Bad Request</tt>.
<tr>
<td width=35>
<td width=450>
<td width=50>
</table>
</table>
<tr>
<td valign=bottom align=right>
<form>
<font color=ffcf69><shadow>
<input type=button usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"
action="client:goback"
value="Done"
width='110'
selected>
<spacer type=horizontal width=20>
</shadow></font>
</form>
</table>
</body>
`;

View File

@@ -1,82 +0,0 @@
data = `
<html>
<head>
<title>Publisher problem</title>
<display
noscroll
showwhencomplete
>
</head>
<body hspace=0 vspace=0
text='E6E6E6' link='E6E6E6' vlink='E6E6E6'
fontsize='medium'
bgcolor=00292f
>
<table cellspacing=0 cellpadding=0>
<tr>
<td width=560 height=96 valign=top>
<table background="wtv-guide:/ROMCache/help/common/helpMastheadBlank.swf" width=560 height=96 cellspacing=0 cellpadding=0>
<tr>
<td width=107 height=96 valign=top rowspan=2>
<spacer type=vertical height=7><br>
<spacer type=horizontal width=7>
<a href='wtv-home:/home'>
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
</a>
<td width=453 valign=top>
<spacer type=vertical height=54><br>
<font size=+3><blackface>
Publisher problem&nbsp;
</blackface></font>
<tr>
<td align=right>
&nbsp;
</table>
<tr>
<td width=560 valign=top height=225>
<table cellpadding=0 cellspacing=0 width=560>
<tr>
<td width=25 height=17>
<td width=535>
<tr>
<td>
<td height=225 rowspan=2 valign=top>
<table cellpadding=0 cellspacing=0 height=225 width=535>
<tr>
<td height=15>
<tr>
<td>
<td valign=top>
This message means that
the publisher's computer experienced a technical
problem while it was trying to send you information.
<p>
This can occur because of a mistake made by the
author of a page or by the publisher.
You might want to try getting the page again,
though this problem is likely to happen again.
<p>
<font size=-1>
<i>Technical details</i><br>
This is result&nbsp;&nbsp;<tt>500 Internal Server Error</tt>.
<tr>
<td width=35>
<td width=450>
<td width=50>
</table>
</table>
<tr>
<td valign=bottom align=right>
<form>
<font color=ffcf69><shadow>
<input type=button usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"
action="client:goback"
value="Done"
width='110'
selected>
<spacer type=horizontal width=20>
</shadow></font>
</form>
</table>
</body>
`;

View File

@@ -1,83 +0,0 @@
data = `
<html>
<head>
<title>Page was not found</title>
<display
noscroll
showwhencomplete
>
</head>
<body hspace=0 vspace=0
text='E6E6E6' link='E6E6E6' vlink='E6E6E6'
fontsize='medium'
bgcolor=00292f
>
<table cellspacing=0 cellpadding=0>
<tr>
<td width=560 height=96 valign=top>
<table background="wtv-guide:/ROMCache/help/common/helpMastheadBlank.swf" width=560 height=96 cellspacing=0 cellpadding=0>
<tr>
<td width=107 height=96 valign=top rowspan=2>
<spacer type=vertical height=7><br>
<spacer type=horizontal width=7>
<a href='wtv-home:/home'>
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
</a>
<td width=453 valign=top>
<spacer type=vertical height=54><br>
<font size=+3><blackface>
Page was not found&nbsp;
</blackface></font>
<tr>
<td align=right>
&nbsp;
</table>
<tr>
<td width=560 valign=top height=225>
<table cellpadding=0 cellspacing=0 width=560>
<tr>
<td width=25 height=17>
<td width=535>
<tr>
<td>
<td height=225 rowspan=2 valign=top>
<table cellpadding=0 cellspacing=0 height=225 width=535>
<tr>
<td height=15>
<tr>
<td>
<td valign=top>
This message means that
the publisher could not find
a particular page that was requested.
<p>
If you were typing in a Web address, you
can check the address to make sure it is accurate.
<p>
This message also appears if a page's author
mistyped the address of another page.
<p>
<font size=-1>
<i>Technical details</i><br>
This is a server result&nbsp;&nbsp;<tt>404 Not Found</tt>.
<tr>
<td width=35>
<td width=450>
<td width=50>
</table>
</table>
<tr>
<td valign=bottom align=right>
<form>
<font color=ffcf69><shadow>
<input type=button usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"
action="client:goback"
value="Done"
width='110'
selected>
<spacer type=horizontal width=20>
</shadow></font>
</form>
</table>
</body>
`;

View File

@@ -1,81 +0,0 @@
data = `
<html>
<head>
<title>Publisher is too busy</title>
<display
noscroll
showwhencomplete
>
</head>
<body hspace=0 vspace=0
text='E6E6E6' link='E6E6E6' vlink='E6E6E6'
fontsize='medium'
bgcolor=00292f
>
<table cellspacing=0 cellpadding=0>
<tr>
<td width=560 height=96 valign=top>
<table background="wtv-guide:/ROMCache/help/common/helpMastheadBlank.swf" width=560 height=96 cellspacing=0 cellpadding=0>
<tr>
<td width=107 height=96 valign=top rowspan=2>
<spacer type=vertical height=7><br>
<spacer type=horizontal width=7>
<a href='wtv-home:/home'>
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
</a>
<td width=453 valign=top>
<spacer type=vertical height=54><br>
<font size=+3><blackface>
Publisher is too busy&nbsp;
</blackface></font>
<tr>
<td align=right>
&nbsp;
</table>
<tr>
<td width=560 valign=top height=225>
<table cellpadding=0 cellspacing=0 width=560>
<tr>
<td width=25 height=17>
<td width=535>
<tr>
<td>
<td height=225 rowspan=2 valign=top>
<table cellpadding=0 cellspacing=0 height=225 width=535>
<tr>
<td height=15>
<tr>
<td>
<td valign=top>
This message means that
the publisher of the page you're trying to reach
is so busy sending pages to other people on the
Internet that it can't handle your request right now.
<p>
Try again in a minute or two, and the publisher
might be less busy. Many publishers are busiest in the mid-morning and early evening.
<p>
<font size=-1>
<i>Technical details</i><br>
This is result&nbsp;&nbsp;<tt>503 Service Unavailable</tt>.
<tr>
<td width=35>
<td width=450>
<td width=50>
</table>
</table>
<tr>
<td valign=bottom align=right>
<form>
<font color=ffcf69><shadow>
<input type=button usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"
action="client:goback"
value="Done"
width='110'
selected>
<spacer type=horizontal width=20>
</shadow></font>
</form>
</table>
</body>
`;

View File

@@ -0,0 +1,30 @@
const nunjucks = require('nunjucks');
const path = require('path');
class WTVNunjucksTemplate {
page_args = {};
constructor(page_args) {
this.page_args = page_args;
}
getTemplatePage() {
// Configure nunjucks with the templates directory
const templatesPath = path.join(__dirname, '../templates');
const env = nunjucks.configure(templatesPath, {
autoescape: true,
throwOnUndefined: false
});
try {
// Render the template with the provided arguments
const rendered = env.render(this.page_args.template_name, this.page_args);
return rendered;
} catch (error) {
console.error('Error rendering Nunjucks template:', error);
return null;
}
}
}
module.exports = WTVNunjucksTemplate;

View File

@@ -0,0 +1,16 @@
{% set title = "Access is restricted" %}
{% set heading = "Access is restricted" %}
{% set error_code = "403 Forbidden" %}
{% set error_description = "result" %}
{% set content %}
This message means that
the publisher has restricted access to a page,
and will not allow you to see it.
<p>
Publishers sometimes restrict access to
limit the use of their information.
<p>
In general, it won't help to try again.
{% endset %}
{% include "error_base.njk" %}

View File

@@ -0,0 +1,22 @@
{% set title = "Missing publisher's name" %}
{% set heading = "Missing publisher's name" %}
{% set error_code = "400 Bad Request" %}
{% set error_description = "result" %}
{% set content %}
Web addresses generally include a publisher's
name after the colon. This name is often called
a <i>host</i> name. In this address, <B>www.npr.org</B>
is the publisher's name:
<table>
<tr>
<td height=8>
<tr>
<td width=10>
<td><tt>http://<b>www.npr.org</b>/news/</tt>
</table>
<p>
This message appears if you don't include the publisher's
name in an address that you type.
{% endset %}
{% include "error_base.njk" %}

View File

@@ -0,0 +1,16 @@
{% set title = "Publisher problem" %}
{% set heading = "Publisher problem" %}
{% set error_code = "500 Internal Server Error" %}
{% set error_description = "result" %}
{% set content %}
This message means that
the publisher's computer experienced a technical
problem while it was trying to send you information.
<p>
This can occur because of a mistake made by the
author of a page or by the publisher.
You might want to try getting the page again,
though this problem is likely to happen again.
{% endset %}
{% include "error_base.njk" %}

View File

@@ -0,0 +1,17 @@
{% set title = "Page was not found" %}
{% set heading = "Page was not found" %}
{% set error_code = "404 Not Found" %}
{% set error_description = "a server result" %}
{% set content %}
This message means that
the publisher could not find
a particular page that was requested.
<p>
If you were typing in a Web address, you
can check the address to make sure it is accurate.
<p>
This message also appears if a page's author
mistyped the address of another page.
{% endset %}
{% include "error_base.njk" %}

View File

@@ -0,0 +1,15 @@
{% set title = "Publisher is too busy" %}
{% set heading = "Publisher is too busy" %}
{% set error_code = "503 Service Unavailable" %}
{% set error_description = "result" %}
{% set content %}
This message means that
the publisher of the page you're trying to reach
is so busy sending pages to other people on the
Internet that it can't handle your request right now.
<p>
Try again in a minute or two, and the publisher
might be less busy. Many publishers are busiest in the mid-morning and early evening.
{% endset %}
{% include "error_base.njk" %}

View File

@@ -1,7 +1,6 @@
data = `
<html>
<head>
<title>Access is restricted</title>
<title>{{ title }}</title>
<display
noscroll
showwhencomplete
@@ -21,12 +20,12 @@ bgcolor=00292f
<spacer type=vertical height=7><br>
<spacer type=horizontal width=7>
<a href='wtv-home:/home'>
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
<img src="{{ minisrv_config.config.service_logo }}" width=87 height=67>
</a>
<td width=453 valign=top>
<spacer type=vertical height=54><br>
<font size=+3><blackface>
Access is restricted&nbsp;
{{ heading }}&nbsp;
</blackface></font>
<tr>
<td align=right>
@@ -47,18 +46,11 @@ Access is restricted&nbsp;
<tr>
<td>
<td valign=top>
This message means that
the publisher has restricted access to a page,
and will not allow you to see it.
<p>
Publishers sometimes restrict access to
limit the use of their information.
<p>
In general, it won't help to try again.
{{ content | safe }}
<p>
<font size=-1>
<i>Technical details</i><br>
This is result&nbsp;&nbsp;<tt>403 Forbidden</tt>.
This is {{ error_description }}&nbsp;&nbsp;<tt>{{ error_code }}</tt>.
<tr>
<td width=35>
<td width=450>
@@ -79,4 +71,4 @@ selected>
</form>
</table>
</body>
`;
</html>