add manual timezone override
This commit is contained in:
@@ -1412,6 +1412,8 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
var headers = "";
|
||||
var content_length = 0;
|
||||
var eol = "\n";
|
||||
var timezone = "-0000";
|
||||
|
||||
if (typeof (data) === 'undefined' || data === null) data = '';
|
||||
if (typeof (headers_obj) === 'string') {
|
||||
// string to header object
|
||||
@@ -1435,6 +1437,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
// logged in
|
||||
headers_obj['wtv-mail-count'] = ssid_sessions[socket.ssid].mailstore.countUnreadMessages(0);
|
||||
}
|
||||
timezone = ssid_sessions[socket.ssid].getSessionData("timezone") || "-0000"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1483,8 +1486,15 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
wtvshared.getFileExt(socket_sessions[socket.id].request_headers.service_file_path).toLowerCase() !== "php" ||
|
||||
wtvshared.getFileExt(socket_sessions[socket.id].request_headers.service_file_path).toLowerCase() !== "cgi" ||
|
||||
socket_sessions[socket.id].request_headers.raw_file === true) {
|
||||
var last_modified = wtvshared.getFileLastModifiedUTCString(socket_sessions[socket.id].request_headers.service_file_path);
|
||||
if (last_modified) headers_obj["Last-Modified"] = last_modified;
|
||||
if (socket.res) {
|
||||
var last_modified_formatted = wtvshared.getFileLastModifiedUTCString(socket_sessions[socket.id].request_headers.service_file_path);
|
||||
} else {
|
||||
var last_modified = wtvshared.getFileLastModifiedUTCObj(socket_sessions[socket.id].request_headers.service_file_path);
|
||||
var strftime = require('strftime');
|
||||
var strf = strftime.timezone(timezone);
|
||||
var last_modified_formatted = strf("%a, %d %b %Y %H:%M:%S", last_modified);
|
||||
}
|
||||
if (last_modified_formatted) headers_obj["Last-Modified"] = last_modified_formatted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ else {
|
||||
var human_name = nickname;
|
||||
var userid = '1' + Math.floor(Math.random() * 1000000000000000000);
|
||||
var messenger_enabled = 0;
|
||||
var messenger_authorized = 0;
|
||||
var messenger_authorized = 0;
|
||||
var timezone = "-0000";
|
||||
if (request_headers.query.skip_splash) gourl = "wtv-home:/home?";
|
||||
else gourl = "wtv-home:/splash?";
|
||||
} else if (!session_data.getSessionData("registered")) {
|
||||
@@ -48,6 +49,7 @@ else {
|
||||
var messenger_enabled = session_data.getSessionData("messenger_enabled") || 0;
|
||||
var messenger_authorized = session_data.getSessionData("messenger_authorized") || 0;
|
||||
var messenger_email = session_data.getSessionData("messenger_email");
|
||||
var timezone = session_data.getSessionData("timezone") || "-0000";
|
||||
var gourl = "wtv-home:/splash?";
|
||||
}
|
||||
var limitedLogin = session_data.lockdown;
|
||||
@@ -87,10 +89,11 @@ wtv-expire-all: wtv-head-waiter:
|
||||
`;
|
||||
|
||||
if (!limitedLogin && !limitedLoginRegistered) {
|
||||
headers += `wtv-client-time-zone: GMT -0000
|
||||
|
||||
headers += `wtv-country: US
|
||||
wtv-client-time-zone: GMT ${timezone}
|
||||
wtv-client-time-dst-rule: GMT
|
||||
wtv-client-date: `+ strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + ` GMT
|
||||
wtv-country: US
|
||||
wtv-client-date: ${new Date().toUTCString()}
|
||||
wtv-language-header: en-US,en
|
||||
wtv-noback-all: wtv-
|
||||
wtv-transition-override: off
|
||||
|
||||
124
zefie_wtvp_minisrv/includes/ServiceVault/wtv-setup/timezone.js
Normal file
124
zefie_wtvp_minisrv/includes/ServiceVault/wtv-setup/timezone.js
Normal file
@@ -0,0 +1,124 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var timezone = "-0000";
|
||||
if (session_data.isRegistered()) {
|
||||
timezone = session_data.getSessionData("timezone") || timezone;
|
||||
if (request_headers.query.timezone) {
|
||||
timezone = request_headers.query.timezone;
|
||||
session_data.setSessionData("timezone", timezone);
|
||||
}
|
||||
}
|
||||
|
||||
strf = strftime.timezone(timezone)
|
||||
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
wtv-expire-all: wtv-
|
||||
wtv-expire-all: http
|
||||
wtv-client-time-zone: GMT -0000
|
||||
wtv-client-time-dst-rule: false
|
||||
wtv-client-date: ${strf("%a, %d %b %Y %H:%M:%S", new Date(new Date().setUTCSeconds(new Date().getUTCSeconds())))} GMT
|
||||
Content-Type: text/html`
|
||||
|
||||
|
||||
|
||||
html = `<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
Set Timezone
|
||||
</TITLE>
|
||||
<DISPLAY nosave skipback noscroll>
|
||||
</HEAD>
|
||||
<sidebar width=110> <table cellspacing=0 cellpadding=0 BGCOLOR="30364D">
|
||||
<tr>
|
||||
<td colspan=3 abswidth=104 absheight=4>
|
||||
<td rowspan=99 width=6 absheight=420 valign=top align=left>
|
||||
<img src="wtv-home:/ROMCache/Shadow.gif" width=6 height=420>
|
||||
<tr>
|
||||
<td abswidth=6>
|
||||
<td abswidth=92 absheight=76>
|
||||
<table href="wtv-home:/home" absheight=76 cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td align=right>
|
||||
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
|
||||
</table>
|
||||
<td abswidth=6>
|
||||
<tr><td absheight=5 colspan=3>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr><td abswidth=104 absheight=2 valign=middle align=center bgcolor="1C1E28">
|
||||
<img src="wtv-home:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<tr><td abswidth=104 absheight=1 valign=top align=left>
|
||||
<tr><td abswidth=104 absheight=2 valign=top align=left bgcolor="4D5573">
|
||||
<img src="wtv-home:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
</table>
|
||||
<tr><td absheight=37>
|
||||
<tr><td absheight=263 align=right colspan=3>
|
||||
<img src="ROMCache/AccountBanner.gif" width=53 height=263>
|
||||
<tr><td absheight=41>
|
||||
</table>
|
||||
</sidebar>
|
||||
<BODY BGCOLOR="#191919" TEXT="#44cc55" LINK="189CD6" VLINK="189CD6" HSPACE=0 VSPACE=0 FONTSIZE="large"
|
||||
>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td abswidth=14>
|
||||
<td abswidth=416 absheight=80 valign=center>
|
||||
<font size="+2" color="E7CE4A"><blackface><shadow>
|
||||
Set Timezone
|
||||
<td abswidth=20>
|
||||
<tr>
|
||||
<td>
|
||||
<td absheight=244 valign=top align=left>
|
||||
<form action="wtv-setup:/timezone" method="post">
|
||||
Current system time: <clock></clock><br><br>
|
||||
Your current timezone is set to: <b>${timezone}</b><br><br>`;
|
||||
|
||||
|
||||
const timezones = [
|
||||
["UTC-12:00", "-1200"], ["UTC-11:00", "-1100"], ["UTC-10:00", "-1000"], ["UTC-09:00", "-0900"], ["UTC-08:00", "-0800"],
|
||||
["UTC-07:00", "-0700"], ["UTC-06:00", "-0600"], ["UTC-05:00", "-0500"], ["UTC-04:00", "-0400"], ["UTC-03:00", "-0300"],
|
||||
["UTC-02:00", "-0200"], ["UTC-01:00", "-0100"], ["UTC±00:00", "-0000"], ["UTC+01:00", "+0100"], ["UTC+02:00", "+0200"],
|
||||
["UTC+03:00", "+0300"], ["UTC+04:00", "+0400"], ["UTC+05:00", "+0500"], ["UTC+06:00", "+0600"], ["UTC+07:00", "+0700"],
|
||||
["UTC+08:00", "+0800"], ["UTC+09:00", "+0900"], ["UTC+10:00", "+1000"], ["UTC+11:00", "+1100"], ["UTC+12:00", "+1200"]
|
||||
];
|
||||
|
||||
html += `<select name="timezone" onchange="this.form.submit()">\n`;
|
||||
for (const tz of timezones) {
|
||||
html += ` <option value="${tz[1]}" ${tz[1] === timezone ? 'selected' : ''}>${tz[0]}</option>\n`;
|
||||
}
|
||||
html += `</select>`;
|
||||
|
||||
html += `</form>
|
||||
<TR>
|
||||
<TD>
|
||||
<TD COLSPAN=4 HEIGHT=0 VALIGN=top ALIGN=left>
|
||||
<tr>
|
||||
<TD>
|
||||
<td colspan=3 height=2 valign=middle align=center bgcolor="2B2B2B">
|
||||
<spacer type=block width=436 height=1>
|
||||
<tr>
|
||||
<TD>
|
||||
<td colspan=4 height=1 valign=top align=left>
|
||||
<tr>
|
||||
<TD>
|
||||
<td colspan=3 height=2 valign=top align=left bgcolor="0D0D0D">
|
||||
<spacer type=block width=436 height=1>
|
||||
<TR>
|
||||
<TD>
|
||||
<TD COLSPAN=4 HEIGHT=4 VALIGN=top ALIGN=left>
|
||||
<TR>
|
||||
<TD>
|
||||
<TD COLSPAN=2 VALIGN=top ALIGN=left>
|
||||
<tr>
|
||||
<TD COLSPAN=2 VALIGN=top ALIGN=right>
|
||||
<FORM action="wtv-setup:/setup">
|
||||
<FONT COLOR="#E7CE4A" SIZE=-1><SHADOW>
|
||||
<INPUT TYPE=SUBMIT BORDERIMAGE="file://ROM/Borders/ButtonBorder2.bif" Value=Done NAME="Done" USESTYLE WIDTH=103>
|
||||
</SHADOW></FONT></FORM>
|
||||
<TD>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
`;
|
||||
|
||||
data = html;
|
||||
@@ -662,6 +662,10 @@ class WTVShared {
|
||||
return this.getFileLastModified(file).toUTCString();
|
||||
}
|
||||
|
||||
getFileLastModifiedUTCObj(file) {
|
||||
return new Date(new Date().setUTCSeconds(this.getFileLastModified(file).getUTCSeconds()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a RFC7231 compliant UTC Date String from the current time
|
||||
* @param {Number} offset Offset from current time (+/-)
|
||||
|
||||
Reference in New Issue
Block a user