-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
可选后端,实现前后端分离 #4899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
可选后端,实现前后端分离 #4899
Changes from 2 commits
a8cad50
75ee467
68b8a1a
d68ccfc
3b93429
1859206
4b1395b
6439e4e
f309638
bf1bde7
3610a42
437c186
15ee177
df1299b
3e928b9
d6455d7
31f4604
af09b5c
48c2d98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 3.10 | ||
| 3.10 |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||
| import asyncio | ||||||||
| import base64 | ||||||||
| import logging | ||||||||
| import os | ||||||||
|
|
@@ -7,6 +8,7 @@ | |||||||
| import time | ||||||||
| import uuid | ||||||||
| import zipfile | ||||||||
| from ipaddress import IPv4Address, IPv6Address, ip_address | ||||||||
| from pathlib import Path | ||||||||
|
|
||||||||
| import aiohttp | ||||||||
|
|
@@ -217,18 +219,51 @@ def file_to_base64(file_path: str) -> str: | |||||||
| return "base64://" + base64_str | ||||||||
|
|
||||||||
|
|
||||||||
| def get_local_ip_addresses(): | ||||||||
| def get_local_ip_addresses() -> list[IPv4Address | IPv6Address]: | ||||||||
| net_interfaces = psutil.net_if_addrs() | ||||||||
| network_ips = [] | ||||||||
| network_ips: list[IPv4Address | IPv6Address] = [] | ||||||||
|
|
||||||||
| for interface, addrs in net_interfaces.items(): | ||||||||
| for _, addrs in net_interfaces.items(): | ||||||||
| for addr in addrs: | ||||||||
| if addr.family == socket.AF_INET: # 使用 socket.AF_INET 代替 psutil.AF_INET | ||||||||
| network_ips.append(addr.address) | ||||||||
| if addr.family == socket.AF_INET: | ||||||||
| network_ips.append(ip_address(addr.address)) | ||||||||
| elif addr.family == socket.AF_INET6: | ||||||||
| # 过滤掉 IPv6 的 link-local 地址(fe80:...) | ||||||||
| # 用这个不如用::1 | ||||||||
| ip = ip_address(addr.address.split("%")[0]) # 处理带 zone index 的情况 | ||||||||
| network_ips.append(ip) | ||||||||
|
||||||||
| network_ips.append(ip) | |
| if isinstance(ip, IPv6Address) and not ip.is_link_local: | |
| network_ips.append(ip) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: 建议为该图片添加
alt属性以提升可访问性。例如:
<img src="..." width="100" alt="对机器人动图的简短描述" />,这样屏幕阅读器就能向用户传达动画的内容。Original comment in English
suggestion: Consider adding an
altattribute to the image for better accessibility.For example:
<img src="..." width="100" alt="Short description of the robot GIF" />so screen readers can convey the content of the animation.