forked from itsdarklikehell/pwnagotchi-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay_version.py
62 lines (54 loc) · 1.83 KB
/
display_version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.plugins as plugins
import pwnagotchi.ui.fonts as fonts
import pwnagotchi
import logging
class DisplayVersion(plugins.Plugin):
__GitHub__ = ""
__author__ = "(edited by: itsdarklikehell [email protected]), https://github.com/Teraskull/"
__version__ = "1.0.0"
__license__ = "GPL3"
__description__ = (
"A plugin that will add the Pwnagotchi version to the left of the current mode."
)
__name__ = "DisplayVersion"
__help__ = (
"A plugin that will add the Pwnagotchi version to the left of the current mode."
)
__dependencies__ = {
"apt": ["none"],
"pip": ["scapy"],
}
__defaults__ = {
"enabled": False,
}
def __init__(self):
self.ready = False
logging.debug(f"[{self.__class__.__name__}] plugin init")
self.title = ""
def on_loaded(self):
logging.info(f"[{self.__class__.__name__}] plugin loaded")
def on_ui_setup(self, ui):
ui.add_element(
"version",
LabeledValue(
color=BLACK,
label="",
value="v0.0.0",
position=(185, 110),
label_font=fonts.Small,
text_font=fonts.Small,
),
)
def on_ui_update(self, ui):
ui.set("version", f"v{pwnagotchi.__version__}")
def on_unload(self, ui):
with ui._lock:
try:
ui.remove_element("version")
logging.info(f"[{self.__class__.__name__}] plugin unloaded")
except Exception as e:
logging.error(f"[{self.__class__.__name__}] unload: %s" % e)
def on_webhook(self, path, request):
logging.info(f"[{self.__class__.__name__}] webhook pressed")