Skip to content

Commit

Permalink
Sponsorship auto-generate v0.1 + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jokob-sk committed Jan 28, 2024
1 parent 5cfe0bf commit a7227ca
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 9 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/update_sponsors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Update Sponsors

on:
schedule:
- cron: '0 0 * * *' # Set your preferred schedule

jobs:
update-readme:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Update Sponsors
run: |
GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
gh run workflow_dispatch -R $GITHUB_REPOSITORY -f update_sponsors_table.yml -t $GH_TOKEN
31 changes: 31 additions & 0 deletions .github/workflows/update_sponsors_table.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Update Sponsors Table

on:
workflow_run:
workflows: ["Update Sponsors"]
types:
- completed

jobs:
update-table:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r update_sponsors_requirements.txt # If you have any Python dependencies
- name: Update Sponsors Table
run: |
python update_sponsors.py
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,36 @@

Get visibility of what's going on on your WIFI/LAN network. Scan for devices, port changes and get alerts if unknown devices or changes are found. Write your own [Plugins](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins#readme) with auto-generated UI and in-build notification system.

[![Docker](https://img.shields.io/github/actions/workflow/status/jokob-sk/Pi.Alert/docker_prod.yml?label=Build&logo=GitHub)](https://github.com/jokob-sk/Pi.Alert/actions/workflows/docker_prod.yml)
[![GitHub Committed](https://img.shields.io/github/last-commit/jokob-sk/Pi.Alert?color=40ba12&label=Committed&logo=GitHub&logoColor=fff)](https://github.com/jokob-sk/Pi.Alert)
[![Docker Size](https://img.shields.io/docker/image-size/jokobsk/pi.alert?label=Size&logo=Docker&color=0aa8d2&logoColor=fff)](https://hub.docker.com/r/jokobsk/pi.alert)
[![Docker Pulls](https://img.shields.io/docker/pulls/jokobsk/pi.alert?label=Pulls&logo=docker&color=0aa8d2&logoColor=fff)](https://hub.docker.com/r/jokobsk/pi.alert)
[![Docker Pushed](https://img.shields.io/badge/dynamic/json?color=0aa8d2&logoColor=fff&label=Pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&link=http://left&link=https://hub.docker.com/repository/docker/jokobsk/pi.alert)](https://hub.docker.com/r/jokobsk/pi.alert)
[![Docker Pushed](https://img.shields.io/badge/dynamic/json?color=0aa8d2&logoColor=fff&label=Pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&link=http://left&link=https://hub.docker.com/repository/docker/jokobsk/pi.alert)](https://hub.docker.com/r/jokobsk/pi.alert)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/jokob-sk?style=social)](https://github.com/sponsors/jokob-sk)

| 🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📑 [Docker guide](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md) |🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases) | 📚 [All Docs](https://github.com/jokob-sk/Pi.Alert/tree/main/docs) |
| 🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📑 [Docker guide](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md) |🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases) | 📚 [All Docs](https://github.com/jokob-sk/Pi.Alert/tree/main/docs) |
|----------------------|----------------------| ----------------------| ----------------------|


| ![Main screen][main] | ![Screen 1][screen1] | ![Screen 5][screen5] |
|----------------------|----------------------| ----------------------|
| ![Screen 3][screen3] | ![Screen 4][screen4] | ![Screen 6][screen6] |
| ![Screen 8][screen8] | ![Report 2][report2] | ![Screen 9][screen9] |


## Why PiAlert❓

Most of us don't know what's going on on our home network, but we want our family and data to be safe. _Command-line tools_ are great, but the output can be _hard to understand_ and action if you are not a network specialist.

PiAlert gives you peace of mind. _Visualize and immediately report 📬_ what is going on in your network - this is the first step to enhance your _network security 🔐_.

_PiAlert combines several network and other scanning tools 🔍 with notifications 📧 into one user-friendly package 📦_. You get an overview of network device Sessions, Connected devices, Events, Presence, Down alerts, and IPs. You can schedule Nmap scans to detect changes in device ports and visualize your Network topology (even with undetectable, dummy devices).
PiAlert combines several network and other scanning tools 🔍 with notifications 📧 into one user-friendly package 📦.

Setup a _kill switch ☠_ for your network via a smart plug with the available [Home Assistant](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/HOME_ASSISTANT.md) integration. Implement custom automations with the [CSV device Exports 📤](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/csv_backup), [Webhooks](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/WEBHOOK_N8N.md), or [API endpoints](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/API.md) features.

Extend the app if you want to create your own scanner [Plugin](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins#readme) and handle the results and notifications in PiAlert.

Looking forward to your contributions if you decide to share your work with the community ❤.

| ![Main screen][main] | ![Screen 1][screen1] | ![Screen 5][screen5] |
|----------------------|----------------------| ----------------------|
| ![Screen 3][screen3] | ![Screen 4][screen4] | ![Screen 6][screen6] |
| ![Screen 8][screen8] | ![Report 2][report2] | ![Screen 9][screen9] |

## Scan Methods, Notifications, Integration, Extension system

| Features | Details |
Expand Down Expand Up @@ -72,6 +74,16 @@ Looking forward to your contributions if you decide to share your work with the

> 📧 Email me at [[email protected]](mailto:[email protected]?subject=PiAlert) if you want to get in touch or if I should add other sponsorship platforms.
### ⭐ Sponsors

Thank you to all the wonderful people who have sponsored (=burnout prevention) this project:

<!-- DO NOT MODIFY BELOW -->

<!--SPONSORS-LIST-->

<!-- DO NOT MODIFY ABOVE -->

## Everything else
<!--- --------------------------------------------------------------------- --->

Expand Down
67 changes: 67 additions & 0 deletions update_sponsors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import os
import requests

def fetch_sponsors():
repo_owner = "jokob-sk"
repo_name = "Pi.Alert"
api_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/sponsors"

headers = {
"Authorization": f"Bearer {os.environ.get('GH_TOKEN')}",
"Accept": "application/vnd.github.v3+json",
}

current_sponsors = []
past_sponsors = []

page = 1
while True:
params = {"page": page}
response = requests.get(api_url, headers=headers, params=params)
data = response.json()

if not data:
break

for sponsor in data:
if sponsor["sponsorship_created_at"] == sponsor["sponsorship_updated_at"]:
past_sponsors.append(sponsor)
else:
current_sponsors.append(sponsor)

page += 1

return {"current_sponsors": current_sponsors, "past_sponsors": past_sponsors}

def generate_sponsors_table(current_sponsors, past_sponsors):
current_table = "| Current Sponsors |\n|---|\n"
for sponsor in current_sponsors:
current_table += f"| [{sponsor['login']}](https://github.com/{sponsor['login']}) |\n"

past_table = "| Past Sponsors |\n|---|\n"
for sponsor in past_sponsors:
past_table += f"| {sponsor['login']} |\n"

return current_table + "\n" + past_table

def update_readme(sponsors_table):
readme_path = "README.md"
with open(readme_path, "r") as readme_file:
readme_content = readme_file.read()

# Replace the placeholder <!--SPONSORS-LIST--> with the generated sponsors table
updated_readme = readme_content.replace("<!--SPONSORS-LIST-->", sponsors_table)

with open(readme_path, "w") as readme_file:
readme_file.write(updated_readme)

def main():
sponsors_data = fetch_sponsors()
current_sponsors = sponsors_data.get("current_sponsors", [])
past_sponsors = sponsors_data.get("past_sponsors", [])

sponsors_table = generate_sponsors_table(current_sponsors, past_sponsors)
update_readme(sponsors_table)

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions update_sponsors_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests>=2.0.0

0 comments on commit a7227ca

Please sign in to comment.