Skip to content

Commit 0414701

Browse files
authored
Merge pull request #32 from TTB-Network/dev/storage
🐛 修复漏洞
2 parents b5f2353 + 2fda2c2 commit 0414701

File tree

12 files changed

+336
-122
lines changed

12 files changed

+336
-122
lines changed

.github/workflows/build_and_publish.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,3 @@ jobs:
6767
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
6868
git commit -a -m ":sparkles: 更新 VERSION"
6969
git push
70-
71-
72-

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ bmclapi
88
cache
99
public
1010
.ssl
11-
.lh

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
## 从源码运行
4343

44-
建议 Python 版本:3.12+。
44+
建议 Python 版本:3.10+。
4545

4646
1. 克隆仓库或从 [Releases](https://github.com/TTB-Network/python-openbmclapi/releases) 中下载代码:
4747

config/config.yml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ storages:
3636
bmclapi:
3737
path: ./bmclapi
3838
type: file
39+
width: 0
3940
web:
4041
force_ssl: false
4142
port: 8080

core/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,17 @@ async def check_ports():
185185
closed = False
186186
for port in ports:
187187
try:
188+
kwargs = {}
189+
if port[1] is not None:
190+
kwargs["ssl"] = port[1]
191+
kwargs["ssl_handshake_timeout"] = 5
188192
client = Client(
189193
*(
190194
await asyncio.wait_for(
191195
asyncio.open_connection(
192196
"127.0.0.1",
193197
port[0].sockets[0].getsockname()[1],
194-
ssl=port[1],
198+
**kwargs,
195199
),
196200
timeout=5,
197201
)

core/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ class StatsCache:
7777

7878

7979
class Storage(metaclass=abc.ABCMeta):
80-
def __init__(self, name) -> None:
80+
def __init__(self, name, width: int) -> None:
8181
self.name = name
8282
self.disabled = False
83+
self.width = width
8384

8485
def get_name(self):
8586
return self.name

0 commit comments

Comments
 (0)