Skip to content

Commit 9433cba

Browse files
committed
合规测试
1 parent 71aa024 commit 9433cba

File tree

4 files changed

+373
-86
lines changed

4 files changed

+373
-86
lines changed

main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,14 @@ def safe_make_net(ip_value: str, mask: str) -> str:
7474

7575
with open('template/template.html', 'r', encoding='utf-8') as f:
7676
template = f.read()
77-
new_content = (template.replace("%_REPLACE_CONTENT0_%", ''.join(content))).replace(
78-
"%_REPLACE_CONTENT1_%", json.dumps(tableDataList, ensure_ascii=False)
77+
map_config_endpoint = os.getenv('TRACE_MAP_CONFIG_ENDPOINT', '/map-style-config')
78+
default_style = os.getenv('TRACE_GLOBAL_MAP_STYLE', 'https://tiles.openfreemap.org/styles/liberty')
79+
new_content = (
80+
template
81+
.replace("%_REPLACE_CONTENT0_%", ''.join(content))
82+
.replace("%_REPLACE_CONTENT1_%", json.dumps(tableDataList, ensure_ascii=False))
83+
.replace("%_MAP_CONFIG_ENDPOINT_%", json.dumps(map_config_endpoint))
84+
.replace("%_GLOBAL_DEFAULT_MAP_STYLE_%", json.dumps(default_style))
7985
)
8086
with open(os.path.join(output_path, file_name), 'w', encoding='utf-8') as fp:
8187
fp.write(new_content)

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ gunicorn~=23.0.0
55
IPy~=1.1
66
translate~=3.6.1
77
packaging~=24.2
8+
geoip2~=4.8.0

0 commit comments

Comments
 (0)