Introduce per-instance chart (#4183)
* Introduce per-instance chart * Implement chart view in client * Handle note deleting * More chart srcs * Add drive stats * Improve drive stats * Fix bug * Add icon
This commit is contained in:
@@ -4,7 +4,10 @@ import DriveFileThumbnail, { DriveFileThumbnailChunk } from '../../models/drive-
|
||||
import config from '../../config';
|
||||
import driveChart from '../../services/chart/drive';
|
||||
import perUserDriveChart from '../../services/chart/per-user-drive';
|
||||
import instanceChart from '../../services/chart/instance';
|
||||
import DriveFileWebpublic, { DriveFileWebpublicChunk } from '../../models/drive-file-webpublic';
|
||||
import Instance from '../../models/instance';
|
||||
import { isRemoteUser } from '../../models/user';
|
||||
|
||||
export default async function(file: IDriveFile, isExpired = false) {
|
||||
if (file.metadata.storage == 'minio') {
|
||||
@@ -84,4 +87,13 @@ export default async function(file: IDriveFile, isExpired = false) {
|
||||
// 統計を更新
|
||||
driveChart.update(file, false);
|
||||
perUserDriveChart.update(file, false);
|
||||
if (isRemoteUser(file.metadata._user)) {
|
||||
instanceChart.updateDrive(file, false);
|
||||
Instance.update({ host: file.metadata._user.host }, {
|
||||
$inc: {
|
||||
driveUsage: -file.length,
|
||||
driveFiles: -1
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user