Compare commits

...

2 Commits

Author SHA1 Message Date
zefie
f2e11f827f switch mail to domain_name 2026-05-03 13:30:30 -04:00
zefie
32b6129ae3 set domain name to minisrv.local, check content-length on proxies 2026-05-03 13:07:12 -04:00
7 changed files with 47 additions and 10 deletions

View File

@@ -57,7 +57,7 @@ Welcome to Mail 
In Mail, you can exchange typed messages—called
<i>m-mail</i>&#151;with anyone who is on ${minisrv_config.config.service_name}, as well as anyone using other compatible MiniSrvs around the world. This is your m-mail address:
<blockquote>
<b>${session_data.getSessionData("subscriber_username")}@${minisrv_config.config.service_name}</b>
<b>${session_data.getSessionData("subscriber_username")}@${minisrv_config.config.domain_name}</b>
</blockquote>
Choose <b>Begin</b> to start using Mail. <!-- Or to learn more,
choose this link:

View File

@@ -176,7 +176,7 @@ E-mail addresses for ${session_data.getSessionData("subscriber_username")}
<tr absheight=26>
<td rowspan=1000 abswidth=8>
<td colspan=3>
Your address is ${session_data.getSessionData("subscriber_username")}@${minisrv_config.config.service_name}
Your address is ${session_data.getSessionData("subscriber_username")}@${minisrv_config.config.domain_name}
<tr absheight=8>
<td colspan=3>
<img src="wtv-home:/ROMCache/Spacer.gif" width=1 height=8>
@@ -702,7 +702,7 @@ ${(!newaddress) ? `<input type=hidden name="id" value="${request_headers.query.i
let addrExists = false;
// dumbass protection for making addresses look proper in the list
let address = request_headers.query.address.split("@")[0];
address += `@${minisrv_config.config.service_name}`;
address += `@${minisrv_config.config.domain_name}`;
// sanity checks to make sure the user doesn't have duplicate names/addresses
address_book.forEach(user => {
if (user.name.includes(request_headers.query.nickname)) {
@@ -745,7 +745,7 @@ Location: wtv-mail:/addressbook`;
}
// dumbass protection for making addresses look proper in the list
address = address.split("@")[0];
address += `@${minisrv_config.config.service_name}`;
address += `@${minisrv_config.config.domain_name}`;
nameExists = false;
addrExists = false;
if (address_book.length > 1) {

View File

@@ -262,7 +262,7 @@ label="View saved e-mail messages">
<font sizerange=medium> ${message_list_string}
<table cellspacing=0 cellpadding=0 border=0>
<TR><TD maxlines="1">
${username}@${minisrv_config.config.service_name}
${username}@${minisrv_config.config.domain_name}
</TD></TR>
</TABLE>
</font><br>
@@ -321,7 +321,7 @@ ${message_font_close}
data += `
<font sizerange=medium> No ${(mailbox_name === "Inbox") ? `new e-mail messages for<table cellspacing=0 cellpadding=0 border=0>
<TR><TD maxlines="1">
${username}@${minisrv_config.config.service_name}
${username}@${minisrv_config.config.domain_name}
</TD></TR>
</TABLE>` : 'e-mail messages in mailbox ' + mailbox_name}
</font><br>

View File

@@ -127,7 +127,7 @@ Content-Type: audio/wav`;
const username = session_data.getSessionData("subscriber_username");
const userdisplayname = wtvshared.htmlEntitize(session_data.getSessionData("subscriber_name"));
const address = username + "@" + minisrv_config.config.service_name //minisrv_config.config.domain_name
const address = username + "@" + minisrv_config.config.domain_name //minisrv_config.config.domain_name
const notImplementedAlert = new clientShowAlert({
'image': minisrv_config.config.service_logo,
'message': "This feature is not available.",

View File

@@ -135,7 +135,8 @@ class WTVMSNTV2 {
handleData(socket, chunk) {
socket.buffer = Buffer.concat([socket.buffer, chunk]);
if (socket.buffer.length > parseFloat(this.minisrv_config.services[service_name].max_response_size || 128) * 1024 * 1024) {
const maxRequestBytes = this.maxProxyResponseBytes;
if (socket.buffer.length > maxRequestBytes) {
this.writeError(socket, 413, 'Request Entity Too Large');
socket.destroy();
return;
@@ -169,6 +170,11 @@ class WTVMSNTV2 {
});
const contentLength = parseInt(headers['content-length'] || '0', 10) || 0;
if (contentLength > 0 && contentLength > maxRequestBytes) {
this.writeError(socket, 413, 'Request Entity Too Large');
socket.destroy();
return;
}
const requestLength = headerEnd + 4 + contentLength;
if (socket.buffer.length < requestLength) return;
@@ -376,6 +382,11 @@ class WTVMSNTV2 {
}
});
const contentLength = parseInt(headers['content-length'] || '0', 10) || 0;
const maxRequestBytes = this.maxProxyResponseBytes;
if (contentLength > 0 && contentLength > maxRequestBytes) {
this.writeError(socket, 413, 'Request Entity Too Large');
return;
}
const requestLength = headerEnd + 4 + contentLength;
if (connection.buffer.length < requestLength) break;
const body = connection.buffer.slice(headerEnd + 4, requestLength);
@@ -1115,6 +1126,12 @@ class WTVMSNTV2 {
}
});
const contentLength = parseInt(headers['content-length'] || '0', 10) || 0;
const maxRequestBytes = this.maxProxyResponseBytes;
if (contentLength > 0 && contentLength > maxRequestBytes) {
this.writeError(socket, 413, 'Request Entity Too Large');
socket.destroy();
return;
}
const requestLength = headerEnd + 4 + contentLength;
if (socket.sslv2AppBuffer.length < requestLength) return;
const body = socket.sslv2AppBuffer.slice(headerEnd + 4, requestLength);
@@ -1242,6 +1259,12 @@ class WTVMSNTV2 {
});
const contentLength = parseInt(headers['content-length'] || '0', 10) || 0;
const maxRequestBytes = this.maxProxyResponseBytes;
if (contentLength > 0 && contentLength > maxRequestBytes) {
this.writeError(tlsSocket, 413, 'Request Entity Too Large');
tlsSocket.destroy();
return;
}
const requestLength = headerEnd + 4 + contentLength;
if (tlsSocket.buffer.length < requestLength) return;

View File

@@ -111,11 +111,24 @@ class WTVHTTP {
}
const req = this.proxy_agent.request(options, (res) => {
let total_data = 0;
let abortedBySize = false;
const maxBytes = 1024 * 1024 * parseFloat(this.minisrv_config.services[request_type].max_response_size || 16);
const responseContentLength = parseInt(res.headers['content-length'] || res.headers['Content-Length'] || '0', 10) || 0;
if (responseContentLength > 0 && responseContentLength > maxBytes) {
console.warn(` * Proxy response contains Content-Length ${responseContentLength} bytes > limit ${maxBytes} bytes, destroying...`);
abortedBySize = true;
res.destroy();
const errpage = this.wtvshared.doErrorPage(400, "The item chosen is too large to be used.");
this.sendToClient(socket, errpage[0], errpage[1]);
return;
}
res.on('data', d => {
if (abortedBySize) return;
data.push(d);
total_data += d.length;
if (total_data > 1024 * 1024 * parseFloat(this.minisrv_config.services[request_type].max_response_size || 16)) {
if (total_data > maxBytes) {
abortedBySize = true;
console.warn(` * Response data exceeded ${this.minisrv_config.services[request_type].max_response_size || 16}MB limit, destroying...`);
res.destroy();
const errpage = this.wtvshared.doErrorPage(400, "The item chosen is too large to be used.");
@@ -133,6 +146,7 @@ class WTVHTTP {
});
res.on('end', () => {
if (abortedBySize) return;
// For when http proxies behave correctly
if (!this.minisrv_config.services[request_type].external_proxy_is_http1 || data.length > 0) {
this.handleProxy(socket, request_type, request_headers, res, data);

View File

@@ -48,7 +48,7 @@
"show_diskmap": false, // Useful for debugging custom Diskmaps
"unauthorized_url": "wtv-1800:/unauthorized?", // Where to send unauthorized users
"enable_port_isolation": true, // Only respond to services on their correct ports
"domain_name": "wtv.zefie.com", // For usenet and future stuff, no need to change just yet,
"domain_name": "minisrv.local", // For MSNTV2 stuff
"max_post_length": 20, // in megabytes
"require_valid_ssid": false, // require a valid SSID (with valid CRC)
"user_accounts": { // user account settings