From b5acf15877908a4b0e60324c1371aad623b5529d Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 4 May 2018 16:27:03 +0900 Subject: [PATCH] 2.0.0 --- migration/2.0.0.js | 57 +++++++++++++++++++ migration/2018-04-19.js | 49 ---------------- package.json | 4 +- .../common/views/components/media-list.vue | 17 ++++-- .../app/common/views/components/othello.vue | 16 +++--- .../desktop/views/components/media-image.vue | 12 +++- .../desktop/views/components/media-video.vue | 1 + .../desktop/views/components/note-detail.vue | 2 +- .../desktop/views/components/note-preview.vue | 1 + .../views/components/notes.note.sub.vue | 1 + .../desktop/views/components/notes.note.vue | 2 +- .../mobile/views/components/media-image.vue | 12 +++- .../views/components/note-detail.sub.vue | 1 + .../mobile/views/components/note-detail.vue | 2 +- .../mobile/views/components/note-preview.vue | 1 + .../app/mobile/views/components/note.sub.vue | 1 + .../app/mobile/views/components/note.vue | 2 +- .../mobile/views/components/notification.vue | 2 +- 18 files changed, 109 insertions(+), 74 deletions(-) create mode 100644 migration/2.0.0.js delete mode 100644 migration/2018-04-19.js diff --git a/migration/2.0.0.js b/migration/2.0.0.js new file mode 100644 index 000000000..eb8f5730c --- /dev/null +++ b/migration/2.0.0.js @@ -0,0 +1,57 @@ +// for Node.js interpret + +const chalk = require('chalk'); +const sequential = require('promise-sequential'); + +const { default: User } = require('../built/models/user'); +const { default: DriveFile } = require('../built/models/drive-file'); + +async function main() { + const promiseGens = []; + + const count = await DriveFile.count({}); + + let prev; + + for (let i = 0; i < count; i++) { + promiseGens.push(() => { + const promise = new Promise(async (res, rej) => { + const file = await DriveFile.findOne(prev ? { + _id: { $gt: prev._id } + } : {}, { + sort: { + _id: 1 + } + }); + + prev = file; + + const user = await User.findOne({ _id: file.metadata.userId }); + + DriveFile.update({ + _id: file._id + }, { + $set: { + 'metadata._user': { + host: user.host + } + } + }).then(() => { + res([i, file]); + }).catch(rej); + }); + + promise.then(([i, file]) => { + console.log(chalk`{gray ${i}} {green done: {bold ${file._id}} ${file.filename}}`); + }); + + return promise; + }); + } + + return await sequential(promiseGens); +} + +main().then(() => { + console.log('ALL DONE'); +}).catch(console.error); diff --git a/migration/2018-04-19.js b/migration/2018-04-19.js deleted file mode 100644 index b0df22c00..000000000 --- a/migration/2018-04-19.js +++ /dev/null @@ -1,49 +0,0 @@ -// for Node.js interpret - -const { default: User } = require('../built/models/user'); -const { default: Following } = require('../built/models/following'); -const { default: zip } = require('@prezzemolo/zip') - -const migrate = async (following) => { - const follower = await User.findOne({ _id: following.followerId }); - const followee = await User.findOne({ _id: following.followeeId }); - const result = await Following.update(following._id, { - $set: { - stalk: true, - _follower: { - host: follower.host, - inbox: follower.host != null ? follower.inbox : undefined - }, - _followee: { - host: followee.host, - inbox: followee.host != null ? followee.inbox : undefined - } - } - }); - return result.ok === 1; -} - -async function main() { - const count = await Following.count({}); - - const dop = Number.parseInt(process.argv[2]) || 5 - const idop = ((count - (count % dop)) / dop) + 1 - - return zip( - 1, - async (time) => { - console.log(`${time} / ${idop}`) - const doc = await Following.find({}, { - limit: dop, skip: time * dop - }) - return Promise.all(doc.map(migrate)) - }, - idop - ).then(a => { - const rv = [] - a.forEach(e => rv.push(...e)) - return rv - }) -} - -main().then(console.dir).catch(console.error) diff --git a/package.json b/package.json index 1d6cf4b9e..c29b9d5d8 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "misskey", "author": "syuilo ", - "version": "1.7.0", - "clientVersion": "1.0.5175", + "version": "2.0.0", + "clientVersion": "1.0.5184", "codename": "nighthike", "main": "./built/index.js", "private": true, diff --git a/src/client/app/common/views/components/media-list.vue b/src/client/app/common/views/components/media-list.vue index 64172ad0b..ff9d5e102 100644 --- a/src/client/app/common/views/components/media-list.vue +++ b/src/client/app/common/views/components/media-list.vue @@ -2,7 +2,7 @@
@@ -11,7 +11,14 @@ import Vue from 'vue'; export default Vue.extend({ - props: ['mediaList'], + props: { + mediaList: { + required: true + }, + raw: { + default: false + } + } }); @@ -23,7 +30,7 @@ export default Vue.extend({ @media (max-width 500px) height 192px - + &[data-count="1"] grid-template-rows 1fr &[data-count="2"] @@ -40,7 +47,7 @@ export default Vue.extend({ &[data-count="4"] grid-template-columns 1fr 1fr grid-template-rows 1fr 1fr - + :nth-child(1) grid-column 1 / 2 grid-row 1 / 2 @@ -53,5 +60,5 @@ export default Vue.extend({ :nth-child(4) grid-column 2 / 3 grid-row 2 / 3 - + diff --git a/src/client/app/common/views/components/othello.vue b/src/client/app/common/views/components/othello.vue index 8f7d9dfd6..fafa04725 100644 --- a/src/client/app/common/views/components/othello.vue +++ b/src/client/app/common/views/components/othello.vue @@ -31,7 +31,7 @@

対局の招待があります!:

- + {{ i.parent.name }} @{{ i.parent.username }} @@ -40,8 +40,8 @@

自分の対局

- - + + {{ g.user1.name }} vs {{ g.user2.name }} {{ g.isEnded ? '終了' : '進行中' }} @@ -49,8 +49,8 @@

みんなの対局

- - + + {{ g.user1.name }} vs {{ g.user2.name }} {{ g.isEnded ? '終了' : '進行中' }} @@ -271,8 +271,7 @@ export default Vue.extend({ &:active background #eee - > img - vertical-align bottom + > .avatar border-radius 100% > span @@ -301,8 +300,7 @@ export default Vue.extend({ &:active background #eee - > img - vertical-align bottom + > .avatar border-radius 100% > span diff --git a/src/client/app/desktop/views/components/media-image.vue b/src/client/app/desktop/views/components/media-image.vue index 3d28d5149..e5803cc36 100644 --- a/src/client/app/desktop/views/components/media-image.vue +++ b/src/client/app/desktop/views/components/media-image.vue @@ -14,12 +14,20 @@ import Vue from 'vue'; import MkMediaImageDialog from './media-image-dialog.vue'; export default Vue.extend({ - props: ['image'], + props: { + image: { + type: Object, + required: true + }, + raw: { + default: false + } + }, computed: { style(): any { return { 'background-color': this.image.properties.avgColor ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent', - 'background-image': `url(${this.image.url}?thumbnail&size=512)` + 'background-image': this.raw ? `url(${this.image.url})` : `url(${this.image.url}?thumbnail&size=512)` }; } }, diff --git a/src/client/app/desktop/views/components/media-video.vue b/src/client/app/desktop/views/components/media-video.vue index 4fd955a82..3635941e6 100644 --- a/src/client/app/desktop/views/components/media-video.vue +++ b/src/client/app/desktop/views/components/media-video.vue @@ -52,6 +52,7 @@ export default Vue.extend({ width 100% height 100% border-radius 4px + .mk-media-video-thumbnail display flex justify-content center diff --git a/src/client/app/desktop/views/components/note-detail.vue b/src/client/app/desktop/views/components/note-detail.vue index 5d07dc90d..a0e391514 100644 --- a/src/client/app/desktop/views/components/note-detail.vue +++ b/src/client/app/desktop/views/components/note-detail.vue @@ -39,7 +39,7 @@
- +
diff --git a/src/client/app/desktop/views/components/note-preview.vue b/src/client/app/desktop/views/components/note-preview.vue index 43eb15988..d04abfc5a 100644 --- a/src/client/app/desktop/views/components/note-preview.vue +++ b/src/client/app/desktop/views/components/note-preview.vue @@ -53,6 +53,7 @@ root(isDark) > header display flex + align-items baseline white-space nowrap > .name diff --git a/src/client/app/desktop/views/components/notes.note.sub.vue b/src/client/app/desktop/views/components/notes.note.sub.vue index 238fb0369..575d60520 100644 --- a/src/client/app/desktop/views/components/notes.note.sub.vue +++ b/src/client/app/desktop/views/components/notes.note.sub.vue @@ -65,6 +65,7 @@ root(isDark) > header display flex + align-items baseline margin-bottom 2px white-space nowrap line-height 21px diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index b512f78ec..9adbfc017 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -400,7 +400,7 @@ root(isDark) > header display flex - align-items center + align-items baseline margin-bottom 4px white-space nowrap diff --git a/src/client/app/mobile/views/components/media-image.vue b/src/client/app/mobile/views/components/media-image.vue index cfc213498..92d1cdc6f 100644 --- a/src/client/app/mobile/views/components/media-image.vue +++ b/src/client/app/mobile/views/components/media-image.vue @@ -6,12 +6,20 @@ import Vue from 'vue'; export default Vue.extend({ - props: ['image'], + props: { + image: { + type: Object, + required: true + }, + raw: { + default: false + } + }, computed: { style(): any { return { 'background-color': this.image.properties.avgColor ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent', - 'background-image': `url(${this.image.url}?thumbnail&size=512)` + 'background-image': this.raw ? `url(${this.image.url})` : `url(${this.image.url}?thumbnail&size=512)` }; } } diff --git a/src/client/app/mobile/views/components/note-detail.sub.vue b/src/client/app/mobile/views/components/note-detail.sub.vue index 34ff06db3..e515fda8a 100644 --- a/src/client/app/mobile/views/components/note-detail.sub.vue +++ b/src/client/app/mobile/views/components/note-detail.sub.vue @@ -55,6 +55,7 @@ root(isDark) > header display flex + align-items baseline margin-bottom 4px white-space nowrap diff --git a/src/client/app/mobile/views/components/note-detail.vue b/src/client/app/mobile/views/components/note-detail.vue index b9bd9fe49..5a7226faa 100644 --- a/src/client/app/mobile/views/components/note-detail.vue +++ b/src/client/app/mobile/views/components/note-detail.vue @@ -37,7 +37,7 @@ {{ tag }}
- +
diff --git a/src/client/app/mobile/views/components/note-preview.vue b/src/client/app/mobile/views/components/note-preview.vue index e9fe9b1bd..ec11f2331 100644 --- a/src/client/app/mobile/views/components/note-preview.vue +++ b/src/client/app/mobile/views/components/note-preview.vue @@ -49,6 +49,7 @@ root(isDark) > header display flex + align-items baseline margin-bottom 4px white-space nowrap diff --git a/src/client/app/mobile/views/components/note.sub.vue b/src/client/app/mobile/views/components/note.sub.vue index 251b377fb..82025291d 100644 --- a/src/client/app/mobile/views/components/note.sub.vue +++ b/src/client/app/mobile/views/components/note.sub.vue @@ -69,6 +69,7 @@ root(isDark) > header display flex + align-items baseline margin-bottom 2px white-space nowrap diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue index f3aab49bb..401ffa278 100644 --- a/src/client/app/mobile/views/components/note.vue +++ b/src/client/app/mobile/views/components/note.vue @@ -333,7 +333,7 @@ root(isDark) > header display flex - align-items center + align-items baseline white-space nowrap @media (min-width 500px) diff --git a/src/client/app/mobile/views/components/notification.vue b/src/client/app/mobile/views/components/notification.vue index 13ca95075..c1b37563c 100644 --- a/src/client/app/mobile/views/components/notification.vue +++ b/src/client/app/mobile/views/components/notification.vue @@ -124,7 +124,7 @@ root(isDark) > header display flex - align-items center + align-items baseline white-space nowrap i, .mk-reaction-icon