2025-08-13 08:45:18 +02:00
|
|
|
|
# Postauto
|
|
|
|
|
|
### Poster automatiquement via une simple commande depuis un VPS, dédié ou seedbox
|
|
|
|
|
|
|
|
|
|
|
|
**Postauto** est un ensemble de scripts (bash + une petite UI web Node.js) qui :
|
|
|
|
|
|
- génèrent les **PAR2**
|
|
|
|
|
|
- postent via **Nyuu** (avec **obfuscation**)
|
|
|
|
|
|
- envoient automatiquement sur le site (MediaInfo/BDInfo inclus)
|
|
|
|
|
|
- proposent un **suivi sur une page web**
|
|
|
|
|
|
|
|
|
|
|
|
## Sommaire
|
|
|
|
|
|
- [Prérequis](#prérequis)
|
|
|
|
|
|
- [Installation](#installation)
|
|
|
|
|
|
- [Configuration (bash)](#configuration-bash--homeuserautopostconfsh)
|
|
|
|
|
|
- [Configuration (UI web)](#configuration-ui-web--homeuserautopostconfigjs)
|
|
|
|
|
|
- [Création de la base](#création-de-la-base)
|
|
|
|
|
|
- [Commandes CLI](#commandes-cli)
|
|
|
|
|
|
- [Interface web](#interface-web)
|
|
|
|
|
|
- [Configuration Nginx](#configuration-nginx)
|
|
|
|
|
|
- [Mise à jour](#mise-à-jour)
|
2025-08-13 08:51:01 +02:00
|
|
|
|
- [Automatique](#automatique)
|
|
|
|
|
|
- [Manuellement](#manuellement)
|
2025-08-13 08:45:18 +02:00
|
|
|
|
- [Désinstallation](#désinstallation)
|
|
|
|
|
|
- [Limitations](#limitations)
|
|
|
|
|
|
- [Dépannage](#dépannage)
|
|
|
|
|
|
|
|
|
|
|
|
## Prérequis
|
|
|
|
|
|
- Linux (script bash)
|
|
|
|
|
|
- Accès **SSH** (sur `/home/$USER`)
|
|
|
|
|
|
- Outils de base : `basename`, `curl`, `screen`, `nginx` (pour l’UI web)
|
|
|
|
|
|
- Testé avec :
|
|
|
|
|
|
- VPS / dédiés ✅
|
|
|
|
|
|
- Seedbox : Ultra.cc ✅, Whatbox ✅, Dediseedbox ❌ (limitations)
|
|
|
|
|
|
|
|
|
|
|
|
> L’installateur installe/emballe tout le reste (mediainfo, sqlite3 si besoin, 7z, BDInfo, Nyuu, ParPar, Node v22, modules npm…).
|
|
|
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
|
|
|
|
### Avec droits sudo (recommandé)
|
|
|
|
|
|
Installe mediainfo/sqlite via paquets Debian (meilleure compatibilité) :
|
|
|
|
|
|
```bash
|
|
|
|
|
|
wget -qO install.sh https://tig.unfr.pw/UNFR/postauto/raw/branch/main/install.sh \
|
|
|
|
|
|
&& chmod +x install.sh \
|
|
|
|
|
|
&& sudo --preserve-env=HOME ./install.sh
|
2025-02-01 22:22:26 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
### Sans sudo
|
|
|
|
|
|
Utilise des binaires « standalone » dans `~/bin` :
|
|
|
|
|
|
```bash
|
|
|
|
|
|
wget -qO install.sh https://tig.unfr.pw/UNFR/postauto/raw/branch/main/install.sh \
|
|
|
|
|
|
&& chmod +x install.sh \
|
|
|
|
|
|
&& ./install.sh
|
2025-02-21 11:17:46 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
## Configuration (bash) — `/home/$USER/autopost/conf.sh`
|
2025-03-12 11:47:10 +01:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
> Variables **obligatoires** (placeholders à remplacer), + règles **sqlite/mysql**.
|
2025-03-12 11:47:10 +01:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
```bash
|
2025-02-01 22:22:26 +01:00
|
|
|
|
#!/bin/bash
|
2025-08-13 08:45:18 +02:00
|
|
|
|
# CONFIG À MODIFIER
|
2025-02-01 22:22:26 +01:00
|
|
|
|
URL_API="A NOUS DEMANDER SUR DISCORD"
|
|
|
|
|
|
APIKEY="A RETROUVER DANS VOTRE PROFIL"
|
2025-08-13 08:45:18 +02:00
|
|
|
|
|
2025-02-01 22:22:26 +01:00
|
|
|
|
DOSSIER_GLOBAL="/home/$USER/"
|
|
|
|
|
|
DOSSIER_NFO="/home/$USER/autopost/mediainfo/"
|
2025-02-02 11:10:55 +01:00
|
|
|
|
DOSSIER_LOGS="/home/$USER/autopost/logs/"
|
2025-08-13 08:45:18 +02:00
|
|
|
|
DOSSIER_NZB_ATTENTE="/home/$USER/autopost/ATTENTE/"
|
|
|
|
|
|
DOSSIER_NZB_FINAL="/home/$USER/autopost/FINIS/"
|
|
|
|
|
|
|
|
|
|
|
|
# cp -rl | cp -rs | ln -s | mv | cp
|
|
|
|
|
|
MOVE_CMD="cp -rl"
|
2025-02-01 22:22:26 +01:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
# CONFIG FOURNISSEUR USENET DE POST (requis)
|
2025-02-01 22:22:26 +01:00
|
|
|
|
NG_HOST=""
|
|
|
|
|
|
NG_PORT=""
|
|
|
|
|
|
NG_USER=""
|
|
|
|
|
|
NG_PASS=""
|
|
|
|
|
|
NG_NBR_CONN=""
|
2025-06-23 14:38:15 +02:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
# Base de données
|
|
|
|
|
|
dbtype="sqlite" # ou "mysql"
|
|
|
|
|
|
MYSQL_TABLE="release" # OBLIGATOIRE
|
|
|
|
|
|
|
|
|
|
|
|
# sqlite -> DB_FILE requis, champs MySQL facultatifs
|
2025-06-23 14:38:15 +02:00
|
|
|
|
DB_FILE="/home/$USER/autopost/base_autopost.db"
|
2025-08-13 08:45:18 +02:00
|
|
|
|
|
|
|
|
|
|
# mysql -> champs MySQL requis, DB_FILE facultatif
|
2025-06-23 14:38:15 +02:00
|
|
|
|
MYSQL_HOST=""
|
|
|
|
|
|
MYSQL_PORT=
|
|
|
|
|
|
MYSQL_USER=""
|
|
|
|
|
|
MYSQL_PASS=""
|
|
|
|
|
|
MYSQL_DB=""
|
2025-02-01 22:22:26 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
**Rappels :**
|
|
|
|
|
|
- Si `dbtype="sqlite"` → **`DB_FILE` requis** ; `MYSQL_*` facultatifs.
|
|
|
|
|
|
- Si `dbtype="mysql"` → **`MYSQL_HOST/PORT/USER/PASS/DB` requis** ; `DB_FILE` facultatif.
|
|
|
|
|
|
- Les dossiers `DOSSIER_*` doivent **exister**.
|
2025-02-01 22:22:26 +01:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
## Configuration (UI web) — `/home/$USER/autopost/config.js`
|
2025-02-01 22:22:26 +01:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
> Champs **obligatoires** + règles **sqlite/mysql** + proxy/HTTPS.
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
2025-08-13 08:45:18 +02:00
|
|
|
|
// Réseau
|
|
|
|
|
|
port: 3000, // ⚠️ Choisissez un port autorisé par votre hébergeur (Ultra.cc: `app-ports free`)
|
|
|
|
|
|
name: 'NomDuNoeud', // Nom affiché dans l’UI
|
|
|
|
|
|
background_color: 'slate-900', // Tailwind color: https://tailwindcss.com/docs/colors
|
|
|
|
|
|
|
|
|
|
|
|
// Base de données
|
|
|
|
|
|
dbtype: 'sqlite', // 'sqlite' ou 'mysql'
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
// sqlite -> dbFile requis
|
2025-05-15 14:03:34 +02:00
|
|
|
|
dbFile: path.join(__dirname, 'base_autopost.db'),
|
2025-08-13 08:45:18 +02:00
|
|
|
|
|
|
|
|
|
|
// mysql -> champs requis
|
2025-06-23 14:38:15 +02:00
|
|
|
|
DB_HOST: '',
|
2025-08-13 08:45:18 +02:00
|
|
|
|
DB_PORT: 3306,
|
2025-06-23 14:38:15 +02:00
|
|
|
|
DB_USER: '',
|
|
|
|
|
|
DB_PASSWORD: '',
|
|
|
|
|
|
DB_DATABASE: '',
|
2025-08-13 08:45:18 +02:00
|
|
|
|
DB_TABLE: 'release',
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
// Dossiers
|
2025-05-15 14:03:34 +02:00
|
|
|
|
finishdirectory: path.join(__dirname, 'FINIS'),
|
2025-08-13 08:45:18 +02:00
|
|
|
|
logdirectory: path.join(__dirname, 'logs'),
|
|
|
|
|
|
infodirectory: path.join(__dirname, 'mediainfo'),
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
// Sessions (générer un secret : `curl -L pw.vdx.sh/w/32`)
|
|
|
|
|
|
sessionSecret: 'collez-ici-le-secret-généré',
|
|
|
|
|
|
trustProxy: 0, // 0 = pas de proxy, 1 = Nginx, 2 = Cloudflare->Nginx, etc.
|
|
|
|
|
|
cookieSecure: false, // true si HTTPS bout-à-bout (reverse proxy compris)
|
|
|
|
|
|
sessionStorePath: './sessions',
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
// Auth UI (à changer !)
|
2025-05-15 14:03:34 +02:00
|
|
|
|
auth: {
|
|
|
|
|
|
username: 'user',
|
|
|
|
|
|
password: 'pass'
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
**Rappels :**
|
|
|
|
|
|
- `dbtype: 'sqlite'` → **`dbFile` requis** ; `DB_*` facultatifs.
|
|
|
|
|
|
- `dbtype: 'mysql'` → **`DB_HOST/PORT/USER/PASSWORD/DATABASE` requis** ; `dbFile` facultatif.
|
|
|
|
|
|
- Si vous êtes derrière Nginx/Cloudflare, ajustez **`trustProxy`** et **`cookieSecure`**.
|
|
|
|
|
|
- Les dossiers `finishdirectory`, `logdirectory`, `infodirectory` doivent **exister**.
|
|
|
|
|
|
|
|
|
|
|
|
## Création de la base
|
|
|
|
|
|
```bash
|
|
|
|
|
|
postauto createdb
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Commandes CLI
|
|
|
|
|
|
|
|
|
|
|
|
| Commande | Description |
|
|
|
|
|
|
|-----------|-------------|
|
|
|
|
|
|
| `start` | Démarre le script principal. |
|
|
|
|
|
|
| `stop` | Arrête le script. |
|
|
|
|
|
|
| `restart` | Redémarre le script. |
|
|
|
|
|
|
| `show` | Entre dans la session `screen` (Ctrl+A puis D pour détacher). |
|
|
|
|
|
|
| `status` | Affiche les 500 derniers enregistrements avec leur statut (Attente / Échec / Succès). |
|
|
|
|
|
|
| `add` | Ajoute un **fichier MKV** à traiter (chemin complet requis). |
|
|
|
|
|
|
| `createdb`| Crée (ou recrée, avec confirmation) la base de données. |
|
|
|
|
|
|
| `log` | Affiche le log de post pour un fichier donné. |
|
|
|
|
|
|
| `check` | Vérifie la présence d’un fichier sur le site. |
|
|
|
|
|
|
| `update` | Met à jour les scripts. |
|
|
|
|
|
|
|
|
|
|
|
|
> Autocomplétion bash fournie (install/update l’activent automatiquement).
|
|
|
|
|
|
|
|
|
|
|
|
## Interface web
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
- L’installateur installe **Node v22** (via `nvm`) et tous les modules requis.
|
|
|
|
|
|
- Lancer l’UI (ex. en arrière-plan) :
|
|
|
|
|
|
```bash
|
|
|
|
|
|
postauto restart
|
|
|
|
|
|
```
|
|
|
|
|
|
(ou configurez un service systemd / `pm2` selon vos préférences)
|
|
|
|
|
|
|
|
|
|
|
|
### Configuration Nginx
|
|
|
|
|
|
|
|
|
|
|
|
> **Important :** les routes statiques sont servies sous **`/autopost`**.
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
|
|
|
|
|
```nginx
|
2025-08-13 08:45:18 +02:00
|
|
|
|
# Remplacez 127.0.0.1:3000 par le host:port de votre UI (voir config.js: port)
|
2025-05-15 14:03:34 +02:00
|
|
|
|
location /autopost/ {
|
2025-08-13 08:45:18 +02:00
|
|
|
|
proxy_pass http://127.0.0.1:3000;
|
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2025-05-15 14:03:34 +02:00
|
|
|
|
}
|
2025-08-13 08:45:18 +02:00
|
|
|
|
|
2025-08-13 08:47:07 +02:00
|
|
|
|
location /js/ {
|
2025-08-13 08:45:18 +02:00
|
|
|
|
proxy_pass http://127.0.0.1:3000;
|
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2025-08-11 18:43:12 +02:00
|
|
|
|
}
|
2025-08-13 08:45:18 +02:00
|
|
|
|
|
2025-08-13 08:47:07 +02:00
|
|
|
|
location /jquery/ {
|
2025-08-13 08:45:18 +02:00
|
|
|
|
proxy_pass http://127.0.0.1:3000;
|
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2025-08-11 18:43:12 +02:00
|
|
|
|
}
|
2025-05-15 14:03:34 +02:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
> Réglez **`trustProxy`** (1 pour Nginx, 2 pour Cloudflare→Nginx) et mettez **`cookieSecure: true`** si le site est servi en **HTTPS**.
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
## Mise à jour
|
2025-08-13 08:51:01 +02:00
|
|
|
|
### Automatique
|
|
|
|
|
|
```bash
|
|
|
|
|
|
postauto restart
|
|
|
|
|
|
```
|
|
|
|
|
|
ou
|
|
|
|
|
|
```bash
|
|
|
|
|
|
postauto stop
|
|
|
|
|
|
postauto update
|
|
|
|
|
|
```
|
2025-05-15 14:03:34 +02:00
|
|
|
|
|
2025-08-13 08:51:01 +02:00
|
|
|
|
### Manuellement
|
2025-08-13 08:45:18 +02:00
|
|
|
|
```bash
|
|
|
|
|
|
postauto stop \
|
|
|
|
|
|
&& wget -qO update.sh https://tig.unfr.pw/UNFR/postauto/raw/branch/main/update.sh \
|
|
|
|
|
|
&& chmod +x update.sh \
|
|
|
|
|
|
&& ./update.sh
|
|
|
|
|
|
```
|
2025-02-01 22:22:26 +01:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
### Passage en 7z (12/03/2024)
|
|
|
|
|
|
```bash
|
|
|
|
|
|
cd ~/autopost
|
|
|
|
|
|
wget -qO compress.sh https://tig.unfr.pw/UNFR/postauto/raw/branch/main/autopost/compress.sh \
|
|
|
|
|
|
&& chmod +x compress.sh \
|
|
|
|
|
|
&& ./compress.sh
|
2025-02-01 22:22:26 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
## Désinstallation
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
wget -qO uninstall.sh https://tig.unfr.pw/UNFR/postauto/raw/branch/main/uninstall.sh \
|
|
|
|
|
|
&& chmod +x uninstall.sh \
|
|
|
|
|
|
&& ./uninstall.sh
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
- Propose d’arrêter `postauto`, de supprimer la conf, la base, les NZB, et les fichiers Node.
|
|
|
|
|
|
- Nettoie l’autocomplétion (`~/.bash_completion.d/postauto`) et l’ancien bloc éventuel dans `~/.bashrc`.
|
|
|
|
|
|
|
|
|
|
|
|
## Limitations
|
|
|
|
|
|
- Bash → Linux uniquement.
|
|
|
|
|
|
- Accès SSH requis sur `/home/$USER`.
|
|
|
|
|
|
- Les seedbox peuvent restreindre les ports et/ou l’exécution de services persistants (voir hébergeur).
|
|
|
|
|
|
|
|
|
|
|
|
## Dépannage
|
|
|
|
|
|
|
|
|
|
|
|
- **Port refusé** : choisissez un port autorisé (Ultra.cc : `app-ports free`).
|
|
|
|
|
|
- **Node manquant** : relancez `install.sh` (il installe `nvm` + Node v22).
|
|
|
|
|
|
- **MediaInfo/sqlite** : avec sudo, installés via apt ; sans sudo, binaires fournis dans `~/bin`.
|
|
|
|
|
|
- **Erreur GLIBC** sur sqlite ou autre binaire : utilisez la version embarquée par l’installateur (dans `~/bin`).
|
|
|
|
|
|
- **Sessions** derrière Nginx : mettez `trustProxy` à `1` (ou `2` via Cloudflare→Nginx) et `cookieSecure: true` si HTTPS.
|
|
|
|
|
|
- **Dossiers manquants** : créez/ajustez `DOSSIER_*` (bash) et `*directory` (UI).
|
2025-02-01 22:22:26 +01:00
|
|
|
|
|
2025-08-13 08:45:18 +02:00
|
|
|
|
## Développement
|
|
|
|
|
|
Vos idées et axes d’amélioration sont les bienvenus — PRs et issues appréciés 🙂
|