# WOL·Ly

<p align="center">
  <a href="https://git.konsthol.eu/konsthol/WOL-Ly">
    <img src="assets/images/logo.png?raw=true" width="300"/>
  </a>
</p>

WOL·Ly is a Wake-On-LAN server, ready to bring devices to life.

After initializing the .env file with the MAC addresses of the devices you need to wake up, you'll be ready to use either the UI or curl to do so.

The format used in the .env file is

```sh
# Environment variables
WOL_SECRET_KEY="secretkey"
WOL_USER_PASS="userpassword"
REDIS_URL="redis://localhost:6379/0"
DEVICE_MAC="mac"
DEVICE_IP="ipv4"
DEVICE_IFACE="eth0|wlan0 etc"
```

The only required fields are the _MAC ones. If _IFACE is not provided, eth0 is the default. The _IP is only used for the ping functionality.

The default user is called anon and can be changed in auth.py

For every change of the .env file in the app folder you need to restart the systemd service.

It goes without saying that Wake-On-LAN must be enabled both in the BIOS and the operating system.

The project should also be run as root because the way that it sends Wake-On-LAN packets is similar to how etherwake does it. It doesn't actually send a UDP packet on port 9 but rather raw ethernet frames directly to the NIC of the device you want to wake up.

## Installation 🪛

```sh
git clone https://git.konsthol.eu/konsthol/WOL-Ly
cd WOL-Ly
chmod +x setup.sh
sudo ./setup.sh
```

If you just want to use it and don't care about the code or you don't want to download any python dependencies, you can just grab the binary from the releases page and run it. The easiest way to do that is this.

```sh
sudo apt install -y jq
wget https://git.konsthol.eu/konsthol/WOL-Ly/raw/branch/main/setupSingleBinary.sh
sudo bash setupSingleBinary.sh
rm setupSingleBinary.sh
```

When you change the .env in the app folder you should run this

`sudo systemctl restart wolServer`

## Usage 🖥️

Wake a device up 🛑💤

`curl -k "https://username:password@deviceIP:51820/wol/deviceToWakeUpName?key=SecretKey"`

Ping a device 👉

`curl -k "https://deviceIP:51820/ping/deviceToWakeUpName"`

Check to see if Redis is connected ✔️

`curl -k "https://username:password@deviceIP:51820/redis_status"`

Reset the rate limits 🙅

`curl -k "https://username:password@deviceIP:51820/reset_limiter?key=SecretKey"`

Or you could go to "https://deviceIP:51820" and click the buttons there for the Ping and Wol functions.

## UI portion 

![Usage](./assets/videos/video-13-1224_20-41-25.gif)

## Dependencies 📦

* Python
* Redis
* Gunicorn
* OpenSSL

## Credits go to 🗒️

* [CodePen](https://codepen.io/)
* [Fernando Cohen](https://codepen.io/designfenix/pen/RwKPapa)
* [John Muir](https://codepen.io/john_r_muir/pen/RwzpNQv)
* [Krasivoron Alexander](https://codepen.io/kvoron/pen/abgoJVj)
* [Filip Zrnzevic](https://codepen.io/filipz/pen/poMLWNX)
* [Eugene Burlak](https://codepen.io/eugene_burlak/pen/MYgYVbQ)

For providing the CodePens I used to make the UI portion of WOL·Ly

* [Oswald](https://github.com/googlefonts/OswaldFont)

For providing the fonts used in the UI.

* [Luke Peavey](https://github.com/lukePeavey/SplitType)

For providing the SplitType library.

* [GSAP](https://gsap.com/community/standard-license/)

For providing a way to implement the animations used in the 4th CodePen.

## License 📜

This project as a whole is licensed under GPLv3 but for the UI part that uses Flexbox the license used is Apache License 2.0. The font used is Oswald which is licensed under SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007.
