admin/monitor: new "agent" column

Massimo Melina committed Feb 22, 2023 at 06:34 UTC be6d7f47dbea4def2e79a6545e9bf38bed9335d3
3 files changed +44 -7
admin/src/MonitorPage.ts
+4
@@ -143,6 +143,10 @@ function Connections() {
143 type: 'number',
144 valueFormatter: ({ value }) => formatBytes(value as number)
145 },
146 + {
147 + field: 'agent',
148 + headerName: "Agent",
149 + },
150 {
151 field: "Actions",
152 width: 80,
src/api.monitor.ts
+35
@@ -79,6 +79,7 @@ const apis: ApiHandlers = {
79 function fromCtx(ctx?: Koa.Context) {
80 return ctx && {
81 user: getCurrentUsername(ctx),
82 + agent: getBrowser(ctx.get('user-agent')),
83 archive: ctx.state.archive,
84 path: (ctx.fileSource || ctx.state.archive) && ctx.path // only for downloading files
85 }
@@ -107,3 +108,37 @@ function getConnAddress(conn: Connection) {
108 port: conn.socket.remotePort,
109 }
110 }
111 +
112 +function getBrowser(agent: string) {
113 + for (const [name,re] of Object.entries(BROWSERS))
114 + if (re.test(agent))
115 + return name
116 + return ''
117 +}
118 +const BROWSERS = {
119 + YaBrowser: /yabrowser/i,
120 + AlamoFire: /alamofire/i,
121 + Edge: /edge|edga|edgios|edg/i,
122 + PhantomJS: /phantomjs/i,
123 + Konqueror: /konqueror/i,
124 + Amaya: /amaya/i,
125 + Epiphany: /epiphany/i,
126 + SeaMonkey: /seamonkey/i,
127 + Flock: /flock/i,
128 + OmniWeb: /omniweb/i,
129 + Opera: /opera|OPR\//i,
130 + Chromium: /chromium/i,
131 + Facebook: /FBA[NV]/,
132 + Chrome: /chrome|crios/i,
133 + WinJs: /msapphost/i,
134 + IE: /msie|trident/i,
135 + Firefox: /firefox|fxios/i,
136 + Safari: /safari/i,
137 + PS5: /playstation 5/i,
138 + PS4: /playstation 4/i,
139 + PS3: /playstation 3/i,
140 + PSP: /playstation portable/i,
141 + PS: /playstation/i,
142 + Xbox: /xbox/i,
143 + UC: /UCBrowser/i,
144 +}
\ No newline at end of file
todo.md
+5 -7
@@ -1,11 +1,14 @@
1 # To do
2 +- blacklist of plugins (as a temporary measure until GitHub's intervention)
3 +- admin: warn in case of items with same name
4 +- admin/fs: button "copy url to clipboard"
5 +- frontend search supporting masks
6 +- plugin: list of IPs seen
7 - admin/fs: check if source exists when set
8 - plugins: after installing, switch to installed (and perhaps highlight new one)
9 - plugins' log, accessible in admin
10 - fix: cannot switch off https and switch on http at the same time
6 -- admin/monitor: show user-agent
11 - admin: check + update
8 -- multilanguage (i18n)
12 - frontend: hide closer button on login dialog accessing a protected resource, as it's no use
13 - generation of links to give access to a file
14 - an admin page where you can pick a file or folder(zip), and a link is generated
@@ -15,17 +18,13 @@
18 - show public ip use, https://github.com/sindresorhus/public-ip
19 - configure router with upnp. If it fails, suggest a guide. https://github.com/indutny/node-nat-upnp
20 - offer ddns registration/update
18 -- blacklist of plugins (as a temporary measure until GitHub's intervention)
21 - admin/fs: sort items
22 - admin/config: hide advanced settings
23 - admin/fs: support insert/delete key
22 -- admin/fs: button "copy url to clipboard"
24 - admin/monitor: show some info on what folder is browsing
25 - admin/fs: navigate file picker with keyboard
25 -- plugin: list of IPs seen
26 - plugin: automatic redirection from http to https
27 - admin: in a group, show linked accounts
28 -- admin: warn in case of items with same name
28 - command line help --help
29 - plugin download-counter: expose results on admin
30 - whitelist di ip
@@ -34,7 +33,6 @@
33 - log filter plugin
34 - admin: improve masks editor
35 - admin: warn before changing page if we have unsaved changes
37 -- frontend search supporting masks
36 - remove seconds from time
37 - plugin: upload quota per-account (possibly inheriting), and a default
38 - plugin: make letsencrypt easier