Update dependencies 🚀

This commit is contained in:
syuilo 2018-04-27 19:12:15 +09:00
parent 6274f6f2f6
commit 0f27b62924
99 changed files with 446 additions and 433 deletions

View File

@ -31,7 +31,7 @@
"@prezzemolo/rap": "0.1.2",
"@prezzemolo/zip": "0.0.3",
"@types/bcryptjs": "2.4.1",
"@types/chai": "4.1.2",
"@types/chai": "4.1.3",
"@types/chai-http": "3.0.4",
"@types/debug": "0.0.30",
"@types/deep-equal": "1.0.1",
@ -51,22 +51,22 @@
"@types/js-yaml": "3.11.1",
"@types/koa": "2.0.45",
"@types/koa-bodyparser": "4.2.0",
"@types/koa-compress": "^2.0.8",
"@types/koa-compress": "2.0.8",
"@types/koa-favicon": "2.0.19",
"@types/koa-logger": "^3.1.0",
"@types/koa-logger": "3.1.0",
"@types/koa-mount": "3.0.1",
"@types/koa-multer": "1.0.0",
"@types/koa-router": "7.0.27",
"@types/koa-router": "7.0.28",
"@types/koa-send": "4.1.1",
"@types/koa__cors": "2.2.2",
"@types/kue": "0.11.8",
"@types/license-checker": "15.0.0",
"@types/mkdirp": "0.5.2",
"@types/mocha": "5.0.0",
"@types/mocha": "5.2.0",
"@types/mongodb": "3.0.15",
"@types/monk": "6.0.0",
"@types/ms": "0.7.30",
"@types/node": "9.6.5",
"@types/node": "9.6.6",
"@types/nopt": "3.0.29",
"@types/pug": "2.0.4",
"@types/qrcode": "0.8.1",
@ -79,7 +79,7 @@
"@types/speakeasy": "2.0.2",
"@types/tmp": "0.0.33",
"@types/uuid": "3.4.3",
"@types/webpack": "4.1.3",
"@types/webpack": "4.1.4",
"@types/webpack-stream": "3.2.10",
"@types/websocket": "0.0.38",
"@types/ws": "4.0.2",
@ -88,10 +88,10 @@
"autwh": "0.1.0",
"bcryptjs": "2.4.3",
"bootstrap-vue": "2.0.0-rc.6",
"cafy": "6.0.0",
"cafy": "7.0.1",
"chai": "4.1.2",
"chai-http": "4.0.0",
"chalk": "2.4.0",
"chalk": "2.4.1",
"crc-32": "1.2.0",
"css-loader": "0.28.11",
"debug": "3.1.0",
@ -100,12 +100,12 @@
"diskusage": "0.2.4",
"dompurify": "1.0.3",
"elasticsearch": "14.2.2",
"element-ui": "2.3.4",
"element-ui": "2.3.6",
"emojilib": "2.2.12",
"escape-regexp": "0.0.1",
"eslint": "4.19.1",
"eslint-plugin-vue": "4.4.0",
"eventemitter3": "3.0.1",
"eslint-plugin-vue": "4.5.0",
"eventemitter3": "3.1.0",
"exif-js": "2.3.0",
"file-loader": "1.1.11",
"file-type": "7.6.0",
@ -133,30 +133,30 @@
"is-root": "2.0.0",
"is-url": "1.2.4",
"js-yaml": "3.11.0",
"jsdom": "11.8.0",
"koa": "2.5.0",
"jsdom": "11.9.0",
"koa": "2.5.1",
"koa-bodyparser": "4.2.0",
"koa-compress": "3.0.0",
"koa-favicon": "2.0.1",
"koa-json-body": "^5.3.0",
"koa-logger": "^3.2.0",
"koa-json-body": "5.3.0",
"koa-logger": "3.2.0",
"koa-mount": "3.0.0",
"koa-multer": "1.0.2",
"koa-router": "7.4.0",
"koa-send": "4.1.3",
"koa-slow": "^2.1.0",
"koa-slow": "2.1.0",
"kue": "0.11.6",
"license-checker": "18.0.0",
"loader-utils": "1.1.0",
"mecab-async": "0.1.2",
"mkdirp": "0.5.1",
"mocha": "5.1.0",
"mocha": "5.1.1",
"moji": "0.5.1",
"mongodb": "3.0.7",
"monk": "6.0.5",
"ms": "2.1.1",
"nan": "2.10.0",
"node-sass": "4.8.3",
"node-sass": "4.9.0",
"node-sass-json-importer": "3.2.0",
"nopt": "4.0.1",
"nprogress": "0.2.0",
@ -190,9 +190,9 @@
"textarea-caret": "3.1.0",
"tmp": "0.0.33",
"ts-loader": "4.2.0",
"ts-node": "6.0.0",
"ts-node": "6.0.1",
"tslint": "5.9.1",
"typescript": "2.8.1",
"typescript": "2.8.3",
"typescript-eslint-parser": "15.0.0",
"uglify-es": "3.3.9",
"url-loader": "1.0.1",
@ -201,18 +201,18 @@
"vue": "2.5.16",
"vue-cropperjs": "2.2.0",
"vue-js-modal": "1.3.13",
"vue-json-tree-view": "2.1.3",
"vue-loader": "14.2.2",
"vue-json-tree-view": "2.1.4",
"vue-loader": "15.0.3",
"vue-router": "3.0.1",
"vue-template-compiler": "2.5.16",
"vuedraggable": "2.16.0",
"vuex": "^3.0.1",
"vuex": "3.0.1",
"web-push": "3.3.0",
"webfinger.js": "2.6.6",
"webpack": "4.6.0",
"webpack-cli": "2.0.14",
"webpack-cli": "2.0.15",
"webpack-replace-loader": "1.3.0",
"websocket": "1.0.25",
"websocket": "1.0.26",
"ws": "5.1.1",
"xev": "2.0.0"
}

View File

@ -125,7 +125,8 @@ export default Vue.extend({
flex 1
$width = 1000px
background-image url('/assets/welcome-bg.svg')
background linear-gradient(to bottom, #1e1d65, #bd6659)
//background-image url('/assets/welcome-bg.svg')
background-size cover
background-position top center
@ -309,9 +310,3 @@ export default Vue.extend({
a
color #666
</style>
<style lang="stylus">
html
body
background linear-gradient(to bottom, #1e1d65, #bd6659)
</style>

View File

@ -1,33 +1,35 @@
<template>
<div class="welcome">
<h1><b>Misskey</b>へようこそ</h1>
<p>Twitter風ミニブログSNSMisskeyへようこそ共有したいことを投稿したりタイムラインでみんなの投稿を読むこともできます<br><a href="/signup">アカウントを作成する</a></p>
<div class="form">
<p>%fa:lock% ログイン</p>
<div>
<form @submit.prevent="onSubmit">
<input v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" placeholder="ユーザー名" autofocus required @change="onUsernameChange"/>
<input v-model="password" type="password" placeholder="パスワード" required/>
<input v-if="user && user.twoFactorEnabled" v-model="token" type="number" placeholder="トークン" required/>
<button type="submit" :disabled="signing">{{ signing ? 'ログインしています' : 'ログイン' }}</button>
</form>
<div>
<h1><b>Misskey</b>へようこそ</h1>
<p>Twitter風ミニブログSNSMisskeyへようこそ共有したいことを投稿したりタイムラインでみんなの投稿を読むこともできます<br><a href="/signup">アカウントを作成する</a></p>
<div class="form">
<p>%fa:lock% ログイン</p>
<div>
<a :href="`${apiUrl}/signin/twitter`">Twitterでログイン</a>
<form @submit.prevent="onSubmit">
<input v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" placeholder="ユーザー名" autofocus required @change="onUsernameChange"/>
<input v-model="password" type="password" placeholder="パスワード" required/>
<input v-if="user && user.twoFactorEnabled" v-model="token" type="number" placeholder="トークン" required/>
<button type="submit" :disabled="signing">{{ signing ? 'ログインしています' : 'ログイン' }}</button>
</form>
<div>
<a :href="`${apiUrl}/signin/twitter`">Twitterでログイン</a>
</div>
</div>
</div>
<div class="tl">
<p>%fa:comments R% タイムラインを見てみる</p>
<mk-welcome-timeline/>
</div>
<div class="users">
<router-link v-for="user in users" :key="user.id" class="avatar-anchor" :to="`/@${user.username}`">
<img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
</router-link>
</div>
<footer>
<small>{{ copyright }}</small>
</footer>
</div>
<div class="tl">
<p>%fa:comments R% タイムラインを見てみる</p>
<mk-welcome-timeline/>
</div>
<div class="users">
<router-link v-for="user in users" :key="user.id" class="avatar-anchor" :to="`/@${user.username}`">
<img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
</router-link>
</div>
<footer>
<small>{{ copyright }}</small>
</footer>
</div>
</template>
@ -84,123 +86,120 @@ export default Vue.extend({
<style lang="stylus" scoped>
.welcome
padding 16px
margin 0 auto
max-width 500px
background linear-gradient(to bottom, #1e1d65, #bd6659)
h1
margin 0
padding 8px
font-size 1.5em
font-weight normal
color #cacac3
> div
padding 16px
margin 0 auto
max-width 500px
& + p
margin 0 0 16px 0
padding 0 8px 0 8px
color #949fa9
.form
margin-bottom 16px
background #fff
border solid 1px rgba(0, 0, 0, 0.2)
border-radius 8px
overflow hidden
> p
h1
margin 0
padding 12px 20px
color #555
background #f5f5f5
border-bottom solid 1px #ddd
padding 8px
font-size 1.5em
font-weight normal
color #cacac3
> div
& + p
margin 0 0 16px 0
padding 0 8px 0 8px
color #949fa9
> form
padding 16px
.form
margin-bottom 16px
background #fff
border solid 1px rgba(0, 0, 0, 0.2)
border-radius 8px
overflow hidden
> p
margin 0
padding 12px 20px
color #555
background #f5f5f5
border-bottom solid 1px #ddd
input
display block
padding 12px
margin 0 0 16px 0
width 100%
font-size 1em
color rgba(0, 0, 0, 0.7)
background #fff
outline none
border solid 1px #ddd
border-radius 4px
button
display block
width 100%
padding 10px
margin 0
color #333
font-size 1em
text-align center
text-decoration none
text-shadow 0 1px 0 rgba(255, 255, 255, 0.9)
background-image linear-gradient(#fafafa, #eaeaea)
border 1px solid #ddd
border-bottom-color #cecece
border-radius 4px
&:active
background-color #767676
background-image none
border-color #444
box-shadow 0 1px 3px rgba(0, 0, 0, 0.075), inset 0 0 5px rgba(0, 0, 0, 0.2)
> div
padding 16px
text-align center
> .tl
background #fff
border solid 1px rgba(0, 0, 0, 0.2)
border-radius 8px
overflow hidden
> form
padding 16px
border-bottom solid 1px #ddd
> p
margin 0
padding 12px 20px
color #555
background #f5f5f5
border-bottom solid 1px #ddd
input
display block
padding 12px
margin 0 0 16px 0
width 100%
font-size 1em
color rgba(0, 0, 0, 0.7)
background #fff
outline none
border solid 1px #ddd
border-radius 4px
> .mk-welcome-timeline
max-height 300px
overflow auto
button
display block
width 100%
padding 10px
margin 0
color #333
font-size 1em
text-align center
text-decoration none
text-shadow 0 1px 0 rgba(255, 255, 255, 0.9)
background-image linear-gradient(#fafafa, #eaeaea)
border 1px solid #ddd
border-bottom-color #cecece
border-radius 4px
> .users
margin 12px 0 0 0
&:active
background-color #767676
background-image none
border-color #444
box-shadow 0 1px 3px rgba(0, 0, 0, 0.075), inset 0 0 5px rgba(0, 0, 0, 0.2)
> *
display inline-block
margin 4px
> div
padding 16px
text-align center
> .tl
background #fff
border solid 1px rgba(0, 0, 0, 0.2)
border-radius 8px
overflow hidden
> p
margin 0
padding 12px 20px
color #555
background #f5f5f5
border-bottom solid 1px #ddd
> .mk-welcome-timeline
max-height 300px
overflow auto
> .users
margin 12px 0 0 0
> *
display inline-block
width 38px
height 38px
vertical-align top
border-radius 6px
margin 4px
> footer
text-align center
color #fff
> *
display inline-block
width 38px
height 38px
vertical-align top
border-radius 6px
> small
display block
margin 16px 0 0 0
opacity 0.7
> footer
text-align center
color #fff
> small
display block
margin 16px 0 0 0
opacity 0.7
</style>
<style lang="stylus">
html
body
background linear-gradient(to bottom, #1e1d65, #bd6659)
</style>

View File

@ -1,5 +1,5 @@
import * as mongo from 'mongodb';
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy';
import deepcopy = require('deepcopy');
import db from '../db/mongodb';
import Reaction from './note-reaction';

View File

@ -9,7 +9,7 @@ import Note from '../../../../models/note';
*/
module.exports = params => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).$;
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).get();
if (limitErr) return rej('invalid limit param');
const datas = await Note

View File

@ -9,7 +9,7 @@ import User from '../../../../models/user';
*/
module.exports = params => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).$;
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).get();
if (limitErr) return rej('invalid limit param');
const users = await User

View File

@ -12,11 +12,11 @@ import Note from '../../../../../models/note';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).$;
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).get();
if (limitErr) return rej('invalid limit param');
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Lookup user

View File

@ -10,7 +10,7 @@ import FollowedLog from '../../../../../models/followed-log';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Lookup user

View File

@ -10,7 +10,7 @@ import FollowingLog from '../../../../../models/following-log';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Lookup user

View File

@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Lookup user

View File

@ -13,7 +13,7 @@ import Reaction from '../../../../../models/note-reaction';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Lookup user

View File

@ -67,24 +67,24 @@ import App, { isValidNameId, pack } from '../../../../models/app';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'nameId' parameter
const [nameId, nameIdErr] = $(params.nameId).string().pipe(isValidNameId).$;
const [nameId, nameIdErr] = $(params.nameId).string().pipe(isValidNameId).get();
if (nameIdErr) return rej('invalid nameId param');
// Get 'name' parameter
const [name, nameErr] = $(params.name).string().$;
const [name, nameErr] = $(params.name).string().get();
if (nameErr) return rej('invalid name param');
// Get 'description' parameter
const [description, descriptionErr] = $(params.description).string().$;
const [description, descriptionErr] = $(params.description).string().get();
if (descriptionErr) return rej('invalid description param');
// Get 'permission' parameter
const [permission, permissionErr] = $(params.permission).array($().string()).unique().$;
const [permission, permissionErr] = $(params.permission).array($().string()).unique().get();
if (permissionErr) return rej('invalid permission param');
// Get 'callbackUrl' parameter
// TODO: Check it is valid url
const [callbackUrl = null, callbackUrlErr] = $(params.callbackUrl).optional.nullable.string().$;
const [callbackUrl = null, callbackUrlErr] = $(params.callbackUrl).optional.nullable.string().get();
if (callbackUrlErr) return rej('invalid callbackUrl param');
// Generate secret

View File

@ -42,7 +42,7 @@ import { isValidNameId } from '../../../../../models/app';
*/
module.exports = async (params) => new Promise(async (res, rej) => {
// Get 'nameId' parameter
const [nameId, nameIdErr] = $(params.nameId).string().pipe(isValidNameId).$;
const [nameId, nameIdErr] = $(params.nameId).string().pipe(isValidNameId).get();
if (nameIdErr) return rej('invalid nameId param');
// Get exist

View File

@ -41,11 +41,11 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
const isSecure = user != null && app == null;
// Get 'appId' parameter
const [appId, appIdErr] = $(params.appId).optional.type(ID).$;
const [appId, appIdErr] = $(params.appId).optional.type(ID).get();
if (appIdErr) return rej('invalid appId param');
// Get 'nameId' parameter
const [nameId, nameIdErr] = $(params.nameId).optional.string().$;
const [nameId, nameIdErr] = $(params.nameId).optional.string().get();
if (nameIdErr) return rej('invalid nameId param');
if (appId === undefined && nameId === undefined) {

View File

@ -40,7 +40,7 @@ import AccessToken from '../../../../models/access-token';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'token' parameter
const [token, tokenErr] = $(params.token).string().$;
const [token, tokenErr] = $(params.token).string().get();
if (tokenErr) return rej('invalid token param');
// Fetch token

View File

@ -46,7 +46,7 @@ import config from '../../../../../config';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'appSecret' parameter
const [appSecret, appSecretErr] = $(params.appSecret).string().$;
const [appSecret, appSecretErr] = $(params.appSecret).string().get();
if (appSecretErr) return rej('invalid appSecret param');
// Lookup app

View File

@ -53,7 +53,7 @@ import AuthSess, { pack } from '../../../../../models/auth-session';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'token' parameter
const [token, tokenErr] = $(params.token).string().$;
const [token, tokenErr] = $(params.token).string().get();
if (tokenErr) return rej('invalid token param');
// Lookup session

View File

@ -51,7 +51,7 @@ import { pack } from '../../../../../models/user';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'appSecret' parameter
const [appSecret, appSecretErr] = $(params.appSecret).string().$;
const [appSecret, appSecretErr] = $(params.appSecret).string().get();
if (appSecretErr) return rej('invalid appSecret param');
// Lookup app
@ -64,7 +64,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
}
// Get 'token' parameter
const [token, tokenErr] = $(params.token).string().$;
const [token, tokenErr] = $(params.token).string().get();
if (tokenErr) return rej('invalid token param');
// Fetch token

View File

@ -13,15 +13,15 @@ import Channel, { pack } from '../../../models/channel';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -11,7 +11,7 @@ import { pack } from '../../../../models/channel';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'title' parameter
const [title, titleErr] = $(params.title).string().range(1, 100).$;
const [title, titleErr] = $(params.title).string().range(1, 100).get();
if (titleErr) return rej('invalid title param');
// Create a channel

View File

@ -10,15 +10,15 @@ import Note, { pack } from '../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 1000, limitErr] = $(params.limit).optional.number().range(1, 1000).$;
const [limit = 1000, limitErr] = $(params.limit).optional.number().range(1, 1000).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified
@ -27,7 +27,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Get 'channelId' parameter
const [channelId, channelIdErr] = $(params.channelId).type(ID).$;
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
if (channelIdErr) return rej('invalid channelId param');
// Fetch channel

View File

@ -9,7 +9,7 @@ import Channel, { IChannel, pack } from '../../../../models/channel';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'channelId' parameter
const [channelId, channelIdErr] = $(params.channelId).type(ID).$;
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
if (channelIdErr) return rej('invalid channelId param');
// Fetch channel

View File

@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'channelId' parameter
const [channelId, channelIdErr] = $(params.channelId).type(ID).$;
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
if (channelIdErr) return rej('invalid channelId param');
//#region Fetch channel

View File

@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'channelId' parameter
const [channelId, channelIdErr] = $(params.channelId).type(ID).$;
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
if (channelIdErr) return rej('invalid channelId param');
//#region Fetch channel

View File

@ -9,15 +9,15 @@ import DriveFile, { pack } from '../../../../models/drive-file';
*/
module.exports = async (params, user, app) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) throw 'invalid limit param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) throw 'invalid untilId param';
// Check if both of sinceId and untilId is specified
@ -26,11 +26,11 @@ module.exports = async (params, user, app) => {
}
// Get 'folderId' parameter
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).$;
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
if (folderIdErr) throw 'invalid folderId param';
// Get 'type' parameter
const [type, typeErr] = $(params.type).optional.string().match(/^[a-zA-Z\/\-\*]+$/).$;
const [type, typeErr] = $(params.type).optional.string().match(/^[a-zA-Z\/\-\*]+$/).get();
if (typeErr) throw 'invalid type param';
// Construct query

View File

@ -29,7 +29,7 @@ module.exports = async (file, params, user): Promise<any> => {
}
// Get 'folderId' parameter
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).$;
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
if (folderIdErr) throw 'invalid folderId param';
try {

View File

@ -9,11 +9,11 @@ import DriveFile, { pack } from '../../../../../models/drive-file';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name, nameErr] = $(params.name).string().$;
const [name, nameErr] = $(params.name).string().get();
if (nameErr) return rej('invalid name param');
// Get 'folderId' parameter
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).$;
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
if (folderIdErr) return rej('invalid folderId param');
// Issue query

View File

@ -9,7 +9,7 @@ import DriveFile, { pack } from '../../../../../models/drive-file';
*/
module.exports = async (params, user) => {
// Get 'fileId' parameter
const [fileId, fileIdErr] = $(params.fileId).type(ID).$;
const [fileId, fileIdErr] = $(params.fileId).type(ID).get();
if (fileIdErr) throw 'invalid fileId param';
// Fetch file

View File

@ -11,7 +11,7 @@ import { publishDriveStream } from '../../../../../publishers/stream';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'fileId' parameter
const [fileId, fileIdErr] = $(params.fileId).type(ID).$;
const [fileId, fileIdErr] = $(params.fileId).type(ID).get();
if (fileIdErr) return rej('invalid fileId param');
// Fetch file
@ -26,12 +26,12 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Get 'name' parameter
const [name, nameErr] = $(params.name).optional.string().pipe(validateFileName).$;
const [name, nameErr] = $(params.name).optional.string().pipe(validateFileName).get();
if (nameErr) return rej('invalid name param');
if (name) file.filename = name;
// Get 'folderId' parameter
const [folderId, folderIdErr] = $(params.folderId).optional.nullable.type(ID).$;
const [folderId, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
if (folderIdErr) return rej('invalid folderId param');
if (folderId !== undefined) {

View File

@ -11,11 +11,11 @@ import uploadFromUrl from '../../../../../services/drive/upload-from-url';
module.exports = async (params, user): Promise<any> => {
// Get 'url' parameter
// TODO: Validate this url
const [url, urlErr] = $(params.url).string().$;
const [url, urlErr] = $(params.url).string().get();
if (urlErr) throw 'invalid url param';
// Get 'folderId' parameter
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).$;
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
if (folderIdErr) throw 'invalid folderId param';
return pack(await uploadFromUrl(url, user, folderId));

View File

@ -9,15 +9,15 @@ import DriveFolder, { pack } from '../../../../models/drive-folder';
*/
module.exports = (params, user, app) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified
@ -26,7 +26,7 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
}
// Get 'folderId' parameter
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).$;
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
if (folderIdErr) return rej('invalid folderId param');
// Construct query

View File

@ -10,11 +10,11 @@ import { publishDriveStream } from '../../../../../publishers/stream';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name = '無題のフォルダー', nameErr] = $(params.name).optional.string().pipe(isValidFolderName).$;
const [name = '無題のフォルダー', nameErr] = $(params.name).optional.string().pipe(isValidFolderName).get();
if (nameErr) return rej('invalid name param');
// Get 'parentId' parameter
const [parentId = null, parentIdErr] = $(params.parentId).optional.nullable.type(ID).$;
const [parentId = null, parentIdErr] = $(params.parentId).optional.nullable.type(ID).get();
if (parentIdErr) return rej('invalid parentId param');
// If the parent folder is specified

View File

@ -9,11 +9,11 @@ import DriveFolder, { pack } from '../../../../../models/drive-folder';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name, nameErr] = $(params.name).string().$;
const [name, nameErr] = $(params.name).string().get();
if (nameErr) return rej('invalid name param');
// Get 'parentId' parameter
const [parentId = null, parentIdErr] = $(params.parentId).optional.nullable.type(ID).$;
const [parentId = null, parentIdErr] = $(params.parentId).optional.nullable.type(ID).get();
if (parentIdErr) return rej('invalid parentId param');
// Issue query

View File

@ -9,7 +9,7 @@ import DriveFolder, { pack } from '../../../../../models/drive-folder';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'folderId' parameter
const [folderId, folderIdErr] = $(params.folderId).type(ID).$;
const [folderId, folderIdErr] = $(params.folderId).type(ID).get();
if (folderIdErr) return rej('invalid folderId param');
// Get folder

View File

@ -10,7 +10,7 @@ import { publishDriveStream } from '../../../../../publishers/stream';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'folderId' parameter
const [folderId, folderIdErr] = $(params.folderId).type(ID).$;
const [folderId, folderIdErr] = $(params.folderId).type(ID).get();
if (folderIdErr) return rej('invalid folderId param');
// Fetch folder
@ -25,12 +25,12 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Get 'name' parameter
const [name, nameErr] = $(params.name).optional.string().pipe(isValidFolderName).$;
const [name, nameErr] = $(params.name).optional.string().pipe(isValidFolderName).get();
if (nameErr) return rej('invalid name param');
if (name) folder.name = name;
// Get 'parentId' parameter
const [parentId, parentIdErr] = $(params.parentId).optional.nullable.type(ID).$;
const [parentId, parentIdErr] = $(params.parentId).optional.nullable.type(ID).get();
if (parentIdErr) return rej('invalid parentId param');
if (parentId !== undefined) {
if (parentId === null) {

View File

@ -9,15 +9,15 @@ import DriveFile, { pack } from '../../../../models/drive-file';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified
@ -26,7 +26,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Get 'type' parameter
const [type, typeErr] = $(params.type).optional.string().match(/^[a-zA-Z\/\-\*]+$/).$;
const [type, typeErr] = $(params.type).optional.string().match(/^[a-zA-Z\/\-\*]+$/).get();
if (typeErr) return rej('invalid type param');
// Construct query

View File

@ -13,7 +13,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const follower = user;
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// 自分自身

View File

@ -13,7 +13,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const follower = user;
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Check if the followee is yourself

View File

@ -8,7 +8,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const follower = user;
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Fetch following

View File

@ -8,7 +8,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const follower = user;
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Fetch following

View File

@ -7,7 +7,7 @@ import User from '../../../../../models/user';
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'token' parameter
const [token, tokenErr] = $(params.token).string().$;
const [token, tokenErr] = $(params.token).string().get();
if (tokenErr) return rej('invalid token param');
const _token = token.replace(/\s/g, '');

View File

@ -10,7 +10,7 @@ import config from '../../../../../config';
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'password' parameter
const [password, passwordErr] = $(params.password).string().$;
const [password, passwordErr] = $(params.password).string().get();
if (passwordErr) return rej('invalid password param');
// Compare password

View File

@ -7,7 +7,7 @@ import User from '../../../../../models/user';
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'password' parameter
const [password, passwordErr] = $(params.password).string().$;
const [password, passwordErr] = $(params.password).string().get();
if (passwordErr) return rej('invalid password param');
// Compare password

View File

@ -10,15 +10,15 @@ import { pack } from '../../../../models/app';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'sort' parameter
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').$;
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').get();
if (sortError) return rej('invalid sort param');
// Get tokens

View File

@ -10,11 +10,11 @@ import User from '../../../../models/user';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'currentPasword' parameter
const [currentPassword, currentPasswordErr] = $(params.currentPasword).string().$;
const [currentPassword, currentPasswordErr] = $(params.currentPasword).string().get();
if (currentPasswordErr) return rej('invalid currentPasword param');
// Get 'newPassword' parameter
const [newPassword, newPasswordErr] = $(params.newPassword).string().$;
const [newPassword, newPasswordErr] = $(params.newPassword).string().get();
if (newPasswordErr) return rej('invalid newPassword param');
// Compare password

View File

@ -9,15 +9,15 @@ import Favorite, { pack } from '../../../../models/favorite';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -14,27 +14,27 @@ import read from '../../common/read-notification';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'following' parameter
const [following = false, followingError] =
$(params.following).optional.boolean().$;
$(params.following).optional.boolean().get();
if (followingError) return rej('invalid following param');
// Get 'markAsRead' parameter
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().$;
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().get();
if (markAsReadErr) return rej('invalid markAsRead param');
// Get 'type' parameter
const [type, typeErr] = $(params.type).optional.array($().string()).unique().$;
const [type, typeErr] = $(params.type).optional.array($().string()).unique().get();
if (typeErr) return rej('invalid type param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -11,7 +11,7 @@ import { pack } from '../../../../models/user';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Fetch pinee

View File

@ -12,7 +12,7 @@ import generateUserToken from '../../common/generate-native-user-token';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'password' parameter
const [password, passwordErr] = $(params.password).string().$;
const [password, passwordErr] = $(params.password).string().get();
if (passwordErr) return rej('invalid password param');
// Compare password

View File

@ -9,15 +9,15 @@ import Signin, { pack } from '../../../../models/signin';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -12,42 +12,42 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
const isSecure = user != null && app == null;
// Get 'name' parameter
const [name, nameErr] = $(params.name).optional.nullable.string().pipe(isValidName).$;
const [name, nameErr] = $(params.name).optional.nullable.string().pipe(isValidName).get();
if (nameErr) return rej('invalid name param');
if (name) user.name = name;
// Get 'description' parameter
const [description, descriptionErr] = $(params.description).optional.nullable.string().pipe(isValidDescription).$;
const [description, descriptionErr] = $(params.description).optional.nullable.string().pipe(isValidDescription).get();
if (descriptionErr) return rej('invalid description param');
if (description !== undefined) user.description = description;
// Get 'location' parameter
const [location, locationErr] = $(params.location).optional.nullable.string().pipe(isValidLocation).$;
const [location, locationErr] = $(params.location).optional.nullable.string().pipe(isValidLocation).get();
if (locationErr) return rej('invalid location param');
if (location !== undefined) user.profile.location = location;
// Get 'birthday' parameter
const [birthday, birthdayErr] = $(params.birthday).optional.nullable.string().pipe(isValidBirthday).$;
const [birthday, birthdayErr] = $(params.birthday).optional.nullable.string().pipe(isValidBirthday).get();
if (birthdayErr) return rej('invalid birthday param');
if (birthday !== undefined) user.profile.birthday = birthday;
// Get 'avatarId' parameter
const [avatarId, avatarIdErr] = $(params.avatarId).optional.type(ID).$;
const [avatarId, avatarIdErr] = $(params.avatarId).optional.type(ID).get();
if (avatarIdErr) return rej('invalid avatarId param');
if (avatarId) user.avatarId = avatarId;
// Get 'bannerId' parameter
const [bannerId, bannerIdErr] = $(params.bannerId).optional.type(ID).$;
const [bannerId, bannerIdErr] = $(params.bannerId).optional.type(ID).get();
if (bannerIdErr) return rej('invalid bannerId param');
if (bannerId) user.bannerId = bannerId;
// Get 'isBot' parameter
const [isBot, isBotErr] = $(params.isBot).optional.boolean().$;
const [isBot, isBotErr] = $(params.isBot).optional.boolean().get();
if (isBotErr) return rej('invalid isBot param');
if (isBot != null) user.isBot = isBot;
// Get 'autoWatch' parameter
const [autoWatch, autoWatchErr] = $(params.autoWatch).optional.boolean().$;
const [autoWatch, autoWatchErr] = $(params.autoWatch).optional.boolean().get();
if (autoWatchErr) return rej('invalid autoWatch param');
if (autoWatch != null) user.settings.autoWatch = autoWatch;

View File

@ -10,11 +10,11 @@ import event from '../../../../publishers/stream';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name, nameErr] = $(params.name).string().$;
const [name, nameErr] = $(params.name).string().get();
if (nameErr) return rej('invalid name param');
// Get 'value' parameter
const [value, valueErr] = $(params.value).nullable.any().$;
const [value, valueErr] = $(params.value).nullable.any().get();
if (valueErr) return rej('invalid value param');
const x = {};

View File

@ -12,15 +12,15 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
.have('name', $().string())
.have('id', $().string())
.have('place', $().string())
.have('data', $().object())).$;
.have('data', $().object())).get();
if (homeErr) return rej('invalid home param');
// Get 'id' parameter
const [id, idErr] = $(params.id).optional.string().$;
const [id, idErr] = $(params.id).optional.string().get();
if (idErr) return rej('invalid id param');
// Get 'data' parameter
const [data, dataErr] = $(params.data).optional.object().$;
const [data, dataErr] = $(params.data).optional.object().get();
if (dataErr) return rej('invalid data param');
if (home) {

View File

@ -11,15 +11,15 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
$().object(true)
.have('name', $().string())
.have('id', $().string())
.have('data', $().object())).$;
.have('data', $().object())).get();
if (homeErr) return rej('invalid home param');
// Get 'id' parameter
const [id, idErr] = $(params.id).optional.string().$;
const [id, idErr] = $(params.id).optional.string().get();
if (idErr) return rej('invalid id param');
// Get 'data' parameter
const [data, dataErr] = $(params.data).optional.object().$;
const [data, dataErr] = $(params.data).optional.object().get();
if (dataErr) return rej('invalid data param');
if (home) {

View File

@ -11,7 +11,7 @@ import { pack } from '../../../../models/messaging-message';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
const mute = await Mute.find({

View File

@ -16,7 +16,7 @@ import read from '../../common/read-messaging-message';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [recipientId, recipientIdErr] = $(params.userId).type(ID).$;
const [recipientId, recipientIdErr] = $(params.userId).type(ID).get();
if (recipientIdErr) return rej('invalid userId param');
// Fetch recipient
@ -33,19 +33,19 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Get 'markAsRead' parameter
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().$;
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().get();
if (markAsReadErr) return rej('invalid markAsRead param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -19,7 +19,7 @@ import config from '../../../../../config';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [recipientId, recipientIdErr] = $(params.userId).type(ID).$;
const [recipientId, recipientIdErr] = $(params.userId).type(ID).get();
if (recipientIdErr) return rej('invalid userId param');
// Myself
@ -41,11 +41,11 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Get 'text' parameter
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$;
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).get();
if (textErr) return rej('invalid text');
// Get 'fileId' parameter
const [fileId, fileIdErr] = $(params.fileId).optional.type(ID).$;
const [fileId, fileIdErr] = $(params.fileId).optional.type(ID).get();
if (fileIdErr) return rej('invalid fileId param');
let file = null;

View File

@ -12,7 +12,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const muter = user;
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// 自分自身

View File

@ -12,7 +12,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const muter = user;
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Check if the mutee is yourself

View File

@ -11,15 +11,15 @@ import { getFriendIds } from '../../common/get-friends';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'iknow' parameter
const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().$;
const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().get();
if (iknowErr) return rej('invalid iknow param');
// Get 'limit' parameter
const [limit = 30, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 30, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'cursor' parameter
const [cursor = null, cursorErr] = $(params.cursor).optional.type(ID).$;
const [cursor = null, cursorErr] = $(params.cursor).optional.type(ID).get();
if (cursorErr) return rej('invalid cursor param');
// Construct query

View File

@ -9,11 +9,11 @@ import App, { pack } from '../../../../models/app';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
const query = {

View File

@ -9,35 +9,35 @@ import Note, { pack } from '../../../models/note';
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'reply' parameter
const [reply, replyErr] = $(params.reply).optional.boolean().$;
const [reply, replyErr] = $(params.reply).optional.boolean().get();
if (replyErr) return rej('invalid reply param');
// Get 'renote' parameter
const [renote, renoteErr] = $(params.renote).optional.boolean().$;
const [renote, renoteErr] = $(params.renote).optional.boolean().get();
if (renoteErr) return rej('invalid renote param');
// Get 'media' parameter
const [media, mediaErr] = $(params.media).optional.boolean().$;
const [media, mediaErr] = $(params.media).optional.boolean().get();
if (mediaErr) return rej('invalid media param');
// Get 'poll' parameter
const [poll, pollErr] = $(params.poll).optional.boolean().$;
const [poll, pollErr] = $(params.poll).optional.boolean().get();
if (pollErr) return rej('invalid poll param');
// Get 'bot' parameter
//const [bot, botErr] = $(params.bot).optional.boolean().$;
//const [bot, botErr] = $(params.bot).optional.boolean().get();
//if (botErr) return rej('invalid bot param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -13,15 +13,15 @@ import Note, { pack } from '../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Lookup note

View File

@ -14,23 +14,23 @@ import { IApp } from '../../../../models/app';
*/
module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
// Get 'visibility' parameter
const [visibility = 'public', visibilityErr] = $(params.visibility).optional.string().or(['public', 'unlisted', 'private', 'direct']).$;
const [visibility = 'public', visibilityErr] = $(params.visibility).optional.string().or(['public', 'unlisted', 'private', 'direct']).get();
if (visibilityErr) return rej('invalid visibility');
// Get 'text' parameter
const [text = null, textErr] = $(params.text).optional.nullable.string().pipe(isValidText).$;
const [text = null, textErr] = $(params.text).optional.nullable.string().pipe(isValidText).get();
if (textErr) return rej('invalid text');
// Get 'cw' parameter
const [cw, cwErr] = $(params.cw).optional.nullable.string().pipe(isValidCw).$;
const [cw, cwErr] = $(params.cw).optional.nullable.string().pipe(isValidCw).get();
if (cwErr) return rej('invalid cw');
// Get 'viaMobile' parameter
const [viaMobile = false, viaMobileErr] = $(params.viaMobile).optional.boolean().$;
const [viaMobile = false, viaMobileErr] = $(params.viaMobile).optional.boolean().get();
if (viaMobileErr) return rej('invalid viaMobile');
// Get 'tags' parameter
const [tags = [], tagsErr] = $(params.tags).optional.array($().string().range(1, 32)).unique().$;
const [tags = [], tagsErr] = $(params.tags).optional.array($().string().range(1, 32)).unique().get();
if (tagsErr) return rej('invalid tags');
// Get 'geo' parameter
@ -43,11 +43,11 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
.have('altitudeAccuracy', $().nullable.number())
.have('heading', $().nullable.number().range(0, 360))
.have('speed', $().nullable.number())
.$;
.get();
if (geoErr) return rej('invalid geo');
// Get 'mediaIds' parameter
const [mediaIds, mediaIdsErr] = $(params.mediaIds).optional.array($().type(ID)).unique().range(1, 4).$;
const [mediaIds, mediaIdsErr] = $(params.mediaIds).optional.array($().type(ID)).unique().range(1, 4).get();
if (mediaIdsErr) return rej('invalid mediaIds');
let files = [];
@ -74,7 +74,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
}
// Get 'renoteId' parameter
const [renoteId, renoteIdErr] = $(params.renoteId).optional.type(ID).$;
const [renoteId, renoteIdErr] = $(params.renoteId).optional.type(ID).get();
if (renoteIdErr) return rej('invalid renoteId');
let renote: INote = null;
@ -95,7 +95,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
}
// Get 'replyId' parameter
const [replyId, replyIdErr] = $(params.replyId).optional.type(ID).$;
const [replyId, replyIdErr] = $(params.replyId).optional.type(ID).get();
if (replyIdErr) return rej('invalid replyId');
let reply: INote = null;
@ -116,7 +116,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
}
// Get 'channelId' parameter
const [channelId, channelIdErr] = $(params.channelId).optional.type(ID).$;
const [channelId, channelIdErr] = $(params.channelId).optional.type(ID).get();
if (channelIdErr) return rej('invalid channelId');
let channel: IChannel = null;
@ -162,7 +162,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
.unique()
.range(2, 10)
.each(c => c.length > 0 && c.length < 50))
.$;
.get();
if (pollErr) return rej('invalid poll');
if (poll) {

View File

@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get favoritee

View File

@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get favoritee

View File

@ -11,23 +11,23 @@ import { pack } from '../../../../models/note';
*/
module.exports = async (params, user, app) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) throw 'invalid limit param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) throw 'invalid untilId param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of sinceId, untilId, sinceDate, untilDate specified

View File

@ -11,23 +11,23 @@ import { pack } from '../../../../models/note';
*/
module.exports = async (params, user, app) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) throw 'invalid limit param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) throw 'invalid untilId param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of sinceId, untilId, sinceDate, untilDate specified

View File

@ -16,19 +16,19 @@ import { pack } from '../../../../models/note';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'following' parameter
const [following = false, followingError] =
$(params.following).optional.boolean().$;
$(params.following).optional.boolean().get();
if (followingError) return rej('invalid following param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -10,11 +10,11 @@ import Note, { pack } from '../../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get votes

View File

@ -14,7 +14,7 @@ import notify from '../../../../../publishers/notify';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get votee
@ -34,7 +34,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [choice, choiceError] =
$(params.choice).number()
.pipe(c => note.poll.choices.some(x => x.id == c))
.$;
.get();
if (choiceError) return rej('invalid choice param');
// if already voted

View File

@ -14,19 +14,19 @@ import Reaction, { pack } from '../../../../models/note-reaction';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'sort' parameter
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').$;
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').get();
if (sortError) return rej('invalid sort param');
// Lookup note

View File

@ -11,11 +11,11 @@ import { validateReaction } from '../../../../../models/note-reaction';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get 'reaction' parameter
const [reaction, reactionErr] = $(params.reaction).string().pipe(validateReaction.ok).$;
const [reaction, reactionErr] = $(params.reaction).string().pipe(validateReaction.ok).get();
if (reactionErr) return rej('invalid reaction param');
// Fetch reactee

View File

@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Fetch unreactee

View File

@ -13,19 +13,19 @@ import Note, { pack } from '../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'sort' parameter
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').$;
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').get();
if (sortError) return rej('invalid sort param');
// Lookup note

View File

@ -13,19 +13,19 @@ import Note, { pack } from '../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -18,63 +18,63 @@ import { pack } from '../../../../models/note';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'text' parameter
const [text, textError] = $(params.text).optional.string().$;
const [text, textError] = $(params.text).optional.string().get();
if (textError) return rej('invalid text param');
// Get 'includeUserIds' parameter
const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array($().type(ID)).$;
const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array($().type(ID)).get();
if (includeUserIdsErr) return rej('invalid includeUserIds param');
// Get 'excludeUserIds' parameter
const [excludeUserIds = [], excludeUserIdsErr] = $(params.excludeUserIds).optional.array($().type(ID)).$;
const [excludeUserIds = [], excludeUserIdsErr] = $(params.excludeUserIds).optional.array($().type(ID)).get();
if (excludeUserIdsErr) return rej('invalid excludeUserIds param');
// Get 'includeUserUsernames' parameter
const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array($().string()).$;
const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array($().string()).get();
if (includeUserUsernamesErr) return rej('invalid includeUserUsernames param');
// Get 'excludeUserUsernames' parameter
const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.excludeUserUsernames).optional.array($().string()).$;
const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.excludeUserUsernames).optional.array($().string()).get();
if (excludeUserUsernamesErr) return rej('invalid excludeUserUsernames param');
// Get 'following' parameter
const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$;
const [following = null, followingErr] = $(params.following).optional.nullable.boolean().get();
if (followingErr) return rej('invalid following param');
// Get 'mute' parameter
const [mute = 'mute_all', muteErr] = $(params.mute).optional.string().$;
const [mute = 'mute_all', muteErr] = $(params.mute).optional.string().get();
if (muteErr) return rej('invalid mute param');
// Get 'reply' parameter
const [reply = null, replyErr] = $(params.reply).optional.nullable.boolean().$;
const [reply = null, replyErr] = $(params.reply).optional.nullable.boolean().get();
if (replyErr) return rej('invalid reply param');
// Get 'renote' parameter
const [renote = null, renoteErr] = $(params.renote).optional.nullable.boolean().$;
const [renote = null, renoteErr] = $(params.renote).optional.nullable.boolean().get();
if (renoteErr) return rej('invalid renote param');
// Get 'media' parameter
const [media = null, mediaErr] = $(params.media).optional.nullable.boolean().$;
const [media = null, mediaErr] = $(params.media).optional.nullable.boolean().get();
if (mediaErr) return rej('invalid media param');
// Get 'poll' parameter
const [poll = null, pollErr] = $(params.poll).optional.nullable.boolean().$;
const [poll = null, pollErr] = $(params.poll).optional.nullable.boolean().get();
if (pollErr) return rej('invalid poll param');
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
if (untilDateErr) throw 'invalid untilDate param';
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 30).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 30).get();
if (limitErr) return rej('invalid limit param');
let includeUsers = includeUserIds;

View File

@ -13,7 +13,7 @@ import Note, { pack } from '../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
if (noteIdErr) return rej('invalid noteId param');
// Get note

View File

@ -13,23 +13,23 @@ import { pack } from '../../../../models/note';
*/
module.exports = async (params, user, app) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) throw 'invalid limit param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) throw 'invalid untilId param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
@ -38,11 +38,11 @@ module.exports = async (params, user, app) => {
}
// Get 'includeMyRenotes' parameter
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().$;
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().get();
if (includeMyRenotesErr) throw 'invalid includeMyRenotes param';
// Get 'includeRenotedMyNotes' parameter
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().$;
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().get();
if (includeRenotedMyNotesErr) throw 'invalid includeRenotedMyNotes param';
const [followings, watchingChannelIds, mutedUserIds] = await Promise.all([

View File

@ -14,27 +14,27 @@ import Note, { pack } from '../../../../models/note';
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'reply' parameter
const [reply, replyErr] = $(params.reply).optional.boolean().$;
const [reply, replyErr] = $(params.reply).optional.boolean().get();
if (replyErr) return rej('invalid reply param');
// Get 'renote' parameter
const [renote, renoteErr] = $(params.renote).optional.boolean().$;
const [renote, renoteErr] = $(params.renote).optional.boolean().get();
if (renoteErr) return rej('invalid renote param');
// Get 'media' parameter
const [media, mediaErr] = $(params.media).optional.boolean().$;
const [media, mediaErr] = $(params.media).optional.boolean().get();
if (mediaErr) return rej('invalid media param');
// Get 'poll' parameter
const [poll, pollErr] = $(params.poll).optional.boolean().$;
const [poll, pollErr] = $(params.poll).optional.boolean().get();
if (pollErr) return rej('invalid poll param');
const query = {

View File

@ -12,23 +12,23 @@ import UserList from '../../../../models/user-list';
*/
module.exports = async (params, user, app) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) throw 'invalid limit param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) throw 'invalid untilId param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
@ -37,15 +37,15 @@ module.exports = async (params, user, app) => {
}
// Get 'includeMyRenotes' parameter
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().$;
const [includeMyRenotes = true, includeMyRenotesErr] = $(params.includeMyRenotes).optional.boolean().get();
if (includeMyRenotesErr) throw 'invalid includeMyRenotes param';
// Get 'includeRenotedMyNotes' parameter
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().$;
const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $(params.includeRenotedMyNotes).optional.boolean().get();
if (includeRenotedMyNotesErr) throw 'invalid includeRenotedMyNotes param';
// Get 'listId' parameter
const [listId, listIdErr] = $(params.listId).type(ID).$;
const [listId, listIdErr] = $(params.listId).type(ID).get();
if (listIdErr) throw 'invalid listId param';
const [list, mutedUserIds] = await Promise.all([

View File

@ -3,19 +3,19 @@ import OthelloGame, { pack } from '../../../../models/othello-game';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'my' parameter
const [my = false, myErr] = $(params.my).optional.boolean().$;
const [my = false, myErr] = $(params.my).optional.boolean().get();
if (myErr) return rej('invalid my param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Check if both of sinceId and untilId is specified

View File

@ -4,7 +4,7 @@ import Othello from '../../../../../othello/core';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'gameId' parameter
const [gameId, gameIdErr] = $(params.gameId).type(ID).$;
const [gameId, gameIdErr] = $(params.gameId).type(ID).get();
if (gameIdErr) return rej('invalid gameId param');
const game = await OthelloGame.findOne({ _id: gameId });

View File

@ -7,7 +7,7 @@ import { eighteight } from '../../../../othello/maps';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [childId, childIdErr] = $(params.userId).type(ID).$;
const [childId, childIdErr] = $(params.userId).type(ID).get();
if (childIdErr) return rej('invalid userId param');
// Myself

View File

@ -9,15 +9,15 @@ import Subscription from '../../../../models/sw-subscription';
*/
module.exports = async (params, user, app) => new Promise(async (res, rej) => {
// Get 'endpoint' parameter
const [endpoint, endpointErr] = $(params.endpoint).string().$;
const [endpoint, endpointErr] = $(params.endpoint).string().get();
if (endpointErr) return rej('invalid endpoint param');
// Get 'auth' parameter
const [auth, authErr] = $(params.auth).string().$;
const [auth, authErr] = $(params.auth).string().get();
if (authErr) return rej('invalid auth param');
// Get 'publickey' parameter
const [publickey, publickeyErr] = $(params.publickey).string().$;
const [publickey, publickeyErr] = $(params.publickey).string().get();
if (publickeyErr) return rej('invalid publickey param');
// if already subscribed

View File

@ -13,7 +13,7 @@ import { validateUsername } from '../../../../models/user';
*/
module.exports = async (params) => new Promise(async (res, rej) => {
// Get 'username' parameter
const [username, usernameError] = $(params.username).string().pipe(validateUsername).$;
const [username, usernameError] = $(params.username).string().pipe(validateUsername).get();
if (usernameError) return rej('invalid username param');
// Get exist

View File

@ -9,15 +9,15 @@ import User, { pack } from '../../../models/user';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'sort' parameter
const [sort, sortError] = $(params.sort).optional.string().or('+follower|-follower').$;
const [sort, sortError] = $(params.sort).optional.string().or('+follower|-follower').get();
if (sortError) return rej('invalid sort param');
// Construct query

View File

@ -12,19 +12,19 @@ import { getFriendIds } from '../../common/get-friends';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Get 'iknow' parameter
const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().$;
const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().get();
if (iknowErr) return rej('invalid iknow param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'cursor' parameter
const [cursor = null, cursorErr] = $(params.cursor).optional.type(ID).$;
const [cursor = null, cursorErr] = $(params.cursor).optional.type(ID).get();
if (cursorErr) return rej('invalid cursor param');
// Lookup user

View File

@ -16,19 +16,19 @@ import { getFriendIds } from '../../common/get-friends';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Get 'iknow' parameter
const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().$;
const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().get();
if (iknowErr) return rej('invalid iknow param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'cursor' parameter
const [cursor = null, cursorErr] = $(params.cursor).optional.type(ID).$;
const [cursor = null, cursorErr] = $(params.cursor).optional.type(ID).get();
if (cursorErr) return rej('invalid cursor param');
// Lookup user

View File

@ -7,11 +7,11 @@ import User, { pack } from '../../../../models/user';
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Lookup user

View File

@ -9,7 +9,7 @@ import UserList, { pack } from '../../../../../models/user-list';
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'title' parameter
const [title, titleErr] = $(params.title).string().range(1, 100).$;
const [title, titleErr] = $(params.title).string().range(1, 100).get();
if (titleErr) return rej('invalid title param');
// insert

View File

@ -11,7 +11,7 @@ import { deliver } from '../../../../../queue';
*/
module.exports = async (params, me) => new Promise(async (res, rej) => {
// Get 'listId' parameter
const [listId, listIdErr] = $(params.listId).type(ID).$;
const [listId, listIdErr] = $(params.listId).type(ID).get();
if (listIdErr) return rej('invalid listId param');
// Fetch the list
@ -25,7 +25,7 @@ module.exports = async (params, me) => new Promise(async (res, rej) => {
}
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).type(ID).$;
const [userId, userIdErr] = $(params.userId).type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Fetch the user

View File

@ -6,7 +6,7 @@ import UserList, { pack } from '../../../../../models/user-list';
*/
module.exports = async (params, me) => new Promise(async (res, rej) => {
// Get 'listId' parameter
const [listId, listIdErr] = $(params.listId).type(ID).$;
const [listId, listIdErr] = $(params.listId).type(ID).get();
if (listIdErr) return rej('invalid listId param');
// Fetch the list

View File

@ -11,11 +11,11 @@ import User from '../../../../models/user';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).optional.type(ID).$;
const [userId, userIdErr] = $(params.userId).optional.type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Get 'username' parameter
const [username, usernameErr] = $(params.username).optional.string().$;
const [username, usernameErr] = $(params.username).optional.string().get();
if (usernameErr) return rej('invalid username param');
if (userId === undefined && username === undefined) {
@ -23,7 +23,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
}
// Get 'host' parameter
const [host, hostErr] = $(params.host).optional.string().$;
const [host, hostErr] = $(params.host).optional.string().get();
if (hostErr) return rej('invalid host param');
if (userId === undefined && host === undefined) {
@ -31,31 +31,31 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
}
// Get 'includeReplies' parameter
const [includeReplies = true, includeRepliesErr] = $(params.includeReplies).optional.boolean().$;
const [includeReplies = true, includeRepliesErr] = $(params.includeReplies).optional.boolean().get();
if (includeRepliesErr) return rej('invalid includeReplies param');
// Get 'withMedia' parameter
const [withMedia = false, withMediaErr] = $(params.withMedia).optional.boolean().$;
const [withMedia = false, withMediaErr] = $(params.withMedia).optional.boolean().get();
if (withMediaErr) return rej('invalid withMedia param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
if (untilIdErr) return rej('invalid untilId param');
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of sinceId, untilId, sinceDate, untilDate specified

View File

@ -16,11 +16,11 @@ import Mute from '../../../../models/mute';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// ID list of the user itself and other users who the user follows

View File

@ -16,15 +16,15 @@ const escapeRegexp = require('escape-regexp');
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'query' parameter
const [query, queryError] = $(params.query).string().pipe(x => x != '').$;
const [query, queryError] = $(params.query).string().pipe(x => x != '').get();
if (queryError) return rej('invalid query param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'max' parameter
const [max = 10, maxErr] = $(params.max).optional.number().range(1, 30).$;
const [max = 10, maxErr] = $(params.max).optional.number().range(1, 30).get();
if (maxErr) return rej('invalid max param');
// If Elasticsearch is available, search by $

View File

@ -9,15 +9,15 @@ import User, { pack } from '../../../../models/user';
*/
module.exports = (params, me) => new Promise(async (res, rej) => {
// Get 'query' parameter
const [query, queryError] = $(params.query).string().$;
const [query, queryError] = $(params.query).string().get();
if (queryError) return rej('invalid query param');
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
if (offsetErr) return rej('invalid offset param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
if (limitErr) return rej('invalid limit param');
const users = await User

View File

@ -14,19 +14,19 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
let user;
// Get 'userId' parameter
const [userId, userIdErr] = $(params.userId).optional.type(ID).$;
const [userId, userIdErr] = $(params.userId).optional.type(ID).get();
if (userIdErr) return rej('invalid userId param');
// Get 'userIds' parameter
const [userIds, userIdsErr] = $(params.userIds).optional.array($().type(ID)).$;
const [userIds, userIdsErr] = $(params.userIds).optional.array($().type(ID)).get();
if (userIdsErr) return rej('invalid userIds param');
// Get 'username' parameter
const [username, usernameErr] = $(params.username).optional.string().$;
const [username, usernameErr] = $(params.username).optional.string().get();
if (usernameErr) return rej('invalid username param');
// Get 'host' parameter
const [host, hostErr] = $(params.host).nullable.optional.string().$;
const [host, hostErr] = $(params.host).nullable.optional.string().get();
if (hostErr) return rej('invalid host param');
if (userIds) {

View File

@ -5,6 +5,7 @@
import * as fs from 'fs';
import * as webpack from 'webpack';
import chalk from 'chalk';
const { VueLoaderPlugin } = require('vue-loader');
import jsonImporter from 'node-sass-json-importer';
const minifyHtml = require('html-minifier').minify;
const WebpackOnBuildPlugin = require('on-build-webpack');
@ -117,7 +118,8 @@ module.exports = entries.map(x => {
fs.writeFileSync('./built/client/meta.json', JSON.stringify({
version
}), 'utf-8');
})
}),
new VueLoaderPlugin()
];
if (isProduction) {
@ -135,7 +137,9 @@ module.exports = entries.map(x => {
loader: 'vue-loader',
options: {
cssSourceMap: false,
preserveWhitespace: false
compilerOptions: {
preserveWhitespace: false
}
}
}, {
loader: 'replace',
@ -165,17 +169,32 @@ module.exports = entries.map(x => {
}
}]
}, {
test: /\.styl$/,
test: /\.styl(us)?$/,
exclude: /node_modules/,
use: [{
loader: 'style-loader'
oneOf: [{
resourceQuery: /module/,
use: [{
loader: 'vue-style-loader'
}, {
loader: 'css-loader',
options: {
modules: true,
minimize: true
}
}, {
loader: 'stylus-loader'
}]
}, {
loader: 'css-loader',
options: {
minimize: true
}
}, {
loader: 'stylus-loader'
use: [{
loader: 'vue-style-loader'
}, {
loader: 'css-loader',
options: {
minimize: true
}
}, {
loader: 'stylus-loader'
}]
}]
}, {
test: /\.scss$/,
@ -196,7 +215,7 @@ module.exports = entries.map(x => {
}, {
test: /\.css$/,
use: [{
loader: 'style-loader'
loader: 'vue-style-loader'
}, {
loader: 'css-loader',
options: {