Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -147,18 +147,27 @@ def login():
|
|
| 147 |
def wake():
|
| 148 |
if not session.get('auth'): return redirect('/')
|
| 149 |
|
| 150 |
-
|
| 151 |
try:
|
|
|
|
|
|
|
| 152 |
target_ip = socket.gethostbyname(MON_HOST_NOIP)
|
| 153 |
-
depicus_url = f"https://www.depicus.com/wake-on-lan/woli?m={mac_clean}&i={target_ip}&s=255.255.255.255&p=9"
|
| 154 |
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
'Referer': 'https://www.depicus.com/'
|
| 158 |
-
}
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
except Exception as e:
|
| 164 |
msg = f"Erreur de relais : {str(e)}"
|
|
|
|
| 147 |
def wake():
|
| 148 |
if not session.get('auth'): return redirect('/')
|
| 149 |
|
| 150 |
+
mac = MAC_ADRESSE.upper()
|
| 151 |
try:
|
| 152 |
+
# On tente d'utiliser une API alternative qui envoie le paquet différemment
|
| 153 |
+
# Parfois, changer de service de relais suffit à débloquer la Bbox
|
| 154 |
target_ip = socket.gethostbyname(MON_HOST_NOIP)
|
|
|
|
| 155 |
|
| 156 |
+
# Service alternatif : DNSExit WOL API
|
| 157 |
+
url = f"https://www.dnsexit.com/api/wol?mac={mac}&host={target_ip}"
|
|
|
|
|
|
|
| 158 |
|
| 159 |
+
headers = {'User-Agent': 'Mozilla/5.0'}
|
| 160 |
+
r = requests.get(url, headers=headers, timeout=10)
|
| 161 |
+
|
| 162 |
+
msg = f"🚀 Signal envoyé à {target_ip} ! Réponse du service : {r.status_code}"
|
| 163 |
+
|
| 164 |
+
except Exception as e:
|
| 165 |
+
msg = f"Erreur : {str(e)}"
|
| 166 |
+
|
| 167 |
+
status_text, status_color = get_server_status()
|
| 168 |
+
return render_template_string(HTML_TEMPLATE, logged_in=True, status_text=status_text,
|
| 169 |
+
status_color=status_color, bg_image=IMAGE_FOND,
|
| 170 |
+
galerie=IMAGES_GALERIE, show_snake=True, message=msg)
|
| 171 |
|
| 172 |
except Exception as e:
|
| 173 |
msg = f"Erreur de relais : {str(e)}"
|