mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	fix: NodeInfo のユーザー数と投稿数の内容を見直す (#8255)
* NodeInfoのアクティブユーザーの取得方法を変更する * NodeInfoの投稿数の出力内容を見直す
This commit is contained in:
		
							parent
							
								
									be15c8f437
								
							
						
					
					
						commit
						08d0a45ee7
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		| 
						 | 
					@ -2,7 +2,7 @@ import * as Router from '@koa/router';
 | 
				
			||||||
import config from '@/config/index';
 | 
					import config from '@/config/index';
 | 
				
			||||||
import { fetchMeta } from '@/misc/fetch-meta';
 | 
					import { fetchMeta } from '@/misc/fetch-meta';
 | 
				
			||||||
import { Users, Notes } from '@/models/index';
 | 
					import { Users, Notes } from '@/models/index';
 | 
				
			||||||
import { Not, IsNull, MoreThan } from 'typeorm';
 | 
					import { MoreThan } from 'typeorm';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const router = new Router();
 | 
					const router = new Router();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,14 +25,12 @@ const nodeinfo2 = async () => {
 | 
				
			||||||
		activeHalfyear,
 | 
							activeHalfyear,
 | 
				
			||||||
		activeMonth,
 | 
							activeMonth,
 | 
				
			||||||
		localPosts,
 | 
							localPosts,
 | 
				
			||||||
		localComments,
 | 
					 | 
				
			||||||
	] = await Promise.all([
 | 
						] = await Promise.all([
 | 
				
			||||||
		fetchMeta(true),
 | 
							fetchMeta(true),
 | 
				
			||||||
		Users.count({ where: { host: null } }),
 | 
							Users.count({ where: { host: null } }),
 | 
				
			||||||
		Users.count({ where: { host: null, updatedAt: MoreThan(new Date(now - 15552000000)) } }),
 | 
							Users.count({ where: { host: null, lastActiveDate: MoreThan(new Date(now - 15552000000)) } }),
 | 
				
			||||||
		Users.count({ where: { host: null, updatedAt: MoreThan(new Date(now - 2592000000)) } }),
 | 
							Users.count({ where: { host: null, lastActiveDate: MoreThan(new Date(now - 2592000000)) } }),
 | 
				
			||||||
		Notes.count({ where: { userHost: null, replyId: null } }),
 | 
							Notes.count({ where: { userHost: null } }),
 | 
				
			||||||
		Notes.count({ where: { userHost: null, replyId: Not(IsNull()) } }),
 | 
					 | 
				
			||||||
	]);
 | 
						]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const proxyAccount = meta.proxyAccountId ? await Users.pack(meta.proxyAccountId).catch(() => null) : null;
 | 
						const proxyAccount = meta.proxyAccountId ? await Users.pack(meta.proxyAccountId).catch(() => null) : null;
 | 
				
			||||||
| 
						 | 
					@ -52,7 +50,7 @@ const nodeinfo2 = async () => {
 | 
				
			||||||
		usage: {
 | 
							usage: {
 | 
				
			||||||
			users: { total, activeHalfyear, activeMonth },
 | 
								users: { total, activeHalfyear, activeMonth },
 | 
				
			||||||
			localPosts,
 | 
								localPosts,
 | 
				
			||||||
			localComments,
 | 
								localComments: 0,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		metadata: {
 | 
							metadata: {
 | 
				
			||||||
			nodeName: meta.name,
 | 
								nodeName: meta.name,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue