OpnsenseAppControl/README.md

60 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🧠 System Overview
### Frontend (HTML/JS/CSS)
```
└── `/api/getListApp` reads `listApp.txt` and fetches init data from OPNsense
└── `/update` applies `app_controls` to Zenarmor via `fetch`
```
### Backend (Node.js + Express)
```
└── Uses Puppeteer for headless login
└── Session auto-refresh every 5 minutes
└── API forwarding with CSRF token + cookie
```
---
# 📁 Project Structure
```
├── public/
│ └── index.html ← Frontend UI
├── listApp.txt ← Line-separated JSON data of apps
├── server.js ← Express backend + OPNsense bridge
└── README.md ← This file
```
---
# 🛠️ Setup & Run
### 1. Install dependencies
```bash
npm install
```
> ⚠️ If using `node-fetch@3+`, it requires ESM.
> ✅ This script handles it via dynamic import.
---
### 2. Start the server
```bash
node server.js
```
* Login will be performed immediately.
* Session will auto-refresh every 5 minutes.
---
# 🔐 Config
* Change `SERVER_DOMAIN` in `public/index.html`
* Change `OPENSENSE_DOMAIN` in `server.js`