Spaces:
Paused
Paused
Download add_admin_button.py from sherifghazi/EGYshot: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/sherifghazi/EGYshot/resolve/main/add_admin_button.py
- Command line
-
hf download hf://spaces/sherifghazi/EGYshot/add_admin_button.py
-
curl -L -o add_admin_button.py https://huggingface.co/spaces/sherifghazi/EGYshot/resolve/main/add_admin_button.py
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("⚠️ الزر موجود بالفعل.") | |