Skip to content

Commit b4cafcd

Browse files
committed
fix: 修复漏洞
1 parent 807eff5 commit b4cafcd

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

core/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import psutil
66

77

8-
def getStatus(cluster) -> web.Response:
8+
async def getStatus(cluster) -> web.Response:
99
hourly_hits = getHourlyHits()
1010
daily_hits = getDailyHits()
1111
monthly_hits = getMonthlyHits()

core/cluster.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from core.storages import getStorages, LocalStorage
1212
from core.classes import FileInfo, FileList, AgentConfiguration
1313
from core.router import Router
14+
from core.orm import writeHits
1415
from core.i18n import locale
1516
from typing import List, Any
1617
from aiohttp import web

core/orm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def writeAgent(agent: str, hits: int) -> None:
5151

5252
def getHourlyHits() -> Dict[str, List[Dict[str, int]]]:
5353
def fetchData(base_time: datetime) -> List[Dict[str, int]]:
54-
timestamps = [int(base_time.replace(hour=i).timestamp()) for i in range(1, 26)]
54+
timestamps = [
55+
int((base_time + timedelta(hours=i)).timestamp()) for i in range(24)
56+
] + [int((base_time.replace(hour=1) + timedelta(days=1)).timestamp())]
5557
return [
5658
{
5759
"hits": sum(item.hits for item in query) if query else 0,

0 commit comments

Comments
 (0)