untitled1176 commited on
Commit
ea500c2
·
verified ·
1 Parent(s): 7ea86b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -14
app.py CHANGED
@@ -147,19 +147,21 @@ def login():
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)}"
@@ -168,14 +170,6 @@ def wake():
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)}"
174
-
175
- status_text, status_color = get_server_status()
176
- return render_template_string(HTML_TEMPLATE, logged_in=True, status_text=status_text,
177
- status_color=status_color, bg_image=IMAGE_FOND,
178
- galerie=IMAGES_GALERIE, show_snake=True, message=msg)
179
 
180
  if __name__ == "__main__":
181
  app.run(host='0.0.0.0', port=7860)
 
147
  def wake():
148
  if not session.get('auth'): return redirect('/')
149
 
150
+ mac_clean = MAC_ADRESSE.replace(':', '').upper()
151
  try:
152
+ # Résolution DNS de ton IP publique
 
153
  target_ip = socket.gethostbyname(MON_HOST_NOIP)
154
 
155
+ # On utilise le service DNSExit qui est très direct
156
+ url = f"https://www.dnsexit.com/api/wol?mac={mac_clean}&host={target_ip}"
157
 
158
  headers = {'User-Agent': 'Mozilla/5.0'}
159
  r = requests.get(url, headers=headers, timeout=10)
160
 
161
+ if r.status_code == 200:
162
+ msg = f"🚀 Signal envoyé à {target_ip} !"
163
+ else:
164
+ msg = f"Signal envoyé (Code {r.status_code})"
165
 
166
  except Exception as e:
167
  msg = f"Erreur : {str(e)}"
 
170
  return render_template_string(HTML_TEMPLATE, logged_in=True, status_text=status_text,
171
  status_color=status_color, bg_image=IMAGE_FOND,
172
  galerie=IMAGES_GALERIE, show_snake=True, message=msg)
 
 
 
 
 
 
 
 
173
 
174
  if __name__ == "__main__":
175
  app.run(host='0.0.0.0', port=7860)