mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 12:43:08 +02:00
ce340aba7a
* wip * wip * wip * wip * wip * Update define.ts * Update update.ts * Update user.ts * wip * wip * Update request.ts * URL * wip * wip * wip * wip * Update invite.ts * Update create.ts
43 lines
935 B
TypeScript
43 lines
935 B
TypeScript
import define from '../define';
|
|
import { fetchMeta } from '@/misc/fetch-meta';
|
|
import { DriveFiles } from '../../../models';
|
|
|
|
export const meta = {
|
|
desc: {
|
|
'ja-JP': 'ドライブの情報を取得します。',
|
|
'en-US': 'Get drive information.'
|
|
},
|
|
|
|
tags: ['drive', 'account'],
|
|
|
|
requireCredential: true as const,
|
|
|
|
kind: 'read:drive',
|
|
|
|
res: {
|
|
type: 'object' as const,
|
|
optional: false as const, nullable: false as const,
|
|
properties: {
|
|
capacity: {
|
|
type: 'number' as const,
|
|
optional: false as const, nullable: false as const,
|
|
},
|
|
usage: {
|
|
type: 'number' as const,
|
|
optional: false as const, nullable: false as const,
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, user) => {
|
|
const instance = await fetchMeta(true);
|
|
|
|
// Calculate drive usage
|
|
const usage = await DriveFiles.calcDriveUsageOf(user.id);
|
|
|
|
return {
|
|
capacity: 1024 * 1024 * instance.localDriveCapacityMb,
|
|
usage: usage
|
|
};
|
|
});
|