Merge pull request #120 from 2311719626/feat/task-logs-virtual-scroll

feat(task-logs): 优化任务中心日志前端展示 & fix(auth): 移除安全漏洞
This commit is contained in:
Wonder
2026-07-28 17:47:36 +08:00
committed by GitHub
2 changed files with 25 additions and 2 deletions
+25
View File
@@ -240,6 +240,31 @@ function selectTask(taskId: string) {
void loadLogs(taskId)
}
function scrollToBottom() {
if (!autoScroll.value) return
nextTick(() => {
if (logContainerRef.value) {
logContainerRef.value.scrollTop = logContainerRef.value.scrollHeight
}
})
}
function handleScroll() {
if (!logContainerRef.value) return
const { scrollTop, scrollHeight, clientHeight } = logContainerRef.value
const distanceFromBottom = scrollHeight - scrollTop - clientHeight
// 距离底部小于 50px 时认为在底部,恢复自动滚动
if (distanceFromBottom < 50) {
autoScroll.value = true
} else if (distanceFromBottom > 100) {
// 用户向上滚动超过 100px 时暂停自动滚动
autoScroll.value = false
}
}
function refreshCurrent() {
void loadTasks()
}
-2
View File
@@ -18,8 +18,6 @@ func AuthMiddleware(cfg config.Config) gin.HandlerFunc {
tokenValue := ""
if strings.HasPrefix(value, "Bearer ") {
tokenValue = strings.TrimPrefix(value, "Bearer ")
} else {
tokenValue = strings.TrimSpace(c.Query("access_token"))
}
if tokenValue == "" {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "missing bearer token"})