EGYshot / add_admin_button.py
Sharo5's picture
chore: fresh clean commit without binary files
400d4a6
Raw History Blame Contribute Delete
1.14 kB
import os
file_path = os.path.expanduser("~/EGYshot/templates/wallet.html")
with open(file_path, "r", encoding="utf-8") as f:
code = f.read()
# الكود الذي سيتم إضافته (زر الإدارة)
admin_button = '''
<!-- زر إدارة الحسابات (للأدمن فقط) -->
{% if session.get("user_id") == "admin@egyshot.com" %}
<div style="text-align: center; margin-top: 25px;">
<a href="/admin" style="display: inline-block; background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #000; padding: 15px 35px; border-radius: 12px; text-decoration: none; font-weight: 900; font-size: 1.1rem; box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);">
⚙️ إدارة الحسابات والأرصدة
</a>
</div>
{% endif %}
'''
if 'href="/admin"' not in code:
# إضافته قبل إغلاق body
if '</body>' in code:
code = code.replace('</body>', admin_button + '\n</body>')
with open(file_path, "w", encoding="utf-8") as f:
f.write(code)
print("✅ تم إضافة زر الإدارة إلى wallet.html")
else:
print("⚠️ الزر موجود بالفعل.")