Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
b694bf1f41 | |||
0bbfbfc762 | |||
319f525199 | |||
ee62f6e356 | |||
0f27b62924 | |||
6274f6f2f6 | |||
32da569ef6 | |||
1625fdc2f4 | |||
a0795b1afe |
@ -18,10 +18,11 @@ ultimately sophisticated new type of mini-blog based SNS.
|
|||||||
|
|
||||||
:sparkles: Features
|
:sparkles: Features
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
* Automatically updated timeline
|
|
||||||
* Reactions
|
* Reactions
|
||||||
|
* User lists
|
||||||
* Private messages
|
* Private messages
|
||||||
* ServiceWorker support
|
* Mute
|
||||||
|
* Real time contents
|
||||||
* ActivityPub compatible
|
* ActivityPub compatible
|
||||||
|
|
||||||
and more! You can touch with your own eyes at https://misskey.xyz/.
|
and more! You can touch with your own eyes at https://misskey.xyz/.
|
||||||
|
56
package.json
56
package.json
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"clientVersion": "1.0.0",
|
"clientVersion": "1.0.5130",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
@ -31,7 +31,7 @@
|
|||||||
"@prezzemolo/rap": "0.1.2",
|
"@prezzemolo/rap": "0.1.2",
|
||||||
"@prezzemolo/zip": "0.0.3",
|
"@prezzemolo/zip": "0.0.3",
|
||||||
"@types/bcryptjs": "2.4.1",
|
"@types/bcryptjs": "2.4.1",
|
||||||
"@types/chai": "4.1.2",
|
"@types/chai": "4.1.3",
|
||||||
"@types/chai-http": "3.0.4",
|
"@types/chai-http": "3.0.4",
|
||||||
"@types/debug": "0.0.30",
|
"@types/debug": "0.0.30",
|
||||||
"@types/deep-equal": "1.0.1",
|
"@types/deep-equal": "1.0.1",
|
||||||
@ -51,22 +51,22 @@
|
|||||||
"@types/js-yaml": "3.11.1",
|
"@types/js-yaml": "3.11.1",
|
||||||
"@types/koa": "2.0.45",
|
"@types/koa": "2.0.45",
|
||||||
"@types/koa-bodyparser": "4.2.0",
|
"@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-favicon": "2.0.19",
|
||||||
"@types/koa-logger": "^3.1.0",
|
"@types/koa-logger": "3.1.0",
|
||||||
"@types/koa-mount": "3.0.1",
|
"@types/koa-mount": "3.0.1",
|
||||||
"@types/koa-multer": "1.0.0",
|
"@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-send": "4.1.1",
|
||||||
"@types/koa__cors": "2.2.2",
|
"@types/koa__cors": "2.2.2",
|
||||||
"@types/kue": "0.11.8",
|
"@types/kue": "0.11.8",
|
||||||
"@types/license-checker": "15.0.0",
|
"@types/license-checker": "15.0.0",
|
||||||
"@types/mkdirp": "0.5.2",
|
"@types/mkdirp": "0.5.2",
|
||||||
"@types/mocha": "5.0.0",
|
"@types/mocha": "5.2.0",
|
||||||
"@types/mongodb": "3.0.15",
|
"@types/mongodb": "3.0.15",
|
||||||
"@types/monk": "6.0.0",
|
"@types/monk": "6.0.0",
|
||||||
"@types/ms": "0.7.30",
|
"@types/ms": "0.7.30",
|
||||||
"@types/node": "9.6.5",
|
"@types/node": "9.6.6",
|
||||||
"@types/nopt": "3.0.29",
|
"@types/nopt": "3.0.29",
|
||||||
"@types/pug": "2.0.4",
|
"@types/pug": "2.0.4",
|
||||||
"@types/qrcode": "0.8.1",
|
"@types/qrcode": "0.8.1",
|
||||||
@ -79,7 +79,7 @@
|
|||||||
"@types/speakeasy": "2.0.2",
|
"@types/speakeasy": "2.0.2",
|
||||||
"@types/tmp": "0.0.33",
|
"@types/tmp": "0.0.33",
|
||||||
"@types/uuid": "3.4.3",
|
"@types/uuid": "3.4.3",
|
||||||
"@types/webpack": "4.1.3",
|
"@types/webpack": "4.1.4",
|
||||||
"@types/webpack-stream": "3.2.10",
|
"@types/webpack-stream": "3.2.10",
|
||||||
"@types/websocket": "0.0.38",
|
"@types/websocket": "0.0.38",
|
||||||
"@types/ws": "4.0.2",
|
"@types/ws": "4.0.2",
|
||||||
@ -88,10 +88,10 @@
|
|||||||
"autwh": "0.1.0",
|
"autwh": "0.1.0",
|
||||||
"bcryptjs": "2.4.3",
|
"bcryptjs": "2.4.3",
|
||||||
"bootstrap-vue": "2.0.0-rc.6",
|
"bootstrap-vue": "2.0.0-rc.6",
|
||||||
"cafy": "6.0.0",
|
"cafy": "7.0.1",
|
||||||
"chai": "4.1.2",
|
"chai": "4.1.2",
|
||||||
"chai-http": "4.0.0",
|
"chai-http": "4.0.0",
|
||||||
"chalk": "2.4.0",
|
"chalk": "2.4.1",
|
||||||
"crc-32": "1.2.0",
|
"crc-32": "1.2.0",
|
||||||
"css-loader": "0.28.11",
|
"css-loader": "0.28.11",
|
||||||
"debug": "3.1.0",
|
"debug": "3.1.0",
|
||||||
@ -100,12 +100,12 @@
|
|||||||
"diskusage": "0.2.4",
|
"diskusage": "0.2.4",
|
||||||
"dompurify": "1.0.3",
|
"dompurify": "1.0.3",
|
||||||
"elasticsearch": "14.2.2",
|
"elasticsearch": "14.2.2",
|
||||||
"element-ui": "2.3.4",
|
"element-ui": "2.3.6",
|
||||||
"emojilib": "2.2.12",
|
"emojilib": "2.2.12",
|
||||||
"escape-regexp": "0.0.1",
|
"escape-regexp": "0.0.1",
|
||||||
"eslint": "4.19.1",
|
"eslint": "4.19.1",
|
||||||
"eslint-plugin-vue": "4.4.0",
|
"eslint-plugin-vue": "4.5.0",
|
||||||
"eventemitter3": "3.0.1",
|
"eventemitter3": "3.1.0",
|
||||||
"exif-js": "2.3.0",
|
"exif-js": "2.3.0",
|
||||||
"file-loader": "1.1.11",
|
"file-loader": "1.1.11",
|
||||||
"file-type": "7.6.0",
|
"file-type": "7.6.0",
|
||||||
@ -133,30 +133,30 @@
|
|||||||
"is-root": "2.0.0",
|
"is-root": "2.0.0",
|
||||||
"is-url": "1.2.4",
|
"is-url": "1.2.4",
|
||||||
"js-yaml": "3.11.0",
|
"js-yaml": "3.11.0",
|
||||||
"jsdom": "11.8.0",
|
"jsdom": "11.9.0",
|
||||||
"koa": "2.5.0",
|
"koa": "2.5.1",
|
||||||
"koa-bodyparser": "4.2.0",
|
"koa-bodyparser": "4.2.0",
|
||||||
"koa-compress": "3.0.0",
|
"koa-compress": "3.0.0",
|
||||||
"koa-favicon": "2.0.1",
|
"koa-favicon": "2.0.1",
|
||||||
"koa-json-body": "^5.3.0",
|
"koa-json-body": "5.3.0",
|
||||||
"koa-logger": "^3.2.0",
|
"koa-logger": "3.2.0",
|
||||||
"koa-mount": "3.0.0",
|
"koa-mount": "3.0.0",
|
||||||
"koa-multer": "1.0.2",
|
"koa-multer": "1.0.2",
|
||||||
"koa-router": "7.4.0",
|
"koa-router": "7.4.0",
|
||||||
"koa-send": "4.1.3",
|
"koa-send": "4.1.3",
|
||||||
"koa-slow": "^2.1.0",
|
"koa-slow": "2.1.0",
|
||||||
"kue": "0.11.6",
|
"kue": "0.11.6",
|
||||||
"license-checker": "18.0.0",
|
"license-checker": "18.0.0",
|
||||||
"loader-utils": "1.1.0",
|
"loader-utils": "1.1.0",
|
||||||
"mecab-async": "0.1.2",
|
"mecab-async": "0.1.2",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"mocha": "5.1.0",
|
"mocha": "5.1.1",
|
||||||
"moji": "0.5.1",
|
"moji": "0.5.1",
|
||||||
"mongodb": "3.0.7",
|
"mongodb": "3.0.7",
|
||||||
"monk": "6.0.5",
|
"monk": "6.0.5",
|
||||||
"ms": "2.1.1",
|
"ms": "2.1.1",
|
||||||
"nan": "2.10.0",
|
"nan": "2.10.0",
|
||||||
"node-sass": "4.8.3",
|
"node-sass": "4.9.0",
|
||||||
"node-sass-json-importer": "3.2.0",
|
"node-sass-json-importer": "3.2.0",
|
||||||
"nopt": "4.0.1",
|
"nopt": "4.0.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
@ -190,9 +190,9 @@
|
|||||||
"textarea-caret": "3.1.0",
|
"textarea-caret": "3.1.0",
|
||||||
"tmp": "0.0.33",
|
"tmp": "0.0.33",
|
||||||
"ts-loader": "4.2.0",
|
"ts-loader": "4.2.0",
|
||||||
"ts-node": "6.0.0",
|
"ts-node": "6.0.1",
|
||||||
"tslint": "5.9.1",
|
"tslint": "5.9.1",
|
||||||
"typescript": "2.8.1",
|
"typescript": "2.8.3",
|
||||||
"typescript-eslint-parser": "15.0.0",
|
"typescript-eslint-parser": "15.0.0",
|
||||||
"uglify-es": "3.3.9",
|
"uglify-es": "3.3.9",
|
||||||
"url-loader": "1.0.1",
|
"url-loader": "1.0.1",
|
||||||
@ -201,18 +201,18 @@
|
|||||||
"vue": "2.5.16",
|
"vue": "2.5.16",
|
||||||
"vue-cropperjs": "2.2.0",
|
"vue-cropperjs": "2.2.0",
|
||||||
"vue-js-modal": "1.3.13",
|
"vue-js-modal": "1.3.13",
|
||||||
"vue-json-tree-view": "2.1.3",
|
"vue-json-tree-view": "2.1.4",
|
||||||
"vue-loader": "14.2.2",
|
"vue-loader": "15.0.3",
|
||||||
"vue-router": "3.0.1",
|
"vue-router": "3.0.1",
|
||||||
"vue-template-compiler": "2.5.16",
|
"vue-template-compiler": "2.5.16",
|
||||||
"vuedraggable": "2.16.0",
|
"vuedraggable": "2.16.0",
|
||||||
"vuex": "^3.0.1",
|
"vuex": "3.0.1",
|
||||||
"web-push": "3.3.0",
|
"web-push": "3.3.0",
|
||||||
"webfinger.js": "2.6.6",
|
"webfinger.js": "2.6.6",
|
||||||
"webpack": "4.6.0",
|
"webpack": "4.6.0",
|
||||||
"webpack-cli": "2.0.14",
|
"webpack-cli": "2.0.15",
|
||||||
"webpack-replace-loader": "1.3.0",
|
"webpack-replace-loader": "1.3.0",
|
||||||
"websocket": "1.0.25",
|
"websocket": "1.0.26",
|
||||||
"ws": "5.1.1",
|
"ws": "5.1.1",
|
||||||
"xev": "2.0.0"
|
"xev": "2.0.0"
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<x-core v-if="src == 'home'" ref="tl" key="home" src="home"/>
|
<x-core v-if="src == 'home'" ref="tl" key="home" src="home"/>
|
||||||
<x-core v-if="src == 'local'" ref="tl" key="local" src="local"/>
|
<x-core v-if="src == 'local'" ref="tl" key="local" src="local"/>
|
||||||
<x-core v-if="src == 'global'" ref="tl" key="global" src="global"/>
|
<x-core v-if="src == 'global'" ref="tl" key="global" src="global"/>
|
||||||
<mk-user-list-timeline v-if="src == 'list'" ref="tl" key="list" :list="list"/>
|
<mk-user-list-timeline v-if="src == 'list'" ref="tl" :key="list.id" :list="list"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -125,7 +125,8 @@ export default Vue.extend({
|
|||||||
flex 1
|
flex 1
|
||||||
$width = 1000px
|
$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-size cover
|
||||||
background-position top center
|
background-position top center
|
||||||
|
|
||||||
@ -309,9 +310,3 @@ export default Vue.extend({
|
|||||||
a
|
a
|
||||||
color #666
|
color #666
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="stylus">
|
|
||||||
html
|
|
||||||
body
|
|
||||||
background linear-gradient(to bottom, #1e1d65, #bd6659)
|
|
||||||
</style>
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
html
|
html
|
||||||
height 100%
|
height 100%
|
||||||
|
background #ececed
|
||||||
|
|
||||||
|
&[data-darkmode]
|
||||||
|
background #191B22
|
||||||
|
|
||||||
body
|
body
|
||||||
display flex
|
display flex
|
||||||
|
@ -31,6 +31,9 @@ export default Vue.extend({
|
|||||||
font-size 0.9em
|
font-size 0.9em
|
||||||
padding 16px
|
padding 16px
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
padding 24px 32px
|
||||||
|
|
||||||
&:after
|
&:after
|
||||||
content ""
|
content ""
|
||||||
display block
|
display block
|
||||||
|
@ -238,7 +238,7 @@ export default Vue.extend({
|
|||||||
|
|
||||||
root(isDark)
|
root(isDark)
|
||||||
font-size 12px
|
font-size 12px
|
||||||
border-bottom solid 1px #eaeaea
|
border-bottom solid 1px isDark ? #1c2023 : #eaeaea
|
||||||
|
|
||||||
&:first-child
|
&:first-child
|
||||||
border-radius 8px 8px 0 0
|
border-radius 8px 8px 0 0
|
||||||
@ -266,6 +266,9 @@ root(isDark)
|
|||||||
@media (min-width 500px)
|
@media (min-width 500px)
|
||||||
padding 16px
|
padding 16px
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
padding 16px 32px
|
||||||
|
|
||||||
.avatar-anchor
|
.avatar-anchor
|
||||||
display inline-block
|
display inline-block
|
||||||
|
|
||||||
@ -308,7 +311,10 @@ root(isDark)
|
|||||||
background transparent
|
background transparent
|
||||||
|
|
||||||
> article
|
> article
|
||||||
padding 14px 16px 9px 16px
|
padding 16px 16px 9px
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
padding 32px 32px 22px
|
||||||
|
|
||||||
&:after
|
&:after
|
||||||
content ""
|
content ""
|
||||||
|
@ -199,10 +199,13 @@ export default Vue.extend({
|
|||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
@import '~const.styl'
|
@import '~const.styl'
|
||||||
|
|
||||||
.mk-notes
|
root(isDark)
|
||||||
background #fff
|
background isDark ? #282C37 : #fff
|
||||||
border-radius 8px
|
border-radius 8px
|
||||||
box-shadow 0 0 0 1px rgba(0, 0, 0, 0.2)
|
box-shadow 0 0 2px rgba(0, 0, 0, 0.1)
|
||||||
|
|
||||||
|
@media (min-width 500px)
|
||||||
|
box-shadow 0 8px 32px rgba(0, 0, 0, 0.1)
|
||||||
|
|
||||||
.transition
|
.transition
|
||||||
.mk-notes-enter
|
.mk-notes-enter
|
||||||
@ -260,8 +263,8 @@ export default Vue.extend({
|
|||||||
> footer
|
> footer
|
||||||
text-align center
|
text-align center
|
||||||
border-top solid 1px #eaeaea
|
border-top solid 1px #eaeaea
|
||||||
border-bottom-left-radius 4px
|
border-bottom-left-radius 8px
|
||||||
border-bottom-right-radius 4px
|
border-bottom-right-radius 8px
|
||||||
|
|
||||||
&:empty
|
&:empty
|
||||||
display none
|
display none
|
||||||
@ -270,10 +273,18 @@ export default Vue.extend({
|
|||||||
margin 0
|
margin 0
|
||||||
padding 16px
|
padding 16px
|
||||||
width 100%
|
width 100%
|
||||||
color $theme-color
|
|
||||||
border-radius 0 0 8px 8px
|
border-radius 0 0 8px 8px
|
||||||
|
|
||||||
|
@media (min-width 500px)
|
||||||
|
padding 20px
|
||||||
|
|
||||||
&:disabled
|
&:disabled
|
||||||
opacity 0.7
|
opacity 0.7
|
||||||
|
|
||||||
|
.mk-notes[data-darkmode]
|
||||||
|
root(true)
|
||||||
|
|
||||||
|
.mk-notes:not([data-darkmode])
|
||||||
|
root(false)
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mk-notification">
|
<div class="mk-notification">
|
||||||
<div class="notification reaction" v-if="notification.type == 'reaction'">
|
<div class="notification reaction" v-if="notification.type == 'reaction'">
|
||||||
<mk-time :time="notification.createdAt"/>
|
|
||||||
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
||||||
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div>
|
||||||
<p>
|
<header>
|
||||||
<mk-reaction-icon :reaction="notification.reaction"/>
|
<mk-reaction-icon :reaction="notification.reaction"/>
|
||||||
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
||||||
</p>
|
<mk-time :time="notification.createdAt"/>
|
||||||
|
</header>
|
||||||
<router-link class="note-ref" :to="notification.note | notePage">
|
<router-link class="note-ref" :to="notification.note | notePage">
|
||||||
%fa:quote-left%{{ getNoteSummary(notification.note) }}
|
%fa:quote-left%{{ getNoteSummary(notification.note) }}
|
||||||
%fa:quote-right%
|
%fa:quote-right%
|
||||||
@ -18,38 +18,54 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="notification renote" v-if="notification.type == 'renote'">
|
<div class="notification renote" v-if="notification.type == 'renote'">
|
||||||
<mk-time :time="notification.createdAt"/>
|
|
||||||
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
||||||
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div>
|
||||||
<p>
|
<header>
|
||||||
%fa:retweet%
|
%fa:retweet%
|
||||||
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
||||||
</p>
|
<mk-time :time="notification.createdAt"/>
|
||||||
|
</header>
|
||||||
<router-link class="note-ref" :to="notification.note | notePage">
|
<router-link class="note-ref" :to="notification.note | notePage">
|
||||||
%fa:quote-left%{{ getNoteSummary(notification.note.renote) }}%fa:quote-right%
|
%fa:quote-left%{{ getNoteSummary(notification.note.renote) }}%fa:quote-right%
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="notification follow" v-if="notification.type == 'follow'">
|
||||||
|
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
||||||
|
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
||||||
|
</router-link>
|
||||||
|
<div>
|
||||||
|
<header>
|
||||||
|
%fa:user-plus%
|
||||||
|
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
||||||
|
<mk-time :time="notification.createdAt"/>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="notification poll_vote" v-if="notification.type == 'poll_vote'">
|
||||||
|
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
||||||
|
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
||||||
|
</router-link>
|
||||||
|
<div>
|
||||||
|
<header>
|
||||||
|
%fa:chart-pie%
|
||||||
|
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
||||||
|
<mk-time :time="notification.createdAt"/>
|
||||||
|
</header>
|
||||||
|
<router-link class="note-ref" :to="notification.note | notePage">
|
||||||
|
%fa:quote-left%{{ getNoteSummary(notification.note) }}%fa:quote-right%
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<template v-if="notification.type == 'quote'">
|
<template v-if="notification.type == 'quote'">
|
||||||
<mk-note :note="notification.note"/>
|
<mk-note :note="notification.note"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="notification follow" v-if="notification.type == 'follow'">
|
|
||||||
<mk-time :time="notification.createdAt"/>
|
|
||||||
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
|
||||||
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
|
||||||
</router-link>
|
|
||||||
<div class="text">
|
|
||||||
<p>
|
|
||||||
%fa:user-plus%
|
|
||||||
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template v-if="notification.type == 'reply'">
|
<template v-if="notification.type == 'reply'">
|
||||||
<mk-note :note="notification.note"/>
|
<mk-note :note="notification.note"/>
|
||||||
</template>
|
</template>
|
||||||
@ -57,22 +73,6 @@
|
|||||||
<template v-if="notification.type == 'mention'">
|
<template v-if="notification.type == 'mention'">
|
||||||
<mk-note :note="notification.note"/>
|
<mk-note :note="notification.note"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="notification poll_vote" v-if="notification.type == 'poll_vote'">
|
|
||||||
<mk-time :time="notification.createdAt"/>
|
|
||||||
<router-link class="avatar-anchor" :to="notification.user | userPage">
|
|
||||||
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
|
|
||||||
</router-link>
|
|
||||||
<div class="text">
|
|
||||||
<p>
|
|
||||||
%fa:chart-pie%
|
|
||||||
<router-link :to="notification.user | userPage">{{ notification.user | userName }}</router-link>
|
|
||||||
</p>
|
|
||||||
<router-link class="note-ref" :to="notification.note | notePage">
|
|
||||||
%fa:quote-left%{{ getNoteSummary(notification.note) }}%fa:quote-right%
|
|
||||||
</router-link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -95,44 +95,57 @@ export default Vue.extend({
|
|||||||
|
|
||||||
> .notification
|
> .notification
|
||||||
padding 16px
|
padding 16px
|
||||||
|
font-size 12px
|
||||||
overflow-wrap break-word
|
overflow-wrap break-word
|
||||||
|
|
||||||
|
@media (min-width 350px)
|
||||||
|
font-size 14px
|
||||||
|
|
||||||
|
@media (min-width 500px)
|
||||||
|
font-size 16px
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
padding 32px
|
||||||
|
|
||||||
&:after
|
&:after
|
||||||
content ""
|
content ""
|
||||||
display block
|
display block
|
||||||
clear both
|
clear both
|
||||||
|
|
||||||
> .mk-time
|
|
||||||
display inline
|
|
||||||
position absolute
|
|
||||||
top 16px
|
|
||||||
right 12px
|
|
||||||
vertical-align top
|
|
||||||
color rgba(0, 0, 0, 0.6)
|
|
||||||
font-size 0.9em
|
|
||||||
|
|
||||||
> .avatar-anchor
|
> .avatar-anchor
|
||||||
display block
|
display block
|
||||||
float left
|
float left
|
||||||
|
|
||||||
img
|
img
|
||||||
min-width 36px
|
width 36px
|
||||||
min-height 36px
|
height 36px
|
||||||
max-width 36px
|
|
||||||
max-height 36px
|
|
||||||
border-radius 6px
|
border-radius 6px
|
||||||
|
|
||||||
> .text
|
@media (min-width 500px)
|
||||||
|
width 42px
|
||||||
|
height 42px
|
||||||
|
|
||||||
|
> div
|
||||||
float right
|
float right
|
||||||
width calc(100% - 36px)
|
width calc(100% - 36px)
|
||||||
padding-left 8px
|
padding-left 8px
|
||||||
|
|
||||||
p
|
@media (min-width 500px)
|
||||||
margin 0
|
width calc(100% - 42px)
|
||||||
|
|
||||||
|
> header
|
||||||
|
display flex
|
||||||
|
align-items center
|
||||||
|
white-space nowrap
|
||||||
|
|
||||||
i, .mk-reaction-icon
|
i, .mk-reaction-icon
|
||||||
margin-right 4px
|
margin-right 4px
|
||||||
|
|
||||||
|
> .mk-time
|
||||||
|
margin-left auto
|
||||||
|
color rgba(0, 0, 0, 0.3)
|
||||||
|
font-size 0.9em
|
||||||
|
|
||||||
> .note-preview
|
> .note-preview
|
||||||
color rgba(0, 0, 0, 0.7)
|
color rgba(0, 0, 0, 0.7)
|
||||||
|
|
||||||
@ -147,11 +160,11 @@ export default Vue.extend({
|
|||||||
margin-right 3px
|
margin-right 3px
|
||||||
|
|
||||||
&.renote
|
&.renote
|
||||||
.text p i
|
> div > header i
|
||||||
color #77B255
|
color #77B255
|
||||||
|
|
||||||
&.follow
|
&.follow
|
||||||
.text p i
|
> div > header i
|
||||||
color #53c7ce
|
color #53c7ce
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mk-notifications">
|
<div class="mk-notifications">
|
||||||
<div class="notifications" v-if="notifications.length != 0">
|
<transition-group name="mk-notifications" class="transition notifications">
|
||||||
<template v-for="(notification, i) in _notifications">
|
<template v-for="(notification, i) in _notifications">
|
||||||
<mk-notification :notification="notification" :key="notification.id"/>
|
<mk-notification :notification="notification" :key="notification.id"/>
|
||||||
<p class="date" v-if="i != notifications.length - 1 && notification._date != _notifications[i + 1]._date">
|
<p class="date" :key="notification.id + '_date'" v-if="i != notifications.length - 1 && notification._date != _notifications[i + 1]._date">
|
||||||
<span>%fa:angle-up%{{ notification._datetext }}</span>
|
<span>%fa:angle-up%{{ notification._datetext }}</span>
|
||||||
<span>%fa:angle-down%{{ _notifications[i + 1]._datetext }}</span>
|
<span>%fa:angle-down%{{ _notifications[i + 1]._datetext }}</span>
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</transition-group>
|
||||||
|
|
||||||
<button class="more" v-if="moreNotifications" @click="fetchMoreNotifications" :disabled="fetchingMoreNotifications">
|
<button class="more" v-if="moreNotifications" @click="fetchMoreNotifications" :disabled="fetchingMoreNotifications">
|
||||||
<template v-if="fetchingMoreNotifications">%fa:spinner .pulse .fw%</template>
|
<template v-if="fetchingMoreNotifications">%fa:spinner .pulse .fw%</template>
|
||||||
{{ fetchingMoreNotifications ? '%i18n:!common.loading%' : '%i18n:!@more%' }}
|
{{ fetchingMoreNotifications ? '%i18n:!common.loading%' : '%i18n:!@more%' }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<p class="empty" v-if="notifications.length == 0 && !fetching">%i18n:@empty%</p>
|
<p class="empty" v-if="notifications.length == 0 && !fetching">%i18n:@empty%</p>
|
||||||
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
|
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
|
||||||
</div>
|
</div>
|
||||||
@ -102,23 +104,26 @@ export default Vue.extend({
|
|||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.mk-notifications
|
.mk-notifications
|
||||||
margin 8px auto
|
margin 0 auto
|
||||||
padding 0
|
|
||||||
max-width 500px
|
|
||||||
width calc(100% - 16px)
|
|
||||||
background #fff
|
background #fff
|
||||||
border-radius 8px
|
border-radius 8px
|
||||||
box-shadow 0 0 0 1px rgba(0, 0, 0, 0.2)
|
box-shadow 0 0 2px rgba(0, 0, 0, 0.1)
|
||||||
|
|
||||||
@media (min-width 500px)
|
@media (min-width 500px)
|
||||||
margin 16px auto
|
box-shadow 0 8px 32px rgba(0, 0, 0, 0.1)
|
||||||
width calc(100% - 32px)
|
|
||||||
|
.transition
|
||||||
|
.mk-notifications-enter
|
||||||
|
.mk-notifications-leave-to
|
||||||
|
opacity 0
|
||||||
|
transform translateY(-30px)
|
||||||
|
|
||||||
|
> *
|
||||||
|
transition transform .3s ease, opacity .3s ease
|
||||||
|
|
||||||
> .notifications
|
> .notifications
|
||||||
|
|
||||||
> .mk-notification
|
> .mk-notification
|
||||||
margin 0 auto
|
|
||||||
max-width 500px
|
|
||||||
border-bottom solid 1px rgba(0, 0, 0, 0.05)
|
border-bottom solid 1px rgba(0, 0, 0, 0.05)
|
||||||
|
|
||||||
&:last-child
|
&:last-child
|
||||||
|
@ -175,11 +175,15 @@ export default Vue.extend({
|
|||||||
margin 8px auto
|
margin 8px auto
|
||||||
background #fff
|
background #fff
|
||||||
border-radius 8px
|
border-radius 8px
|
||||||
box-shadow 0 0 0 1px rgba(0, 0, 0, 0.2)
|
box-shadow 0 0 2px rgba(0, 0, 0, 0.1)
|
||||||
|
|
||||||
@media (min-width 500px)
|
@media (min-width 500px)
|
||||||
margin 16px auto
|
margin 16px auto
|
||||||
width calc(100% - 32px)
|
width calc(100% - 32px)
|
||||||
|
box-shadow 0 8px 32px rgba(0, 0, 0, 0.1)
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
margin 32px auto
|
||||||
|
|
||||||
> header
|
> header
|
||||||
z-index 1
|
z-index 1
|
||||||
|
@ -143,14 +143,14 @@ export default Vue.extend({
|
|||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
@import '~const.styl'
|
@import '~const.styl'
|
||||||
|
|
||||||
.header
|
root(isDark)
|
||||||
$height = 48px
|
$height = 48px
|
||||||
|
|
||||||
position fixed
|
position fixed
|
||||||
top 0
|
top 0
|
||||||
z-index 1024
|
z-index 1024
|
||||||
width 100%
|
width 100%
|
||||||
box-shadow 0 1px 0 rgba(#000, 0.075)
|
//box-shadow 0 1px 0 rgba(#000, 0.075)
|
||||||
|
|
||||||
&, *
|
&, *
|
||||||
user-select none
|
user-select none
|
||||||
@ -167,7 +167,7 @@ export default Vue.extend({
|
|||||||
-webkit-backdrop-filter blur(12px)
|
-webkit-backdrop-filter blur(12px)
|
||||||
backdrop-filter blur(12px)
|
backdrop-filter blur(12px)
|
||||||
//background-color rgba(#1b2023, 0.75)
|
//background-color rgba(#1b2023, 0.75)
|
||||||
background-color #1b2023
|
background-color isDark ? #313543 : #595f6f
|
||||||
|
|
||||||
> p
|
> p
|
||||||
display none
|
display none
|
||||||
@ -244,4 +244,10 @@ export default Vue.extend({
|
|||||||
line-height $height
|
line-height $height
|
||||||
border-left solid 1px rgba(#000, 0.1)
|
border-left solid 1px rgba(#000, 0.1)
|
||||||
|
|
||||||
|
.header[data-darkmode]
|
||||||
|
root(true)
|
||||||
|
|
||||||
|
.header:not([data-darkmode])
|
||||||
|
root(false)
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -65,9 +65,3 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
.mk-user-timeline
|
|
||||||
max-width 600px
|
|
||||||
margin 0 auto
|
|
||||||
</style>
|
|
||||||
|
@ -102,7 +102,6 @@ export default Vue.extend({
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey';
|
document.title = 'Misskey';
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -40,9 +40,6 @@ export default Vue.extend({
|
|||||||
created() {
|
created() {
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
fetch() {
|
fetch() {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
@ -39,9 +39,6 @@ export default Vue.extend({
|
|||||||
created() {
|
created() {
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
fetch() {
|
fetch() {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<x-tl v-if="src == 'home'" ref="tl" key="home" src="home" @loaded="onLoaded"/>
|
<x-tl v-if="src == 'home'" ref="tl" key="home" src="home" @loaded="onLoaded"/>
|
||||||
<x-tl v-if="src == 'local'" ref="tl" key="local" src="local"/>
|
<x-tl v-if="src == 'local'" ref="tl" key="local" src="local"/>
|
||||||
<x-tl v-if="src == 'global'" ref="tl" key="global" src="global"/>
|
<x-tl v-if="src == 'global'" ref="tl" key="global" src="global"/>
|
||||||
<mk-user-list-timeline v-if="src.startsWith('list:')" ref="tl" key="list" :list="list"/>
|
<mk-user-list-timeline v-if="src.startsWith('list:')" ref="tl" :key="list.id" :list="list"/>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</mk-ui>
|
</mk-ui>
|
||||||
@ -77,7 +77,6 @@ export default Vue.extend({
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey';
|
document.title = 'Misskey';
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
|
|
||||||
Progress.start();
|
Progress.start();
|
||||||
},
|
},
|
||||||
@ -163,11 +162,14 @@ main
|
|||||||
background #eee
|
background #eee
|
||||||
|
|
||||||
> .tl
|
> .tl
|
||||||
max-width 600px
|
max-width 680px
|
||||||
margin 0 auto
|
margin 0 auto
|
||||||
padding 8px
|
padding 8px
|
||||||
|
|
||||||
@media (min-width 500px)
|
@media (min-width 500px)
|
||||||
padding 16px
|
padding 16px
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
padding 32px
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -30,7 +30,6 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey';
|
document.title = 'Misskey';
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetch() {
|
fetch() {
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
<mk-ui>
|
<mk-ui>
|
||||||
<span slot="header">%fa:R bell%%i18n:@notifications%</span>
|
<span slot="header">%fa:R bell%%i18n:@notifications%</span>
|
||||||
<template slot="func"><button @click="fn">%fa:check%</button></template>
|
<template slot="func"><button @click="fn">%fa:check%</button></template>
|
||||||
<mk-notifications @fetched="onFetched"/>
|
|
||||||
|
<main>
|
||||||
|
<mk-notifications @fetched="onFetched"/>
|
||||||
|
</main>
|
||||||
</mk-ui>
|
</mk-ui>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -13,7 +16,6 @@ import Progress from '../../../common/scripts/loading';
|
|||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey | %i18n:@notifications%';
|
document.title = 'Misskey | %i18n:@notifications%';
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
|
|
||||||
Progress.start();
|
Progress.start();
|
||||||
},
|
},
|
||||||
@ -30,3 +32,20 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
@import '~const.styl'
|
||||||
|
|
||||||
|
main
|
||||||
|
width 100%
|
||||||
|
max-width 680px
|
||||||
|
margin 0 auto
|
||||||
|
padding 8px
|
||||||
|
|
||||||
|
@media (min-width 500px)
|
||||||
|
padding 16px
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
padding 32px
|
||||||
|
|
||||||
|
</style>
|
||||||
|
@ -59,7 +59,6 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey | %i18n:@title%';
|
document.title = 'Misskey | %i18n:@title%';
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setAvatar() {
|
setAvatar() {
|
||||||
|
@ -39,7 +39,6 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = `%i18n:@search%: ${this.q} | Misskey`;
|
document.title = `%i18n:@search%: ${this.q} | Misskey`;
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
|
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,6 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey | %i18n:@settings%';
|
document.title = 'Misskey | %i18n:@settings%';
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
signout() {
|
signout() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<mk-ui>
|
<mk-ui>
|
||||||
<template slot="header" v-if="!fetching"><img :src="`${user.avatarUrl}?thumbnail&size=64`" alt="">{{ user | userName }}</template>
|
<template slot="header" v-if="!fetching"><img :src="`${user.avatarUrl}?thumbnail&size=64`" alt="">{{ user | userName }}</template>
|
||||||
<main v-if="!fetching">
|
<main v-if="!fetching" :data-darkmode="_darkmode_">
|
||||||
<div class="is-suspended" v-if="user.isSuspended"><p>%fa:exclamation-triangle% %i18n:@is-suspended%</p></div>
|
<div class="is-suspended" v-if="user.isSuspended"><p>%fa:exclamation-triangle% %i18n:@is-suspended%</p></div>
|
||||||
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
||||||
<header>
|
<header>
|
||||||
@ -45,9 +45,9 @@
|
|||||||
</header>
|
</header>
|
||||||
<nav>
|
<nav>
|
||||||
<div class="nav-container">
|
<div class="nav-container">
|
||||||
<a :data-active="page == 'home'" @click="page = 'home'">%i18n:@overview%</a>
|
<a :data-active="page == 'home'" @click="page = 'home'">%fa:home% %i18n:@overview%</a>
|
||||||
<a :data-active="page == 'notes'" @click="page = 'notes'">%i18n:@timeline%</a>
|
<a :data-active="page == 'notes'" @click="page = 'notes'">%fa:R comment-alt% %i18n:@timeline%</a>
|
||||||
<a :data-active="page == 'media'" @click="page = 'media'">%i18n:@media%</a>
|
<a :data-active="page == 'media'" @click="page = 'media'">%fa:image% %i18n:@media%</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
@ -88,9 +88,6 @@ export default Vue.extend({
|
|||||||
created() {
|
created() {
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
document.documentElement.style.background = '#313a42';
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
fetch() {
|
fetch() {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
@ -110,7 +107,7 @@ export default Vue.extend({
|
|||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
@import '~const.styl'
|
@import '~const.styl'
|
||||||
|
|
||||||
main
|
root(isDark)
|
||||||
> .is-suspended
|
> .is-suspended
|
||||||
> .is-remote
|
> .is-remote
|
||||||
&.is-suspended
|
&.is-suspended
|
||||||
@ -138,7 +135,7 @@ main
|
|||||||
|
|
||||||
> .banner
|
> .banner
|
||||||
padding-bottom 33.3%
|
padding-bottom 33.3%
|
||||||
background-color #1b1b1b
|
background-color isDark ? #0e0e0e : #cacaca
|
||||||
background-size cover
|
background-size cover
|
||||||
background-position center
|
background-position center
|
||||||
|
|
||||||
@ -165,13 +162,13 @@ main
|
|||||||
left -2px
|
left -2px
|
||||||
bottom -2px
|
bottom -2px
|
||||||
width 100%
|
width 100%
|
||||||
border 3px solid #313a42
|
border 3px solid isDark ? #191b22 : #ececed
|
||||||
border-radius 6px
|
border-radius 6px
|
||||||
|
|
||||||
@media (min-width 500px)
|
@media (min-width 500px)
|
||||||
left -4px
|
left -4px
|
||||||
bottom -4px
|
bottom -4px
|
||||||
border 4px solid #313a42
|
border 4px solid isDark ? #191b22 : #ececed
|
||||||
border-radius 12px
|
border-radius 12px
|
||||||
|
|
||||||
> .mk-follow-button
|
> .mk-follow-button
|
||||||
@ -185,14 +182,14 @@ main
|
|||||||
margin 0
|
margin 0
|
||||||
line-height 22px
|
line-height 22px
|
||||||
font-size 20px
|
font-size 20px
|
||||||
color #fff
|
color isDark ? #fff : #757c82
|
||||||
|
|
||||||
> .username
|
> .username
|
||||||
display inline-block
|
display inline-block
|
||||||
line-height 20px
|
line-height 20px
|
||||||
font-size 16px
|
font-size 16px
|
||||||
font-weight bold
|
font-weight bold
|
||||||
color #657786
|
color isDark ? #657786 : #969ea5
|
||||||
|
|
||||||
> .followed
|
> .followed
|
||||||
margin-left 8px
|
margin-left 8px
|
||||||
@ -204,7 +201,7 @@ main
|
|||||||
|
|
||||||
> .description
|
> .description
|
||||||
margin 8px 0
|
margin 8px 0
|
||||||
color #fff
|
color isDark ? #fff : #757c82
|
||||||
|
|
||||||
> .info
|
> .info
|
||||||
margin 8px 0
|
margin 8px 0
|
||||||
@ -212,14 +209,14 @@ main
|
|||||||
> p
|
> p
|
||||||
display inline
|
display inline
|
||||||
margin 0 16px 0 0
|
margin 0 16px 0 0
|
||||||
color #a9b9c1
|
color isDark ? #a9b9c1 : #90989c
|
||||||
|
|
||||||
> i
|
> i
|
||||||
margin-right 4px
|
margin-right 4px
|
||||||
|
|
||||||
> .status
|
> .status
|
||||||
> a
|
> a
|
||||||
color #657786
|
color isDark ? #657786 : #818a92
|
||||||
|
|
||||||
&:not(:last-child)
|
&:not(:last-child)
|
||||||
margin-right 16px
|
margin-right 16px
|
||||||
@ -227,7 +224,7 @@ main
|
|||||||
> b
|
> b
|
||||||
margin-right 4px
|
margin-right 4px
|
||||||
font-size 16px
|
font-size 16px
|
||||||
color #fff
|
color isDark ? #fff : #787e86
|
||||||
|
|
||||||
> i
|
> i
|
||||||
font-size 14px
|
font-size 14px
|
||||||
@ -235,9 +232,9 @@ main
|
|||||||
> nav
|
> nav
|
||||||
position -webkit-sticky
|
position -webkit-sticky
|
||||||
position sticky
|
position sticky
|
||||||
top 48px
|
top 47px
|
||||||
box-shadow 0 4px 4px rgba(0, 0, 0, 0.3)
|
box-shadow 0 4px 4px isDark ? rgba(#000, 0.3) : rgba(#000, 0.07)
|
||||||
background-color #313a42
|
background-color isDark ? #191b22 : #ececed
|
||||||
z-index 1
|
z-index 1
|
||||||
|
|
||||||
> .nav-container
|
> .nav-container
|
||||||
@ -253,7 +250,7 @@ main
|
|||||||
line-height 52px
|
line-height 52px
|
||||||
font-size 14px
|
font-size 14px
|
||||||
text-decoration none
|
text-decoration none
|
||||||
color #657786
|
color isDark ? #657786 : #9ca1a5
|
||||||
border-bottom solid 2px transparent
|
border-bottom solid 2px transparent
|
||||||
|
|
||||||
&[data-active]
|
&[data-active]
|
||||||
@ -262,9 +259,20 @@ main
|
|||||||
border-color $theme-color
|
border-color $theme-color
|
||||||
|
|
||||||
> .body
|
> .body
|
||||||
|
max-width 680px
|
||||||
|
margin 0 auto
|
||||||
padding 8px
|
padding 8px
|
||||||
|
|
||||||
@media (min-width 500px)
|
@media (min-width 500px)
|
||||||
padding 16px
|
padding 16px
|
||||||
|
|
||||||
|
@media (min-width 600px)
|
||||||
|
padding 32px
|
||||||
|
|
||||||
|
main[data-darkmode]
|
||||||
|
root(true)
|
||||||
|
|
||||||
|
main:not([data-darkmode])
|
||||||
|
root(false)
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -64,11 +64,14 @@ export default Vue.extend({
|
|||||||
> section
|
> section
|
||||||
background #eee
|
background #eee
|
||||||
border-radius 8px
|
border-radius 8px
|
||||||
box-shadow 0 0 0 1px rgba(0, 0, 0, 0.2)
|
box-shadow 0 4px 16px rgba(#000, 0.1)
|
||||||
|
|
||||||
&:not(:last-child)
|
&:not(:last-child)
|
||||||
margin-bottom 8px
|
margin-bottom 8px
|
||||||
|
|
||||||
|
@media (min-width 500px)
|
||||||
|
margin-bottom 16px
|
||||||
|
|
||||||
> h2
|
> h2
|
||||||
margin 0
|
margin 0
|
||||||
padding 8px 10px
|
padding 8px 10px
|
||||||
|
@ -1,33 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="welcome">
|
<div class="welcome">
|
||||||
<h1><b>Misskey</b>へようこそ</h1>
|
<div>
|
||||||
<p>Twitter風ミニブログSNS、Misskeyへようこそ。共有したいことを投稿したり、タイムラインでみんなの投稿を読むこともできます。<br><a href="/signup">アカウントを作成する</a></p>
|
<h1><b>Misskey</b>へようこそ</h1>
|
||||||
<div class="form">
|
<p>Twitter風ミニブログSNS、Misskeyへようこそ。共有したいことを投稿したり、タイムラインでみんなの投稿を読むこともできます。<br><a href="/signup">アカウントを作成する</a></p>
|
||||||
<p>%fa:lock% ログイン</p>
|
<div class="form">
|
||||||
<div>
|
<p>%fa:lock% ログイン</p>
|
||||||
<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>
|
<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>
|
</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>
|
||||||
<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>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -84,123 +86,120 @@ export default Vue.extend({
|
|||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.welcome
|
.welcome
|
||||||
padding 16px
|
background linear-gradient(to bottom, #1e1d65, #bd6659)
|
||||||
margin 0 auto
|
|
||||||
max-width 500px
|
|
||||||
|
|
||||||
h1
|
> div
|
||||||
margin 0
|
padding 16px
|
||||||
padding 8px
|
margin 0 auto
|
||||||
font-size 1.5em
|
max-width 500px
|
||||||
font-weight normal
|
|
||||||
color #cacac3
|
|
||||||
|
|
||||||
& + p
|
h1
|
||||||
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
|
|
||||||
margin 0
|
margin 0
|
||||||
padding 12px 20px
|
padding 8px
|
||||||
color #555
|
font-size 1.5em
|
||||||
background #f5f5f5
|
font-weight normal
|
||||||
border-bottom solid 1px #ddd
|
color #cacac3
|
||||||
|
|
||||||
> div
|
& + p
|
||||||
|
margin 0 0 16px 0
|
||||||
|
padding 0 8px 0 8px
|
||||||
|
color #949fa9
|
||||||
|
|
||||||
> form
|
.form
|
||||||
padding 16px
|
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
|
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
|
> div
|
||||||
padding 16px
|
|
||||||
text-align center
|
|
||||||
|
|
||||||
> .tl
|
> form
|
||||||
background #fff
|
padding 16px
|
||||||
border solid 1px rgba(0, 0, 0, 0.2)
|
border-bottom solid 1px #ddd
|
||||||
border-radius 8px
|
|
||||||
overflow hidden
|
|
||||||
|
|
||||||
> p
|
input
|
||||||
margin 0
|
display block
|
||||||
padding 12px 20px
|
padding 12px
|
||||||
color #555
|
margin 0 0 16px 0
|
||||||
background #f5f5f5
|
width 100%
|
||||||
border-bottom solid 1px #ddd
|
font-size 1em
|
||||||
|
color rgba(0, 0, 0, 0.7)
|
||||||
|
background #fff
|
||||||
|
outline none
|
||||||
|
border solid 1px #ddd
|
||||||
|
border-radius 4px
|
||||||
|
|
||||||
> .mk-welcome-timeline
|
button
|
||||||
max-height 300px
|
display block
|
||||||
overflow auto
|
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
|
&:active
|
||||||
margin 12px 0 0 0
|
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
|
||||||
display inline-block
|
padding 16px
|
||||||
margin 4px
|
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
|
display inline-block
|
||||||
width 38px
|
margin 4px
|
||||||
height 38px
|
|
||||||
vertical-align top
|
|
||||||
border-radius 6px
|
|
||||||
|
|
||||||
> footer
|
> *
|
||||||
text-align center
|
display inline-block
|
||||||
color #fff
|
width 38px
|
||||||
|
height 38px
|
||||||
|
vertical-align top
|
||||||
|
border-radius 6px
|
||||||
|
|
||||||
> small
|
> footer
|
||||||
display block
|
text-align center
|
||||||
margin 16px 0 0 0
|
color #fff
|
||||||
opacity 0.7
|
|
||||||
|
> small
|
||||||
|
display block
|
||||||
|
margin 16px 0 0 0
|
||||||
|
opacity 0.7
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="stylus">
|
|
||||||
html
|
|
||||||
body
|
|
||||||
background linear-gradient(to bottom, #1e1d65, #bd6659)
|
|
||||||
</style>
|
|
||||||
|
@ -40,6 +40,12 @@ export type Source = {
|
|||||||
site_key: string;
|
site_key: string;
|
||||||
secret_key: string;
|
secret_key: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ゴーストアカウントのID
|
||||||
|
*/
|
||||||
|
ghost?: string;
|
||||||
|
|
||||||
accesslog?: string;
|
accesslog?: string;
|
||||||
twitter?: {
|
twitter?: {
|
||||||
consumer_key: string;
|
consumer_key: string;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as mongo from 'mongodb';
|
import * as mongo from 'mongodb';
|
||||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
|
import $ from 'cafy';
|
||||||
import deepcopy = require('deepcopy');
|
import deepcopy = require('deepcopy');
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
import Reaction from './note-reaction';
|
import Reaction from './note-reaction';
|
||||||
|
@ -37,7 +37,7 @@ export default User;
|
|||||||
type IUserBase = {
|
type IUserBase = {
|
||||||
_id: mongo.ObjectID;
|
_id: mongo.ObjectID;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
deletedAt: Date;
|
deletedAt?: Date;
|
||||||
followersCount: number;
|
followersCount: number;
|
||||||
followingCount: number;
|
followingCount: number;
|
||||||
name?: string;
|
name?: string;
|
||||||
@ -51,7 +51,6 @@ type IUserBase = {
|
|||||||
description: string;
|
description: string;
|
||||||
pinnedNoteId: mongo.ObjectID;
|
pinnedNoteId: mongo.ObjectID;
|
||||||
isSuspended: boolean;
|
isSuspended: boolean;
|
||||||
keywords: string[];
|
|
||||||
host: string;
|
host: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ export interface ILocalUser extends IUserBase {
|
|||||||
isPro: boolean;
|
isPro: boolean;
|
||||||
twoFactorSecret: string;
|
twoFactorSecret: string;
|
||||||
twoFactorEnabled: boolean;
|
twoFactorEnabled: boolean;
|
||||||
twoFactorTempSecret: string;
|
twoFactorTempSecret?: string;
|
||||||
clientSettings: any;
|
clientSettings: any;
|
||||||
settings: any;
|
settings: any;
|
||||||
}
|
}
|
||||||
@ -459,3 +458,7 @@ function img(url) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export function getGhost(): Promise<ILocalUser> {
|
||||||
|
return User.findOne({ _id: new mongo.ObjectId(config.ghost) });
|
||||||
|
}
|
||||||
|
@ -9,7 +9,7 @@ import Note from '../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = params => new Promise(async (res, rej) => {
|
module.exports = params => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
const datas = await Note
|
const datas = await Note
|
||||||
|
@ -9,7 +9,7 @@ import User from '../../../../models/user';
|
|||||||
*/
|
*/
|
||||||
module.exports = params => new Promise(async (res, rej) => {
|
module.exports = params => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
const users = await User
|
const users = await User
|
||||||
|
@ -12,11 +12,11 @@ import Note from '../../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
|
@ -10,7 +10,7 @@ import FollowedLog from '../../../../../models/followed-log';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
|
@ -10,7 +10,7 @@ import FollowingLog from '../../../../../models/following-log';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
|
@ -13,7 +13,7 @@ import Reaction from '../../../../../models/note-reaction';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
|
@ -67,24 +67,24 @@ import App, { isValidNameId, pack } from '../../../../models/app';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'nameId' parameter
|
// 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');
|
if (nameIdErr) return rej('invalid nameId param');
|
||||||
|
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $(params.name).string().$;
|
const [name, nameErr] = $(params.name).string().get();
|
||||||
if (nameErr) return rej('invalid name param');
|
if (nameErr) return rej('invalid name param');
|
||||||
|
|
||||||
// Get 'description' parameter
|
// Get 'description' parameter
|
||||||
const [description, descriptionErr] = $(params.description).string().$;
|
const [description, descriptionErr] = $(params.description).string().get();
|
||||||
if (descriptionErr) return rej('invalid description param');
|
if (descriptionErr) return rej('invalid description param');
|
||||||
|
|
||||||
// Get 'permission' parameter
|
// 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');
|
if (permissionErr) return rej('invalid permission param');
|
||||||
|
|
||||||
// Get 'callbackUrl' parameter
|
// Get 'callbackUrl' parameter
|
||||||
// TODO: Check it is valid url
|
// 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');
|
if (callbackUrlErr) return rej('invalid callbackUrl param');
|
||||||
|
|
||||||
// Generate secret
|
// Generate secret
|
||||||
|
@ -42,7 +42,7 @@ import { isValidNameId } from '../../../../../models/app';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params) => new Promise(async (res, rej) => {
|
module.exports = async (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'nameId' parameter
|
// 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');
|
if (nameIdErr) return rej('invalid nameId param');
|
||||||
|
|
||||||
// Get exist
|
// Get exist
|
||||||
|
@ -41,11 +41,11 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
|||||||
const isSecure = user != null && app == null;
|
const isSecure = user != null && app == null;
|
||||||
|
|
||||||
// Get 'appId' parameter
|
// 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');
|
if (appIdErr) return rej('invalid appId param');
|
||||||
|
|
||||||
// Get 'nameId' parameter
|
// 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 (nameIdErr) return rej('invalid nameId param');
|
||||||
|
|
||||||
if (appId === undefined && nameId === undefined) {
|
if (appId === undefined && nameId === undefined) {
|
||||||
|
@ -40,7 +40,7 @@ import AccessToken from '../../../../models/access-token';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'token' parameter
|
// Get 'token' parameter
|
||||||
const [token, tokenErr] = $(params.token).string().$;
|
const [token, tokenErr] = $(params.token).string().get();
|
||||||
if (tokenErr) return rej('invalid token param');
|
if (tokenErr) return rej('invalid token param');
|
||||||
|
|
||||||
// Fetch token
|
// Fetch token
|
||||||
|
@ -46,7 +46,7 @@ import config from '../../../../../config';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'appSecret' parameter
|
// Get 'appSecret' parameter
|
||||||
const [appSecret, appSecretErr] = $(params.appSecret).string().$;
|
const [appSecret, appSecretErr] = $(params.appSecret).string().get();
|
||||||
if (appSecretErr) return rej('invalid appSecret param');
|
if (appSecretErr) return rej('invalid appSecret param');
|
||||||
|
|
||||||
// Lookup app
|
// Lookup app
|
||||||
|
@ -53,7 +53,7 @@ import AuthSess, { pack } from '../../../../../models/auth-session';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'token' parameter
|
// Get 'token' parameter
|
||||||
const [token, tokenErr] = $(params.token).string().$;
|
const [token, tokenErr] = $(params.token).string().get();
|
||||||
if (tokenErr) return rej('invalid token param');
|
if (tokenErr) return rej('invalid token param');
|
||||||
|
|
||||||
// Lookup session
|
// Lookup session
|
||||||
|
@ -51,7 +51,7 @@ import { pack } from '../../../../../models/user';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'appSecret' parameter
|
// Get 'appSecret' parameter
|
||||||
const [appSecret, appSecretErr] = $(params.appSecret).string().$;
|
const [appSecret, appSecretErr] = $(params.appSecret).string().get();
|
||||||
if (appSecretErr) return rej('invalid appSecret param');
|
if (appSecretErr) return rej('invalid appSecret param');
|
||||||
|
|
||||||
// Lookup app
|
// Lookup app
|
||||||
@ -64,7 +64,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'token' parameter
|
// Get 'token' parameter
|
||||||
const [token, tokenErr] = $(params.token).string().$;
|
const [token, tokenErr] = $(params.token).string().get();
|
||||||
if (tokenErr) return rej('invalid token param');
|
if (tokenErr) return rej('invalid token param');
|
||||||
|
|
||||||
// Fetch token
|
// Fetch token
|
||||||
|
@ -13,15 +13,15 @@ import Channel, { pack } from '../../../models/channel';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, me) => new Promise(async (res, rej) => {
|
module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
@ -11,7 +11,7 @@ import { pack } from '../../../../models/channel';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'title' parameter
|
// 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');
|
if (titleErr) return rej('invalid title param');
|
||||||
|
|
||||||
// Create a channel
|
// Create a channel
|
||||||
|
@ -10,15 +10,15 @@ import Note, { pack } from '../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// 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
|
// 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');
|
if (channelIdErr) return rej('invalid channelId param');
|
||||||
|
|
||||||
// Fetch channel
|
// Fetch channel
|
||||||
|
@ -9,7 +9,7 @@ import Channel, { IChannel, pack } from '../../../../models/channel';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'channelId' parameter
|
// 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');
|
if (channelIdErr) return rej('invalid channelId param');
|
||||||
|
|
||||||
// Fetch channel
|
// Fetch channel
|
||||||
|
@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'channelId' parameter
|
// 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');
|
if (channelIdErr) return rej('invalid channelId param');
|
||||||
|
|
||||||
//#region Fetch channel
|
//#region Fetch channel
|
||||||
|
@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'channelId' parameter
|
// 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');
|
if (channelIdErr) return rej('invalid channelId param');
|
||||||
|
|
||||||
//#region Fetch channel
|
//#region Fetch channel
|
||||||
|
@ -9,15 +9,15 @@ import DriveFile, { pack } from '../../../../models/drive-file';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user, app) => {
|
module.exports = async (params, user, app) => {
|
||||||
// Get 'limit' parameter
|
// 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';
|
if (limitErr) throw 'invalid limit param';
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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';
|
if (sinceIdErr) throw 'invalid sinceId param';
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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';
|
if (untilIdErr) throw 'invalid untilId param';
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
@ -26,11 +26,11 @@ module.exports = async (params, user, app) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'folderId' parameter
|
// 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';
|
if (folderIdErr) throw 'invalid folderId param';
|
||||||
|
|
||||||
// Get 'type' parameter
|
// 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';
|
if (typeErr) throw 'invalid type param';
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
|
@ -29,7 +29,7 @@ module.exports = async (file, params, user): Promise<any> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'folderId' parameter
|
// 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';
|
if (folderIdErr) throw 'invalid folderId param';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -9,11 +9,11 @@ import DriveFile, { pack } from '../../../../../models/drive-file';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $(params.name).string().$;
|
const [name, nameErr] = $(params.name).string().get();
|
||||||
if (nameErr) return rej('invalid name param');
|
if (nameErr) return rej('invalid name param');
|
||||||
|
|
||||||
// Get 'folderId' parameter
|
// 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');
|
if (folderIdErr) return rej('invalid folderId param');
|
||||||
|
|
||||||
// Issue query
|
// Issue query
|
||||||
|
@ -9,7 +9,7 @@ import DriveFile, { pack } from '../../../../../models/drive-file';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user) => {
|
module.exports = async (params, user) => {
|
||||||
// Get 'fileId' parameter
|
// Get 'fileId' parameter
|
||||||
const [fileId, fileIdErr] = $(params.fileId).type(ID).$;
|
const [fileId, fileIdErr] = $(params.fileId).type(ID).get();
|
||||||
if (fileIdErr) throw 'invalid fileId param';
|
if (fileIdErr) throw 'invalid fileId param';
|
||||||
|
|
||||||
// Fetch file
|
// Fetch file
|
||||||
|
@ -11,7 +11,7 @@ import { publishDriveStream } from '../../../../../publishers/stream';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'fileId' parameter
|
// 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');
|
if (fileIdErr) return rej('invalid fileId param');
|
||||||
|
|
||||||
// Fetch file
|
// Fetch file
|
||||||
@ -26,12 +26,12 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'name' parameter
|
// 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 (nameErr) return rej('invalid name param');
|
||||||
if (name) file.filename = name;
|
if (name) file.filename = name;
|
||||||
|
|
||||||
// Get 'folderId' parameter
|
// 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 (folderIdErr) return rej('invalid folderId param');
|
||||||
|
|
||||||
if (folderId !== undefined) {
|
if (folderId !== undefined) {
|
||||||
|
@ -11,11 +11,11 @@ import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
|||||||
module.exports = async (params, user): Promise<any> => {
|
module.exports = async (params, user): Promise<any> => {
|
||||||
// Get 'url' parameter
|
// Get 'url' parameter
|
||||||
// TODO: Validate this url
|
// TODO: Validate this url
|
||||||
const [url, urlErr] = $(params.url).string().$;
|
const [url, urlErr] = $(params.url).string().get();
|
||||||
if (urlErr) throw 'invalid url param';
|
if (urlErr) throw 'invalid url param';
|
||||||
|
|
||||||
// Get 'folderId' parameter
|
// 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';
|
if (folderIdErr) throw 'invalid folderId param';
|
||||||
|
|
||||||
return pack(await uploadFromUrl(url, user, folderId));
|
return pack(await uploadFromUrl(url, user, folderId));
|
||||||
|
@ -9,15 +9,15 @@ import DriveFolder, { pack } from '../../../../models/drive-folder';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// 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
|
// 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');
|
if (folderIdErr) return rej('invalid folderId param');
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
|
@ -10,11 +10,11 @@ import { publishDriveStream } from '../../../../../publishers/stream';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// 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 (nameErr) return rej('invalid name param');
|
||||||
|
|
||||||
// Get 'parentId' parameter
|
// 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 (parentIdErr) return rej('invalid parentId param');
|
||||||
|
|
||||||
// If the parent folder is specified
|
// If the parent folder is specified
|
||||||
|
@ -9,11 +9,11 @@ import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $(params.name).string().$;
|
const [name, nameErr] = $(params.name).string().get();
|
||||||
if (nameErr) return rej('invalid name param');
|
if (nameErr) return rej('invalid name param');
|
||||||
|
|
||||||
// Get 'parentId' parameter
|
// 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 (parentIdErr) return rej('invalid parentId param');
|
||||||
|
|
||||||
// Issue query
|
// Issue query
|
||||||
|
@ -9,7 +9,7 @@ import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'folderId' parameter
|
// 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');
|
if (folderIdErr) return rej('invalid folderId param');
|
||||||
|
|
||||||
// Get folder
|
// Get folder
|
||||||
|
@ -10,7 +10,7 @@ import { publishDriveStream } from '../../../../../publishers/stream';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'folderId' parameter
|
// 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');
|
if (folderIdErr) return rej('invalid folderId param');
|
||||||
|
|
||||||
// Fetch folder
|
// Fetch folder
|
||||||
@ -25,12 +25,12 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'name' parameter
|
// 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 (nameErr) return rej('invalid name param');
|
||||||
if (name) folder.name = name;
|
if (name) folder.name = name;
|
||||||
|
|
||||||
// Get 'parentId' parameter
|
// 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 (parentIdErr) return rej('invalid parentId param');
|
||||||
if (parentId !== undefined) {
|
if (parentId !== undefined) {
|
||||||
if (parentId === null) {
|
if (parentId === null) {
|
||||||
|
@ -9,15 +9,15 @@ import DriveFile, { pack } from '../../../../models/drive-file';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// 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
|
// 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');
|
if (typeErr) return rej('invalid type param');
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
|
@ -13,7 +13,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// 自分自身
|
// 自分自身
|
||||||
|
@ -13,7 +13,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Check if the followee is yourself
|
// Check if the followee is yourself
|
||||||
|
@ -8,7 +8,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Fetch following
|
// Fetch following
|
||||||
|
@ -8,7 +8,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Fetch following
|
// Fetch following
|
||||||
|
@ -7,7 +7,7 @@ import User from '../../../../../models/user';
|
|||||||
|
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'token' parameter
|
// Get 'token' parameter
|
||||||
const [token, tokenErr] = $(params.token).string().$;
|
const [token, tokenErr] = $(params.token).string().get();
|
||||||
if (tokenErr) return rej('invalid token param');
|
if (tokenErr) return rej('invalid token param');
|
||||||
|
|
||||||
const _token = token.replace(/\s/g, '');
|
const _token = token.replace(/\s/g, '');
|
||||||
|
@ -10,7 +10,7 @@ import config from '../../../../../config';
|
|||||||
|
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'password' parameter
|
// Get 'password' parameter
|
||||||
const [password, passwordErr] = $(params.password).string().$;
|
const [password, passwordErr] = $(params.password).string().get();
|
||||||
if (passwordErr) return rej('invalid password param');
|
if (passwordErr) return rej('invalid password param');
|
||||||
|
|
||||||
// Compare password
|
// Compare password
|
||||||
|
@ -7,7 +7,7 @@ import User from '../../../../../models/user';
|
|||||||
|
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'password' parameter
|
// Get 'password' parameter
|
||||||
const [password, passwordErr] = $(params.password).string().$;
|
const [password, passwordErr] = $(params.password).string().get();
|
||||||
if (passwordErr) return rej('invalid password param');
|
if (passwordErr) return rej('invalid password param');
|
||||||
|
|
||||||
// Compare password
|
// Compare password
|
||||||
|
@ -10,15 +10,15 @@ import { pack } from '../../../../models/app';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'offset' parameter
|
// 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');
|
if (offsetErr) return rej('invalid offset param');
|
||||||
|
|
||||||
// Get 'sort' parameter
|
// 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');
|
if (sortError) return rej('invalid sort param');
|
||||||
|
|
||||||
// Get tokens
|
// Get tokens
|
||||||
|
@ -10,11 +10,11 @@ import User from '../../../../models/user';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'currentPasword' parameter
|
// Get 'currentPasword' parameter
|
||||||
const [currentPassword, currentPasswordErr] = $(params.currentPasword).string().$;
|
const [currentPassword, currentPasswordErr] = $(params.currentPasword).string().get();
|
||||||
if (currentPasswordErr) return rej('invalid currentPasword param');
|
if (currentPasswordErr) return rej('invalid currentPasword param');
|
||||||
|
|
||||||
// Get 'newPassword' parameter
|
// Get 'newPassword' parameter
|
||||||
const [newPassword, newPasswordErr] = $(params.newPassword).string().$;
|
const [newPassword, newPasswordErr] = $(params.newPassword).string().get();
|
||||||
if (newPasswordErr) return rej('invalid newPassword param');
|
if (newPasswordErr) return rej('invalid newPassword param');
|
||||||
|
|
||||||
// Compare password
|
// Compare password
|
||||||
|
@ -9,15 +9,15 @@ import Favorite, { pack } from '../../../../models/favorite';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
@ -14,27 +14,27 @@ import read from '../../common/read-notification';
|
|||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'following' parameter
|
// Get 'following' parameter
|
||||||
const [following = false, followingError] =
|
const [following = false, followingError] =
|
||||||
$(params.following).optional.boolean().$;
|
$(params.following).optional.boolean().get();
|
||||||
if (followingError) return rej('invalid following param');
|
if (followingError) return rej('invalid following param');
|
||||||
|
|
||||||
// Get 'markAsRead' parameter
|
// 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');
|
if (markAsReadErr) return rej('invalid markAsRead param');
|
||||||
|
|
||||||
// Get 'type' parameter
|
// 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');
|
if (typeErr) return rej('invalid type param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
@ -11,7 +11,7 @@ import { pack } from '../../../../models/user';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Fetch pinee
|
// Fetch pinee
|
||||||
|
@ -12,7 +12,7 @@ import generateUserToken from '../../common/generate-native-user-token';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'password' parameter
|
// Get 'password' parameter
|
||||||
const [password, passwordErr] = $(params.password).string().$;
|
const [password, passwordErr] = $(params.password).string().get();
|
||||||
if (passwordErr) return rej('invalid password param');
|
if (passwordErr) return rej('invalid password param');
|
||||||
|
|
||||||
// Compare password
|
// Compare password
|
||||||
|
@ -9,15 +9,15 @@ import Signin, { pack } from '../../../../models/signin';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
@ -12,42 +12,42 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
|
|||||||
const isSecure = user != null && app == null;
|
const isSecure = user != null && app == null;
|
||||||
|
|
||||||
// Get 'name' parameter
|
// 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 (nameErr) return rej('invalid name param');
|
||||||
if (name) user.name = name;
|
if (name) user.name = name;
|
||||||
|
|
||||||
// Get 'description' parameter
|
// 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 (descriptionErr) return rej('invalid description param');
|
||||||
if (description !== undefined) user.description = description;
|
if (description !== undefined) user.description = description;
|
||||||
|
|
||||||
// Get 'location' parameter
|
// 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 (locationErr) return rej('invalid location param');
|
||||||
if (location !== undefined) user.profile.location = location;
|
if (location !== undefined) user.profile.location = location;
|
||||||
|
|
||||||
// Get 'birthday' parameter
|
// 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 (birthdayErr) return rej('invalid birthday param');
|
||||||
if (birthday !== undefined) user.profile.birthday = birthday;
|
if (birthday !== undefined) user.profile.birthday = birthday;
|
||||||
|
|
||||||
// Get 'avatarId' parameter
|
// 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 (avatarIdErr) return rej('invalid avatarId param');
|
||||||
if (avatarId) user.avatarId = avatarId;
|
if (avatarId) user.avatarId = avatarId;
|
||||||
|
|
||||||
// Get 'bannerId' parameter
|
// 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 (bannerIdErr) return rej('invalid bannerId param');
|
||||||
if (bannerId) user.bannerId = bannerId;
|
if (bannerId) user.bannerId = bannerId;
|
||||||
|
|
||||||
// Get 'isBot' parameter
|
// 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 (isBotErr) return rej('invalid isBot param');
|
||||||
if (isBot != null) user.isBot = isBot;
|
if (isBot != null) user.isBot = isBot;
|
||||||
|
|
||||||
// Get 'autoWatch' parameter
|
// 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 (autoWatchErr) return rej('invalid autoWatch param');
|
||||||
if (autoWatch != null) user.settings.autoWatch = autoWatch;
|
if (autoWatch != null) user.settings.autoWatch = autoWatch;
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@ import event from '../../../../publishers/stream';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $(params.name).string().$;
|
const [name, nameErr] = $(params.name).string().get();
|
||||||
if (nameErr) return rej('invalid name param');
|
if (nameErr) return rej('invalid name param');
|
||||||
|
|
||||||
// Get 'value' parameter
|
// 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');
|
if (valueErr) return rej('invalid value param');
|
||||||
|
|
||||||
const x = {};
|
const x = {};
|
||||||
|
@ -12,15 +12,15 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
|
|||||||
.have('name', $().string())
|
.have('name', $().string())
|
||||||
.have('id', $().string())
|
.have('id', $().string())
|
||||||
.have('place', $().string())
|
.have('place', $().string())
|
||||||
.have('data', $().object())).$;
|
.have('data', $().object())).get();
|
||||||
if (homeErr) return rej('invalid home param');
|
if (homeErr) return rej('invalid home param');
|
||||||
|
|
||||||
// Get 'id' parameter
|
// 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');
|
if (idErr) return rej('invalid id param');
|
||||||
|
|
||||||
// Get 'data' parameter
|
// 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 (dataErr) return rej('invalid data param');
|
||||||
|
|
||||||
if (home) {
|
if (home) {
|
||||||
|
@ -11,15 +11,15 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
|
|||||||
$().object(true)
|
$().object(true)
|
||||||
.have('name', $().string())
|
.have('name', $().string())
|
||||||
.have('id', $().string())
|
.have('id', $().string())
|
||||||
.have('data', $().object())).$;
|
.have('data', $().object())).get();
|
||||||
if (homeErr) return rej('invalid home param');
|
if (homeErr) return rej('invalid home param');
|
||||||
|
|
||||||
// Get 'id' parameter
|
// 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');
|
if (idErr) return rej('invalid id param');
|
||||||
|
|
||||||
// Get 'data' parameter
|
// 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 (dataErr) return rej('invalid data param');
|
||||||
|
|
||||||
if (home) {
|
if (home) {
|
||||||
|
@ -11,7 +11,7 @@ import { pack } from '../../../../models/messaging-message';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
const mute = await Mute.find({
|
const mute = await Mute.find({
|
||||||
|
@ -16,7 +16,7 @@ import read from '../../common/read-messaging-message';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (recipientIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Fetch recipient
|
// Fetch recipient
|
||||||
@ -33,19 +33,19 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'markAsRead' parameter
|
// 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');
|
if (markAsReadErr) return rej('invalid markAsRead param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
@ -19,7 +19,7 @@ import config from '../../../../../config';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (recipientIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Myself
|
// Myself
|
||||||
@ -41,11 +41,11 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'text' parameter
|
// 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');
|
if (textErr) return rej('invalid text');
|
||||||
|
|
||||||
// Get 'fileId' parameter
|
// 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');
|
if (fileIdErr) return rej('invalid fileId param');
|
||||||
|
|
||||||
let file = null;
|
let file = null;
|
||||||
|
@ -12,7 +12,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const muter = user;
|
const muter = user;
|
||||||
|
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// 自分自身
|
// 自分自身
|
||||||
|
@ -12,7 +12,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const muter = user;
|
const muter = user;
|
||||||
|
|
||||||
// Get 'userId' parameter
|
// 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');
|
if (userIdErr) return rej('invalid userId param');
|
||||||
|
|
||||||
// Check if the mutee is yourself
|
// Check if the mutee is yourself
|
||||||
|
@ -11,15 +11,15 @@ import { getFriendIds } from '../../common/get-friends';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, me) => new Promise(async (res, rej) => {
|
module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||||
// Get 'iknow' parameter
|
// 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');
|
if (iknowErr) return rej('invalid iknow param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'cursor' parameter
|
// 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');
|
if (cursorErr) return rej('invalid cursor param');
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
|
@ -9,11 +9,11 @@ import App, { pack } from '../../../../models/app';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'offset' parameter
|
// 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');
|
if (offsetErr) return rej('invalid offset param');
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
|
@ -9,35 +9,35 @@ import Note, { pack } from '../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params) => new Promise(async (res, rej) => {
|
module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
// Get 'reply' parameter
|
// 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');
|
if (replyErr) return rej('invalid reply param');
|
||||||
|
|
||||||
// Get 'renote' parameter
|
// 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');
|
if (renoteErr) return rej('invalid renote param');
|
||||||
|
|
||||||
// Get 'media' parameter
|
// 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');
|
if (mediaErr) return rej('invalid media param');
|
||||||
|
|
||||||
// Get 'poll' parameter
|
// 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');
|
if (pollErr) return rej('invalid poll param');
|
||||||
|
|
||||||
// Get 'bot' parameter
|
// 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');
|
//if (botErr) return rej('invalid bot param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
@ -13,15 +13,15 @@ import Note, { pack } from '../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'offset' parameter
|
// 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');
|
if (offsetErr) return rej('invalid offset param');
|
||||||
|
|
||||||
// Lookup note
|
// Lookup note
|
||||||
|
@ -14,23 +14,23 @@ import { IApp } from '../../../../models/app';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
|
module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
|
||||||
// Get 'visibility' parameter
|
// 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');
|
if (visibilityErr) return rej('invalid visibility');
|
||||||
|
|
||||||
// Get 'text' parameter
|
// 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');
|
if (textErr) return rej('invalid text');
|
||||||
|
|
||||||
// Get 'cw' parameter
|
// 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');
|
if (cwErr) return rej('invalid cw');
|
||||||
|
|
||||||
// Get 'viaMobile' parameter
|
// 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');
|
if (viaMobileErr) return rej('invalid viaMobile');
|
||||||
|
|
||||||
// Get 'tags' parameter
|
// 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');
|
if (tagsErr) return rej('invalid tags');
|
||||||
|
|
||||||
// Get 'geo' parameter
|
// Get 'geo' parameter
|
||||||
@ -43,11 +43,11 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
|||||||
.have('altitudeAccuracy', $().nullable.number())
|
.have('altitudeAccuracy', $().nullable.number())
|
||||||
.have('heading', $().nullable.number().range(0, 360))
|
.have('heading', $().nullable.number().range(0, 360))
|
||||||
.have('speed', $().nullable.number())
|
.have('speed', $().nullable.number())
|
||||||
.$;
|
.get();
|
||||||
if (geoErr) return rej('invalid geo');
|
if (geoErr) return rej('invalid geo');
|
||||||
|
|
||||||
// Get 'mediaIds' parameter
|
// 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');
|
if (mediaIdsErr) return rej('invalid mediaIds');
|
||||||
|
|
||||||
let files = [];
|
let files = [];
|
||||||
@ -74,7 +74,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'renoteId' parameter
|
// 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');
|
if (renoteIdErr) return rej('invalid renoteId');
|
||||||
|
|
||||||
let renote: INote = null;
|
let renote: INote = null;
|
||||||
@ -95,7 +95,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'replyId' parameter
|
// 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');
|
if (replyIdErr) return rej('invalid replyId');
|
||||||
|
|
||||||
let reply: INote = null;
|
let reply: INote = null;
|
||||||
@ -116,7 +116,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get 'channelId' parameter
|
// 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');
|
if (channelIdErr) return rej('invalid channelId');
|
||||||
|
|
||||||
let channel: IChannel = null;
|
let channel: IChannel = null;
|
||||||
@ -162,7 +162,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
|
|||||||
.unique()
|
.unique()
|
||||||
.range(2, 10)
|
.range(2, 10)
|
||||||
.each(c => c.length > 0 && c.length < 50))
|
.each(c => c.length > 0 && c.length < 50))
|
||||||
.$;
|
.get();
|
||||||
if (pollErr) return rej('invalid poll');
|
if (pollErr) return rej('invalid poll');
|
||||||
|
|
||||||
if (poll) {
|
if (poll) {
|
||||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get favoritee
|
// Get favoritee
|
||||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get favoritee
|
// Get favoritee
|
||||||
|
@ -11,23 +11,23 @@ import { pack } from '../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user, app) => {
|
module.exports = async (params, user, app) => {
|
||||||
// Get 'limit' parameter
|
// 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';
|
if (limitErr) throw 'invalid limit param';
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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';
|
if (sinceIdErr) throw 'invalid sinceId param';
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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';
|
if (untilIdErr) throw 'invalid untilId param';
|
||||||
|
|
||||||
// Get 'sinceDate' parameter
|
// Get 'sinceDate' parameter
|
||||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
|
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
|
||||||
if (sinceDateErr) throw 'invalid sinceDate param';
|
if (sinceDateErr) throw 'invalid sinceDate param';
|
||||||
|
|
||||||
// Get 'untilDate' parameter
|
// Get 'untilDate' parameter
|
||||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
|
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
|
||||||
if (untilDateErr) throw 'invalid untilDate param';
|
if (untilDateErr) throw 'invalid untilDate param';
|
||||||
|
|
||||||
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
||||||
|
@ -11,23 +11,23 @@ import { pack } from '../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = async (params, user, app) => {
|
module.exports = async (params, user, app) => {
|
||||||
// Get 'limit' parameter
|
// 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';
|
if (limitErr) throw 'invalid limit param';
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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';
|
if (sinceIdErr) throw 'invalid sinceId param';
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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';
|
if (untilIdErr) throw 'invalid untilId param';
|
||||||
|
|
||||||
// Get 'sinceDate' parameter
|
// Get 'sinceDate' parameter
|
||||||
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
|
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().get();
|
||||||
if (sinceDateErr) throw 'invalid sinceDate param';
|
if (sinceDateErr) throw 'invalid sinceDate param';
|
||||||
|
|
||||||
// Get 'untilDate' parameter
|
// Get 'untilDate' parameter
|
||||||
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
|
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().get();
|
||||||
if (untilDateErr) throw 'invalid untilDate param';
|
if (untilDateErr) throw 'invalid untilDate param';
|
||||||
|
|
||||||
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
|
||||||
|
@ -16,19 +16,19 @@ import { pack } from '../../../../models/note';
|
|||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'following' parameter
|
// Get 'following' parameter
|
||||||
const [following = false, followingError] =
|
const [following = false, followingError] =
|
||||||
$(params.following).optional.boolean().$;
|
$(params.following).optional.boolean().get();
|
||||||
if (followingError) return rej('invalid following param');
|
if (followingError) return rej('invalid following param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
@ -10,11 +10,11 @@ import Note, { pack } from '../../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'offset' parameter
|
// 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');
|
if (offsetErr) return rej('invalid offset param');
|
||||||
|
|
||||||
// Get votes
|
// Get votes
|
||||||
|
@ -14,7 +14,7 @@ import notify from '../../../../../publishers/notify';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get votee
|
// Get votee
|
||||||
@ -34,7 +34,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const [choice, choiceError] =
|
const [choice, choiceError] =
|
||||||
$(params.choice).number()
|
$(params.choice).number()
|
||||||
.pipe(c => note.poll.choices.some(x => x.id == c))
|
.pipe(c => note.poll.choices.some(x => x.id == c))
|
||||||
.$;
|
.get();
|
||||||
if (choiceError) return rej('invalid choice param');
|
if (choiceError) return rej('invalid choice param');
|
||||||
|
|
||||||
// if already voted
|
// if already voted
|
||||||
|
@ -14,19 +14,19 @@ import Reaction, { pack } from '../../../../models/note-reaction';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'offset' parameter
|
// 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');
|
if (offsetErr) return rej('invalid offset param');
|
||||||
|
|
||||||
// Get 'sort' parameter
|
// 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');
|
if (sortError) return rej('invalid sort param');
|
||||||
|
|
||||||
// Lookup note
|
// Lookup note
|
||||||
|
@ -11,11 +11,11 @@ import { validateReaction } from '../../../../../models/note-reaction';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get 'reaction' parameter
|
// 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');
|
if (reactionErr) return rej('invalid reaction param');
|
||||||
|
|
||||||
// Fetch reactee
|
// Fetch reactee
|
||||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Fetch unreactee
|
// Fetch unreactee
|
||||||
|
@ -13,19 +13,19 @@ import Note, { pack } from '../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'offset' parameter
|
// 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');
|
if (offsetErr) return rej('invalid offset param');
|
||||||
|
|
||||||
// Get 'sort' parameter
|
// 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');
|
if (sortError) return rej('invalid sort param');
|
||||||
|
|
||||||
// Lookup note
|
// Lookup note
|
||||||
|
@ -13,19 +13,19 @@ import Note, { pack } from '../../../../models/note';
|
|||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// 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');
|
if (noteIdErr) return rej('invalid noteId param');
|
||||||
|
|
||||||
// Get 'limit' parameter
|
// 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');
|
if (limitErr) return rej('invalid limit param');
|
||||||
|
|
||||||
// Get 'sinceId' parameter
|
// 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');
|
if (sinceIdErr) return rej('invalid sinceId param');
|
||||||
|
|
||||||
// Get 'untilId' parameter
|
// 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');
|
if (untilIdErr) return rej('invalid untilId param');
|
||||||
|
|
||||||
// Check if both of sinceId and untilId is specified
|
// Check if both of sinceId and untilId is specified
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user