diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/desktop/views/pages/welcome.vue | 33 | ||||
| -rw-r--r-- | src/server/api/endpoints/notes/local-timeline.ts | 14 |
2 files changed, 45 insertions, 2 deletions
diff --git a/src/client/app/desktop/views/pages/welcome.vue b/src/client/app/desktop/views/pages/welcome.vue index ba22cb598f..f21070f36f 100644 --- a/src/client/app/desktop/views/pages/welcome.vue +++ b/src/client/app/desktop/views/pages/welcome.vue @@ -44,8 +44,7 @@ <div class="photos block"> <header>%fa:images% %i18n:@photos%</header> <div> - <div v-for="photo in photos"> - </div> + <div v-for="photo in photos" :style="`background-image: url(${photo.thumbnailUrl})`"></div> </div> </div> @@ -99,6 +98,7 @@ export default Vue.extend({ photos: [] }; }, + created() { (this as any).os.getMeta().then(meta => { this.name = meta.name; @@ -110,14 +110,30 @@ export default Vue.extend({ this.stats = stats; }); + const image = [ + 'image/jpeg', + 'image/png', + 'image/gif' + ]; + + (this as any).api('notes/local-timeline', { + fileType: image, + limit: 6 + }).then(notes => { + const files = [].concat(...notes.map(n => n.files)); + this.photos = files.filter(f => image.includes(f.type)).slice(0, 6); + }); }, + methods: { signup() { this.$modal.show('signup'); }, + signin() { this.$modal.show('signin'); }, + dark() { this.$store.commit('device/set', { key: 'darkmode', @@ -280,6 +296,19 @@ root(isDark) grid-row 2 grid-column 2 + > div + display grid + grid-template-rows 1fr 1fr 1fr + grid-template-columns 1fr 1fr + gap 8px + height 100% + padding 16px + + > div + //border-radius 4px + background-position center center + background-size cover + > .nav display flex justify-content center diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts index 39c385853d..ff10e6fbaa 100644 --- a/src/server/api/endpoints/notes/local-timeline.ts +++ b/src/server/api/endpoints/notes/local-timeline.ts @@ -24,6 +24,12 @@ export const meta = { } }), + fileType: $.arr($.str).optional.note({ + desc: { + 'ja-JP': '指定された種類のファイルが添付された投稿のみを取得します' + } + }), + limit: $.num.optional.range(1, 100).note({ default: 10 }), @@ -85,6 +91,14 @@ export default async (params: any, user: ILocalUser) => { query.fileIds = { $exists: true, $ne: [] }; } + if (ps.fileType) { + query.fileIds = { $exists: true, $ne: [] }; + + query['_files.contentType'] = { + $in: ps.fileType + }; + } + if (ps.sinceId) { sort._id = 1; query._id = { |