mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
@ -8,7 +8,6 @@ os.environ['WERKZEUG_RUN_MAIN'] = 'true'
|
||||
|
||||
import pwnagotchi
|
||||
import pwnagotchi.ui.web as web
|
||||
from pwnagotchi.agent import Agent
|
||||
from pwnagotchi import plugins
|
||||
|
||||
from flask import send_file
|
||||
@ -87,7 +86,8 @@ STATUS_PAGE = """<html>
|
||||
|
||||
|
||||
class Handler:
|
||||
def __init__(self, app):
|
||||
def __init__(self, agent, app):
|
||||
self._agent = agent
|
||||
self._app = app
|
||||
self._app.add_url_rule('/', 'index', self.index)
|
||||
self._app.add_url_rule('/ui', 'ui', self.ui)
|
||||
@ -102,7 +102,7 @@ class Handler:
|
||||
|
||||
def index(self):
|
||||
return render_template_string(INDEX, title=pwnagotchi.name(),
|
||||
other_mode='AUTO' if Agent.INSTANCE.mode == 'manual' else 'MANU')
|
||||
other_mode='AUTO' if self._agent.mode == 'manual' else 'MANU')
|
||||
|
||||
def plugins(self, name, subpath):
|
||||
if name is None:
|
||||
|
@ -15,12 +15,12 @@ from pwnagotchi.ui.web.handler import Handler
|
||||
|
||||
|
||||
class Server:
|
||||
def __init__(self, config):
|
||||
def __init__(self, agent, config):
|
||||
self._enabled = config['video']['enabled']
|
||||
self._port = config['video']['port']
|
||||
self._address = config['video']['address']
|
||||
self._origin = None
|
||||
|
||||
self._agent = agent
|
||||
if 'origin' in config['video']:
|
||||
self._origin = config['video']['origin']
|
||||
|
||||
@ -36,7 +36,7 @@ class Server:
|
||||
CORS(app, resources={r"*": {"origins": self._origin}})
|
||||
|
||||
CSRFProtect(app)
|
||||
Handler(app)
|
||||
Handler(agent, app)
|
||||
|
||||
app.run(host=self._address, port=self._port, debug=False)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user