Update_Gsm / app.py
mojtabamoharami's picture
Update app.py
e03c899 verified
import subprocess, threading, time, requests
from flask import Flask, render_template_string
app = Flask(__name__)
HTML_PAGE = """
<!DOCTYPE html>
<html dir="rtl">
<head>
<title>پنل مدیریت شبکه</title>
<style>
body { font-family: Tahoma; background: #1a1a1a; color: #eee; text-align: center; padding-top: 50px; }
.box { background: #252525; padding: 30px; border-radius: 20px; display: inline-block; border: 1px solid #333; }
.btn { background: #008cff; color: white; border: none; padding: 12px 25px; border-radius: 10px; cursor: pointer; font-weight: bold; }
.modal { display: none; position: fixed; z-index: 1; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); }
.modal-content { background: #333; margin: 10% auto; padding: 20px; width: 85%; max-width: 600px; border-radius: 15px; word-break: break-all; color: #00ff00; font-family: monospace; }
</style>
</head>
<body>
<div class="box">
<h2>سیستم مانیتورینگ آپدیت جی‌اس‌ام</h2>
<p>وضعیت سرور: <span style="color: #00ff00;">فعال و متصل</span></p>
<button class="btn" onclick="document.getElementById('m').style.display='block'">دریافت کانفیگ مخصوص اینستاگرام</button>
</div>
<div id="m" class="modal">
<div class="modal-content">
<h4>کانفیگ VLESS (Sing-box):</h4>
<p>vless://49e59f86-4d19-4957-9712-b2273d9036de@mojtabamoharami-updategsm.hf.space:443?encryption=none&security=tls&type=ws&host=mojtabamoharami-updategsm.hf.space&path=%2Fmojtaba#UpdateGSM-Ultra</p>
<button class="btn" style="background:#ff4444" onclick="document.getElementById('m').style.display='none'">بستن</button>
</div>
</div>
</body>
</html>
"""
@app.route('/')
def home(): return render_template_string(HTML_PAGE)
def keep_alive():
while True:
try: requests.get("http://localhost:7860/")
except: pass
time.sleep(1800)
if __name__ == "__main__":
subprocess.Popen("./web-monitor-core run -c config.json", shell=True)
threading.Thread(target=keep_alive, daemon=True).start()
app.run(host='0.0.0.0', port=7860)