mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-12 10:04:28 +05:00
fix: correctly handle IPs in nginx config files when parsing ports (#568)
* chore: add jupyter files to .gitignore Signed-off-by: Dominik Willner <th33xitus@gmail.com> * fix: correctly handle IPs in nginx config files when parsing ports Signed-off-by: Dominik Willner <th33xitus@gmail.com> --------- Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,6 +1,10 @@
|
|||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
|
.jupyter
|
||||||
|
*.ipynb
|
||||||
|
*.ipynb_checkpoints
|
||||||
|
*.tmp
|
||||||
__pycache__
|
__pycache__
|
||||||
.kiauh-env
|
.kiauh-env
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
|||||||
@@ -353,10 +353,16 @@ def read_ports_from_nginx_configs() -> List[int]:
|
|||||||
lines = cfg.readlines()
|
lines = cfg.readlines()
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.replace("default_server", "")
|
line = re.sub(
|
||||||
line = re.sub(r"[;:\[\]]", "", line.strip())
|
r"default_server|http://|https://|[;\[\]]",
|
||||||
if line.startswith("listen") and line.split()[-1] not in port_list:
|
"",
|
||||||
port_list.append(line.split()[-1])
|
line.strip(),
|
||||||
|
)
|
||||||
|
if line.startswith("listen"):
|
||||||
|
if ":" not in line:
|
||||||
|
port_list.append(line.split()[-1])
|
||||||
|
else:
|
||||||
|
port_list.append(line.split(":")[-1])
|
||||||
|
|
||||||
ports_to_ints_list = [int(port) for port in port_list]
|
ports_to_ints_list = [int(port) for port in port_list]
|
||||||
return sorted(ports_to_ints_list, key=lambda x: int(x))
|
return sorted(ports_to_ints_list, key=lambda x: int(x))
|
||||||
|
|||||||
Reference in New Issue
Block a user