Usunięcie mapy z panelu
Zbyt dużo bugów
This commit is contained in:
parent
efa85c5070
commit
694134ccec
2 changed files with 1 additions and 109 deletions
102
app/api.py
102
app/api.py
|
@ -296,108 +296,6 @@ def stats():
|
|||
return jsonify({"error": "Container not found"}), 404
|
||||
|
||||
|
||||
# Map
|
||||
# TODO: OTHER PROXYS ARE JUST A TEMPORARY FIX!!! MAKE SOMETHING PERMANENT INSTEAD
|
||||
@api.route('/map')
|
||||
@oidc.require_login
|
||||
def map_proxy():
|
||||
username = oidc.user_getfield('preferred_username')
|
||||
container_name = f"mc-{username}"
|
||||
container_ip = client.containers.get(container_name).attrs['NetworkSettings']['IPAddress']
|
||||
url = f"http://{container_ip}:8080"
|
||||
|
||||
try:
|
||||
response = requests.get(url, params=request.args, timeout=5)
|
||||
return Response(
|
||||
response.content,
|
||||
status=response.status_code,
|
||||
content_type=response.headers.get('Content-Type', 'application/octet-stream')
|
||||
)
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"Error proxying map: {e}")
|
||||
return jsonify({"message": "Mapa nie działa. Czy zainstalowałeś Squaremap?"}), 500
|
||||
|
||||
|
||||
@api.route('/js/<path:filename>', methods=['GET'])
|
||||
@oidc.require_login
|
||||
def proxy_js(filename):
|
||||
username = oidc.user_getfield('preferred_username')
|
||||
container_name = f"mc-{username}"
|
||||
container_ip = client.containers.get(container_name).attrs['NetworkSettings']['IPAddress']
|
||||
|
||||
url = f"http://{container_ip}:8080/js/{filename}"
|
||||
|
||||
try:
|
||||
response = requests.get(url, timeout=5)
|
||||
return Response(
|
||||
response.content,
|
||||
status=response.status_code,
|
||||
content_type=response.headers.get('Content-Type', 'application/javascript')
|
||||
)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return jsonify({"message": "Błąd ładowania skryptu: " + str(e)}), 500
|
||||
|
||||
|
||||
@api.route('/css/<path:filename>', methods=['GET'])
|
||||
@oidc.require_login
|
||||
def proxy_css(filename):
|
||||
username = oidc.user_getfield('preferred_username')
|
||||
container_name = f"mc-{username}"
|
||||
container_ip = client.containers.get(container_name).attrs['NetworkSettings']['IPAddress']
|
||||
|
||||
url = f"http://{container_ip}:8080/css/{filename}"
|
||||
|
||||
try:
|
||||
response = requests.get(url, timeout=5)
|
||||
return Response(
|
||||
response.content,
|
||||
status=response.status_code,
|
||||
content_type=response.headers.get('Content-Type', 'text/css')
|
||||
)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return jsonify({"message": "Błąd ładowania stylu: " + str(e)}), 500
|
||||
|
||||
|
||||
@api.route('/tiles/<path:filename>', methods=['GET'])
|
||||
@oidc.require_login
|
||||
def proxy_tiles_settings(filename):
|
||||
username = oidc.user_getfield('preferred_username')
|
||||
container_name = f"mc-{username}"
|
||||
container_ip = client.containers.get(container_name).attrs['NetworkSettings']['IPAddress']
|
||||
|
||||
url = f"http://{container_ip}:8080/tiles/{filename}"
|
||||
|
||||
try:
|
||||
response = requests.get(url, timeout=5)
|
||||
return Response(
|
||||
response.content,
|
||||
status=response.status_code,
|
||||
content_type=response.headers.get('Content-Type', 'text/json')
|
||||
)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return jsonify({"message": "Błąd ładowania tiles: " + str(e)}), 500
|
||||
|
||||
|
||||
@api.route('/images/<path:filename>', methods=['GET'])
|
||||
@oidc.require_login
|
||||
def proxy_images(filename):
|
||||
username = oidc.user_getfield('preferred_username')
|
||||
container_name = f"mc-{username}"
|
||||
container_ip = client.containers.get(container_name).attrs['NetworkSettings']['IPAddress']
|
||||
|
||||
url = f"http://{container_ip}:8080/images/{filename}"
|
||||
|
||||
try:
|
||||
response = requests.get(url, timeout=5)
|
||||
return Response(
|
||||
response.content,
|
||||
status=response.status_code,
|
||||
content_type=response.headers.get('Content-Type', 'image/png')
|
||||
)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return jsonify({"message": "Błąd ładowania tiles: " + str(e)}), 500
|
||||
|
||||
|
||||
# Modrinth
|
||||
@api.route('/modrinth/search')
|
||||
def modrinth_search():
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
<button class="tab-button" onclick="showTab('controls')">Sterowanie 🎛️</button>
|
||||
<button class="tab-button" onclick="showTab('console')">Konsola 📟</button>
|
||||
<button class="tab-button" onclick="showTab('files')">Pliki 📁</button>
|
||||
<button class="tab-button" onclick="showTab('config')">Konfiguracja 🛠️</button>
|
||||
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<button class="tab-button" onclick="showTab('map')">Mapa 🗺️</button>
|
||||
<button class="tab-button" onclick="showTab('config')">Konfiguracja 🛠️</button>
|
||||
<button class="tab-button" onclick="showTab('mods')">Mody/Pluginy 🧩</button>
|
||||
<button class="tab-button" onclick="showTab('statistics')">Statystyki 📈</button>
|
||||
</div>
|
||||
|
@ -113,11 +112,6 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
<div class="tab-panel" id="map">
|
||||
<h2>Mapa Serwera</h2>
|
||||
<iframe src="/api/map" width="100%" height="500px"></iframe>
|
||||
</div>
|
||||
|
||||
<div class="tab-panel" id="mods">
|
||||
<h2>Zainstaluj mody/pluginy z Modrinth</h2>
|
||||
<input type="text" id="mod-search" placeholder="Wyszukaj mod/plugin..." oninput="searchMods()">
|
||||
|
|
Loading…
Add table
Reference in a new issue