Fix #200: Instances can now indicate on the nodeinfo endpoint if they want to remain private
This commit is contained in:
parent
ceccaa1387
commit
1974c17e76
|
@ -85,6 +85,20 @@ class InstanceNodeinfoEnabled(types.BooleanPreference):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@global_preferences_registry.register
|
||||||
|
class InstanceNodeinfoPrivate(types.BooleanPreference):
|
||||||
|
show_in_api = False
|
||||||
|
section = instance
|
||||||
|
name = 'nodeinfo_private'
|
||||||
|
default = False
|
||||||
|
verbose_name = 'Enable nodeinfo endpoint'
|
||||||
|
help_text = (
|
||||||
|
'Indicate in the nodeinfo endpoint that you do not want your instance'
|
||||||
|
'to be tracked by third-party services.'
|
||||||
|
'There is no guarantee these tools will honor this setting though.'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@global_preferences_registry.register
|
@global_preferences_registry.register
|
||||||
class InstanceNodeinfoStatsEnabled(types.BooleanPreference):
|
class InstanceNodeinfoStatsEnabled(types.BooleanPreference):
|
||||||
show_in_api = False
|
show_in_api = False
|
||||||
|
|
|
@ -12,6 +12,7 @@ memo = memoize.Memoizer(store, namespace='instance:stats')
|
||||||
|
|
||||||
def get():
|
def get():
|
||||||
share_stats = preferences.get('instance__nodeinfo_stats_enabled')
|
share_stats = preferences.get('instance__nodeinfo_stats_enabled')
|
||||||
|
private = preferences.get('instance__nodeinfo_private')
|
||||||
data = {
|
data = {
|
||||||
'version': '2.0',
|
'version': '2.0',
|
||||||
'software': {
|
'software': {
|
||||||
|
@ -30,6 +31,7 @@ def get():
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'metadata': {
|
'metadata': {
|
||||||
|
'private': preferences.get('instance__nodeinfo_private'),
|
||||||
'shortDescription': preferences.get('instance__short_description'),
|
'shortDescription': preferences.get('instance__short_description'),
|
||||||
'longDescription': preferences.get('instance__long_description'),
|
'longDescription': preferences.get('instance__long_description'),
|
||||||
'nodeName': preferences.get('instance__name'),
|
'nodeName': preferences.get('instance__name'),
|
||||||
|
|
|
@ -36,6 +36,7 @@ def test_nodeinfo_dump(preferences, mocker):
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'metadata': {
|
'metadata': {
|
||||||
|
'private': preferences['instance__nodeinfo_private'],
|
||||||
'shortDescription': preferences['instance__short_description'],
|
'shortDescription': preferences['instance__short_description'],
|
||||||
'longDescription': preferences['instance__long_description'],
|
'longDescription': preferences['instance__long_description'],
|
||||||
'nodeName': preferences['instance__name'],
|
'nodeName': preferences['instance__name'],
|
||||||
|
@ -92,6 +93,7 @@ def test_nodeinfo_dump_stats_disabled(preferences, mocker):
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'metadata': {
|
'metadata': {
|
||||||
|
'private': preferences['instance__nodeinfo_private'],
|
||||||
'shortDescription': preferences['instance__short_description'],
|
'shortDescription': preferences['instance__short_description'],
|
||||||
'longDescription': preferences['instance__long_description'],
|
'longDescription': preferences['instance__long_description'],
|
||||||
'nodeName': preferences['instance__name'],
|
'nodeName': preferences['instance__name'],
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Instances can now indicate on the nodeinfo endpoint if they want to remain private (#200)
|
Loading…
Reference in New Issue