diff --git a/src/server/api/endpoints/app/create.ts b/src/server/api/endpoints/app/create.ts index 3b3eafa699..82a2fcb55e 100644 --- a/src/server/api/endpoints/app/create.ts +++ b/src/server/api/endpoints/app/create.ts @@ -3,6 +3,10 @@ import $ from 'cafy'; import App, { isValidNameId, pack } from '../../../../models/app'; import { ILocalUser } from '../../../../models/user'; +export const meta = { + requireCredential: true +}; + /** * @swagger * /app/create: diff --git a/src/server/api/endpoints/auth/accept.ts b/src/server/api/endpoints/auth/accept.ts index d14c853415..2638ebc148 100644 --- a/src/server/api/endpoints/auth/accept.ts +++ b/src/server/api/endpoints/auth/accept.ts @@ -6,6 +6,11 @@ import AuthSess from '../../../../models/auth-session'; import AccessToken from '../../../../models/access-token'; import { ILocalUser } from '../../../../models/user'; +export const meta = { + requireCredential: true, + secure: true +}; + /** * @swagger * /auth/accept: diff --git a/src/server/api/endpoints/drive.ts b/src/server/api/endpoints/drive.ts index 66ac30c4cf..a98a3a5b87 100644 --- a/src/server/api/endpoints/drive.ts +++ b/src/server/api/endpoints/drive.ts @@ -1,9 +1,17 @@ import DriveFile from '../../../models/drive-file'; import { ILocalUser } from '../../../models/user'; -/** - * Get drive information - */ +export const meta = { + desc: { + ja: 'ドライブの情報を取得します。', + en: 'Get drive information.' + }, + + requireCredential: true, + + kind: 'drive-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Calculate drive usage const usage = await DriveFile diff --git a/src/server/api/endpoints/drive/files.ts b/src/server/api/endpoints/drive/files.ts index 000e4dcdd2..063b4adde1 100644 --- a/src/server/api/endpoints/drive/files.ts +++ b/src/server/api/endpoints/drive/files.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import DriveFile, { pack } from '../../../../models/drive-file'; import { ILocalUser } from '../../../../models/user'; -/** - * Get drive files - */ +export const meta = { + desc: { + ja: 'ドライブのファイル一覧を取得します。', + en: 'Get files of drive.' + }, + + requireCredential: true, + + kind: 'drive-read' +}; + export default async (params: any, user: ILocalUser) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/drive/files/create.ts b/src/server/api/endpoints/drive/files/create.ts index c5eb29e1af..ca12be9104 100644 --- a/src/server/api/endpoints/drive/files/create.ts +++ b/src/server/api/endpoints/drive/files/create.ts @@ -8,7 +8,8 @@ import getParams from '../../../get-params'; export const meta = { desc: { - ja: 'ドライブにファイルをアップロードします。' + ja: 'ドライブにファイルをアップロードします。', + en: 'Upload a file to drive.' }, requireCredential: true, diff --git a/src/server/api/endpoints/drive/files/delete.ts b/src/server/api/endpoints/drive/files/delete.ts index 8a63be0e2f..02cd96dd8f 100644 --- a/src/server/api/endpoints/drive/files/delete.ts +++ b/src/server/api/endpoints/drive/files/delete.ts @@ -4,9 +4,17 @@ import del from '../../../../../services/drive/delete-file'; import { publishDriveStream } from '../../../../../stream'; import { ILocalUser } from '../../../../../models/user'; -/** - * Delete a file - */ +export const meta = { + desc: { + ja: 'ドライブのファイルを削除します。', + en: 'Delete a file of drive.' + }, + + requireCredential: true, + + kind: 'drive-write' +}; + export default async (params: any, user: ILocalUser) => { // Get 'fileId' parameter const [fileId, fileIdErr] = $.type(ID).get(params.fileId); diff --git a/src/server/api/endpoints/drive/files/find.ts b/src/server/api/endpoints/drive/files/find.ts index 8b166e2dbc..aa44ee688e 100644 --- a/src/server/api/endpoints/drive/files/find.ts +++ b/src/server/api/endpoints/drive/files/find.ts @@ -2,9 +2,12 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import DriveFile, { pack } from '../../../../../models/drive-file'; import { ILocalUser } from '../../../../../models/user'; -/** - * Find a file(s) - */ +export const meta = { + requireCredential: true, + + kind: 'drive-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'name' parameter const [name, nameErr] = $.str.get(params.name); diff --git a/src/server/api/endpoints/drive/files/show.ts b/src/server/api/endpoints/drive/files/show.ts index 02faa6d5a7..6a66c7a272 100644 --- a/src/server/api/endpoints/drive/files/show.ts +++ b/src/server/api/endpoints/drive/files/show.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import DriveFile, { pack } from '../../../../../models/drive-file'; import { ILocalUser } from '../../../../../models/user'; -/** - * Show a file - */ +export const meta = { + desc: { + ja: '指定したドライブのファイルの情報を取得します。', + en: 'Get specified file of drive.' + }, + + requireCredential: true, + + kind: 'drive-read' +}; + export default async (params: any, user: ILocalUser) => { // Get 'fileId' parameter const [fileId, fileIdErr] = $.type(ID).get(params.fileId); diff --git a/src/server/api/endpoints/drive/files/update.ts b/src/server/api/endpoints/drive/files/update.ts index 95dd6c2acc..396bc97694 100644 --- a/src/server/api/endpoints/drive/files/update.ts +++ b/src/server/api/endpoints/drive/files/update.ts @@ -4,9 +4,17 @@ import DriveFile, { validateFileName, pack } from '../../../../../models/drive-f import { publishDriveStream } from '../../../../../stream'; import { ILocalUser } from '../../../../../models/user'; -/** - * Update a file - */ +export const meta = { + desc: { + ja: '指定したドライブのファイルの情報を更新します。', + en: 'Update specified file of drive.' + }, + + requireCredential: true, + + kind: 'drive-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'fileId' parameter const [fileId, fileIdErr] = $.type(ID).get(params.fileId); diff --git a/src/server/api/endpoints/drive/files/upload_from_url.ts b/src/server/api/endpoints/drive/files/upload_from_url.ts index 4af365c394..d634cf46db 100644 --- a/src/server/api/endpoints/drive/files/upload_from_url.ts +++ b/src/server/api/endpoints/drive/files/upload_from_url.ts @@ -1,11 +1,24 @@ -/** - * Module dependencies - */ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; +const ms = require('ms'); import { pack } from '../../../../../models/drive-file'; import uploadFromUrl from '../../../../../services/drive/upload-from-url'; import { ILocalUser } from '../../../../../models/user'; +export const meta = { + desc: { + ja: 'ドライブに指定されたURLに存在するファイルをアップロードします。' + }, + + limit: { + duration: ms('1hour'), + max: 10 + }, + + requireCredential: true, + + kind: 'drive-write' +}; + /** * Create a file from a URL */ diff --git a/src/server/api/endpoints/drive/folders.ts b/src/server/api/endpoints/drive/folders.ts index f1817ec42f..de398eb720 100644 --- a/src/server/api/endpoints/drive/folders.ts +++ b/src/server/api/endpoints/drive/folders.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import DriveFolder, { pack } from '../../../../models/drive-folder'; import { ILocalUser } from '../../../../models/user'; -/** - * Get drive folders - */ +export const meta = { + desc: { + ja: 'ドライブのフォルダ一覧を取得します。', + en: 'Get folders of drive.' + }, + + requireCredential: true, + + kind: 'drive-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/drive/folders/create.ts b/src/server/api/endpoints/drive/folders/create.ts index 6205691e15..03f9504774 100644 --- a/src/server/api/endpoints/drive/folders/create.ts +++ b/src/server/api/endpoints/drive/folders/create.ts @@ -3,9 +3,17 @@ import DriveFolder, { isValidFolderName, pack } from '../../../../../models/driv import { publishDriveStream } from '../../../../../stream'; import { ILocalUser } from '../../../../../models/user'; -/** - * Create drive folder - */ +export const meta = { + desc: { + ja: 'ドライブのフォルダを作成します。', + en: 'Create a folder of drive.' + }, + + requireCredential: true, + + kind: 'drive-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'name' parameter const [name = '無題のフォルダー', nameErr] = $.str.optional.pipe(isValidFolderName).get(params.name); diff --git a/src/server/api/endpoints/drive/folders/find.ts b/src/server/api/endpoints/drive/folders/find.ts index 64065d9379..ec3c1d2e36 100644 --- a/src/server/api/endpoints/drive/folders/find.ts +++ b/src/server/api/endpoints/drive/folders/find.ts @@ -2,9 +2,12 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import DriveFolder, { pack } from '../../../../../models/drive-folder'; import { ILocalUser } from '../../../../../models/user'; -/** - * Find a folder(s) - */ +export const meta = { + requireCredential: true, + + kind: 'drive-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'name' parameter const [name, nameErr] = $.str.get(params.name); diff --git a/src/server/api/endpoints/drive/folders/show.ts b/src/server/api/endpoints/drive/folders/show.ts index 5f56606215..6a6c879a01 100644 --- a/src/server/api/endpoints/drive/folders/show.ts +++ b/src/server/api/endpoints/drive/folders/show.ts @@ -2,9 +2,16 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import DriveFolder, { pack } from '../../../../../models/drive-folder'; import { ILocalUser } from '../../../../../models/user'; -/** - * Show a folder - */ +export const meta = { + desc: { + ja: '指定したドライブのフォルダの情報を取得します。' + }, + + requireCredential: true, + + kind: 'drive-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'folderId' parameter const [folderId, folderIdErr] = $.type(ID).get(params.folderId); diff --git a/src/server/api/endpoints/drive/folders/update.ts b/src/server/api/endpoints/drive/folders/update.ts index b833655974..1b449428a6 100644 --- a/src/server/api/endpoints/drive/folders/update.ts +++ b/src/server/api/endpoints/drive/folders/update.ts @@ -3,9 +3,17 @@ import DriveFolder, { isValidFolderName, pack } from '../../../../../models/driv import { publishDriveStream } from '../../../../../stream'; import { ILocalUser } from '../../../../../models/user'; -/** - * Update a folder - */ +export const meta = { + desc: { + ja: '指定したドライブのフォルダの情報を更新します。', + en: 'Update specified folder of drive.' + }, + + requireCredential: true, + + kind: 'drive-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'folderId' parameter const [folderId, folderIdErr] = $.type(ID).get(params.folderId); diff --git a/src/server/api/endpoints/drive/stream.ts b/src/server/api/endpoints/drive/stream.ts index 39c878a1f8..53f94a2639 100644 --- a/src/server/api/endpoints/drive/stream.ts +++ b/src/server/api/endpoints/drive/stream.ts @@ -2,9 +2,12 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import DriveFile, { pack } from '../../../../models/drive-file'; import { ILocalUser } from '../../../../models/user'; -/** - * Get drive stream - */ +export const meta = { + requireCredential: true, + + kind: 'drive-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/following/create.ts b/src/server/api/endpoints/following/create.ts index a902af023f..ebe319e0cf 100644 --- a/src/server/api/endpoints/following/create.ts +++ b/src/server/api/endpoints/following/create.ts @@ -1,11 +1,25 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; +const ms = require('ms'); import User, { pack, ILocalUser } from '../../../../models/user'; import Following from '../../../../models/following'; import create from '../../../../services/following/create'; -/** - * Follow a user - */ +export const meta = { + desc: { + ja: '指定したユーザーをフォローします。', + en: 'Follow a user.' + }, + + limit: { + duration: ms('1hour'), + max: 100 + }, + + requireCredential: true, + + kind: 'following-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const follower = user; diff --git a/src/server/api/endpoints/following/delete.ts b/src/server/api/endpoints/following/delete.ts index f1d29e80b2..4806fe4e39 100644 --- a/src/server/api/endpoints/following/delete.ts +++ b/src/server/api/endpoints/following/delete.ts @@ -1,11 +1,25 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; +const ms = require('ms'); import User, { pack, ILocalUser } from '../../../../models/user'; import Following from '../../../../models/following'; import deleteFollowing from '../../../../services/following/delete'; -/** - * Unfollow a user - */ +export const meta = { + desc: { + ja: '指定したユーザーのフォローを解除します。', + en: 'Unfollow a user.' + }, + + limit: { + duration: ms('1hour'), + max: 100 + }, + + requireCredential: true, + + kind: 'following-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const follower = user; diff --git a/src/server/api/endpoints/following/requests/accept.ts b/src/server/api/endpoints/following/requests/accept.ts index 49c29160b1..b3bf2dd667 100644 --- a/src/server/api/endpoints/following/requests/accept.ts +++ b/src/server/api/endpoints/following/requests/accept.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import acceptFollowRequest from '../../../../../services/following/requests/accept'; import User, { ILocalUser } from '../../../../../models/user'; -/** - * Accept a follow request - */ +export const meta = { + desc: { + ja: '自分に届いた、指定したフォローリクエストを承認します。', + en: 'Accept a follow request.' + }, + + requireCredential: true, + + kind: 'following-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'userId' parameter const [followerId, followerIdErr] = $.type(ID).get(params.userId); diff --git a/src/server/api/endpoints/following/requests/cancel.ts b/src/server/api/endpoints/following/requests/cancel.ts index 6c3539d757..9bfc40ce65 100644 --- a/src/server/api/endpoints/following/requests/cancel.ts +++ b/src/server/api/endpoints/following/requests/cancel.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import cancelFollowRequest from '../../../../../services/following/requests/cancel'; import User, { pack, ILocalUser } from '../../../../../models/user'; -/** - * Cancel a follow request - */ +export const meta = { + desc: { + ja: '自分が作成した、指定したフォローリクエストをキャンセルします。', + en: 'Cancel a follow request.' + }, + + requireCredential: true, + + kind: 'following-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'userId' parameter const [followeeId, followeeIdErr] = $.type(ID).get(params.userId); diff --git a/src/server/api/endpoints/following/requests/list.ts b/src/server/api/endpoints/following/requests/list.ts index dfe9858f3a..b06a158c08 100644 --- a/src/server/api/endpoints/following/requests/list.ts +++ b/src/server/api/endpoints/following/requests/list.ts @@ -2,9 +2,17 @@ import FollowRequest, { pack } from '../../../../../models/follow-request'; import { ILocalUser } from '../../../../../models/user'; -/** - * Get all pending received follow requests - */ +export const meta = { + desc: { + ja: '自分に届いたフォローリクエストの一覧を取得します。', + en: 'Get all pending received follow requests.' + }, + + requireCredential: true, + + kind: 'following-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const reqs = await FollowRequest.find({ followeeId: user._id diff --git a/src/server/api/endpoints/following/requests/reject.ts b/src/server/api/endpoints/following/requests/reject.ts index f92ea52d46..a232549bb8 100644 --- a/src/server/api/endpoints/following/requests/reject.ts +++ b/src/server/api/endpoints/following/requests/reject.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import rejectFollowRequest from '../../../../../services/following/requests/reject'; import User, { ILocalUser } from '../../../../../models/user'; -/** - * Reject a follow request - */ +export const meta = { + desc: { + ja: '自分に届いた、指定したフォローリクエストを拒否します。', + en: 'Reject a follow request.' + }, + + requireCredential: true, + + kind: 'following-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'userId' parameter const [followerId, followerIdErr] = $.type(ID).get(params.userId); diff --git a/src/server/api/endpoints/following/stalk.ts b/src/server/api/endpoints/following/stalk.ts index eb4afb3116..79a3fb976c 100644 --- a/src/server/api/endpoints/following/stalk.ts +++ b/src/server/api/endpoints/following/stalk.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import Following from '../../../../models/following'; import { ILocalUser } from '../../../../models/user'; -/** - * Stalk a user - */ +export const meta = { + desc: { + ja: '指定したユーザーをストーキングします。', + en: 'Stalk a user.' + }, + + requireCredential: true, + + kind: 'following-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const follower = user; diff --git a/src/server/api/endpoints/following/unstalk.ts b/src/server/api/endpoints/following/unstalk.ts index b44ef68b96..71a7a97eeb 100644 --- a/src/server/api/endpoints/following/unstalk.ts +++ b/src/server/api/endpoints/following/unstalk.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import Following from '../../../../models/following'; import { ILocalUser } from '../../../../models/user'; -/** - * Unstalk a user - */ +export const meta = { + desc: { + ja: '指定したユーザーのストーキングをやめます。', + en: 'Unstalk a user.' + }, + + requireCredential: true, + + kind: 'following-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const follower = user; diff --git a/src/server/api/endpoints/games/reversi/games.ts b/src/server/api/endpoints/games/reversi/games.ts index 50a8faa88c..b72af06d22 100644 --- a/src/server/api/endpoints/games/reversi/games.ts +++ b/src/server/api/endpoints/games/reversi/games.ts @@ -2,6 +2,10 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import ReversiGame, { pack } from '../../../../../models/games/reversi/game'; import { ILocalUser } from '../../../../../models/user'; +export const meta = { + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'my' parameter const [my = false, myErr] = $.bool.optional.get(params.my); diff --git a/src/server/api/endpoints/games/reversi/invitations.ts b/src/server/api/endpoints/games/reversi/invitations.ts index c6d0ecfa73..3962282759 100644 --- a/src/server/api/endpoints/games/reversi/invitations.ts +++ b/src/server/api/endpoints/games/reversi/invitations.ts @@ -1,6 +1,10 @@ import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching'; import { ILocalUser } from '../../../../../models/user'; +export const meta = { + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Find session const invitations = await Matching.find({ diff --git a/src/server/api/endpoints/games/reversi/match.ts b/src/server/api/endpoints/games/reversi/match.ts index 4364531516..24746170ff 100644 --- a/src/server/api/endpoints/games/reversi/match.ts +++ b/src/server/api/endpoints/games/reversi/match.ts @@ -5,6 +5,10 @@ import User, { ILocalUser } from '../../../../../models/user'; import publishUserStream, { publishReversiStream } from '../../../../../stream'; import { eighteight } from '../../../../../games/reversi/maps'; +export const meta = { + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'userId' parameter const [childId, childIdErr] = $.type(ID).get(params.userId); diff --git a/src/server/api/endpoints/games/reversi/match/cancel.ts b/src/server/api/endpoints/games/reversi/match/cancel.ts index 84cd1ff119..d5c186409c 100644 --- a/src/server/api/endpoints/games/reversi/match/cancel.ts +++ b/src/server/api/endpoints/games/reversi/match/cancel.ts @@ -1,6 +1,10 @@ import Matching from '../../../../../../models/games/reversi/matching'; import { ILocalUser } from '../../../../../../models/user'; +export const meta = { + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { await Matching.remove({ parentId: user._id diff --git a/src/server/api/endpoints/i/2fa/done.ts b/src/server/api/endpoints/i/2fa/done.ts index fef045948a..6d38ca1de1 100644 --- a/src/server/api/endpoints/i/2fa/done.ts +++ b/src/server/api/endpoints/i/2fa/done.ts @@ -2,6 +2,11 @@ import $ from 'cafy'; import * as speakeasy from 'speakeasy'; import User, { ILocalUser } from '../../../../../models/user'; +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'token' parameter const [token, tokenErr] = $.str.get(params.token); diff --git a/src/server/api/endpoints/i/2fa/register.ts b/src/server/api/endpoints/i/2fa/register.ts index ac703f5b0a..0466a4f366 100644 --- a/src/server/api/endpoints/i/2fa/register.ts +++ b/src/server/api/endpoints/i/2fa/register.ts @@ -5,6 +5,11 @@ import * as QRCode from 'qrcode'; import User, { ILocalUser } from '../../../../../models/user'; import config from '../../../../../config'; +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'password' parameter const [password, passwordErr] = $.str.get(params.password); diff --git a/src/server/api/endpoints/i/2fa/unregister.ts b/src/server/api/endpoints/i/2fa/unregister.ts index 7d99ee397d..accf3ea0f2 100644 --- a/src/server/api/endpoints/i/2fa/unregister.ts +++ b/src/server/api/endpoints/i/2fa/unregister.ts @@ -2,6 +2,11 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import User, { ILocalUser } from '../../../../../models/user'; +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'password' parameter const [password, passwordErr] = $.str.get(params.password); diff --git a/src/server/api/endpoints/i/authorized_apps.ts b/src/server/api/endpoints/i/authorized_apps.ts index 24c4b58f7f..313bb474f4 100644 --- a/src/server/api/endpoints/i/authorized_apps.ts +++ b/src/server/api/endpoints/i/authorized_apps.ts @@ -3,9 +3,11 @@ import AccessToken from '../../../../models/access-token'; import { pack } from '../../../../models/app'; import { ILocalUser } from '../../../../models/user'; -/** - * Get authorized apps of my account - */ +export const meta = { + requireCredential: true, + secure: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/i/change_password.ts b/src/server/api/endpoints/i/change_password.ts index 698db5a6e4..dc0f060c08 100644 --- a/src/server/api/endpoints/i/change_password.ts +++ b/src/server/api/endpoints/i/change_password.ts @@ -2,9 +2,11 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import User, { ILocalUser } from '../../../../models/user'; -/** - * Change password - */ +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'currentPasword' parameter const [currentPassword, currentPasswordErr] = $.str.get(params.currentPasword); diff --git a/src/server/api/endpoints/i/favorites.ts b/src/server/api/endpoints/i/favorites.ts index d37632822a..47c8a87fd9 100644 --- a/src/server/api/endpoints/i/favorites.ts +++ b/src/server/api/endpoints/i/favorites.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import Favorite, { pack } from '../../../../models/favorite'; import { ILocalUser } from '../../../../models/user'; -/** - * Get favorited notes - */ +export const meta = { + desc: { + ja: 'お気に入りに登録した投稿一覧を取得します。', + en: 'Get favorited notes' + }, + + requireCredential: true, + + kind: 'favorites-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/i/regenerate_token.ts b/src/server/api/endpoints/i/regenerate_token.ts index 5c30c4f496..374861daaf 100644 --- a/src/server/api/endpoints/i/regenerate_token.ts +++ b/src/server/api/endpoints/i/regenerate_token.ts @@ -4,9 +4,11 @@ import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../stream'; import generateUserToken from '../../common/generate-native-user-token'; -/** - * Regenerate native token - */ +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'password' parameter const [password, passwordErr] = $.str.get(params.password); diff --git a/src/server/api/endpoints/i/signin_history.ts b/src/server/api/endpoints/i/signin_history.ts index a99a9e81ec..5a3c122f3a 100644 --- a/src/server/api/endpoints/i/signin_history.ts +++ b/src/server/api/endpoints/i/signin_history.ts @@ -2,9 +2,11 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import Signin, { pack } from '../../../../models/signin'; import { ILocalUser } from '../../../../models/user'; -/** - * Get signin history of my account - */ +export const meta = { + requireCredential: true, + secure: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 6d6cf3e4c5..4002bcdc39 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -5,9 +5,17 @@ import DriveFile from '../../../../models/drive-file'; import acceptAllFollowRequests from '../../../../services/following/requests/accept-all'; import { IApp } from '../../../../models/app'; -/** - * Update myself - */ +export const meta = { + desc: { + ja: 'アカウント情報を更新します。', + en: 'Update myself' + }, + + requireCredential: true, + + kind: 'account-write' +}; + export default async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => { const isSecure = user != null && app == null; diff --git a/src/server/api/endpoints/i/update_client_setting.ts b/src/server/api/endpoints/i/update_client_setting.ts index affaee37ee..9342f5dadc 100644 --- a/src/server/api/endpoints/i/update_client_setting.ts +++ b/src/server/api/endpoints/i/update_client_setting.ts @@ -2,9 +2,11 @@ import $ from 'cafy'; import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../stream'; -/** - * Update myself - */ +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'name' parameter const [name, nameErr] = $.str.get(params.name); diff --git a/src/server/api/endpoints/i/update_home.ts b/src/server/api/endpoints/i/update_home.ts index c41ae7b3e8..6f39854290 100644 --- a/src/server/api/endpoints/i/update_home.ts +++ b/src/server/api/endpoints/i/update_home.ts @@ -2,6 +2,11 @@ import $ from 'cafy'; import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../stream'; +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'home' parameter const [home, homeErr] = $.arr($.obj({ diff --git a/src/server/api/endpoints/i/update_mobile_home.ts b/src/server/api/endpoints/i/update_mobile_home.ts index ca61e52600..1babe409e9 100644 --- a/src/server/api/endpoints/i/update_mobile_home.ts +++ b/src/server/api/endpoints/i/update_mobile_home.ts @@ -2,6 +2,11 @@ import $ from 'cafy'; import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../stream'; +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'home' parameter const [home, homeErr] = $.arr($.obj({ diff --git a/src/server/api/endpoints/i/update_widget.ts b/src/server/api/endpoints/i/update_widget.ts index a413ca7e9b..5bf9c23053 100644 --- a/src/server/api/endpoints/i/update_widget.ts +++ b/src/server/api/endpoints/i/update_widget.ts @@ -2,6 +2,11 @@ import $ from 'cafy'; import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../stream'; +export const meta = { + requireCredential: true, + secure: true +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'id' parameter const [id, idErr] = $.str.get(params.id); diff --git a/src/server/api/endpoints/messaging/history.ts b/src/server/api/endpoints/messaging/history.ts index a1bd015864..66798d50c5 100644 --- a/src/server/api/endpoints/messaging/history.ts +++ b/src/server/api/endpoints/messaging/history.ts @@ -4,9 +4,17 @@ import Mute from '../../../../models/mute'; import { pack } from '../../../../models/messaging-message'; import { ILocalUser } from '../../../../models/user'; -/** - * Show messaging history - */ +export const meta = { + desc: { + ja: 'Messagingの履歴を取得します。', + en: 'Show messaging history.' + }, + + requireCredential: true, + + kind: 'messaging-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/messaging/messages.ts b/src/server/api/endpoints/messaging/messages.ts index 083fcd83f5..84c28dc0c1 100644 --- a/src/server/api/endpoints/messaging/messages.ts +++ b/src/server/api/endpoints/messaging/messages.ts @@ -4,9 +4,17 @@ import User, { ILocalUser } from '../../../../models/user'; import { pack } from '../../../../models/messaging-message'; import read from '../../common/read-messaging-message'; -/** - * Get messages - */ +export const meta = { + desc: { + ja: '指定したユーザーとのMessagingのメッセージ一覧を取得します。', + en: 'Get messages of messaging.' + }, + + requireCredential: true, + + kind: 'messaging-read' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'userId' parameter const [recipientId, recipientIdErr] = $.type(ID).get(params.userId); diff --git a/src/server/api/endpoints/messaging/messages/create.ts b/src/server/api/endpoints/messaging/messages/create.ts index c3d9824d69..9b897b45e7 100644 --- a/src/server/api/endpoints/messaging/messages/create.ts +++ b/src/server/api/endpoints/messaging/messages/create.ts @@ -11,9 +11,17 @@ import { publishMessagingStream, publishMessagingIndexStream } from '../../../.. import pushSw from '../../../../../push-sw'; import config from '../../../../../config'; -/** - * Create a message - */ +export const meta = { + desc: { + ja: '指定したユーザーへMessagingのメッセージを送信します。', + en: 'Create a message of messaging.' + }, + + requireCredential: true, + + kind: 'messaging-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'userId' parameter const [recipientId, recipientIdErr] = $.type(ID).get(params.userId); diff --git a/src/server/api/endpoints/mute/create.ts b/src/server/api/endpoints/mute/create.ts index 3e766bf170..bd70cd62ef 100644 --- a/src/server/api/endpoints/mute/create.ts +++ b/src/server/api/endpoints/mute/create.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import User, { ILocalUser } from '../../../../models/user'; import Mute from '../../../../models/mute'; -/** - * Mute a user - */ +export const meta = { + desc: { + ja: 'ユーザーをミュートします。', + en: 'Mute a user' + }, + + requireCredential: true, + + kind: 'account/write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const muter = user; diff --git a/src/server/api/endpoints/mute/delete.ts b/src/server/api/endpoints/mute/delete.ts index 057baed2be..3187c46f83 100644 --- a/src/server/api/endpoints/mute/delete.ts +++ b/src/server/api/endpoints/mute/delete.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id'; import User, { ILocalUser } from '../../../../models/user'; import Mute from '../../../../models/mute'; -/** - * Unmute a user - */ +export const meta = { + desc: { + ja: 'ユーザーのミュートを解除します。', + en: 'Unmute a user' + }, + + requireCredential: true, + + kind: 'account/write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const muter = user; diff --git a/src/server/api/endpoints/mute/list.ts b/src/server/api/endpoints/mute/list.ts index 54ca84c61d..e297605338 100644 --- a/src/server/api/endpoints/mute/list.ts +++ b/src/server/api/endpoints/mute/list.ts @@ -3,9 +3,17 @@ import Mute from '../../../../models/mute'; import { pack, ILocalUser } from '../../../../models/user'; import { getFriendIds } from '../../common/get-friends'; -/** - * Get muted users of a user - */ +export const meta = { + desc: { + ja: 'ミュートしているユーザー一覧を取得します。', + en: 'Get muted users.' + }, + + requireCredential: true, + + kind: 'account/read' +}; + export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => { // Get 'iknow' parameter const [iknow = false, iknowErr] = $.bool.optional.get(params.iknow); diff --git a/src/server/api/endpoints/my/apps.ts b/src/server/api/endpoints/my/apps.ts index 8e946c9466..35185db41d 100644 --- a/src/server/api/endpoints/my/apps.ts +++ b/src/server/api/endpoints/my/apps.ts @@ -2,9 +2,15 @@ import $ from 'cafy'; import App, { pack } from '../../../../models/app'; import { ILocalUser } from '../../../../models/user'; -/** - * Get my apps - */ +export const meta = { + desc: { + ja: '自分のアプリケーション一覧を取得します。', + en: 'Get my apps' + }, + + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/notes/delete.ts b/src/server/api/endpoints/notes/delete.ts index bebf7b2035..22c6101e14 100644 --- a/src/server/api/endpoints/notes/delete.ts +++ b/src/server/api/endpoints/notes/delete.ts @@ -3,9 +3,17 @@ import Note from '../../../../models/note'; import deleteNote from '../../../../services/note/delete'; import { ILocalUser } from '../../../../models/user'; -/** - * Delete a note - */ +export const meta = { + desc: { + ja: '指定した投稿を削除します。', + en: 'Delete a note.' + }, + + requireCredential: true, + + kind: 'note-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'noteId' parameter const [noteId, noteIdErr] = $.type(ID).get(params.noteId); diff --git a/src/server/api/endpoints/notes/favorites/create.ts b/src/server/api/endpoints/notes/favorites/create.ts index 280283d340..87f6cf1f08 100644 --- a/src/server/api/endpoints/notes/favorites/create.ts +++ b/src/server/api/endpoints/notes/favorites/create.ts @@ -3,9 +3,17 @@ import Favorite from '../../../../../models/favorite'; import Note from '../../../../../models/note'; import { ILocalUser } from '../../../../../models/user'; -/** - * Favorite a note - */ +export const meta = { + desc: { + ja: '指定した投稿をお気に入りに登録します。', + en: 'Favorite a note.' + }, + + requireCredential: true, + + kind: 'favorite-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'noteId' parameter const [noteId, noteIdErr] = $.type(ID).get(params.noteId); diff --git a/src/server/api/endpoints/notes/favorites/delete.ts b/src/server/api/endpoints/notes/favorites/delete.ts index 2cd00f876b..3906fe99bb 100644 --- a/src/server/api/endpoints/notes/favorites/delete.ts +++ b/src/server/api/endpoints/notes/favorites/delete.ts @@ -3,9 +3,17 @@ import Favorite from '../../../../../models/favorite'; import Note from '../../../../../models/note'; import { ILocalUser } from '../../../../../models/user'; -/** - * Unfavorite a note - */ +export const meta = { + desc: { + ja: '指定した投稿のお気に入りを解除します。', + en: 'Unfavorite a note.' + }, + + requireCredential: true, + + kind: 'favorite-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'noteId' parameter const [noteId, noteIdErr] = $.type(ID).get(params.noteId); diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts index c4e420602f..db91230a81 100644 --- a/src/server/api/endpoints/notes/mentions.ts +++ b/src/server/api/endpoints/notes/mentions.ts @@ -4,9 +4,15 @@ import { getFriendIds } from '../../common/get-friends'; import { pack } from '../../../../models/note'; import { ILocalUser } from '../../../../models/user'; -/** - * Get mentions of myself - */ +export const meta = { + desc: { + ja: '自分に言及している投稿の一覧を取得します。', + en: 'Get mentions of myself.' + }, + + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'following' parameter const [following = false, followingError] = diff --git a/src/server/api/endpoints/notes/polls/recommendation.ts b/src/server/api/endpoints/notes/polls/recommendation.ts index f448bb66fc..a0469d1870 100644 --- a/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/src/server/api/endpoints/notes/polls/recommendation.ts @@ -3,9 +3,15 @@ import Vote from '../../../../../models/poll-vote'; import Note, { pack } from '../../../../../models/note'; import { ILocalUser } from '../../../../../models/user'; -/** - * Get recommended polls - */ +export const meta = { + desc: { + ja: 'おすすめのアンケート一覧を取得します。', + en: 'Get recommended polls.' + }, + + requireCredential: true, +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/notes/polls/vote.ts b/src/server/api/endpoints/notes/polls/vote.ts index 026caa0b4e..568c187f8a 100644 --- a/src/server/api/endpoints/notes/polls/vote.ts +++ b/src/server/api/endpoints/notes/polls/vote.ts @@ -7,9 +7,17 @@ import { publishNoteStream } from '../../../../../stream'; import notify from '../../../../../notify'; import { ILocalUser } from '../../../../../models/user'; -/** - * Vote poll of a note - */ +export const meta = { + desc: { + ja: '指定した投稿のアンケートに投票します。', + en: 'Vote poll of a note.' + }, + + requireCredential: true, + + kind: 'vote-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'noteId' parameter const [noteId, noteIdErr] = $.type(ID).get(params.noteId); diff --git a/src/server/api/endpoints/notes/reactions.ts b/src/server/api/endpoints/notes/reactions.ts index 938ed6f514..8921c55916 100644 --- a/src/server/api/endpoints/notes/reactions.ts +++ b/src/server/api/endpoints/notes/reactions.ts @@ -3,9 +3,15 @@ import Note from '../../../../models/note'; import Reaction, { pack } from '../../../../models/note-reaction'; import { ILocalUser } from '../../../../models/user'; -/** - * Show reactions of a note - */ +export const meta = { + desc: { + ja: '指定した投稿のリアクション一覧を取得します。', + en: 'Show reactions of a note.' + }, + + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'noteId' parameter const [noteId, noteIdErr] = $.type(ID).get(params.noteId); @@ -46,6 +52,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) = }); // Serialize - res(await Promise.all(reactions.map(async reaction => - await pack(reaction, user)))); + res(await Promise.all(reactions.map(reaction => pack(reaction, user)))); }); diff --git a/src/server/api/endpoints/notes/reactions/create.ts b/src/server/api/endpoints/notes/reactions/create.ts index f290ab00b4..65e24e7c06 100644 --- a/src/server/api/endpoints/notes/reactions/create.ts +++ b/src/server/api/endpoints/notes/reactions/create.ts @@ -6,12 +6,15 @@ import { ILocalUser } from '../../../../../models/user'; import getParams from '../../../get-params'; export const meta = { - name: 'notes/reactions/create', - desc: { - ja: '投稿にリアクションします。' + ja: '指定した投稿にリアクションします。', + en: 'React to a note.' }, + requireCredential: true, + + kind: 'reaction-write', + params: { noteId: $.type(ID).note({ desc: { @@ -27,9 +30,6 @@ export const meta = { } }; -/** - * React to a note - */ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { const [ps, psErr] = getParams(meta, params); if (psErr) return rej(psErr); diff --git a/src/server/api/endpoints/notes/reactions/delete.ts b/src/server/api/endpoints/notes/reactions/delete.ts index 6f662526d0..62af0407bc 100644 --- a/src/server/api/endpoints/notes/reactions/delete.ts +++ b/src/server/api/endpoints/notes/reactions/delete.ts @@ -3,9 +3,17 @@ import Reaction from '../../../../../models/note-reaction'; import Note from '../../../../../models/note'; import { ILocalUser } from '../../../../../models/user'; -/** - * Unreact to a note - */ +export const meta = { + desc: { + ja: '指定した投稿へのリアクションを取り消します。', + en: 'Unreact to a note.' + }, + + requireCredential: true, + + kind: 'reaction-write' +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'noteId' parameter const [noteId, noteIdErr] = $.type(ID).get(params.noteId); diff --git a/src/server/api/endpoints/notes/trend.ts b/src/server/api/endpoints/notes/trend.ts index ae66234c0b..1cbbfacadc 100644 --- a/src/server/api/endpoints/notes/trend.ts +++ b/src/server/api/endpoints/notes/trend.ts @@ -3,9 +3,15 @@ import $ from 'cafy'; import Note, { pack } from '../../../../models/note'; import { ILocalUser } from '../../../../models/user'; -/** - * Get trend notes - */ +export const meta = { + desc: { + ja: '人気の投稿の一覧を取得します。', + en: 'Get trend notes.' + }, + + requireCredential: true +}; + export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/notes/user-list-timeline.ts b/src/server/api/endpoints/notes/user-list-timeline.ts index ef08f69c10..5837a9a301 100644 --- a/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/src/server/api/endpoints/notes/user-list-timeline.ts @@ -5,9 +5,15 @@ import { pack } from '../../../../models/note'; import UserList from '../../../../models/user-list'; import { ILocalUser } from '../../../../models/user'; -/** - * Get timeline of a user list - */ +export const meta = { + desc: { + ja: '指定したユーザーリストのタイムラインを取得します。', + en: 'Get timeline of a user list.' + }, + + requireCredential: true +}; + export default async (params: any, user: ILocalUser) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); diff --git a/src/server/api/endpoints/notifications/mark_as_read_all.ts b/src/server/api/endpoints/notifications/mark_as_read_all.ts index 5011c72d54..7cf4cd16e9 100644 --- a/src/server/api/endpoints/notifications/mark_as_read_all.ts +++ b/src/server/api/endpoints/notifications/mark_as_read_all.ts @@ -2,6 +2,17 @@ import Notification from '../../../../models/notification'; import event from '../../../../stream'; import User, { ILocalUser } from '../../../../models/user'; +export const meta = { + desc: { + ja: '全ての通知を既読にします。', + en: 'Mark as read all notifications.' + }, + + requireCredential: true, + + kind: 'notification-write' +}; + /** * Mark as read all notifications */ diff --git a/src/server/api/endpoints/sw/register.ts b/src/server/api/endpoints/sw/register.ts index c7bf1bfbe5..3414600048 100644 --- a/src/server/api/endpoints/sw/register.ts +++ b/src/server/api/endpoints/sw/register.ts @@ -2,6 +2,10 @@ import $ from 'cafy'; import Subscription from '../../../../models/sw-subscription'; import { ILocalUser } from '../../../../models/user'; +export const meta = { + requireCredential: true +}; + /** * subscribe service worker */ diff --git a/src/server/api/endpoints/users/lists/create.ts b/src/server/api/endpoints/users/lists/create.ts index f3776afee0..d7dc2a5f70 100644 --- a/src/server/api/endpoints/users/lists/create.ts +++ b/src/server/api/endpoints/users/lists/create.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import UserList, { pack } from '../../../../../models/user-list'; import { ILocalUser } from '../../../../../models/user'; -/** - * Create a user list - */ +export const meta = { + desc: { + ja: 'ユーザーリストを作成します。', + en: 'Create a user list' + }, + + requireCredential: true, + + kind: 'account-write' +}; + export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'title' parameter const [title, titleErr] = $.str.range(1, 100).get(params.title); diff --git a/src/server/api/endpoints/users/lists/list.ts b/src/server/api/endpoints/users/lists/list.ts index 88fa75a111..31fef26bdc 100644 --- a/src/server/api/endpoints/users/lists/list.ts +++ b/src/server/api/endpoints/users/lists/list.ts @@ -1,9 +1,16 @@ import UserList, { pack } from '../../../../../models/user-list'; import { ILocalUser } from '../../../../../models/user'; -/** - * Add a user to a user list - */ +export const meta = { + desc: { + ja: '自分の作成したユーザーリスト一覧を取得します。' + }, + + requireCredential: true, + + kind: 'account-read' +}; + export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => { // Fetch lists const userLists = await UserList.find({ diff --git a/src/server/api/endpoints/users/lists/push.ts b/src/server/api/endpoints/users/lists/push.ts index 9e99d59fc1..bd4e201bde 100644 --- a/src/server/api/endpoints/users/lists/push.ts +++ b/src/server/api/endpoints/users/lists/push.ts @@ -6,6 +6,17 @@ import ap from '../../../../../remote/activitypub/renderer'; import renderFollow from '../../../../../remote/activitypub/renderer/follow'; import { deliver } from '../../../../../queue'; +export const meta = { + desc: { + ja: '指定したユーザーリストに指定したユーザーを追加します。', + en: 'Add a user to a user list.' + }, + + requireCredential: true, + + kind: 'account-write' +}; + /** * Add a user to a user list */ diff --git a/src/server/api/endpoints/users/lists/show.ts b/src/server/api/endpoints/users/lists/show.ts index f432cf44fb..2fd142a609 100644 --- a/src/server/api/endpoints/users/lists/show.ts +++ b/src/server/api/endpoints/users/lists/show.ts @@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id'; import UserList, { pack } from '../../../../../models/user-list'; import { ILocalUser } from '../../../../../models/user'; -/** - * Show a user list - */ +export const meta = { + desc: { + ja: '指定したユーザーリストの情報を取得します。', + en: 'Show a user list.' + }, + + requireCredential: true, + + kind: 'account-read' +}; + export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => { // Get 'listId' parameter const [listId, listIdErr] = $.type(ID).get(params.listId); diff --git a/src/server/api/endpoints/users/recommendation.ts b/src/server/api/endpoints/users/recommendation.ts index b7402b7fb1..13377e6fff 100644 --- a/src/server/api/endpoints/users/recommendation.ts +++ b/src/server/api/endpoints/users/recommendation.ts @@ -4,9 +4,16 @@ import User, { pack, ILocalUser } from '../../../../models/user'; import { getFriendIds } from '../../common/get-friends'; import Mute from '../../../../models/mute'; -/** - * Get recommended users - */ +export const meta = { + desc: { + ja: 'おすすめのユーザー一覧を取得します。' + }, + + requireCredential: true, + + kind: 'account-read' +}; + export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => { // Get 'limit' parameter const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);