Merge branch 'develop'

This commit is contained in:
syuilo 2018-08-27 04:56:57 +09:00
commit 8910a4bc0c
7 changed files with 19 additions and 47 deletions

View File

@ -1,40 +0,0 @@
const { default: User, deleteUser } = require('../built/models/user');
const { default: zip } = require('@prezzemolo/zip')
const migrate = async (user) => {
try {
await deleteUser(user._id);
return true;
} catch (e) {
return false;
}
}
async function main() {
const count = await User.count({
uri: /#/
});
const dop = 1
const idop = ((count - (count % dop)) / dop) + 1
return zip(
1,
async (time) => {
console.log(`${time} / ${idop}`)
const doc = await User.find({
uri: /#/
}, {
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)

View File

@ -1,8 +1,8 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"version": "8.14.0",
"clientVersion": "1.0.9022",
"version": "8.15.0",
"clientVersion": "1.0.9031",
"codename": "nighthike",
"main": "./built/index.js",
"private": true,

View File

@ -4,7 +4,7 @@
<h1>%fa:heart%%i18n:@title%</h1>
<p>
{{ '%i18n:@text%'.substr(0, '%i18n:@text%'.indexOf('{')) }}
<a href="https://syuilo.com">@syuilo</a>
<a :href="meta.maintainer.url">{{ meta.maintainer.name }}</a>
{{ '%i18n:@text%'.substr('%i18n:@text%'.indexOf('}') + 1) }}
</p>
</article>
@ -15,6 +15,17 @@
import define from '../../../common/define-widget';
export default define({
name: 'donation'
}).extend({
data() {
return {
meta: null
};
},
created() {
(this as any).os.getMeta().then(meta => {
this.meta = meta;
});
}
});
</script>

View File

@ -53,5 +53,5 @@ export default function load() {
}
function normalizeUrl(url: string) {
return url[url.length - 1] === '/' ? url.substr(0, url.length - 1) : url;
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
}

View File

@ -2,7 +2,8 @@ import * as mongo from 'mongodb';
import db from '../db/mongodb';
const Stats = db.get<IStats>('stats');
Stats.createIndex({ date: -1 }, { unique: true });
Stats.dropIndex({ date: -1 }); // 後方互換性のため
Stats.createIndex({ span: -1, date: -1 }, { unique: true });
export default Stats;
export interface IStats {

View File

@ -14,7 +14,7 @@ function getUserToken(ctx: Koa.Context) {
function compareOrigin(ctx: Koa.Context) {
function normalizeUrl(url: string) {
return url[url.length - 1] === '/' ? url.substr(0, url.length - 1) : url;
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
}
const referer = ctx.headers['referer'];

View File

@ -7,7 +7,7 @@ function trim(text, g) {
export default function(src) {
const fn = options => {
const search = options.search;
const g = search[search.length - 1] == 'g';
const g = search.endsWith('g');
const file = this.resourcePath.replace(/\\/g, '/');
const replace = options.i18n ? global[options.replace].bind(null, {
src: file,