From df69b0192c5abb931c71195597867fdfe14f66c7 Mon Sep 17 00:00:00 2001 From: nixevol Date: Wed, 16 Sep 2026 17:36:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A5=BC=E5=AE=87=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E4=BF=A1=E6=81=AF=E7=9B=B4=E6=8E=A5=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=B9=B6=E5=BC=80=E5=90=AF=E4=BF=9D=E5=AD=98=E5=8D=B3?= =?UTF-8?q?=E9=87=8D=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .streamlit/config.toml | 1 + ui/building_page.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.streamlit/config.toml b/.streamlit/config.toml index 49b5966..7ef7d94 100644 --- a/.streamlit/config.toml +++ b/.streamlit/config.toml @@ -1,6 +1,7 @@ [server] address = "127.0.0.1" maxUploadSize = 4096 +runOnSave = true [browser] gatherUsageStats = false diff --git a/ui/building_page.py b/ui/building_page.py index 4c22752..dd79916 100644 --- a/ui/building_page.py +++ b/ui/building_page.py @@ -13,21 +13,22 @@ def render(): limit = c2.number_input("查询数量(0 表示全部)", 0, value=1000) concurrency = c3.number_input("并发数", 1, 32, 8) encoding = st.selectbox("文件编码", ["gb18030", "utf-8-sig"]) - with st.expander("连接设置"): + st.markdown("**连接信息**(留空则使用脚本内默认配置)") + url = st.text_input("服务地址", type="password", placeholder="https://...wfs?...ak=...&sig=...") + cookies = st.text_input("登录信息", type="password", placeholder="CASTGC=...") + referer = st.text_input("来源页(可留空)") + with st.expander("高级参数"): timeout = st.number_input("超时(秒)", 1, 300, 30) retries = st.number_input("失败重试", 0, 10, 2) interval = st.number_input("请求间隔(秒)", 0.0, 60.0, 0.2, 0.1) - override = st.checkbox("使用临时连接信息", value=False) - url = st.text_input("服务地址", type="password") - cookies = st.text_input("登录信息", type="password") - referer = st.text_input("来源页(可留空)") submitted = st.form_submit_button("开始查询", type="primary") if submitted: try: if not source: raise ValueError("请先导入坐标文件。") - if override and (not url.startswith(("http://", "https://")) or not cookies.strip()): - raise ValueError("请填写完整服务地址和登录信息。") + override = bool(url.strip() or cookies.strip()) + if override and (not url.strip().startswith(("http://", "https://")) or not cookies.strip()): + raise ValueError("服务地址和登录信息需同时填写,且地址以 http(s):// 开头。") params = {"INPUT_CSV": source, "INPUT_ENCODING": encoding, "START_ROW": start, "LIMIT": limit or None, "CONCURRENCY": concurrency, "TIMEOUT": timeout, "MAX_RETRIES": retries, "REQUEST_INTERVAL": interval}