Modification du lien de la doc pour pointer vers le wiki du projet.
This commit is contained in:
@@ -20,4 +20,4 @@ python3 scrape_server.py
|
|||||||
curl "http://127.0.0.1:8765/?hash=3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
curl "http://127.0.0.1:8765/?hash=3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
||||||
```
|
```
|
||||||
|
|
||||||
[Documentation complète](docs/) · [Démo interactive](https://team4kw.fr/trigun-remaster-1080p/#infos)
|
[Documentation complète](https://git.azuze.fr/kawa/Torrent-Indicator/wiki/?action=_pages) · [Démo interactive](https://team4kw.fr/trigun-remaster-1080p/#infos)
|
||||||
|
|||||||
@@ -1,120 +0,0 @@
|
|||||||
# Installation
|
|
||||||
|
|
||||||
## Prérequis
|
|
||||||
|
|
||||||
- VPS Linux avec Python 3.8+
|
|
||||||
- nginx
|
|
||||||
- Certbot
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 1. Déployer le serveur Python
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo mkdir -p /var/www/torrent-indicator
|
|
||||||
sudo cp scrape_server.py /var/www/torrent-indicator/
|
|
||||||
```
|
|
||||||
|
|
||||||
### Activer le service systemd
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo cp torrent-scrape.service /etc/systemd/system/
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable --now torrent-scrape
|
|
||||||
```
|
|
||||||
|
|
||||||
Vérifier :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo systemctl status torrent-scrape
|
|
||||||
# ● torrent-scrape.service - Torrent Tracker Scrape Server
|
|
||||||
# Active: active (running)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. Obtenir le certificat SSL
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo certbot certonly --nginx -d torrent-api.monsite.com
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 3. Configurer nginx
|
|
||||||
|
|
||||||
Ajouter dans `/etc/nginx/sites-available/votresite` :
|
|
||||||
|
|
||||||
```nginx
|
|
||||||
server {
|
|
||||||
server_name torrent-api.monsite.com;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:8765/;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_read_timeout 15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
listen 443 ssl;
|
|
||||||
ssl_certificate /etc/letsencrypt/live/torrent-api.monsite.com/fullchain.pem;
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/torrent-api.monsite.com/privkey.pem;
|
|
||||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
if ($host = torrent-api.monsite.com) {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
listen 80;
|
|
||||||
server_name torrent-api.monsite.com;
|
|
||||||
return 404;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo nginx -t && sudo nginx -s reload
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. Vérifier l'API publique
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl "https://torrent-api.monsite.com/?hash=3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
|
||||||
```
|
|
||||||
|
|
||||||
Réponse attendue :
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"seeders": 1234,
|
|
||||||
"leechers": 56,
|
|
||||||
"health": "excellent",
|
|
||||||
"popularity": "popular",
|
|
||||||
"sources": 4
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Les paramètres se trouvent en haut de `scrape_server.py` :
|
|
||||||
|
|
||||||
| Variable | Défaut | Description |
|
|
||||||
|---|---|---|
|
|
||||||
| `HOST` | `127.0.0.1` | Interface d'écoute |
|
|
||||||
| `PORT` | `8765` | Port du serveur |
|
|
||||||
| `TIMEOUT` | `7` | Timeout par tracker (secondes) |
|
|
||||||
| `CACHE_TTL` | `300` | Durée du cache (secondes) |
|
|
||||||
| `TRACKERS` | *(liste)* | Trackers HTTP interrogés |
|
|
||||||
|
|
||||||
Après modification, redémarrer le service :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo systemctl restart torrent-scrape
|
|
||||||
```
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
# Intégration hors Ghost
|
|
||||||
|
|
||||||
Le widget fonctionne sur n'importe quelle page HTML. Voir `demo.html` pour des exemples concrets.
|
|
||||||
|
|
||||||
## Intégration en 2 étapes
|
|
||||||
|
|
||||||
### 1. Ajouter le CSS et le JS
|
|
||||||
|
|
||||||
Copier le bloc `<style>` et le bloc `<script>` depuis `ghost-inject.html` dans votre page.
|
|
||||||
Adapter `API_URL` :
|
|
||||||
|
|
||||||
```html
|
|
||||||
<style id="ti-styles">
|
|
||||||
/* ... contenu de ghost-inject.html ... */
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/* ... contenu de ghost-inject.html ... */
|
|
||||||
var API_URL = 'https://torrent-api.monsite.com';
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Le script se place de préférence juste avant `</body>`.
|
|
||||||
|
|
||||||
### 2. Placer les widgets dans le HTML
|
|
||||||
|
|
||||||
```html
|
|
||||||
<!-- Compact -->
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-hash="3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
|
||||||
data-label="Ubuntu 24.04 LTS"></div>
|
|
||||||
|
|
||||||
<!-- Large -->
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-hash="3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
|
||||||
data-label="Ubuntu 24.04 LTS"
|
|
||||||
data-layout="wide"></div>
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Cas d'usage
|
|
||||||
|
|
||||||
### Page de téléchargement
|
|
||||||
|
|
||||||
```html
|
|
||||||
<h2>Télécharger</h2>
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-magnet="magnet:?xt=urn:btih:3b245504..."
|
|
||||||
data-label="Ubuntu 24.04 LTS"
|
|
||||||
data-layout="wide"></div>
|
|
||||||
<a href="magnet:?xt=urn:btih:3b245504...">Ouvrir le magnet</a>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tableau comparatif de plusieurs torrents
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div style="display:flex; gap:16px; flex-wrap:wrap;">
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-hash="3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
|
||||||
data-label="Ubuntu 24.04"></div>
|
|
||||||
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-hash="9bb80f655e2a0490b1ed7b19b63a7b2acacffe0e"
|
|
||||||
data-label="Debian 12"></div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Création dynamique via JavaScript
|
|
||||||
|
|
||||||
```html
|
|
||||||
<button onclick="addWidget()">Vérifier le torrent</button>
|
|
||||||
<div id="result"></div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function addWidget() {
|
|
||||||
var el = document.createElement('div');
|
|
||||||
el.className = 'torrent-indicator';
|
|
||||||
el.setAttribute('data-hash', '3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0');
|
|
||||||
el.setAttribute('data-layout', 'wide');
|
|
||||||
document.getElementById('result').appendChild(el);
|
|
||||||
TorrentIndicator.init(el);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Rafraîchissement manuel
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Rafraîchir tous les widgets de la page
|
|
||||||
TorrentIndicator.refreshAll();
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Compatibilité
|
|
||||||
|
|
||||||
- Navigateurs modernes (Chrome, Firefox, Safari, Edge)
|
|
||||||
- Aucune dépendance externe
|
|
||||||
- Fonctionne avec : sites statiques, WordPress, Joomla, Drupal, forums, etc.
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
# Widget Ghost
|
|
||||||
|
|
||||||
## 1. Code Injection (une seule fois)
|
|
||||||
|
|
||||||
Dans **Ghost Admin → Settings → Code injection → Site Header**, coller tout le contenu de `ghost-inject.html`.
|
|
||||||
|
|
||||||
Mettre à jour l'URL de l'API en haut du script :
|
|
||||||
|
|
||||||
```js
|
|
||||||
var API_URL = 'https://torrent-api.monsite.com';
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. Utilisation dans les articles
|
|
||||||
|
|
||||||
Dans l'éditeur Ghost, insérer un bloc **HTML** et coller l'un des snippets suivants.
|
|
||||||
|
|
||||||
### Layout compact (vertical)
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-hash="3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
|
||||||
data-label="Ubuntu 24.04 LTS"></div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Layout large (horizontal, centré)
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-hash="3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0"
|
|
||||||
data-label="Ubuntu 24.04 LTS"
|
|
||||||
data-layout="wide"></div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via lien magnet
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="torrent-indicator"
|
|
||||||
data-magnet="magnet:?xt=urn:btih:3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0&dn=ubuntu"
|
|
||||||
data-label="Ubuntu 24.04 LTS"
|
|
||||||
data-layout="wide"></div>
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Attributs disponibles
|
|
||||||
|
|
||||||
| Attribut | Requis | Description |
|
|
||||||
|---|---|---|
|
|
||||||
| `data-hash` | Oui* | Info hash hexadécimal (40 caractères) |
|
|
||||||
| `data-magnet` | Oui* | Lien magnet complet |
|
|
||||||
| `data-label` | Non | Titre affiché dans l'en-tête du widget |
|
|
||||||
| `data-layout` | Non | `wide` pour le layout horizontal |
|
|
||||||
|
|
||||||
*`data-hash` ou `data-magnet`, l'un des deux est obligatoire.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Valeurs retournées
|
|
||||||
|
|
||||||
### Santé (`health`)
|
|
||||||
|
|
||||||
| Valeur | Condition |
|
|
||||||
|---|---|
|
|
||||||
| `dead` | 0 seeder |
|
|
||||||
| `poor` | ratio seeders/(seeders+leechers) < 20 % |
|
|
||||||
| `good` | ratio ≥ 20 % |
|
|
||||||
| `excellent` | ratio ≥ 50 % |
|
|
||||||
|
|
||||||
### Popularité (`popularity`)
|
|
||||||
|
|
||||||
| Valeur | Total seeders + leechers |
|
|
||||||
|---|---|
|
|
||||||
| `low` | < 10 |
|
|
||||||
| `moderate` | 10 – 99 |
|
|
||||||
| `popular` | 100 – 999 |
|
|
||||||
| `viral` | ≥ 1 000 |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Cache et données périmées
|
|
||||||
|
|
||||||
Le serveur met les résultats en cache 5 minutes. Si les trackers sont temporairement inaccessibles, le widget affiche les dernières données connues avec la mention *données en cache* dans le pied de page, plutôt qu'un message d'erreur.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## API publique JavaScript
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Rafraîchir tous les widgets de la page
|
|
||||||
TorrentIndicator.refreshAll();
|
|
||||||
|
|
||||||
// Initialiser un élément spécifique
|
|
||||||
TorrentIndicator.init(document.querySelector('.torrent-indicator'));
|
|
||||||
```
|
|
||||||
Reference in New Issue
Block a user