This commit is contained in:
syuilo
2021-12-09 23:58:30 +09:00
parent 0abe2dfee0
commit c69b72e199
573 changed files with 3318 additions and 3318 deletions

View File

@ -13,7 +13,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@ -35,7 +35,7 @@ export const meta = {
'local',
'remote',
]),
default: 'combined'
default: 'combined',
},
targetUserOrigin: {
@ -44,7 +44,7 @@ export const meta = {
'local',
'remote',
]),
default: 'combined'
default: 'combined',
},
},
@ -73,7 +73,7 @@ export const meta = {
resolved: {
type: 'boolean' as const,
nullable: false as const, optional: false as const,
example: false
example: false,
},
reporterId: {
type: 'string' as const,
@ -93,21 +93,21 @@ export const meta = {
reporter: {
type: 'object' as const,
nullable: false as const, optional: false as const,
ref: 'User'
ref: 'User',
},
targetUser: {
type: 'object' as const,
nullable: false as const, optional: false as const,
ref: 'User'
ref: 'User',
},
assignee: {
type: 'object' as const,
nullable: true as const, optional: true as const,
ref: 'User'
}
}
}
}
ref: 'User',
},
},
},
},
};
export default define(meta, async (ps) => {

View File

@ -12,7 +12,7 @@ export const meta = {
password: {
validator: Users.validatePassword,
}
},
},
res: {
@ -23,9 +23,9 @@ export const meta = {
token: {
type: 'string' as const,
optional: false as const, nullable: false as const,
}
}
}
},
},
},
};
export default define(meta, async (ps, _me) => {
@ -42,7 +42,7 @@ export default define(meta, async (ps, _me) => {
const res = await Users.pack(account, account, {
detail: true,
includeSecrets: true
includeSecrets: true,
});
(res as any).token = secret;

View File

@ -16,7 +16,7 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps, me) => {
@ -39,11 +39,11 @@ export default define(meta, async (ps, me) => {
await doPostSuspend(user).catch(e => {});
createDeleteAccountJob(user, {
soft: false
soft: false,
});
} else {
createDeleteAccountJob(user, {
soft: true // リモートユーザーの削除は、完全にDBから物理削除してしまうと再度連合してきてアカウントが復活する可能性があるため、soft指定する
soft: true, // リモートユーザーの削除は、完全にDBから物理削除してしまうと再度連合してきてアカウントが復活する可能性があるため、soft指定する
});
}

View File

@ -11,26 +11,26 @@ export const meta = {
params: {
url: {
validator: $.str.min(1)
validator: $.str.min(1),
},
memo: {
validator: $.str
validator: $.str,
},
place: {
validator: $.str
validator: $.str,
},
priority: {
validator: $.str
validator: $.str,
},
ratio: {
validator: $.num.int().min(0)
validator: $.num.int().min(0),
},
expiresAt: {
validator: $.num.int()
validator: $.num.int(),
},
imageUrl: {
validator: $.str.min(1)
}
validator: $.str.min(1),
},
},
};

View File

@ -12,17 +12,17 @@ export const meta = {
params: {
id: {
validator: $.type(ID)
}
validator: $.type(ID),
},
},
errors: {
noSuchAd: {
message: 'No such ad.',
code: 'NO_SUCH_AD',
id: 'ccac9863-3a03-416e-b899-8a64041118b1'
}
}
id: 'ccac9863-3a03-416e-b899-8a64041118b1',
},
},
};
export default define(meta, async (ps, me) => {

View File

@ -13,7 +13,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {

View File

@ -12,28 +12,28 @@ export const meta = {
params: {
id: {
validator: $.type(ID)
validator: $.type(ID),
},
memo: {
validator: $.str
validator: $.str,
},
url: {
validator: $.str.min(1)
validator: $.str.min(1),
},
imageUrl: {
validator: $.str.min(1)
validator: $.str.min(1),
},
place: {
validator: $.str
validator: $.str,
},
priority: {
validator: $.str
validator: $.str,
},
ratio: {
validator: $.num.int().min(0)
validator: $.num.int().min(0),
},
expiresAt: {
validator: $.num.int()
validator: $.num.int(),
},
},
@ -41,9 +41,9 @@ export const meta = {
noSuchAd: {
message: 'No such ad.',
code: 'NO_SUCH_AD',
id: 'b7aa1727-1354-47bc-a182-3a9c3973d300'
}
}
id: 'b7aa1727-1354-47bc-a182-3a9c3973d300',
},
},
};
export default define(meta, async (ps, me) => {

View File

@ -11,14 +11,14 @@ export const meta = {
params: {
title: {
validator: $.str.min(1)
validator: $.str.min(1),
},
text: {
validator: $.str.min(1)
validator: $.str.min(1),
},
imageUrl: {
validator: $.nullable.str.min(1)
}
validator: $.nullable.str.min(1),
},
},
res: {
@ -52,9 +52,9 @@ export const meta = {
imageUrl: {
type: 'string' as const,
optional: false as const, nullable: true as const,
}
}
}
},
},
},
};
export default define(meta, async (ps) => {

View File

@ -12,17 +12,17 @@ export const meta = {
params: {
id: {
validator: $.type(ID)
}
validator: $.type(ID),
},
},
errors: {
noSuchAnnouncement: {
message: 'No such announcement.',
code: 'NO_SUCH_ANNOUNCEMENT',
id: 'ecad8040-a276-4e85-bda9-015a708d291e'
}
}
id: 'ecad8040-a276-4e85-bda9-015a708d291e',
},
},
};
export default define(meta, async (ps, me) => {

View File

@ -13,7 +13,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@ -63,10 +63,10 @@ export const meta = {
reads: {
type: 'number' as const,
optional: false as const, nullable: false as const,
}
}
}
}
},
},
},
},
};
export default define(meta, async (ps) => {
@ -76,7 +76,7 @@ export default define(meta, async (ps) => {
for (const announcement of announcements) {
(announcement as any).reads = await AnnouncementReads.count({
announcementId: announcement.id
announcementId: announcement.id,
});
}

View File

@ -12,26 +12,26 @@ export const meta = {
params: {
id: {
validator: $.type(ID)
validator: $.type(ID),
},
title: {
validator: $.str.min(1)
validator: $.str.min(1),
},
text: {
validator: $.str.min(1)
validator: $.str.min(1),
},
imageUrl: {
validator: $.nullable.str.min(1)
}
validator: $.nullable.str.min(1),
},
},
errors: {
noSuchAnnouncement: {
message: 'No such announcement.',
code: 'NO_SUCH_ANNOUNCEMENT',
id: 'd3aae5a7-6372-4cb4-b61c-f511ffc2d7cc'
}
}
id: 'd3aae5a7-6372-4cb4-b61c-f511ffc2d7cc',
},
},
};
export default define(meta, async (ps, me) => {

View File

@ -14,12 +14,12 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps, me) => {
const files = await DriveFiles.find({
userId: ps.userId
userId: ps.userId,
});
for (const file of files) {

View File

@ -12,7 +12,7 @@ export const meta = {
export default define(meta, async (ps, me) => {
const files = await DriveFiles.find({
userId: IsNull()
userId: IsNull(),
});
for (const file of files) {

View File

@ -13,7 +13,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@ -25,7 +25,7 @@ export const meta = {
},
type: {
validator: $.optional.nullable.str.match(/^[a-zA-Z0-9\/\-*]+$/)
validator: $.optional.nullable.str.match(/^[a-zA-Z0-9\/\-*]+$/),
},
origin: {
@ -34,12 +34,12 @@ export const meta = {
'local',
'remote',
]),
default: 'local'
default: 'local',
},
hostname: {
validator: $.optional.nullable.str,
default: null
default: null,
},
},
@ -49,9 +49,9 @@ export const meta = {
items: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'DriveFile'
}
}
ref: 'DriveFile',
},
},
};
export default define(meta, async (ps, me) => {

View File

@ -24,8 +24,8 @@ export const meta = {
noSuchFile: {
message: 'No such file.',
code: 'NO_SUCH_FILE',
id: 'caf3ca38-c6e5-472e-a30c-b05377dcc240'
}
id: 'caf3ca38-c6e5-472e-a30c-b05377dcc240',
},
},
res: {
@ -51,36 +51,36 @@ export const meta = {
},
userHost: {
type: 'string' as const,
optional: false as const, nullable: true as const
optional: false as const, nullable: true as const,
},
md5: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'md5',
example: '15eca7fba0480996e2245f5185bf39f2'
example: '15eca7fba0480996e2245f5185bf39f2',
},
name: {
type: 'string' as const,
optional: false as const, nullable: false as const,
example: 'lenna.jpg'
example: 'lenna.jpg',
},
type: {
type: 'string' as const,
optional: false as const, nullable: false as const,
example: 'image/jpeg'
example: 'image/jpeg',
},
size: {
type: 'number' as const,
optional: false as const, nullable: false as const,
example: 51469
example: 51469,
},
comment: {
type: 'string' as const,
optional: false as const, nullable: true as const
optional: false as const, nullable: true as const,
},
blurhash: {
type: 'string' as const,
optional: false as const, nullable: true as const
optional: false as const, nullable: true as const,
},
properties: {
type: 'object' as const,
@ -89,24 +89,24 @@ export const meta = {
width: {
type: 'number' as const,
optional: false as const, nullable: false as const,
example: 1280
example: 1280,
},
height: {
type: 'number' as const,
optional: false as const, nullable: false as const,
example: 720
example: 720,
},
avgColor: {
type: 'string' as const,
optional: true as const, nullable: false as const,
example: 'rgb(40,65,87)'
}
}
example: 'rgb(40,65,87)',
},
},
},
storedInternal: {
type: 'boolean' as const,
optional: false as const, nullable: true as const,
example: true
example: true,
},
url: {
type: 'string' as const,
@ -137,11 +137,11 @@ export const meta = {
},
uri: {
type: 'string' as const,
optional: false as const, nullable: true as const
optional: false as const, nullable: true as const,
},
src: {
type: 'string' as const,
optional: false as const, nullable: true as const
optional: false as const, nullable: true as const,
},
folderId: {
type: 'string' as const,
@ -155,21 +155,21 @@ export const meta = {
},
isLink: {
type: 'boolean' as const,
optional: false as const, nullable: false as const
}
}
}
optional: false as const, nullable: false as const,
},
},
},
};
export default define(meta, async (ps, me) => {
const file = ps.fileId ? await DriveFiles.findOne(ps.fileId) : await DriveFiles.findOne({
where: [{
url: ps.url
url: ps.url,
}, {
thumbnailUrl: ps.url
thumbnailUrl: ps.url,
}, {
webpublicUrl: ps.url
}]
webpublicUrl: ps.url,
}],
});
if (file == null) {

View File

@ -17,7 +17,7 @@ export const meta = {
params: {
fileId: {
validator: $.type(ID)
validator: $.type(ID),
},
},
@ -25,9 +25,9 @@ export const meta = {
noSuchFile: {
message: 'No such file.',
code: 'MO_SUCH_FILE',
id: 'fc46b5a4-6b92-4c33-ac66-b806659bb5cf'
}
}
id: 'fc46b5a4-6b92-4c33-ac66-b806659bb5cf',
},
},
};
export default define(meta, async (ps, me) => {
@ -51,14 +51,14 @@ export default define(meta, async (ps, me) => {
await getConnection().queryResultCache!.remove(['meta_emojis']);
publishBroadcastStream('emojiAdded', {
emoji: await Emojis.pack(emoji.id)
emoji: await Emojis.pack(emoji.id),
});
insertModerationLog(me, 'addEmoji', {
emojiId: emoji.id
emojiId: emoji.id,
});
return {
id: emoji.id
id: emoji.id,
};
});

View File

@ -17,7 +17,7 @@ export const meta = {
params: {
emojiId: {
validator: $.type(ID)
validator: $.type(ID),
},
},
@ -25,8 +25,8 @@ export const meta = {
noSuchEmoji: {
message: 'No such emoji.',
code: 'NO_SUCH_EMOJI',
id: 'e2785b66-dca3-4087-9cac-b93c541cc425'
}
id: 'e2785b66-dca3-4087-9cac-b93c541cc425',
},
},
res: {
@ -37,9 +37,9 @@ export const meta = {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
}
}
}
},
},
},
};
export default define(meta, async (ps, me) => {
@ -72,10 +72,10 @@ export default define(meta, async (ps, me) => {
await getConnection().queryResultCache!.remove(['meta_emojis']);
publishBroadcastStream('emojiAdded', {
emoji: await Emojis.pack(copied.id)
emoji: await Emojis.pack(copied.id),
});
return {
id: copied.id
id: copied.id,
};
});

View File

@ -14,17 +14,17 @@ export const meta = {
params: {
query: {
validator: $.optional.nullable.str,
default: null
default: null,
},
host: {
validator: $.optional.nullable.str,
default: null
default: null,
},
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@ -33,7 +33,7 @@ export const meta = {
untilId: {
validator: $.optional.type(ID),
}
},
},
res: {
@ -53,8 +53,8 @@ export const meta = {
optional: false as const, nullable: false as const,
items: {
type: 'string' as const,
optional: false as const, nullable: false as const
}
optional: false as const, nullable: false as const,
},
},
name: {
type: 'string' as const,
@ -71,10 +71,10 @@ export const meta = {
url: {
type: 'string' as const,
optional: false as const, nullable: false as const,
}
}
}
}
},
},
},
},
};
export default define(meta, async (ps) => {

View File

@ -14,12 +14,12 @@ export const meta = {
params: {
query: {
validator: $.optional.nullable.str,
default: null
default: null,
},
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@ -28,7 +28,7 @@ export const meta = {
untilId: {
validator: $.optional.type(ID),
}
},
},
res: {
@ -48,8 +48,8 @@ export const meta = {
optional: false as const, nullable: false as const,
items: {
type: 'string' as const,
optional: false as const, nullable: false as const
}
optional: false as const, nullable: false as const,
},
},
name: {
type: 'string' as const,
@ -66,10 +66,10 @@ export const meta = {
url: {
type: 'string' as const,
optional: false as const, nullable: false as const,
}
}
}
}
},
},
},
},
};
export default define(meta, async (ps) => {

View File

@ -14,17 +14,17 @@ export const meta = {
params: {
id: {
validator: $.type(ID)
}
validator: $.type(ID),
},
},
errors: {
noSuchEmoji: {
message: 'No such emoji.',
code: 'NO_SUCH_EMOJI',
id: 'be83669b-773a-44b7-b1f8-e5e5170ac3c2'
}
}
id: 'be83669b-773a-44b7-b1f8-e5e5170ac3c2',
},
},
};
export default define(meta, async (ps, me) => {
@ -37,6 +37,6 @@ export default define(meta, async (ps, me) => {
await getConnection().queryResultCache!.remove(['meta_emojis']);
insertModerationLog(me, 'removeEmoji', {
emoji: emoji
emoji: emoji,
});
});

View File

@ -13,29 +13,29 @@ export const meta = {
params: {
id: {
validator: $.type(ID)
validator: $.type(ID),
},
name: {
validator: $.str
validator: $.str,
},
category: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
aliases: {
validator: $.arr($.str)
}
validator: $.arr($.str),
},
},
errors: {
noSuchEmoji: {
message: 'No such emoji.',
code: 'NO_SUCH_EMOJI',
id: '684dec9d-a8c2-4364-9aa8-456c49cb1dc8'
}
}
id: '684dec9d-a8c2-4364-9aa8-456c49cb1dc8',
},
},
};
export default define(meta, async (ps) => {

View File

@ -11,14 +11,14 @@ export const meta = {
params: {
host: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, me) => {
const files = await DriveFiles.find({
userHost: ps.host
userHost: ps.host,
});
for (const file of files) {

View File

@ -12,9 +12,9 @@ export const meta = {
params: {
host: {
validator: $.str
validator: $.str,
},
}
},
};
export default define(meta, async (ps, me) => {

View File

@ -11,19 +11,19 @@ export const meta = {
params: {
host: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, me) => {
const followings = await Followings.find({
followerHost: ps.host
followerHost: ps.host,
});
const pairs = await Promise.all(followings.map(f => Promise.all([
Users.findOneOrFail(f.followerId),
Users.findOneOrFail(f.followeeId)
Users.findOneOrFail(f.followeeId),
])));
for (const pair of pairs) {

View File

@ -11,13 +11,13 @@ export const meta = {
params: {
host: {
validator: $.str
validator: $.str,
},
isSuspended: {
validator: $.bool
validator: $.bool,
},
}
},
};
export default define(meta, async (ps, me) => {
@ -28,6 +28,6 @@ export default define(meta, async (ps, me) => {
}
Instances.update({ host: toPuny(ps.host) }, {
isSuspended: ps.isSuspended
isSuspended: ps.isSuspended,
});
});

View File

@ -16,10 +16,10 @@ export const meta = {
example: {
migrations: {
count: 66,
size: 32768
size: 32768,
},
}
}
},
},
};
export default define(meta, async () => {

View File

@ -20,10 +20,10 @@ export const meta = {
optional: false as const, nullable: false as const,
example: '2ERUA5VR',
maxLength: 8,
minLength: 8
}
}
}
minLength: 8,
},
},
},
};
export default define(meta, async () => {

View File

@ -13,7 +13,7 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps) => {
@ -28,6 +28,6 @@ export default define(meta, async (ps) => {
}
await Users.update(user.id, {
isModerator: true
isModerator: true,
});
});

View File

@ -13,7 +13,7 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps) => {
@ -24,6 +24,6 @@ export default define(meta, async (ps) => {
}
await Users.update(user.id, {
isModerator: false
isModerator: false,
});
});

View File

@ -17,7 +17,7 @@ export const meta = {
},
expiresAt: {
validator: $.num.int()
validator: $.num.int(),
},
},
@ -25,15 +25,15 @@ export const meta = {
noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: 'ee449fbe-af2a-453b-9cae-cf2fe7c895fc'
id: 'ee449fbe-af2a-453b-9cae-cf2fe7c895fc',
},
alreadyPromoted: {
message: 'The note has already promoted.',
code: 'ALREADY_PROMOTED',
id: 'ae427aa2-7a41-484f-a18c-2c1104051604'
id: 'ae427aa2-7a41-484f-a18c-2c1104051604',
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@ -8,7 +8,7 @@ export const meta = {
requireCredential: true as const,
requireModerator: true,
params: {}
params: {},
};
export default define(meta, async (ps, me) => {

View File

@ -24,15 +24,15 @@ export const meta = {
},
{
type: 'number' as const,
}
]
}
},
],
},
},
example: [[
'example.com',
12
]]
}
12,
]],
},
};
export default define(meta, async (ps) => {

View File

@ -24,15 +24,15 @@ export const meta = {
},
{
type: 'number' as const,
}
]
}
},
],
},
},
example: [[
'example.com',
12
]]
}
12,
]],
},
};
export default define(meta, async (ps) => {

View File

@ -19,7 +19,7 @@ export const meta = {
limit: {
validator: $.optional.num,
default: 50
default: 50,
},
},
@ -33,27 +33,27 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
data: {
type: 'object' as const,
optional: false as const, nullable: false as const
optional: false as const, nullable: false as const,
},
attempts: {
type: 'number' as const,
optional: false as const, nullable: false as const
optional: false as const, nullable: false as const,
},
maxAttempts: {
type: 'number' as const,
optional: false as const, nullable: false as const
optional: false as const, nullable: false as const,
},
timestamp: {
type: 'number' as const,
optional: false as const, nullable: false as const
}
}
}
}
optional: false as const, nullable: false as const,
},
},
},
},
};
export default define(meta, async (ps) => {

View File

@ -14,19 +14,19 @@ export const meta = {
optional: false as const, nullable: false as const,
properties: {
deliver: {
ref: 'QueueCount'
ref: 'QueueCount',
},
inbox: {
ref: 'QueueCount'
ref: 'QueueCount',
},
db: {
ref: 'QueueCount'
ref: 'QueueCount',
},
objectStorage: {
ref: 'QueueCount'
}
}
}
ref: 'QueueCount',
},
},
},
};
export default define(meta, async (ps) => {

View File

@ -12,7 +12,7 @@ export const meta = {
params: {
inbox: {
validator: $.str
validator: $.str,
},
},
@ -20,7 +20,7 @@ export const meta = {
invalidUrl: {
message: 'Invalid URL',
code: 'INVALID_URL',
id: 'fb8c92d3-d4e5-44e7-b3d4-800d5cef8b2c'
id: 'fb8c92d3-d4e5-44e7-b3d4-800d5cef8b2c',
},
},
@ -31,12 +31,12 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
inbox: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'url'
format: 'url',
},
status: {
type: 'string' as const,
@ -45,11 +45,11 @@ export const meta = {
enum: [
'requesting',
'accepted',
'rejected'
]
}
}
}
'rejected',
],
},
},
},
};
export default define(meta, async (ps, user) => {

View File

@ -20,12 +20,12 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
inbox: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'url'
format: 'url',
},
status: {
type: 'string' as const,
@ -34,12 +34,12 @@ export const meta = {
enum: [
'requesting',
'accepted',
'rejected'
]
}
}
}
}
'rejected',
],
},
},
},
},
};
export default define(meta, async (ps, user) => {

View File

@ -10,7 +10,7 @@ export const meta = {
params: {
inbox: {
validator: $.str
validator: $.str,
},
},
};

View File

@ -25,10 +25,10 @@ export const meta = {
type: 'string' as const,
optional: false as const, nullable: false as const,
minLength: 8,
maxLength: 8
}
}
}
maxLength: 8,
},
},
},
};
export default define(meta, async (ps) => {
@ -48,12 +48,12 @@ export default define(meta, async (ps) => {
const hash = bcrypt.hashSync(passwd);
await UserProfiles.update({
userId: user.id
userId: user.id,
}, {
password: hash
password: hash,
});
return {
password: passwd
password: passwd,
};
});

View File

@ -13,7 +13,7 @@ export const meta = {
reportId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps, me) => {

View File

@ -18,7 +18,7 @@ export const meta = {
text: {
validator: $.str,
},
}
},
};
export default define(meta, async (ps) => {

View File

@ -24,7 +24,7 @@ export const meta = {
os: {
type: 'string' as const,
optional: false as const, nullable: false as const,
example: 'linux'
example: 'linux',
},
node: {
type: 'string' as const,
@ -45,8 +45,8 @@ export const meta = {
cores: {
type: 'number' as const,
optional: false as const, nullable: false as const,
}
}
},
},
},
mem: {
type: 'object' as const,
@ -56,8 +56,8 @@ export const meta = {
type: 'number' as const,
optional: false as const, nullable: false as const,
format: 'bytes',
}
}
},
},
},
fs: {
type: 'object' as const,
@ -72,8 +72,8 @@ export const meta = {
type: 'number' as const,
optional: false as const, nullable: false as const,
format: 'bytes',
}
}
},
},
},
net: {
type: 'object' as const,
@ -82,12 +82,12 @@ export const meta = {
interface: {
type: 'string' as const,
optional: false as const, nullable: false as const,
example: 'eth0'
}
}
}
}
}
example: 'eth0',
},
},
},
},
},
};
export default define(meta, async () => {
@ -103,17 +103,17 @@ export default define(meta, async () => {
redis: redisClient.server_info.redis_version,
cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length
cores: os.cpus().length,
},
mem: {
total: memStats.total
total: memStats.total,
},
fs: {
total: fsStats[0].size,
used: fsStats[0].used,
},
net: {
interface: netInterface
}
interface: netInterface,
},
};
});

View File

@ -13,7 +13,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@ -35,34 +35,34 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
createdAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time'
format: 'date-time',
},
type: {
type: 'string' as const,
optional: false as const, nullable: false as const
optional: false as const, nullable: false as const,
},
info: {
type: 'object' as const,
optional: false as const, nullable: false as const
optional: false as const, nullable: false as const,
},
userId: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
user: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'User'
}
}
}
}
ref: 'User',
},
},
},
},
};
export default define(meta, async (ps) => {

View File

@ -22,85 +22,85 @@ export const meta = {
id: {
type: 'string' as const,
nullable: false as const, optional: false as const,
format: 'id'
format: 'id',
},
createdAt: {
type: 'string' as const,
nullable: false as const, optional: false as const,
format: 'date-time'
format: 'date-time',
},
updatedAt: {
type: 'string' as const,
nullable: true as const, optional: false as const,
format: 'date-time'
format: 'date-time',
},
lastFetchedAt: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
username: {
type: 'string' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
name: {
type: 'string' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
folowersCount: {
type: 'number' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
followingCount: {
type: 'number' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
notesCount: {
type: 'number' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
avatarId: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
bannerId: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
tags: {
type: 'array' as const,
nullable: false as const, optional: false as const,
items: {
type: 'string' as const,
nullable: false as const, optional: false as const
}
nullable: false as const, optional: false as const,
},
},
avatarUrl: {
type: 'string' as const,
nullable: true as const, optional: false as const,
format: 'url'
format: 'url',
},
bannerUrl: {
type: 'string' as const,
nullable: true as const, optional: false as const,
format: 'url'
format: 'url',
},
avatarBlurhash: {
type: 'any' as const,
nullable: true as const, optional: false as const,
default: null
default: null,
},
bannerBlurhash: {
type: 'any' as const,
nullable: true as const, optional: false as const,
default: null
default: null,
},
isSuspended: {
type: 'boolean' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
isSilenced: {
type: 'boolean' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
isLocked: {
type: 'boolean' as const,
@ -108,55 +108,55 @@ export const meta = {
},
isBot: {
type: 'boolean' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
isCat: {
type: 'boolean' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
isAdmin: {
type: 'boolean' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
isModerator: {
type: 'boolean' as const,
nullable: false as const, optional: false as const
nullable: false as const, optional: false as const,
},
emojis: {
type: 'array' as const,
nullable: false as const, optional: false as const,
items: {
type: 'string' as const,
nullable: false as const, optional: false as const
}
nullable: false as const, optional: false as const,
},
},
host: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
inbox: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
sharedInbox: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
featured: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
uri: {
type: 'string' as const,
nullable: true as const, optional: false as const
nullable: true as const, optional: false as const,
},
token: {
type: 'string' as const,
nullable: false as const, optional: false as const,
default: '<MASKED>'
}
}
}
default: '<MASKED>',
},
},
},
};
export default define(meta, async (ps, me) => {

View File

@ -11,12 +11,12 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
offset: {
validator: $.optional.num.min(0),
default: 0
default: 0,
},
sort: {
@ -40,7 +40,7 @@ export const meta = {
'silenced',
'suspended',
]),
default: 'all'
default: 'all',
},
origin: {
@ -49,18 +49,18 @@ export const meta = {
'local',
'remote',
]),
default: 'local'
default: 'local',
},
username: {
validator: $.optional.str,
default: null
default: null,
},
hostname: {
validator: $.optional.str,
default: null
}
default: null,
},
},
res: {
@ -69,9 +69,9 @@ export const meta = {
items: {
type: 'object' as const,
nullable: false as const, optional: false as const,
ref: 'User'
}
}
ref: 'User',
},
},
};
export default define(meta, async (ps, me) => {

View File

@ -14,7 +14,7 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps, me) => {
@ -29,7 +29,7 @@ export default define(meta, async (ps, me) => {
}
await Users.update(user.id, {
isSilenced: true
isSilenced: true,
});
insertModerationLog(me, 'silence', {

View File

@ -18,7 +18,7 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps, me) => {
@ -37,7 +37,7 @@ export default define(meta, async (ps, me) => {
}
await Users.update(user.id, {
isSuspended: true
isSuspended: true,
});
insertModerationLog(me, 'suspend', {
@ -58,12 +58,12 @@ export default define(meta, async (ps, me) => {
async function unFollowAll(follower: User) {
const followings = await Followings.find({
followerId: follower.id
followerId: follower.id,
});
for (const following of followings) {
const followee = await Users.findOne({
id: following.followeeId
id: following.followeeId,
});
if (followee == null) {
@ -79,6 +79,6 @@ async function readAllNotify(notifier: User) {
notifierId: notifier.id,
isRead: false,
}, {
isRead: true
isRead: true,
});
}

View File

@ -14,7 +14,7 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps, me) => {
@ -25,7 +25,7 @@ export default define(meta, async (ps, me) => {
}
await Users.update(user.id, {
isSilenced: false
isSilenced: false,
});
insertModerationLog(me, 'unsilence', {

View File

@ -15,7 +15,7 @@ export const meta = {
userId: {
validator: $.type(ID),
},
}
},
};
export default define(meta, async (ps, me) => {
@ -26,7 +26,7 @@ export default define(meta, async (ps, me) => {
}
await Users.update(user.id, {
isSuspended: false
isSuspended: false,
});
insertModerationLog(me, 'unsuspend', {

View File

@ -246,57 +246,57 @@ export const meta = {
},
useObjectStorage: {
validator: $.optional.bool
validator: $.optional.bool,
},
objectStorageBaseUrl: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
objectStorageBucket: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
objectStoragePrefix: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
objectStorageEndpoint: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
objectStorageRegion: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
objectStoragePort: {
validator: $.optional.nullable.num
validator: $.optional.nullable.num,
},
objectStorageAccessKey: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
objectStorageSecretKey: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
objectStorageUseSSL: {
validator: $.optional.bool
validator: $.optional.bool,
},
objectStorageUseProxy: {
validator: $.optional.bool
validator: $.optional.bool,
},
objectStorageSetPublicRead: {
validator: $.optional.bool
validator: $.optional.bool,
},
objectStorageS3ForcePathStyle: {
validator: $.optional.bool
validator: $.optional.bool,
},
}
},
};
export default define(meta, async (ps, me) => {
@ -593,8 +593,8 @@ export default define(meta, async (ps, me) => {
await getConnection().transaction(async transactionalEntityManager => {
const meta = await transactionalEntityManager.findOne(Meta, {
order: {
id: 'DESC'
}
id: 'DESC',
},
});
if (meta) {

View File

@ -16,7 +16,7 @@ export const meta = {
analyze: {
validator: $.bool,
},
}
},
};
export default define(meta, async (ps, me) => {