Changes have been pushed for the repository "fawkes.git".
(Fawkes Robotics Software Framework)

Clone:  g...@git.fawkesrobotics.org:fawkes.git
Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, timn/webview-2.0 has been updated
        to  250ded3bff67e2fd240009cef48314c4354d22e2 (commit)
       via  bc8b45b5e08dff74c9c3bc825af35bdc9b8d899e (commit)
       via  8790f4cbcc55d0b3625f416f5df98304bad99ba3 (commit)
       via  a3204e81b7a983518bf0ad2030dbc3d2799ec9b2 (commit)
       via  6432e14e598f7940566dafc3f5ef1157d4805ed8 (commit)
       via  a32bb792aee78a73cae4efb70e77e0df54b96af4 (commit)
       via  b7886417cbb0eefb8b2cd1efa662941b0c920c27 (commit)
       via  8bb66470b214b10e6efddda18448643a703d7644 (commit)
       via  e9815a7a2dfeaff6524d39aa1ff738616d44cfc4 (commit)
       via  137cb0a9e5f23ed5d218824df6bade0289426e5d (commit)
       via  1fc44188cdae9ad8ee846dcc9c3be6f031299366 (commit)
       via  a0b7943e2a02ebb429301688c29a60c3f37346aa (commit)
       via  e965cf14173975d960baa32aa23abe8f1be1cc48 (commit)
      from  e88228fe28757bbd8cc48ace32be8fb0f32f8ee2 (commit)

http://git.fawkesrobotics.org/fawkes.git/timn/webview-2.0

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit e965cf14173975d960baa32aa23abe8f1be1cc48
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:02:13 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:02:13 2018 +0200

    libwebview: relax REST API reply type
    
    REST API handlers can now return arbitrary WebReply instances, not just
    WebviewRestReply. This is useful, for example, if the API returns
    dynamic replies or replies that contain images.

http://git.fawkesrobotics.org/fawkes.git/commit/e965cf1
http://trac.fawkesrobotics.org/changeset/e965cf1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit a0b7943e2a02ebb429301688c29a60c3f37346aa
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:03:43 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:03:43 2018 +0200

    libwebview: add functor to disable caching on reply

http://git.fawkesrobotics.org/fawkes.git/commit/a0b7943
http://trac.fawkesrobotics.org/changeset/a0b7943

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 1fc44188cdae9ad8ee846dcc9c3be6f031299366
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:07:16 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:07:16 2018 +0200

    webview: add image REST API, remove image processor
    
    This adds a new REST API to retrieve image information, images, and
    image streams. Thus it provides the same functionality as the old image
    processor. Move code to the new REST API and completely remove the old
    processor.

http://git.fawkesrobotics.org/fawkes.git/commit/1fc4418
http://trac.fawkesrobotics.org/changeset/1fc4418

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 137cb0a9e5f23ed5d218824df6bade0289426e5d
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:08:29 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:08:29 2018 +0200

    config: enable webview client-side caching by default
    
    Now that the files to serve for the frontend are static (versioned by
    hash in filename, but as long as the name is the same the content is the
    same), enable caching by default. Later override it for the truly
    dynamic content, i.e., the REST APIs.

http://git.fawkesrobotics.org/fawkes.git/commit/137cb0a
http://trac.fawkesrobotics.org/changeset/137cb0a

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit e9815a7a2dfeaff6524d39aa1ff738616d44cfc4
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:10:41 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:10:41 2018 +0200

    webview: disable caching for REST API replies
    
    The API replies are expected to change frequently, if not always.
    Therefore, disable caching on these by default.

http://git.fawkesrobotics.org/fawkes.git/commit/e9815a7
http://trac.fawkesrobotics.org/changeset/e9815a7

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 8bb66470b214b10e6efddda18448643a703d7644
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:11:31 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:11:31 2018 +0200

    webview-frontend: add fonts to service worker configuration
    
    Enable better caching for the included fonts.

http://git.fawkesrobotics.org/fawkes.git/commit/8bb6647
http://trac.fawkesrobotics.org/changeset/8bb6647

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit b7886417cbb0eefb8b2cd1efa662941b0c920c27
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:13:38 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:13:38 2018 +0200

    webview-frontend: disable chart refresh on blur, restart on focus
    
    When the window looses focus, for example when switching to another tab
    in the browser, disable automatic updates of Prometheus charts. If no
    one is looking we don't need to use bandwidth for this.
    
    If the window regains focus update the graphs and re-enable auto
    refresh.

http://git.fawkesrobotics.org/fawkes.git/commit/b788641
http://trac.fawkesrobotics.org/changeset/b788641

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit a32bb792aee78a73cae4efb70e77e0df54b96af4
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:23:19 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:23:19 2018 +0200

    webview-frontend: add image component
    
    Enables to list and view images and image streams.

http://git.fawkesrobotics.org/fawkes.git/commit/a32bb79
http://trac.fawkesrobotics.org/changeset/a32bb79

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 6432e14e598f7940566dafc3f5ef1157d4805ed8
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 19:23:53 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 19:23:53 2018 +0200

    webview-frontend: promchart legend click highlights clicked series
    
    The original behavior inherited from C3 is to hide a timeseries if
    clicking on its legend. Most of the time, that's not what I want.
    Rather, I want to highlight (or "zoom-in") on this particular series.
    
    Therefore, add a custom legend click handler that does exactly that.

http://git.fawkesrobotics.org/fawkes.git/commit/6432e14
http://trac.fawkesrobotics.org/changeset/6432e14

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit a3204e81b7a983518bf0ad2030dbc3d2799ec9b2
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 20:03:22 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 20:03:22 2018 +0200

    libwebview: support reverse proxy X-Forwarded-For header
    
    Set the client address to what the proxy said the original IP was. This
    is useful for better logging (logging the real IP rather than the
    proxy's IP).

http://git.fawkesrobotics.org/fawkes.git/commit/a3204e8
http://trac.fawkesrobotics.org/changeset/a3204e8

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 8790f4cbcc55d0b3625f416f5df98304bad99ba3
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 20:04:22 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 20:04:22 2018 +0200

    libwebview: only disallow re-registrations with same weight
    
    Allow that multiple handlers are registered for the same method/URL
    combination, as long as the weight is different.
    
    This can be used to preempt the file and catchall handler for automated
    services which should rather give 404 to indicate a missing
    service/plugin.

http://git.fawkesrobotics.org/fawkes.git/commit/8790f4c
http://trac.fawkesrobotics.org/changeset/8790f4c

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit bc8b45b5e08dff74c9c3bc825af35bdc9b8d899e
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 20:06:38 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 20:06:38 2018 +0200

    webview: add support for explicit high-weight 404
    
    Support the configuration of URLs for which a 404-handler with a very
    high weight should be registered. This will give a 404 for non-existent
    plugins rather than the frontend. This is useful for endpoints which are
    not user-facing, but rather are ingested by some other program. A 404 in
    that case can be more helpful than the index file.

http://git.fawkesrobotics.org/fawkes.git/commit/bc8b45b
http://trac.fawkesrobotics.org/changeset/bc8b45b

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 250ded3bff67e2fd240009cef48314c4354d22e2
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Sun Apr 8 20:08:15 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Sun Apr 8 20:08:15 2018 +0200

    config: configure 404 for /metrics and /xmlrpc

http://git.fawkesrobotics.org/fawkes.git/commit/250ded3
http://trac.fawkesrobotics.org/changeset/250ded3

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 cfg/conf.d/webview.yaml                            |   13 +-
 src/libs/webview/reply.cpp                         |   20 ++
 src/libs/webview/reply.h                           |    2 +
 src/libs/webview/request.cpp                       |   56 +++--
 src/libs/webview/rest_api.cpp                      |    2 +-
 src/libs/webview/rest_api.h                        |   14 +-
 src/libs/webview/router.h                          |    5 +-
 src/plugins/webview/Makefile                       |   25 +-
 src/plugins/webview/frontend/src/app/app.module.ts |    2 +
 .../webview/frontend/src/chrome/nav/template.html  |    4 +
 .../frontend/src/components/promchart/component.ts |   44 +++-
 src/plugins/webview/frontend/src/ngsw-config.json  |   11 +-
 .../frontend/src/parts/images/component.module.ts  |   30 +++
 .../images/components/overview.component.html      |   80 +++++++
 .../images/components/overview.component.scss      |   20 ++
 .../components/overview.component.spec.ts          |    0
 .../parts/images/components/overview.component.ts  |  157 ++++++++++++
 .../frontend/src/parts/images/models/ImageInfo.ts  |   32 +++
 .../webview/frontend/src/parts/images/module.ts    |   23 ++
 .../frontend/src/parts/images/routing.module.ts    |   18 ++
 .../frontend/src/parts/images/service.module.ts    |   12 +
 .../src/parts/images/services/api.service.ts       |   59 +++++
 .../webview/image-rest-api/ImageApiService.ts      |   59 +++++
 .../Makefile                                       |    0
 src/plugins/webview/image-rest-api/api.yaml        |  112 +++++++++
 .../webview/image-rest-api/image-rest-api.cpp      |  185 +++++++++++++++
 .../webview/image-rest-api/image-rest-api.h        |   72 ++++++
 .../image-rest-api/jpeg_stream_producer.cpp        |  229 ++++++++++++++++++
 .../webview/image-rest-api/jpeg_stream_producer.h  |  111 +++++++++
 src/plugins/webview/image-rest-api/mjpeg_reply.cpp |  134 +++++++++++
 src/plugins/webview/image-rest-api/mjpeg_reply.h   |   65 +++++
 .../webview/image-rest-api/model/ImageInfo.cpp     |  184 ++++++++++++++
 .../webview/image-rest-api/model/ImageInfo.h       |  250 ++++++++++++++++++++
 src/plugins/webview/image_processor.cpp            |  194 ---------------
 src/plugins/webview/image_processor.h              |   60 -----
 src/plugins/webview/jpeg_stream_producer.cpp       |  228 ------------------
 src/plugins/webview/jpeg_stream_producer.h         |  111 ---------
 src/plugins/webview/mjpeg_reply.cpp                |  134 -----------
 src/plugins/webview/mjpeg_reply.h                  |   63 -----
 src/plugins/webview/rest_processor.cpp             |   14 +-
 src/plugins/webview/static_processor.cpp           |    4 +-
 src/plugins/webview/webview_plugin.cpp             |    6 +
 src/plugins/webview/webview_thread.cpp             |   40 ++--
 src/plugins/webview/webview_thread.h               |   15 +-
 44 files changed, 2017 insertions(+), 882 deletions(-)
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/component.module.ts
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/components/overview.component.html
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/components/overview.component.scss
 copy src/plugins/webview/frontend/src/parts/{blackboard => 
images}/components/overview.component.spec.ts (100%)
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/components/overview.component.ts
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/models/ImageInfo.ts
 create mode 100644 src/plugins/webview/frontend/src/parts/images/module.ts
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/routing.module.ts
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/service.module.ts
 create mode 100644 
src/plugins/webview/frontend/src/parts/images/services/api.service.ts
 create mode 100644 src/plugins/webview/image-rest-api/ImageApiService.ts
 copy src/plugins/webview/{blackboard-rest-api => image-rest-api}/Makefile 
(100%)
 create mode 100644 src/plugins/webview/image-rest-api/api.yaml
 create mode 100644 src/plugins/webview/image-rest-api/image-rest-api.cpp
 create mode 100644 src/plugins/webview/image-rest-api/image-rest-api.h
 create mode 100644 src/plugins/webview/image-rest-api/jpeg_stream_producer.cpp
 create mode 100644 src/plugins/webview/image-rest-api/jpeg_stream_producer.h
 create mode 100644 src/plugins/webview/image-rest-api/mjpeg_reply.cpp
 create mode 100644 src/plugins/webview/image-rest-api/mjpeg_reply.h
 create mode 100644 src/plugins/webview/image-rest-api/model/ImageInfo.cpp
 create mode 100644 src/plugins/webview/image-rest-api/model/ImageInfo.h
 delete mode 100644 src/plugins/webview/image_processor.cpp
 delete mode 100644 src/plugins/webview/image_processor.h
 delete mode 100644 src/plugins/webview/jpeg_stream_producer.cpp
 delete mode 100644 src/plugins/webview/jpeg_stream_producer.h
 delete mode 100644 src/plugins/webview/mjpeg_reply.cpp
 delete mode 100644 src/plugins/webview/mjpeg_reply.h


- *Diffs* -------------------------------------------------------------

- *commit* e965cf14173975d960baa32aa23abe8f1be1cc48 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:02:13 2018 +0200
Subject: libwebview: relax REST API reply type

 src/libs/webview/rest_api.cpp |    2 +-
 src/libs/webview/rest_api.h   |   14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/webview/rest_api.cpp b/src/libs/webview/rest_api.cpp
index e6e1d90..5dd6903 100644
--- a/src/libs/webview/rest_api.cpp
+++ b/src/libs/webview/rest_api.cpp
@@ -70,7 +70,7 @@ WebviewRestApi::process_request(const WebRequest *request, 
const std::string & r
                WebviewRestParams params;
                params.set_path_args(std::move(path_args));
                params.set_query_args(request->get_values());
-               std::unique_ptr<WebviewRestReply> reply = 
handler(request->body(), params);
+               std::unique_ptr<WebReply> reply = handler(request->body(), 
params);
                return reply.release();
        } catch (NullPointerException &e) {
                return NULL;
diff --git a/src/libs/webview/rest_api.h b/src/libs/webview/rest_api.h
index a51852b..8e175fb 100644
--- a/src/libs/webview/rest_api.h
+++ b/src/libs/webview/rest_api.h
@@ -182,7 +182,7 @@ class WebviewRestApi
        WebviewRestApi(const std::string &name, fawkes::Logger *logger);
 
        /** REST API call handler function type. */
-       typedef std::function<std::unique_ptr<WebviewRestReply> (std::string, 
WebviewRestParams&)> Handler;
+       typedef std::function<std::unique_ptr<WebReply> (std::string, 
WebviewRestParams&)> Handler;
 
        const std::string &     name() const;
        void add_handler(WebRequest::Method method, std::string path, Handler 
handler);
@@ -196,11 +196,11 @@ class WebviewRestApi
         * @param handler handler function
         */
        void add_handler(WebRequest::Method method, std::string path,
-                        std::function<std::unique_ptr<WebviewRestReply> 
(WebviewRestParams &)> handler)
+                        std::function<std::unique_ptr<WebReply> 
(WebviewRestParams &)> handler)
        {
                add_handler(method, path,
                            [this, handler](const std::string &body, 
WebviewRestParams& m)
-                           -> std::unique_ptr<WebviewRestReply>
+                           -> std::unique_ptr<WebReply>
                            {
                                    try {
                                            return handler(m);
@@ -229,7 +229,7 @@ class WebviewRestApi
        {
                add_handler(method, path,
                            [this, handler](const std::string &body, 
WebviewRestParams& m)
-                           -> std::unique_ptr<WebviewRestReply>
+                           -> std::unique_ptr<WebReply>
                            {
                                    I input;
                                    input.from_json(body);
@@ -262,11 +262,11 @@ class WebviewRestApi
         */
        template <class I>
        void add_handler(WebRequest::Method method, std::string path,
-                        std::function<std::unique_ptr<WebviewRestReply> (I, 
WebviewRestParams &)> handler)
+                        std::function<std::unique_ptr<WebReply> (I, 
WebviewRestParams &)> handler)
        {
                add_handler(method, path,
                            [this, handler](const std::string &body, 
WebviewRestParams& m)
-                           -> std::unique_ptr<WebviewRestReply>
+                           -> std::unique_ptr<WebReply>
                            {
                                    I input;
                                    input.from_json(body);
@@ -296,7 +296,7 @@ class WebviewRestApi
        {
                add_handler(method, path,
                            [this, handler](const std::string &body, 
WebviewRestParams& m)
-                           -> std::unique_ptr<WebviewRestReply>
+                           -> std::unique_ptr<WebReply>
                            {
                                    try {
                                            O output{handler(m)};

- *commit* a0b7943e2a02ebb429301688c29a60c3f37346aa - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:03:43 2018 +0200
Subject: libwebview: add functor to disable caching on reply

 src/libs/webview/reply.cpp |   20 ++++++++++++++++++++
 src/libs/webview/reply.h   |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/webview/reply.cpp b/src/libs/webview/reply.cpp
index 59ee73b..da9f9fb 100644
--- a/src/libs/webview/reply.cpp
+++ b/src/libs/webview/reply.cpp
@@ -32,6 +32,26 @@ namespace fawkes {
 }
 #endif
 
+/** Disable caching on a reply.
+ * This is a convenience wrapper to reply->set_caching(false). It enables
+ * the following call styles:
+ * @code
+ * return no_caching(new StaticWebReply(Reply::HTTP_NOT_FOUND, "Not Found"));
+ *
+ * return no_caching(some_handler());
+ * @endcode
+ * This works on any reply without always patching a boolean flag into
+ * the ctor and without first storing the pointer, calling the function,
+ * and then returning.
+ * @param reply reply to disable caching for
+ * @return this
+ */
+WebReply *
+no_caching(WebReply *reply)
+{
+       reply->set_caching(false);
+       return reply;
+}
 
 
 /** @class WebReply <webview/reply.h>
diff --git a/src/libs/webview/reply.h b/src/libs/webview/reply.h
index 851e0a5..02bd206 100644
--- a/src/libs/webview/reply.h
+++ b/src/libs/webview/reply.h
@@ -152,6 +152,8 @@ class StaticWebReply : public WebReply
   std::string _body;
 };
 
+extern WebReply * no_caching(WebReply *reply);
+
 } // end namespace fawkes
 
 #endif

- *commit* 1fc44188cdae9ad8ee846dcc9c3be6f031299366 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:07:16 2018 +0200
Subject: webview: add image REST API, remove image processor

 src/plugins/webview/Makefile                       |   25 ++--
 .../webview/image-rest-api/ImageApiService.ts      |   59 ++++++
 .../Makefile                                       |    0
 src/plugins/webview/image-rest-api/api.yaml        |  112 +++++++++++
 .../webview/image-rest-api/image-rest-api.cpp      |  185 +++++++++++++++++++
 .../image-rest-api/image-rest-api.h}               |   42 ++--
 .../{ => image-rest-api}/jpeg_stream_producer.cpp  |   11 +-
 .../{ => image-rest-api}/jpeg_stream_producer.h    |    8 +-
 .../webview/{ => image-rest-api}/mjpeg_reply.cpp   |    6 +-
 .../webview/{ => image-rest-api}/mjpeg_reply.h     |   12 +-
 .../model/ImageInfo.cpp}                           |  101 +++++-----
 .../model/ImageInfo.h}                             |  122 +++++++------
 src/plugins/webview/image_processor.cpp            |  194 --------------------
 src/plugins/webview/image_processor.h              |   60 ------
 src/plugins/webview/webview_plugin.cpp             |    6 +
 src/plugins/webview/webview_thread.cpp             |   20 --
 src/plugins/webview/webview_thread.h               |   12 --
 17 files changed, 528 insertions(+), 447 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/webview/Makefile b/src/plugins/webview/Makefile
index 720fd03..a38965f 100644
--- a/src/plugins/webview/Makefile
+++ b/src/plugins/webview/Makefile
@@ -68,19 +68,6 @@ ifeq ($(HAVE_BOOST_LIBS)$(HAVE_LIBMICROHTTPD),11)
        CFLAGS  += $(call boost-libs-cflags,$(REQ_BOOST_LIBS))
        LDFLAGS += $(call boost-libs-ldflags,$(REQ_BOOST_LIBS))
 
-  ifeq ($(HAVE_CPP11)$(HAVE_JPEG),11)
-    LIBS_webview += m fvutils fvcams
-    OBJS_webview += image_processor.o mjpeg_reply.o jpeg_stream_producer.o
-    CFLAGS += -DHAVE_JPEG $(CFLAGS_CPP11)
-  else
-    ifneq ($(HAVE_CPP11),1)
-      WARN_TARGETS += warning_cpp11
-    endif
-    ifneq ($(HAVE_JPEG),1)
-      WARN_TARGETS = warning_jpeg
-    endif
-  endif
-
   ifeq ($(HAVE_TF)$(HAVE_GRAPHVIZ),11)
     OBJS_webview += tf_processor.o
     LIBS_webview += fawkestf
@@ -110,6 +97,18 @@ ifeq ($(HAVE_BOOST_LIBS)$(HAVE_LIBMICROHTTPD),11)
 
     OBJS_webview += blackboard-rest-api/blackboard-rest-api.o \
                    $(patsubst %.cpp,%.o,$(subst $(SRCDIR)/,,$(realpath 
$(wildcard $(SRCDIR)/blackboard-rest-api/model/*.cpp))))
+
+    ifeq ($(HAVE_JPEG),1)
+      CFLAGS += -DHAVE_JPEG
+      LIBS_webview += m fvutils fvcams
+      OBJS_webview += image-rest-api/image-rest-api.o \
+                      image-rest-api/mjpeg_reply.o \
+                      image-rest-api/jpeg_stream_producer.o \
+                      $(patsubst %.cpp,%.o,$(subst $(SRCDIR)/,,$(wildcard 
$(SRCDIR)/image-rest-api/model/*.cpp)))
+    else
+      WARN_TARGETS = warning_jpeg
+    endif
+
   else
     ifneq ($(HAVE_CPP17),1)
       WARN_TARGETS += warning_cpp17
diff --git a/src/plugins/webview/webview_plugin.cpp 
b/src/plugins/webview/webview_plugin.cpp
index 8f6c269..4e16c20 100644
--- a/src/plugins/webview/webview_plugin.cpp
+++ b/src/plugins/webview/webview_plugin.cpp
@@ -27,6 +27,9 @@
 
 #ifdef HAVE_REST_APIS
 #  include "blackboard-rest-api/blackboard-rest-api.h"
+#  ifdef HAVE_JPEG
+#    include "image-rest-api/image-rest-api.h"
+#  endif
 #endif
 
 using namespace fawkes;
@@ -48,6 +51,9 @@ WebviewPlugin::WebviewPlugin(Configuration *config)
 
   thread_list.push_back(new WebviewThread(enable_thread_pool));
   thread_list.push_back(new BlackboardRestApi());
+#ifdef HAVE_JPEG
+  thread_list.push_back(new ImageRestApi());
+#endif
 }
 
 
diff --git a/src/plugins/webview/webview_thread.cpp 
b/src/plugins/webview/webview_thread.cpp
index a5ae78b..4832bc4 100644
--- a/src/plugins/webview/webview_thread.cpp
+++ b/src/plugins/webview/webview_thread.cpp
@@ -28,9 +28,6 @@
 #ifdef HAVE_TF
 #  include "tf_processor.h"
 #endif
-#ifdef HAVE_JPEG
-#  include "image_processor.h"
-#endif
 #include "service_browse_handler.h"
 #include "header_generator.h"
 #include "footer_generator.h"
@@ -236,18 +233,10 @@ WebviewThread::init()
   startpage_processor_  = NULL;
   blackboard_processor_ = NULL;
   plugins_processor_ = NULL;
-#ifdef HAVE_JPEG
-  image_processor_     = NULL;
-#endif
 #ifdef HAVE_TF
   tf_processor_ = NULL;
 #endif
 
-#ifdef HAVE_JPEG
-  image_processor_     = new WebviewImageRequestProcessor(webview_url_manager, 
config,
-                                                          logger, 
thread_collector);
-#endif
-
   if (catchall_file.empty()) {
          blackboard_processor_ = new 
WebviewBlackBoardRequestProcessor(webview_url_manager, blackboard);
          plugins_processor_    = new 
WebviewPluginsRequestProcessor(webview_url_manager, plugin_manager);
@@ -261,9 +250,6 @@ WebviewThread::init()
          webview_nav_manager->add_nav_entry("/tf/", "TF");
 #endif
          webview_nav_manager->add_nav_entry("/plugins/", "Plugins");
-#ifdef HAVE_JPEG
-         webview_nav_manager->add_nav_entry("/images/", "Images");
-#endif
   }
 
   std::string afs;
@@ -298,9 +284,6 @@ WebviewThread::finalize()
 #ifdef HAVE_TF
   webview_nav_manager->remove_nav_entry("/tf/");
 #endif
-#ifdef HAVE_JPEG
-  webview_nav_manager->remove_nav_entry("/images/");
-#endif
 
   delete webserver_;
 
@@ -316,9 +299,6 @@ WebviewThread::finalize()
 #ifdef HAVE_TF
   delete tf_processor_;
 #endif
-#ifdef HAVE_JPEG
-  delete image_processor_;
-#endif
   delete footer_gen_;
   delete header_gen_;
   dispatcher_ = NULL;
diff --git a/src/plugins/webview/webview_thread.h 
b/src/plugins/webview/webview_thread.h
index 7afa672..e4bbfa3 100644
--- a/src/plugins/webview/webview_thread.h
+++ b/src/plugins/webview/webview_thread.h
@@ -30,9 +30,6 @@
 #include <aspect/logger.h>
 #include <aspect/plugin_director.h>
 #include <aspect/webview.h>
-#ifdef HAVE_JPEG
-#  include <aspect/thread_producer.h>
-#endif
 #ifdef HAVE_TF
 #  include <aspect/tf.h>
 #endif
@@ -57,9 +54,6 @@ class WebviewUserVerifier;
 #ifdef HAVE_TF
 class WebviewTfRequestProcessor;
 #endif
-#ifdef HAVE_JPEG
-class WebviewImageRequestProcessor;
-#endif
 
 class WebviewThread
 : public fawkes::Thread,
@@ -69,9 +63,6 @@ class WebviewThread
   public fawkes::NetworkAspect,
   public fawkes::LoggerAspect,
   public fawkes::PluginDirectorAspect,
-#ifdef HAVE_JPEG
-  public fawkes::ThreadProducerAspect,
-#endif
 #ifdef HAVE_TF
   public fawkes::TransformAspect,
 #endif
@@ -104,9 +95,6 @@ class WebviewThread
 #ifdef HAVE_TF
   WebviewTfRequestProcessor          *tf_processor_;
 #endif
-#ifdef HAVE_JPEG
-  WebviewImageRequestProcessor       *image_processor_;
-#endif
   WebviewServiceBrowseHandler        *service_browse_handler_;
   WebviewHeaderGenerator             *header_gen_;
   WebviewFooterGenerator             *footer_gen_;

- *commit* 137cb0a9e5f23ed5d218824df6bade0289426e5d - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:08:29 2018 +0200
Subject: config: enable webview client-side caching by default

 cfg/conf.d/webview.yaml |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/cfg/conf.d/webview.yaml b/cfg/conf.d/webview.yaml
index 9fd22b2..f8bda4a 100644
--- a/cfg/conf.d/webview.yaml
+++ b/cfg/conf.d/webview.yaml
@@ -9,7 +9,7 @@ webview:
 
   # True to allow client side caching. Typically you want this disabled
   # to force proper reloads each time with fresh data.
-  client_side_caching: false
+  client_side_caching: true
 
   tls:
     # Encrypt connections?

- *commit* e9815a7a2dfeaff6524d39aa1ff738616d44cfc4 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:10:41 2018 +0200
Subject: webview: disable caching for REST API replies

 src/plugins/webview/rest_processor.cpp |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/webview/rest_processor.cpp 
b/src/plugins/webview/rest_processor.cpp
index de991c4..ebbdfca 100644
--- a/src/plugins/webview/rest_processor.cpp
+++ b/src/plugins/webview/rest_processor.cpp
@@ -4,7 +4,6 @@
  *
  *  Created: Fri Mar 16 12:02:53 2018
  *  Copyright  2006-2018  Tim Niemueller [www.niemueller.de]
- *
  ****************************************************************************/
 
 /*  This program is free software; you can redistribute it and/or modify
@@ -76,7 +75,6 @@ WebviewRESTRequestProcessor::~WebviewRESTRequestProcessor()
   }
 }
 
-
 WebReply *
 WebviewRESTRequestProcessor::process_request(const fawkes::WebRequest *request)
 {
@@ -92,21 +90,23 @@ WebviewRESTRequestProcessor::process_request(const 
fawkes::WebRequest *request)
        WebviewRestApi *api = api_mgr_->get_api(rest_api);
        if (! api) {
                logger_->log_error("WebRESTProc", "REST API '%s' unknown", 
rest_api.c_str());
-               return new StaticWebReply(WebReply::HTTP_NOT_FOUND, "REST API 
'" + rest_api + "' unknown\n");
+               return new StaticWebReply(WebReply::HTTP_NOT_FOUND,
+                                          "REST API '" + rest_api + "' 
unknown\n");
        }
 
        try {
                WebReply *reply = api->process_request(request, rest_path);
                if (! reply) {
                        return new StaticWebReply(WebReply::HTTP_NOT_FOUND, 
"REST API '" + rest_api +
-                                                    "' has no endpoint '" + 
rest_path + "'\n");
+                                                 "' has no endpoint '" + 
rest_path + "'\n");
                }
-               return reply;
+               return no_caching(reply);
        } catch (Exception &e) {
                logger_->log_error("WebRESTProc", "REST API '%s' failed, 
exception follows", rest_api.c_str());
                logger_->log_error("WebRESTProc", e);
-               return new StaticWebReply(WebReply::HTTP_INTERNAL_SERVER_ERROR, 
"REST API '" + rest_api + "': " +
-                                         e.what_no_backtrace() + "\n");
+               return no_caching(new 
StaticWebReply(WebReply::HTTP_INTERNAL_SERVER_ERROR,
+                                                    "REST API '" + rest_api + 
"': " +
+                                                    e.what_no_backtrace() + 
"\n"));
        }
        
 }

- *commit* 8bb66470b214b10e6efddda18448643a703d7644 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:11:31 2018 +0200
Subject: webview-frontend: add fonts to service worker configuration

 src/plugins/webview/frontend/src/ngsw-config.json |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/webview/frontend/src/ngsw-config.json 
b/src/plugins/webview/frontend/src/ngsw-config.json
index b9bf3a5..554f03d 100644
--- a/src/plugins/webview/frontend/src/ngsw-config.json
+++ b/src/plugins/webview/frontend/src/ngsw-config.json
@@ -23,5 +23,14 @@
         "/assets/**"
       ]
     }
+  }, {
+    "name": "fonts",
+    "installMode": "lazy",
+    "updateMode": "prefetch",
+    "resources": {
+      "versionedFiles": [
+        "/*.woff2"
+      ]
+    }
   }]
-}
\ No newline at end of file
+}

- *commit* b7886417cbb0eefb8b2cd1efa662941b0c920c27 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:13:38 2018 +0200
Subject: webview-frontend: disable chart refresh on blur, restart on focus

 .../frontend/src/components/promchart/component.ts |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/webview/frontend/src/components/promchart/component.ts 
b/src/plugins/webview/frontend/src/components/promchart/component.ts
index 8073089..5be91cb 100644
--- a/src/plugins/webview/frontend/src/components/promchart/component.ts
+++ b/src/plugins/webview/frontend/src/components/promchart/component.ts
@@ -2,7 +2,7 @@
 // Copyright  2018  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
 // License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
 
-import {Component, Input, AfterViewInit, ViewChild, OnDestroy} from 
'@angular/core';
+import {Component, Input, AfterViewInit, ViewChild, OnDestroy, HostListener} 
from '@angular/core';
 import { HttpClient } from '@angular/common/http';
 
 import { Observable } from 'rxjs/Observable';
@@ -54,7 +54,7 @@ export class PrometheusChartComponent implements 
AfterViewInit, OnDestroy {
   @ViewChild('chart') chart_elem;
 
   have_data: boolean = false;
-  zero_message: string = "No date received";
+  zero_message: string = "No data received";
   auto_refresh_subscription = null;
 
   constructor(private http: HttpClient) {}
@@ -87,7 +87,19 @@ export class PrometheusChartComponent implements 
AfterViewInit, OnDestroy {
   {
     this.disable_autorefresh();
   }
-  
+
+  @HostListener('window:focus', ['$event'])
+  onFocus(ev: FocusEvent)
+  {
+    this.enable_autorefresh();
+  }
+
+  @HostListener('window:blur', ['$event'])
+  onBlur(ev: FocusEvent)
+  {
+    this.disable_autorefresh();
+  }
+
   refresh()
   {
     let end   = Math.floor(Date.now() / 1000);
@@ -223,6 +235,8 @@ export class PrometheusChartComponent implements 
AfterViewInit, OnDestroy {
               legend: this.legend
             });
             this.have_data = true;
+          } else {
+            this.zero_message = "No data available";
           }
         },
         (err) => {

- *commit* a32bb792aee78a73cae4efb70e77e0df54b96af4 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:23:19 2018 +0200
Subject: webview-frontend: add image component

 src/plugins/webview/frontend/src/app/app.module.ts |    2 +
 .../webview/frontend/src/chrome/nav/template.html  |    4 +
 .../parts/{clips => images}/component.module.ts    |   16 +-
 .../images/components/overview.component.html      |   80 ++++++++++
 .../images/components/overview.component.scss      |   20 +++
 .../components/overview.component.spec.ts          |    0
 .../parts/images/components/overview.component.ts  |  157 ++++++++++++++++++++
 .../SkillCall.ts => images/models/ImageInfo.ts}    |   20 ++-
 .../webview/frontend/src/parts/images/module.ts    |   23 +++
 .../parts/{skiller => images}/routing.module.ts    |    6 +-
 .../parts/{blackboard => images}/service.module.ts |    6 +-
 .../src/parts/images/services/api.service.ts}      |    0
 12 files changed, 312 insertions(+), 22 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/webview/frontend/src/app/app.module.ts 
b/src/plugins/webview/frontend/src/app/app.module.ts
index 21ef860..bf7159a 100644
--- a/src/plugins/webview/frontend/src/app/app.module.ts
+++ b/src/plugins/webview/frontend/src/app/app.module.ts
@@ -20,6 +20,7 @@ import { ClipsExecutiveModule } from 
'../parts/clips-executive/module';
 import { SkillerModule } from '../parts/skiller/module';
 import { BlackboardModule } from '../parts/blackboard/module';
 import { ClipsModule } from '../parts/clips/module';
+import { ImageModule } from '../parts/images/module';
 
 import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
 
@@ -39,6 +40,7 @@ import { HttpClientInMemoryWebApiModule } from 
'angular-in-memory-web-api';
          SkillerModule,
          BlackboardModule,
          ClipsModule,
+         ImageModule,
 
          // Keep the AppRoutingModule last
          AppRoutingModule,
diff --git a/src/plugins/webview/frontend/src/chrome/nav/template.html 
b/src/plugins/webview/frontend/src/chrome/nav/template.html
index 254c892..ee1fe96 100644
--- a/src/plugins/webview/frontend/src/chrome/nav/template.html
+++ b/src/plugins/webview/frontend/src/chrome/nav/template.html
@@ -26,6 +26,10 @@
                                                                         
routerLink="blackboard"
                    i18n>Blackboard
       </ff-nav-item>
+      <ff-nav-item class="ff-nav-item"
+                                                                        
routerLink="images"
+                   i18n>Images
+      </ff-nav-item>
 
       <mat-divider></mat-divider>
 

- *commit* 6432e14e598f7940566dafc3f5ef1157d4805ed8 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 19:23:53 2018 +0200
Subject: webview-frontend: promchart legend click highlights clicked series

 .../frontend/src/components/promchart/component.ts |   24 +++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/webview/frontend/src/components/promchart/component.ts 
b/src/plugins/webview/frontend/src/components/promchart/component.ts
index 5be91cb..9a38111 100644
--- a/src/plugins/webview/frontend/src/components/promchart/component.ts
+++ b/src/plugins/webview/frontend/src/components/promchart/component.ts
@@ -200,7 +200,29 @@ export class PrometheusChartComponent implements 
AfterViewInit, OnDestroy {
             if (this.y_tick_count) {
               this.y_axis.tick.count = this.y_tick_count + 1;
             }
-      
+
+            if (! this.legend.item) {
+              this.legend.item = {};
+            }
+            this.legend.item.onclick =
+              function (d) {
+                let shown = this.api.data.shown();
+                if (shown.findIndex((de) => de.id == d) < 0) {
+                  // we are switching from another activated single data
+                  this.api.hide();
+                  this.api.show(d);
+                } else {
+                  if (shown.length <= 1) {
+                    // click on zoomed-in data
+                    this.api.show();
+                  } else {
+                    // select data on fully visible chart
+                    this.api.hide();
+                    this.api.show(d);
+                  }
+                }
+              };
+
             let chart = c3.generate({
               bindto: this.chart_elem.nativeElement,
               size: {

- *commit* a3204e81b7a983518bf0ad2030dbc3d2799ec9b2 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 20:03:22 2018 +0200
Subject: libwebview: support reverse proxy X-Forwarded-For header

 src/libs/webview/request.cpp |   56 +++++++++++++++++++++++++----------------
 1 files changed, 34 insertions(+), 22 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/webview/request.cpp b/src/libs/webview/request.cpp
index 42eb5df..a16b6dd 100644
--- a/src/libs/webview/request.cpp
+++ b/src/libs/webview/request.cpp
@@ -121,33 +121,45 @@ WebRequest::setup(const char *url, const char *method,
     http_version_ = HTTP_VERSION_1_1;
   }
 
-  struct sockaddr *client_addr =
-    MHD_get_connection_info(connection, MHD_CONNECTION_INFO_CLIENT_ADDRESS)
-      ->client_addr;
-
-  char addr_str[INET6_ADDRSTRLEN];
-  switch(client_addr->sa_family) {
-  case AF_INET:
-    inet_ntop(AF_INET, &(((struct sockaddr_in *)client_addr)->sin_addr),
-             addr_str, INET6_ADDRSTRLEN);
-    break;
-
-  case AF_INET6:
-    inet_ntop(AF_INET6, &(((struct sockaddr_in6 *)client_addr)->sin6_addr),
-             addr_str, INET6_ADDRSTRLEN);
-    break;
-
-  default:
-    strncpy(addr_str, "Unknown AF", INET6_ADDRSTRLEN);
-  }
-
-  client_addr_ = addr_str;
-
   MHD_get_connection_values(connection, MHD_HEADER_KIND, &header_iterator, 
this);
   MHD_get_connection_values(connection, MHD_COOKIE_KIND, &cookie_iterator, 
this);
   MHD_get_connection_values(connection,
                            MHD_GET_ARGUMENT_KIND, &get_argument_iterator, 
this);
 
+
+  // check for reverse proxy header fields
+  if (headers_.find("X-Forwarded-For") != headers_.end()) {
+         std::string forwarded_for{headers_["X-Forwarded-For"]};
+         std::string::size_type comma_pos = forwarded_for.find(",");
+         if (comma_pos != std::string::npos) {
+                 forwarded_for = forwarded_for.substr(0, comma_pos);
+         }
+         client_addr_ = forwarded_for;
+
+  } else {
+         struct sockaddr *client_addr =
+                 MHD_get_connection_info(connection, 
MHD_CONNECTION_INFO_CLIENT_ADDRESS)
+                 ->client_addr;
+
+         char addr_str[INET6_ADDRSTRLEN];
+         switch(client_addr->sa_family) {
+         case AF_INET:
+                 inet_ntop(AF_INET, &(((struct sockaddr_in 
*)client_addr)->sin_addr),
+                           addr_str, INET6_ADDRSTRLEN);
+                 break;
+
+         case AF_INET6:
+                 inet_ntop(AF_INET6, &(((struct sockaddr_in6 
*)client_addr)->sin6_addr),
+                           addr_str, INET6_ADDRSTRLEN);
+                 break;
+
+         default:
+                 strncpy(addr_str, "Unknown AF", INET6_ADDRSTRLEN);
+         }
+
+         client_addr_ = addr_str;
+  }
+
   is_setup_ = true;
 }
 

- *commit* 8790f4cbcc55d0b3625f416f5df98304bad99ba3 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 20:04:22 2018 +0200
Subject: libwebview: only disallow re-registrations with same weight

 src/libs/webview/router.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/webview/router.h b/src/libs/webview/router.h
index 4a880d4..2198abf 100644
--- a/src/libs/webview/router.h
+++ b/src/libs/webview/router.h
@@ -106,8 +106,9 @@ class WebviewRouter
        add(WebRequest::Method method, const std::string &path, T handler, int 
weight)
        {
                auto ri = std::find_if(routes_.begin(), routes_.end(),
-                                      [this, method, &path](auto r) -> bool {
-                                              return (std::get<1>(r) == method 
&&
+                                      [this, method, &path, &weight](auto r) 
-> bool {
+                                              return (std::get<0>(r) == weight 
&&
+                                                      std::get<1>(r) == method 
&&
                                                       std::get<2>(r) == path);
                                       });
                if (ri != routes_.end()) {

- *commit* bc8b45b5e08dff74c9c3bc825af35bdc9b8d899e - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 20:06:38 2018 +0200
Subject: webview: add support for explicit high-weight 404

 src/plugins/webview/static_processor.cpp |    4 ++--
 src/plugins/webview/webview_thread.cpp   |   20 ++++++++++++++++++++
 src/plugins/webview/webview_thread.h     |    3 +++
 3 files changed, 25 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/webview/static_processor.cpp 
b/src/plugins/webview/static_processor.cpp
index 89e1db3..1dd4e05 100644
--- a/src/plugins/webview/static_processor.cpp
+++ b/src/plugins/webview/static_processor.cpp
@@ -87,12 +87,12 @@ 
WebviewStaticRequestProcessor::WebviewStaticRequestProcessor(fawkes::WebUrlManag
   
   url_manager_->add_handler(WebRequest::METHOD_GET, base_url + "{file+}",
                             
std::bind(&WebviewStaticRequestProcessor::process_request, this,
-                                      std::placeholders::_1), 1000);
+                                      std::placeholders::_1), 10040);
 
   if (catchall_file_ != "") {
          url_manager_->add_handler(WebRequest::METHOD_GET, base_url + "?",
                                    
std::bind(&WebviewStaticRequestProcessor::process_request, this,
-                                             std::placeholders::_1), 1050);
+                                             std::placeholders::_1), 10050);
   }
 }
 
diff --git a/src/plugins/webview/webview_thread.cpp 
b/src/plugins/webview/webview_thread.cpp
index 4832bc4..c539c8e 100644
--- a/src/plugins/webview/webview_thread.cpp
+++ b/src/plugins/webview/webview_thread.cpp
@@ -252,6 +252,16 @@ WebviewThread::init()
          webview_nav_manager->add_nav_entry("/plugins/", "Plugins");
   }
 
+  try {
+         cfg_explicit_404_ = config->get_strings("/webview/explicit-404");
+         for (const auto &u : cfg_explicit_404_) {
+                 webview_url_manager->add_handler(WebRequest::METHOD_GET, u,
+                                                  
std::bind(&WebviewThread::produce_404, this),
+                                                  10000);
+         }
+  } catch (Exception &e) {} // ignored, no explicit 404
+
+  
   std::string afs;
   if (cfg_use_ipv4_ && cfg_use_ipv6_) {
          afs = "IPv4,IPv6";
@@ -285,6 +295,10 @@ WebviewThread::finalize()
   webview_nav_manager->remove_nav_entry("/tf/");
 #endif
 
+  for (const auto &u : cfg_explicit_404_) {
+         webview_url_manager->remove_handler(WebRequest::METHOD_GET, u);
+  }
+
   delete webserver_;
 
   delete webview_service_;
@@ -335,3 +349,9 @@ WebviewThread::tls_create(const char *tls_key_file, const 
char *tls_cert_file)
     throw Exception("Failed to auto-generate key/certificate pair");
   }
 }
+
+WebReply *
+WebviewThread::produce_404()
+{
+       return new StaticWebReply(WebReply::HTTP_NOT_FOUND, "Not found\n");
+}
diff --git a/src/plugins/webview/webview_thread.h 
b/src/plugins/webview/webview_thread.h
index e4bbfa3..80b1a0b 100644
--- a/src/plugins/webview/webview_thread.h
+++ b/src/plugins/webview/webview_thread.h
@@ -40,6 +40,7 @@ namespace fawkes {
   class NetworkService;
   class WebServer;
   class WebRequestDispatcher;
+  class WebReply;
 }
 
 class WebviewStaticRequestProcessor;
@@ -78,6 +79,7 @@ class WebviewThread
 
  private:
   void tls_create(const char *tls_key_file, const char *tls_cert_file);
+  fawkes::WebReply * produce_404();
 
 
  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
@@ -113,6 +115,7 @@ class WebviewThread
   std::string  cfg_access_log_;
   bool         cfg_use_thread_pool_;
   unsigned int cfg_num_threads_;
+  std::vector<std::string> cfg_explicit_404_;
 
   fawkes::CacheLogger     cache_logger_;
   fawkes::NetworkService *webview_service_;

- *commit* 250ded3bff67e2fd240009cef48314c4354d22e2 - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Sun Apr 8 20:08:15 2018 +0200
Subject: config: configure 404 for /metrics and /xmlrpc

 cfg/conf.d/webview.yaml |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/cfg/conf.d/webview.yaml b/cfg/conf.d/webview.yaml
index f8bda4a..e241d7d 100644
--- a/cfg/conf.d/webview.yaml
+++ b/cfg/conf.d/webview.yaml
@@ -107,3 +107,14 @@ webview:
     # Typically this is provided by mailcap in /etc/mime.types.
     mime-file: /etc/mime.types
 
+
+  # For the given URLs, a handler will be configured that captures
+  # requests if no other handler is registered, i.e., the actual
+  # plugin handling these requests has not been loaded.
+  # If this is not a user-facing page, but rather an endpoint ingested
+  # by some program, this may provide better feedback.
+  # For user pages, with the appropriate catchall above, we always
+  # serve the UI and it will do something useful.
+  explicit-404:
+    - /metrics
+    - /xmlrpc




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org
_______________________________________________
fawkes-commits mailing list
fawkes-commits@lists.kbsg.rwth-aachen.de
https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits

Reply via email to