Command-line and Web Interface for Paperwork
Par Yves le jeudi 21 janvier 2016, 23:19 - Lien permanent
I am very fortunate that one jflesch on GitHub decided one day to create Paperwork! This excellent program evolved very quickly and is still improving. I manage all my official documents, invoices, and such, in Paperwork. Scan by scan, PDF import by PDF import, I am slowly approaching the 2000 documents, or 5000 pages. This program has proved invaluable in the past year alone, both for speeding up the processing of new documents, and for looking for old documents.
Yet I miss one feature: the possibility to search the database of documents (which is on my home server) from any computer or mobile device, without having to launch Paperwork, which is only installed on the main family PC.
Besides, as I often connect to my server from distant places using OpenSSH, the possibility to do command-line searches would be a big improvement over my current use of
grep, etc. Or I should rather say, my use of
grep, etc. Because…
Like many programmers, I tend to not let something like a missing program bother me too long. I wrote the missing program since it did not exist, and now I publish it, because it may be interesting to other people.
The command-line interface is usable on its own, and its output is in JSON format, so that humans and programs can both comfortably use it. The WEB interface is based on the command-line interface, and care has been taken to ensure that the combination is secure.
The command-line interface should run on any Linux system, as its requirements are very standard; it does not use any Paperwork component, nor does it use the python language. The WEB interface only needs PHP and sudo. The one real requirement is that the machine that hosts these interfaces needs access to Paperwork’s data, preferably on local storage, or through a mount point.
To get the program, first grab the public SSH “private key” called “id_gitolite_public” (attached to this article) and store it in your
.ssh/ folder with Unix rights
400. Then, in your
~/.ssh/config file, add something like this:
Finally, get the GIT repository with this command:
git clone public.yalis.fr:yves/paperweb
I think that I wrote all that was needed in the
README file, but drop a comment if something is not clear or if I forgot something.
In short, the only dependencies are Linux (with
sudo) and PHP. The CLI part is a single file, and the few files of the WEB part only need to be dropped to a PHP-enabled folder served by the web server (Apache, Nginx…).
- 2016-02-01 — Minor update because the code evolved a bit.
- 2017-02-16 — Fixed a typo: “yalic” instead of “yalis”…
- 2017-04-20 — Circumvent port-knocking with a dedicated port (2222). To all who could not access my Git, please accept my apologies!