page parametres

This commit is contained in:
Grizouille
2025-11-08 17:43:18 +01:00
parent 933105b521
commit 45b442efcd
5 changed files with 77 additions and 35 deletions

View File

@@ -6,7 +6,6 @@ import requests
import atexit
from flask import Flask, render_template, request, jsonify, session
from markupsafe import escape
from flask_autoindex import AutoIndex
import warnings
import giphypop
@@ -17,8 +16,6 @@ from deezer_downloader.nextcloud import addJwtInUserSession
app = Flask(__name__)
app.secret_key = "vilvhmqerjgùqrgojpùqjgvnùzevoijrpùvqpzejgijzepgùg"
auto_index = AutoIndex(app, config["download_dirs"]["base"], add_url_rules=False)
auto_index.add_icon_rule('music.png', ext='m3u8')
warnings.filterwarnings("ignore", message="You are using the giphy public api key")
giphy = giphypop.Giphy()
@@ -95,6 +92,14 @@ def index():
static_root=config["http"]["static_root"],
use_mpd=str(config['mpd'].getboolean('use_mpd')).lower())
@app.route("/save_config", methods=['POST'])
@validate_schema("login", "password", "dirPath")
def parameters():
user_input = request.get_json(force=True)
dir = user_input['dirPath']
#return jsonify({'error': 'Champs requis manquants'}), 400
return jsonify()
@app.route("/debug")
def show_debug():
@@ -110,21 +115,6 @@ def show_debug():
return jsonify({'debug_msg': stdout.decode()})
@app.route("/downloads/")
@app.route("/downloads/<path:path>")
def autoindex(path="."):
# directory index - flask version (let the user download mp3/zip in the browser)
try:
gif = giphy.random_gif(tag="cat")
media_url = gif.media_url
except requests.exceptions.HTTPError:
# the api is rate-limited. Fallback:
media_url = "https://cataas.com/cat"
template_context = {'gif_url': media_url}
return auto_index.render_autoindex(path=session['user_base_dir'], template_context=template_context)
@app.route('/queue', methods=['GET'])
def show_queue():
"""