diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-06-16 12:54:10 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-06-16 12:54:10 +0200 |
commit | ce182275027c3202a1fa4dcf6b0ed87ede79da37 (patch) | |
tree | 3370350545da3bf873f8ec51aaf4decf8f7d33be | |
parent | 634cdf0f3e0f3e92e14df4c400d83ccaf4156c9a (diff) | |
download | server-ce182275027c3202a1fa4dcf6b0ed87ede79da37.tar.gz |
Update user last seen when connecting to websocket.
-rw-r--r-- | server.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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" |