more patches to previous updates

- fixed getUnreadMailCount
- added unread mail count to login screen
- added session busted detection (new bug that when you restart minisrv it loses the user_id, so we send the client to relog) (todo: maybe add api to add key/value to ticket so we can retain data over server restarts)
This commit is contained in:
zefie
2022-02-08 04:58:16 -05:00
parent 07b5145dec
commit 433fc3db19
5 changed files with 45 additions and 24 deletions

View File

@@ -75,7 +75,6 @@ wtv-encrypted: true
wtv-ticket: ${wtvsec_login.ticket_b64}
`;
}
console.log(ssid_sessions[socket.ssid])
if (limitedLoginRegistered) gourl = "wtv-head-waiter:/password?";
headers += `
wtv-visit: ${gourl}`;

View File

@@ -86,7 +86,19 @@ for (const [key, value] of Object.entries(accounts)) {
if (key == "subscriber") data += `<font size=+1><b>${value['subscriber_username']}</b></font></a>`;
else data += `<font size=+1>${value['subscriber_username']}</font>`
data += "<td width=15><td nowrap> <font color=42BD52>";
data += "<!-- do mailcheck here -->" // todo
var userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
userSession.user_id = user_id;
var mailcount = 0;
if (userSession.mailstore.mailstoreExists()) {
if (userSession.mailstore.mailboxExists(0)) {
mailcount = userSession.mailstore.countUnreadMessages(0);
}
}
if (mailcount > 0) {
var mcnumber = (mailcount >= 100) ? "99+" : mailcount;
data += mcnumber + ` new message${(mcnumber != 1) ? 's' : ''}`;
}
data += `</font>
<tr>
<td>
@@ -107,6 +119,8 @@ for (const [key, value] of Object.entries(accounts)) {
while (accounts_listed < minisrv_config.config.user_accounts.max_users_per_account) {
data += `<tr>
<td>
<td absheight=37><tr>
<td>
<td bgcolor=1e1e1e width=400 absheight=2 colspan=3>
<img src="ROMCache/Spacer.gif" width=1 height=1>
<tr>
@@ -116,11 +130,6 @@ while (accounts_listed < minisrv_config.config.user_accounts.max_users_per_accou
<td>
<td bgcolor=121212 width=400 absheight=2 colspan=3>
<img src="ROMCache/Spacer.gif" width=1 height=1>`;
if (accounts_listed != minisrv_config.config.user_accounts.max_users_per_account - 1) {
data += `<tr>
<td>
<td absheight=37>`;
}
accounts_listed++;
}