INNER CODE UNIT · Python
_http_serve
evilsocket/pwnagotchi · pwnagotchi/ui/web/server.py:30
def _http_serve(self):
if self._address is not None:
web_path = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__,
static_url_path='',
static_folder=os.path.join(web_path, 'static'),
template_folder=os.path.join(web_path, 'templates'))
app.secret_key = secrets.token_urlsafe(256)
if self._origin:
CORS(app, resources={r"*": {"origins": self._origin}})
CSRFProtect(app)
Handler(self._config, self._agent, app)
logging.info("web ui available at http://%s:%d/" % (self._address, self._port))