diff --git a/app.py b/app.py index 8f74e31..92d2d2c 100644 --- a/app.py +++ b/app.py @@ -1192,6 +1192,37 @@ def r_upload_del(tid): return jsonify(ok=True) +@app.route('/api/upload/browse', methods=['POST']) +def r_upload_browse(): + """Listet SMB-Freigaben eines Servers ohne gespeicherte Config (rclone connection string).""" + data = request.get_json(force=True) + host = data.get('host', '').strip() + user = data.get('user', '').strip() + pw = data.get('pass', '') + if not host: + return jsonify(error='Server-Adresse fehlt'), 400 + conn = f':smb,host={host}' + if user: + conn += f',user={user}' + if pw: + try: + obscured = _rclone_obscure(pw) + conn += f',pass={obscured}' + except Exception: + pass + conn += ':' + r = subprocess.run( + ['rclone', '--config', str(RCLONE_CONF), 'lsd', conn], + capture_output=True, text=True, timeout=15 + ) + if r.returncode != 0: + lines = r.stderr.strip().splitlines() + err = lines[-1] if lines else 'Verbindung fehlgeschlagen' + return jsonify(error=err), 400 + shares = [line.strip().split()[-1] for line in r.stdout.splitlines() if line.strip()] + return jsonify(shares=shares) + + @app.route('/api/upload/targets//toggle', methods=['POST']) def r_upload_toggle(tid): cfg = load_cfg() @@ -1857,19 +1888,41 @@ body{background:var(--bg);color:var(--txt);font-family:-apple-system,BlinkMacSys