release: v1.4.0 — 标签系统、操作日志扩展与文档截图更新
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
Publish Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Canceled after 0s
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Canceled after 0s
Publish Docker image / merge (push) Canceled after 0s
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
Publish Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Canceled after 0s
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Canceled after 0s
Publish Docker image / merge (push) Canceled after 0s
- 每用户标签与彩色打标,图库 OR/AND 筛选与批量打标 - 操作日志记录登录、删除、设置与标签操作 - API 标签/打标接口;README 与文档站截图同步
This commit is contained in:
1 parent
f17d79b236
commit
737235acff
110 files changed
+5881
-778
No files matched your search
@@ -4,10 +4,9 @@ import { logException } from '../../utils/logger'
|
||||
import {
|
||||
listActivityLogs,
|
||||
listUserIdUsernameMap,
|
||||
summarizeActivityLogs,
|
||||
type LogAction,
|
||||
type LogSource
|
||||
summarizeActivityLogs
|
||||
} from '../../utils/db'
|
||||
import { isLogAction, isLogSource } from '../../utils/activity-log'
|
||||
import { ensureStorageSchema } from '../../utils/storage-backends'
|
||||
import {
|
||||
DEFAULT_LIST_LIMIT,
|
||||
@@ -25,14 +24,10 @@ export default defineEventHandler(async (event) => {
|
||||
: DEFAULT_LIST_LIMIT
|
||||
|
||||
const actionRaw = typeof query.action === 'string' ? query.action : ''
|
||||
const action = (actionRaw === 'upload' || actionRaw === 'delete')
|
||||
? actionRaw as LogAction
|
||||
: undefined
|
||||
const action = isLogAction(actionRaw) ? actionRaw : undefined
|
||||
|
||||
const sourceRaw = typeof query.source === 'string' ? query.source : ''
|
||||
const source = (sourceRaw === 'web' || sourceRaw === 'api')
|
||||
? sourceRaw as LogSource
|
||||
: undefined
|
||||
const source = isLogSource(sourceRaw) ? sourceRaw : undefined
|
||||
|
||||
const folder = typeof query.folder === 'string' && query.folder.trim()
|
||||
? query.folder.trim()
|
||||
@@ -41,6 +36,19 @@ export default defineEventHandler(async (event) => {
|
||||
const searchRaw = typeof query.q === 'string' ? query.q.trim() : ''
|
||||
const search = searchRaw || undefined
|
||||
|
||||
const dateFromRaw = typeof query.from === 'string' ? query.from.trim() : ''
|
||||
const dateToRaw = typeof query.to === 'string' ? query.to.trim() : ''
|
||||
const dateFrom = dateFromRaw && /^\d{4}-\d{2}-\d{2}$/.test(dateFromRaw)
|
||||
? `${dateFromRaw}T00:00:00.000Z`
|
||||
: undefined
|
||||
const dateTo = dateToRaw && /^\d{4}-\d{2}-\d{2}$/.test(dateToRaw)
|
||||
? (() => {
|
||||
const end = new Date(`${dateToRaw}T00:00:00.000Z`)
|
||||
end.setUTCDate(end.getUTCDate() + 1)
|
||||
return end.toISOString()
|
||||
})()
|
||||
: undefined
|
||||
|
||||
const pageRaw = Number(query.page ?? 1)
|
||||
const page = Number.isFinite(pageRaw) && pageRaw > 0
|
||||
? Math.floor(pageRaw)
|
||||
@@ -62,8 +70,25 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
try {
|
||||
ensureStorageSchema()
|
||||
const result = listActivityLogs({ limit, page, action, source, folder, userId, search })
|
||||
const summary = summarizeActivityLogs({ source, folder, userId, search })
|
||||
const result = listActivityLogs({
|
||||
limit,
|
||||
page,
|
||||
action,
|
||||
source,
|
||||
folder,
|
||||
userId,
|
||||
search,
|
||||
dateFrom,
|
||||
dateTo
|
||||
})
|
||||
const summary = summarizeActivityLogs({
|
||||
source,
|
||||
folder,
|
||||
userId,
|
||||
search,
|
||||
dateFrom,
|
||||
dateTo
|
||||
})
|
||||
const userMap = user.role === 'admin' ? listUserIdUsernameMap() : undefined
|
||||
|
||||
return {
|
||||
@@ -84,6 +109,8 @@ export default defineEventHandler(async (event) => {
|
||||
type: (row.backend_type === 'local' ? 'local' : 's3') as 'local' | 's3'
|
||||
}
|
||||
: null,
|
||||
ipAddress: row.ip_address,
|
||||
status: row.status === 'failure' ? 'failure' : 'success',
|
||||
createdAt: row.created_at
|
||||
})),
|
||||
total: result.total,
|
||||
|
||||
Reference in new issue
Block a user