Spaces:
Paused
Paused
j49_c commited on
Commit ·
0c7947c
1
Parent(s): 1556c64
Fix login persistence on Hugging Face and update branding with new logo
Browse files- README.md +1 -8
- admin.html +14 -3
- app.py +11 -1
- index.html +6 -11
- login.html +31 -23
README.md
CHANGED
|
@@ -12,11 +12,4 @@ pinned: false
|
|
| 12 |
|
| 13 |
### 🔗 روابط الوصول:
|
| 14 |
* **الرابط المختصر:** [rb.gy/mqkfan](https://rb.gy/mqkfan)
|
| 15 |
-
* **الرابط المباشر:** [hf.co/spaces/mohammed978/hostbot](https://huggingface.co/spaces/mohammed978/hostbot)
|
| 16 |
-
|
| 17 |
-
### 🛡️ حماية الخصوصية:
|
| 18 |
-
* تم تأمين كلمة سر الإدارة عبر متغيرات البيئة (Environment Variables).
|
| 19 |
-
* نظام حماية تلقائي ضد توقف السيرفر (Keep-Alive).
|
| 20 |
-
* إعادة تشغيل تلقائية للبوتات عند حدوث أي خلل (Auto-Recovery).
|
| 21 |
-
|
| 22 |
-
⚙️ الخادم يعمل على المنفذ 7860 (Hugging Face Default).
|
|
|
|
| 12 |
|
| 13 |
### 🔗 روابط الوصول:
|
| 14 |
* **الرابط المختصر:** [rb.gy/mqkfan](https://rb.gy/mqkfan)
|
| 15 |
+
* **الرابط المباشر:** [hf.co/spaces/mohammed978/hostbot](https://huggingface.co/spaces/mohammed978/hostbot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin.html
CHANGED
|
@@ -52,7 +52,15 @@
|
|
| 52 |
z-index: 100;
|
| 53 |
}
|
| 54 |
|
| 55 |
-
.logo {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
font-weight: 700;
|
| 57 |
font-size: 18px;
|
| 58 |
letter-spacing: -0.5px;
|
|
@@ -61,7 +69,7 @@
|
|
| 61 |
gap: 8px;
|
| 62 |
}
|
| 63 |
|
| 64 |
-
.logo span {
|
| 65 |
color: var(--muted);
|
| 66 |
font-weight: 400;
|
| 67 |
font-size: 13px;
|
|
@@ -290,7 +298,10 @@
|
|
| 290 |
|
| 291 |
<body>
|
| 292 |
<div class="top">
|
| 293 |
-
<div
|
|
|
|
|
|
|
|
|
|
| 294 |
<div style="display:flex;gap:12px;">
|
| 295 |
<button class="btn" onclick="location.href='/'">Operative Dashboard</button>
|
| 296 |
<button class="btn btn-danger" onclick="location.href='/logout'">Terminate Session</button>
|
|
|
|
| 52 |
z-index: 100;
|
| 53 |
}
|
| 54 |
|
| 55 |
+
.logo-img {
|
| 56 |
+
width: 40px;
|
| 57 |
+
height: 40px;
|
| 58 |
+
border-radius: 50%;
|
| 59 |
+
object-fit: cover;
|
| 60 |
+
border: 2px solid var(--primary);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.logo-text {
|
| 64 |
font-weight: 700;
|
| 65 |
font-size: 18px;
|
| 66 |
letter-spacing: -0.5px;
|
|
|
|
| 69 |
gap: 8px;
|
| 70 |
}
|
| 71 |
|
| 72 |
+
.logo-text span {
|
| 73 |
color: var(--muted);
|
| 74 |
font-weight: 400;
|
| 75 |
font-size: 13px;
|
|
|
|
| 298 |
|
| 299 |
<body>
|
| 300 |
<div class="top">
|
| 301 |
+
<div style="display:flex;align-items:center;gap:12px;">
|
| 302 |
+
<img src="https://f.top4top.io/p_37210bgwm1.jpg" alt="Logo" class="logo-img">
|
| 303 |
+
<div class="logo-text">الذئب الابيض <span>CENTRAL COMMAND</span></div>
|
| 304 |
+
</div>
|
| 305 |
<div style="display:flex;gap:12px;">
|
| 306 |
<button class="btn" onclick="location.href='/'">Operative Dashboard</button>
|
| 307 |
<button class="btn btn-danger" onclick="location.href='/logout'">Terminate Session</button>
|
app.py
CHANGED
|
@@ -13,6 +13,7 @@ import requests
|
|
| 13 |
import psutil
|
| 14 |
from flask import Flask, send_from_directory, request, jsonify, redirect, session
|
| 15 |
from werkzeug.security import generate_password_hash, check_password_hash
|
|
|
|
| 16 |
from functools import wraps
|
| 17 |
|
| 18 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
@@ -25,7 +26,14 @@ os.makedirs(USERS_ROOT, exist_ok=True)
|
|
| 25 |
os.makedirs(DATA_DIR, exist_ok=True)
|
| 26 |
|
| 27 |
app = Flask(__name__)
|
| 28 |
-
app.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
ADMIN_USERNAME = os.environ.get("ADMIN_USER", "moh777")
|
| 31 |
# If the environment variable is not set, we use the default password,
|
|
@@ -432,6 +440,7 @@ def api_login():
|
|
| 432 |
|
| 433 |
if username == ADMIN_USERNAME and password == ADMIN_PASSWORD:
|
| 434 |
session["user"] = {"username": ADMIN_USERNAME, "is_admin": True}
|
|
|
|
| 435 |
return jsonify({"success": True, "is_admin": True})
|
| 436 |
|
| 437 |
db = load_users()
|
|
@@ -444,6 +453,7 @@ def api_login():
|
|
| 444 |
return jsonify({"success": False, "message": "Invalid username or password"}), 401
|
| 445 |
|
| 446 |
session["user"] = {"username": u.get("username"), "is_admin": False}
|
|
|
|
| 447 |
ensure_user_dirs(u.get("username"))
|
| 448 |
return jsonify({"success": True, "is_admin": False})
|
| 449 |
|
|
|
|
| 13 |
import psutil
|
| 14 |
from flask import Flask, send_from_directory, request, jsonify, redirect, session
|
| 15 |
from werkzeug.security import generate_password_hash, check_password_hash
|
| 16 |
+
from werkzeug.middleware.proxy_fix import ProxyFix
|
| 17 |
from functools import wraps
|
| 18 |
|
| 19 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 26 |
os.makedirs(DATA_DIR, exist_ok=True)
|
| 27 |
|
| 28 |
app = Flask(__name__)
|
| 29 |
+
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1)
|
| 30 |
+
app.secret_key = os.environ.get("PANEL_SECRET_KEY", "CHANGE_ME_STABLE_KEY_123")
|
| 31 |
+
app.config.update(
|
| 32 |
+
SESSION_COOKIE_HTTPONLY=True,
|
| 33 |
+
SESSION_COOKIE_SAMESITE='None',
|
| 34 |
+
SESSION_COOKIE_SECURE=True,
|
| 35 |
+
PERMANENT_SESSION_LIFETIME=604800 # 1 week
|
| 36 |
+
)
|
| 37 |
|
| 38 |
ADMIN_USERNAME = os.environ.get("ADMIN_USER", "moh777")
|
| 39 |
# If the environment variable is not set, we use the default password,
|
|
|
|
| 440 |
|
| 441 |
if username == ADMIN_USERNAME and password == ADMIN_PASSWORD:
|
| 442 |
session["user"] = {"username": ADMIN_USERNAME, "is_admin": True}
|
| 443 |
+
session.permanent = True
|
| 444 |
return jsonify({"success": True, "is_admin": True})
|
| 445 |
|
| 446 |
db = load_users()
|
|
|
|
| 453 |
return jsonify({"success": False, "message": "Invalid username or password"}), 401
|
| 454 |
|
| 455 |
session["user"] = {"username": u.get("username"), "is_admin": False}
|
| 456 |
+
session.permanent = True
|
| 457 |
ensure_user_dirs(u.get("username"))
|
| 458 |
return jsonify({"success": True, "is_admin": False})
|
| 459 |
|
index.html
CHANGED
|
@@ -88,18 +88,12 @@
|
|
| 88 |
cursor: pointer;
|
| 89 |
}
|
| 90 |
|
| 91 |
-
.logo {
|
| 92 |
-
font-size: 28px;
|
| 93 |
width: 44px;
|
| 94 |
height: 44px;
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
|
| 99 |
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 100 |
-
border-radius: 12px;
|
| 101 |
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
| 102 |
-
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
| 103 |
}
|
| 104 |
|
| 105 |
.title-box {
|
|
@@ -272,6 +266,7 @@
|
|
| 272 |
line-height: 1.4;
|
| 273 |
display: -webkit-box;
|
| 274 |
-webkit-line-clamp: 2;
|
|
|
|
| 275 |
-webkit-box-orient: vertical;
|
| 276 |
overflow: hidden;
|
| 277 |
}
|
|
@@ -725,7 +720,7 @@
|
|
| 725 |
<div class="topbar">
|
| 726 |
<div class="topbar-inner">
|
| 727 |
<div class="brand" onclick="goHome()" role="button" tabindex="0">
|
| 728 |
-
<
|
| 729 |
<div class="title-box">
|
| 730 |
<div class="title">الذئب الابيض</div>
|
| 731 |
<span class="sub" id="pyHostTxt">Connecting...</span>
|
|
|
|
| 88 |
cursor: pointer;
|
| 89 |
}
|
| 90 |
|
| 91 |
+
.logo-img {
|
|
|
|
| 92 |
width: 44px;
|
| 93 |
height: 44px;
|
| 94 |
+
border-radius: 50%;
|
| 95 |
+
object-fit: cover;
|
| 96 |
+
border: 2px solid var(--primary);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
}
|
| 98 |
|
| 99 |
.title-box {
|
|
|
|
| 266 |
line-height: 1.4;
|
| 267 |
display: -webkit-box;
|
| 268 |
-webkit-line-clamp: 2;
|
| 269 |
+
line-clamp: 2;
|
| 270 |
-webkit-box-orient: vertical;
|
| 271 |
overflow: hidden;
|
| 272 |
}
|
|
|
|
| 720 |
<div class="topbar">
|
| 721 |
<div class="topbar-inner">
|
| 722 |
<div class="brand" onclick="goHome()" role="button" tabindex="0">
|
| 723 |
+
<img src="https://f.top4top.io/p_37210bgwm1.jpg" alt="Logo" class="logo-img">
|
| 724 |
<div class="title-box">
|
| 725 |
<div class="title">الذئب الابيض</div>
|
| 726 |
<span class="sub" id="pyHostTxt">Connecting...</span>
|
login.html
CHANGED
|
@@ -74,13 +74,32 @@
|
|
| 74 |
text-align: center;
|
| 75 |
}
|
| 76 |
|
| 77 |
-
.logo {
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
.title {
|
|
@@ -160,16 +179,6 @@
|
|
| 160 |
transform: translateY(1px);
|
| 161 |
}
|
| 162 |
|
| 163 |
-
.btn-secondary {
|
| 164 |
-
background: transparent;
|
| 165 |
-
color: var(--primary);
|
| 166 |
-
border: 1px solid transparent;
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
.btn-secondary:hover {
|
| 170 |
-
background: rgba(10, 132, 255, 0.1);
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
.msg {
|
| 174 |
margin-top: 16px;
|
| 175 |
color: var(--muted);
|
|
@@ -188,11 +197,8 @@
|
|
| 188 |
<body>
|
| 189 |
<div class="container">
|
| 190 |
<div class="card">
|
| 191 |
-
<div class="
|
| 192 |
-
<
|
| 193 |
-
stroke-linejoin="round">
|
| 194 |
-
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
|
| 195 |
-
</svg>
|
| 196 |
</div>
|
| 197 |
<div class="title">الذئب الابيض</div>
|
| 198 |
<div class="sub">Central Intelligence Node<br>Authorized Personnel Only</div>
|
|
@@ -224,7 +230,9 @@
|
|
| 224 |
if (!r.ok || !d.success) { m.style.color = "var(--error)"; m.textContent = d.message || 'Authentication failed'; return; }
|
| 225 |
m.style.color = "#32D74B";
|
| 226 |
m.textContent = 'Access Granted.';
|
| 227 |
-
setTimeout(() =>
|
|
|
|
|
|
|
| 228 |
}
|
| 229 |
</script>
|
| 230 |
</body>
|
|
|
|
| 74 |
text-align: center;
|
| 75 |
}
|
| 76 |
|
| 77 |
+
.logo-img {
|
| 78 |
+
width: 110px;
|
| 79 |
+
height: 110px;
|
| 80 |
+
border-radius: 50%;
|
| 81 |
+
object-fit: cover;
|
| 82 |
+
margin-bottom: 24px;
|
| 83 |
+
border: 3px solid var(--primary);
|
| 84 |
+
box-shadow: 0 0 20px rgba(10, 132, 255, 0.4);
|
| 85 |
+
animation: pulse 3s infinite ease-in-out;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
@keyframes pulse {
|
| 89 |
+
0% {
|
| 90 |
+
transform: scale(1);
|
| 91 |
+
box-shadow: 0 0 20px rgba(10, 132, 255, 0.4);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
50% {
|
| 95 |
+
transform: scale(1.05);
|
| 96 |
+
box-shadow: 0 0 35px rgba(10, 132, 255, 0.6);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
100% {
|
| 100 |
+
transform: scale(1);
|
| 101 |
+
box-shadow: 0 0 20px rgba(10, 132, 255, 0.4);
|
| 102 |
+
}
|
| 103 |
}
|
| 104 |
|
| 105 |
.title {
|
|
|
|
| 179 |
transform: translateY(1px);
|
| 180 |
}
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
.msg {
|
| 183 |
margin-top: 16px;
|
| 184 |
color: var(--muted);
|
|
|
|
| 197 |
<body>
|
| 198 |
<div class="container">
|
| 199 |
<div class="card">
|
| 200 |
+
<div class="branding">
|
| 201 |
+
<img src="https://f.top4top.io/p_37210bgwm1.jpg" alt="الذئب الابيض" class="logo-img">
|
|
|
|
|
|
|
|
|
|
| 202 |
</div>
|
| 203 |
<div class="title">الذئب الابيض</div>
|
| 204 |
<div class="sub">Central Intelligence Node<br>Authorized Personnel Only</div>
|
|
|
|
| 230 |
if (!r.ok || !d.success) { m.style.color = "var(--error)"; m.textContent = d.message || 'Authentication failed'; return; }
|
| 231 |
m.style.color = "#32D74B";
|
| 232 |
m.textContent = 'Access Granted.';
|
| 233 |
+
setTimeout(() => {
|
| 234 |
+
window.location.href = d.is_admin ? './admin' : './';
|
| 235 |
+
}, 500);
|
| 236 |
}
|
| 237 |
</script>
|
| 238 |
</body>
|