goaccess icon indicating copy to clipboard operation
goaccess copied to clipboard

HTML report view breaks copy&paste by constantly updating data

Open palant opened this issue 3 years ago • 2 comments

The HTML report will replace all table contents every second. If you want to copy some text out of the tables, you have to be really quick: you have a second to select the text and copy it. Once table contents are replaced, your selection will be gone, even if nothing actually changed.

The way the application is currently written, I don’t see an easy way to make this work correctly. Short of switching it a better framework, one could update each row individually rather than replacing all table contents at the same time here:

https://github.com/allinurl/goaccess/blob/9e4b7cf14e92f808b816c8c300331f2ae132b22f/resources/js/app.js#L1563-L1565

This would allow checking whether innerHTML you are assigning to a row is actually different from what the row currently has and dropping unnecessary assignments. This would require ensuring correct row count manually however rather than leaving it up to the template.

palant avatar Nov 16 '20 12:11 palant

I agree, checking each row may be the way to go. I concur also that having a framework would make things easier in these types of cases, though, I'm hesitant due to the overhead of adding one and keeping the report as light as possible.

allinurl avatar Nov 18 '20 01:11 allinurl

While deciding on framework or no framework is up to you of course, I thought that I would give you some background info: size of Vue.js runtime is 63 kB (uncompressed), it’s one of the smaller frameworks out there. Size of the application code will most likely increase as well, although only moderately. Code complexity should go down considerably however, as Vue components are way more readable than the templates used right now. Also, using them will make accidental introduction of XSS vulnerabilities impossible.

palant avatar Dec 04 '20 18:12 palant