2.0.0
This commit is contained in:
parent
f62603fd9d
commit
b5acf15877
18 changed files with 109 additions and 74 deletions
57
migration/2.0.0.js
Normal file
57
migration/2.0.0.js
Normal file
|
@ -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);
|
|
@ -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)
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "1.7.0",
|
||||
"clientVersion": "1.0.5175",
|
||||
"version": "2.0.0",
|
||||
"clientVersion": "1.0.5184",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="mk-media-list" :data-count="mediaList.length">
|
||||
<template v-for="media in mediaList">
|
||||
<mk-media-video :video="media" :key="media.id" v-if="media.type.startsWith('video')" :inline-playable="mediaList.length === 1"/>
|
||||
<mk-media-image :image="media" :key="media.id" v-else />
|
||||
<mk-media-image :image="media" :key="media.id" v-else :raw="raw"/>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -11,7 +11,14 @@
|
|||
import Vue from 'vue';
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['mediaList'],
|
||||
props: {
|
||||
mediaList: {
|
||||
required: true
|
||||
},
|
||||
raw: {
|
||||
default: false
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<section v-if="invitations.length > 0">
|
||||
<h2>対局の招待があります!:</h2>
|
||||
<div class="invitation" v-for="i in invitations" tabindex="-1" @click="accept(i)">
|
||||
<img :src="`${i.parent.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<mk-avatar class="avatar" :user="i.parent"/>
|
||||
<span class="name"><b>{{ i.parent.name }}</b></span>
|
||||
<span class="username">@{{ i.parent.username }}</span>
|
||||
<mk-time :time="i.createdAt"/>
|
||||
|
@ -40,8 +40,8 @@
|
|||
<section v-if="myGames.length > 0">
|
||||
<h2>自分の対局</h2>
|
||||
<a class="game" v-for="g in myGames" tabindex="-1" @click.prevent="go(g)" :href="`/othello/${g.id}`">
|
||||
<img :src="`${g.user1.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<img :src="`${g.user2.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<mk-avatar class="avatar" :user="g.user1.avatarUrl"/>
|
||||
<mk-avatar class="avatar" :user="g.user2.avatarUrl"/>
|
||||
<span><b>{{ g.user1.name }}</b> vs <b>{{ g.user2.name }}</b></span>
|
||||
<span class="state">{{ g.isEnded ? '終了' : '進行中' }}</span>
|
||||
</a>
|
||||
|
@ -49,8 +49,8 @@
|
|||
<section v-if="games.length > 0">
|
||||
<h2>みんなの対局</h2>
|
||||
<a class="game" v-for="g in games" tabindex="-1" @click.prevent="go(g)" :href="`/othello/${g.id}`">
|
||||
<img :src="`${g.user1.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<img :src="`${g.user2.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<mk-avatar class="avatar" :user="g.user1.avatarUrl"/>
|
||||
<mk-avatar class="avatar" :user="g.user2.avatarUrl"/>
|
||||
<span><b>{{ g.user1.name }}</b> vs <b>{{ g.user2.name }}</b></span>
|
||||
<span class="state">{{ g.isEnded ? '終了' : '進行中' }}</span>
|
||||
</a>
|
||||
|
@ -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
|
||||
|
|
|
@ -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)`
|
||||
};
|
||||
}
|
||||
},
|
||||
|
|
|
@ -52,6 +52,7 @@ export default Vue.extend({
|
|||
width 100%
|
||||
height 100%
|
||||
border-radius 4px
|
||||
|
||||
.mk-media-video-thumbnail
|
||||
display flex
|
||||
justify-content center
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<mk-note-html v-if="p.text" :text="p.text" :i="os.i"/>
|
||||
</div>
|
||||
<div class="media" v-if="p.media.length > 0">
|
||||
<mk-media-list :media-list="p.media"/>
|
||||
<mk-media-list :media-list="p.media" :raw="true"/>
|
||||
</div>
|
||||
<mk-poll v-if="p.poll" :note="p"/>
|
||||
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
|
||||
|
|
|
@ -53,6 +53,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
white-space nowrap
|
||||
|
||||
> .name
|
||||
|
|
|
@ -65,6 +65,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 2px
|
||||
white-space nowrap
|
||||
line-height 21px
|
||||
|
|
|
@ -400,7 +400,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items center
|
||||
align-items baseline
|
||||
margin-bottom 4px
|
||||
white-space nowrap
|
||||
|
||||
|
|
|
@ -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)`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 4px
|
||||
white-space nowrap
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link>
|
||||
</div>
|
||||
<div class="media" v-if="p.media.length > 0">
|
||||
<mk-media-list :media-list="p.media"/>
|
||||
<mk-media-list :media-list="p.media" :raw="true"/>
|
||||
</div>
|
||||
<mk-poll v-if="p.poll" :note="p"/>
|
||||
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
|
||||
|
|
|
@ -49,6 +49,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 4px
|
||||
white-space nowrap
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 2px
|
||||
white-space nowrap
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items center
|
||||
align-items baseline
|
||||
white-space nowrap
|
||||
|
||||
@media (min-width 500px)
|
||||
|
|
|
@ -124,7 +124,7 @@ root(isDark)
|
|||
|
||||
> header
|
||||
display flex
|
||||
align-items center
|
||||
align-items baseline
|
||||
white-space nowrap
|
||||
|
||||
i, .mk-reaction-icon
|
||||
|
|
Loading…
Reference in a new issue