This commit is contained in:
syuilo 2022-09-24 10:25:32 +09:00
parent ab6bbb9e23
commit f4b981cefe
1 changed files with 33 additions and 28 deletions

View File

@ -76,23 +76,6 @@ export const meta = {
properties: { properties: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
properties: {
width: {
type: 'number',
optional: false, nullable: false,
example: 1280,
},
height: {
type: 'number',
optional: false, nullable: false,
example: 720,
},
avgColor: {
type: 'string',
optional: true, nullable: false,
example: 'rgb(40,65,87)',
},
},
}, },
storedInternal: { storedInternal: {
type: 'boolean', type: 'boolean',
@ -116,15 +99,15 @@ export const meta = {
}, },
accessKey: { accessKey: {
type: 'string', type: 'string',
optional: false, nullable: false, optional: false, nullable: true,
}, },
thumbnailAccessKey: { thumbnailAccessKey: {
type: 'string', type: 'string',
optional: false, nullable: false, optional: false, nullable: true,
}, },
webpublicAccessKey: { webpublicAccessKey: {
type: 'string', type: 'string',
optional: false, nullable: false, optional: false, nullable: true,
}, },
uri: { uri: {
type: 'string', type: 'string',
@ -192,14 +175,36 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
throw new ApiError(meta.errors.noSuchFile); throw new ApiError(meta.errors.noSuchFile);
} }
const res = file as Partial<typeof file>; return {
id: file.id,
if (!me.isAdmin) { userId: file.userId,
delete res.requestIp; userHost: file.userHost,
delete res.requestHeaders; isLink: file.isLink,
} maybePorn: file.maybePorn,
maybeSensitive: file.maybeSensitive,
return res; isSensitive: file.isSensitive,
folderId: file.folderId,
src: file.src,
uri: file.uri,
webpublicAccessKey: file.webpublicAccessKey,
thumbnailAccessKey: file.thumbnailAccessKey,
accessKey: file.accessKey,
webpublicType: file.webpublicType,
webpublicUrl: file.webpublicUrl,
thumbnailUrl: file.thumbnailUrl,
url: file.url,
storedInternal: file.storedInternal,
properties: file.properties,
blurhash: file.blurhash,
comment: file.comment,
size: file.size,
type: file.type,
name: file.name,
md5: file.md5,
createdAt: file.createdAt.toISOString(),
requestIp: me.isAdmin ? file.requestIp : null,
requestHeaders: me.isAdmin ? file.requestHeaders : null,
};
}); });
} }
} }