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

@@ -10,9 +10,9 @@ export const meta = {
params: {
token: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, user) => {
@@ -27,7 +27,7 @@ export default define(meta, async (ps, user) => {
const verified = (speakeasy as any).totp.verify({
secret: profile.twoFactorTempSecret,
encoding: 'base32',
token: token
token: token,
});
if (!verified) {
@@ -36,6 +36,6 @@ export default define(meta, async (ps, user) => {
await UserProfiles.update(user.id, {
twoFactorSecret: profile.twoFactorTempSecret,
twoFactorEnabled: true
twoFactorEnabled: true,
});
});

View File

@@ -7,7 +7,7 @@ import {
UserProfiles,
UserSecurityKeys,
AttestationChallenges,
Users
Users,
} from '@/models/index';
import config from '@/config/index';
import { procedures, hash } from '../../../2fa';
@@ -22,21 +22,21 @@ export const meta = {
params: {
clientDataJSON: {
validator: $.str
validator: $.str,
},
attestationObject: {
validator: $.str
validator: $.str,
},
password: {
validator: $.str
validator: $.str,
},
challengeId: {
validator: $.str
validator: $.str,
},
name: {
validator: $.str
}
}
validator: $.str,
},
},
};
const rpIdHashReal = hash(Buffer.from(config.hostname, 'utf-8'));
@@ -99,7 +99,7 @@ export default define(meta, async (ps, user) => {
clientDataHash: clientDataJSONHash,
credentialId,
publicKey,
rpIdHash
rpIdHash,
});
if (!verificationData.valid) throw new Error('signature invalid');
@@ -107,7 +107,7 @@ export default define(meta, async (ps, user) => {
userId: user.id,
id: ps.challengeId,
registrationChallenge: true,
challenge: hash(clientData.challenge).toString('hex')
challenge: hash(clientData.challenge).toString('hex'),
});
if (!attestationChallenge) {
@@ -116,7 +116,7 @@ export default define(meta, async (ps, user) => {
await AttestationChallenges.delete({
userId: user.id,
id: ps.challengeId
id: ps.challengeId,
});
// Expired challenge (> 5min old)
@@ -134,17 +134,17 @@ export default define(meta, async (ps, user) => {
id: credentialIdString,
lastUsed: new Date(),
name: ps.name,
publicKey: verificationData.publicKey.toString('hex')
publicKey: verificationData.publicKey.toString('hex'),
});
// Publish meUpdated event
publishMainStream(user.id, 'meUpdated', await Users.pack(user.id, user, {
detail: true,
includeSecrets: true
includeSecrets: true,
}));
return {
id: credentialIdString,
name: ps.name
name: ps.name,
};
});

View File

@@ -9,13 +9,13 @@ export const meta = {
params: {
value: {
validator: $.boolean
}
}
validator: $.boolean,
},
},
};
export default define(meta, async (ps, user) => {
await UserProfiles.update(user.id, {
usePasswordLessLogin: ps.value
usePasswordLessLogin: ps.value,
});
});

View File

@@ -16,9 +16,9 @@ export const meta = {
params: {
password: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, user) => {
@@ -49,11 +49,11 @@ export default define(meta, async (ps, user) => {
id: challengeId,
challenge: hash(Buffer.from(challenge, 'utf-8')).toString('hex'),
createdAt: new Date(),
registrationChallenge: true
registrationChallenge: true,
});
return {
challengeId,
challenge
challenge,
};
});

View File

@@ -13,9 +13,9 @@ export const meta = {
params: {
password: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, user) => {
@@ -30,11 +30,11 @@ export default define(meta, async (ps, user) => {
// Generate user's secret key
const secret = speakeasy.generateSecret({
length: 32
length: 32,
});
await UserProfiles.update(user.id, {
twoFactorTempSecret: secret.base32
twoFactorTempSecret: secret.base32,
});
// Get the data URL of the authenticator URL
@@ -42,13 +42,13 @@ export default define(meta, async (ps, user) => {
secret: secret.base32,
encoding: 'base32',
label: user.username,
issuer: config.host
issuer: config.host,
}));
return {
qr: dataUrl,
secret: secret.base32,
label: user.username,
issuer: config.host
issuer: config.host,
};
});

View File

@@ -11,12 +11,12 @@ export const meta = {
params: {
password: {
validator: $.str
validator: $.str,
},
credentialId: {
validator: $.str
validator: $.str,
},
}
},
};
export default define(meta, async (ps, user) => {
@@ -32,13 +32,13 @@ export default define(meta, async (ps, user) => {
// Make sure we only delete the user's own creds
await UserSecurityKeys.delete({
userId: user.id,
id: ps.credentialId
id: ps.credentialId,
});
// Publish meUpdated event
publishMainStream(user.id, 'meUpdated', await Users.pack(user.id, user, {
detail: true,
includeSecrets: true
includeSecrets: true,
}));
return {};

View File

@@ -10,9 +10,9 @@ export const meta = {
params: {
password: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, user) => {
@@ -27,6 +27,6 @@ export default define(meta, async (ps, user) => {
await UserProfiles.update(user.id, {
twoFactorSecret: null,
twoFactorEnabled: false
twoFactorEnabled: false,
});
});

View File

@@ -16,7 +16,7 @@ export const meta = {
'-lastUsedAt',
]),
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -21,24 +21,24 @@ export const meta = {
sort: {
validator: $.optional.str.or('desc|asc'),
default: 'desc',
}
}
},
},
};
export default define(meta, async (ps, user) => {
// Get tokens
const tokens = await AccessTokens.find({
where: {
userId: user.id
userId: user.id,
},
take: ps.limit!,
skip: ps.offset,
order: {
id: ps.sort == 'asc' ? 1 : -1
}
id: ps.sort == 'asc' ? 1 : -1,
},
});
return await Promise.all(tokens.map(token => Apps.pack(token.appId, user, {
detail: true
detail: true,
})));
});

View File

@@ -10,13 +10,13 @@ export const meta = {
params: {
currentPassword: {
validator: $.str
validator: $.str,
},
newPassword: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, user) => {
@@ -34,6 +34,6 @@ export default define(meta, async (ps, user) => {
const hash = await bcrypt.hash(ps.newPassword, salt);
await UserProfiles.update(user.id, {
password: hash
password: hash,
});
});

View File

@@ -13,9 +13,9 @@ export const meta = {
params: {
password: {
validator: $.str
validator: $.str,
},
}
},
};
export default define(meta, async (ps, user) => {
@@ -36,7 +36,7 @@ export default define(meta, async (ps, user) => {
await doPostSuspend(user).catch(e => {});
createDeleteAccountJob(user, {
soft: false
soft: false,
});
await Users.update(user.id, {

View File

@@ -14,7 +14,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -33,7 +33,7 @@ export const meta = {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'NoteFavorite',
}
},
},
};

View File

@@ -14,7 +14,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -33,15 +33,15 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
page: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'GalleryPost'
}
}
}
ref: 'GalleryPost',
},
},
},
};
export default define(meta, async (ps, user) => {

View File

@@ -14,7 +14,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -32,9 +32,9 @@ export const meta = {
items: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'GalleryPost'
}
}
ref: 'GalleryPost',
},
},
};
export default define(meta, async (ps, user) => {

View File

@@ -17,17 +17,17 @@ export const meta = {
properties: {
count: {
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, user) => {
return {
count: await MutedNotes.count({
userId: user.id,
reason: 'word'
})
reason: 'word',
}),
};
});

View File

@@ -18,34 +18,34 @@ export const meta = {
params: {
fileId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchFile: {
message: 'No such file.',
code: 'NO_SUCH_FILE',
id: 'ebb53e5f-6574-9c0c-0b92-7ca6def56d7e'
id: 'ebb53e5f-6574-9c0c-0b92-7ca6def56d7e',
},
unexpectedFileType: {
message: 'We need csv file.',
code: 'UNEXPECTED_FILE_TYPE',
id: 'b6fab7d6-d945-d67c-dfdb-32da1cd12cfe'
id: 'b6fab7d6-d945-d67c-dfdb-32da1cd12cfe',
},
tooBigFile: {
message: 'That file is too big.',
code: 'TOO_BIG_FILE',
id: 'b7fbf0b1-aeef-3b21-29ef-fadd4cb72ccf'
id: 'b7fbf0b1-aeef-3b21-29ef-fadd4cb72ccf',
},
emptyFile: {
message: 'That file is empty.',
code: 'EMPTY_FILE',
id: '6f3a4dcc-f060-a707-4950-806fbdbe60d6'
id: '6f3a4dcc-f060-a707-4950-806fbdbe60d6',
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -17,34 +17,34 @@ export const meta = {
params: {
fileId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchFile: {
message: 'No such file.',
code: 'NO_SUCH_FILE',
id: 'b98644cf-a5ac-4277-a502-0b8054a709a3'
id: 'b98644cf-a5ac-4277-a502-0b8054a709a3',
},
unexpectedFileType: {
message: 'We need csv file.',
code: 'UNEXPECTED_FILE_TYPE',
id: '660f3599-bce0-4f95-9dde-311fd841c183'
id: '660f3599-bce0-4f95-9dde-311fd841c183',
},
tooBigFile: {
message: 'That file is too big.',
code: 'TOO_BIG_FILE',
id: 'dee9d4ed-ad07-43ed-8b34-b2856398bc60'
id: 'dee9d4ed-ad07-43ed-8b34-b2856398bc60',
},
emptyFile: {
message: 'That file is empty.',
code: 'EMPTY_FILE',
id: '31a1b42c-06f7-42ae-8a38-a661c5c9f691'
id: '31a1b42c-06f7-42ae-8a38-a661c5c9f691',
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -18,34 +18,34 @@ export const meta = {
params: {
fileId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchFile: {
message: 'No such file.',
code: 'NO_SUCH_FILE',
id: 'e674141e-bd2a-ba85-e616-aefb187c9c2a'
id: 'e674141e-bd2a-ba85-e616-aefb187c9c2a',
},
unexpectedFileType: {
message: 'We need csv file.',
code: 'UNEXPECTED_FILE_TYPE',
id: '568c6e42-c86c-ba09-c004-517f83f9f1a8'
id: '568c6e42-c86c-ba09-c004-517f83f9f1a8',
},
tooBigFile: {
message: 'That file is too big.',
code: 'TOO_BIG_FILE',
id: '9b4ada6d-d7f7-0472-0713-4f558bd1ec9c'
id: '9b4ada6d-d7f7-0472-0713-4f558bd1ec9c',
},
emptyFile: {
message: 'That file is empty.',
code: 'EMPTY_FILE',
id: 'd2f12af1-e7b4-feac-86a3-519548f2728e'
id: 'd2f12af1-e7b4-feac-86a3-519548f2728e',
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -17,34 +17,34 @@ export const meta = {
params: {
fileId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchFile: {
message: 'No such file.',
code: 'NO_SUCH_FILE',
id: 'ea9cc34f-c415-4bc6-a6fe-28ac40357049'
id: 'ea9cc34f-c415-4bc6-a6fe-28ac40357049',
},
unexpectedFileType: {
message: 'We need csv file.',
code: 'UNEXPECTED_FILE_TYPE',
id: 'a3c9edda-dd9b-4596-be6a-150ef813745c'
id: 'a3c9edda-dd9b-4596-be6a-150ef813745c',
},
tooBigFile: {
message: 'That file is too big.',
code: 'TOO_BIG_FILE',
id: 'ae6e7a22-971b-4b52-b2be-fc0b9b121fe9'
id: 'ae6e7a22-971b-4b52-b2be-fc0b9b121fe9',
},
emptyFile: {
message: 'That file is empty.',
code: 'EMPTY_FILE',
id: '99efe367-ce6e-4d44-93f8-5fae7b040356'
id: '99efe367-ce6e-4d44-93f8-5fae7b040356',
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -19,7 +19,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -32,17 +32,17 @@ export const meta = {
following: {
validator: $.optional.bool,
default: false
default: false,
},
unreadOnly: {
validator: $.optional.bool,
default: false
default: false,
},
markAsRead: {
validator: $.optional.bool,
default: true
default: true,
},
includeTypes: {
@@ -51,7 +51,7 @@ export const meta = {
excludeTypes: {
validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])),
}
},
},
res: {
@@ -61,7 +61,7 @@ export const meta = {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'Notification',
}
},
},
};

View File

@@ -14,7 +14,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -33,15 +33,15 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
page: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'Page'
}
}
}
ref: 'Page',
},
},
},
};
export default define(meta, async (ps, user) => {

View File

@@ -14,7 +14,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -32,9 +32,9 @@ export const meta = {
items: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'Page'
}
}
ref: 'Page',
},
},
};
export default define(meta, async (ps, user) => {

View File

@@ -15,34 +15,34 @@ export const meta = {
params: {
noteId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: '56734f8b-3928-431e-bf80-6ff87df40cb3'
id: '56734f8b-3928-431e-bf80-6ff87df40cb3',
},
pinLimitExceeded: {
message: 'You can not pin notes any more.',
code: 'PIN_LIMIT_EXCEEDED',
id: '72dab508-c64d-498f-8740-a8eec1ba385a'
id: '72dab508-c64d-498f-8740-a8eec1ba385a',
},
alreadyPinned: {
message: 'That note has already been pinned.',
code: 'ALREADY_PINNED',
id: '8b18c2b7-68fe-4edb-9892-c0cbaeb6c913'
id: '8b18c2b7-68fe-4edb-9892-c0cbaeb6c913',
},
},
res: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'User'
}
ref: 'User',
},
};
export default define(meta, async (ps, user) => {
@@ -54,6 +54,6 @@ export default define(meta, async (ps, user) => {
});
return await Users.pack(user.id, user, {
detail: true
detail: true,
});
});

View File

@@ -10,23 +10,23 @@ export const meta = {
kind: 'write:account',
params: {
}
},
};
export default define(meta, async (ps, user) => {
// Update documents
await MessagingMessages.update({
recipientId: user.id,
isRead: false
isRead: false,
}, {
isRead: true
isRead: true,
});
const joinings = await UserGroupJoinings.find({ userId: user.id });
await Promise.all(joinings.map(j => MessagingMessages.createQueryBuilder().update()
.set({
reads: (() => `array_append("reads", '${user.id}')`) as any
reads: (() => `array_append("reads", '${user.id}')`) as any,
})
.where(`groupId = :groupId`, { groupId: j.userGroupId })
.andWhere('userId != :userId', { userId: user.id })

View File

@@ -10,13 +10,13 @@ export const meta = {
kind: 'write:account',
params: {
}
},
};
export default define(meta, async (ps, user) => {
// Remove documents
await NoteUnreads.delete({
userId: user.id
userId: user.id,
});
// 全て既読になったイベントを発行

View File

@@ -23,9 +23,9 @@ export const meta = {
noSuchAnnouncement: {
message: 'No such announcement.',
code: 'NO_SUCH_ANNOUNCEMENT',
id: '184663db-df88-4bc2-8b52-fb85f0681939'
id: '184663db-df88-4bc2-8b52-fb85f0681939',
},
}
},
};
export default define(meta, async (ps, user) => {
@@ -39,7 +39,7 @@ export default define(meta, async (ps, user) => {
// Check if already read
const read = await AnnouncementReads.findOne({
announcementId: ps.announcementId,
userId: user.id
userId: user.id,
});
if (read != null) {

View File

@@ -12,9 +12,9 @@ export const meta = {
params: {
password: {
validator: $.str
}
}
validator: $.str,
},
},
};
export default define(meta, async (ps, user) => {
@@ -31,7 +31,7 @@ export default define(meta, async (ps, user) => {
const secret = generateUserToken();
await Users.update(user.id, {
token: secret
token: secret,
});
// Publish event

View File

@@ -12,7 +12,7 @@ export const meta = {
validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)),
default: [],
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -10,7 +10,7 @@ export const meta = {
params: {
key: {
validator: $.str
validator: $.str,
},
scope: {
@@ -23,7 +23,7 @@ export const meta = {
noSuchKey: {
message: 'No such key.',
code: 'NO_SUCH_KEY',
id: '97a1e8e7-c0f7-47d2-957a-92e61256e01a'
id: '97a1e8e7-c0f7-47d2-957a-92e61256e01a',
},
},
};

View File

@@ -10,7 +10,7 @@ export const meta = {
params: {
key: {
validator: $.str
validator: $.str,
},
scope: {
@@ -23,7 +23,7 @@ export const meta = {
noSuchKey: {
message: 'No such key.',
code: 'NO_SUCH_KEY',
id: 'ac3ed68a-62f0-422b-a7bc-d5e09e8f6a6a'
id: 'ac3ed68a-62f0-422b-a7bc-d5e09e8f6a6a',
},
},
};

View File

@@ -12,7 +12,7 @@ export const meta = {
validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)),
default: [],
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -12,7 +12,7 @@ export const meta = {
validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)),
default: [],
},
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -10,7 +10,7 @@ export const meta = {
params: {
key: {
validator: $.str
validator: $.str,
},
scope: {
@@ -23,7 +23,7 @@ export const meta = {
noSuchKey: {
message: 'No such key.',
code: 'NO_SUCH_KEY',
id: '1fac4e8a-a6cd-4e39-a4a5-3a7e11f1b019'
id: '1fac4e8a-a6cd-4e39-a4a5-3a7e11f1b019',
},
},
};

View File

@@ -7,7 +7,7 @@ export const meta = {
secure: true,
params: {
}
},
};
export default define(meta, async (ps, user) => {

View File

@@ -11,18 +11,18 @@ export const meta = {
params: {
key: {
validator: $.str.min(1)
validator: $.str.min(1),
},
value: {
validator: $.nullable.any
validator: $.nullable.any,
},
scope: {
validator: $.optional.arr($.str.match(/^[a-zA-Z0-9_]+$/)),
default: [],
},
}
},
};
export default define(meta, async (ps, user) => {
@@ -37,7 +37,7 @@ export default define(meta, async (ps, user) => {
if (existingItem) {
await RegistryItems.update(existingItem.id, {
updatedAt: new Date(),
value: ps.value
value: ps.value,
});
} else {
await RegistryItems.insert({
@@ -48,7 +48,7 @@ export default define(meta, async (ps, user) => {
domain: null,
scope: ps.scope,
key: ps.key,
value: ps.value
value: ps.value,
});
}
@@ -56,6 +56,6 @@ export default define(meta, async (ps, user) => {
publishMainStream(user.id, 'registryUpdated', {
scope: ps.scope,
key: ps.key,
value: ps.value
value: ps.value,
});
});

View File

@@ -11,9 +11,9 @@ export const meta = {
params: {
tokenId: {
validator: $.type(ID)
}
}
validator: $.type(ID),
},
},
};
export default define(meta, async (ps, user) => {

View File

@@ -12,7 +12,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -21,8 +21,8 @@ export const meta = {
untilId: {
validator: $.optional.type(ID),
}
}
},
},
};
export default define(meta, async (ps, user) => {

View File

@@ -15,22 +15,22 @@ export const meta = {
params: {
noteId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: '454170ce-9d63-4a43-9da1-ea10afe81e21'
id: '454170ce-9d63-4a43-9da1-ea10afe81e21',
},
},
res: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'User'
}
ref: 'User',
},
};
export default define(meta, async (ps, user) => {
@@ -40,6 +40,6 @@ export default define(meta, async (ps, user) => {
});
return await Users.pack(user.id, user, {
detail: true
detail: true,
});
});

View File

@@ -17,16 +17,16 @@ export const meta = {
limit: {
duration: ms('1hour'),
max: 3
max: 3,
},
params: {
password: {
validator: $.str
validator: $.str,
},
email: {
validator: $.optional.nullable.str
validator: $.optional.nullable.str,
},
},
@@ -34,15 +34,15 @@ export const meta = {
incorrectPassword: {
message: 'Incorrect password.',
code: 'INCORRECT_PASSWORD',
id: 'e54c1d7e-e7d6-4103-86b6-0a95069b4ad3'
id: 'e54c1d7e-e7d6-4103-86b6-0a95069b4ad3',
},
unavailable: {
message: 'Unavailable email address.',
code: 'UNAVAILABLE',
id: 'a2defefb-f220-8849-0af6-17f816099323'
id: 'a2defefb-f220-8849-0af6-17f816099323',
},
}
},
};
export default define(meta, async (ps, user) => {
@@ -65,12 +65,12 @@ export default define(meta, async (ps, user) => {
await UserProfiles.update(user.id, {
email: ps.email,
emailVerified: false,
emailVerifyCode: null
emailVerifyCode: null,
});
const iObj = await Users.pack(user.id, user, {
detail: true,
includeSecrets: true
includeSecrets: true,
});
// Publish meUpdated event
@@ -80,7 +80,7 @@ export default define(meta, async (ps, user) => {
const code = rndstr('a-z0-9', 16);
await UserProfiles.update(user.id, {
emailVerifyCode: code
emailVerifyCode: code,
});
const link = `${config.url}/verify-email/${code}`;

View File

@@ -113,19 +113,19 @@ export const meta = {
},
mutedWords: {
validator: $.optional.arr($.arr($.str))
validator: $.optional.arr($.arr($.str)),
},
mutedInstances: {
validator: $.optional.arr($.str)
validator: $.optional.arr($.str),
},
mutingNotificationTypes: {
validator: $.optional.arr($.str.or(notificationTypes as unknown as string[]))
validator: $.optional.arr($.str.or(notificationTypes as unknown as string[])),
},
emailNotificationTypes: {
validator: $.optional.arr($.str)
validator: $.optional.arr($.str),
},
},
@@ -133,39 +133,39 @@ export const meta = {
noSuchAvatar: {
message: 'No such avatar file.',
code: 'NO_SUCH_AVATAR',
id: '539f3a45-f215-4f81-a9a8-31293640207f'
id: '539f3a45-f215-4f81-a9a8-31293640207f',
},
noSuchBanner: {
message: 'No such banner file.',
code: 'NO_SUCH_BANNER',
id: '0d8f5629-f210-41c2-9433-735831a58595'
id: '0d8f5629-f210-41c2-9433-735831a58595',
},
avatarNotAnImage: {
message: 'The file specified as an avatar is not an image.',
code: 'AVATAR_NOT_AN_IMAGE',
id: 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191'
id: 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191',
},
bannerNotAnImage: {
message: 'The file specified as a banner is not an image.',
code: 'BANNER_NOT_AN_IMAGE',
id: '75aedb19-2afd-4e6d-87fc-67941256fa60'
id: '75aedb19-2afd-4e6d-87fc-67941256fa60',
},
noSuchPage: {
message: 'No such page.',
code: 'NO_SUCH_PAGE',
id: '8e01b590-7eb9-431b-a239-860e086c408e'
id: '8e01b590-7eb9-431b-a239-860e086c408e',
},
},
res: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'User'
}
ref: 'User',
},
};
export default define(meta, async (ps, _user, token) => {
@@ -280,7 +280,7 @@ export default define(meta, async (ps, _user, token) => {
const iObj = await Users.pack(user.id, user, {
detail: true,
includeSecrets: isSecure
includeSecrets: isSecure,
});
// Publish meUpdated event

View File

@@ -14,7 +14,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
default: 10
default: 10,
},
sinceId: {
@@ -36,16 +36,16 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
format: 'id',
},
group: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'UserGroup'
}
}
}
}
ref: 'UserGroup',
},
},
},
},
};
export default define(meta, async (ps, user) => {