From 3a9011690c811b21e72c88ea1acea51f32f5aa54 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 28 Jan 2026 16:02:57 +0000 Subject: [PATCH] first commit --- backend/Dockerfile | 13 ++++++ backend/main.py | 64 ++++++++++++++++++++++++++ docker-compose.yml | 10 +++++ frontend/app.js | 106 ++++++++++++++++++++++++++++++++++++++++++++ frontend/index.html | 37 ++++++++++++++++ frontend/style.css | 30 +++++++++++++ 6 files changed, 260 insertions(+) create mode 100644 backend/Dockerfile create mode 100644 backend/main.py create mode 100644 docker-compose.yml create mode 100644 frontend/app.js create mode 100644 frontend/index.html create mode 100644 frontend/style.css diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..c7a4907 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.9-slim + +# Install yt-dlp and dependencies +RUN apt-get update && apt-get install -y ffmpeg curl && \ + curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \ + chmod a+rx /usr/local/bin/yt-dlp + +WORKDIR /app +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY . . + +CMD ["python", "main.py"] \ No newline at end of file diff --git a/backend/main.py b/backend/main.py new file mode 100644 index 0000000..67ab2a3 --- /dev/null +++ b/backend/main.py @@ -0,0 +1,64 @@ +from flask import Flask, request, Response, send_from_directory, jsonify +import subprocess +import requests + +app = Flask(__name__, static_folder='../frontend', static_url_path='') +app.url_map.strict_slashes = False + +@app.route('/api/status', methods=['POST', 'GET']) +def proxy_status(): + if request.method == 'POST': + # Safely get the json body + client_data = request.get_json() or {} + target_server = client_data.get('server') + else: + target_server = request.args.get('server') + + if not target_server: + return jsonify({"error": "No server provided"}), 400 + + try: + # Use the data gathered above + response = requests.post(target_server, json=client_data if request.method == 'POST' else {}, timeout=5) + return (response.content, response.status_code, response.headers.items()) + except Exception as e: + return jsonify({"error": str(e)}), 500 + + + +@app.route('/') +def index(): + return send_from_directory(app.static_folder, 'index.html') + +@app.route('/api/stream', methods=['POST', 'GET']) +def stream_video(): + # Note: