From 5928fd34adf53b1cf2a75546afa79416fdd77aa1 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 15 Feb 2025 22:51:11 +0100 Subject: [PATCH] automatic participantdir creation due to .gitignore ignoring them by default, to facilitate upgrades --- scripts/lantern.py | 20 ++++++++++++++++++- ...wn_participants => .official_participants} | 0 2 files changed, 19 insertions(+), 1 deletion(-) rename www/{.known_participants => .official_participants} (100%) diff --git a/scripts/lantern.py b/scripts/lantern.py index 8cb3ced..912ce5e 100644 --- a/scripts/lantern.py +++ b/scripts/lantern.py @@ -9,7 +9,7 @@ import urllib def main(): - os.system('clear') + #os.system('clear') proxies = { 'http': 'socks5h://127.0.0.1:9050', 'https': 'socks5h://127.0.0.1:9050' @@ -17,6 +17,24 @@ def main(): rootpath='/srv/darknet-lantern/' urlpath=pwd.getpwuid(os.getuid()).pw_dir+"/.darknet_participant_url" + participantsdir=rootpath+'www/participants/' + officialparticipants=rootpath+'www/.official_participants' + + # check if /srv/darknet-lantern/www/participants directory exists, + if not os.path.isdir(participantsdir): + print("participants directory doesnt exist, creating it") + os.makedirs(participantsdir) + # iterate over /srv/darknet-lantern/www/.official_participants, list each line + with open(officialparticipants, 'r') as file: + # for each line (which is a participant): + for line in file: + participantdir=participantsdir+line.strip() + # check if the directory exists + if not os.path.isdir(participantdir): + #if not, create it + print("Official participan ",line.strip() , "'s directory doesnt exist, creating it") + os.makedirs(participantdir) + print_colors(""" diff --git a/www/.known_participants b/www/.official_participants similarity index 100% rename from www/.known_participants rename to www/.official_participants