allowed ips load

This commit is contained in:
√(noham)² committed 2024-07-27 22:17:54 +02:00
1 parent 21ed85c304
commit a258f92208
3 files changed
+6 -1

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"ALLOWED_IPS": ["127.0.0.1"]}
+1
View File
@@ -1 +1,2 @@
.venv
.allowed
+4 -1
View File
@@ -15,12 +15,15 @@ from textwrap import indent
from traceback import format_exc
import h11
import trio
import json
DEFAULT_PORT = 8080
PORT = int(getenv('PORT', DEFAULT_PORT))
# List of allowed IP addresses
ALLOWED_IPS = ['127.0.0.1', '82.66.241.83', '136.243.50.102', '178.254.72.180'] + [f'192.168.1.{i}' for i in range(1, 254)]
with open('.allowed') as f:
ALLOWED_IPS = json.load(f)['ALLOWED_IPS']
ALLOWED_IPS = ALLOWED_IPS + [f'192.168.1.{i}' for i in range(1, 254)]
prn = partial(print, end='')
indented = partial(indent, prefix=' ')