sbs20 / scanservjs

SANE scanner nodejs web ui
https://sbs20.github.io/scanservjs/
GNU General Public License v2.0
686 stars 137 forks source link

Feature request: extend afterScan to receive HTTP request headers (?) #710

Open jlbribeiro opened 6 months ago

jlbribeiro commented 6 months ago

First of all, thank you @sbs20 for your work on this project.

I'm thinking of setting up this project with a couple of family scanners; I want, however, to be able to sort the scanned files by user, with no user intervention. I respect the goal of this project is to keep it lean, and introducing the concept of users feels out-of-scope for you (even though there's a basic auth mechanism). Given the response to #357, and taking into account the introduction of afterScan (#483), I'm trying to come up with something that leverages the hooks mechanism, while keeping it fairly generic/extensible.

As far as I can tell (and please correct me if I'm wrong), the afterScan hook looks like the one I'm looking for, but it only receives information concerning the file that was just scanned.

I was thinking of something along these lines:

This, however, relies on scanservjs propagating the HTTP request headers from user click to afterScan; I'm not sure this is the best way of achieving this, so I'm hoping you have better suggestions. The reason for going with HTTP headers is because it feels "fairly" generic, since it allows other ways of sorting/enhancing files (deciding other processing pipelines based on this).

Some use-cases:

Again, thank you very much for your work, and wishes of a happy holiday season.