Skip to content

Commit

Permalink
fix: 修复漏洞
Browse files Browse the repository at this point in the history
  • Loading branch information
SilianZ committed Dec 29, 2024
1 parent e2d5182 commit b96e084
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python OpenBMCLAPI Dashboard</title>
<script type="module" crossorigin src="/assets/index-DsyND4Ca.js"></script>
<script type="module" crossorigin src="/assets/index-BQ9kYwai.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BhTleVqd.css">
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions core/storages/alist.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def getMissingFiles(self, files: FileList, pbar: tqdm) -> FileList:
existing_files: List[FileInfo] = []
async with aiohttp.ClientSession(self.url, headers=self.headers) as session:

async def getFileList(dir: str) -> List[FileInfo]:
async def getFileList(dir: str, pbar: tqdm) -> List[FileInfo]:
file_path = self.path + dir
response = await session.post(
"/api/fs/list", headers=self.headers, json={"path": file_path}
Expand All @@ -113,7 +113,7 @@ async def getFileList(dir: str) -> List[FileInfo]:
) as _pbar:
for i in range(256):
dir = f"/{i:02x}"
existing_files += await getFileList(dir)
existing_files += await getFileList(dir, _pbar)

existing_info: Set[Tuple[str, int]] = {
(file.hash, file.size) for file in existing_files
Expand Down
8 changes: 3 additions & 5 deletions dashboard/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ export async function fetchRank() {
}

function getWebSocketURL(path: string) {
const baseURL = axios.defaults.baseURL || ''
const url = new URL(baseURL)
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
url.pathname = path
return url.toString()
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
const host = window.location.host
return `${protocol}//${host}${path}`
}

const ws = new WebSocket(getWebSocketURL('/ws/logs'))
Expand Down

0 comments on commit b96e084

Please sign in to comment.