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
c04d3d22
Commit
c04d3d22
authored
2 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
feat(api): add federation/stats endpoint
parent
164d4a98
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/backend/src/server/api/endpoints.ts
+2
-0
2 additions, 0 deletions
packages/backend/src/server/api/endpoints.ts
packages/backend/src/server/api/endpoints/federation/stats.ts
+49
-0
49 additions, 0 deletions
...ages/backend/src/server/api/endpoints/federation/stats.ts
with
51 additions
and
0 deletions
packages/backend/src/server/api/endpoints.ts
+
2
−
0
View file @
c04d3d22
...
...
@@ -135,6 +135,7 @@ import * as ep___federation_instances from './endpoints/federation/instances.js'
import
*
as
ep___federation_showInstance
from
'
./endpoints/federation/show-instance.js
'
;
import
*
as
ep___federation_updateRemoteUser
from
'
./endpoints/federation/update-remote-user.js
'
;
import
*
as
ep___federation_users
from
'
./endpoints/federation/users.js
'
;
import
*
as
ep___federation_stats
from
'
./endpoints/federation/stats.js
'
;
import
*
as
ep___following_create
from
'
./endpoints/following/create.js
'
;
import
*
as
ep___following_delete
from
'
./endpoints/following/delete.js
'
;
import
*
as
ep___following_invalidate
from
'
./endpoints/following/invalidate.js
'
;
...
...
@@ -447,6 +448,7 @@ const eps = [
[
'
federation/show-instance
'
,
ep___federation_showInstance
],
[
'
federation/update-remote-user
'
,
ep___federation_updateRemoteUser
],
[
'
federation/users
'
,
ep___federation_users
],
[
'
federation/stats
'
,
ep___federation_stats
],
[
'
following/create
'
,
ep___following_create
],
[
'
following/delete
'
,
ep___following_delete
],
[
'
following/invalidate
'
,
ep___following_invalidate
],
...
...
This diff is collapsed.
Click to expand it.
packages/backend/src/server/api/endpoints/federation/stats.ts
0 → 100644
+
49
−
0
View file @
c04d3d22
import
{
MoreThan
}
from
'
typeorm
'
;
import
{
Instances
}
from
'
@/models/index.js
'
;
import
{
awaitAll
}
from
'
@/prelude/await-all.js
'
;
import
define
from
'
../../define.js
'
;
export
const
meta
=
{
tags
:
[
'
federation
'
],
requireCredential
:
false
,
allowGet
:
true
,
cacheSec
:
60
*
60
,
}
as const
;
export
const
paramDef
=
{
type
:
'
object
'
,
properties
:
{
},
required
:
[],
}
as const
;
// eslint-disable-next-line import/no-default-export
export
default
define
(
meta
,
paramDef
,
async
(
ps
)
=>
{
const
[
topSubInstances
,
topPubInstances
]
=
await
Promise
.
all
([
Instances
.
find
({
where
:
{
followersCount
:
MoreThan
(
0
),
},
order
:
{
followersCount
:
'
DESC
'
,
},
take
:
10
,
}),
Instances
.
find
({
where
:
{
followingCount
:
MoreThan
(
0
),
},
order
:
{
followingCount
:
'
DESC
'
,
},
take
:
10
,
}),
]);
return
await
awaitAll
({
topSubInstances
:
Instances
.
packMany
(
topSubInstances
),
topPubInstances
:
Instances
.
packMany
(
topPubInstances
),
});
});
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