mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: oplog: better logging
This commit is contained in:
1 parent
92c1a41585
commit
ead0d54a55
8 files changed
+74
-60
No files matched your search
@@ -514,14 +514,8 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
|
||||
?.filter((i) => files.has(i.name))
|
||||
?.map((i) => i.size),
|
||||
) || 0;
|
||||
await oplog.add({
|
||||
type: 'bulkDownload',
|
||||
time: new Date(),
|
||||
uid: this.user._id,
|
||||
ip: this.request.ip,
|
||||
fileType: 'problem',
|
||||
await oplog.log(this, 'download.problem.bulk', {
|
||||
target: Array.from(files).map((file) => `problem/${this.pdoc.domainId}/${this.pdoc.docId}/${type}/${file}`),
|
||||
referer: this.request.referer,
|
||||
size,
|
||||
});
|
||||
for (const file of files) {
|
||||
@@ -618,14 +612,8 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
||||
}
|
||||
const target = `problem/${this.pdoc.domainId}/${this.pdoc.docId}/${type}/${filename}`;
|
||||
const file = await storage.getMeta(target);
|
||||
await oplog.add({
|
||||
type: 'download',
|
||||
time: new Date(),
|
||||
uid: this.user._id,
|
||||
ip: this.request.ip,
|
||||
fileType: 'problem',
|
||||
await oplog.log(this, 'download.problem.single', {
|
||||
target,
|
||||
referer: this.request.referer,
|
||||
size: file?.size || 0,
|
||||
});
|
||||
if (!file) {
|
||||
|
||||
Reference in new issue
Block a user