예제 #1
0
import os
import shutil
import json
from flask_cors import CORS
from FreeTAKServer.controllers.RestMessageControllers.SendSimpleCoTController import SendSimpleCoTController
from FreeTAKServer.controllers.RestMessageControllers.SendPresenceController import SendPresenceController
from FreeTAKServer.controllers.RestMessageControllers.SendEmergencyController import SendEmergencyController
from FreeTAKServer.controllers.configuration.MainConfig import MainConfig
from FreeTAKServer.controllers.JsonController import JsonController

dbController = DatabaseController()

UpdateArray = []
StartTime = None

functionNames = vars()
functionNames.function_names()

jsonVars = vars()
jsonVars.json_vars()

restMethods = vars()
restMethods.rest_methods()

defaultValues = vars()
defaultValues.default_values()

app = Flask(__name__)
login_manager = LoginManager()
login_manager.init_app(app)
auth = HTTPTokenAuth(scheme='Bearer')
예제 #2
0
from flask import Flask, request, jsonify, session
from flask_socketio import SocketIO, emit
from flask_cors import CORS

import json

from FreeTAKServer.controllers.DatabaseControllers.DatabaseController import DatabaseController
from FreeTAKServer.controllers.configuration.MainConfig import MainConfig
from FreeTAKServer.controllers.configuration.RestAPIVariables import RestAPIVariables as vars

functionNames = vars()
functionNames.function_names()
app = Flask(__name__)
CORS(app)
socketio = SocketIO(app, async_handlers=True, async_mode="eventlet")
socketio.init_app(app, cors_allowed_origins="*")
dbController = DatabaseController()


def startup(self, APIPipea, CommandPipea, IP, Port, starttime):
    global APIPipe, CommandPipe, StartTime
    StartTime = starttime
    APIPipe = APIPipea
    CommandPipe = CommandPipea
    socketio.run(app, host=IP, port=Port)


def socket_auth(session=None):
    def innerfunc(x):
        def wrapper(*args, **kwargs):
            if hasattr(session, 'authenticated') and session.authenticated:
예제 #3
0
from FreeTAKServer.controllers.RestMessageControllers.SendChatController import SendChatController
from FreeTAKServer.controllers.RestMessageControllers.SendPresenceController import SendPresenceController
from FreeTAKServer.controllers.RestMessageControllers.SendEmergencyController import SendEmergencyController
from FreeTAKServer.controllers.RestMessageControllers.SendSimpleCoTController import SendSimpleCoTController
from FreeTAKServer.model.FTSModel.Event import Event
from flask import Flask, request, jsonify, session
from FreeTAKServer.controllers.JsonController import JsonController
from FreeTAKServer.controllers.DatabaseControllers.DatabaseController import DatabaseController
from FreeTAKServer.controllers.configuration.RestAPIVariables import RestAPIVariables as vars
from flask_httpauth import HTTPTokenAuth

dbController = DatabaseController()
restMethods = vars()
restMethods.rest_methods()
app = Flask(__name__)
auth = HTTPTokenAuth(scheme='Bearer')


class GeoObject:
    @staticmethod
    def create_geoobject(json_data: dict) -> object:
        """
        create a geoobject FTSModel Object From information specified in supplied JSON argument

        @param json_data:
        @return:
        """
        jsonobj = JsonController().serialize_geoobject_post(json_data)
        simpleCoTObject = SendSimpleCoTController(jsonobj).getCoTObject()
        return simpleCoTObject