Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
funkwhale
funkwhale
Merge requests
!1898
Refactor NodeInfo Endpoint to use proper serializer
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Refactor NodeInfo Endpoint to use proper serializer
node_info_serializer
into
develop
Overview
11
Commits
17
Pipelines
42
Changes
6
Merged
Georg Krause
requested to merge
node_info_serializer
into
develop
2 years ago
Overview
3
Commits
17
Pipelines
42
Changes
6
Expand
Check for new spectacular warnings and fix them
Make sure the endpoint does behave like before
Fix tests
Edited
2 years ago
by
Georg Krause
0
0
Merge request reports
Compare
develop
version 21
5a8bcd63
2 years ago
version 20
3dc70182
2 years ago
version 19
40906496
2 years ago
version 18
faf09ef5
2 years ago
version 17
d72ec94c
2 years ago
version 16
2b9b8960
2 years ago
version 15
1a71f3f3
2 years ago
version 14
20999b3c
2 years ago
version 13
dc70e9c2
2 years ago
version 12
9be8c0d7
2 years ago
version 11
06007fa0
2 years ago
version 10
f7c5de31
2 years ago
version 9
9acedbbb
2 years ago
version 8
1be0169d
2 years ago
version 7
34bc26c6
2 years ago
version 6
d017bd9d
2 years ago
version 5
09838631
2 years ago
version 4
16e08335
2 years ago
version 3
f1f751e1
2 years ago
version 2
2eac294f
2 years ago
version 1
12afdfaa
2 years ago
develop (base)
and
latest version
latest version
7a178bc6
17 commits,
2 years ago
version 21
5a8bcd63
16 commits,
2 years ago
version 20
3dc70182
17 commits,
2 years ago
version 19
40906496
16 commits,
2 years ago
version 18
faf09ef5
16 commits,
2 years ago
version 17
d72ec94c
15 commits,
2 years ago
version 16
2b9b8960
15 commits,
2 years ago
version 15
1a71f3f3
13 commits,
2 years ago
version 14
20999b3c
13 commits,
2 years ago
version 13
dc70e9c2
11 commits,
2 years ago
version 12
9be8c0d7
11 commits,
2 years ago
version 11
06007fa0
10 commits,
2 years ago
version 10
f7c5de31
9 commits,
2 years ago
version 9
9acedbbb
9 commits,
2 years ago
version 8
1be0169d
9 commits,
2 years ago
version 7
34bc26c6
8 commits,
2 years ago
version 6
d017bd9d
7 commits,
2 years ago
version 5
09838631
6 commits,
2 years ago
version 4
16e08335
4 commits,
2 years ago
version 3
f1f751e1
1 commit,
2 years ago
version 2
2eac294f
1 commit,
2 years ago
version 1
12afdfaa
21 commits,
2 years ago
6 files
+
347
−
291
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
api/funkwhale_api/instance/nodeinfo.py deleted
100644 → 0
+
0
−
100
Options
from
cache_memoize
import
cache_memoize
from
django.urls
import
reverse
import
funkwhale_api
from
funkwhale_api.common
import
preferences
from
funkwhale_api.federation
import
actors
,
models
as
federation_models
from
funkwhale_api.federation
import
utils
as
federation_utils
from
funkwhale_api.moderation
import
models
as
moderation_models
from
funkwhale_api.music
import
utils
as
music_utils
from
.
import
stats
def
get
():
all_preferences
=
preferences
.
all
()
share_stats
=
all_preferences
.
get
(
"
instance__nodeinfo_stats_enabled
"
)
allow_list_enabled
=
all_preferences
.
get
(
"
moderation__allow_list_enabled
"
)
allow_list_public
=
all_preferences
.
get
(
"
moderation__allow_list_public
"
)
auth_required
=
all_preferences
.
get
(
"
common__api_authentication_required
"
)
banner
=
all_preferences
.
get
(
"
instance__banner
"
)
unauthenticated_report_types
=
all_preferences
.
get
(
"
moderation__unauthenticated_report_types
"
)
if
allow_list_enabled
and
allow_list_public
:
allowed_domains
=
list
(
federation_models
.
Domain
.
objects
.
filter
(
allowed
=
True
)
.
order_by
(
"
name
"
)
.
values_list
(
"
name
"
,
flat
=
True
)
)
else
:
allowed_domains
=
None
data
=
{
"
version
"
:
"
2.0
"
,
"
software
"
:
{
"
name
"
:
"
funkwhale
"
,
"
version
"
:
funkwhale_api
.
__version__
},
"
protocols
"
:
[
"
activitypub
"
],
"
services
"
:
{
"
inbound
"
:
[],
"
outbound
"
:
[]},
"
openRegistrations
"
:
all_preferences
.
get
(
"
users__registration_enabled
"
),
"
usage
"
:
{
"
users
"
:
{
"
total
"
:
0
,
"
activeHalfyear
"
:
0
,
"
activeMonth
"
:
0
}},
"
metadata
"
:
{
"
actorId
"
:
actors
.
get_service_actor
().
fid
,
"
private
"
:
all_preferences
.
get
(
"
instance__nodeinfo_private
"
),
"
shortDescription
"
:
all_preferences
.
get
(
"
instance__short_description
"
),
"
longDescription
"
:
all_preferences
.
get
(
"
instance__long_description
"
),
"
rules
"
:
all_preferences
.
get
(
"
instance__rules
"
),
"
contactEmail
"
:
all_preferences
.
get
(
"
instance__contact_email
"
),
"
terms
"
:
all_preferences
.
get
(
"
instance__terms
"
),
"
nodeName
"
:
all_preferences
.
get
(
"
instance__name
"
),
"
banner
"
:
federation_utils
.
full_url
(
banner
.
url
)
if
banner
else
None
,
"
defaultUploadQuota
"
:
all_preferences
.
get
(
"
users__upload_quota
"
),
"
library
"
:
{
"
federationEnabled
"
:
all_preferences
.
get
(
"
federation__enabled
"
),
"
anonymousCanListen
"
:
not
all_preferences
.
get
(
"
common__api_authentication_required
"
),
},
"
supportedUploadExtensions
"
:
music_utils
.
SUPPORTED_EXTENSIONS
,
"
allowList
"
:
{
"
enabled
"
:
allow_list_enabled
,
"
domains
"
:
allowed_domains
},
"
reportTypes
"
:
[
{
"
type
"
:
t
,
"
label
"
:
l
,
"
anonymous
"
:
t
in
unauthenticated_report_types
}
for
t
,
l
in
moderation_models
.
REPORT_TYPES
],
"
funkwhaleSupportMessageEnabled
"
:
all_preferences
.
get
(
"
instance__funkwhale_support_message_enabled
"
),
"
instanceSupportMessage
"
:
all_preferences
.
get
(
"
instance__support_message
"
),
"
endpoints
"
:
{
"
knownNodes
"
:
None
,
"
channels
"
:
None
,
"
libraries
"
:
None
},
},
}
if
share_stats
:
getter
=
cache_memoize
(
600
,
prefix
=
"
memoize:instance:stats
"
)(
stats
.
get
)
statistics
=
getter
()
data
[
"
usage
"
][
"
users
"
][
"
total
"
]
=
statistics
[
"
users
"
][
"
total
"
]
data
[
"
usage
"
][
"
users
"
][
"
activeHalfyear
"
]
=
statistics
[
"
users
"
][
"
active_halfyear
"
]
data
[
"
usage
"
][
"
users
"
][
"
activeMonth
"
]
=
statistics
[
"
users
"
][
"
active_month
"
]
data
[
"
metadata
"
][
"
library
"
][
"
tracks
"
]
=
{
"
total
"
:
statistics
[
"
tracks
"
]}
data
[
"
metadata
"
][
"
library
"
][
"
artists
"
]
=
{
"
total
"
:
statistics
[
"
artists
"
]}
data
[
"
metadata
"
][
"
library
"
][
"
albums
"
]
=
{
"
total
"
:
statistics
[
"
albums
"
]}
data
[
"
metadata
"
][
"
library
"
][
"
music
"
]
=
{
"
hours
"
:
statistics
[
"
music_duration
"
]}
data
[
"
metadata
"
][
"
usage
"
]
=
{
"
favorites
"
:
{
"
tracks
"
:
{
"
total
"
:
statistics
[
"
track_favorites
"
]}},
"
listenings
"
:
{
"
total
"
:
statistics
[
"
listenings
"
]},
"
downloads
"
:
{
"
total
"
:
statistics
[
"
downloads
"
]},
}
if
not
auth_required
:
data
[
"
metadata
"
][
"
endpoints
"
][
"
knownNodes
"
]
=
federation_utils
.
full_url
(
reverse
(
"
api:v1:federation:domains-list
"
)
)
if
not
auth_required
and
preferences
.
get
(
"
federation__public_index
"
):
data
[
"
metadata
"
][
"
endpoints
"
][
"
libraries
"
]
=
federation_utils
.
full_url
(
reverse
(
"
federation:index:index-libraries
"
)
)
data
[
"
metadata
"
][
"
endpoints
"
][
"
channels
"
]
=
federation_utils
.
full_url
(
reverse
(
"
federation:index:index-channels
"
)
)
return
data
Loading