summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-06-16 12:54:10 +0200
committerTor Andersson <tor@ccxvii.net>2023-06-16 12:54:10 +0200
commitce182275027c3202a1fa4dcf6b0ed87ede79da37 (patch)
tree3370350545da3bf873f8ec51aaf4decf8f7d33be
parent634cdf0f3e0f3e92e14df4c400d83ccaf4156c9a (diff)
downloadserver-ce182275027c3202a1fa4dcf6b0ed87ede79da37.tar.gz
Update user last seen when connecting to websocket.
-rw-r--r--server.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/server.js b/server.js
index 07a6a9b..89b92d6 100644
--- a/server.js
+++ b/server.js
@@ -2267,8 +2267,10 @@ wss.on('connection', (socket, req) => {
let sid = login_cookie(req)
if (sid)
user_id = login_sql_select.get(sid)
- if (user_id)
+ if (user_id) {
socket.user = SQL_SELECT_USER_VIEW.get(user_id)
+ SQL_UPDATE_USER_LAST_SEEN.run(user_id)
+ }
socket.ip = req.headers["x-real-ip"] || req.ip || req.connection.remoteAddress || "0.0.0.0"
socket.title_id = req.query.title || "unknown"