Compare commits

...

18 Commits
1.0.0 ... 1.3.0

Author SHA1 Message Date
985a105930 1.3.0 2018-04-28 12:05:39 +09:00
52560dd986 🎨 2018-04-28 12:04:31 +09:00
de81502fdf 🎨 2018-04-28 12:00:58 +09:00
51876bac62 🎨 2018-04-28 10:59:37 +09:00
a5b994259e Fix bug 2018-04-28 10:27:53 +09:00
c85c825bad 🎨 2018-04-28 10:27:43 +09:00
1cd1c31467 1.2.0 2018-04-28 02:30:27 +09:00
8984e3131d モバイル版のダークモード
など
2018-04-28 02:29:17 +09:00
93fa28991e 🎨 2018-04-28 00:47:52 +09:00
b694bf1f41 1.1.0 2018-04-27 21:37:00 +09:00
0bbfbfc762 Merge pull request #1558 from syuilo/better-mobile-design
Better mobile design
2018-04-27 21:34:03 +09:00
319f525199 wip 2018-04-27 21:33:18 +09:00
ee62f6e356 wip 2018-04-27 21:06:28 +09:00
0f27b62924 Update dependencies 🚀 2018-04-27 19:12:15 +09:00
6274f6f2f6 Update README.md 2018-04-27 10:36:05 +09:00
32da569ef6 #1029 2018-04-26 20:30:49 +09:00
1625fdc2f4 ✌️ 2018-04-26 20:22:51 +09:00
a0795b1afe Fix #1552 2018-04-26 18:24:14 +09:00
135 changed files with 951 additions and 807 deletions

View File

@ -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/.

View File

@ -1,8 +1,8 @@
{ {
"name": "misskey", "name": "misskey",
"author": "syuilo <i@syuilo.com>", "author": "syuilo <i@syuilo.com>",
"version": "1.0.0", "version": "1.3.0",
"clientVersion": "1.0.0", "clientVersion": "1.0.5139",
"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"
} }

View File

@ -120,7 +120,7 @@ root(isDark)
z-index 10000 z-index 10000
width 100% width 100%
height 100% height 100%
background rgba(0, 0, 0, 0.1) background isDark ? rgba(#000, 0.4) : rgba(#000, 0.1)
opacity 0 opacity 0
> .popover > .popover

View File

@ -16,7 +16,9 @@
</div> </div>
</header> </header>
<div class="body"> <div class="body">
<mk-note-html v-if="note.text" :text="note.text" :i="os.i" :class="$style.text"/> <div class="text">
<mk-note-html v-if="note.text" :text="note.text" :i="os.i"/>
</div>
<div class="media" v-if="note.mediaIds.length > 0"> <div class="media" v-if="note.mediaIds.length > 0">
<mk-media-list :media-list="note.media"/> <mk-media-list :media-list="note.media"/>
</div> </div>
@ -40,10 +42,10 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.sub root(isDark)
margin 0 margin 0
padding 20px 32px padding 20px 32px
background #fdfdfd background isDark ? #21242d : #fdfdfd
&:after &:after
content "" content ""
@ -87,7 +89,7 @@ export default Vue.extend({
display inline display inline
margin 0 margin 0
padding 0 padding 0
color #777 color isDark ? #fff : #777
font-size 1em font-size 1em
font-weight 700 font-weight 700
text-align left text-align left
@ -99,24 +101,29 @@ export default Vue.extend({
> .username > .username
text-align left text-align left
margin 0 0 0 8px margin 0 0 0 8px
color #ccc color isDark ? #606984 : #ccc
> .right > .right
float right float right
> .time > .time
font-size 0.9em font-size 0.9em
color #c0c0c0 color isDark ? #606984 : #c0c0c0
</style> > .body
> .text
<style lang="stylus" module>
.text
cursor default cursor default
display block display block
margin 0 margin 0
padding 0 padding 0
overflow-wrap break-word overflow-wrap break-word
font-size 1em font-size 1em
color #717171 color isDark ? #959ba7 : #717171
.sub[data-darkmode]
root(true)
.sub:not([data-darkmode])
root(false)
</style> </style>

View File

@ -38,7 +38,9 @@
</router-link> </router-link>
</header> </header>
<div class="body"> <div class="body">
<mk-note-html :class="$style.text" v-if="p.text" :text="p.text" :i="os.i"/> <div class="text">
<mk-note-html v-if="p.text" :text="p.text" :i="os.i"/>
</div>
<div class="media" v-if="p.media.length > 0"> <div class="media" v-if="p.media.length > 0">
<mk-media-list :media-list="p.media"/> <mk-media-list :media-list="p.media"/>
</div> </div>
@ -214,12 +216,12 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
@import '~const.styl' @import '~const.styl'
.mk-note-detail root(isDark)
margin 0 margin 0 auto
padding 0 padding 0
overflow hidden overflow hidden
text-align left text-align left
background #fff background isDark ? #282C37 : #fff
border solid 1px rgba(0, 0, 0, 0.1) border solid 1px rgba(0, 0, 0, 0.1)
border-radius 8px border-radius 8px
@ -232,28 +234,28 @@ export default Vue.extend({
text-align center text-align center
color #999 color #999
cursor pointer cursor pointer
background #fafafa background isDark ? #21242d : #fafafa
outline none outline none
border none border none
border-bottom solid 1px #eef0f2 border-bottom solid 1px isDark ? #1c2023 : #eef0f2
border-radius 6px 6px 0 0 border-radius 6px 6px 0 0
&:hover &:hover
background #f6f6f6 background isDark ? #2e3440 : #f6f6f6
&:active &:active
background #f0f0f0 background isDark ? #21242b : #f0f0f0
&:disabled &:disabled
color #ccc color isDark ? #21242b : #ccc
> .context > .context
> * > *
border-bottom 1px solid #eef0f2 border-bottom 1px solid isDark ? #1c2023 : #eef0f2
> .renote > .renote
color #9dbb00 color #9dbb00
background linear-gradient(to bottom, #edfde2 0%, #fff 100%) background isDark ? linear-gradient(to bottom, #314027 0%, #282c37 100%) : linear-gradient(to bottom, #edfde2 0%, #fff 100%)
> p > p
margin 0 margin 0
@ -281,7 +283,7 @@ export default Vue.extend({
padding-top 8px padding-top 8px
> .reply-to > .reply-to
border-bottom 1px solid #eef0f2 border-bottom 1px solid isDark ? #1c2023 : #eef0f2
> article > article
padding 28px 32px 18px 32px padding 28px 32px 18px 32px
@ -292,8 +294,8 @@ export default Vue.extend({
clear both clear both
&:hover &:hover
> .main > footer > button > footer > button
color #888 color isDark ? #707b97 : #888
> .avatar-anchor > .avatar-anchor
display block display block
@ -318,7 +320,7 @@ export default Vue.extend({
display inline-block display inline-block
margin 0 margin 0
line-height 24px line-height 24px
color #777 color isDark ? #fff : #627079
font-size 18px font-size 18px
font-weight 700 font-weight 700
text-align left text-align left
@ -331,18 +333,27 @@ export default Vue.extend({
display block display block
text-align left text-align left
margin 0 margin 0
color #ccc color isDark ? #606984 : #ccc
> .time > .time
position absolute position absolute
top 0 top 0
right 32px right 32px
font-size 1em font-size 1em
color #c0c0c0 color isDark ? #606984 : #c0c0c0
> .body > .body
padding 8px 0 padding 8px 0
> .text
cursor default
display block
margin 0
padding 0
overflow-wrap break-word
font-size 1.5em
color isDark ? #fff : #717171
> .renote > .renote
margin 8px 0 margin 8px 0
@ -404,11 +415,11 @@ export default Vue.extend({
background transparent background transparent
border none border none
font-size 1em font-size 1em
color #ddd color isDark ? #606984 : #ccc
cursor pointer cursor pointer
&:hover &:hover
color #666 color isDark ? #9198af : #666
> .count > .count
display inline display inline
@ -420,17 +431,12 @@ export default Vue.extend({
> .replies > .replies
> * > *
border-top 1px solid #eef0f2 border-top 1px solid isDark ? #1c2023 : #eef0f2
.mk-note-detail[data-darkmode]
root(true)
.mk-note-detail:not([data-darkmode])
root(false)
</style> </style>
<style lang="stylus" module>
.text
cursor default
display block
margin 0
padding 0
overflow-wrap break-word
font-size 1.5em
color #717171
</style>

View File

@ -35,8 +35,9 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
root(isDark) root(isDark)
margin 0 margin 0
padding 16px padding 16px 32px
font-size 0.9em font-size 0.9em
background isDark ? #21242d : #fcfcfc
&:after &:after
content "" content ""

View File

@ -371,13 +371,6 @@ root(isDark)
& + article & + article
padding-top 8px padding-top 8px
> .reply-to
padding 0 16px
background rgba(0, 0, 0, 0.0125)
> .mk-note-preview
background transparent
> article > article
padding 28px 32px 18px 32px padding 28px 32px 18px 32px

View File

@ -156,7 +156,7 @@ export default Vue.extend({
this.notes = this.notes.slice(0, displayLimit); this.notes = this.notes.slice(0, displayLimit);
} }
} else { } else {
this.queue.unshift(note); this.queue.push(note);
} }
}, },

View File

@ -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>
@ -67,7 +67,7 @@ root(isDark)
z-index 10 z-index 10
background isDark ? #313543 : #fff background isDark ? #313543 : #fff
border-radius 6px 6px 0 0 border-radius 6px 6px 0 0
box-shadow 0 1px rgba(0, 0, 0, 0.08) box-shadow 0 1px isDark ? rgba(#000, 0.15) : rgba(#000, 0.08)
> button > button
position absolute position absolute

View File

@ -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>

View File

@ -55,15 +55,15 @@ init((launch) => {
{ path: '/signup', name: 'signup', component: MkSignup }, { path: '/signup', name: 'signup', component: MkSignup },
{ path: '/i/settings', component: MkSettings }, { path: '/i/settings', component: MkSettings },
{ path: '/i/settings/profile', component: MkProfileSetting }, { path: '/i/settings/profile', component: MkProfileSetting },
{ path: '/i/notifications', component: MkNotifications }, { path: '/i/notifications', name: 'notifications', component: MkNotifications },
{ path: '/i/messaging', component: MkMessaging }, { path: '/i/messaging', name: 'messaging', component: MkMessaging },
{ path: '/i/messaging/:user', component: MkMessagingRoom }, { path: '/i/messaging/:user', component: MkMessagingRoom },
{ path: '/i/drive', component: MkDrive }, { path: '/i/drive', name: 'drive', component: MkDrive },
{ path: '/i/drive/folder/:folder', component: MkDrive }, { path: '/i/drive/folder/:folder', component: MkDrive },
{ path: '/i/drive/file/:file', component: MkDrive }, { path: '/i/drive/file/:file', component: MkDrive },
{ path: '/selectdrive', component: MkSelectDrive }, { path: '/selectdrive', component: MkSelectDrive },
{ path: '/search', component: MkSearch }, { path: '/search', component: MkSearch },
{ path: '/othello', component: MkOthello }, { path: '/othello', name: 'othello', component: MkOthello },
{ path: '/othello/:game', component: MkOthello }, { path: '/othello/:game', component: MkOthello },
{ path: '/@:user', component: MkUser }, { path: '/@:user', component: MkUser },
{ path: '/@:user/followers', component: MkFollowers }, { path: '/@:user/followers', component: MkFollowers },

View File

@ -8,6 +8,10 @@
html html
height 100% height 100%
background #ececed
&[data-darkmode]
background #191B22
body body
display flex display flex

View File

@ -27,17 +27,17 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.mk-note-card root(isDark)
display inline-block display inline-block
width 150px width 150px
//height 120px //height 120px
font-size 12px font-size 12px
background #fff background isDark ? #282c37 : #fff
border-radius 4px border-radius 4px
> a > a
display block display block
color #2c3940 color isDark ? #fff : #2c3940
&:hover &:hover
text-decoration none text-decoration none
@ -75,11 +75,17 @@ export default Vue.extend({
left 0 left 0
width 100% width 100%
height 20px height 20px
background linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #fff 100%) background isDark ? linear-gradient(to bottom, rgba(#282c37, 0) 0%, #282c37 100%) : linear-gradient(to bottom, rgba(#fff, 0) 0%, #fff 100%)
> .mk-time > .mk-time
display inline-block display inline-block
padding 8px padding 8px
color #aaa color #aaa
.mk-note-card[data-darkmode]
root(true)
.mk-note-card:not([data-darkmode])
root(false)
</style> </style>

View File

@ -27,23 +27,22 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.root.sub root(isDark)
padding 8px padding 8px
font-size 0.9em font-size 0.9em
background #fdfdfd background isDark ? #21242d : #fdfdfd
@media (min-width 500px) @media (min-width 500px)
padding 12px padding 12px
@media (min-width 600px)
padding 24px 32px
&:after &:after
content "" content ""
display block display block
clear both clear both
&:hover
> .main > footer > button
color #888
> .avatar-anchor > .avatar-anchor
display block display block
float left float left
@ -71,7 +70,7 @@ export default Vue.extend({
margin 0 .5em 0 0 margin 0 .5em 0 0
padding 0 padding 0
overflow hidden overflow hidden
color #607073 color isDark ? #fff : #607073
font-size 1em font-size 1em
font-weight 700 font-weight 700
text-align left text-align left
@ -84,11 +83,11 @@ export default Vue.extend({
> .username > .username
text-align left text-align left
margin 0 .5em 0 0 margin 0 .5em 0 0
color #d1d8da color isDark ? #606984 : #d1d8da
> .time > .time
margin-left auto margin-left auto
color #b2b8bb color isDark ? #606984 : #b2b8bb
> .body > .body
@ -97,7 +96,12 @@ export default Vue.extend({
margin 0 margin 0
padding 0 padding 0
font-size 1.1em font-size 1.1em
color #717171 color isDark ? #959ba7 : #717171
.root.sub[data-darkmode]
root(true)
.root.sub:not([data-darkmode])
root(false)
</style> </style>

View File

@ -34,7 +34,9 @@
</div> </div>
</header> </header>
<div class="body"> <div class="body">
<mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/> <div class="text">
<mk-note-html v-if="p.text" :text="p.text" :i="os.i"/>
</div>
<div class="tags" v-if="p.tags && p.tags.length > 0"> <div class="tags" v-if="p.tags && p.tags.length > 0">
<router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link> <router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link>
</div> </div>
@ -209,15 +211,18 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
@import '~const.styl' @import '~const.styl'
.mk-note-detail root(isDark)
overflow hidden overflow hidden
margin 0 auto margin 0 auto
padding 0 padding 0
width 100% width 100%
text-align left text-align left
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(#000, 0.1)
@media (min-width 500px)
box-shadow 0 8px 32px rgba(#000, 0.1)
> .fetching > .fetching
padding 64px 0 padding 64px 0
@ -231,29 +236,26 @@ export default Vue.extend({
text-align center text-align center
color #999 color #999
cursor pointer cursor pointer
background #fafafa background isDark ? #21242d : #fafafa
outline none outline none
border none border none
border-bottom solid 1px #eef0f2 border-bottom solid 1px isDark ? #1c2023 : #eef0f2
border-radius 6px 6px 0 0 border-radius 6px 6px 0 0
box-shadow none box-shadow none
&:hover &:hover
background #f6f6f6 background isDark ? #16181d : #f6f6f6
&:active
background #f0f0f0
&:disabled &:disabled
color #ccc color #ccc
> .context > .context
> * > *
border-bottom 1px solid #eef0f2 border-bottom 1px solid isDark ? #1c2023 : #eef0f2
> .renote > .renote
color #9dbb00 color #9dbb00
background linear-gradient(to bottom, #edfde2 0%, #fff 100%) background isDark ? linear-gradient(to bottom, #314027 0%, #282c37 100%) : linear-gradient(to bottom, #edfde2 0%, #fff 100%)
> p > p
margin 0 margin 0
@ -281,7 +283,7 @@ export default Vue.extend({
padding-top 8px padding-top 8px
> .reply-to > .reply-to
border-bottom 1px solid #eef0f2 border-bottom 1px solid isDark ? #1c2023 : #eef0f2
> article > article
padding 14px 16px 9px 16px padding 14px 16px 9px 16px
@ -294,17 +296,13 @@ export default Vue.extend({
display block display block
clear both clear both
&:hover
> .main > footer > button
color #888
> header > header
display flex display flex
line-height 1.1 line-height 1.1em
> .avatar-anchor > .avatar-anchor
display block display block
padding 0 .5em 0 0 padding 0 12px 0 0
> .avatar > .avatar
display block display block
@ -323,7 +321,7 @@ export default Vue.extend({
> .name > .name
display inline-block display inline-block
margin .4em 0 margin .4em 0
color #777 color isDark ? #fff : #627079
font-size 16px font-size 16px
font-weight bold font-weight bold
text-align left text-align left
@ -336,11 +334,22 @@ export default Vue.extend({
display block display block
text-align left text-align left
margin 0 margin 0
color #ccc color isDark ? #606984 : #ccc
> .body > .body
padding 8px 0 padding 8px 0
> .text
display block
margin 0
padding 0
overflow-wrap break-word
font-size 16px
color isDark ? #fff : #717171
@media (min-width 500px)
font-size 24px
> .renote > .renote
margin 8px 0 margin 8px 0
@ -396,7 +405,7 @@ export default Vue.extend({
> .time > .time
font-size 16px font-size 16px
color #c0c0c0 color isDark ? #606984 : #c0c0c0
> footer > footer
font-size 1.2em font-size 1.2em
@ -408,14 +417,14 @@ export default Vue.extend({
border none border none
box-shadow none box-shadow none
font-size 1em font-size 1em
color #ddd color isDark ? #606984 : #ddd
cursor pointer cursor pointer
&:not(:last-child) &:not(:last-child)
margin-right 28px margin-right 28px
&:hover &:hover
color #666 color isDark ? #9198af : #666
> .count > .count
display inline display inline
@ -427,20 +436,12 @@ export default Vue.extend({
> .replies > .replies
> * > *
border-top 1px solid #eef0f2 border-top 1px solid isDark ? #1c2023 : #eef0f2
</style> .mk-note-detail[data-darkmode]
root(true)
<style lang="stylus" module>
.text .mk-note-detail:not([data-darkmode])
display block root(false)
margin 0
padding 0
overflow-wrap break-word
font-size 16px
color #717171
@media (min-width 500px)
font-size 24px
</style> </style>

View File

@ -31,7 +31,6 @@ export default Vue.extend({
margin 0 margin 0
padding 0 padding 0
font-size 0.9em font-size 0.9em
background #fff
&:after &:after
content "" content ""

View File

@ -27,9 +27,13 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.sub root(isDark)
font-size 0.9em
padding 16px padding 16px
font-size 0.9em
background isDark ? #21242d : #fcfcfc
@media (min-width 600px)
padding 24px 32px
&:after &:after
content "" content ""
@ -73,7 +77,7 @@ export default Vue.extend({
margin 0 0.5em 0 0 margin 0 0.5em 0 0
padding 0 padding 0
overflow hidden overflow hidden
color #607073 color isDark ? #fff : #607073
font-size 1em font-size 1em
font-weight 700 font-weight 700
text-align left text-align left
@ -86,11 +90,11 @@ export default Vue.extend({
> .username > .username
text-align left text-align left
margin 0 margin 0
color #d1d8da color isDark ? #606984 : #d1d8da
> .created-at > .created-at
margin-left auto margin-left auto
color #b2b8bb color isDark ? #606984 : #b2b8bb
> .body > .body
max-height 128px max-height 128px
@ -101,11 +105,16 @@ export default Vue.extend({
margin 0 margin 0
padding 0 padding 0
font-size 1.1em font-size 1.1em
color #717171 color isDark ? #959ba7 : #717171
pre pre
max-height 120px max-height 120px
font-size 80% font-size 80%
</style> .sub[data-darkmode]
root(true)
.sub:not([data-darkmode])
root(false)
</style>

View File

@ -238,13 +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
border-radius 8px 8px 0 0
> .renote
border-radius 8px 8px 0 0
&:last-of-type &:last-of-type
border-bottom none border-bottom none
@ -261,11 +255,14 @@ root(isDark)
padding 8px 16px padding 8px 16px
line-height 28px line-height 28px
color #9dbb00 color #9dbb00
background linear-gradient(to bottom, #edfde2 0%, #fff 100%) background isDark ? linear-gradient(to bottom, #314027 0%, #282c37 100%) : linear-gradient(to bottom, #edfde2 0%, #fff 100%)
@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
@ -301,14 +298,11 @@ root(isDark)
& + article & + article
padding-top 8px padding-top 8px
> .reply-to
background rgba(0, 0, 0, 0.0125)
> .mk-note-preview
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 ""
@ -319,9 +313,9 @@ root(isDark)
display block display block
float left float left
margin 0 10px 8px 0 margin 0 10px 8px 0
position -webkit-sticky //position -webkit-sticky
position sticky //position sticky
top 62px //top 62px
@media (min-width 500px) @media (min-width 500px)
margin-right 16px margin-right 16px
@ -359,7 +353,7 @@ root(isDark)
margin 0 0.5em 0 0 margin 0 0.5em 0 0
padding 0 padding 0
overflow hidden overflow hidden
color #627079 color isDark ? #fff : #627079
font-size 1em font-size 1em
font-weight bold font-weight bold
text-decoration none text-decoration none
@ -372,15 +366,15 @@ root(isDark)
margin 0 0.5em 0 0 margin 0 0.5em 0 0
padding 1px 6px padding 1px 6px
font-size 12px font-size 12px
color #aaa color isDark ? #758188 : #aaa
border solid 1px #ddd border solid 1px isDark ? #57616f : #ddd
border-radius 3px border-radius 3px
> .username > .username
margin 0 0.5em 0 0 margin 0 0.5em 0 0
overflow hidden overflow hidden
text-overflow ellipsis text-overflow ellipsis
color #ccc color isDark ? #606984 : #ccc
> .info > .info
margin-left auto margin-left auto
@ -388,10 +382,10 @@ root(isDark)
> .mobile > .mobile
margin-right 6px margin-right 6px
color #c0c0c0 color isDark ? #606984 : #c0c0c0
> .created-at > .created-at
color #c0c0c0 color isDark ? #606984 : #c0c0c0
> .body > .body
@ -428,7 +422,7 @@ root(isDark)
padding 0 padding 0
overflow-wrap break-word overflow-wrap break-word
font-size 1.1em font-size 1.1em
color #717171 color isDark ? #fff : #717171
>>> .title >>> .title
display block display block
@ -436,7 +430,7 @@ root(isDark)
padding 4px padding 4px
font-size 90% font-size 90%
text-align center text-align center
background #eef1f3 background isDark ? #2f3944 : #eef1f3
border-radius 4px border-radius 4px
>>> .code >>> .code
@ -445,12 +439,12 @@ root(isDark)
>>> .quote >>> .quote
margin 8px margin 8px
padding 6px 12px padding 6px 12px
color #aaa color isDark ? #6f808e : #aaa
border-left solid 3px #eee border-left solid 3px isDark ? #637182 : #eee
> .reply > .reply
margin-right 8px margin-right 8px
color #717171 color isDark ? #99abbf : #717171
> .rp > .rp
margin-left 4px margin-left 4px
@ -522,7 +516,7 @@ root(isDark)
> .mk-note-preview > .mk-note-preview
padding 16px padding 16px
border dashed 1px #c0dac6 border dashed 1px isDark ? #4e945e : #c0dac6
border-radius 8px border-radius 8px
> .app > .app
@ -537,14 +531,14 @@ root(isDark)
border none border none
box-shadow none box-shadow none
font-size 1em font-size 1em
color #ddd color isDark ? #606984 : #ddd
cursor pointer cursor pointer
&:not(:last-child) &:not(:last-child)
margin-right 28px margin-right 28px
&:hover &:hover
color #666 color isDark ? #9198af : #666
> .count > .count
display inline display inline

View File

@ -144,7 +144,7 @@ export default Vue.extend({
this.notes = this.notes.slice(0, displayLimit); this.notes = this.notes.slice(0, displayLimit);
} }
} else { } else {
this.queue.unshift(note); this.queue.push(note);
} }
}, },
@ -199,10 +199,14 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
@import '~const.styl' @import '~const.styl'
.mk-notes root(isDark)
background #fff overflow hidden
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(#000, 0.1)
@media (min-width 500px)
box-shadow 0 8px 32px rgba(#000, 0.1)
.transition .transition
.mk-notes-enter .mk-notes-enter
@ -219,9 +223,9 @@ export default Vue.extend({
line-height 32px line-height 32px
text-align center text-align center
font-size 0.9em font-size 0.9em
color #aaa color isDark ? #666b79 : #aaa
background #fdfdfd background isDark ? #242731 : #fdfdfd
border-bottom solid 1px #eaeaea border-bottom solid 1px isDark ? #1c2023 : #eaeaea
span span
margin 0 16px margin 0 16px
@ -259,9 +263,7 @@ export default Vue.extend({
> footer > footer
text-align center text-align center
border-top solid 1px #eaeaea border-top solid 1px isDark ? #1c2023 : #eaeaea
border-bottom-left-radius 4px
border-bottom-right-radius 4px
&:empty &:empty
display none display none
@ -270,10 +272,18 @@ export default Vue.extend({
margin 0 margin 0
padding 16px padding 16px
width 100% width 100%
color $theme-color color #ccc
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>

View File

@ -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>
@ -91,53 +91,65 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.mk-notification root(isDark)
> .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 24px 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 isDark ? #606984 : #c0c0c0
font-size 0.9em
> .note-preview > .note-preview
color rgba(0, 0, 0, 0.7) color isDark ? #fff : #717171
> .note-ref > .note-ref
color rgba(0, 0, 0, 0.7) color isDark ? #fff : #717171
[data-fa] [data-fa]
font-size 1em font-size 1em
@ -147,12 +159,17 @@ 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> .mk-notification[data-darkmode]
root(true)
.mk-notification:not([data-darkmode])
root(false)
</style>

View File

@ -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>
@ -101,28 +103,28 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.mk-notifications root(isDark)
margin 8px auto margin 0 auto
padding 0 background isDark ? #282C37 :#fff
max-width 500px
width calc(100% - 16px)
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:not(:last-child)
margin 0 auto border-bottom solid 1px isDark ? #1c2023 : #eaeaea
max-width 500px
border-bottom solid 1px rgba(0, 0, 0, 0.05)
&:last-child
border-bottom none
> .date > .date
display block display block
@ -130,9 +132,9 @@ export default Vue.extend({
line-height 32px line-height 32px
text-align center text-align center
font-size 0.8em font-size 0.8em
color #aaa color isDark ? #666b79 : #aaa
background #fdfdfd background isDark ? #242731 : #fdfdfd
border-bottom solid 1px rgba(0, 0, 0, 0.05) border-bottom solid 1px isDark ? #1c2023 : #eaeaea
span span
margin 0 16px margin 0 16px
@ -165,4 +167,10 @@ export default Vue.extend({
> [data-fa] > [data-fa]
margin-right 4px margin-right 4px
.mk-notifications[data-darkmode]
root(true)
.mk-notifications:not([data-darkmode])
root(false)
</style> </style>

View File

@ -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

View File

@ -143,7 +143,7 @@ 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
@ -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>

View File

@ -15,19 +15,20 @@
</router-link> </router-link>
<div class="links"> <div class="links">
<ul> <ul>
<li><router-link to="/">%fa:home%%i18n:@home%%fa:angle-right%</router-link></li> <li><router-link to="/" :data-active="$route.name == 'index'">%fa:home%%i18n:@home%%fa:angle-right%</router-link></li>
<li><router-link to="/i/notifications">%fa:R bell%%i18n:@notifications%<template v-if="hasUnreadNotifications">%fa:circle%</template>%fa:angle-right%</router-link></li> <li><router-link to="/i/notifications" :data-active="$route.name == 'notifications'">%fa:R bell%%i18n:@notifications%<template v-if="hasUnreadNotifications">%fa:circle%</template>%fa:angle-right%</router-link></li>
<li><router-link to="/i/messaging">%fa:R comments%%i18n:@messaging%<template v-if="hasUnreadMessagingMessages">%fa:circle%</template>%fa:angle-right%</router-link></li> <li><router-link to="/i/messaging" :data-active="$route.name == 'messaging'">%fa:R comments%%i18n:@messaging%<template v-if="hasUnreadMessagingMessages">%fa:circle%</template>%fa:angle-right%</router-link></li>
<li><router-link to="/othello">%fa:gamepad%ゲーム<template v-if="hasGameInvitations">%fa:circle%</template>%fa:angle-right%</router-link></li> <li><router-link to="/othello" :data-active="$route.name == 'othello'">%fa:gamepad%ゲーム<template v-if="hasGameInvitations">%fa:circle%</template>%fa:angle-right%</router-link></li>
</ul> </ul>
<ul> <ul>
<li><router-link to="/i/drive">%fa:cloud%%i18n:@drive%%fa:angle-right%</router-link></li> <li><router-link to="/i/drive" :data-active="$route.name == 'drive'">%fa:cloud%%i18n:@drive%%fa:angle-right%</router-link></li>
</ul> </ul>
<ul> <ul>
<li><a @click="search">%fa:search%%i18n:@search%%fa:angle-right%</a></li> <li><a @click="search">%fa:search%%i18n:@search%%fa:angle-right%</a></li>
</ul> </ul>
<ul> <ul>
<li><router-link to="/i/settings">%fa:cog%%i18n:@settings%%fa:angle-right%</router-link></li> <li><router-link to="/i/settings">%fa:cog%%i18n:@settings%%fa:angle-right%</router-link></li>
<li @click="dark"><p><template v-if="_darkmode_">%fa:moon%</template><template v-else>%fa:R moon%</template><span>ダークモード</span></p></li>
</ul> </ul>
</div> </div>
<a :href="aboutUrl"><p class="about">%i18n:@about%</p></a> <a :href="aboutUrl"><p class="about">%i18n:@about%</p></a>
@ -113,6 +114,9 @@ export default Vue.extend({
}, },
onOthelloNoInvites() { onOthelloNoInvites() {
this.hasGameInvitations = false; this.hasGameInvitations = false;
},
dark() {
(this as any)._updateDarkmode_(!(this as any)._darkmode_);
} }
} }
}); });
@ -121,7 +125,9 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
@import '~const.styl' @import '~const.styl'
.nav root(isDark)
$color = isDark ? #c9d2e0 : #777
.backdrop .backdrop
position fixed position fixed
top 0 top 0
@ -129,7 +135,7 @@ export default Vue.extend({
z-index 1025 z-index 1025
width 100% width 100%
height 100% height 100%
background rgba(0, 0, 0, 0.2) background isDark ? rgba(#000, 0.7) : rgba(#000, 0.2)
.body .body
position fixed position fixed
@ -140,8 +146,7 @@ export default Vue.extend({
height 100% height 100%
overflow auto overflow auto
-webkit-overflow-scrolling touch -webkit-overflow-scrolling touch
color #777 background isDark ? #16191f : #fff
background #fff
.me .me
display block display block
@ -162,7 +167,7 @@ export default Vue.extend({
left 80px left 80px
padding 0 padding 0
width calc(100% - 112px) width calc(100% - 112px)
color #777 color $color
line-height 96px line-height 96px
overflow hidden overflow hidden
text-overflow ellipsis text-overflow ellipsis
@ -182,14 +187,22 @@ export default Vue.extend({
font-size 1em font-size 1em
line-height 1em line-height 1em
a a, p
display block display block
margin 0
padding 0 20px padding 0 20px
line-height 3rem line-height 3rem
line-height calc(1rem + 30px) line-height calc(1rem + 30px)
color #777 color $color
text-decoration none text-decoration none
&[data-active]
color $theme-color-foreground
background $theme-color
> [data-fa]:last-child
color $theme-color-foreground
> [data-fa]:first-child > [data-fa]:first-child
margin-right 0.5em margin-right 0.5em
@ -205,18 +218,17 @@ export default Vue.extend({
padding 0 20px padding 0 20px
font-size 1.2em font-size 1.2em
line-height calc(1rem + 30px) line-height calc(1rem + 30px)
color #ccc color $color
opacity 0.5
.about .about
margin 0 margin 0
padding 1em 0 padding 1em 0
text-align center text-align center
font-size 0.8em font-size 0.8em
color $color
opacity 0.5 opacity 0.5
a
color #777
.nav-enter-active, .nav-enter-active,
.nav-leave-active { .nav-leave-active {
opacity: 1; opacity: 1;
@ -239,4 +251,10 @@ export default Vue.extend({
opacity: 0; opacity: 0;
} }
.nav[data-darkmode]
root(true)
.nav:not([data-darkmode])
root(false)
</style> </style>

View File

@ -65,9 +65,3 @@ export default Vue.extend({
} }
}); });
</script> </script>
<style lang="stylus" scoped>
.mk-user-timeline
max-width 600px
margin 0 auto
</style>

View File

@ -102,7 +102,6 @@ export default Vue.extend({
mounted() { mounted() {
document.title = 'Misskey'; document.title = 'Misskey';
document.documentElement.style.background = '#313a42';
}, },
methods: { methods: {

View File

@ -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();

View File

@ -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();

View File

@ -17,7 +17,7 @@
<button @click="fn">%fa:pencil-alt%</button> <button @click="fn">%fa:pencil-alt%</button>
</template> </template>
<main> <main :data-darkmode="_darkmode_">
<div class="nav" v-if="showNav"> <div class="nav" v-if="showNav">
<div class="bg" @click="showNav = false"></div> <div class="bg" @click="showNav = false"></div>
<div class="body"> <div class="body">
@ -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();
}, },
@ -101,7 +100,7 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
@import '~const.styl' @import '~const.styl'
main root(isDark)
> .nav > .nav
> .bg > .bg
position fixed position fixed
@ -120,23 +119,12 @@ main
right 0 right 0
width 300px width 300px
margin 0 auto margin 0 auto
background #fff background isDark ? #272f3a : #fff
border-radius 8px border-radius 8px
box-shadow 0 0 16px rgba(0, 0, 0, 0.1) box-shadow 0 0 16px rgba(0, 0, 0, 0.1)
$balloon-size = 16px $balloon-size = 16px
&:before
content ""
display block
position absolute
top -($balloon-size * 2)
left s('calc(50% - %s)', $balloon-size)
border-top solid $balloon-size transparent
border-left solid $balloon-size transparent
border-right solid $balloon-size transparent
border-bottom solid $balloon-size $border-color
&:after &:after
content "" content ""
display block display block
@ -146,7 +134,7 @@ main
border-top solid $balloon-size transparent border-top solid $balloon-size transparent
border-left solid $balloon-size transparent border-left solid $balloon-size transparent
border-right solid $balloon-size transparent border-right solid $balloon-size transparent
border-bottom solid $balloon-size #fff border-bottom solid $balloon-size isDark ? #272f3a : #fff
> div > div
padding 8px 0 padding 8px 0
@ -154,20 +142,30 @@ main
> * > *
display block display block
padding 8px 16px padding 8px 16px
color isDark ? #cdd0d8 : #666
&[data-active] &[data-active]
color $theme-color-foreground color $theme-color-foreground
background $theme-color background $theme-color
&:not([data-active]):hover &:not([data-active]):hover
background #eee background isDark ? #353e4a : #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
main[data-darkmode]
root(true)
main:not([data-darkmode])
root(false)
</style> </style>

View File

@ -2,11 +2,13 @@
<mk-ui> <mk-ui>
<span slot="header">%fa:R sticky-note%%i18n:@title%</span> <span slot="header">%fa:R sticky-note%%i18n:@title%</span>
<main v-if="!fetching"> <main v-if="!fetching">
<a v-if="note.next" :href="note.next">%fa:angle-up%%i18n:@next%</a>
<div> <div>
<mk-note-detail :note="note"/> <mk-note-detail :note="note"/>
</div> </div>
<a v-if="note.prev" :href="note.prev">%fa:angle-down%%i18n:@prev%</a> <footer>
<a v-if="note.prev" :href="note.prev">%fa:angle-left% %i18n:@prev%</a>
<a v-if="note.next" :href="note.next">%i18n:@next% %fa:angle-right%</a>
</footer>
</main> </main>
</mk-ui> </mk-ui>
</template> </template>
@ -30,7 +32,6 @@ export default Vue.extend({
}, },
mounted() { mounted() {
document.title = 'Misskey'; document.title = 'Misskey';
document.documentElement.style.background = '#313a42';
}, },
methods: { methods: {
fetch() { fetch() {
@ -53,33 +54,24 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
main main
text-align center text-align center
padding 8px
> div
margin 8px auto
padding 0
max-width 500px
width calc(100% - 16px)
@media (min-width 500px) @media (min-width 500px)
margin 16px auto padding 16px
width calc(100% - 32px)
@media (min-width 600px)
padding 32px
> div
margin 0 auto
padding 0
max-width 600px
> footer
margin-top 16px
> a > a
display inline-block display inline-block
margin 0 16px
&:first-child
margin-top 8px
@media (min-width 500px)
margin-top 16px
&:last-child
margin-bottom 8px
@media (min-width 500px)
margin-bottom 16px
> [data-fa]
margin-right 4px
</style> </style>

View File

@ -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>
<main>
<mk-notifications @fetched="onFetched"/> <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>

View File

@ -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() {

View File

@ -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();
}, },

View File

@ -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() {

View File

@ -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,9 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
@import '~const.styl' @import '~const.styl'
main root(isDark)
$bg = isDark ? #22252f : #f7f7f7
> .is-suspended > .is-suspended
> .is-remote > .is-remote
&.is-suspended &.is-suspended
@ -135,10 +134,11 @@ main
font-size 12px font-size 12px
> header > header
background $bg
> .banner > .banner
padding-bottom 33.3% padding-bottom 33.3%
background-color #1b1b1b background-color isDark ? #5f7273 : #cacaca
background-size cover background-size cover
background-position center background-position center
@ -165,13 +165,14 @@ main
left -2px left -2px
bottom -2px bottom -2px
width 100% width 100%
border 3px solid #313a42 background $bg
border 3px solid $bg
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 $bg
border-radius 12px border-radius 12px
> .mk-follow-button > .mk-follow-button
@ -185,26 +186,26 @@ 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
padding 2px 4px padding 2px 4px
font-size 12px font-size 12px
color #657786 color isDark ? #657786 : #fff
background #f8f8f8 background isDark ? #f8f8f8 : #a7bec7
border-radius 4px border-radius 4px
> .description > .description
margin 8px 0 margin 8px 0
color #fff color isDark ? #fff : #757c82
> .info > .info
margin 8px 0 margin 8px 0
@ -212,14 +213,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 +228,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 +236,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 $bg
z-index 1 z-index 1
> .nav-container > .nav-container
@ -250,11 +251,15 @@ main
display block display block
flex 1 1 flex 1 1
text-align center text-align center
line-height 48px
font-size 12px
text-decoration none
color isDark ? #657786 : #9ca1a5
border-bottom solid 2px transparent
@media (min-width 400px)
line-height 52px line-height 52px
font-size 14px font-size 14px
text-decoration none
color #657786
border-bottom solid 2px transparent
&[data-active] &[data-active]
font-weight bold font-weight bold
@ -262,9 +267,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>

View File

@ -54,30 +54,39 @@ export default Vue.extend({
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.root.home root(isDark)
max-width 600px max-width 600px
margin 0 auto margin 0 auto
> .mk-note-detail > .mk-note-detail
margin 0 0 8px 0 margin 0 0 8px 0
@media (min-width 500px)
margin 0 0 16px 0
> section > section
background #eee background isDark ? #21242f : #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
font-size 15px font-size 15px
font-weight normal font-weight normal
color #465258 color isDark ? #b8c5cc : #465258
background #fff background isDark ? #282c37 : #fff
border-radius 8px 8px 0 0 border-radius 8px 8px 0 0
@media (min-width 500px)
padding 10px 16px
> i > i
margin-right 6px margin-right 6px
@ -89,6 +98,12 @@ export default Vue.extend({
display block display block
margin 16px margin 16px
text-align center text-align center
color #cad2da color isDark ? #cad2da : #929aa0
.root.home[data-darkmode]
root(true)
.root.home:not([data-darkmode])
root(false)
</style> </style>

View File

@ -1,5 +1,6 @@
<template> <template>
<div class="welcome"> <div class="welcome">
<div>
<h1><b>Misskey</b>へようこそ</h1> <h1><b>Misskey</b>へようこそ</h1>
<p>Twitter風ミニブログSNSMisskeyへようこそ共有したいことを投稿したりタイムラインでみんなの投稿を読むこともできます<br><a href="/signup">アカウントを作成する</a></p> <p>Twitter風ミニブログSNSMisskeyへようこそ共有したいことを投稿したりタイムラインでみんなの投稿を読むこともできます<br><a href="/signup">アカウントを作成する</a></p>
<div class="form"> <div class="form">
@ -29,6 +30,7 @@
<small>{{ copyright }}</small> <small>{{ copyright }}</small>
</footer> </footer>
</div> </div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -84,6 +86,9 @@ export default Vue.extend({
<style lang="stylus" scoped> <style lang="stylus" scoped>
.welcome .welcome
background linear-gradient(to bottom, #1e1d65, #bd6659)
> div
padding 16px padding 16px
margin 0 auto margin 0 auto
max-width 500px max-width 500px
@ -198,9 +203,3 @@ export default Vue.extend({
opacity 0.7 opacity 0.7
</style> </style>
<style lang="stylus">
html
body
background linear-gradient(to bottom, #1e1d65, #bd6659)
</style>

View File

@ -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;

View File

@ -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';

View File

@ -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) });
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View 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) {

View File

@ -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));

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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

View File

@ -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');
// 自分自身 // 自分自身

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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, '');

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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 = {};

View File

@ -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) {

View File

@ -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) {

View File

@ -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({

View File

@ -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

View File

@ -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;

View File

@ -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');
// 自分自身 // 自分自身

View File

@ -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

View File

@ -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

View File

@ -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 = {

View File

@ -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

View File

@ -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

View File

@ -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) {

Some files were not shown because too many files have changed in this diff Show More