Skip to content
Snippets Groups Projects
Commit f1aa7207 authored by rswindell's avatar rswindell
Browse files

Allow the web user action verb to be configurable via options.web_browsing

(default: 'browsing' - to match web UI verbiage).
parent aa06cc9b
No related branches found
No related tags found
No related merge requests found
...@@ -230,7 +230,7 @@ function web_user_status(web_user, options) ...@@ -230,7 +230,7 @@ function web_user_status(web_user, options)
return output; return output;
} }
function web_users(max_inactivity) function web_users(max_inactivity, browsing)
{ {
var user = new User; var user = new User;
var users = []; var users = [];
...@@ -238,6 +238,8 @@ function web_users(max_inactivity) ...@@ -238,6 +238,8 @@ function web_users(max_inactivity)
const sessions = directory(system.data_dir + 'user/*.web'); const sessions = directory(system.data_dir + 'user/*.web');
if(!max_inactivity) if(!max_inactivity)
max_inactivity = 15 * 60; max_inactivity = 15 * 60;
if(!browsing)
browsing = 'browsing';
sessions.forEach(function (e) { sessions.forEach(function (e) {
const base = file_getname(e).replace(file_getext(e), ''); const base = file_getname(e).replace(file_getext(e), '');
...@@ -255,7 +257,7 @@ function web_users(max_inactivity) ...@@ -255,7 +257,7 @@ function web_users(max_inactivity)
} }
users.push({ users.push({
name: user.alias, name: user.alias,
action: session && session.action ? 'viewing ' + session.action : undefined, action: session && session.action ? (browsing + ' ' + session.action) : undefined,
age: user.age, age: user.age,
gender: user.gender, gender: user.gender,
location: user.location, location: user.location,
...@@ -274,6 +276,8 @@ function web_users(max_inactivity) ...@@ -274,6 +276,8 @@ function web_users(max_inactivity)
// In addition to the options properties supported by node_status(), also supports: // In addition to the options properties supported by node_status(), also supports:
// options.format - a printf-style format for the node status line (e.g. "%d %s") // options.format - a printf-style format for the node status line (e.g. "%d %s")
// options.include_web_users - if false, don't include web users in output/result // options.include_web_users - if false, don't include web users in output/result
// options.web_inactivity_timeout - seconds before considering a web user offline
// options.web_browsing - string to use to represent web actions (default: 'browsing')
function nodelist(print, active, listself, is_sysop, options) function nodelist(print, active, listself, is_sysop, options)
{ {
var others = 0; var others = 0;
...@@ -300,7 +304,7 @@ function nodelist(print, active, listself, is_sysop, options) ...@@ -300,7 +304,7 @@ function nodelist(print, active, listself, is_sysop, options)
output.push(line); output.push(line);
} }
if(options.include_web_users !== false) { if(options.include_web_users !== false) {
var web_user = web_users(options.web_inactivity_timeout); var web_user = web_users(options.web_inactivity_timeout, options.web_browsing);
for(var w in web_user) { for(var w in web_user) {
var line = format(options.format, ++n, web_user_status(web_user[w], options)); var line = format(options.format, ++n, web_user_status(web_user[w], options));
if(print) if(print)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment