From d52744d92123fcb94773fc81266e9bb507f05aed Mon Sep 17 00:00:00 2001 From: ROOT Date: Thu, 20 Feb 2025 08:31:38 +0700 Subject: [PATCH] add --- .env | 2 + app.py | 23 +++--- data/services.json | 16 +++- output.log | 180 ++++++++++++++++++++++++++++++++++++++----- static/style.css | 78 ++++++++++++++----- templates/index.html | 11 ++- 6 files changed, 254 insertions(+), 56 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..c62a74f --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +SECRET_KEY=your_super_secret_key +NGINX_PROJECT_PATH=/projects/nginx diff --git a/app.py b/app.py index b48d89e..aa131d2 100755 --- a/app.py +++ b/app.py @@ -4,9 +4,13 @@ import os import time from flask import Flask, render_template, request, Response, jsonify, redirect, url_for, session from datetime import timedelta +from dotenv import load_dotenv + +# Load biến môi trường từ file .env +load_dotenv() app = Flask(__name__) -app.secret_key = "your_secret_key" +app.secret_key = os.getenv("SECRET_KEY", "default_secret_key") # Lấy từ .env hoặc đặt giá trị mặc định app.permanent_session_lifetime = timedelta(days=1) # Danh sách tài khoản & mật khẩu @@ -30,7 +34,7 @@ def home(): if "user" not in session: return redirect(url_for("login")) - listService = load_services() + listService = [s for s in load_services() if s.get("status", "active") == "active"] return render_template("index.html", listService=listService) @app.route("/login", methods=["GET", "POST"]) @@ -71,20 +75,17 @@ def run_shell_command(command_str): if process.returncode == 0: yield f"data: SUCCESS\n\n" else: - yield f"data: []\n\n" + yield f"data: ERROR\n\n" def generate_output(command_list): """Chạy command từ JSON, sau đó restart Nginx""" - - # Chuyển danh sách command thành chuỗi command_str = " ".join(command_list) + yield from run_shell_command(command_str) - yield from run_shell_command(command_str) # Chạy command chính - - # Sau khi chạy command xong, restart Nginx - nginx_command = "cd /projects/nginx && docker compose down && docker compose up -d" + nginx_project_path = os.getenv("NGINX_PROJECT_PATH", "/projects/nginx") + nginx_command = f"cd {nginx_project_path} && docker compose down && docker compose up -d" yield f"data: === Restarting Nginx ===\n\n" - yield from run_shell_command(nginx_command) # Chạy lệnh restart Nginx + yield from run_shell_command(nginx_command) @app.route("/run-command", methods=["GET"]) def run_command(): @@ -92,7 +93,7 @@ def run_command(): if "user" not in session: return jsonify({"error": "Unauthorized"}), 401 - command_list = request.args.getlist("command[]") # Nhận danh sách lệnh từ frontend + command_list = request.args.getlist("command[]") if not command_list: return jsonify({"error": "No command provided"}), 400 diff --git a/data/services.json b/data/services.json index 6fb2af2..f5f5a3f 100755 --- a/data/services.json +++ b/data/services.json @@ -3,24 +3,32 @@ "name": "Service", "url": "http://service.sundayenglish.com", "description": "Sunday English Service", - "command": ["cd", "/projects/service-se", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"] + "command": ["cd", "/projects/service-se", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"], + "active": true, + "status": "active" }, { "name": "Exercise", "url": "http://exercise.sundayenglish.com", "description": "Sunday English Exercise", - "command": ["cd", "/projects/exercise-se", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"] + "command": ["cd", "/projects/exercise-se", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"], + "active": true, + "status": "active" }, { "name": "Oauth", "url": "https://oauth2.sundayenglish.com", "description": "Oauth", - "command": ["cd", "/projects/gk_oauth", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"] + "command": ["cd", "/projects/gk_oauth", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"], + "active": true, + "status": "active" }, { "name": "Julius", "url": null, "description": "Julius", - "command": ["cd", "/projects/julius", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"] + "command": ["cd", "/projects/julius", "&&", "docker", "compose", "down", "&&", "docker", "compose", "up", "-d"], + "active": false, + "status": "inactive" } ] diff --git a/output.log b/output.log index 75fed53..9db81b9 100755 --- a/output.log +++ b/output.log @@ -9,21 +9,165 @@ Press CTRL+C to quit * Restarting with stat * Debugger is active! * Debugger PIN: 112-654-638 -14.231.189.200 - - [19/Feb/2025 17:03:40] "GET / HTTP/1.1" 200 - -14.231.189.200 - - [19/Feb/2025 17:03:40] "GET /static/style.css HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:41] "GET /static/script.js HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:41] "GET / HTTP/1.1" 200 - -14.231.189.200 - - [19/Feb/2025 17:03:41] "GET /static/style.css HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:41] "GET /static/script.js HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET / HTTP/1.1" 200 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/style.css HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET / HTTP/1.1" 200 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/script.js HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/style.css HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/script.js HTTP/1.1" 200 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET / HTTP/1.1" 200 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/style.css HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/script.js HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET / HTTP/1.1" 200 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/style.css HTTP/1.1" 304 - -14.231.189.200 - - [19/Feb/2025 17:03:42] "GET /static/script.js HTTP/1.1" 304 - +172.18.0.25 - - [20/Feb/2025 08:20:57] "GET / HTTP/1.0" 302 - +172.18.0.25 - - [20/Feb/2025 08:20:58] "GET /login HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:20:58] "GET /favicon.ico HTTP/1.0" 404 - +172.18.0.25 - - [20/Feb/2025 08:20:58] "GET /login HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:01] "POST /login HTTP/1.0" 302 - +172.18.0.25 - - [20/Feb/2025 08:21:01] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:01] "GET /static/script.js HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:01] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:04] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:04] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:04] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:05] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:06] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:21:06] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:06] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:14] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:21:19] "GET /run-command?command[]=cd&command[]=/projects/service-se&command[]=%26%26&command[]=docker&command[]=compose&command[]=down&command[]=%26%26&command[]=docker&command[]=compose&command[]=up&command[]=-d HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:23:06] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:23:08] "GET /static/style.css HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:23:09] "GET /static/script.js HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:23:26] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:23:26] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:23:26] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:24:02] "GET / HTTP/1.0" 302 - +172.18.0.25 - - [20/Feb/2025 08:24:02] "GET /login HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:24:02] "GET /favicon.ico HTTP/1.0" 404 - +172.18.0.25 - - [20/Feb/2025 08:24:10] "POST /login HTTP/1.0" 302 - +172.18.0.25 - - [20/Feb/2025 08:24:10] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:24:10] "GET /static/script.js HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:24:10] "GET /static/style.css HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:53] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:53] "GET /static/style.css HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:53] "GET /static/script.js HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:53] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:53] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:53] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:54] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:55] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:56] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:56] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:56] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:56] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:56] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:56] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:58] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:59] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:59] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:59] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:59] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:26:59] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:26:59] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:00] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:00] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:00] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:01] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:01] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:01] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:33] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:33] "GET /static/style.css HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:33] "GET /static/script.js HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:34] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:35] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:35] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:35] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:35] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:35] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:53] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:27:54] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:27:54] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:28:01] "GET /run-command?command[]=cd&command[]=/projects/service-se&command[]=%26%26&command[]=docker&command[]=compose&command[]=down&command[]=%26%26&command[]=docker&command[]=compose&command[]=up&command[]=-d HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:28:20] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:28:26] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:28:28] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:28:28] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:28:55] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:28:57] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:28:57] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:29:01] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:29:03] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:29:03] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:29:08] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:29:10] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:29:10] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:29:20] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:29:22] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:29:22] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:29:32] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:29:32] "GET /static/style.css HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:29:32] "GET /static/script.js HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:30:09] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:30:11] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:30:11] "GET /static/script.js HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:30:14] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:30:14] "GET /static/style.css HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:30:14] "GET /static/script.js HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:30:27] "GET /run-command?command[]=cd&command[]=/projects/service-se&command[]=%26%26&command[]=docker&command[]=compose&command[]=down&command[]=%26%26&command[]=docker&command[]=compose&command[]=up&command[]=-d HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:31:02] "GET / HTTP/1.0" 200 - +172.18.0.25 - - [20/Feb/2025 08:31:04] "GET /static/style.css HTTP/1.0" 304 - +172.18.0.25 - - [20/Feb/2025 08:31:04] "GET /static/script.js HTTP/1.0" 304 - diff --git a/static/style.css b/static/style.css index 136d08f..787eae8 100755 --- a/static/style.css +++ b/static/style.css @@ -1,60 +1,100 @@ -/* Nền Gradient Đẹp & Hài Hòa */ +/* 🌟 Nền Gradient Đẹp & Hài Hòa */ body { - background: linear-gradient(135deg, #1E2A38, #4C6EF5); /* Xanh đậm sang xanh dương */ + background: linear-gradient(135deg, #1E2A38, #4C6EF5); min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; + font-family: 'Arial', sans-serif; + margin: 0; } -/* Tăng độ mờ của container */ +/* 🪟 Hiệu ứng kính mờ đẹp mắt */ .container { - background: rgba(255, 255, 255, 0.1); /* Màu trắng nhẹ */ - backdrop-filter: blur(15px); /* Hiệu ứng kính mờ */ + background: rgba(255, 255, 255, 0.15); + backdrop-filter: blur(20px); border-radius: 12px; - padding: 20px; - box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); + padding: 25px; + box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4); max-width: 95%; + width: 900px; + transition: all 0.3s ease-in-out; +} + +.container:hover { + transform: translateY(-3px); } -/* Bảng hiển thị đẹp hơn với chữ màu đen */ +/* 📋 Bảng hiển thị với màu sắc rõ ràng */ table { - background: rgba(255, 255, 255, 0.9); /* Nền trắng rõ ràng */ + background: rgba(255, 255, 255, 0.95); border-radius: 8px; overflow: hidden; - color: #000; /* Đặt màu chữ đen */ + color: #000; + width: 100%; + border-collapse: collapse; } +/* 🌟 Header bảng */ th { - background: rgba(0, 0, 0, 0.8); /* Header màu đen đậm */ - color: #ffffff; /* Chữ trắng để nổi bật trên nền đen */ + background: #222; + color: white; + padding: 12px; + font-weight: bold; + text-transform: uppercase; } +/* ✏️ Hàng trong bảng */ td { - color: #000; /* Màu chữ đen */ + color: #000; + padding: 10px; + text-align: center; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); } -/* Khi hover vào hàng trong bảng */ +/* 🖱️ Hiệu ứng hover khi rê chuột vào hàng */ tbody tr:hover { - background: rgba(0, 0, 0, 0.1); /* Nhấn mạnh dòng khi rê chuột */ + background: rgba(0, 0, 0, 0.1); + transition: all 0.2s ease-in-out; } - -/* Tăng độ nổi bật khi hover */ +/* 🔘 Nút chạy lệnh */ .run-btn { transition: all 0.3s ease-in-out; + padding: 8px 12px; + border: none; + border-radius: 6px; + background: #4CAF50; + color: white; + font-weight: bold; + cursor: pointer; } .run-btn:hover { transform: scale(1.1); + background: #45a049; +} + +/* 📱 Responsive: Bảng cuộn ngang trên màn hình nhỏ */ +@media (max-width: 768px) { + .container { + width: 100%; + padding: 15px; + } + + table { + display: block; + overflow-x: auto; + white-space: nowrap; + } } -/* Footer nổi bật & chuyên nghiệp */ +/* 👣 Footer đẹp và chuyên nghiệp */ footer { background: rgba(0, 0, 0, 0.85); - padding: 20px 0; + padding: 15px 0; text-align: center; width: 100%; margin-top: auto; diff --git a/templates/index.html b/templates/index.html index 92422ad..c15feb5 100755 --- a/templates/index.html +++ b/templates/index.html @@ -31,17 +31,18 @@ Service Name - Description + URL - Command + Action {% for service in listService %} + {% if service.status == "active" %} {{ service.name }} - {{ service.description }} + {% if service.url %} 🔗 Visit @@ -49,7 +50,7 @@ N/A {% endif %} - {{ service.command }} + + {% endif %} {% endfor %} +