From 11cf2a96e240e4d2f68694b0d95f87cd5a339010 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 10 May 2020 17:12:42 +0200 Subject: [PATCH] create a receiver details route for use in the header --- owrx/controllers/api.py | 13 +++++++++++++ owrx/http.py | 1 + 2 files changed, 14 insertions(+) diff --git a/owrx/controllers/api.py b/owrx/controllers/api.py index 4e7a966..60bb74f 100644 --- a/owrx/controllers/api.py +++ b/owrx/controllers/api.py @@ -1,5 +1,6 @@ from . import Controller from owrx.feature import FeatureDetector +from owrx.config import Config import json @@ -7,3 +8,15 @@ class ApiController(Controller): def indexAction(self): data = json.dumps(FeatureDetector().feature_report()) self.send_response(data, content_type="application/json") + + def receiverDetails(self): + receiver_details = Config.get().filter( + "receiver_name", + "receiver_location", + "receiver_asl", + "receiver_gps", + "photo_title", + "photo_desc", + ) + data = json.dumps(receiver_details.__dict__()) + self.send_response(data, content_type="application/json") diff --git a/owrx/http.py b/owrx/http.py index 39e2bdf..8381646 100644 --- a/owrx/http.py +++ b/owrx/http.py @@ -101,6 +101,7 @@ class Router(object): StaticRoute("/map", MapController), StaticRoute("/features", FeatureController), StaticRoute("/api/features", ApiController), + StaticRoute("/api/receiverdetails", ApiController, options={"action": "receiverDetails"}), StaticRoute("/metrics", MetricsController), StaticRoute("/settings", SettingsController), StaticRoute("/generalsettings", GeneralSettingsController),