diff --git a/backend/routes.py b/backend/routes.py index ce47d6a..6934851 100644 --- a/backend/routes.py +++ b/backend/routes.py @@ -18,6 +18,8 @@ MAX_ATTEMPTS = 5 BLOCK_TIME = timedelta(minutes=15) MAX_SIZE_BYTES = 5*1024**3 +NB_PAGES = 2 + YGG_PASSKEY = "xj1MgNuyzFKCjOtnawGBC2egDOciUg04" ALLDEBRID_KEY = "mtrQI4h583rHe2ZpvpbC" @@ -87,18 +89,31 @@ def init_app(app): # Préparer l'URL url = "https://yggapi.eu/torrents" + + # Préparer les paramètres params = { - "page": 1, - "q": query, - "category_id" : category_id, - "order_by": "uploaded_at", - "per_page": 100 + "page": 1, + "q": query, + "order_by": "uploaded_at", + "per_page": 100 } + + # Ajouter la catégorie seulement si elle est renseignée et non vide + if category_id: + params["category_id"] = category_id + + results = [] + # Appeler l'API try: - response = requests.get(url, params=params, timeout=5) - response.raise_for_status() # déclenche une exception si erreur HTTP - results = response.json() + for page in range(1, NB_PAGES): + params['page'] = page + print("Appel API page", page, "avec params:", params) + response = requests.get(url, params=params, timeout=5) + response.raise_for_status() + data = response.json() # ici c'est une liste directement + print(f"Nombre de torrents reçus page {page}:", len(data)) + results.extend(data) except Exception as e: print("Erreur API Yggtorrent:", e) results = [] diff --git a/frontend/static/css/style.css b/frontend/static/css/style.css index ce33c71..cf490a1 100644 --- a/frontend/static/css/style.css +++ b/frontend/static/css/style.css @@ -1,18 +1,49 @@ body { - font-family: Arial, sans-serif; + background-color: black; + color: #e0e0e0; + font-family: "Courier New", monospace; margin: 20px; + display: flex; + flex-direction: column; + align-items: center; + min-height: 100vh; } header { - margin-bottom: 20px; -} -table { - width: 100%; - border-collapse: collapse; -} -th, td { - border: 1px solid #ccc; - padding: 5px 10px; + color: #00ff41; + text-shadow: 0 0 10px #00ff41; + margin-bottom: 50px; + text-align: center; } + th { - background-color: #f0f0f0; + /* background-color: rgba(0, 0, 0, 0.8); */ + background-color: #00ff41; + color: black; + font-weight:bold; } + +td { + background-color: rgba(0, 0, 0, 0.6); + font-weight:bold; +} + +.user-info { + display:inline; + margin-right:10px; + color:white; + font-weight:bold; +} + +.bold-label { + font-weight: bold; +} + +#results-table td:nth-child(2), +#results-table td:nth-child(3), +#results-table td:nth-child(4), +#results-table th:nth-child(2), +#results-table th:nth-child(3), +#results-table th:nth-child(4) { + white-space: nowrap; /* empêche le retour à la ligne */ + text-align: center; +} \ No newline at end of file diff --git a/frontend/static/js/matrix.js b/frontend/static/js/matrix.js new file mode 100644 index 0000000..c9bee1d --- /dev/null +++ b/frontend/static/js/matrix.js @@ -0,0 +1,76 @@ +const canvas = document.getElementById('matrix'); +const ctx = canvas.getContext('2d'); + +canvas.width = window.innerWidth; +canvas.height = window.innerHeight; + +const chars = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンあいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん0123456789!#$%&'()*+,-./:;<=>?@"; +const fontSize = 14; +let columns = Math.floor(canvas.width / fontSize); +let drops = Array.from({ length: columns }, () => Math.random() * canvas.height / fontSize); + +// Récupère les zones à masquer : formulaire + tableau +function getMaskRects() { + const rects = []; + const form = document.getElementById('search-form'); + if (form) rects.push(form.getBoundingClientRect()); + const table = document.getElementById('results-table'); + if (table) rects.push(table.getBoundingClientRect()); + return rects; +} + +// Calcul de l'opacité selon distance au centre de la zone +function opacityForPosition(x, y, rects) { + if (!rects || rects.length === 0) return 1; + let minOpacity = 1; + rects.forEach(rect => { + const cx = rect.left + rect.width / 2; + const cy = rect.top + rect.height / 2; + const dx = x - cx; + const dy = y - cy; + const distance = Math.sqrt(dx*dx + dy*dy); + const radius = Math.max(rect.width, rect.height) * 0.8; + + let alpha; + const inner = radius * 0.3; // centre complètement transparent réduit + const outer = radius; // bord complet visible + + if (distance < inner) alpha = 0; + else if (distance > outer) alpha = 1; + else alpha = (distance - inner) / (outer - inner); // transition plus large + + if (alpha < minOpacity) minOpacity = alpha; + }); + return minOpacity; +} + +function draw() { + ctx.fillStyle = "rgba(0,0,0,0.05)"; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + ctx.font = fontSize + "px monospace"; + + const maskRects = getMaskRects(); + + for (let i = 0; i < drops.length; i++) { + const text = chars.charAt(Math.floor(Math.random() * chars.length)); + const x = i * fontSize; + const y = drops[i] * fontSize; + + const alpha = opacityForPosition(x, y, maskRects); + ctx.fillStyle = `rgba(0,255,65,${alpha})`; + ctx.fillText(text, x, y); + + if (y > canvas.height && Math.random() > 0.98) drops[i] = 0; + drops[i]++; + } +} + +setInterval(draw, 20); + +window.addEventListener('resize', () => { + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + columns = Math.floor(canvas.width / fontSize); + drops = Array.from({ length: columns }, () => Math.random() * canvas.height / fontSize); +}); diff --git a/frontend/templates/base.html b/frontend/templates/base.html index ae523db..ff83d85 100644 --- a/frontend/templates/base.html +++ b/frontend/templates/base.html @@ -4,14 +4,30 @@ {% block title %}Yggtorrent App{% endblock %} - + + + {% block matrix %}{% endblock %} +

Les films de Lulu

{% if user %} -

Connecté en tant que {{ user }}

-
+ +
{% endif %} diff --git a/frontend/templates/dashboard.html b/frontend/templates/dashboard.html index adfe5bd..1c3e88a 100644 --- a/frontend/templates/dashboard.html +++ b/frontend/templates/dashboard.html @@ -2,25 +2,149 @@ {% block title %}Tableau de bord{% endblock %} +{% block matrix %} + + +{% endblock %} + {% block content %} -
- - + - - + +
- + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + + +
+ + + + + +
+ +
+ +
+ +
+ + {% endblock %} diff --git a/frontend/templates/login.html b/frontend/templates/login.html index 73dcbc3..57dc0f3 100644 --- a/frontend/templates/login.html +++ b/frontend/templates/login.html @@ -4,9 +4,9 @@ {% block content %}
- + - +
diff --git a/frontend/templates/search_results.html b/frontend/templates/search_results.html index bbf78dc..713a028 100644 --- a/frontend/templates/search_results.html +++ b/frontend/templates/search_results.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} +{% block matrix %} + + +{% endblock %} + {% block content %}

Résultats pour "{{ query }}"