diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-07-07 02:55:52 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-07 02:55:52 +0900 |
| commit | d5bad25c63f1b1d095da8b523dc02be471d7071a (patch) | |
| tree | 381ce23594925e56ba09c16de076932193f35b47 /src/server/api/endpoints/i | |
| parent | Merge pull request #1846 from syuilo/l10n_master (diff) | |
| parent | w (diff) | |
| download | misskey-d5bad25c63f1b1d095da8b523dc02be471d7071a.tar.gz misskey-d5bad25c63f1b1d095da8b523dc02be471d7071a.tar.bz2 misskey-d5bad25c63f1b1d095da8b523dc02be471d7071a.zip | |
Merge pull request #1854 from syuilo/apis
:v:
Diffstat (limited to 'src/server/api/endpoints/i')
| -rw-r--r-- | src/server/api/endpoints/i/2fa/done.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/2fa/register.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/2fa/unregister.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/authorized_apps.ts | 8 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/change_password.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/favorites.ts | 8 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/notifications.ts | 14 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/pin.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/regenerate_token.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/signin_history.ts | 8 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update.ts | 24 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update_client_setting.ts | 4 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update_home.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update_mobile_home.ts | 2 | ||||
| -rw-r--r-- | src/server/api/endpoints/i/update_widget.ts | 2 |
15 files changed, 42 insertions, 42 deletions
diff --git a/src/server/api/endpoints/i/2fa/done.ts b/src/server/api/endpoints/i/2fa/done.ts index 61f13c4c61..fef045948a 100644 --- a/src/server/api/endpoints/i/2fa/done.ts +++ b/src/server/api/endpoints/i/2fa/done.ts @@ -2,7 +2,7 @@ import $ from 'cafy'; import * as speakeasy from 'speakeasy'; import User, { ILocalUser } from '../../../../../models/user'; -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'token' parameter const [token, tokenErr] = $.str.get(params.token); if (tokenErr) return rej('invalid token param'); diff --git a/src/server/api/endpoints/i/2fa/register.ts b/src/server/api/endpoints/i/2fa/register.ts index d05892c84b..ac703f5b0a 100644 --- a/src/server/api/endpoints/i/2fa/register.ts +++ b/src/server/api/endpoints/i/2fa/register.ts @@ -5,7 +5,7 @@ import * as QRCode from 'qrcode'; import User, { ILocalUser } from '../../../../../models/user'; import config from '../../../../../config'; -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'password' parameter const [password, passwordErr] = $.str.get(params.password); if (passwordErr) return rej('invalid password param'); diff --git a/src/server/api/endpoints/i/2fa/unregister.ts b/src/server/api/endpoints/i/2fa/unregister.ts index fc197cb1e4..7d99ee397d 100644 --- a/src/server/api/endpoints/i/2fa/unregister.ts +++ b/src/server/api/endpoints/i/2fa/unregister.ts @@ -2,7 +2,7 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import User, { ILocalUser } from '../../../../../models/user'; -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'password' parameter const [password, passwordErr] = $.str.get(params.password); if (passwordErr) return rej('invalid password param'); diff --git a/src/server/api/endpoints/i/authorized_apps.ts b/src/server/api/endpoints/i/authorized_apps.ts index cfc93c1518..24c4b58f7f 100644 --- a/src/server/api/endpoints/i/authorized_apps.ts +++ b/src/server/api/endpoints/i/authorized_apps.ts @@ -6,17 +6,17 @@ import { ILocalUser } from '../../../../models/user'; /** * Get authorized apps of my account */ -module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +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); + const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); if (limitErr) return rej('invalid limit param'); // Get 'offset' parameter - const [offset = 0, offsetErr] = $.num.optional().min(0).get(params.offset); + const [offset = 0, offsetErr] = $.num.optional.min(0).get(params.offset); if (offsetErr) return rej('invalid offset param'); // Get 'sort' parameter - const [sort = 'desc', sortError] = $.str.optional().or('desc asc').get(params.sort); + const [sort = 'desc', sortError] = $.str.optional.or('desc asc').get(params.sort); if (sortError) return rej('invalid sort param'); // Get tokens diff --git a/src/server/api/endpoints/i/change_password.ts b/src/server/api/endpoints/i/change_password.ts index 9851fa895a..698db5a6e4 100644 --- a/src/server/api/endpoints/i/change_password.ts +++ b/src/server/api/endpoints/i/change_password.ts @@ -5,7 +5,7 @@ import User, { ILocalUser } from '../../../../models/user'; /** * Change password */ -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'currentPasword' parameter const [currentPassword, currentPasswordErr] = $.str.get(params.currentPasword); if (currentPasswordErr) return rej('invalid currentPasword param'); diff --git a/src/server/api/endpoints/i/favorites.ts b/src/server/api/endpoints/i/favorites.ts index dc343afaed..75b456ca58 100644 --- a/src/server/api/endpoints/i/favorites.ts +++ b/src/server/api/endpoints/i/favorites.ts @@ -5,17 +5,17 @@ import { ILocalUser } from '../../../../models/user'; /** * Get favorited notes */ -module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +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); + const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); if (limitErr) return rej('invalid limit param'); // Get 'sinceId' parameter - const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId); + const [sinceId, sinceIdErr] = $.type(ID).optional.get(params.sinceId); if (sinceIdErr) return rej('invalid sinceId param'); // Get 'untilId' parameter - const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId); + const [untilId, untilIdErr] = $.type(ID).optional.get(params.untilId); if (untilIdErr) return rej('invalid untilId param'); // Check if both of sinceId and untilId is specified diff --git a/src/server/api/endpoints/i/notifications.ts b/src/server/api/endpoints/i/notifications.ts index ce283fe48f..1073b0369f 100644 --- a/src/server/api/endpoints/i/notifications.ts +++ b/src/server/api/endpoints/i/notifications.ts @@ -9,30 +9,30 @@ import { ILocalUser } from '../../../../models/user'; /** * Get notifications */ -module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'following' parameter const [following = false, followingError] = - $.bool.optional().get(params.following); + $.bool.optional.get(params.following); if (followingError) return rej('invalid following param'); // Get 'markAsRead' parameter - const [markAsRead = true, markAsReadErr] = $.bool.optional().get(params.markAsRead); + const [markAsRead = true, markAsReadErr] = $.bool.optional.get(params.markAsRead); if (markAsReadErr) return rej('invalid markAsRead param'); // Get 'type' parameter - const [type, typeErr] = $.arr($.str).optional().unique().get(params.type); + const [type, typeErr] = $.arr($.str).optional.unique().get(params.type); if (typeErr) return rej('invalid type param'); // Get 'limit' parameter - const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit); + const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); if (limitErr) return rej('invalid limit param'); // Get 'sinceId' parameter - const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId); + const [sinceId, sinceIdErr] = $.type(ID).optional.get(params.sinceId); if (sinceIdErr) return rej('invalid sinceId param'); // Get 'untilId' parameter - const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId); + const [untilId, untilIdErr] = $.type(ID).optional.get(params.untilId); if (untilIdErr) return rej('invalid untilId param'); // Check if both of sinceId and untilId is specified diff --git a/src/server/api/endpoints/i/pin.ts b/src/server/api/endpoints/i/pin.ts index 7f4a45e1f5..1edc571737 100644 --- a/src/server/api/endpoints/i/pin.ts +++ b/src/server/api/endpoints/i/pin.ts @@ -6,7 +6,7 @@ import { pack } from '../../../../models/user'; /** * Pin note */ -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'noteId' parameter const [noteId, noteIdErr] = $.type(ID).get(params.noteId); if (noteIdErr) return rej('invalid noteId param'); diff --git a/src/server/api/endpoints/i/regenerate_token.ts b/src/server/api/endpoints/i/regenerate_token.ts index 3ffab5428e..1f68e3abd7 100644 --- a/src/server/api/endpoints/i/regenerate_token.ts +++ b/src/server/api/endpoints/i/regenerate_token.ts @@ -7,7 +7,7 @@ import generateUserToken from '../../common/generate-native-user-token'; /** * Regenerate native token */ -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'password' parameter const [password, passwordErr] = $.str.get(params.password); if (passwordErr) return rej('invalid password param'); diff --git a/src/server/api/endpoints/i/signin_history.ts b/src/server/api/endpoints/i/signin_history.ts index 4ab9881f34..1315a2cfb6 100644 --- a/src/server/api/endpoints/i/signin_history.ts +++ b/src/server/api/endpoints/i/signin_history.ts @@ -5,17 +5,17 @@ import { ILocalUser } from '../../../../models/user'; /** * Get signin history of my account */ -module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +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); + const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit); if (limitErr) return rej('invalid limit param'); // Get 'sinceId' parameter - const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId); + const [sinceId, sinceIdErr] = $.type(ID).optional.get(params.sinceId); if (sinceIdErr) return rej('invalid sinceId param'); // Get 'untilId' parameter - const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId); + const [untilId, untilIdErr] = $.type(ID).optional.get(params.untilId); if (untilIdErr) return rej('invalid untilId param'); // Check if both of sinceId and untilId is specified diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 57b050ebc4..08d17fa854 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -8,63 +8,63 @@ import { IApp } from '../../../../models/app'; /** * Update myself */ -module.exports = async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => { const isSecure = user != null && app == null; const updates = {} as any; // Get 'name' parameter - const [name, nameErr] = $.str.optional().nullable().pipe(isValidName).get(params.name); + const [name, nameErr] = $.str.optional.nullable.pipe(isValidName).get(params.name); if (nameErr) return rej('invalid name param'); if (name) updates.name = name; // Get 'description' parameter - const [description, descriptionErr] = $.str.optional().nullable().pipe(isValidDescription).get(params.description); + const [description, descriptionErr] = $.str.optional.nullable.pipe(isValidDescription).get(params.description); if (descriptionErr) return rej('invalid description param'); if (description !== undefined) updates.description = description; // Get 'location' parameter - const [location, locationErr] = $.str.optional().nullable().pipe(isValidLocation).get(params.location); + const [location, locationErr] = $.str.optional.nullable.pipe(isValidLocation).get(params.location); if (locationErr) return rej('invalid location param'); if (location !== undefined) updates['profile.location'] = location; // Get 'birthday' parameter - const [birthday, birthdayErr] = $.str.optional().nullable().pipe(isValidBirthday).get(params.birthday); + const [birthday, birthdayErr] = $.str.optional.nullable.pipe(isValidBirthday).get(params.birthday); if (birthdayErr) return rej('invalid birthday param'); if (birthday !== undefined) updates['profile.birthday'] = birthday; // Get 'avatarId' parameter - const [avatarId, avatarIdErr] = $.type(ID).optional().nullable().get(params.avatarId); + const [avatarId, avatarIdErr] = $.type(ID).optional.nullable.get(params.avatarId); if (avatarIdErr) return rej('invalid avatarId param'); if (avatarId !== undefined) updates.avatarId = avatarId; // Get 'bannerId' parameter - const [bannerId, bannerIdErr] = $.type(ID).optional().nullable().get(params.bannerId); + const [bannerId, bannerIdErr] = $.type(ID).optional.nullable.get(params.bannerId); if (bannerIdErr) return rej('invalid bannerId param'); if (bannerId !== undefined) updates.bannerId = bannerId; // Get 'wallpaperId' parameter - const [wallpaperId, wallpaperIdErr] = $.type(ID).optional().nullable().get(params.wallpaperId); + const [wallpaperId, wallpaperIdErr] = $.type(ID).optional.nullable.get(params.wallpaperId); if (wallpaperIdErr) return rej('invalid wallpaperId param'); if (wallpaperId !== undefined) updates.wallpaperId = wallpaperId; // Get 'isLocked' parameter - const [isLocked, isLockedErr] = $.bool.optional().get(params.isLocked); + const [isLocked, isLockedErr] = $.bool.optional.get(params.isLocked); if (isLockedErr) return rej('invalid isLocked param'); if (isLocked != null) updates.isLocked = isLocked; // Get 'isBot' parameter - const [isBot, isBotErr] = $.bool.optional().get(params.isBot); + const [isBot, isBotErr] = $.bool.optional.get(params.isBot); if (isBotErr) return rej('invalid isBot param'); if (isBot != null) updates.isBot = isBot; // Get 'isCat' parameter - const [isCat, isCatErr] = $.bool.optional().get(params.isCat); + const [isCat, isCatErr] = $.bool.optional.get(params.isCat); if (isCatErr) return rej('invalid isCat param'); if (isCat != null) updates.isCat = isCat; // Get 'autoWatch' parameter - const [autoWatch, autoWatchErr] = $.bool.optional().get(params.autoWatch); + const [autoWatch, autoWatchErr] = $.bool.optional.get(params.autoWatch); if (autoWatchErr) return rej('invalid autoWatch param'); if (autoWatch != null) updates['settings.autoWatch'] = autoWatch; diff --git a/src/server/api/endpoints/i/update_client_setting.ts b/src/server/api/endpoints/i/update_client_setting.ts index 6d6e8ed24a..edcd3e7423 100644 --- a/src/server/api/endpoints/i/update_client_setting.ts +++ b/src/server/api/endpoints/i/update_client_setting.ts @@ -5,13 +5,13 @@ import event from '../../../../publishers/stream'; /** * Update myself */ -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'name' parameter const [name, nameErr] = $.str.get(params.name); if (nameErr) return rej('invalid name param'); // Get 'value' parameter - const [value, valueErr] = $.any.nullable().get(params.value); + const [value, valueErr] = $.any.nullable.get(params.value); if (valueErr) return rej('invalid value param'); const x: any = {}; diff --git a/src/server/api/endpoints/i/update_home.ts b/src/server/api/endpoints/i/update_home.ts index 511a647d88..03795ae8d9 100644 --- a/src/server/api/endpoints/i/update_home.ts +++ b/src/server/api/endpoints/i/update_home.ts @@ -2,7 +2,7 @@ import $ from 'cafy'; import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../publishers/stream'; -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'home' parameter const [home, homeErr] = $.arr( $.obj.strict() diff --git a/src/server/api/endpoints/i/update_mobile_home.ts b/src/server/api/endpoints/i/update_mobile_home.ts index b1f25624fd..a2e2a13465 100644 --- a/src/server/api/endpoints/i/update_mobile_home.ts +++ b/src/server/api/endpoints/i/update_mobile_home.ts @@ -2,7 +2,7 @@ import $ from 'cafy'; import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../publishers/stream'; -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'home' parameter const [home, homeErr] = $.arr( $.obj.strict() diff --git a/src/server/api/endpoints/i/update_widget.ts b/src/server/api/endpoints/i/update_widget.ts index 82bb04d1f4..006916c9fe 100644 --- a/src/server/api/endpoints/i/update_widget.ts +++ b/src/server/api/endpoints/i/update_widget.ts @@ -2,7 +2,7 @@ import $ from 'cafy'; import User, { ILocalUser } from '../../../../models/user'; import event from '../../../../publishers/stream'; -module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { +export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'id' parameter const [id, idErr] = $.str.get(params.id); if (idErr) return rej('invalid id param'); |