Merge branch 'develop'
This commit is contained in:
		
						commit
						d423f8ae57
					
				
					 7 changed files with 19 additions and 47 deletions
				
			
		| 
						 | 
					@ -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)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	"name": "misskey",
 | 
						"name": "misskey",
 | 
				
			||||||
	"author": "syuilo <i@syuilo.com>",
 | 
						"author": "syuilo <i@syuilo.com>",
 | 
				
			||||||
	"version": "8.14.0",
 | 
						"version": "8.15.0",
 | 
				
			||||||
	"clientVersion": "1.0.9022",
 | 
						"clientVersion": "1.0.9031",
 | 
				
			||||||
	"codename": "nighthike",
 | 
						"codename": "nighthike",
 | 
				
			||||||
	"main": "./built/index.js",
 | 
						"main": "./built/index.js",
 | 
				
			||||||
	"private": true,
 | 
						"private": true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,7 @@
 | 
				
			||||||
		<h1>%fa:heart%%i18n:@title%</h1>
 | 
							<h1>%fa:heart%%i18n:@title%</h1>
 | 
				
			||||||
		<p>
 | 
							<p>
 | 
				
			||||||
			{{ '%i18n:@text%'.substr(0, '%i18n:@text%'.indexOf('{')) }}
 | 
								{{ '%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) }}
 | 
								{{ '%i18n:@text%'.substr('%i18n:@text%'.indexOf('}') + 1) }}
 | 
				
			||||||
		</p>
 | 
							</p>
 | 
				
			||||||
	</article>
 | 
						</article>
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,17 @@
 | 
				
			||||||
import define from '../../../common/define-widget';
 | 
					import define from '../../../common/define-widget';
 | 
				
			||||||
export default define({
 | 
					export default define({
 | 
				
			||||||
	name: 'donation'
 | 
						name: 'donation'
 | 
				
			||||||
 | 
					}).extend({
 | 
				
			||||||
 | 
						data() {
 | 
				
			||||||
 | 
							return {
 | 
				
			||||||
 | 
								meta: null
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						created() {
 | 
				
			||||||
 | 
							(this as any).os.getMeta().then(meta => {
 | 
				
			||||||
 | 
								this.meta = meta;
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,5 +53,5 @@ export default function load() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function normalizeUrl(url: string) {
 | 
					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;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@ import * as mongo from 'mongodb';
 | 
				
			||||||
import db from '../db/mongodb';
 | 
					import db from '../db/mongodb';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Stats = db.get<IStats>('stats');
 | 
					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 default Stats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IStats {
 | 
					export interface IStats {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@ function getUserToken(ctx: Koa.Context) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function compareOrigin(ctx: Koa.Context) {
 | 
					function compareOrigin(ctx: Koa.Context) {
 | 
				
			||||||
	function normalizeUrl(url: string) {
 | 
						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'];
 | 
						const referer = ctx.headers['referer'];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,7 @@ function trim(text, g) {
 | 
				
			||||||
export default function(src) {
 | 
					export default function(src) {
 | 
				
			||||||
	const fn = options => {
 | 
						const fn = options => {
 | 
				
			||||||
		const search = options.search;
 | 
							const search = options.search;
 | 
				
			||||||
		const g = search[search.length - 1] == 'g';
 | 
							const g = search.endsWith('g');
 | 
				
			||||||
		const file = this.resourcePath.replace(/\\/g, '/');
 | 
							const file = this.resourcePath.replace(/\\/g, '/');
 | 
				
			||||||
		const replace = options.i18n ? global[options.replace].bind(null, {
 | 
							const replace = options.i18n ? global[options.replace].bind(null, {
 | 
				
			||||||
			src: file,
 | 
								src: file,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue