Skip to content

Commit

Permalink
[core] fixed icon issues (tested on waveshare v2 and v3 with evilsock…
Browse files Browse the repository at this point in the history
…et and jayofelony images)

Close #14
  • Loading branch information
cyberartemio committed Apr 4, 2024
1 parent 28b6fe2 commit fe6a721
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Before installing this plugin on your Pwnagotchi, you need to have Wall of Flipp
## 🚀 Installation

> [!IMPORTANT]
> If you install the plugin using `pwnagotchi plugins` command, make sure to add also `wof_assets` directory to the directory where plugins are stored, otherwise the icon and other resources will not be rendered. Also, if you have Waveshare v4 screen, currently the icon is not rendering properly on pwnagotchi's screen.
> If you install the plugin using `pwnagotchi plugins` command, make sure to add also `wof_assets` directory to the directory where plugins are stored, otherwise the icon and other resources will not be rendered.
1. Login inside your pwnagotchi using SSH:
```sh
Expand All @@ -44,15 +44,20 @@ rm -r wof-pwnagotchi-plugin-main main.zip
```toml
# Enable the plugin
main.plugins.wof.enabled = true

# Show the flipper icon on screen instead of the label "[wof]"
main.plugins.wof.icon = true
# Set to true if you have inverted screen colors

# Set to true for black background, false for white background
main.plugins.wof.icon_reverse = false

# Display coordinates for text position
main.plugins.wof.position.x = 5
main.plugins.wof.position.y = 84

# File system path where Flipper.json file is located
main.plugins.wof.wof_file = "/root/Wall-of-Flippers/Flipper.json"

# A flipper is considered online if its last seen time is within this timespan
main.plugins.wof.online_timespan = 30 # in seconds
```
Expand Down Expand Up @@ -97,5 +102,5 @@ If you want to contribute, you can fork the project and then open a pull request

## 🥇 Credits

- For Wall of Flipper: `Wall of Flippers` by K3YOMI ([Github](https://github.com/K3YOMI/Wall-of-Flippers))
- For icon rendering: `InternetConnectionPlugin` by NeonLightning ([Github](https://github.com/NeonLightning/pwny/blob/main/internet-conection.py))
- `Wall of Flippers` by K3YOMI ([Github](https://github.com/K3YOMI/Wall-of-Flippers))
- rai68 for Flipper icon ([Github](https://github.com/rai68))
16 changes: 13 additions & 3 deletions wof.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import time
from PIL import Image, ImageOps
import pwnagotchi.plugins as plugins
from pwnagotchi.ui.components import LabeledValue, Widget, Bitmap
from pwnagotchi.ui.components import LabeledValue, Widget
from pwnagotchi.ui.view import BLACK
import pwnagotchi.ui.fonts as fonts
from flask import abort
Expand Down Expand Up @@ -407,7 +407,7 @@ def on_ui_setup(self, ui):
text_font = fonts.Small))

if self.__icon:
ui.add_element('wof_logo', Bitmap(path = f'{self.__assets_path}/flipper.bmp', xy = self.__position))
ui.add_element('wof_logo', FlipperIcon(path = f'{self.__assets_path}/flipper.bmp', xy = self.__position, reverse = self.__reverse))

def on_ui_update(self, ui):
flippers = self.__wof_bridge.get_update()
Expand Down Expand Up @@ -454,4 +454,14 @@ def on_webhook(self, path, request):
abort(404)
else:
abort(404)
abort(404)
abort(404)

class FlipperIcon(Widget):
def __init__(self, path, xy, reverse, color = 0):
super().__init__(xy, color)
self.image = Image.open(path)
if(reverse):
self.image = ImageOps.invert(self.image.convert('L'))

def draw(self, canvas, drawer):
canvas.paste(self.image, self.xy)

0 comments on commit fe6a721

Please sign in to comment.