1 Nmhive is a webserver for nmbug_, allowing you to remotely query and
2 manage notmuch_ tags. There is also a bookmarklet that provides a
3 convenient interface for managing tags while browsing Gmane_.
11 The versions shouldn't matter too much, but I'm testing with Flask
12 0.10.1 and Flask-Cors 1.9.0.
17 Launch the server with something like::
19 $ nmhive.py -H 0.0.0.0 -p 5000
20 * Running on http://0.0.0.0:5000/
23 Use nmbug's usual ``NMBGIT`` and ``NMBPREFIX`` environment variables
24 to configure the nmbug repository used by nmhive.
26 You can kill the server whenever you like (e.g. via ``ctrl+c``)
27 without worrying about corrupting your local notmuch or nmbug
30 Then edit ``nmbug_server`` in ``nmbug.js`` to point at that interface.
31 Serve ``nmbug.js`` and ``index.html`` somewhere. I serve them with
32 Nginx_, but you use whatever you like, including `Python's`__
33 `http.server`_ with something like::
35 $ python -m http.server 8000
39 Point your users to the served ``index.html`` so they can get the
40 bookmarklet and read the instructions for using it.
45 The nmhive server provides the following endpoints for use by the
46 bookmarklet (or other tools):
49 Returns the tags that are already stored in the nmbug database as a
50 JSON array. Instead of requiring admins to configure a list of
51 available tags, we just assume all the tags are in use (and that no
52 non-standard tags are in use) under the ``NMBPREFIX``.
54 ``GET /mid/<message-id>``
55 Returns tags associated with a particular message as a JSON array.
56 Returns a 404 if the given Message-ID isn't in the notmuch database.
58 ``POST /mid/<message-id>``
59 Updates the tags associated with a particular message. The posted
60 data should be a JSON array of tag-names with a prefix indicating
61 the desired change. Use ``+`` to add a tag and ``-`` to remove a
64 $ curl -XPOST -H 'Content-Type: application/json' -d '["+obsolete", "-needs-review"]' http://localhost:5000/mid/e630b6763e9d0771718afee41ea15b29bb4a1de8.1409935538.git.wking@tremily.us
67 Adding an already associated tag and removing an already
68 unassociated tag are both no-ops. Returns the updated tags as a
69 JSON array. Returns a 404 if the given Message-ID isn't in the
72 ``GET /gmane/<group>/<article>``
73 Returns the article's Message-ID as ``text/plain``. For example,
74 get the ``Message-ID`` of `this article`__ with::
76 $ curl -XGET http://localhost:5000/gmane/gmane.mail.notmuch.general/19007
77 e630b6763e9d0771718afee41ea15b29bb4a1de8.1409935538.git.wking@tremily.us
79 __ `Gmane Python nmbug v4`_
82 .. _nmbug: http://notmuchmail.org/nmbug/
83 .. _notmuch: http://notmuchmail.org/
84 .. _Gmane: http://gmane.org/
85 .. _Flask: http://flask.pocoo.org/
86 .. _Flask-Cors: https://pypi.python.org/pypi/Flask-Cors/
87 .. _Nginx: http://nginx.org/
88 .. _Python: https://www.python.org/
89 .. _http.server: https://docs.python.org/3/library/http.server.html
90 .. _Gmane Python nmbug v4: http://article.gmane.org/gmane.mail.notmuch.general/19007