From 13421189c65538c370f6571185375dbb717000f6 Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Mon, 19 Apr 2021 14:03:45 +0200 Subject: [PATCH] - use only one level subdomain urls on service list - add status --- bumper/db.py | 1 + .../bumper_confserver_portal_appsvr.py | 43 ++++++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/bumper/db.py b/bumper/db.py index 85c3523..90324e4 100644 --- a/bumper/db.py +++ b/bumper/db.py @@ -350,6 +350,7 @@ def bot_toEcoVacsHome_JSON(bot): # EcoVacs Home # "jmq": "jmq-ngiot-eu.dc.ww.ecouser.net", # "mqs": "api-ngiot.dc-as.ww.ecouser.net" # } + bot["status"] = 1 if bot["mqtt_connection"] or bot["xmpp_connection"] else 0 return json.dumps( bot, default=lambda o: o.__dict__, sort_keys=False diff --git a/bumper/plugins/bumper_confserver_portal_appsvr.py b/bumper/plugins/bumper_confserver_portal_appsvr.py index 6681d63..a92ca66 100644 --- a/bumper/plugins/bumper_confserver_portal_appsvr.py +++ b/bumper/plugins/bumper_confserver_portal_appsvr.py @@ -1,12 +1,10 @@ #!/usr/bin/env python3 -import asyncio -from aiohttp import web -from bumper import plugins import logging -import bumper -from bumper.models import * + +from aiohttp import web + from bumper import plugins -from datetime import datetime, timedelta +from bumper.models import * class portal_api_appsvr(plugins.ConfServerApp): @@ -159,17 +157,31 @@ class portal_api_appsvr(plugins.ConfServerApp): async def handle_appsvr_service_list(self, request): try: + # original urls comment out as they are sub sub domain, which the current certificate is not valid + # using url, where the certs is valid + # data = { + # "account": "users-base.dc-eu.ww.ecouser.net", + # "jmq": "jmq-ngiot-eu.dc.ww.ecouser.net", + # "lb": "lbo.ecouser.net", + # "magw": "api-app.dc-eu.ww.ecouser.net", + # "msgcloud": "msg-eu.ecouser.net:5223", + # "ngiotLb": "jmq-ngiot-eu.area.ww.ecouser.net", + # "rop": "api-rop.dc-eu.ww.ecouser.net" + # } + + data = { + "account": "users-base.ecouser.net", + "jmq": "jmq-ngiot-eu.ecouser.net", + "lb": "lbo.ecouser.net", + "magw": "api-app.ecouser.net", + "msgcloud": "msg-eu.ecouser.net:5223", + "ngiotLb": "jmq-ngiot-eu.ecouser.net", + "rop": "api-rop.ecouser.net" + } + body = { "code": 0, - "data": { - "account": "users-base.dc-eu.ww.ecouser.net", - "jmq": "jmq-ngiot-eu.dc.ww.ecouser.net", - "lb": "lbo.ecouser.net", - "magw": "api-app.dc-eu.ww.ecouser.net", - "msgcloud": "msg-eu.ecouser.net:5223", - "ngiotLb": "jmq-ngiot-eu.area.ww.ecouser.net", - "rop": "api-rop.dc-eu.ww.ecouser.net" - }, + "data": data, "ret": "ok", "todo": "result" } @@ -195,4 +207,5 @@ class portal_api_appsvr(plugins.ConfServerApp): except Exception as e: logging.exception("{}".format(e)) + plugin = portal_api_appsvr()