Files
digiserver-v2/old_code_documentation/check_fix_player.py
DigiServer Admin 4a9616a0f7 Add HTTPS support with Caddy and clean up legacy files
- Add Caddy reverse proxy for automatic HTTPS with Let's Encrypt
- Update docker-compose.yml with Caddy service and internal networking
- Remove all Redis dependencies (not needed for this deployment)
- Fix Dockerfile permissions for instance and uploads directories
- Move legacy scripts to old_code_documentation folder
  - add_muted_column.py, check_fix_player.py, migrate_add_edit_enabled.py
  - docker-start.sh, run_dev.sh, start.sh, clean_for_deployment.sh
- Add HTTPS_SETUP.md documentation for Caddy configuration
- Update .env.example with DOMAIN and EMAIL variables
- Remove redis package from requirements.txt
- Remove rate limiting Redis storage from config.py
2025-12-11 16:56:44 +02:00

50 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Check and fix player quickconnect code."""
from app import create_app
from app.models import Player
from app.extensions import db
app = create_app()
with app.app_context():
# Find player by hostname
player = Player.query.filter_by(hostname='tv-terasa').first()
if not player:
print("❌ Player 'tv-terasa' NOT FOUND in database!")
print("\nAll registered players:")
all_players = Player.query.all()
for p in all_players:
print(f" - ID={p.id}, Name='{p.name}', Hostname='{p.hostname}'")
else:
print(f"✅ Player found:")
print(f" ID: {player.id}")
print(f" Name: {player.name}")
print(f" Hostname: {player.hostname}")
print(f" Playlist ID: {player.playlist_id}")
print(f" Status: {player.status}")
print(f" QuickConnect Hash: {player.quickconnect_code[:60] if player.quickconnect_code else 'Not set'}...")
# Test the quickconnect code
test_code = "8887779"
print(f"\n🔐 Testing quickconnect code: '{test_code}'")
if player.check_quickconnect_code(test_code):
print(f"✅ Code '{test_code}' is VALID!")
else:
print(f"❌ Code '{test_code}' is INVALID - Hash doesn't match!")
# Update it
print(f"\n🔧 Updating quickconnect code to: '{test_code}'")
player.set_quickconnect_code(test_code)
db.session.commit()
print("✅ QuickConnect code updated successfully!")
print(f" New hash: {player.quickconnect_code[:60]}...")
# Verify the update
if player.check_quickconnect_code(test_code):
print(f"✅ Verification successful - code '{test_code}' now works!")
else:
print(f"❌ Verification failed - something went wrong!")