From 401dc64126bfdf6626d7bd198d9671b85070491f Mon Sep 17 00:00:00 2001 From: MangoFanFanw Date: Tue, 21 Apr 2026 22:37:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=AF=B9=E5=A4=96=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E5=90=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suan API 返回的图片链接中使用的主机名现在可以进行设置。 --- njupt_api/baselib/config.py | 3 ++- router/enhance/lib.py | 2 +- webui/src/pages/Config.vue | 6 ++++++ webui/src/types/config.ts | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/njupt_api/baselib/config.py b/njupt_api/baselib/config.py index 7e6a62e..dbed5e8 100644 --- a/njupt_api/baselib/config.py +++ b/njupt_api/baselib/config.py @@ -60,11 +60,12 @@ class Config: doc_system["host"] = "0.0.0.0" doc_system["port"] = 8000 doc_system["reload"] = True + doc_system["public_host"] = "http://127.0.0.1:8000" doc_schedule["playwright_headless"] = True doc_schedule["jwxt_login_method"] = "sso" doc_schedule["semester_start_date"] = "2026-03-02" - doc_schedule["schedule_title_template"] = "芒果酸的第 {title} 周课程表" + doc_schedule["schedule_title_template"] = "芒果酸的第 {week} 周课程表" doc_schedule["schedule_subtitle_template"] = "我也要上吗?" doc_log["log_api_request_details"] = False diff --git a/router/enhance/lib.py b/router/enhance/lib.py index e0c510c..da94d41 100644 --- a/router/enhance/lib.py +++ b/router/enhance/lib.py @@ -70,7 +70,7 @@ async def apply_enhance(course_list: list[dict], week: int, img: bool) -> Return img_url = None if img: - img_url = f"http://172.28.143.24:8000/api/schedule/img/{ + img_url = f"{config.get('system', 'public_host', 'http://127.0.0.1:8000')}/api/schedule/img/{ await generate_img(final_course_list, title_template.format(**vars_), subtitle_template.format(**vars_)) }" diff --git a/webui/src/pages/Config.vue b/webui/src/pages/Config.vue index 82629fd..4499334 100644 --- a/webui/src/pages/Config.vue +++ b/webui/src/pages/Config.vue @@ -67,6 +67,12 @@ function varTag(code: string, description: string) { show-switch title="热重载 Python 代码文件" /> + diff --git a/webui/src/types/config.ts b/webui/src/types/config.ts index 135880c..755caca 100644 --- a/webui/src/types/config.ts +++ b/webui/src/types/config.ts @@ -2,6 +2,7 @@ export interface ConfigSystemDto { host?: string port?: number reload?: boolean + public_host?: string } export interface ConfigScheduleDto {