Example #1
0
 def get_uuid(uuid):
     device = {
         "uuid": "AnonDevice",
         "expires_at": time.time() + 72000,
         "accessToken": uuid,
         "refreshToken": uuid
     }
     return nice_json(device)
Example #2
0
 def activate():
     token = request.json["state"]
     device = {
         "uuid": "AnonDevice",
         "expires_at": time.time() + 72000,
         "accessToken": token,
         "refreshToken": token
     }
     return nice_json(device)
Example #3
0
 def device():
     token = request.headers.get('Authorization', '').replace("Bearer ", "")
     device = {
         "uuid": "AnonDevice",
         "expires_at": time.time() + 72000,
         "accessToken": token,
         "refreshToken": token
     }
     return nice_json(device)
Example #4
0
 def metric(uuid="", name=""):
     data = request.json
     with JsonMetricDatabase() as db:
         db.add_metric(name, json.dumps(data))
     upload_data = {"uploaded": False}
     return nice_json({
         "success": True,
         "uuid": uuid,
         "metric": data,
         "upload_data": upload_data
     })
Example #5
0
def build_response(audio_file, visimes=None):
    if visimes is not None:
        with open(audio_file, "rb") as f:
            audio_data = f.read()
        encoded_audio = base64.b64encode(audio_data)
        res = {
            "audio_base64": encoded_audio.decode("utf-8"),
            "visimes": visimes
        }
        return nice_json(res)
    else:
        return send_file(audio_file, mimetype="audio/wav")
Example #6
0
 def location(uuid):
     if not request.headers.getlist("X-Forwarded-For"):
         ip = request.remote_addr
     else:
         # TODO http://esd.io/blog/flask-apps-heroku-real-ip-spoofing.html
         ip = request.headers.getlist("X-Forwarded-For")[0]
     if CONFIGURATION["override_location"]:
         new_location = CONFIGURATION["default_location"]
     elif CONFIGURATION["geolocate"]:
         new_location = ip_geolocate(ip)
     else:
         new_location = {}
     return nice_json(new_location)
Example #7
0
 def code():
     uuid = request.args["state"]
     code = generate_code()
     result = {"code": code, "uuid": uuid}
     return nice_json(result)
Example #8
0
 def setting(uuid=""):
     result = {}
     return nice_json(result)
Example #9
0
 def skill_json(uuid):
     return nice_json({"backend_disabled": True})
Example #10
0
 def settingsmeta(uuid):
     return nice_json({"success": True, "uuid": uuid})
Example #11
0
 def get_subscriber_voice_url(uuid=""):
     arch = request.args["arch"]
     return nice_json({"link": "", "arch": arch})
Example #12
0
 def subscription_type(uuid=""):
     sub_type = "free"
     subscription = {"@type": sub_type}
     return nice_json(subscription)
Example #13
0
 def pair(code, uuid, name, mail):
     # auto - pair
     return nice_json({"paired": True})
 def hello():
     return nice_json({
         "message": "Welcome to Mock Mycroft Backend",
         "donate": "https://liberapay.com/jarbasAI",
         "author": "JarbasAI"
     })