updated scripts

This commit is contained in:
devaine 2025-10-20 19:02:42 -05:00
commit 5b03adaaa9
Signed by: devaine
GPG key ID: 954B1DCAC6FF84EE
3 changed files with 16 additions and 2 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.env .env
server-scripts/desec/public_ip

View file

@ -4,7 +4,9 @@ import subprocess
import json import json
import os import os
import asyncio import asyncio
from time import sleep
from dotenv import load_dotenv from dotenv import load_dotenv
import urllib3
load_dotenv() # Loads up .env file load_dotenv() # Loads up .env file
@ -86,8 +88,19 @@ async def newIPCheck():
getCurrentIP() # update current ip getCurrentIP() # update current ip
await newIPCheck() await newIPCheck()
def waitForConnection():
while True:
try:
response = urllib3.request("GET", "https://ifconfig.me")
return
except urllib3.exceptions.MaxRetryError:
print("Failed connection!")
sleep(1)
pass
def main(): def main():
waitForConnection()
if not os.path.exists("public_ip"): if not os.path.exists("public_ip"):
getCurrentIP() getCurrentIP()
elif not os.path.exists(".env"): elif not os.path.exists(".env"):

View file

@ -4,8 +4,8 @@
if [ ! -d .venv ]; then if [ ! -d .venv ]; then
python3 -m venv .venv python3 -m venv .venv
source .venv/bin/activate source .venv/bin/activate
pip install -U python-dotenv pip install -U python-dotenv urllib3
pip install --upgrade pip # Update pip to the latest version pip install -U pip # Update pip to the latest version
fi fi
echo 'Make sure to run ". .venv/bin/activate" to enter the development environment' echo 'Make sure to run ". .venv/bin/activate" to enter the development environment'