Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
e2cefb7f
Unverified
Commit
e2cefb7f
authored
3 years ago
by
xianon
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
NodeInfo にユーザー数と投稿数の情報を追加する (#8126)
parent
4ee859b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/backend/src/server/nodeinfo.ts
+16
-16
16 additions, 16 deletions
packages/backend/src/server/nodeinfo.ts
with
16 additions
and
16 deletions
packages/backend/src/server/nodeinfo.ts
+
16
−
16
View file @
e2cefb7f
import
*
as
Router
from
'
@koa/router
'
;
import
config
from
'
@/config/index
'
;
import
{
fetchMeta
}
from
'
@/misc/fetch-meta
'
;
import
{
Users
}
from
'
@/models/index
'
;
// import User from '../models/user';
// import Note from '../models/note';
import
{
Users
,
Notes
}
from
'
@/models/index
'
;
import
{
Not
,
IsNull
,
MoreThan
}
from
'
typeorm
'
;
const
router
=
new
Router
();
...
...
@@ -19,20 +18,21 @@ export const links = [/* (awaiting release) {
}];
const
nodeinfo2
=
async
()
=>
{
const
now
=
Date
.
now
();
const
[
meta
,
//
total,
//
activeHalfyear,
//
activeMonth,
//
localPosts,
//
localComments
total
,
activeHalfyear
,
activeMonth
,
localPosts
,
localComments
,
]
=
await
Promise
.
all
([
fetchMeta
(
true
),
//
User.count({ host: null }),
//
User.count({ host: null, updatedAt:
{ $gt:
new Date(
Date.
now
()
- 15552000000) } }),
//
User.count({ host: null, updatedAt:
{ $gt:
new Date(
Date.
now
()
- 2592000000) } }),
//
Note.count({
'_
user
.h
ost
'
: null, replyId: null }),
//
Note.count({
'_
user
.h
ost
'
: null, replyId:
{ $ne: null
} })
User
s
.
count
({
where
:
{
host
:
null
}
}),
User
s
.
count
({
where
:
{
host
:
null
,
updatedAt
:
MoreThan
(
new
Date
(
now
-
15552000000
)
)
}
}),
User
s
.
count
({
where
:
{
host
:
null
,
updatedAt
:
MoreThan
(
new
Date
(
now
-
2592000000
)
)
}
}),
Note
s
.
count
({
where
:
{
user
H
ost
:
null
,
replyId
:
null
}
}),
Note
s
.
count
({
where
:
{
user
H
ost
:
null
,
replyId
:
Not
(
IsNull
())
}
})
,
]);
const
proxyAccount
=
meta
.
proxyAccountId
?
await
Users
.
pack
(
meta
.
proxyAccountId
).
catch
(()
=>
null
)
:
null
;
...
...
@@ -50,9 +50,9 @@ const nodeinfo2 = async () => {
},
openRegistrations
:
!
meta
.
disableRegistration
,
usage
:
{
users
:
{},
//
{ total, activeHalfyear, activeMonth },
//
localPosts,
//
localComments
users
:
{
total
,
activeHalfyear
,
activeMonth
},
localPosts
,
localComments
,
},
metadata
:
{
nodeName
:
meta
.
name
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment