mirror of
https://github.com/AsgardEternal/DiscordWhitelist.git
synced 2024-12-30 14:09:13 -06:00
update to threading server
This commit is contained in:
parent
1191154d5a
commit
1747e55549
@ -46,9 +46,9 @@ class serveRA(http.server.SimpleHTTPRequestHandler):
|
|||||||
for congrp in confgrps:
|
for congrp in confgrps:
|
||||||
responsetext = re.sub(rf"^Group=({congrp[0]}):(.+)", rf"Group=\1:{congrp[1]}", responsetext, flags=re.M)
|
responsetext = re.sub(rf"^Group=({congrp[0]}):(.+)", rf"Group=\1:{congrp[1]}", responsetext, flags=re.M)
|
||||||
self.wfile.write(responsetext.encode('utf-8'))
|
self.wfile.write(responsetext.encode('utf-8'))
|
||||||
backupfile = open(f"./wlgrps/backup-{grpName}.cfg", 'wb')
|
with open(f"./wlgrps/backup-{grpName}.cfg", 'wb') as backupfile:
|
||||||
backupfile.write(responsetext.encode('utf-8'))
|
backupfile.write(responsetext.encode('utf-8'))
|
||||||
backupfile.close()
|
backupfile.close()
|
||||||
else:
|
else:
|
||||||
backupfile = open(f"./wlgrps/backup-{grpName}.cfg", 'rb')
|
backupfile = open(f"./wlgrps/backup-{grpName}.cfg", 'rb')
|
||||||
self.copyfile(backupfile, self.wfile)
|
self.copyfile(backupfile, self.wfile)
|
||||||
@ -70,7 +70,7 @@ def startServer():
|
|||||||
while True:
|
while True:
|
||||||
print("trying to start...")
|
print("trying to start...")
|
||||||
try:
|
try:
|
||||||
with socketserver.TCPServer(("", PORT), handler) as httpd:
|
with socketserver.ThreadingTCPServer(("", PORT), handler) as httpd:
|
||||||
print('starting server!')
|
print('starting server!')
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
except:
|
except:
|
||||||
|
Loading…
Reference in New Issue
Block a user