Skip to content

Commit e7c531e

Browse files
reworked on the pypi page
1 parent a5d3941 commit e7c531e

3 files changed

Lines changed: 115 additions & 82 deletions

File tree

.github/workflows/pypi-publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build-and-publish:
13+
name: Build and publish Python 🐍 distribution 📦 to PyPI
14+
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write # IMPORTANT: this is required for trusted publishing
17+
18+
steps:
19+
- name: Checkout Source Code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Build generic package distributions
28+
run: |
29+
cd server
30+
python -m pip install build
31+
python -m build
32+
33+
- name: Publish package distribution to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
packages-dir: server/dist/

server/README.md

Lines changed: 77 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,108 @@
1-
# GuGa Server — Technical Deep Dive
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/PositiveMatician/GuGa-Nexus/main/app-stable/app/src/main/assets/logo.png" width="128" height="128" />
3+
</p>
24

3-
This document provides a comprehensive technical overview of the GuGa-Nexus backend. It is intended for developers, maintainers, or anyone looking to understand the inner workings of the system.
5+
<h1 align="center">GuGa Nexus</h1>
46

5-
---
6-
7-
## 🏗️ System Architecture
8-
9-
GuGa is a distributed notification relay system. The architecture consists of three main local components interacting with a remote Android client:
7+
<p align="center">
8+
Send your Linux terminal and OS notifications straight to your Android.<br/>
9+
No cloud. No subscription. No port forwarding.
10+
</p>
1011

11-
1. **Core Server (`server.py`)**: The central hub. It manages client sessions (browsers and Android apps), handles authentication (pairing), and provides a private REST/SocketIO interface for message ingestion.
12-
2. **OS Alerter (`os_notification_alerter.py`)**: A passive listener that monitors the Linux D-Bus for `org.freedesktop.Notifications`. When an OS notification is detected, it cleans the text and forwards it to the Core Server via a local POST request.
13-
3. **CLI Tool (`guga_push.py`)**: An active pusher. It allows users or scripts to manually trigger notifications. It handles both simple messages and "command watching" (monitoring a subprocess and notifying on completion).
12+
<p align="center">
13+
<a href="https://pypi.org/project/GuGa/">
14+
<img src="https://img.shields.io/pypi/v/GuGa.svg" alt="PyPI Version" />
15+
</a>
16+
<img src="https://img.shields.io/badge/platform-Linux-lightgrey" alt="Platform" />
17+
<img src="https://img.shields.io/badge/encryption-AES--256--GCM-green" alt="Encryption" />
18+
<img src="https://img.shields.io/badge/license-MIT-yellow" alt="License" />
19+
</p>
1420

15-
```mermaid
16-
graph TD
17-
A[OS Notifications] -->|D-Bus| B(OS Alerter)
18-
C[User/Scripts] -->|CLI| D(guga CLI)
19-
B -->|Local POST| E[Core Server]
20-
D -->|Local POST| E
21-
E -->|SocketIO / AES-GCM| F{Network}
22-
F -->|Local/Cloudflare| G[Android App]
23-
F -->|HTTPS| H[Web Dashboard]
24-
```
21+
🔗 [View the full Open Source Repository on GitHub](https://github.com/PositiveMatician/GuGa-Nexus)
2522

2623
---
2724

28-
## 📂 Project Structure (Technical)
25+
**GuGa Nexus** is a minimalist, privacy-focused ecosystem that bridges your Linux machine and your Android device. It uses end-to-end AES-256-GCM encryption and works strictly over your own local network or a direct Cloudflare Tunnel—never storing your data on a third-party server.
2926

30-
| File / Directory | Purpose |
31-
| :--- | :--- |
32-
| `server.py` | Main application entry point. Handles Flask routes, SocketIO events, and device pairing logic. |
33-
| `setup.py` | Environment initialization script. Detects package managers, installs system deps (dbus), and downloads `cloudflared`. |
34-
| `os_notification_alerter.py` | Subprocess-based D-Bus monitor. Forwards desktop alerts to the server. |
35-
| `guga_push.py` | The logic for the `guga` CLI tool. Uses only Python standard library where possible for maximum portability. |
36-
| `trusted_devices.json` | Persistent store for paired device IDs, encryption tokens, and expiry timestamps. |
37-
| `requirements.txt` | Python dependency list (Flask, SocketIO, Cryptography, python-dotenv). |
38-
| `cloudflared` | (Generated) The Cloudflare Tunnel binary used for zero-config remote access. |
39-
| `man/` | Contains the manual pages for the `guga` tool. |
27+
- **Waiting for a long script to finish?** Get notified the moment it's done.
28+
- **Training a model overnight?** Wake up to the final accuracy line in your notification.
29+
- **SSHed into a remote server?** GuGa reaches your phone over the internet seamlessly.
4030

4131
---
4232

43-
## 🔐 Security Implementation
33+
## Installation
4434

45-
### End-to-End Encryption (AES-256-GCM)
46-
Except for the initial pairing handshake, all data sent to Android apps is encrypted locally using **AES-256-GCM**.
47-
- **Key Generation**: During pairing, a unique 256-bit hex token is generated via `secrets.token_hex(32)`.
48-
- **Persistence**: This token is stored on the server in `trusted_devices.json` and on the phone in secure storage.
49-
- **Payload**: Each message includes a random 12-byte IV and the base64-encoded ciphertext.
35+
GuGa is distributed strictly as a standard Python module via PyPI.
5036

51-
### Zero-Trust Handshake
52-
Pairing follows a strict 8-digit PIN protocol:
53-
1. Device sends a `hello` with a unique ID.
54-
2. Server generates a random 8-digit PIN and prints it to the *physical terminal*.
55-
3. User enters the PIN on the device.
56-
4. If the PIN matches, the server issues a long-lived hex token.
37+
1. **Install the package:**
38+
```bash
39+
pip install GuGa
40+
```
5741

58-
### Network Isolation
59-
- The `/send` route (used by the Alerter and CLI) only accepts requests from `127.0.0.1` or `::1`.
60-
- This ensures that only local processes can "push" notifications to your phone.
42+
2. **Initialize the background daemon:**
43+
```bash
44+
guga --install-service
45+
```
46+
*(This interactive setup will cleanly provision your systemd daemon and configure your network routing. Afterwards, your QR code will be generated).*
47+
48+
3. **Install the Android App:**
49+
Download the `stable` Android APK from the [GitHub Releases Page](https://github.com/PositiveMatician/GuGa-Nexus/releases) and scan the QR code printed in your terminal!
6150

6251
---
6352

64-
## 📡 D-Bus Alerter Logic
53+
## 🚀 Examples & Usage
6554

66-
The `os_notification_alerter.py` script spawns `dbus-monitor` as an asynchronous subprocess. It filters specifically for:
67-
`interface='org.freedesktop.Notifications', member='Notify'`
55+
Once deployed, the `guga` command-line utility is globally available on your terminal. It's designed to automatically detect whether you want to send a plain text notification, or if you want it to execute and watch a long-running process on your behalf.
6856

69-
It uses a state-machine parser to extract the **App Name**, **Summary (Title)**, and **Body** from the multi-line D-Bus output. It also includes a `clean_text` utility to strip HTML tags and Markdown formatting that some Linux desktop environments include in notifications.
57+
### 1. Plain Notifications (Message Mode)
58+
Send simple text updates directly to your Android device.
7059

71-
---
60+
```bash
61+
# Push a simple message
62+
guga "Build finished successfully ✅"
7263

73-
## ⚙️ Environment Configuration (`.env`)
64+
# You can also stream output into it via stdin!
65+
echo "Database migration complete" | guga
66+
```
67+
68+
### 2. Process Watching (Run Mode)
69+
Put `guga` in front of any command. It will execute the command natively while streaming the output to your terminal just as normal. Once the command finishes, it will instantly notify your phone with the **Elapsed Time**, **Exit Status**, and the **Last Console Line**.
70+
71+
```bash
72+
# Get notified when training finishes
73+
guga python train_model.py --epochs 100
7474

75-
The server and its adapters read configuration from `server/.env`.
75+
# Compile code and get notified if it succeeded or crashed
76+
guga make build-project
7677

77-
| Key | Type | Default | Description |
78-
| :--- | :--- | :--- | :--- |
79-
| `PORT` | `int` | `6769` | The port the Flask/SocketIO server listens on. |
80-
| `MODE` | `str` | `public` | `lan` for local network only, or `public` to spawn a Cloudflare Tunnel. |
81-
| `ENABLE_OS_NOTIFICATIONS` | `bool` | `False` | Whether `server.py` should automatically spawn the Alerter subprocess. |
82-
| `ALERTER_SERVER_URL` | `url` | `http://localhost:6769/send` | The endpoint the Alerter targets. |
83-
| `GUGA_VERBOSE` | `bool` | `false` | Enable detailed debug logging (encryption/decryption traces). |
78+
# Add custom labels to your notifications for clarity
79+
guga -r ./deploy.sh --title "Production Server"
80+
```
8481

8582
---
8683

87-
## 🛠️ Development & Maintenance
84+
## Post-Install Utilities
8885

89-
### 🔍 Logging & Debugging
90-
The server uses a structured event logging system. To see more detailed information, including raw SocketIO traffic and encryption/decryption traces, set the `GUGA_VERBOSE` environment variable:
86+
If you need to view your pairing credentials or manage your background daemon after installation, GuGa provides several utility commands:
9187

9288
```bash
93-
GUGA_VERBOSE=true python server.py
89+
guga --qr # Show the pairing QR code
90+
guga --show-pin # Show the secure Zero-Trust PIN
91+
guga --install-service --reconfigure # Re-run the interactive setup
9492
```
9593

96-
#### Event Symbols
97-
| Symbol | Meaning |
98-
| :--- | :--- |
99-
| `` | Success (e.g., device paired) |
100-
| `` | Error / Failure (e.g., PIN rejected, decrypt failed) |
101-
| `` | Connected (New session established) |
102-
| `` | Disconnected (Session ended) |
103-
| `` | Command (Received phrase to process) |
104-
| `` | Reconnected (Known device identified) |
105-
| `` | Warning (e.g., token expired, tunnel fallback) |
106-
107-
### Resetting All Trust
108-
To revoke access for all devices, simply delete `trusted_devices.json` and restart the server.
109-
110-
### Adding New Commands
111-
The `process_command` function in `server.py` is the hook for adding remote execution capabilities. Currently, it acts as a placeholder for future feature expansion.
94+
To control the Linux backend server explicitly:
95+
```bash
96+
sudo systemctl start guga # Start the server daemon
97+
sudo systemctl stop guga # Stop the server daemon
98+
journalctl -u guga -f # View live server connection logs
99+
```
100+
101+
---
102+
103+
## Core Features & Architecture
104+
105+
* **Terminal Tracking:** Push notifications to Android via the `guga` global CLI.
106+
* **System OS Monitoring:** Automatically intercepts DBus to forward your native Linux desktop notifications straight to your phone.
107+
* **Zero-Trust Coupling:** Cryptographically secure pairing logic relying strictly on visual QR transmission + 8-Digit PINs (No OAuth or cloud-accounts required).
108+
* **Network Versatility:** Operates flawlessly in **LAN-only mode** strictly over local WiFi, or seamlessly hooks into Cloudflared to grant you **Internet-anywhere access** without needing to own a domain or configure port-forwarding.

server/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ requires = ["setuptools>=61.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name = "guga"
7-
version = "1.0.1"
6+
name = "GuGa"
7+
version = "1.0.3"
88
description = "Linux to Android notification bridge."
99
readme = "README.md"
1010
requires-python = ">=3.7"

0 commit comments

Comments
 (0)