feat: expose fudai region coordinates in gui
This commit is contained in:
1 parent
bcc4d1151f
commit
4797fa046e
17 files changed
+1044
-119
No files matched your search
@@ -83,6 +83,17 @@ def _is_invalid_ports_spec(spec) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def _coerce_region_values(value) -> list[int] | None:
|
||||
if not isinstance(value, (list, tuple)):
|
||||
return None
|
||||
if len(value) != 4:
|
||||
return None
|
||||
try:
|
||||
return [int(item) for item in value]
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def handle_get(handler, u, runner, csrf_token: str) -> None:
|
||||
if u.path.startswith("/api/"):
|
||||
if not _is_local_request(handler):
|
||||
@@ -448,6 +459,42 @@ def handle_post(handler, u, runner, csrf_token: str) -> None:
|
||||
"fudai_detail_ui_mode",
|
||||
"logging.log_format_mode",
|
||||
}
|
||||
region_list_keys = {
|
||||
"fudai_detail_regions.legacy.content",
|
||||
"fudai_detail_regions.legacy.value",
|
||||
"fudai_detail_regions.legacy.countdown_full",
|
||||
"fudai_detail_regions.legacy.task_list",
|
||||
"fudai_detail_regions.legacy.task_count",
|
||||
"fudai_detail_regions.legacy.participants",
|
||||
"fudai_detail_regions.legacy.button",
|
||||
"fudai_detail_regions.legacy.live_title",
|
||||
"fudai_detail_regions.v2_0_two_task.content",
|
||||
"fudai_detail_regions.v2_0_two_task.value",
|
||||
"fudai_detail_regions.v2_0_two_task.countdown_full",
|
||||
"fudai_detail_regions.v2_0_two_task.task_list",
|
||||
"fudai_detail_regions.v2_0_two_task.task_count",
|
||||
"fudai_detail_regions.v2_0_two_task.participants",
|
||||
"fudai_detail_regions.v2_0_two_task.button",
|
||||
"fudai_detail_regions.v2_0_two_task.live_title",
|
||||
"fudai_detail_regions.v2_0_one_task.content",
|
||||
"fudai_detail_regions.v2_0_one_task.value",
|
||||
"fudai_detail_regions.v2_0_one_task.countdown_full",
|
||||
"fudai_detail_regions.v2_0_one_task.info_line",
|
||||
"fudai_detail_regions.v2_0_one_task.task_list",
|
||||
"fudai_detail_regions.v2_0_one_task.task_count",
|
||||
"fudai_detail_regions.v2_0_one_task.participants",
|
||||
"fudai_detail_regions.v2_0_one_task.button",
|
||||
"fudai_detail_regions.v2_0_one_task.live_title",
|
||||
"pixel_regions.lottery_result.button",
|
||||
"pixel_regions.lottery_result.pixel",
|
||||
"pixel_regions.lottery_result.click",
|
||||
"pixel_regions.attend_button",
|
||||
"pixel_regions.fansclub_join",
|
||||
"pixel_regions.coupon_popup",
|
||||
"pixel_regions.shopping_redpacket",
|
||||
"pixel_regions.fudai_detail_body",
|
||||
"pixel_regions.live_room_icon_bbox",
|
||||
}
|
||||
derived_logging_keys = {
|
||||
"logging.debug_detail_level",
|
||||
"logging.error_detail_level",
|
||||
@@ -515,6 +562,11 @@ def handle_post(handler, u, runner, csrf_token: str) -> None:
|
||||
set_nested_value(
|
||||
cfg, k, [str(x).strip() for x in str(v).splitlines() if str(x).strip()]
|
||||
)
|
||||
elif k in region_list_keys:
|
||||
parsed = _coerce_region_values(v)
|
||||
if parsed is None:
|
||||
continue
|
||||
set_nested_value(cfg, k, parsed)
|
||||
elif k in enum_str_keys:
|
||||
val = str(v or "").strip().lower()
|
||||
if k == "reset_after_swipes_action":
|
||||
|
||||
Reference in new issue
Block a user